diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-19 18:20:13 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-19 18:20:13 +0000 |
commit | a879809cfaf556cdf54894f91ea968ccad8e8c84 (patch) | |
tree | 039743dadb0d2cfa4ee275623ec1a63627d17c46 /usr.bin | |
parent | 1cc10b6938d5899d30e9566130563b5295bbf628 (diff) |
Add fancy kdump support for the openat(2) system calls.
ok otto@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/kdump/kdump.c | 95 | ||||
-rw-r--r-- | usr.bin/kdump/kdump_subr.h | 3 | ||||
-rw-r--r-- | usr.bin/kdump/mksubr | 5 |
3 files changed, 98 insertions, 5 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index e4ae0478176..8de69c1822d 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.60 2011/07/17 07:49:34 otto Exp $ */ +/* $OpenBSD: kdump.c,v 1.61 2011/07/19 18:20:11 matthew Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -48,6 +48,7 @@ #include <ctype.h> #include <err.h> +#include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -143,6 +144,7 @@ static void ktrsysret(struct ktr_sysret *); static void ktrstruct(char *, size_t); static void setemul(const char *); static void usage(void); +static void atfd(int); int main(int argc, char *argv[]) @@ -540,7 +542,7 @@ ktrsyscall(struct ktr_syscall *ktr) break; case SYS_chmod: case SYS_fchmod: - pn( NULL); + pn(NULL); pn(modename); break; case SYS_fcntl: { @@ -728,6 +730,84 @@ ktrsyscall(struct ktr_syscall *ktr) pn(NULL); pn(wait4optname); break; + case SYS_faccessat: + pn(atfd); + pn(NULL); + pn(accessmodename); + pn(atflagsname); + break; + case SYS_fchmodat: + pn(atfd); + pn(NULL); + pn(modename); + pn(atflagsname); + break; + case SYS_fchownat: + pn(atfd); + pn(NULL); + pn(NULL); + pn(NULL); + pn(atflagsname); + break; + case SYS_fstatat: + pn(atfd); + pn(NULL); + pn(NULL); + pn(atflagsname); + break; + case SYS_linkat: + pn(atfd); + pn(NULL); + pn(atfd); + pn(NULL); + pn(atflagsname); + break; + case SYS_mkdirat: + case SYS_mkfifoat: + case SYS_mknodat: + pn(atfd); + pn(NULL); + pn(modename); + break; + case SYS_openat: { + int flags; + int mode; + + pn(atfd); + pn(NULL); + if (!fancy) + break; + flags = ap[0]; + mode = ap[1]; + (void)putchar(','); + flagsandmodename(flags, mode); + ap += 2; + narg -= 2; + break; + } + case SYS_readlinkat: + pn(atfd); + break; + case SYS_renameat: + pn(atfd); + pn(NULL); + pn(atfd); + break; + case SYS_symlinkat: + pn(NULL); + pn(atfd); + break; + case SYS_unlinkat: + pn(atfd); + pn(NULL); + pn(atflagsname); + break; + case SYS_utimensat: + pn(atfd); + pn(NULL); + pn(NULL); + pn(atflagsname); + break; } nonnative: @@ -1160,3 +1240,14 @@ setemul(const char *name) } warnx("Emulation `%s' unknown", name); } + +static void +atfd(int fd) +{ + if (fd == AT_FDCWD) + (void)printf("AT_FDCWD"); + else if (decimal) + (void)printf("%d", fd); + else + (void)printf("%#x", fd); +} diff --git a/usr.bin/kdump/kdump_subr.h b/usr.bin/kdump/kdump_subr.h index b08742ef538..36a1872b36e 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.3 2011/07/08 19:29:44 otto Exp $ */ +/* $OpenBSD: kdump_subr.h,v 1.4 2011/07/19 18:20:12 matthew Exp $ */ /* * Copyright(c) 2006 2006 David Kirchner <dpk@dpk.net> * @@ -25,6 +25,7 @@ void fcntlcmdname(int, int); void rtprioname(int); void modename(int); void flagsname(int); +void atflagsname(int); void flagsandmodename(int, int); void accessmodename(int); void mmapprotname(int); diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 6652aa99a81..29150f81e9c 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: mksubr,v 1.5 2011/07/08 19:29:44 otto Exp $ +# $OpenBSD: mksubr,v 1.6 2011/07/19 18:20:12 matthew Exp $ # # Copyright (c) 2006 David Kirchner <dpk@dpk.net> # @@ -334,6 +334,7 @@ _EOF_ auto_or_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h" auto_or_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" +auto_or_type "atflagsname" "AT_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" auto_or_type "accessmodename" "[A-Z]_OK[[:space:]]+0?x?[0-9A-Fa-f]+" "sys/unistd.h" auto_or_type "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h" auto_or_type "mmapflagsname" "MAP_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h" @@ -382,7 +383,7 @@ fcntlcmdname (int cmd, int arg) { switch (cmd) { _EOF_ -egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z]+[[:space:]]+[0-9]+[[:space:]]*" \ +egrep "^#[[:space:]]*define[[:space:]]+F_[A-Z_]+[[:space:]]+[0-9]+[[:space:]]*" \ $include_dir/sys/fcntl.h | \ awk 'BEGIN { o=0 } { for (i = 1; i <= NF; i++) \ if ($i ~ /define/) \ |