Author: rpaulo
Date: Thu Sep 16 11:33:31 2010
New Revision: 212727
URL: http://svn.freebsd.org/changeset/base/212727

Log:
  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

Modified:
  head/usr.bin/kdump/mksubr

Modified: head/usr.bin/kdump/mksubr
==============================================================================
--- head/usr.bin/kdump/mksubr   Thu Sep 16 10:53:01 2010        (r212726)
+++ head/usr.bin/kdump/mksubr   Thu Sep 16 11:33:31 2010        (r212727)
@@ -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:]]+M
                ++i; \
                printf "\tif(!((flags>0)^((%s)>0)))\n\t\tif_print_or(flags, %s, 
or);\n", $i, $i }'
 cat <<_EOF_
+        printf(">");
 }
 
 _EOF_
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to