Index: stable/11/lib/libsysdecode/Makefile =================================================================== --- stable/11/lib/libsysdecode/Makefile (revision 332243) +++ stable/11/lib/libsysdecode/Makefile (revision 332244) @@ -1,138 +1,139 @@ # $FreeBSD$ .include PACKAGE=lib${LIB} LIB= sysdecode SRCS= errno.c flags.c ioctl.c signal.c syscallnames.c utrace.c INCS= sysdecode.h CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${SRCTOP}/sys CFLAGS+= -I${SRCTOP}/libexec/rtld-elf MAN= sysdecode.3 \ sysdecode_abi_to_freebsd_errno.3 \ sysdecode_cap_rights.3 \ sysdecode_enum.3 \ sysdecode_fcntl_arg.3 \ sysdecode_kevent.3 \ sysdecode_ioctlname.3 \ sysdecode_mask.3 \ sysdecode_quotactl_cmd.3 \ + sysdecode_sctp_sinfo_flags.3 \ sysdecode_sigcode.3 \ sysdecode_sockopt_name.3 \ sysdecode_socket_protocol.3 \ sysdecode_syscallnames.3 \ sysdecode_utrace.3 MLINKS= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.3 MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \ sysdecode_enum.3 sysdecode_atfd.3 \ sysdecode_enum.3 sysdecode_extattrnamespace.3 \ sysdecode_enum.3 sysdecode_fadvice.3 \ sysdecode_enum.3 sysdecode_fcntl_cmd.3 \ sysdecode_enum.3 sysdecode_getfsstat_mode.3 \ sysdecode_enum.3 sysdecode_getrusage_who.3 \ sysdecode_enum.3 sysdecode_idtype.3 \ sysdecode_enum.3 sysdecode_ipproto.3 \ sysdecode_enum.3 sysdecode_kldsym_cmd.3 \ sysdecode_enum.3 sysdecode_kldunload_flags.3 \ sysdecode_enum.3 sysdecode_lio_listio_mode.3 \ sysdecode_enum.3 sysdecode_madvice.3 \ sysdecode_enum.3 sysdecode_minherit_flags.3 \ sysdecode_enum.3 sysdecode_msgctl_cmd.3 \ sysdecode_enum.3 sysdecode_nfssvc_flags.3 \ sysdecode_enum.3 sysdecode_pathconf_name.3 \ sysdecode_enum.3 sysdecode_prio_which.3 \ sysdecode_enum.3 sysdecode_procctl_cmd.3 \ sysdecode_enum.3 sysdecode_ptrace_request.3 \ sysdecode_enum.3 sysdecode_rlimit.3 \ sysdecode_enum.3 sysdecode_rtprio_function.3 \ sysdecode_enum.3 sysdecode_scheduler_policy.3 \ sysdecode_enum.3 sysdecode_sctp_pr_policy.3 \ sysdecode_enum.3 sysdecode_semctl_cmd.3 \ sysdecode_enum.3 sysdecode_shmctl_cmd.3 \ sysdecode_enum.3 sysdecode_shutdown_how.3 \ sysdecode_enum.3 sysdecode_sigbus_code.3 \ sysdecode_enum.3 sysdecode_sigchld_code.3 \ sysdecode_enum.3 sysdecode_sigfpe_code.3 \ sysdecode_enum.3 sysdecode_sigill_code.3 \ sysdecode_enum.3 sysdecode_signal.3 \ sysdecode_enum.3 sysdecode_sigprocmask_how.3 \ sysdecode_enum.3 sysdecode_sigsegv_code.3 \ sysdecode_enum.3 sysdecode_sigtrap_code.3 \ sysdecode_enum.3 sysdecode_sockaddr_family.3 \ sysdecode_enum.3 sysdecode_socketdomain.3 \ sysdecode_enum.3 sysdecode_sockettype.3 \ sysdecode_enum.3 sysdecode_sockopt_level.3 \ sysdecode_enum.3 sysdecode_sysarch_number.3 \ sysdecode_enum.3 sysdecode_umtx_op.3 \ sysdecode_enum.3 sysdecode_vmresult.3 \ sysdecode_enum.3 sysdecode_whence.3 MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3 MLINKS+=sysdecode_kevent.3 sysdecode_kevent_fflags.3 \ sysdecode_kevent.3 sysdecode_kevent_filter.3 \ sysdecode_kevent.3 sysdecode_kevent_flags.3 MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \ sysdecode_mask.3 sysdecode_atflags.3 \ sysdecode_mask.3 sysdecode_capfcntlrights.3 \ sysdecode_mask.3 sysdecode_fcntl_fileflags.3 \ sysdecode_mask.3 sysdecode_fileflags.3 \ sysdecode_mask.3 sysdecode_filemode.3 \ sysdecode_mask.3 sysdecode_flock_operation.3 \ sysdecode_mask.3 sysdecode_mlockall_flags.3 \ sysdecode_mask.3 sysdecode_mmap_flags.3 \ sysdecode_mask.3 sysdecode_mmap_prot.3 \ sysdecode_mask.3 sysdecode_mount_flags.3 \ sysdecode_mask.3 sysdecode_msg_flags.3 \ sysdecode_mask.3 sysdecode_msync_flags.3 \ sysdecode_mask.3 sysdecode_open_flags.3 \ sysdecode_mask.3 sysdecode_pipe2_flags.3 \ sysdecode_mask.3 sysdecode_reboot_howto.3 \ sysdecode_mask.3 sysdecode_rfork_flags.3 \ sysdecode_mask.3 sysdecode_semget_flags.3 \ sysdecode_mask.3 sysdecode_sendfile_flags.3 \ sysdecode_mask.3 sysdecode_shmat_flags.3 \ sysdecode_mask.3 sysdecode_socket_type.3 \ sysdecode_mask.3 sysdecode_thr_create_flags.3 \ sysdecode_mask.3 sysdecode_umtx_cvwait_flags.3 \ sysdecode_mask.3 sysdecode_umtx_rwlock_flags.3 \ sysdecode_mask.3 sysdecode_vmprot.3 \ sysdecode_mask.3 sysdecode_wait4_options.3 \ sysdecode_mask.3 sysdecode_wait6_options.3 CLEANFILES= ioctl.c tables.h .if defined(COMPAT_32BIT) CPP+= -m32 .endif .if ${MK_PF} != "no" CFLAGS+=-DPF .endif # Workaround duplicate declarations in CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls # Workaround warning for unused ssi_cables[] in CFLAGS.gcc.ioctl.c+= -Wno-unused CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}} DEPENDOBJS+= tables.h tables.h: mktables sh ${.CURDIR}/mktables ${DESTDIR}${INCLUDEDIR} ${.TARGET} # mkioctls runs find(1) for headers so needs to rebuild every time. This used # to be a hack only done in buildworld. .if !defined(_SKIP_BUILD) ioctl.c: .PHONY .endif ioctl.c: mkioctls .META env MACHINE=${MACHINE} CPP="${CPP}" MK_PF="${MK_PF}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} beforedepend: ioctl.c tables.h .include Index: stable/11/lib/libsysdecode/flags.c =================================================================== --- stable/11/lib/libsysdecode/flags.c (revision 332243) +++ stable/11/lib/libsysdecode/flags.c (revision 332244) @@ -1,1165 +1,1193 @@ /* * Copyright (c) 2006 "David Kirchner" . 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. */ #include __FBSDID("$FreeBSD$"); #define L2CAP_SOCKET_CHECKED #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* * This is taken from the xlat tables originally in truss which were * in turn taken from strace. */ struct name_table { uintmax_t val; const char *str; }; #define X(a) { a, #a }, #define XEND { 0, NULL } #define TABLE_START(n) static struct name_table n[] = { #define TABLE_ENTRY X #define TABLE_END XEND }; #include "tables.h" #undef TABLE_START #undef TABLE_ENTRY #undef TABLE_END /* * These are simple support macros. print_or utilizes a variable * defined in the calling function to track whether or not it should * print a logical-OR character ('|') before a string. if_print_or * simply handles the necessary "if" statement used in many lines * of this file. */ #define print_or(fp,str,orflag) do { \ if (orflag) fputc(fp, '|'); else orflag = true; \ fprintf(fp, str); } \ while (0) #define if_print_or(fp,i,flag,orflag) do { \ if ((i & flag) == flag) \ print_or(fp,#flag,orflag); } \ while (0) static const char * lookup_value(struct name_table *table, uintmax_t val) { for (; table->str != NULL; table++) if (table->val == val) return (table->str); return (NULL); } /* * Used when the value maps to a bitmask of #definition values in the * table. This is a helper routine which outputs a symbolic mask of * matched masks. Multiple masks are separated by a pipe ('|'). * The value is modified on return to only hold unmatched bits. */ static void print_mask_part(FILE *fp, struct name_table *table, uintmax_t *valp, bool *printed) { uintmax_t rem; rem = *valp; for (; table->str != NULL; table++) { if ((table->val & rem) == table->val) { /* * Only print a zero mask if the raw value is * zero. */ if (table->val == 0 && *valp != 0) continue; fprintf(fp, "%s%s", *printed ? "|" : "", table->str); *printed = true; rem &= ~table->val; } } *valp = rem; } /* * Used when the value maps to a bitmask of #definition values in the * table. The return value is true if something was printed. If * rem is not NULL, *rem holds any bits not decoded if something was * printed. If nothing was printed and rem is not NULL, *rem holds * the original value. */ static bool print_mask_int(FILE *fp, struct name_table *table, int ival, int *rem) { uintmax_t val; bool printed; printed = false; val = (unsigned)ival; print_mask_part(fp, table, &val, &printed); if (rem != NULL) *rem = val; return (printed); } /* * Used for a mask of optional flags where a value of 0 is valid. */ static bool print_mask_0(FILE *fp, struct name_table *table, int val, int *rem) { if (val == 0) { fputs("0", fp); if (rem != NULL) *rem = 0; return (true); } return (print_mask_int(fp, table, val, rem)); } /* * Like print_mask_0 but for a unsigned long instead of an int. */ static bool print_mask_0ul(FILE *fp, struct name_table *table, u_long lval, u_long *rem) { uintmax_t val; bool printed; if (lval == 0) { fputs("0", fp); if (rem != NULL) *rem = 0; return (true); } printed = false; val = lval; print_mask_part(fp, table, &val, &printed); if (rem != NULL) *rem = val; return (printed); } static void print_integer(FILE *fp, int val, int base) { switch (base) { case 8: fprintf(fp, "0%o", val); break; case 10: fprintf(fp, "%d", val); break; case 16: fprintf(fp, "0x%x", val); break; default: abort2("bad base", 0, NULL); break; } } static bool print_value(FILE *fp, struct name_table *table, uintmax_t val) { const char *str; str = lookup_value(table, val); if (str != NULL) { fputs(str, fp); return (true); } return (false); } const char * sysdecode_atfd(int fd) { if (fd == AT_FDCWD) return ("AT_FDCWD"); return (NULL); } bool sysdecode_atflags(FILE *fp, int flag, int *rem) { return (print_mask_int(fp, atflags, flag, rem)); } static struct name_table semctlops[] = { X(GETNCNT) X(GETPID) X(GETVAL) X(GETALL) X(GETZCNT) X(SETVAL) X(SETALL) X(IPC_RMID) X(IPC_SET) X(IPC_STAT) XEND }; const char * sysdecode_semctl_cmd(int cmd) { return (lookup_value(semctlops, cmd)); } static struct name_table shmctlops[] = { X(IPC_RMID) X(IPC_SET) X(IPC_STAT) XEND }; const char * sysdecode_shmctl_cmd(int cmd) { return (lookup_value(shmctlops, cmd)); } const char * sysdecode_msgctl_cmd(int cmd) { return (sysdecode_shmctl_cmd(cmd)); } static struct name_table semgetflags[] = { X(IPC_CREAT) X(IPC_EXCL) X(SEM_R) X(SEM_A) X((SEM_R>>3)) X((SEM_A>>3)) X((SEM_R>>6)) X((SEM_A>>6)) XEND }; bool sysdecode_semget_flags(FILE *fp, int flag, int *rem) { return (print_mask_int(fp, semgetflags, flag, rem)); } static struct name_table idtypes[] = { X(P_PID) X(P_PPID) X(P_PGID) X(P_SID) X(P_CID) X(P_UID) X(P_GID) X(P_ALL) X(P_LWPID) X(P_TASKID) X(P_PROJID) X(P_POOLID) X(P_JAILID) X(P_CTID) X(P_CPUID) X(P_PSETID) XEND }; /* XXX: idtype is really an idtype_t */ const char * sysdecode_idtype(int idtype) { return (lookup_value(idtypes, idtype)); } /* * [g|s]etsockopt's level argument can either be SOL_SOCKET or a * protocol-specific value. */ const char * sysdecode_sockopt_level(int level) { const char *str; if (level == SOL_SOCKET) return ("SOL_SOCKET"); /* SOL_* constants for Bluetooth sockets. */ str = lookup_value(ngbtsolevel, level); if (str != NULL) return (str); /* * IP and Infiniband sockets use IP protocols as levels. Not all * protocols are valid but it is simpler to just allow all of them. * * XXX: IPPROTO_IP == 0, but UNIX domain sockets use a level of 0 * for private options. */ str = sysdecode_ipproto(level); if (str != NULL) return (str); return (NULL); } bool sysdecode_vmprot(FILE *fp, int type, int *rem) { return (print_mask_int(fp, vmprot, type, rem)); } static struct name_table sockflags[] = { X(SOCK_CLOEXEC) X(SOCK_NONBLOCK) XEND }; bool sysdecode_socket_type(FILE *fp, int type, int *rem) { const char *str; uintmax_t val; bool printed; str = lookup_value(socktype, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)); if (str != NULL) { fputs(str, fp); *rem = 0; printed = true; } else { *rem = type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK); printed = false; } val = type & (SOCK_CLOEXEC | SOCK_NONBLOCK); print_mask_part(fp, sockflags, &val, &printed); return (printed); } bool sysdecode_access_mode(FILE *fp, int mode, int *rem) { return (print_mask_int(fp, accessmode, mode, rem)); } /* XXX: 'type' is really an acl_type_t. */ const char * sysdecode_acltype(int type) { return (lookup_value(acltype, type)); } bool sysdecode_cap_fcntlrights(FILE *fp, uint32_t rights, uint32_t *rem) { return (print_mask_int(fp, capfcntl, rights, rem)); } const char * sysdecode_extattrnamespace(int namespace) { return (lookup_value(extattrns, namespace)); } const char * sysdecode_fadvice(int advice) { return (lookup_value(fadvisebehav, advice)); } bool sysdecode_open_flags(FILE *fp, int flags, int *rem) { bool printed; int mode; uintmax_t val; mode = flags & O_ACCMODE; flags &= ~O_ACCMODE; switch (mode) { case O_RDONLY: if (flags & O_EXEC) { flags &= ~O_EXEC; fputs("O_EXEC", fp); } else fputs("O_RDONLY", fp); printed = true; mode = 0; break; case O_WRONLY: fputs("O_WRONLY", fp); printed = true; mode = 0; break; case O_RDWR: fputs("O_RDWR", fp); printed = true; mode = 0; break; default: printed = false; } val = (unsigned)flags; print_mask_part(fp, openflags, &val, &printed); if (rem != NULL) *rem = val | mode; return (printed); } bool sysdecode_fcntl_fileflags(FILE *fp, int flags, int *rem) { bool printed; int oflags; /* * The file flags used with F_GETFL/F_SETFL mostly match the * flags passed to open(2). However, a few open-only flag * bits have been repurposed for fcntl-only flags. */ oflags = flags & ~(O_NOFOLLOW | FRDAHEAD); printed = sysdecode_open_flags(fp, oflags, rem); if (flags & O_NOFOLLOW) { fprintf(fp, "%sFPOIXSHM", printed ? "|" : ""); printed = true; } if (flags & FRDAHEAD) { fprintf(fp, "%sFRDAHEAD", printed ? "|" : ""); printed = true; } return (printed); } bool sysdecode_flock_operation(FILE *fp, int operation, int *rem) { return (print_mask_int(fp, flockops, operation, rem)); } static struct name_table getfsstatmode[] = { X(MNT_WAIT) X(MNT_NOWAIT) XEND }; const char * sysdecode_getfsstat_mode(int mode) { return (lookup_value(getfsstatmode, mode)); } const char * sysdecode_getrusage_who(int who) { return (lookup_value(rusage, who)); } static struct name_table kevent_user_ffctrl[] = { X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) XEND }; static struct name_table kevent_rdwr_fflags[] = { X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND }; static struct name_table kevent_vnode_fflags[] = { X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB) X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) X(NOTE_OPEN) X(NOTE_CLOSE) X(NOTE_CLOSE_WRITE) X(NOTE_READ) XEND }; static struct name_table kevent_proc_fflags[] = { X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR) X(NOTE_CHILD) XEND }; static struct name_table kevent_timer_fflags[] = { X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS) XEND }; void sysdecode_kevent_fflags(FILE *fp, short filter, int fflags, int base) { int rem; if (fflags == 0) { fputs("0", fp); return; } switch (filter) { case EVFILT_READ: case EVFILT_WRITE: if (!print_mask_int(fp, kevent_rdwr_fflags, fflags, &rem)) fprintf(fp, "%#x", rem); else if (rem != 0) fprintf(fp, "|%#x", rem); break; case EVFILT_VNODE: if (!print_mask_int(fp, kevent_vnode_fflags, fflags, &rem)) fprintf(fp, "%#x", rem); else if (rem != 0) fprintf(fp, "|%#x", rem); break; case EVFILT_PROC: case EVFILT_PROCDESC: if (!print_mask_int(fp, kevent_proc_fflags, fflags, &rem)) fprintf(fp, "%#x", rem); else if (rem != 0) fprintf(fp, "|%#x", rem); break; case EVFILT_TIMER: if (!print_mask_int(fp, kevent_timer_fflags, fflags, &rem)) fprintf(fp, "%#x", rem); else if (rem != 0) fprintf(fp, "|%#x", rem); break; case EVFILT_USER: { unsigned int ctrl, data; ctrl = fflags & NOTE_FFCTRLMASK; data = fflags & NOTE_FFLAGSMASK; if (fflags & NOTE_TRIGGER) { fputs("NOTE_TRIGGER", fp); if (fflags == NOTE_TRIGGER) return; fputc('|', fp); } /* * An event with 'ctrl' == NOTE_FFNOP is either a reported * (output) event for which only 'data' should be output * or a pointless input event. Assume that pointless * input events don't occur in practice. An event with * NOTE_TRIGGER is always an input event. */ if (ctrl != NOTE_FFNOP || fflags & NOTE_TRIGGER) { fprintf(fp, "%s|%#x", lookup_value(kevent_user_ffctrl, ctrl), data); } else { print_integer(fp, data, base); } break; } default: print_integer(fp, fflags, base); break; } } bool sysdecode_kevent_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, keventflags, flags, rem)); } const char * sysdecode_kevent_filter(int filter) { return (lookup_value(keventfilters, filter)); } const char * sysdecode_kldsym_cmd(int cmd) { return (lookup_value(kldsymcmd, cmd)); } const char * sysdecode_kldunload_flags(int flags) { return (lookup_value(kldunloadfflags, flags)); } const char * sysdecode_lio_listio_mode(int mode) { return (lookup_value(lio_listiomodes, mode)); } const char * sysdecode_madvice(int advice) { return (lookup_value(madvisebehav, advice)); } const char * sysdecode_minherit_inherit(int inherit) { return (lookup_value(minheritflags, inherit)); } bool sysdecode_mlockall_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, mlockallflags, flags, rem)); } bool sysdecode_mmap_prot(FILE *fp, int prot, int *rem) { return (print_mask_int(fp, mmapprot, prot, rem)); } bool sysdecode_fileflags(FILE *fp, fflags_t flags, fflags_t *rem) { return (print_mask_0(fp, fileflags, flags, rem)); } bool sysdecode_filemode(FILE *fp, int mode, int *rem) { return (print_mask_0(fp, filemode, mode, rem)); } bool sysdecode_mount_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, mountflags, flags, rem)); } bool sysdecode_msync_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, msyncflags, flags, rem)); } const char * sysdecode_nfssvc_flags(int flags) { return (lookup_value(nfssvcflags, flags)); } static struct name_table pipe2flags[] = { X(O_CLOEXEC) X(O_NONBLOCK) XEND }; bool sysdecode_pipe2_flags(FILE *fp, int flags, int *rem) { return (print_mask_0(fp, pipe2flags, flags, rem)); } const char * sysdecode_prio_which(int which) { return (lookup_value(prio, which)); } const char * sysdecode_procctl_cmd(int cmd) { return (lookup_value(procctlcmd, cmd)); } const char * sysdecode_ptrace_request(int request) { return (lookup_value(ptraceop, request)); } static struct name_table quotatypes[] = { X(GRPQUOTA) X(USRQUOTA) XEND }; bool sysdecode_quotactl_cmd(FILE *fp, int cmd) { const char *primary, *type; primary = lookup_value(quotactlcmds, cmd >> SUBCMDSHIFT); if (primary == NULL) return (false); fprintf(fp, "QCMD(%s,", primary); type = lookup_value(quotatypes, cmd & SUBCMDMASK); if (type != NULL) fprintf(fp, "%s", type); else fprintf(fp, "%#x", cmd & SUBCMDMASK); fprintf(fp, ")"); return (true); } bool sysdecode_reboot_howto(FILE *fp, int howto, int *rem) { bool printed; /* * RB_AUTOBOOT is special in that its value is zero, but it is * also an implied argument if a different operation is not * requested via RB_HALT, RB_POWEROFF, or RB_REROOT. */ if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT)) == 0) { fputs("RB_AUTOBOOT|", fp); printed = true; } else printed = false; return (print_mask_int(fp, rebootopt, howto, rem) || printed); } bool sysdecode_rfork_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, rforkflags, flags, rem)); } const char * sysdecode_rlimit(int resource) { return (lookup_value(rlimit, resource)); } const char * sysdecode_scheduler_policy(int policy) { return (lookup_value(schedpolicy, policy)); } bool sysdecode_sendfile_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, sendfileflags, flags, rem)); } bool sysdecode_shmat_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, shmatflags, flags, rem)); } const char * sysdecode_shutdown_how(int how) { return (lookup_value(shutdownhow, how)); } const char * sysdecode_sigbus_code(int si_code) { return (lookup_value(sigbuscode, si_code)); } const char * sysdecode_sigchld_code(int si_code) { return (lookup_value(sigchldcode, si_code)); } const char * sysdecode_sigfpe_code(int si_code) { return (lookup_value(sigfpecode, si_code)); } const char * sysdecode_sigill_code(int si_code) { return (lookup_value(sigillcode, si_code)); } const char * sysdecode_sigsegv_code(int si_code) { return (lookup_value(sigsegvcode, si_code)); } const char * sysdecode_sigtrap_code(int si_code) { return (lookup_value(sigtrapcode, si_code)); } const char * sysdecode_sigprocmask_how(int how) { return (lookup_value(sigprocmaskhow, how)); } const char * sysdecode_socketdomain(int domain) { return (lookup_value(sockdomain, domain)); } const char * sysdecode_socket_protocol(int domain, int protocol) { switch (domain) { case PF_INET: case PF_INET6: return (lookup_value(sockipproto, protocol)); default: return (NULL); } } const char * sysdecode_sockaddr_family(int sa_family) { return (lookup_value(sockfamily, sa_family)); } const char * sysdecode_ipproto(int protocol) { return (lookup_value(sockipproto, protocol)); } const char * sysdecode_sockopt_name(int level, int optname) { if (level == SOL_SOCKET) return (lookup_value(sockopt, optname)); if (level == IPPROTO_IP) /* XXX: UNIX domain socket options use a level of 0 also. */ return (lookup_value(sockoptip, optname)); if (level == IPPROTO_IPV6) return (lookup_value(sockoptipv6, optname)); if (level == IPPROTO_SCTP) return (lookup_value(sockoptsctp, optname)); if (level == IPPROTO_TCP) return (lookup_value(sockopttcp, optname)); if (level == IPPROTO_UDP) return (lookup_value(sockoptudp, optname)); if (level == IPPROTO_UDPLITE) return (lookup_value(sockoptudplite, optname)); return (NULL); } bool sysdecode_thr_create_flags(FILE *fp, int flags, int *rem) { return (print_mask_int(fp, thrcreateflags, flags, rem)); } const char * sysdecode_umtx_op(int op) { return (lookup_value(umtxop, op)); } const char * sysdecode_vmresult(int result) { return (lookup_value(vmresult, result)); } bool sysdecode_wait4_options(FILE *fp, int options, int *rem) { bool printed; int opt6; /* A flags value of 0 is normal. */ if (options == 0) { fputs("0", fp); if (rem != NULL) *rem = 0; return (true); } /* * These flags are implicit and aren't valid flags for wait4() * directly (though they don't fail with EINVAL). */ opt6 = options & (WEXITED | WTRAPPED); options &= ~opt6; printed = print_mask_int(fp, wait6opt, options, rem); if (rem != NULL) *rem |= opt6; return (printed); } bool sysdecode_wait6_options(FILE *fp, int options, int *rem) { return (print_mask_int(fp, wait6opt, options, rem)); } const char * sysdecode_whence(int whence) { return (lookup_value(seekwhence, whence)); } const char * sysdecode_fcntl_cmd(int cmd) { return (lookup_value(fcntlcmd, cmd)); } static struct name_table fcntl_fd_arg[] = { X(FD_CLOEXEC) X(0) XEND }; bool sysdecode_fcntl_arg_p(int cmd) { switch (cmd) { case F_GETFD: case F_GETFL: case F_GETOWN: return (false); default: return (true); } } void sysdecode_fcntl_arg(FILE *fp, int cmd, uintptr_t arg, int base) { int rem; switch (cmd) { case F_SETFD: if (!print_value(fp, fcntl_fd_arg, arg)) print_integer(fp, arg, base); break; case F_SETFL: if (!sysdecode_fcntl_fileflags(fp, arg, &rem)) fprintf(fp, "%#x", rem); else if (rem != 0) fprintf(fp, "|%#x", rem); break; case F_GETLK: case F_SETLK: case F_SETLKW: fprintf(fp, "%p", (void *)arg); break; default: print_integer(fp, arg, base); break; } } bool sysdecode_mmap_flags(FILE *fp, int flags, int *rem) { uintmax_t val; bool printed; int align; /* * MAP_ALIGNED can't be handled directly by print_mask_int(). * MAP_32BIT is also problematic since it isn't defined for * all platforms. */ printed = false; align = flags & MAP_ALIGNMENT_MASK; val = (unsigned)flags & ~MAP_ALIGNMENT_MASK; print_mask_part(fp, mmapflags, &val, &printed); #ifdef MAP_32BIT if (val & MAP_32BIT) { fprintf(fp, "%sMAP_32BIT", printed ? "|" : ""); printed = true; val &= ~MAP_32BIT; } #endif if (align != 0) { if (printed) fputc('|', fp); if (align == MAP_ALIGNED_SUPER) fputs("MAP_ALIGNED_SUPER", fp); else fprintf(fp, "MAP_ALIGNED(%d)", align >> MAP_ALIGNMENT_SHIFT); printed = true; } if (rem != NULL) *rem = val; return (printed); } const char * sysdecode_pathconf_name(int name) { return (lookup_value(pathconfname, name)); } const char * sysdecode_rtprio_function(int function) { return (lookup_value(rtpriofuncs, function)); } bool sysdecode_msg_flags(FILE *fp, int flags, int *rem) { return (print_mask_0(fp, msgflags, flags, rem)); } const char * sysdecode_sigcode(int sig, int si_code) { const char *str; str = lookup_value(sigcode, si_code); if (str != NULL) return (str); switch (sig) { case SIGILL: return (sysdecode_sigill_code(si_code)); case SIGBUS: return (sysdecode_sigbus_code(si_code)); case SIGSEGV: return (sysdecode_sigsegv_code(si_code)); case SIGFPE: return (sysdecode_sigfpe_code(si_code)); case SIGTRAP: return (sysdecode_sigtrap_code(si_code)); case SIGCHLD: return (sysdecode_sigchld_code(si_code)); default: return (NULL); } } const char * sysdecode_sysarch_number(int number) { return (lookup_value(sysarchnum, number)); } bool sysdecode_umtx_cvwait_flags(FILE *fp, u_long flags, u_long *rem) { return (print_mask_0ul(fp, umtxcvwaitflags, flags, rem)); } bool sysdecode_umtx_rwlock_flags(FILE *fp, u_long flags, u_long *rem) { return (print_mask_0ul(fp, umtxrwlockflags, flags, rem)); } void sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp) { struct name_table *t; int i; bool comma; for (i = 0; i < CAPARSIZE(rightsp); i++) { if (CAPIDXBIT(rightsp->cr_rights[i]) != 1 << i) { fprintf(fp, "invalid cap_rights_t"); return; } } comma = false; for (t = caprights; t->str != NULL; t++) { if (cap_rights_is_set(rightsp, t->val)) { fprintf(fp, "%s%s", comma ? "," : "", t->str); comma = true; } } } const char * sysdecode_sctp_pr_policy(int policy) { return (lookup_value(sctpprpolicy, policy)); } + +static struct name_table sctpsinfoflags[] = { + X(SCTP_EOF) X(SCTP_ABORT) X(SCTP_UNORDERED) X(SCTP_ADDR_OVER) + X(SCTP_SENDALL) X(SCTP_EOR) X(SCTP_SACK_IMMEDIATELY) XEND +}; + +void +sysdecode_sctp_sinfo_flags(FILE *fp, int sinfo_flags) +{ + const char *temp; + int rem; + bool printed; + + printed = print_mask_0(fp, sctpsinfoflags, sinfo_flags, &rem); + if (rem & ~SCTP_PR_SCTP_ALL) { + fprintf(fp, "%s%#x", printed ? "|" : "", rem & ~SCTP_PR_SCTP_ALL); + printed = true; + rem &= ~SCTP_PR_SCTP_ALL; + } + if (rem != 0) { + temp = sysdecode_sctp_pr_policy(rem); + if (temp != NULL) { + fprintf(fp, "%s%s", printed ? "|" : "", temp); + } else { + fprintf(fp, "%s%#x", printed ? "|" : "", rem); + } + } +} Index: stable/11/lib/libsysdecode/sysdecode.3 =================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 (revision 332243) +++ stable/11/lib/libsysdecode/sysdecode.3 (revision 332244) @@ -1,88 +1,89 @@ .\" .\" Copyright (c) 2015 John Baldwin .\" 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 November 24, 2017 +.Dd January 14, 2018 .Dt SYSDECODE 3 .Os .Sh NAME .Nm sysdecode .Nd system argument decoding library .Sh LIBRARY .Lb libsysdecode .Sh SYNOPSIS .In sys/types.h .In stdbool.h .In sysdecode.h .Sh DESCRIPTION The .Nm library includes several functions that provide descriptive names of values associated with system calls. .Ss Supported ABIs Some functions in this library provide ABI-specific descriptions. The supported ABIs are named by the .Vt enum sysdecode_abi enumeration. .Pp .Bl -tag -width "Li SYSDECODE_ABI_CLOUDABI64" -compact .It Li SYSDECODE_ABI_FREEBSD Native FreeBSD binaries. Supported on all platforms. .It Li SYSDECODE_ABI_FREEBSD32 32-bit FreeBSD binaries. Supported on amd64 and powerpc64. .It Li SYSDECODE_ABI_LINUX Linux binaries of the same platform. Supported on amd64 and i386. .It Li SYSDECODE_ABI_LINUX32 32-bit Linux binaries. Supported on amd64. .It Li SYSDECODE_ABI_CLOUDABI64 64-bit CloudABI binaries. Supported on aarch64 and amd64. .It Li SYSDECODE_ABI_UNKNOWN A placeholder for use when the ABI is not known. .El .Sh SEE ALSO .Xr sysdecode_abi_to_freebsd_errno 3 , .Xr sysdecode_cap_rights 3 , .Xr sysdecode_enum 3 , .Xr sysdecode_fcntl_arg 3 , .Xr sysdecode_ioctlname 3 , .Xr sysdecode_kevent 3 , .Xr sysdecode_mask 3 , .Xr sysdecode_quotactl_cmd 3 , +.Xr sysdecode_sctp_sinfo_flags 3 , .Xr sysdecode_sigcode 3 , .Xr sysdecode_socket_protocol 3 , .Xr sysdecode_sockopt_name 3 , .Xr sysdecode_syscallnames 3 , .Xr sysdecode_utrace 3 .Sh HISTORY The .Nm library first appeared in .Fx 11.0 . Index: stable/11/lib/libsysdecode/sysdecode.h =================================================================== --- stable/11/lib/libsysdecode/sysdecode.h (revision 332243) +++ stable/11/lib/libsysdecode/sysdecode.h (revision 332244) @@ -1,127 +1,128 @@ /*- * Copyright (c) 2015 John H. Baldwin * 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$ */ #ifndef __SYSDECODE_H__ #define __SYSDECODE_H__ enum sysdecode_abi { SYSDECODE_ABI_UNKNOWN = 0, SYSDECODE_ABI_FREEBSD, SYSDECODE_ABI_FREEBSD32, SYSDECODE_ABI_LINUX, SYSDECODE_ABI_LINUX32, SYSDECODE_ABI_CLOUDABI64 }; int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error); bool sysdecode_access_mode(FILE *_fp, int _mode, int *_rem); const char *sysdecode_acltype(int _type); const char *sysdecode_atfd(int _fd); bool sysdecode_atflags(FILE *_fp, int _flags, int *_rem); bool sysdecode_cap_fcntlrights(FILE *_fp, uint32_t _rights, uint32_t *_rem); void sysdecode_cap_rights(FILE *_fp, cap_rights_t *_rightsp); const char *sysdecode_extattrnamespace(int _namespace); const char *sysdecode_fadvice(int _advice); void sysdecode_fcntl_arg(FILE *_fp, int _cmd, uintptr_t _arg, int _base); bool sysdecode_fcntl_arg_p(int _cmd); const char *sysdecode_fcntl_cmd(int _cmd); bool sysdecode_fcntl_fileflags(FILE *_fp, int _flags, int *_rem); bool sysdecode_fileflags(FILE *_fp, fflags_t _flags, fflags_t *_rem); bool sysdecode_filemode(FILE *_fp, int _mode, int *_rem); bool sysdecode_flock_operation(FILE *_fp, int _operation, int *_rem); int sysdecode_freebsd_to_abi_errno(enum sysdecode_abi _abi, int _error); const char *sysdecode_getfsstat_mode(int _mode); const char *sysdecode_getrusage_who(int _who); const char *sysdecode_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); const char *sysdecode_ipproto(int _protocol); void sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags, int _base); const char *sysdecode_kevent_filter(int _filter); bool sysdecode_kevent_flags(FILE *_fp, int _flags, int *_rem); 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_inherit(int _inherit); const char *sysdecode_msgctl_cmd(int _cmd); bool sysdecode_mlockall_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_mmap_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_mmap_prot(FILE *_fp, int _prot, int *_rem); bool sysdecode_mount_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_msg_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_msync_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_nfssvc_flags(int _flags); bool sysdecode_open_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_pathconf_name(int _name); bool sysdecode_pipe2_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_prio_which(int _which); const char *sysdecode_procctl_cmd(int _cmd); const char *sysdecode_ptrace_request(int _request); bool sysdecode_quotactl_cmd(FILE *_fp, int _cmd); bool sysdecode_reboot_howto(FILE *_fp, int _howto, int *_rem); bool sysdecode_rfork_flags(FILE *_fp, int _flags, int *_rem); 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); +void sysdecode_sctp_sinfo_flags(FILE *_fp, int _sinfo_flags); const char *sysdecode_semctl_cmd(int _cmd); bool sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem); bool sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_shmat_flags(FILE *_fp, int _flags, int *_rem); 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_sigcode(int _sig, 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_socket_protocol(int _domain, int _protocol); bool sysdecode_socket_type(FILE *_fp, int _type, int *_rem); const char *sysdecode_sockopt_level(int _level); const char *sysdecode_sockopt_name(int _level, int _optname); const char *sysdecode_syscallname(enum sysdecode_abi _abi, unsigned int _code); const char *sysdecode_sysarch_number(int _number); bool sysdecode_thr_create_flags(FILE *_fp, int _flags, int *_rem); bool sysdecode_umtx_cvwait_flags(FILE *_fp, u_long _flags, u_long *_rem); const char *sysdecode_umtx_op(int _op); bool sysdecode_umtx_rwlock_flags(FILE *_fp, u_long _flags, u_long *_rem); int sysdecode_utrace(FILE *_fp, void *_buf, size_t _len); bool sysdecode_vmprot(FILE *_fp, int _type, int *_rem); const char *sysdecode_vmresult(int _result); bool sysdecode_wait4_options(FILE *_fp, int _options, int *_rem); bool sysdecode_wait6_options(FILE *_fp, int _options, int *_rem); const char *sysdecode_whence(int _whence); #endif /* !__SYSDECODE_H__ */ Index: stable/11/lib/libsysdecode/sysdecode_enum.3 =================================================================== --- stable/11/lib/libsysdecode/sysdecode_enum.3 (revision 332243) +++ stable/11/lib/libsysdecode/sysdecode_enum.3 (revision 332244) @@ -1,256 +1,257 @@ .\" .\" Copyright (c) 2016 John Baldwin .\" 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 14, 2018 .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_getrusage_who , .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_pathconf_name , .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_sctp_pr_policy , +.Nm sysdecode_sctp_sinfo_flags , .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_sysarch_number , .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_getrusage_who "int who" .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_pathconf_name "int name" .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_sctp_pr_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_sysarch_number "int number" .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_pathconf_name Ta Xr pathconf 2 Ta Fa name .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_getrusage_who Ta Xr getrusage 2 Ta Fa who .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_sysarch_number Ta Xr sysarch 2 Ta Fa number .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_sctp_pr_policy A PR-SCTP policy. .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 Index: stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 =================================================================== --- stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 (nonexistent) +++ stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 (revision 332244) @@ -0,0 +1,55 @@ +.\" +.\" Copyright (c) 2018 Michael Tuexen +.\" 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 14, 2018 +.Dt sysdecode_sctp_sinfo_flags 3 +.Os +.Sh NAME +.Nm sysdecode_sctp_sinfo_flags +.Nd output textual description of the sinfo_flags field of struct sctp_sndrcvinfo +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In stdio.h +.In sysdecode.h +.Ft void +.Fn sysdecode_sctp_sinfo_flags "FILE *fp" "int sinfo_flags" +.Sh DESCRIPTION +The +.Fn sysdecode_sctp_sinfo_flags +function outputs a textual description of the +.Fa sinfo_flags +member of a +.Vt struct sctp_sndrcvinfo +to the stream +.Fa fp . +In particular, the embedded PR-SCTP policies are handled. +.Sh SEE ALSO +.Xr sysdecode 3 +.Xr sysdecode_sctp_pr_policy 3 Property changes on: stable/11/lib/libsysdecode/sysdecode_sctp_sinfo_flags.3 ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: stable/11 =================================================================== --- stable/11 (revision 332243) +++ stable/11 (revision 332244) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r327966