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 October 17, 2016 29.Dt sysdecode_enum 3 30.Os 31.Sh NAME 32.Nm sysdecode_enum , 33.Nm sysdecode_acltype , 34.Nm sysdecode_atfd , 35.Nm sysdecode_extattrnamespace , 36.Nm sysdecode_fadvice , 37.Nm sysdecode_fcntl_cmd , 38.Nm sysdecode_idtype , 39.Nm sysdecode_ipproto , 40.Nm sysdecode_kldsym_cmd , 41.Nm sysdecode_kldunload_flags , 42.Nm sysdecode_lio_listio_mode , 43.Nm sysdecode_madvice , 44.Nm sysdecode_minherit_flags , 45.Nm sysdecode_msgctl_cmd , 46.Nm sysdecode_nfssvc_flags , 47.Nm sysdecode_prio_which , 48.Nm sysdecode_procctl_cmd , 49.Nm sysdecode_ptrace_request , 50.Nm sysdecode_rlimit , 51.Nm sysdecode_rtprio_function , 52.Nm sysdecode_scheduler_policy , 53.Nm sysdecode_semctl_cmd , 54.Nm sysdecode_shmctl_cmd , 55.Nm sysdecode_shutdown_how , 56.Nm sysdecode_sigbus_code , 57.Nm sysdecode_sigchld_code , 58.Nm sysdecode_sigfpe_code , 59.Nm sysdecode_sigill_code , 60.Nm sysdecode_signal , 61.Nm sysdecode_sigprocmask_how , 62.Nm sysdecode_sigsegv_code , 63.Nm sysdecode_sigtrap_code , 64.Nm sysdecode_sockaddr_family , 65.Nm sysdecode_socketdomain , 66.Nm sysdecode_sockettype , 67.Nm sysdecode_sockopt_level , 68.Nm sysdecode_umtx_op , 69.Nm sysdecode_vmresult , 70.Nm sysdecode_whence 71.Nd lookup name of various enumerated values 72.Sh LIBRARY 73.Lb libsysdecode 74.Sh SYNOPSIS 75.In sys/types.h 76.In stdbool.h 77.In sysdecode.h 78.Ft const char * 79.Fn sysdecode_acltype "int type" 80.Ft const char * 81.Fn sysdecode_atfd "int fd" 82.Ft const char * 83.Fn sysdecode_extattrnamespace "int namespace" 84.Ft const char * 85.Fn sysdecode_fadvice "int advice" 86.Ft const char * 87.Fn sysdecode_fcntl_cmd "int cmd" 88.Ft const char * 89.Fn sysdecode_idtype "int idtype" 90.Ft const char * 91.Fn sysdecode_ipproto "int protocol" 92.Ft const char * 93.Fn sysdecode_kldsym_cmd "int cmd" 94.Ft const char * 95.Fn sysdecode_kldunload_flags "int flags" 96.Ft const char * 97.Fn sysdecode_lio_listio_mode "int mode" 98.Ft const char * 99.Fn sysdecode_madvice "int advice" 100.Ft const char * 101.Fn sysdecode_minherit_flags "int inherit" 102.Ft const char * 103.Fn sysdecode_msgctl_cmd "int cmd" 104.Ft const char * 105.Fn sysdecode_nfssvc_flags "int flags" 106.Ft const char * 107.Fn sysdecode_prio_which "int which" 108.Ft const char * 109.Fn sysdecode_procctl_cmd "int cmd" 110.Ft const char * 111.Fn sysdecode_ptrace_request "int request" 112.Ft const char * 113.Fn sysdecode_rlimit "int resource" 114.Ft const char * 115.Fn sysdecode_rtprio_function "int function" 116.Ft const char * 117.Fn sysdecode_scheduler_policy "int policy" 118.Ft const char * 119.Fn sysdecode_semctl_cmd "int cmd" 120.Ft const char * 121.Fn sysdecode_shmctl_cmd "int cmd" 122.Ft const char * 123.Fn sysdecode_shutdown_how "int how" 124.Ft const char * 125.Fn sysdecode_sigbus_code "int si_code" 126.Ft const char * 127.Fn sysdecode_sigchld_code "int si_code" 128.Ft const char * 129.Fn sysdecode_sigfpe_code "int si_code" 130.Ft const char * 131.Fn sysdecode_sigill_code "int si_code" 132.Ft const char * 133.Fn sysdecode_signal "int sig" 134.Ft const char * 135.Fn sysdecode_sigprocmask_how "int how" 136.Ft const char * 137.Fn sysdecode_sigsegv_code "int si_code" 138.Ft const char * 139.Fn sysdecode_sigtrap_code "int si_code" 140.Ft const char * 141.Fn sysdecode_sockaddr_family "int sa_family" 142.Ft const char * 143.Fn sysdecode_socketdomain "int domain" 144.Ft const char * 145.Fn sysdecode_sockettype "int type" 146.Ft const char * 147.Fn sysdecode_sockopt_level "int level" 148.Ft const char * 149.Fn sysdecode_umtx_op "int op" 150.Ft const char * 151.Fn sysdecode_vmresult "int result" 152.Ft const char * 153.Fn sysdecode_whence "int whence" 154.Sh DESCRIPTION 155The 156.Nm 157functions return a text description of an integer value. 158The text description matches the name of a C macro with the same value as the 159sole function argument. 160.Dv NULL 161is returned if there is no matching C macro name. 162.Pp 163Most of these functions decode an argument passed to a system call: 164.Bl -column "Fn sysdecode_extattrnamespace" "Xr sched_setscheduler 2" 165.It Sy Function Ta Sy System Call Ta Sy Argument 166.It Fn sysdecode_acltype Ta Xr acl_get_file 3 Ta Fa type 167.It Fn sysdecode_atfd Ta Xr openat 2 Ta Fa fd 168.It Fn sysdecode_extattrnamespace Ta Xr extattr_get_fd 2 Ta Fa attrnamespace 169.It Fn sysdecode_fadvice Ta Xr posix_fadvise 2 Ta Fa advice 170.It Fn sysdecode_fcntl_cmd Ta Xr fcntl 2 Ta Fa cmd 171.It Fn sysdecode_idtype Ta 172.Xr procctl 2 , 173.Xr waitid 2 174.Ta Fa idtype 175.It Fn sysdecode_kldsym_cmd Ta Xr kldsym 2 Ta Fa cmd 176.It Fn sysdecode_kldunload_flags Ta Xr kldunloadf 2 Ta Fa flags 177.It Fn sysdecode_lio_listio_mode Ta Xr lio_listio 2 Ta Fa mode 178.It Fn sysdecode_madvice Ta Xr madvise 2 Ta Fa advice 179.It Fn sysdecode_minherit_inherit Ta Xr minherit 2 Ta Fa inherit 180.It Fn sysdecode_msgctl_cmd Ta Xr msgctl 2 Ta Fa cmd 181.It Fn sysdecode_nfssvc_flags Ta Xr nfssvc 2 Ta Fa flags 182.It Fn sysdecode_prio_which Ta Xr getpriority 2 Ta Fa which 183.It Fn sysdecode_procctl_cmd Ta Xr procctl 2 Ta Fa cmd 184.It Fn sysdecode_ptrace_request Ta Xr ptrace 2 Ta Fa request 185.It Fn sysdecode_rlimit Ta Xr getrlimit 2 Ta Fa resource 186.It Fn sysdecode_rtprio_function Ta Xr rtprio 2 Ta Fa function 187.It Fn sysdecode_scheduler_policy Ta Xr sched_setscheduler 2 Ta Fa policy 188.It Fn sysdecode_semctl_cmd Ta Xr semctl 2 Ta Fa cmd 189.It Fn sysdecode_shmctl_cmd Ta Xr shmctl 2 Ta Fa cmd 190.It Fn sysdecode_shutdown_how Ta Xr shutdown 2 Ta Fa how 191.It Fn sysdecode_sigprocmask_how Ta Xr sigprocmask 2 Ta Fa how 192.It Fn sysdecode_sockopt_level Ta Xr getsockopt 2 Ta Fa level 193.It Fn sysdecode_umtx_op Ta Xr _umtx_op 2 Ta Fa op 194.It Fn sysdecode_whence Ta Xr lseek 2 Ta Fa whence 195.El 196.Pp 197These functions decode signal-specific signal codes stored in the 198.Fa si_code 199field of the 200.Vt siginfo_t 201object associated with an instance of signal: 202.Bl -column "Fn sysdecode_sigchld_code" 203.It Sy Function Ta Sy Signal 204.It Fn sysdecode_sigbus_code Ta Dv SIGBUS 205.It Fn sysdecode_sigchld_code Ta Dv SIGCHLD 206.It Fn sysdecode_sigfpe_code Ta Dv SIGFPE 207.It Fn sysdecode_sigill_code Ta Dv SIGILL 208.It Fn sysdecode_sigsegv_code Ta Dv SIGSEGV 209.It Fn sysdecode_sigtrap_code Ta Dv SIGBTRAP 210.El 211.Pp 212Other functions decode the values described below: 213.Bl -tag -width "Fn sysdecode_sockaddr_family" 214.It Fn sysdecode_ipproto 215An IP protocol. 216.It Fn sysdecode_signal 217A process signal. 218.It Fn sysdecode_sockaddr_family 219A socket address family. 220.It Fn sysdecode_socketdomain 221A socket domain. 222.It Fn sysdecode_vmresult 223The return value of a function in the virtual memory subsystem of the kernel 224indicating the status of the associated request. 225.El 226.Sh RETURN VALUES 227The 228.Nm 229functions return the name of a matching C macro or 230.Dv NULL 231if no matching C macro was found. 232.Sh SEE ALSO 233.Xr sysdecode 3 , 234.Xr sysdecode_mask 3 , 235.Xr sysdecode_sigcode 3 236