diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2010-09-16 11:33:31 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2010-09-16 11:33:31 +0000 |
commit | a5675467db63223c48c077b5d11728af70c0d848 (patch) | |
tree | d4baf4f1b9697b9b58ab99ce8dd05b21025a53f7 /usr.bin | |
parent | 10f125026cd544d1d2829b8f0d72332c62d90e2b (diff) | |
download | FreeBSD-src-a5675467db63223c48c077b5d11728af70c0d848.zip FreeBSD-src-a5675467db63223c48c077b5d11728af70c0d848.tar.gz |
When generating functions to print the arguments of system calls with
bitwise parameters (e.g. mmap), print the syscall parameter value first.
The resulting output looks like the %b specifier of printf(9).
Before:
mmap(0,0x8000,PROT_READ|PROT_WRITE,...
After:
mmap(0,0x8000,0x3<PROT_READ|PROT_WRITE>,...
Submitted by: Norberto Lopes <nlopes.ml at gmail.com>
Idea from: freebsd-arch/2006-April/005116.html
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/kdump/mksubr | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 797c32c..043d712 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -49,6 +49,7 @@ void $name (int arg) { int or = 0; + printf("%#x<", arg); _EOF_ egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \ $include_dir/$file | \ @@ -58,6 +59,7 @@ _EOF_ ++i; \ printf "\tif(!((arg>0)^((%s)>0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }' cat <<_EOF_ + printf(">"); if (or == 0) (void)printf("<invalid>%ld", (long)arg); } @@ -432,6 +434,8 @@ sendrecvflagsname (int flags) (void)printf("0"); return; } + + printf("%#x<", flags); _EOF_ egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]]*" $include_dir/sys/socket.h | \ awk '{ for (i = 1; i <= NF; i++) \ @@ -440,6 +444,7 @@ egrep "^#[[:space:]]*define[[:space:]]+MSG_[A-Z]+[[:space:]]+0x[0-9]+[[:space:]] ++i; \ printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, or);\n", $i, $i }' cat <<_EOF_ + printf(">"); } _EOF_ |