Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern create an array of altsyscallnames, which are the s...



details:   https://anonhg.NetBSD.org/src/rev/307920eee8e3
branches:  trunk
changeset: 340671:307920eee8e3
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Sep 24 14:30:52 2015 +0000

description:
create an array of altsyscallnames, which are the syscall names that the
libc api uses. For example syscallnames[293] = "__sigprocmask14",
altsyscallnames[293] = "sigprocmask". This is so that things like dtrace
can use the system call names everyone uses. The array is sparse; if the
names were the same (or for compat names) they are not copied and the array
has NULL for them.

diffstat:

 sys/kern/makesyscalls.sh |  30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diffs (107 lines):

diff -r cb9a60cfe9f5 -r 307920eee8e3 sys/kern/makesyscalls.sh
--- a/sys/kern/makesyscalls.sh  Thu Sep 24 14:26:44 2015 +0000
+++ b/sys/kern/makesyscalls.sh  Thu Sep 24 14:30:52 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: makesyscalls.sh,v 1.153 2015/05/09 10:57:04 pooka Exp $
+#      $NetBSD: makesyscalls.sh,v 1.154 2015/09/24 14:30:52 christos Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -82,13 +82,17 @@
 sysprotos="sys.protos"
 syscompat_pref="sysent."
 sysent="sysent.switch"
-sysnamesbottom="sysnames.bottom"
+sysnamesbottom="$sysnames.bottom"
+sysnamesfriendly="$sysnames.friendly"
 rumptypes="rumphdr.types"
 rumpprotos="rumphdr.protos"
 systracetmp="systrace.$$"
 systraceret="systraceret.$$"
 
-trap "rm $sysdcl $sysprotos $sysent $sysnamesbottom $rumpsysent $rumptypes $rumpprotos $systracetmp $systraceret" 0
+cleanup() {
+    rm $sysdcl $sysprotos $sysent $sysnamesbottom $sysnamesfriendly $rumpsysent $rumptypes $rumpprotos $systracetmp $systraceret
+}
+trap "cleanup" 0
 
 # Awk program (must support nawk extensions)
 # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
@@ -171,7 +175,8 @@
        sysdcl = \"$sysdcl\"
        syscompat_pref = \"$syscompat_pref\"
        sysent = \"$sysent\"
-       sysnamesbottom = \"$sysnamesbottom\"
+       sysnamesbottom = \"${sysnames}.bottom\"
+       sysnamesfriendly = \"${sysnames}.friendly\"
        rumpprotos = \"$rumpprotos\"
        rumptypes = \"$rumptypes\"
        sys_nosys = \"$sys_nosys\"
@@ -311,8 +316,12 @@
        # hide the include files from it.
        printf "#if defined(_KERNEL_OPT)\n" > sysnames
 
+       printf "#else /* _KERNEL_OPT */\n" > sysnamesbottom
+       printf "#include <sys/null.h>\n" > sysnamesbottom
        printf "#endif /* _KERNEL_OPT */\n\n" > sysnamesbottom
        printf "const char *const %s[] = {\n",namesname > sysnamesbottom
+       printf "\n\n/* libc style syscall names */\n" > sysnamesfriendly
+       printf "const char *const alt%s[] = {\n", namesname > sysnamesfriendly
 
        printf " * created from%s\n */\n\n", $0 > sysnumhdr
        printf "#ifndef _" constprefix "SYSCALL_H_\n" > sysnumhdr
@@ -442,6 +451,7 @@
        print > sysnumhdr
        print > sysprotos
        print > sysnamesbottom
+       print > sysnamesfriendly
        print > systrace
        print > systracetmp
        print > systraceret
@@ -852,6 +862,12 @@
        # output syscall name for names table
        printf("\t/* %3d */\t\"%s%s\",\n", syscall, compatwrap_, funcalias) \
            > sysnamesbottom
+       if (compatwrap_ != "" || fbase == funcalias)
+               printf("\t/* %3d */\tNULL, /* %s%s */\n", syscall, \
+                   compatwrap_, funcalias) > sysnamesfriendly
+       else
+               printf("\t/* %3d */\t\"%s%s\",\n", syscall, compatwrap_, \
+                   fbase) > sysnamesfriendly
 
        # output syscall number of header, if appropriate
        if (type == "STD" || type == "NOARGS" || type == "INDIR" || \
@@ -1041,6 +1057,8 @@
        print fillerpsysent(syscall, rumpnoflags, rumpnosys, comment) > rumpsysent
        printf("\t/* %3d */\t\"#%d (%s)\",\n", syscall, syscall, comment) \
            > sysnamesbottom
+       printf("\t/* %3d */\tNULL, /* %s */\n", syscall, comment) \
+           > sysnamesfriendly
        if ($2 != "UNIMPL")
                printf("\t\t\t\t/* %d is %s */\n", syscall, comment) > sysnumhdr
        syscall++
@@ -1106,6 +1124,8 @@
                        print fillerpsysent(syscall, rumpnoflags, rumpnosys, "filler") > rumpsysent
                        printf("\t/* %3d */\t\"# filler\",\n", syscall) \
                            > sysnamesbottom
+                       printf("\t/* %3d */\tNULL, /* filler */\n", syscall) \
+                           > sysnamesfriendly
                        syscall++
                }
        }
@@ -1117,6 +1137,7 @@
        if (haverumpcalls)
                printf("#endif /* !RUMP_CLIENT */\n") > sysprotos
        printf("};\n") > sysnamesbottom
+       printf("};\n") > sysnamesfriendly
        printf("#define\t%sMAXSYSCALL\t%d\n", constprefix, maxsyscall) > sysnumhdr
        if (nsysent)
                printf("#define\t%sNSYSENT\t%d\n", constprefix, nsysent) > sysnumhdr
@@ -1132,6 +1153,7 @@
 printf "\n#endif /* _RUMP_RUMP_SYSCALLS_H_ */\n" >> $rumpprotos
 cat $sysdcl $sysent > $syssw
 cat $sysnamesbottom >> $sysnames
+cat $sysnamesfriendly >> $sysnames
 cat $rumpsysent >> $rumpcalls
 
 touch $rumptypes



Home | Main Index | Thread Index | Old Index