sysdecode_enum(3)
π NAME π
okay so this is sysdecode_enum(3), straight outta the Library Functions Manual, and it's literally the lookup-name squad for enumerated values. The whole function fam is:
sysdecode_enumsysdecode_acltypesysdecode_atfdsysdecode_extattrnamespacesysdecode_fadvicesysdecode_fcntl_cmdsysdecode_getfsstat_modesysdecode_getrusage_whosysdecode_idtypesysdecode_ipprotosysdecode_itimersysdecode_kldsym_cmdsysdecode_kldunload_flagssysdecode_lio_listio_modesysdecode_madvicesysdecode_minherit_flagssysdecode_msgctl_cmdsysdecode_nfssvc_flagssysdecode_pathconf_namesysdecode_prio_whichsysdecode_procctl_cmdsysdecode_ptrace_requestsysdecode_rlimitsysdecode_rtprio_functionsysdecode_scheduler_policysysdecode_sctp_pr_policysysdecode_sctp_sinfo_flagssysdecode_semctl_cmdsysdecode_shmctl_cmdsysdecode_shutdown_howsysdecode_sigbus_codesysdecode_sigchld_codesysdecode_sigfpe_codesysdecode_sigill_codesysdecode_signalsysdecode_sigprocmask_howsysdecode_sigsegv_codesysdecode_sigtrap_codesysdecode_sockaddr_familysysdecode_socketdomainsysdecode_sockettypesysdecode_sockopt_levelsysdecode_sysarch_numbersysdecode_umtx_opsysdecode_vmresultsysdecode_whence
and the whole vibe is: lookup name of various enumerated values. periodt.
π LIBRARY π
library βlibsysdecodeβ β that's the one, bestie.
β¨ SYNOPSIS β¨
okay so first you bring in the header:
#include <sysdecode.h>
then every single signature returns const char *. all of them. Here's the full stack:
const char *
sysdecode_acltype(int type);
const char *
sysdecode_atfd(int fd);
const char *
sysdecode_extattrnamespace(int namespace);
const char *
sysdecode_fadvice(int advice);
const char *
sysdecode_fcntl_cmd(int cmd);
const char *
sysdecode_getfsstat_mode(int mode);
const char *
sysdecode_getrusage_who(int who);
const char *
sysdecode_idtype(int idtype);
const char *
sysdecode_ipproto(int protocol);
const char *
sysdecode_itimer(int which);
const char *
sysdecode_kldsym_cmd(int cmd);
const char *
sysdecode_kldunload_flags(int flags);
const char *
sysdecode_lio_listio_mode(int mode);
const char *
sysdecode_madvice(int advice);
const char *
sysdecode_minherit_flags(int inherit);
const char *
sysdecode_msgctl_cmd(int cmd);
const char *
sysdecode_nfssvc_flags(int flags);
const char *
sysdecode_pathconf_name(int name);
const char *
sysdecode_prio_which(int which);
const char *
sysdecode_procctl_cmd(int cmd);
const char *
sysdecode_ptrace_request(int request);
const char *
sysdecode_rlimit(int resource);
const char *
sysdecode_rtprio_function(int function);
const char *
sysdecode_scheduler_policy(int policy);
const char *
sysdecode_sctp_pr_policy(int policy);
const char *
sysdecode_semctl_cmd(int cmd);
const char *
sysdecode_shmctl_cmd(int cmd);
const char *
sysdecode_shutdown_how(int how);
const char *
sysdecode_sigbus_code(int si_code);
const char *
sysdecode_sigchld_code(int si_code);
const char *
sysdecode_sigfpe_code(int si_code);
const char *
sysdecode_sigill_code(int si_code);
const char *
sysdecode_signal(int sig);
const char *
sysdecode_sigprocmask_how(int how);
const char *
sysdecode_sigsegv_code(int si_code);
const char *
sysdecode_sigtrap_code(int si_code);
const char *
sysdecode_sockaddr_family(int sa_family);
const char *
sysdecode_socketdomain(int domain);
const char *
sysdecode_sockettype(int type);
const char *
sysdecode_sockopt_level(int level);
const char *
sysdecode_sysarch_number(int number);
const char *
sysdecode_umtx_op(int op);
const char *
sysdecode_vmresult(int result);
const char *
sysdecode_whence(int whence);
π¦ DESCRIPTION π¦
The sysdecode_enum 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. NULL is returned if there is no matching C macro name.
Most of these functions decode an argument passed to a system call:
sysdecode_acltype()β system callacl_get_file(3), argumenttype.sysdecode_atfd()β system callopenat(2), argumentfd.sysdecode_extattrnamespace()β system callextattr_get_fd(2), argumentattrnamespace.sysdecode_fadvice()β system callposix_fadvise(2), argumentadvice.sysdecode_fcntl_cmd()β system callfcntl(2), argumentcmd.sysdecode_getfsstat_mode()β system callgetfsstat(2), argumentmode.sysdecode_idtype()β system callsprocctl(2),waitid(2); the table doesn't list an argument for this one.sysdecode_itimer()β system callsgetitimer(2),setitimer(2); no argument entry in the table here either.sysdecode_kldsym_cmd()β system callkldsym(2), argumentcmd.sysdecode_kldunload_flags()β system callkldunloadf(2), argumentflags.sysdecode_lio_listio_mode()β system calllio_listio(2), argumentmode.sysdecode_madvice()β system callmadvise(2), argumentadvice.sysdecode_minherit_inherit()β system callminherit(2), argumentinherit. (yes, this table row really sayssysdecode_minherit_inherit().)sysdecode_msgctl_cmd()β system callmsgctl(2), argumentcmd.sysdecode_nfssvc_flags()β system callnfssvc(2), argumentflags.sysdecode_pathconf_name()β system callpathconf(2), argumentname.sysdecode_prio_which()β system callgetpriority(2), argumentwhich.sysdecode_procctl_cmd()β system callprocctl(2), argumentcmd.sysdecode_ptrace_request()β system callptrace(2), argumentrequest.sysdecode_rlimit()β system callgetrlimit(2), argumentresource.sysdecode_rtprio_function()β system callrtprio(2), argumentfunction.sysdecode_getrusage_who()β system callgetrusage(2), argumentwho.sysdecode_scheduler_policy()β system callsched_setscheduler(2), argumentpolicy.sysdecode_semctl_cmd()β system callsemctl(2), argumentcmd.sysdecode_shmctl_cmd()β system callshmctl(2), argumentcmd.sysdecode_shutdown_how()β system callshutdown(2), argumenthow.sysdecode_sigprocmask_how()β system callsigprocmask(2), argumenthow.sysdecode_sockopt_level()β system callgetsockopt(2), argumentlevel.sysdecode_sysarch_number()β system callsysarch(2), argumentnumber.sysdecode_umtx_op()β system call_umtx_op(2), argumentop.sysdecode_whence()β system calllseek(2), argumentwhence.
These functions decode signal-specific signal codes stored in the si_code field of the siginfo_t object associated with an instance of signal:
sysdecode_sigbus_code()βSIGBUSsysdecode_sigchld_code()βSIGCHLDsysdecode_sigfpe_code()βSIGFPEsysdecode_sigill_code()βSIGILLsysdecode_sigsegv_code()βSIGSEGVsysdecode_sigtrap_code()βSIGTRAP
Other functions decode the values described below:
sysdecode_ipproto()β an IP protocol.sysdecode_sctp_pr_policy()β a PR-SCTP policy.sysdecode_signal()β a process signal.sysdecode_sockaddr_family()β a socket address family.sysdecode_socketdomain()β a socket domain.sysdecode_vmresult()β the return value of a function in the virtual memory subsystem of the kernel indicating the status of the associated request.
π RETURN VALUES π
The sysdecode_enum functions return the name of a matching C macro or NULL if no matching C macro was found. that's the whole tea.
π SEE ALSO π
with love from Debian, dated June 22, 2022, on the sysdecode_enum(3) page β mwah π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms