1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
.\"
.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 2, 2017
.Dt sysdecode_enum 3
.Os
.Sh NAME
.Nm sysdecode_enum ,
.Nm sysdecode_acltype ,
.Nm sysdecode_atfd ,
.Nm sysdecode_extattrnamespace ,
.Nm sysdecode_fadvice ,
.Nm sysdecode_fcntl_cmd ,
.Nm sysdecode_getfsstat_mode ,
.Nm sysdecode_idtype ,
.Nm sysdecode_ipproto ,
.Nm sysdecode_kldsym_cmd ,
.Nm sysdecode_kldunload_flags ,
.Nm sysdecode_lio_listio_mode ,
.Nm sysdecode_madvice ,
.Nm sysdecode_minherit_flags ,
.Nm sysdecode_msgctl_cmd ,
.Nm sysdecode_nfssvc_flags ,
.Nm sysdecode_prio_which ,
.Nm sysdecode_procctl_cmd ,
.Nm sysdecode_ptrace_request ,
.Nm sysdecode_rlimit ,
.Nm sysdecode_rtprio_function ,
.Nm sysdecode_scheduler_policy ,
.Nm sysdecode_semctl_cmd ,
.Nm sysdecode_shmctl_cmd ,
.Nm sysdecode_shutdown_how ,
.Nm sysdecode_sigbus_code ,
.Nm sysdecode_sigchld_code ,
.Nm sysdecode_sigfpe_code ,
.Nm sysdecode_sigill_code ,
.Nm sysdecode_signal ,
.Nm sysdecode_sigprocmask_how ,
.Nm sysdecode_sigsegv_code ,
.Nm sysdecode_sigtrap_code ,
.Nm sysdecode_sockaddr_family ,
.Nm sysdecode_socketdomain ,
.Nm sysdecode_sockettype ,
.Nm sysdecode_sockopt_level ,
.Nm sysdecode_umtx_op ,
.Nm sysdecode_vmresult ,
.Nm sysdecode_whence
.Nd lookup name of various enumerated values
.Sh LIBRARY
.Lb libsysdecode
.Sh SYNOPSIS
.In sys/types.h
.In stdbool.h
.In sysdecode.h
.Ft const char *
.Fn sysdecode_acltype "int type"
.Ft const char *
.Fn sysdecode_atfd "int fd"
.Ft const char *
.Fn sysdecode_extattrnamespace "int namespace"
.Ft const char *
.Fn sysdecode_fadvice "int advice"
.Ft const char *
.Fn sysdecode_fcntl_cmd "int cmd"
.Ft const char *
.Fn sysdecode_getfsstat_mode "int mode"
.Ft const char *
.Fn sysdecode_idtype "int idtype"
.Ft const char *
.Fn sysdecode_ipproto "int protocol"
.Ft const char *
.Fn sysdecode_kldsym_cmd "int cmd"
.Ft const char *
.Fn sysdecode_kldunload_flags "int flags"
.Ft const char *
.Fn sysdecode_lio_listio_mode "int mode"
.Ft const char *
.Fn sysdecode_madvice "int advice"
.Ft const char *
.Fn sysdecode_minherit_flags "int inherit"
.Ft const char *
.Fn sysdecode_msgctl_cmd "int cmd"
.Ft const char *
.Fn sysdecode_nfssvc_flags "int flags"
.Ft const char *
.Fn sysdecode_prio_which "int which"
.Ft const char *
.Fn sysdecode_procctl_cmd "int cmd"
.Ft const char *
.Fn sysdecode_ptrace_request "int request"
.Ft const char *
.Fn sysdecode_rlimit "int resource"
.Ft const char *
.Fn sysdecode_rtprio_function "int function"
.Ft const char *
.Fn sysdecode_scheduler_policy "int policy"
.Ft const char *
.Fn sysdecode_semctl_cmd "int cmd"
.Ft const char *
.Fn sysdecode_shmctl_cmd "int cmd"
.Ft const char *
.Fn sysdecode_shutdown_how "int how"
.Ft const char *
.Fn sysdecode_sigbus_code "int si_code"
.Ft const char *
.Fn sysdecode_sigchld_code "int si_code"
.Ft const char *
.Fn sysdecode_sigfpe_code "int si_code"
.Ft const char *
.Fn sysdecode_sigill_code "int si_code"
.Ft const char *
.Fn sysdecode_signal "int sig"
.Ft const char *
.Fn sysdecode_sigprocmask_how "int how"
.Ft const char *
.Fn sysdecode_sigsegv_code "int si_code"
.Ft const char *
.Fn sysdecode_sigtrap_code "int si_code"
.Ft const char *
.Fn sysdecode_sockaddr_family "int sa_family"
.Ft const char *
.Fn sysdecode_socketdomain "int domain"
.Ft const char *
.Fn sysdecode_sockettype "int type"
.Ft const char *
.Fn sysdecode_sockopt_level "int level"
.Ft const char *
.Fn sysdecode_umtx_op "int op"
.Ft const char *
.Fn sysdecode_vmresult "int result"
.Ft const char *
.Fn sysdecode_whence "int whence"
.Sh DESCRIPTION
The
.Nm
functions return a text description of an integer value.
The text description matches the name of a C macro with the same value as the
sole function argument.
.Dv NULL
is returned if there is no matching C macro name.
.Pp
Most of these functions decode an argument passed to a system call:
.Bl -column "Fn sysdecode_extattrnamespace" "Xr sched_setscheduler 2"
.It Sy Function Ta Sy System Call Ta Sy Argument
.It Fn sysdecode_acltype Ta Xr acl_get_file 3 Ta Fa type
.It Fn sysdecode_atfd Ta Xr openat 2 Ta Fa fd
.It Fn sysdecode_extattrnamespace Ta Xr extattr_get_fd 2 Ta Fa attrnamespace
.It Fn sysdecode_fadvice Ta Xr posix_fadvise 2 Ta Fa advice
.It Fn sysdecode_fcntl_cmd Ta Xr fcntl 2 Ta Fa cmd
.It Fn sysdecode_getfsstat_mode Ta Xr getfsstat 2 Ta Fa mode
.It Fn sysdecode_idtype Ta
.Xr procctl 2 ,
.Xr waitid 2
.Ta Fa idtype
.It Fn sysdecode_kldsym_cmd Ta Xr kldsym 2 Ta Fa cmd
.It Fn sysdecode_kldunload_flags Ta Xr kldunloadf 2 Ta Fa flags
.It Fn sysdecode_lio_listio_mode Ta Xr lio_listio 2 Ta Fa mode
.It Fn sysdecode_madvice Ta Xr madvise 2 Ta Fa advice
.It Fn sysdecode_minherit_inherit Ta Xr minherit 2 Ta Fa inherit
.It Fn sysdecode_msgctl_cmd Ta Xr msgctl 2 Ta Fa cmd
.It Fn sysdecode_nfssvc_flags Ta Xr nfssvc 2 Ta Fa flags
.It Fn sysdecode_prio_which Ta Xr getpriority 2 Ta Fa which
.It Fn sysdecode_procctl_cmd Ta Xr procctl 2 Ta Fa cmd
.It Fn sysdecode_ptrace_request Ta Xr ptrace 2 Ta Fa request
.It Fn sysdecode_rlimit Ta Xr getrlimit 2 Ta Fa resource
.It Fn sysdecode_rtprio_function Ta Xr rtprio 2 Ta Fa function
.It Fn sysdecode_scheduler_policy Ta Xr sched_setscheduler 2 Ta Fa policy
.It Fn sysdecode_semctl_cmd Ta Xr semctl 2 Ta Fa cmd
.It Fn sysdecode_shmctl_cmd Ta Xr shmctl 2 Ta Fa cmd
.It Fn sysdecode_shutdown_how Ta Xr shutdown 2 Ta Fa how
.It Fn sysdecode_sigprocmask_how Ta Xr sigprocmask 2 Ta Fa how
.It Fn sysdecode_sockopt_level Ta Xr getsockopt 2 Ta Fa level
.It Fn sysdecode_umtx_op Ta Xr _umtx_op 2 Ta Fa op
.It Fn sysdecode_whence Ta Xr lseek 2 Ta Fa whence
.El
.Pp
These functions decode signal-specific signal codes stored in the
.Fa si_code
field of the
.Vt siginfo_t
object associated with an instance of signal:
.Bl -column "Fn sysdecode_sigchld_code"
.It Sy Function Ta Sy Signal
.It Fn sysdecode_sigbus_code Ta Dv SIGBUS
.It Fn sysdecode_sigchld_code Ta Dv SIGCHLD
.It Fn sysdecode_sigfpe_code Ta Dv SIGFPE
.It Fn sysdecode_sigill_code Ta Dv SIGILL
.It Fn sysdecode_sigsegv_code Ta Dv SIGSEGV
.It Fn sysdecode_sigtrap_code Ta Dv SIGBTRAP
.El
.Pp
Other functions decode the values described below:
.Bl -tag -width "Fn sysdecode_sockaddr_family"
.It Fn sysdecode_ipproto
An IP protocol.
.It Fn sysdecode_signal
A process signal.
.It Fn sysdecode_sockaddr_family
A socket address family.
.It Fn sysdecode_socketdomain
A socket domain.
.It Fn sysdecode_vmresult
The return value of a function in the virtual memory subsystem of the kernel
indicating the status of the associated request.
.El
.Sh RETURN VALUES
The
.Nm
functions return the name of a matching C macro or
.Dv NULL
if no matching C macro was found.
.Sh SEE ALSO
.Xr sysdecode 3 ,
.Xr sysdecode_mask 3 ,
.Xr sysdecode_sigcode 3
|