[BACK]Return to mksubr CVS log [TXT][DIR] Up to [local] / src / usr.bin / kdump

Diff for /src/usr.bin/kdump/mksubr between version 1.11 and 1.12

version 1.11, 2012/06/20 07:30:01 version 1.12, 2012/07/08 10:23:36
Line 48 
Line 48 
 # Automatically generates a C function that will print out the  # Automatically generates a C function that will print out the
 # numeric input as a pipe-delimited string of the appropriate  # numeric input as a pipe-delimited string of the appropriate
 # #define keys. ex:  # #define keys. ex:
 # S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH  # 0x1a4<S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH>
 # The XOR is necessary to prevent including the "0"-value in every  # The XOR is necessary to prevent including the "0"-value in every
 # line.  # line.
 #  #
Line 120 
Line 120 
 }  }
   
 #  #
   # Automatically generates a C function that will print out a
   # file flags input as a pipe-delimited string of the appropriate
   # #define keys. ex:
   # 0x30000<O_RDONLY|O_CLOEXEC|O_DIRECTORY>
   # This is different than the others to handle O_RDONLY correctly when
   # other flags are present and to diagnose an invalid O_ACCMODE value
   #
   auto_fflags_type () {
           local name grep file
           name=$1
           grep=$2
           file=$3
   
           cat <<_EOF_
   /* AUTO */
   void
   $name (int arg)
   {
           printf("%#x<", arg);
           switch (arg & O_ACCMODE) {
           case O_RDONLY:
                   printf("O_RDONLY");
                   break;
           case O_WRONLY:
                   printf("O_WRONLY");
                   break;
           case O_RDWR:
                   printf("O_RDWR");
                   break;
           default:
                   printf("<invalid>O_ACCMODE");
                   break;
           }
   _EOF_
           egrep "^#[[:space:]]*define[[:space:]]+"${grep}"[[:space:]]*" \
                   $include_dir/$file | \
           egrep -v 'O_(RD(ONLY|WR)|WRONLY|ACCMODE)' | \
           awk '{ for (i = 1; i <= NF; i++) \
                   if ($i ~ /define/) \
                           break; \
                   ++i; \
                   printf "\tif (arg & %s) printf (\"|%%s\", \"%s\");\n", $i, $i }'
   cat <<_EOF_
           printf(">");
   }
   
   _EOF_
   }
   
   
   #
 # Automatically generates a C function used when the argument  # Automatically generates a C function used when the argument
 # maps to a single, specific #definition  # maps to a single, specific #definition
 #  #
Line 400 
Line 451 
 _EOF_  _EOF_
   
 auto_orz_type "modename" "S_[A-Z]+[[:space:]]+[0-6]{7}" "sys/stat.h"  auto_orz_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_fflags_type "flagsname" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h"
 auto_orz_type "atflagsname" "AT_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h"  auto_orz_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 "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 "mmapprotname" "PROT_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h"

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12