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