History log of /openbsd-current/usr.bin/kdump/mksubr
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.40 13-Aug-2023 visa

kevent: Add precision and abstimer flags for EVFILT_TIMER

Add timer precision flags NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS
and NOTE_NSECONDS for EVFILT_TIMER. Also, add an initial implementation
of NOTE_ABSTIME timers.

Similar kevent(2) flags exist on FreeBSD, NetBSD and XNU.

Initial diff by and OK aisha@
OK mpi@


Revision tags: OPENBSD_7_3_BASE
# 1.39 19-Dec-2022 guenther

Improve reporting of waitid(2)'s idtype/id and options arguments
Add mimmutable(2) to report like munmap(2)


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.38 22-Feb-2022 deraadt

MAXCOMLEN is no longer needed in these programs, so remove the annotation
from sys/param.h include lines, or remove the include lines entirely if
it this was the least requirement.
ok millert


Revision tags: OPENBSD_7_0_BASE
# 1.37 17-Sep-2021 deraadt

sys/param.h is only needed for MAXCOMLEN, but a few header files
which must be manually included in userland were missing


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.36 05-Nov-2018 anton

trace struct flock; ok visa@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 14-Feb-2018 otto

Zero as (un)mount flag is valid; ok millert@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.39 19-Dec-2022 guenther

Improve reporting of waitid(2)'s idtype/id and options arguments
Add mimmutable(2) to report like munmap(2)


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.38 22-Feb-2022 deraadt

MAXCOMLEN is no longer needed in these programs, so remove the annotation
from sys/param.h include lines, or remove the include lines entirely if
it this was the least requirement.
ok millert


Revision tags: OPENBSD_7_0_BASE
# 1.37 17-Sep-2021 deraadt

sys/param.h is only needed for MAXCOMLEN, but a few header files
which must be manually included in userland were missing


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.36 05-Nov-2018 anton

trace struct flock; ok visa@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 14-Feb-2018 otto

Zero as (un)mount flag is valid; ok millert@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.38 22-Feb-2022 deraadt

MAXCOMLEN is no longer needed in these programs, so remove the annotation
from sys/param.h include lines, or remove the include lines entirely if
it this was the least requirement.
ok millert


Revision tags: OPENBSD_7_0_BASE
# 1.37 17-Sep-2021 deraadt

sys/param.h is only needed for MAXCOMLEN, but a few header files
which must be manually included in userland were missing


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.36 05-Nov-2018 anton

trace struct flock; ok visa@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 14-Feb-2018 otto

Zero as (un)mount flag is valid; ok millert@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.37 17-Sep-2021 deraadt

sys/param.h is only needed for MAXCOMLEN, but a few header files
which must be manually included in userland were missing


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.36 05-Nov-2018 anton

trace struct flock; ok visa@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 14-Feb-2018 otto

Zero as (un)mount flag is valid; ok millert@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.36 05-Nov-2018 anton

trace struct flock; ok visa@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.35 14-Feb-2018 otto

Zero as (un)mount flag is valid; ok millert@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.35 14-Feb-2018 otto

Zero as (un)mount flag is valid; ok millert@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.34 11-Feb-2018 otto

fix madvise(2) flags matching; ok deraadt@ tom@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@


# 1.33 29-Nov-2017 guenther

fcntl(F_GETOWN) doesn't have an argument, so don't display it. While
here, make it easier to extend the set of such fcntl() commands

ok deraadt@


Revision tags: OPENBSD_6_2_BASE
# 1.32 28-Apr-2017 mpi

Display futex(2) operations and arguments.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.31 07-Jun-2016 deraadt

ktrace support for pollfd[] arrays
ok guenther


# 1.30 22-Mar-2016 guenther

Format the flags argument to sendsyslog()

ok deraadt@ bluhm@


Revision tags: OPENBSD_5_9_BASE
# 1.29 14-Jan-2016 guenther

Display struct event more like other structs: show all members and use cpp
define names. Use the mksubr infrastructure for EVFILT_*,
EV_*, and (with some kludging) NOTE_* values. If EV_ERROR is set,
include the errno string for the data member.

Also, do MSG_* parsing on the msg_flags member of struct msghdr.

ok millert@


Revision tags: OPENBSD_5_8_BASE
# 1.28 17-May-2015 deraadt

isatty() is used by stdio to determine the buffering mode. Add a F_ISATTY
option to fcntl(), so that isatty() can use this rather than than the bloated
ioctl() interface. Reducing uses of ioctl() by libc makes it easier to
constrain programs with various kinds of systrace sandboxes.
ok guenther, previously discussed as a concept with nicm


# 1.27 17-Apr-2015 guenther

The first argument to socket/socketpair is an address family, not a protocol
family. (sysctl(3) is practically the only place where PF_* is correct)


Revision tags: OPENBSD_5_7_BASE
# 1.26 18-Jan-2015 guenther

Eliminate a gcc warnings by not #defining _KERNEL when pulling in
<sys/socket.h>: it doesn't expose anything kdump cares about.
Also, COMPAT_43 is dead

warning noted by deraadt@


# 1.25 11-Dec-2014 guenther

