diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-12-25 09:35:52 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-12-25 09:35:52 +0000 |
commit | b44c7115d776339da65305d602441c0df7da54ef (patch) | |
tree | 30e266162fa6d2ee3080b37613646cc00af5f6a8 /usr.bin | |
parent | 486d2f917c8ab55c62a9f3165051749b0a0f499a (diff) |
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@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/kdump/kdump.c | 33 | ||||
-rw-r--r-- | usr.bin/kdump/kdump_subr.h | 6 | ||||
-rw-r--r-- | usr.bin/kdump/mksubr | 21 |
3 files changed, 50 insertions, 10 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 60f2a9dc64f..d62332fbae7 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.76 2012/12/05 12:54:15 millert Exp $ */ +/* $OpenBSD: kdump.c,v 1.77 2012/12/25 09:35:51 guenther Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -59,6 +59,7 @@ #include <err.h> #include <fcntl.h> #include <limits.h> +#include <poll.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -159,6 +160,7 @@ static void ktrstruct(char *, size_t); static void setemul(const char *); static void usage(void); static void atfd(int); +static void polltimeout(int); int main(int argc, char *argv[]) @@ -717,6 +719,10 @@ ktrsyscall(struct ktr_syscall *ktr) pn(NULL); pn(sendrecvflagsname); break; + case SYS_shutdown: + pn(NULL); + pn(shutdownhowname); + break; case SYS___semctl: pn(NULL); pn(NULL); @@ -741,6 +747,11 @@ ktrsyscall(struct ktr_syscall *ktr) case SYS_clock_getres: pn(clockname); break; + case SYS_poll: + pn(NULL); + pn(NULL); + pn(polltimeout); + break; case SYS_sigaction: pn(signame); break; @@ -777,6 +788,9 @@ ktrsyscall(struct ktr_syscall *ktr) pn(NULL); pn(wait4optname); break; + case SYS_getrusage: + pn(rusagewho); + break; case SYS___thrsleep: pn(NULL); pn(clockname); @@ -862,6 +876,11 @@ ktrsyscall(struct ktr_syscall *ktr) pn(NULL); pn(atflagsname); break; + case SYS_pathconf: + case SYS_fpathconf: + pn(NULL); + pn(pathconfname); + break; } nonnative: @@ -900,6 +919,7 @@ static struct ctlname kernprocname[] = { "tty" }, { "uid" }, { "ruid" }, + { "kthread" }, }; static struct ctlname ttysname[] = CTL_KERN_TTY_NAMES; static struct ctlname semname[] = CTL_KERN_SEMINFO_NAMES; @@ -1605,3 +1625,14 @@ atfd(int fd) else (void)printf("%#x", fd); } + +static void +polltimeout(int timeout) +{ + if (timeout == INFTIM) + (void)printf("INFTIM"); + else if (decimal) + (void)printf("%d", timeout); + else + (void)printf("%#x", timeout); +} diff --git a/usr.bin/kdump/kdump_subr.h b/usr.bin/kdump/kdump_subr.h index f4c3763e441..f27c3fa10fd 100644 --- a/usr.bin/kdump/kdump_subr.h +++ b/usr.bin/kdump/kdump_subr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump_subr.h,v 1.7 2012/04/12 12:33:04 deraadt Exp $ */ +/* $OpenBSD: kdump_subr.h,v 1.8 2012/12/25 09:35:51 guenther Exp $ */ /* * Copyright(c) 2006 2006 David Kirchner <dpk@dpk.net> * @@ -48,6 +48,7 @@ void mlockallname(int); void shmatname(int); void nfssvcname(int); void whencename(int); +void pathconfname(int); void rlimitname(int); void shutdownhowname(int); void prioname(int); @@ -61,6 +62,7 @@ void extattrctlname(int); void kldsymcmdname(int); void sendfileflagsname(int); void acltypename(int); +void rusagewho(int); void sigactionflagname(int); void sigprocmaskhowname(int); void lio_listioname(int); @@ -68,4 +70,4 @@ void minheritname(int); void quotactlname(int); void ptraceopname(int); -extern int decimal, resolv; +extern int decimal, resolv, fancy; diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index bbd36329df6..1682fd9e99a 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: mksubr,v 1.13 2012/07/21 07:16:03 matthew Exp $ +# $OpenBSD: mksubr,v 1.14 2012/12/25 09:35:51 guenther Exp $ # # Copyright (c) 2006 David Kirchner <dpk@dpk.net> # @@ -251,6 +251,7 @@ cat <<_EOF_ #include <netinet/in.h> #include <sys/param.h> #include <sys/mount.h> +#include <sys/poll.h> #include <sys/ptrace.h> #include <sys/resource.h> #include <sys/reboot.h> @@ -415,10 +416,11 @@ semgetname (int flag) { void flagsandmodename (int flags, int mode) { flagsname (flags); - (void)putchar(','); if ((flags & O_CREAT) == O_CREAT) { + (void)putchar(','); modename (mode); - } else { + } else if (!fancy) { + (void)putchar(','); if (decimal) { (void)printf("<unused>%ld", (long)mode); } else { @@ -468,8 +470,9 @@ auto_orz_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}" "sys/shm.h" #auto_or_type "nfssvcname" "NFSSVC_[A-Z]+[[:space:]]+0x[0-9]+" "nfsserver/nfs.h" # auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" +auto_switch_type "pathconfname" "_PC_[_A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h" -#auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" +auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" #auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" @@ -480,6 +483,7 @@ auto_switch_type "clockname" "CLOCK_[A-Z]+[[:space:]]+[0-9]+" "sys/_time.h" #auto_switch_type "kldsymcmdname" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" #auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h" #auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h" +auto_switch_type "rusagewho" "RUSAGE_[A-Z]+[[:space:]]+[-0-9]+" "sys/resource.h" auto_orz_type "sigactionflagname" "SA_[A-Z]+[[:space:]]+0x[0-9]+" "sys/signal.h" auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h" auto_switch_type "sigill_name" "ILL_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h" @@ -525,8 +529,8 @@ cat <<_EOF_ default: /* Should not reach */ (void)printf("<invalid=%ld>", (long)cmd); } - (void)putchar(','); - if (cmd == F_GETFD || cmd == F_SETFD) { + if (cmd == F_SETFD) { + (void)putchar(','); if (arg == FD_CLOEXEC) (void)printf("FD_CLOEXEC"); else if (arg == 0) @@ -537,9 +541,12 @@ cat <<_EOF_ else (void)printf("<invalid>%#lx", (long)arg); } + } else if (cmd == F_SETFL) { + (void)putchar(','); flagsname(arg); - } else { + } else if (!fancy || (cmd != F_GETFD && cmd != F_GETFL)) { + (void)putchar(','); if (decimal) (void)printf("%ld", (long)arg); else |