Date: Thu, 12 Jan 2017 22:06:58 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311999 - in stable/11: . lib/libsysdecode usr.bin/kdump usr.bin/truss Message-ID: <201701122206.v0CM6w2c091165@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Jan 12 22:06:57 2017 New Revision: 311999 URL: https://svnweb.freebsd.org/changeset/base/311999 Log: MFC 307538,307948,308602,308603,311151: Move kdump's mksubr into libsysdecode. 307538: Move mksubr from kdump into libsysdecode. Restructure this script so that it generates a header of tables instead of a source file. The tables are included in a flags.c source file which provides functions to decode various system call arguments. For functions that decode an enumeration, the function returns a pointer to a string for known values and NULL for unknown values. For functions that do more complex decoding (typically of a bitmask), the function accepts a pointer to a FILE object (open_memstream() can be used as a string builder) to which decoded values are written. If the function operates on a bitmask, the function returns true if any bits were decoded or false if the entire value was valid. Additionally, the third argument accepts a pointer to a value to which any undecoded bits are stored. This pointer can be NULL if the caller doesn't care about remaining bits. Convert kdump over to using decoder functions from libsysdecode instead of mksubr. truss also uses decoders from libsysdecode instead of private lookup tables, though lookup tables for objects not decoded by kdump remain in truss for now. Eventually most of these tables should move into libsysdecode as the automated table generation approach from mksubr is less stale than the static tables in truss. Some changes have been made to truss and kdump output: - The flags passed to open() are now properly decoded in that one of O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded mask. - Optional arguments to open(), openat(), and fcntl() are only printed in kdump if they exist (e.g. the mode is only printed for open() if O_CREAT is set in the flags). - Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int. - Include all procctl() commands. - Correctly decode pipe2() flags in truss by not assuming full open()-like flags with O_RDONLY, etc. - Decode file flags passed to *chflags() as file flags (UF_* and SF_*) rather than as a file mode. - Fix decoding of quotactl() commands by splitting out the two command components instead of assuming the raw command value matches the primary command component. In addition, truss and kdump now build without triggering any warnings. All of the sysdecode manpages now include the required headers in the synopsis. 307948: Use binary and (&) instead of logical to extract the mask of a capability. 308602: Generate and use a proper .depend file for tables.h. 308603: Move libsysdecode-specific hack out of buildworld. This should fix the lib32 build since it was not removing the generated ioctl.c. This file is generated by a find(1) call, so cannot use normal dependency tracking methods. 311151: Update libsysdecode for getfsstat() 'flags' argument changing to 'mode'. As a followup to r310638, update libsysdecode (and kdump) to decode the 'mode' argument to getfsstat(). sysdecode_getfsstat_flags() has been renamed to sysdecode_getfsstat_mode() and now treats the argument as an enumerated value rather than a mask of flags. Added: stable/11/lib/libsysdecode/flags.c - copied, changed from r307538, head/lib/libsysdecode/flags.c stable/11/lib/libsysdecode/mktables - copied, changed from r307538, head/lib/libsysdecode/mktables stable/11/lib/libsysdecode/signal.c - copied unchanged from r307538, head/lib/libsysdecode/signal.c stable/11/lib/libsysdecode/sysdecode_cap_rights.3 - copied unchanged from r307538, head/lib/libsysdecode/sysdecode_cap_rights.3 stable/11/lib/libsysdecode/sysdecode_enum.3 - copied, changed from r307538, head/lib/libsysdecode/sysdecode_enum.3 stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 - copied unchanged from r307538, head/lib/libsysdecode/sysdecode_fcntl_arg.3 stable/11/lib/libsysdecode/sysdecode_mask.3 - copied, changed from r307538, head/lib/libsysdecode/sysdecode_mask.3 stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 - copied unchanged from r307538, head/lib/libsysdecode/sysdecode_quotactl_cmd.3 stable/11/lib/libsysdecode/sysdecode_sigcode.3 - copied unchanged from r307538, head/lib/libsysdecode/sysdecode_sigcode.3 stable/11/lib/libsysdecode/sysdecode_sockopt_name.3 - copied unchanged from r307538, head/lib/libsysdecode/sysdecode_sockopt_name.3 Deleted: stable/11/usr.bin/kdump/mksubr Modified: stable/11/Makefile.inc1 stable/11/ObsoleteFiles.inc stable/11/lib/libsysdecode/Makefile stable/11/lib/libsysdecode/errno.c stable/11/lib/libsysdecode/mkioctls stable/11/lib/libsysdecode/syscallnames.c stable/11/lib/libsysdecode/sysdecode.3 stable/11/lib/libsysdecode/sysdecode.h stable/11/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3 stable/11/lib/libsysdecode/sysdecode_ioctlname.3 stable/11/lib/libsysdecode/sysdecode_syscallnames.3 stable/11/lib/libsysdecode/sysdecode_utrace.3 stable/11/lib/libsysdecode/utrace.c stable/11/usr.bin/kdump/Makefile stable/11/usr.bin/kdump/kdump.c stable/11/usr.bin/truss/Makefile stable/11/usr.bin/truss/aarch64-cloudabi64.c stable/11/usr.bin/truss/aarch64-freebsd.c stable/11/usr.bin/truss/amd64-cloudabi64.c stable/11/usr.bin/truss/amd64-freebsd.c stable/11/usr.bin/truss/amd64-freebsd32.c stable/11/usr.bin/truss/amd64-linux.c stable/11/usr.bin/truss/amd64-linux32.c stable/11/usr.bin/truss/arm-freebsd.c stable/11/usr.bin/truss/extern.h stable/11/usr.bin/truss/i386-freebsd.c stable/11/usr.bin/truss/i386-linux.c stable/11/usr.bin/truss/main.c stable/11/usr.bin/truss/mips-freebsd.c stable/11/usr.bin/truss/powerpc-freebsd.c stable/11/usr.bin/truss/powerpc64-freebsd.c stable/11/usr.bin/truss/powerpc64-freebsd32.c stable/11/usr.bin/truss/setup.c stable/11/usr.bin/truss/sparc64-freebsd.c stable/11/usr.bin/truss/syscall.h stable/11/usr.bin/truss/syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/Makefile.inc1 Thu Jan 12 22:06:57 2017 (r311999) @@ -655,9 +655,6 @@ _worldtmp: .PHONY .endif .else rm -rf ${WORLDTMP}/legacy/usr/include -# XXX - These can depend on any header file. - rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c - rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c .endif .for _dir in \ lib lib/casper usr legacy/bin legacy/usr Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/ObsoleteFiles.inc Thu Jan 12 22:06:57 2017 (r311999) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20170112: sysdecode_getfsstat_flags() renamed to sysdecode_getfsstat_mode() +OLD_FILES+=usr/share/man/man3/sysdecode_getfsstat_flags.3.gz # 20161217: new clang import which bumps version from 3.9.0 to 3.9.1. OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.9.0/include/sanitizer/asan_interface.h Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/Makefile Thu Jan 12 22:06:57 2017 (r311999) @@ -5,20 +5,94 @@ PACKAGE=lib${LIB} LIB= sysdecode -SRCS= errno.c ioctl.c syscallnames.c utrace.c +SRCS= errno.c flags.c ioctl.c signal.c syscallnames.c utrace.c INCS= sysdecode.h +CFLAGS+= -I${.OBJDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../libexec/rtld-elf -MAN+= sysdecode.3 \ +MAN= sysdecode.3 \ sysdecode_abi_to_freebsd_errno.3 \ + sysdecode_cap_rights.3 \ + sysdecode_enum.3 \ + sysdecode_fcntl_arg.3 \ sysdecode_ioctlname.3 \ + sysdecode_mask.3 \ + sysdecode_quotactl_cmd.3 \ + sysdecode_sigcode.3 \ + sysdecode_sockopt_name.3 \ sysdecode_syscallnames.3 \ sysdecode_utrace.3 -MLINKS+= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.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_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_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_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_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_mask.3 sysdecode_accessmode.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 +CLEANFILES= ioctl.c tables.h .if defined(COMPAT_32BIT) CPP+= -m32 @@ -36,10 +110,19 @@ CFLAGS.gcc.ioctl.c+= -Wno-unused CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}} -ioctl.c: mkioctls +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}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} -beforedepend: ioctl.c +beforedepend: ioctl.c tables.h .include <bsd.lib.mk> Modified: stable/11/lib/libsysdecode/errno.c ============================================================================== --- stable/11/lib/libsysdecode/errno.c Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/errno.c Thu Jan 12 22:06:57 2017 (r311999) @@ -28,8 +28,11 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/acl.h> +#include <sys/wait.h> #include <errno.h> #include <limits.h> +#include <stdbool.h> #include <stdio.h> #include <sysdecode.h> Copied and modified: stable/11/lib/libsysdecode/flags.c (from r307538, head/lib/libsysdecode/flags.c) ============================================================================== --- head/lib/libsysdecode/flags.c Mon Oct 17 22:37:07 2016 (r307538, copy source) +++ stable/11/lib/libsysdecode/flags.c Thu Jan 12 22:06:57 2017 (r311999) @@ -472,11 +472,15 @@ sysdecode_flock_operation(FILE *fp, int return (print_mask_int(fp, flockops, operation, rem)); } -bool -sysdecode_getfsstat_flags(FILE *fp, int flags, int *rem) +static struct name_table getfsstatmode[] = { + X(MNT_WAIT) X(MNT_NOWAIT) XEND +}; + +const char * +sysdecode_getfsstat_mode(int mode) { - return (print_mask_int(fp, getfsstatflags, flags, rem)); + return (lookup_value(getfsstatmode, mode)); } const char * @@ -959,7 +963,7 @@ sysdecode_umtx_rwlock_flags(FILE *fp, u_ } /* XXX: This should be in <sys/capsicum.h> */ -#define CAPMASK(right) ((right) && (((uint64_t)1 << 57) - 1)) +#define CAPMASK(right) ((right) & (((uint64_t)1 << 57) - 1)) void sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp) Modified: stable/11/lib/libsysdecode/mkioctls ============================================================================== --- stable/11/lib/libsysdecode/mkioctls Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/mkioctls Thu Jan 12 22:06:57 2017 (r311999) @@ -62,6 +62,7 @@ BEGIN { print "#include <netinet6/ip6_mroute.h>" print "#include <stdio.h>" print "#include <cam/cam.h>" + print "#include <stdbool.h>" print "#include <stddef.h>" print "#include <stdint.h>" print "#include <sysdecode.h>" Copied and modified: stable/11/lib/libsysdecode/mktables (from r307538, head/lib/libsysdecode/mktables) ============================================================================== --- head/lib/libsysdecode/mktables Mon Oct 17 22:37:07 2016 (r307538, copy source) +++ stable/11/lib/libsysdecode/mktables Thu Jan 12 22:06:57 2017 (r311999) @@ -37,11 +37,16 @@ LC_ALL=C; export LC_ALL if [ -z "$1" ] then - echo "usage: sh $0 include-dir" + echo "usage: sh $0 include-dir [output-file]" exit 1 fi include_dir=$1 +if [ -n "$2" ]; then + output_file="$2" + exec > "$output_file" +fi +all_headers= # # Generate a table C #definitions. The including file can define the # TABLE_NAME(n), TABLE_ENTRY(x), and TABLE_END macros to define what @@ -60,6 +65,7 @@ gen_table() else filter="egrep -v" fi + all_headers="${all_headers:+${all_headers} }${file}" cat <<_EOF_ TABLE_START(${name}) _EOF_ @@ -88,7 +94,6 @@ gen_table "extattrns" "EXTATTR_NAM gen_table "fadvisebehav" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" gen_table "openflags" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" "O_RDONLY|O_RDWR|O_WRONLY" gen_table "flockops" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h" -gen_table "getfsstatflags" "MNT_[A-Z]+[[:space:]]+[1-9][0-9]*" "sys/mount.h" gen_table "kldsymcmd" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "kldunloadfflags" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "lio_listiomodes" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" @@ -142,3 +147,12 @@ gen_table "sigcode" "SI_[A-Z]+[[ gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "caprights" "CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)" "sys/capsicum.h" + +# Generate a .depend file for our output file +if [ -n "$output_file" ]; then + echo "$output_file: \\" > ".depend.$output_file" + echo "$all_headers" | tr ' ' '\n' | sort -u | + sed -e "s,^, $include_dir/," -e 's,$, \\,' >> \ + ".depend.$output_file" + echo >> ".depend.$output_file" +fi Copied: stable/11/lib/libsysdecode/signal.c (from r307538, head/lib/libsysdecode/signal.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/signal.c Thu Jan 12 22:06:57 2017 (r311999, copy of r307538, head/lib/libsysdecode/signal.c) @@ -0,0 +1,143 @@ +/*- + * Copyright (c) 2016 John H. Baldwin <jhb@FreeBSD.org> + * 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 <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <signal.h> +#include <stdbool.h> +#include <stdio.h> +#include <sysdecode.h> + +static const char *signames[] = { + [SIGHUP] = "SIGHUP", + [SIGINT] = "SIGINT", + [SIGQUIT] = "SIGQUIT", + [SIGILL] = "SIGILL", + [SIGTRAP] = "SIGTRAP", + [SIGABRT] = "SIGABRT", + [SIGEMT] = "SIGEMT", + [SIGFPE] = "SIGFPE", + [SIGKILL] = "SIGKILL", + [SIGBUS] = "SIGBUS", + [SIGSEGV] = "SIGSEGV", + [SIGSYS] = "SIGSYS", + [SIGPIPE] = "SIGPIPE", + [SIGALRM] = "SIGALRM", + [SIGTERM] = "SIGTERM", + [SIGURG] = "SIGURG", + [SIGSTOP] = "SIGSTOP", + [SIGTSTP] = "SIGTSTP", + [SIGCONT] = "SIGCONT", + [SIGCHLD] = "SIGCHLD", + [SIGTTIN] = "SIGTTIN", + [SIGTTOU] = "SIGTTOU", + [SIGIO] = "SIGIO", + [SIGXCPU] = "SIGXCPU", + [SIGXFSZ] = "SIGXFSZ", + [SIGVTALRM] = "SIGVTALRM", + [SIGPROF] = "SIGPROF", + [SIGWINCH] = "SIGWINCH", + [SIGINFO] = "SIGINFO", + [SIGUSR1] = "SIGUSR1", + [SIGUSR2] = "SIGUSR2", + [SIGTHR] = "SIGTHR", + [SIGLIBRT] = "SIGLIBRT", + + /* XXX: Solaris uses SIGRTMIN, SIGRTMIN+<x>...SIGRTMAX-<x>, SIGRTMAX */ + [SIGRTMIN] = "SIGRT0", + [SIGRTMIN + 1] = "SIGRT1", + [SIGRTMIN + 2] = "SIGRT2", + [SIGRTMIN + 3] = "SIGRT3", + [SIGRTMIN + 4] = "SIGRT4", + [SIGRTMIN + 5] = "SIGRT5", + [SIGRTMIN + 6] = "SIGRT6", + [SIGRTMIN + 7] = "SIGRT7", + [SIGRTMIN + 8] = "SIGRT8", + [SIGRTMIN + 9] = "SIGRT9", + [SIGRTMIN + 10] = "SIGRT10", + [SIGRTMIN + 11] = "SIGRT11", + [SIGRTMIN + 12] = "SIGRT12", + [SIGRTMIN + 13] = "SIGRT13", + [SIGRTMIN + 14] = "SIGRT14", + [SIGRTMIN + 15] = "SIGRT15", + [SIGRTMIN + 16] = "SIGRT16", + [SIGRTMIN + 17] = "SIGRT17", + [SIGRTMIN + 18] = "SIGRT18", + [SIGRTMIN + 19] = "SIGRT19", + [SIGRTMIN + 20] = "SIGRT20", + [SIGRTMIN + 21] = "SIGRT21", + [SIGRTMIN + 22] = "SIGRT22", + [SIGRTMIN + 23] = "SIGRT23", + [SIGRTMIN + 24] = "SIGRT24", + [SIGRTMIN + 25] = "SIGRT25", + [SIGRTMIN + 26] = "SIGRT26", + [SIGRTMIN + 27] = "SIGRT27", + [SIGRTMIN + 28] = "SIGRT28", + [SIGRTMIN + 29] = "SIGRT29", + [SIGRTMIN + 30] = "SIGRT30", + [SIGRTMIN + 31] = "SIGRT31", + [SIGRTMIN + 32] = "SIGRT32", + [SIGRTMIN + 33] = "SIGRT33", + [SIGRTMIN + 34] = "SIGRT34", + [SIGRTMIN + 35] = "SIGRT35", + [SIGRTMIN + 36] = "SIGRT36", + [SIGRTMIN + 37] = "SIGRT37", + [SIGRTMIN + 38] = "SIGRT38", + [SIGRTMIN + 39] = "SIGRT39", + [SIGRTMIN + 40] = "SIGRT40", + [SIGRTMIN + 41] = "SIGRT41", + [SIGRTMIN + 42] = "SIGRT42", + [SIGRTMIN + 43] = "SIGRT43", + [SIGRTMIN + 44] = "SIGRT44", + [SIGRTMIN + 45] = "SIGRT45", + [SIGRTMIN + 46] = "SIGRT46", + [SIGRTMIN + 47] = "SIGRT47", + [SIGRTMIN + 48] = "SIGRT48", + [SIGRTMIN + 49] = "SIGRT49", + [SIGRTMIN + 50] = "SIGRT50", + [SIGRTMIN + 51] = "SIGRT51", + [SIGRTMIN + 52] = "SIGRT52", + [SIGRTMIN + 53] = "SIGRT53", + [SIGRTMIN + 54] = "SIGRT54", + [SIGRTMIN + 55] = "SIGRT55", + [SIGRTMIN + 56] = "SIGRT56", + [SIGRTMIN + 57] = "SIGRT57", + [SIGRTMIN + 58] = "SIGRT58", + [SIGRTMIN + 59] = "SIGRT59", + [SIGRTMIN + 60] = "SIGRT60", + [SIGRTMIN + 61] = "SIGRT61", +}; + +const char * +sysdecode_signal(int sig) +{ + + if ((unsigned)sig < nitems(signames)) + return (signames[sig]); + return (NULL); +} Modified: stable/11/lib/libsysdecode/syscallnames.c ============================================================================== --- stable/11/lib/libsysdecode/syscallnames.c Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/syscallnames.c Thu Jan 12 22:06:57 2017 (r311999) @@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$"); */ #include <sys/param.h> +#include <sys/acl.h> +#include <sys/wait.h> +#include <stdbool.h> #include <stdio.h> #include <sysdecode.h> Modified: stable/11/lib/libsysdecode/sysdecode.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.3 Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/sysdecode.3 Thu Jan 12 22:06:57 2017 (r311999) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 29, 2016 +.Dd October 17, 2016 .Dt SYSDECODE 3 .Os .Sh NAME @@ -33,6 +33,10 @@ .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 @@ -65,7 +69,14 @@ A placeholder for use when the ABI is no .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_mask 3 , +.Xr sysdecode_quotactl_cmd 3 , +.Xr sysdecode_sigcode 3 , +.Xr sysdecode_sockopt_name 3 , .Xr sysdecode_syscallnames 3 , .Xr sysdecode_utrace 3 .Sh HISTORY Modified: stable/11/lib/libsysdecode/sysdecode.h ============================================================================== --- stable/11/lib/libsysdecode/sysdecode.h Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/sysdecode.h Thu Jan 12 22:06:57 2017 (r311999) @@ -39,9 +39,79 @@ enum sysdecode_abi { }; 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_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_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); +const char *sysdecode_ipproto(int _protocol); +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); +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_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); +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); +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__ */ Modified: stable/11/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3 Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3 Thu Jan 12 22:06:57 2017 (r311999) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2016 +.Dd October 17, 2016 .Dt sysdecode_abi_to_freebsd_errno 3 .Os .Sh NAME @@ -35,6 +35,9 @@ .Sh LIBRARY .Lb libsysdecode .Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h .Ft int .Fn sysdecode_abi_to_freebsd_errno "enum sysdecode_abi abi" "int error" .Ft int Copied: stable/11/lib/libsysdecode/sysdecode_cap_rights.3 (from r307538, head/lib/libsysdecode/sysdecode_cap_rights.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_cap_rights.3 Thu Jan 12 22:06:57 2017 (r311999, copy of r307538, head/lib/libsysdecode/sysdecode_cap_rights.3) @@ -0,0 +1,50 @@ +.\" +.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org> +.\" 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 October 17, 2016 +.Dt sysdecode_cap_rights 3 +.Os +.Sh NAME +.Nm sysdecode_cap_rights +.Nd output list of capability rights +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h +.Ft void +.Fn sysdecode_cap_rights "FILE *fp" "cap_rights_t *rightsp" +.Sh DESCRIPTION +The +.Fn sysdecode_cap_rights +function outputs a comma-separated list of capability rights at +.Fa rightsp +to the stream +.Fa fp . +.Sh SEE ALSO +.Xr sysdecode 3 Copied and modified: stable/11/lib/libsysdecode/sysdecode_enum.3 (from r307538, head/lib/libsysdecode/sysdecode_enum.3) ============================================================================== --- head/lib/libsysdecode/sysdecode_enum.3 Mon Oct 17 22:37:07 2016 (r307538, copy source) +++ stable/11/lib/libsysdecode/sysdecode_enum.3 Thu Jan 12 22:06:57 2017 (r311999) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd January 2, 2017 .Dt sysdecode_enum 3 .Os .Sh NAME @@ -35,6 +35,7 @@ .Nm sysdecode_extattrnamespace , .Nm sysdecode_fadvice , .Nm sysdecode_fcntl_cmd , +.Nm sysdecode_getfsstat_mode , .Nm sysdecode_idtype , .Nm sysdecode_ipproto , .Nm sysdecode_kldsym_cmd , @@ -86,6 +87,8 @@ .Ft const char * .Fn sysdecode_fcntl_cmd "int cmd" .Ft const char * +.Fn sysdecode_getfsstat_mode "int mode" +.Ft const char * .Fn sysdecode_idtype "int idtype" .Ft const char * .Fn sysdecode_ipproto "int protocol" @@ -168,6 +171,7 @@ Most of these functions decode an argume .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 Copied: stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 (from r307538, head/lib/libsysdecode/sysdecode_fcntl_arg.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_fcntl_arg.3 Thu Jan 12 22:06:57 2017 (r311999, copy of r307538, head/lib/libsysdecode/sysdecode_fcntl_arg.3) @@ -0,0 +1,121 @@ +.\" +.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org> +.\" 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 October 17, 2016 +.Dt sysdecode_fcntl_arg 3 +.Os +.Sh NAME +.Nm sysdecode_fcntl_arg , +.Nm sysdecode_fcntl_arg_p +.Nd output description of fcntl argument +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h +.Ft void +.Fn sysdecode_fcntl_arg "FILE *fp" "int cmd" "uintptr_t arg" "int base" +.Ft bool +.Fn sysdecode_fcntl_arg_p "int cmd" +.Sh DESCRIPTION +The +.Fn sysdecode_fcntl_arg +function outputs a text description of the optional +.Fa arg +argument to +.Xr fcntl 2 +to the stream +.Fa fp . +The type and format of +.Fa arg +are determined by +.Fa cmd : +.Bl -column ".Dv F_SETLKW" "Vt struct flock *" +.It Sy Command Ta Fa arg Sy Type Ta Sy Output Format +.It +.It Dv F_SETFD Ta Vt int Ta +.Dq FD_CLOEXEC +or the value of +.Fa arg +in the indicated +.Fa base +.Pq one of 8, 10, or 16 . +.It +.It Dv F_SETFL Ta Vt int Ta +File flags as output by +.Xr sysdecode_fcntl_fileflags 3 +with any unknown or remaining bits output in hexadecimal. +.It +.It Dv F_GETLK Ta Vt struct flock * Ta +.It Dv F_SETLK Ta Vt struct flock * Ta +.It Dv F_SETLKW Ta Vt struct flock * Ta +The value of +.Fa arg +using the +.Dq %p +conversion specification. +.It +.It Others Ta Vt int Ta +The value of +.Fa arg +in the indicated +.Fa base +.Pq one of 8, 10, or 16 . +.El +.Pp +The +.Fn sysdecode_fcntl_arg_p +function can be used to determine if a +.Xr fcntl 2 +command uses the optional third argument to +.Xr fcntl 2 . +The function returns +.Dv true +if +.Fa cmd +accepts a third argument to +.Xr fcntl 2 +and +.Dv false +if it does not. +.Sh RETURN VALUES +The +.Nm sysdecode_fcntl_arg_p +function returns +.Dv true +if +.Fa cmd +accepts a third argument to +.Xr fcntl 2 +and +.Dv false +if it does not. +.Sh SEE ALSO +.Xr sysdecode 3 , +.Xr sysdecode_fcntl_cmd 3 , +.Xr sysdecode_fcntl_fileflags 3 Modified: stable/11/lib/libsysdecode/sysdecode_ioctlname.3 ============================================================================== --- stable/11/lib/libsysdecode/sysdecode_ioctlname.3 Thu Jan 12 21:46:31 2017 (r311998) +++ stable/11/lib/libsysdecode/sysdecode_ioctlname.3 Thu Jan 12 22:06:57 2017 (r311999) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2015 +.Dd October 17, 2016 .Dt sysdecode_ioctlname 3 .Os .Sh NAME @@ -34,6 +34,9 @@ .Sh LIBRARY .Lb libsysdecode .Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h .Ft conts char * .Fn sysdecode_ioctlname "unsigned long request" .Sh DESCRIPTION Copied and modified: stable/11/lib/libsysdecode/sysdecode_mask.3 (from r307538, head/lib/libsysdecode/sysdecode_mask.3) ============================================================================== --- head/lib/libsysdecode/sysdecode_mask.3 Mon Oct 17 22:37:07 2016 (r307538, copy source) +++ stable/11/lib/libsysdecode/sysdecode_mask.3 Thu Jan 12 22:06:57 2017 (r311999) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2016 +.Dd January 2, 2017 .Dt sysdecode_mask 3 .Os .Sh NAME @@ -36,7 +36,6 @@ .Nm sysdecode_fileflags , .Nm sysdecode_filemode , .Nm sysdecode_flock_operation , -.Nm sysdecode_getfsstat_flags , .Nm sysdecode_mlockall_flags , .Nm sysdecode_mmap_flags , .Nm sysdecode_mmap_prot , @@ -153,7 +152,6 @@ Most of these functions decode an argume .It Fn sysdecode_fileflags Ta Xr chflags 2 Ta Fa flags .It Fn sysdecode_filemode Ta Xr chmod 2 , Xr open 2 Ta mode .It Fn sysdecode_flock_operation Ta Xr flock 2 Ta Fa operation -.It Fn sysdecode_getfsstat_flags Ta Xr getfsstatflags 2 Ta Fa flags .It Fn sysdecode_mlockall_flags Ta Xr mlockall 2 Ta Fa flags .It Fn sysdecode_mmap_flags Ta Xr mmap 2 Ta Fa flags .It Fn sysdecode_mmap_prot Ta Xr mmap 2 Ta Fa prot Copied: stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 (from r307538, head/lib/libsysdecode/sysdecode_quotactl_cmd.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_quotactl_cmd.3 Thu Jan 12 22:06:57 2017 (r311999, copy of r307538, head/lib/libsysdecode/sysdecode_quotactl_cmd.3) @@ -0,0 +1,93 @@ +.\" +.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org> +.\" 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 October 17, 2016 +.Dt sysdecode_quotactl_cmd 3 +.Os +.Sh NAME +.Nm sysdecode_quotactl_cmd +.Nd output name of quotactl command +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h +.Ft bool +.Fn sysdecode_quotactl_cmd "FILE *fp" "int cmd" +.Sh DESCRIPTION +The +.Fn sysdecode_quotactl_cmd +function outputs a text description of the +.Fa cmd +argument to +.Xr quotactl 2 +to the stream +.Fa fp . +The description is formatted as an invocation of the +.Dv QCMD +macro defined in the +.In ufs/ufs/quota.h +header. +.Pp +The function first computes the primary and secondary values used by +.Dv QCMD +to construct +.Fa cmd . +If the primary command value does not represent a known constant, +.Fn sysdecode_quotactl_cmd +does not generate any output and returns +.Dv false . +Otherwise, +.Fn sysdecode_quotactl_cmd +outputs text depicting an invocation of +.Dv QCMD +with the associated constants for the primary and secondary command values +and returns +.Dv true . +If the secondary command values does not represent a known constant, +its value is output as a hexadecimal integer. +.Sh RETURN VALUES +The +.Nm sysdecode_quotactl_cmd +function returns +.Dv true +if it outputs a description of +.Fa cmd +and +.Dv false +if it does not. +.Sh EXAMPLES +The statement +.Pp +.Dl sysdecode_quotatcl_cmd(stdout, QCMD(Q_GETQUOTA, USRQUOTA); +.Pp +outputs the text +.Dq QCMD(Q_GETQUOTA, USRQUOTA) +to standard output. +.Sh SEE ALSO +.Xr sysdecode 3 Copied: stable/11/lib/libsysdecode/sysdecode_sigcode.3 (from r307538, head/lib/libsysdecode/sysdecode_sigcode.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_sigcode.3 Thu Jan 12 22:06:57 2017 (r311999, copy of r307538, head/lib/libsysdecode/sysdecode_sigcode.3) @@ -0,0 +1,83 @@ +.\" +.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org> +.\" 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 October 17, 2016 +.Dt sysdecode_sigcode 3 +.Os +.Sh NAME +.Nm sysdecode_sigcode +.Nd lookup name of signal code +.Sh LIBRARY +.Lb libsysdecode +.Sh SYNOPSIS +.In sys/types.h +.In stdbool.h +.In sysdecode.h +.Ft const char * +.Fn sysdecode_sigcode "int signal" "int si_code" +.Sh DESCRIPTION +The +.Fn sysdecode_sigcode +function returns a text description of the +.Fa si_code +field of the +.Vt siginfo_t +object associated with an instance of signal +.Fa sig . +The text description contains the name of the C macro whose value matches +.Fa si_code . +General purpose signal codes such as +.Dv SI_USER +are handled as well as signal-specific codes for +.Dv SIGBUS , +.Dv SIGCHLD , +.Dv SIGFPE , +.Dv SIGILL , +.Dv SIGSEGV +and +.Dv SIGTRAP . +If +.Fa si_code +does not represent a known signal code, +.Fn sysdecode_sigcode +returns +.Dv NULL . +.Sh RETURN VALUES +The +.Fn sysdecode_sigcode +function returns a pointer to a signal code description or +.Dv NULL +if +.Fa si_code +is not a known signal code. +.Sh SEE ALSO +.Xr sysdecode_sigbus_code 3 , +.Xr sysdecode_sigchld_code 3 , +.Xr sysdecode_sigfpe_code 3 , +.Xr sysdecode_sigill_code 3 , +.Xr sysdecode_sigsegv_code 3 , +.Xr sysdecode_sigtrap_code 3 Copied: stable/11/lib/libsysdecode/sysdecode_sockopt_name.3 (from r307538, head/lib/libsysdecode/sysdecode_sockopt_name.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libsysdecode/sysdecode_sockopt_name.3 Thu Jan 12 22:06:57 2017 (r311999, copy of r307538, head/lib/libsysdecode/sysdecode_sockopt_name.3) @@ -0,0 +1,61 @@ +.\" +.\" Copyright (c) 2016 John Baldwin <jhb@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701122206.v0CM6w2c091165>