Make quotactlcmd formatting consistent with others
Fix some indentation in the generated .c file


# 1.24 08-Dec-2014 guenther

Convert syscall argument handling from a giant switch to a giant table.
While at it, use formatters for fds, counts, ids of all types, and "small
buffer sizes" that always show them in decimal, while paths, pointers, and
"big buffer sizes" get formatters that always show them in hex. The -d
option only affects args when the -n option is used or for unknown syscalls,
as well as syscall return values, and unrecognized ioctls.

ok otto@ millert@


# 1.23 13-Oct-2014 guenther

Add dumping of struct dqblk done by quotactl(2)

ok millert@


# 1.22 17-Sep-2014 guenther

Add display of the flags to pipe2, dup3, and accept4, display of
MSG_CMSG_CLOEXEC in recvmsg, and display of SOCK_{CLOEXEC,NONBLOCK}
in socket and socketpair.
Do _not_ display the O_ACCMODE bits in the arg to fcntl(F_SETFD)

ok miod@


# 1.21 17-Aug-2014 guenther

Use %#o instead of %#x for mode_t


Revision tags: OPENBSD_5_6_BASE
# 1.20 02-Jul-2014 otto

properly process minherit(2) flags; ok guenther@ matthew@


# 1.19 27-Jun-2014 matthew

Cleanup support for legacy mmap flags

Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine
them to either be aliases for existing flags (e.g., MAP_COPY ->
MAP_PRIVATE) or 0.

Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel
and kdump can remain compatible with current OpenBSD binaries.

ok deraadt


Revision tags: OPENBSD_5_5_BASE
# 1.18 21-Dec-2013 guenther

Recognize itimer and ktrace facility names to {get,set}itimer() and ktrace()

ok otto@


Revision tags: OPENBSD_5_4_BASE
# 1.17 03-Jul-2013 guenther

For consistency, move the functions that aren't generated at build-time
from mksubr to kdump.c

ok otto@ millert@


# 1.16 01-Jul-2013 guenther

Tweak regexp so that RUSAGE_CHILDREN will be matched and displayed


# 1.15 17-Jun-2013 guenther

Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and
{clock,pthread}_getcpuclockid() functions.

Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@
ok matthew@


Revision tags: OPENBSD_5_3_BASE
# 1.14 25-Dec-2012 guenther

Report macro names for the second argument to shutdown(), getrusage(),
pathconf(), and fpathconf(), and for poll()'s INFTIM.
When open()'s flag arg doesn't include O_CREAT, don't show the third argument
unless th e-n option is given. Ditto for fcntl()'s F_GETFD and F_GETFL ops.
Show sysctl()'s KERN_PROC_KTHREAD as "kthread".

ok otto@


Revision tags: OPENBSD_5_2_BASE
# 1.13 21-Jul-2012 matthew

Make kdump recognize the __MAP_NOREPLACE flag.

ok deraadt


# 1.12 08-Jul-2012 guenther

Handle the O_ACCMODE bits correctly, so that O_RDONLY is displayed
even when other flag bits are set

ok otto@


# 1.11 20-Jun-2012 guenther

CLOCK_* moved from sys/time.h to sys/_time.h

ok otto@ kettenis@


# 1.10 12-Apr-2012 deraadt

remove rfork(); ok guenther miod


# 1.9 19-Mar-2012 guenther

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@


# 1.8 20-Feb-2012 guenther

- add more ptrace() ops
- be robust against a ktrace file the contains a record with
ktr_len==SIZE_MAX, instead of reallocating its buffer to zero size
- format the clockid_t argument to clock_*() and __thrsleep() as CLOCK_*
- format the sigset_t argument to sigprocmask() and __thrsigdivert(), the
return from sigprocmask(), and the mask reported for PSIG records
as a bitset of SIG* values, except that if most the bits are set
then invert it and prefix with '~'
- show the next level of the kern.proc sysctl
- __tfork() creates procs, so do the mappidtoemul() handling
- refactor ktrstat()'s time printing bits and fix a whitespace glitch
in its output
- reduce stack usage in ktrstruct()
- a value of zero is not an error for mode bits (S_*), atflag bits
(AT_*), wait options (W*), or shmat flags (SHM_*)

ok otto@


Revision tags: OPENBSD_5_1_BASE
# 1.7 19-Sep-2011 deraadt

teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies.
ok miod pirofti


Revision tags: OPENBSD_5_0_BASE
# 1.6 19-Jul-2011 matthew

Add fancy kdump support for the openat(2) system calls.

ok otto@


# 1.5 08-Jul-2011 otto

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@


# 1.4 04-Jul-2011 otto

Big restructuring of the main switch making it much more readable.
Also, handle offset_t (long long) args and padding in a consistent manner.
ok deraadt@


# 1.3 20-Jun-2011 otto

more fancy kdump output, mostly from FreeBSD; ok deraadt@ tedu@


# 1.2 16-Jun-2011 otto

Local changes to make this work on OpenBSD. Not used functions disabled for
now.


# 1.1 16-Jun-2011 otto

mksubr from freebsd, to be used to generate flags to name translation
for kdump. Added missing license to the file, with the kind
permission of the author David Kirchner. Not used yet. ok miod@