]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libsysdecode/sysdecode_mask.3
Import mandoc 1.14.3
[FreeBSD/FreeBSD.git] / lib / libsysdecode / sysdecode_mask.3
1 .\"
2 .\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org>
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd September 3, 2017
29 .Dt sysdecode_mask 3
30 .Os
31 .Sh NAME
32 .Nm sysdecode_mask ,
33 .Nm sysdecode_accessmode ,
34 .Nm sysdecode_atflags ,
35 .Nm sysdecode_capfcntlrights ,
36 .Nm sysdecode_fcntl_fileflags ,
37 .Nm sysdecode_fileflags ,
38 .Nm sysdecode_filemode ,
39 .Nm sysdecode_flock_operation ,
40 .Nm sysdecode_mlockall_flags ,
41 .Nm sysdecode_mmap_flags ,
42 .Nm sysdecode_mmap_prot ,
43 .Nm sysdecode_mount_flags ,
44 .Nm sysdecode_msg_flags ,
45 .Nm sysdecode_msync_flags ,
46 .Nm sysdecode_open_flags ,
47 .Nm sysdecode_pipe2_flags ,
48 .Nm sysdecode_reboot_howto ,
49 .Nm sysdecode_rfork_flags ,
50 .Nm sysdecode_semget_flags ,
51 .Nm sysdecode_sendfile_flags ,
52 .Nm sysdecode_shmat_flags ,
53 .Nm sysdecode_socket_type ,
54 .Nm sysdecode_thr_create_flags ,
55 .Nm sysdecode_umtx_cvwait_flags ,
56 .Nm sysdecode_umtx_rwlock_flags ,
57 .Nm sysdecode_vmprot ,
58 .Nm sysdecode_wait4_options ,
59 .Nm sysdecode_wait6_options
60 .Nd print name of various bitmask values
61 .Sh LIBRARY
62 .Lb libsysdecode
63 .Sh SYNOPSIS
64 .In sys/types.h
65 .In stdbool.h
66 .In sysdecode.h
67 .Ft bool
68 .Fn sysdecode_access_mode "FILE *fp" "int mode" "int *rem"
69 .Ft bool
70 .Fn sysdecode_atflags "FILE *fp" "int flags" "int *rem"
71 .Ft bool
72 .Fn sysdecode_cap_fcntlrights "FILE *fp" "uint32_t rights" "uint32_t *rem"
73 .Ft bool
74 .Fn sysdecode_fcntl_fileflags "FILE *fp" "int flags" "int *rem"
75 .Ft bool
76 .Fn sysdecode_fileflags "FILE *fp" "fflags_t flags" "fflags_t *rem"
77 .Ft bool
78 .Fn sysdecode_filemode "FILE *fp" "int mode" "int *rem"
79 .Ft bool
80 .Fn sysdecode_flock_operation "FILE *fp" "int operation" "int *rem"
81 .Ft bool
82 .Fn sysdecode_mlockall_flags "FILE *fp" "int flags" "int *rem"
83 .Ft bool
84 .Fn sysdecode_mmap_flags "FILE *fp" "int flags" "int *rem"
85 .Ft bool
86 .Fn sysdecode_mmap_prot "FILE *fp" "int prot" "int *rem"
87 .Ft bool
88 .Fn sysdecode_mount_flags "FILE *fp" "int flags" "int *rem"
89 .Ft bool
90 .Fn sysdecode_msg_flags "FILE *fp" "int flags" "int *rem"
91 .Ft bool
92 .Fn sysdecode_msync_flags "FILE *fp" "int flags" "int *rem"
93 .Ft bool
94 .Fn sysdecode_open_flags "FILE *fp" "int flags" "int *rem"
95 .Ft bool
96 .Fn sysdecode_pipe2_flags "FILE *fp" "int flags" "int *rem"
97 .Ft bool
98 .Fn sysdecode_reboot_howto "FILE *fp" "int howto" "int *rem"
99 .Ft bool
100 .Fn sysdecode_rfork_flags "FILE *fp" "int flags" "int *rem"
101 .Ft bool
102 .Fn sysdecode_semget_flags "FILE *fp" "int flags" "int *rem"
103 .Ft bool
104 .Fn sysdecode_sendfile_flags "FILE *fp" "int flags" "int *rem"
105 .Ft bool
106 .Fn sysdecode_shmat_flags "FILE *fp" "int flags" "int *rem"
107 .Ft bool
108 .Fn sysdecode_socket_type "FILE *fp" "int type" "int *rem"
109 .Ft bool
110 .Fn sysdecode_thr_create_flags "FILE *fp" "int flags" "int *rem"
111 .Ft bool
112 .Fn sysdecode_umtx_cvwait_flags "FILE *fp" "u_long flags" "u_long *rem"
113 .Ft bool
114 .Fn sysdecode_umtx_rwlock_flags "FILE *fp" "u_long flags" "u_long *rem"
115 .Ft bool
116 .Fn sysdecode_vmprot "FILE *fp" "int type" "int *rem"
117 .Ft bool
118 .Fn sysdecode_wait4_options "FILE *fp" "int options" "int *rem"
119 .Ft bool
120 .Fn sysdecode_wait6_options "FILE *fp" "int options" "int *rem"
121 .Sh DESCRIPTION
122 The
123 .Nm
124 functions are used to generate a text description of an integer value
125 built from a mask of bitfields.
126 The text description lists the C macros for field values joined by pipe
127 .Sq |
128 characters matching the format used in C source code.
129 Most of the values decoded by these functions are passed as arguments to
130 system calls,
131 though some of these values are used internally in the kernel.
132 .Pp
133 Each function writes the text description to
134 .Fa fp .
135 The second argument should contain the integer value to be decoded.
136 The
137 .Fa rem
138 argument is set to the value of any bits that were not decoded
139 .Pq bit fields that do not have a corresponding C macro .
140 .Fa rem
141 may be set to
142 .Dv NULL
143 if the caller does not need this value.
144 Each function returns
145 .Dv true
146 if any bit fields in the value were decoded and
147 .Dv false
148 if no bit fields were decoded.
149 .Pp
150 Most of these functions decode an argument passed to a system call:
151 .Bl -column "Fn sysdecode_flock_operation" "Xr cap_fcntls_limit 2"
152 .It Sy Function Ta Sy System Call Ta Sy Argument
153 .It Fn sysdecode_access_mode Ta Xr access 2 Ta Fa mode
154 .It Fn sysdecode_atflags Ta Xr chflagsat 2 , Xr fstatat 2 Ta Fa atflag , Fa flag
155 .It Fn sysdecode_cap_fcntlrights Ta Xr cap_fcntls_limit 2 Ta Fa fcntlrights
156 .It Fn sysdecode_fileflags Ta Xr chflags 2 Ta Fa flags
157 .It Fn sysdecode_filemode Ta Xr chmod 2 , Xr open 2 Ta mode
158 .It Fn sysdecode_flock_operation Ta Xr flock 2 Ta Fa operation
159 .It Fn sysdecode_mlockall_flags Ta Xr mlockall 2 Ta Fa flags
160 .It Fn sysdecode_mmap_flags Ta Xr mmap 2 Ta Fa flags
161 .It Fn sysdecode_mmap_prot Ta Xr mmap 2 Ta Fa prot
162 .It Fn sysdecode_mount_flags Ta Xr mount 2 Ta Fa flags
163 .It Fn sysdecode_msg_flags Ta Xr recv 2 , Xr send 2 Ta Fa flags
164 .It Fn sysdecode_msync_flags Ta Xr msync 2 Ta Fa flags
165 .It Fn sysdecode_open_flags Ta Xr open 2 Ta Fa flags
166 .It Fn sysdecode_pipe2_flags Ta Xr pipe2 Ta Fa flags
167 .It Fn sysdecode_reboot_howto Ta Xr reboot 2 Ta Fa howto
168 .It Fn sysdecode_rfork_flags Ta Xr rfork 2 Ta Fa flags
169 .It Fn sysdecode_semget_flags Ta Xr semget 2 Ta Fa flags
170 .It Fn sysdecode_sendfile_flags Ta Xr sendfile 2 Ta Fa flags
171 .It Fn sysdecode_shmat_flags Ta Xr shmat 2 Ta Fa flags
172 .It Fn sysdecode_socket_type Ta Xr socket 2 Ta Fa type
173 .It Fn sysdecode_thr_create_flags Ta Xr thr_create 2 Ta Fa flags
174 .It Fn sysdecode_wait4_options Ta Xr wait4 2 Ta Fa options
175 .It Fn sysdecode_wait6_options Ta Xr wait6 2 Ta Fa options
176 .El
177 .Pp
178 Other functions decode the values described below:
179 .Bl -tag -width ".Fn sysdecode_umtx_cvwait_flags"
180 .It Fn sysdecode_fcntl_fileflags
181 The file flags used with the
182 .Dv F_GETFL
183 and
184 .Dv F_SETFL
185 .Xr fcntl 2
186 commands.
187 .It Fn sysdecode_umtx_cvwait_flags
188 The
189 .Fa val
190 argument to
191 .Xr _umtx_op 2
192 for
193 .Dv UMTX_OP_CV_WAIT
194 operations.
195 .It Fn sysdecode_umtx_rwlock_flags
196 The
197 .Fa val
198 argument to
199 .Xr _umtx_op 2
200 for
201 .Dv UMTX_OP_RW_RDLOCK
202 operations.
203 .It Fn sysdecode_vmprot
204 The memory protection flags stored in
205 .Vt vm_prot_t
206 variables.
207 .El
208 .Sh RETURN VALUES
209 The
210 .Nm
211 functions return
212 .Dv true
213 if any bit fields in the value were decoded and
214 .Dv false
215 if no bit fields were decoded.
216 .Sh SEE ALSO
217 .Xr sysdecode 3 ,
218 .Xr sysdecode_enum 3