sysdecode_enum(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– 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_enum
  • sysdecode_acltype
  • sysdecode_atfd
  • sysdecode_extattrnamespace
  • sysdecode_fadvice
  • sysdecode_fcntl_cmd
  • sysdecode_getfsstat_mode
  • sysdecode_getrusage_who
  • sysdecode_idtype
  • sysdecode_ipproto
  • sysdecode_itimer
  • sysdecode_kldsym_cmd
  • sysdecode_kldunload_flags
  • sysdecode_lio_listio_mode
  • sysdecode_madvice
  • sysdecode_minherit_flags
  • sysdecode_msgctl_cmd
  • sysdecode_nfssvc_flags
  • sysdecode_pathconf_name
  • sysdecode_prio_which
  • sysdecode_procctl_cmd
  • sysdecode_ptrace_request
  • sysdecode_rlimit
  • sysdecode_rtprio_function
  • sysdecode_scheduler_policy
  • sysdecode_sctp_pr_policy
  • sysdecode_sctp_sinfo_flags
  • sysdecode_semctl_cmd
  • sysdecode_shmctl_cmd
  • sysdecode_shutdown_how
  • sysdecode_sigbus_code
  • sysdecode_sigchld_code
  • sysdecode_sigfpe_code
  • sysdecode_sigill_code
  • sysdecode_signal
  • sysdecode_sigprocmask_how
  • sysdecode_sigsegv_code
  • sysdecode_sigtrap_code
  • sysdecode_sockaddr_family
  • sysdecode_socketdomain
  • sysdecode_sockettype
  • sysdecode_sockopt_level
  • sysdecode_sysarch_number
  • sysdecode_umtx_op
  • sysdecode_vmresult
  • sysdecode_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 call acl_get_file(3), argument type.
  • sysdecode_atfd() β€” system call openat(2), argument fd.
  • sysdecode_extattrnamespace() β€” system call extattr_get_fd(2), argument attrnamespace.
  • sysdecode_fadvice() β€” system call posix_fadvise(2), argument advice.
  • sysdecode_fcntl_cmd() β€” system call fcntl(2), argument cmd.
  • sysdecode_getfsstat_mode() β€” system call getfsstat(2), argument mode.
  • sysdecode_idtype() β€” system calls procctl(2), waitid(2); the table doesn't list an argument for this one.
  • sysdecode_itimer() β€” system calls getitimer(2), setitimer(2); no argument entry in the table here either.
  • sysdecode_kldsym_cmd() β€” system call kldsym(2), argument cmd.
  • sysdecode_kldunload_flags() β€” system call kldunloadf(2), argument flags.
  • sysdecode_lio_listio_mode() β€” system call lio_listio(2), argument mode.
  • sysdecode_madvice() β€” system call madvise(2), argument advice.
  • sysdecode_minherit_inherit() β€” system call minherit(2), argument inherit. (yes, this table row really says sysdecode_minherit_inherit().)
  • sysdecode_msgctl_cmd() β€” system call msgctl(2), argument cmd.
  • sysdecode_nfssvc_flags() β€” system call nfssvc(2), argument flags.
  • sysdecode_pathconf_name() β€” system call pathconf(2), argument name.
  • sysdecode_prio_which() β€” system call getpriority(2), argument which.
  • sysdecode_procctl_cmd() β€” system call procctl(2), argument cmd.
  • sysdecode_ptrace_request() β€” system call ptrace(2), argument request.
  • sysdecode_rlimit() β€” system call getrlimit(2), argument resource.
  • sysdecode_rtprio_function() β€” system call rtprio(2), argument function.
  • sysdecode_getrusage_who() β€” system call getrusage(2), argument who.
  • sysdecode_scheduler_policy() β€” system call sched_setscheduler(2), argument policy.
  • sysdecode_semctl_cmd() β€” system call semctl(2), argument cmd.
  • sysdecode_shmctl_cmd() β€” system call shmctl(2), argument cmd.
  • sysdecode_shutdown_how() β€” system call shutdown(2), argument how.
  • sysdecode_sigprocmask_how() β€” system call sigprocmask(2), argument how.
  • sysdecode_sockopt_level() β€” system call getsockopt(2), argument level.
  • sysdecode_sysarch_number() β€” system call sysarch(2), argument number.
  • sysdecode_umtx_op() β€” system call _umtx_op(2), argument op.
  • sysdecode_whence() β€” system call lseek(2), argument whence.

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() β€” SIGBUS
  • sysdecode_sigchld_code() β€” SIGCHLD
  • sysdecode_sigfpe_code() β€” SIGFPE
  • sysdecode_sigill_code() β€” SIGILL
  • sysdecode_sigsegv_code() β€” SIGSEGV
  • sysdecode_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