Author: jhb
Date: Fri Jul 24 19:35:06 2009
New Revision: 195854
URL: http://svn.freebsd.org/changeset/base/195854

Log:
  MFC: Several cleanups to the syscall tables:
  - Add explicit prototypes for lkmnosys() and lkmressys() in <sys/sysent.h>
    and remove hacks for those routines from makesyscalls.sh.
  - Change the LKM syscall entries in the freebsd32 table to use lkmnosys
    rather than nosys.
  - Use NOPROTO for __syscall() to remove more magic logic from
    makesyscalls.sh.
  - Retire the unused nfsclnt() system call and mark it as UNIMPL rather than
    NOIMPL.
  - Remove the NOIMPL system call type.
  - Allow multiple flags in the type system call type field.  Use this to
    retire CPT_NOA.
  - Update the comment descriptions for COMPAT[45] system calls in various
    generated files.
  - Update comments in syscalls.master.
  - Include defintions for audit identifiers for compat system calls in
    <sys/sysproto.h>.

Modified:
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/sys/Symbol.map
  stable/7/sys/   (props changed)
  stable/7/sys/compat/freebsd32/syscalls.master
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/kern/makesyscalls.sh
  stable/7/sys/kern/syscalls.master
  stable/7/sys/sys/sysent.h

Modified: stable/7/lib/libc/sys/Symbol.map
==============================================================================
--- stable/7/lib/libc/sys/Symbol.map    Fri Jul 24 19:12:19 2009        
(r195853)
+++ stable/7/lib/libc/sys/Symbol.map    Fri Jul 24 19:35:06 2009        
(r195854)
@@ -202,7 +202,6 @@ FBSD_1.0 {
        nanosleep;
        netbsd_lchown;
        netbsd_msync;
-       nfsclnt;
        nfssvc;
        nfstat;
        nlstat;
@@ -746,8 +745,6 @@ FBSDprivate_1.0 {
        __sys_netbsd_lchown;
        _netbsd_msync;
        __sys_netbsd_msync;
-       _nfsclnt;
-       __sys_nfsclnt;
        _nfssvc;
        __sys_nfssvc;
        _nfstat;

Modified: stable/7/sys/compat/freebsd32/syscalls.master
==============================================================================
--- stable/7/sys/compat/freebsd32/syscalls.master       Fri Jul 24 19:12:19 
2009        (r195853)
+++ stable/7/sys/compat/freebsd32/syscalls.master       Fri Jul 24 19:35:06 
2009        (r195854)
@@ -5,15 +5,17 @@
 ; System call name/number master file.
 ; Processed to created init_sysent.c, syscalls.c and syscall.h.
 
-; Columns: number audit type nargs name alt{name,tag,rtyp}/comments
+; Columns: number audit type name alt{name,tag,rtyp}/comments
 ;      number  system call number, must be in order
 ;      audit   the audit event associated with the system call
 ;              A value of AUE_NULL means no auditing, but it also means that
 ;              there is no audit event for the call at this time. For the
 ;              case where the event exists, but we don't want auditing, the
 ;              event should be #defined to AUE_NULL in audit_kevents.h.
-;      type    one of STD, OBSOL, UNIMPL, COMPAT, CPT_NOA, LIBCOMPAT,
-;              NODEF, NOARGS, NOPROTO, NOIMPL, NOSTD, COMPAT4
+;      type    one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6,
+;              LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD
+;              The COMPAT* options may be combined with one or more NO*
+;              options separated by '|' with no spaces (e.g. COMPAT|NOARGS)
 ;      name    psuedo-prototype of syscall routine
 ;              If one of the following alts is different, then all appear:
 ;      altname name of system call if different
@@ -25,15 +27,16 @@
 ;      STD     always included
 ;      COMPAT  included on COMPAT #ifdef
 ;      COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat)
+;      COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat)
 ;      LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h
 ;      OBSOL   obsolete, not included in system, only specifies name
 ;      UNIMPL  not implemented, placeholder only
 ;      NOSTD   implemented but as a lkm that can be statically
-;              compiled in; sysent entry will be filled with lkmsys
+;              compiled in; sysent entry will be filled with lkmressys
 ;              so the SYSCALL_MODULE macro works
 ;      NOARGS  same as STD except do not create structure in sys/sysproto.h
 ;      NODEF   same as STD except only have the entry in the syscall table
-;              added.  Meaning - do do not create structure or function
+;              added.  Meaning - do not create structure or function
 ;              prototype in sys/sysproto.h
 ;      NOPROTO same as STD except do not create structure or
 ;              function prototype in sys/sysproto.h.  Does add a
@@ -388,16 +391,16 @@
 ;
 ; The following are reserved for loadable syscalls
 ;
-210    AUE_NULL        UNIMPL
-211    AUE_NULL        UNIMPL
-212    AUE_NULL        UNIMPL
-213    AUE_NULL        UNIMPL
-214    AUE_NULL        UNIMPL
-215    AUE_NULL        UNIMPL
-216    AUE_NULL        UNIMPL
-217    AUE_NULL        UNIMPL
-218    AUE_NULL        UNIMPL
-219    AUE_NULL        UNIMPL
+210    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+211    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+212    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+213    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+214    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+215    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+216    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+217    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+218    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
+219    AUE_NULL        NODEF   lkmnosys lkmnosys nosys_args int
 
 ;
 ; The following were introduced with NetBSD/4.4Lite-2
@@ -652,7 +655,7 @@
 367    AUE_NULL        UNIMPL  __cap_get_file
 368    AUE_NULL        UNIMPL  __cap_set_fd
 369    AUE_NULL        UNIMPL  __cap_set_file
-370    AUE_NULL        UNIMPL  lkmressys
+370    AUE_NULL        UNIMPL  nosys
 371    AUE_EXTATTR_SET_FD      NOPROTO { int extattr_set_fd(int fd, \
                                    int attrnamespace, const char *attrname, \
                                    void *data, size_t nbytes); }

Modified: stable/7/sys/kern/makesyscalls.sh
==============================================================================
--- stable/7/sys/kern/makesyscalls.sh   Fri Jul 24 19:12:19 2009        
(r195853)
+++ stable/7/sys/kern/makesyscalls.sh   Fri Jul 24 19:35:06 2009        
(r195854)
@@ -213,6 +213,19 @@ s/\$//g
                print
                exit 1
        }
+       # Returns true if the type "name" is the first flag in the type field
+       function type(name, flags, n) {
+               n = split($3, flags, /\|/)
+               return (n > 0 && flags[1] == name)
+       }
+       # Returns true if the flag "name" is set in the type field
+       function flag(name, flags, i, n) {
+               n = split($3, flags, /\|/)
+               for (i = 1; i <= n; i++)
+                       if (flags[i] == name)
+                               return 1
+               return 0
+       }
        function align_sysent_comment(column) {
                printf("\t") > sysent
                column = column + 8 - column % 8
@@ -241,7 +254,7 @@ s/\$//g
                        rettype="int"
                        end=NF
                }
-               if ($3 == "NODEF") {
+               if (flag("NODEF")) {
                        auditev="AUE_NULL"
                        funcname=$4
                        argssize = "AS(" $6 ")"
@@ -267,11 +280,11 @@ s/\$//g
                        funcalias = funcname
                if (argalias == "") {
                        argalias = funcname "_args"
-                       if ($3 == "COMPAT")
+                       if (flag("COMPAT"))
                                argalias = "o" argalias
-                       if ($3 == "COMPAT4")
+                       if (flag("COMPAT4"))
                                argalias = "freebsd4_" argalias
-                       if ($3 == "COMPAT6")
+                       if (flag("COMPAT6"))
                                argalias = "freebsd6_" argalias
                }
                f++
@@ -318,8 +331,8 @@ s/\$//g
                auditev = $2;
        }
 
-       $3 == "STD" || $3 == "NODEF" || $3 == "NOARGS"  || $3 == "NOPROTO" \
-           || $3 == "NOIMPL" || $3 == "NOSTD" {
+       type("STD") || type("NODEF") || type("NOARGS") || type("NOPROTO") \
+           || type("NOSTD") {
                parseline()
                printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > 
systrace
                printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > 
systracetmp
@@ -345,43 +358,30 @@ s/\$//g
                }
                printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace
                printf("\t\tbreak;\n") > systracetmp
-               if ((!nosys || funcname != "nosys") && \
-                   (funcname != "lkmnosys") && (funcname != "lkmressys")) {
-                       if (argc != 0 && $3 != "NOARGS" && $3 != "NOPROTO") {
-                               printf("struct %s {\n", argalias) > sysarg
-                               for (i = 1; i <= argc; i++)
-                                       printf("\tchar %s_l_[PADL_(%s)]; " \
-                                           "%s %s; char %s_r_[PADR_(%s)];\n",
-                                           argname[i], argtype[i],
-                                           argtype[i], argname[i],
-                                           argname[i], argtype[i]) > sysarg
-                               printf("};\n") > sysarg
-                       }
-                       else if ($3 != "NOARGS" && $3 != "NOPROTO" && \
-                           $3 != "NODEF")
-                               printf("struct %s {\n\tregister_t dummy;\n};\n",
-                                   argalias) > sysarg
-               }
-               if (($3 != "NOPROTO" && $3 != "NODEF" && \
-                   (funcname != "nosys" || !nosys)) || \
-                   (funcname == "lkmnosys" && !lkmnosys) || \
-                   funcname == "lkmressys") {
+               if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \
+                   !flag("NODEF")) {
+                       printf("struct %s {\n", argalias) > sysarg
+                       for (i = 1; i <= argc; i++)
+                               printf("\tchar %s_l_[PADL_(%s)]; " \
+                                   "%s %s; char %s_r_[PADR_(%s)];\n",
+                                   argname[i], argtype[i],
+                                   argtype[i], argname[i],
+                                   argname[i], argtype[i]) > sysarg
+                       printf("};\n") > sysarg
+               }
+               else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF"))
+                       printf("struct %s {\n\tregister_t dummy;\n};\n",
+                           argalias) > sysarg
+               if (!flag("NOPROTO") && !flag("NODEF")) {
                        printf("%s\t%s(struct thread *, struct %s *)",
                            rettype, funcname, argalias) > sysdcl
                        printf(";\n") > sysdcl
                        printf("#define\t%sAUE_%s\t%s\n", syscallprefix,
                            funcalias, auditev) > sysaue
                }
-               if (funcname == "nosys")
-                       nosys = 1
-               if (funcname == "lkmnosys")
-                       lkmnosys = 1
                printf("\t{ %s, (sy_call_t *)", argssize) > sysent
                column = 8 + 2 + length(argssize) + 15
-               if ($3 == "NOIMPL") {
-                       printf("%s },", "nosys, AUE_NULL, NULL, 0, 0") > sysent
-                       column = column + length("nosys") + 3
-               } else if ($3 == "NOSTD") {
+               if (flag("NOSTD")) {
                        printf("%s },", "lkmressys, AUE_NULL, NULL, 0, 0") > 
sysent
                        column = column + length("lkmressys") + 3
                } else {
@@ -392,7 +392,7 @@ s/\$//g
                printf("/* %d = %s */\n", syscall, funcalias) > sysent
                printf("\t\"%s\",\t\t\t/* %d = %s */\n",
                    funcalias, syscall, funcalias) > sysnames
-               if ($3 != "NODEF") {
+               if (!flag("NODEF")) {
                        printf("#define\t%s%s\t%d\n", syscallprefix,
                            funcalias, syscall) > syshdr
                        printf(" \\\n\t%s.o", funcalias) > sysmk
@@ -400,28 +400,32 @@ s/\$//g
                syscall++
                next
        }
-       $3 == "COMPAT" || $3 == "COMPAT4" || $3 == "COMPAT6" || $3 == "CPT_NOA" 
{
-               if ($3 == "COMPAT" || $3 == "CPT_NOA") {
+       type("COMPAT") || type("COMPAT4") || type("COMPAT6") {
+               if (flag("COMPAT")) {
                        ncompat++
                        out = syscompat
                        outdcl = syscompatdcl
                        wrap = "compat"
                        prefix = "o"
-               } else if ($3 == "COMPAT4") {
+                       descr = "old"
+               } else if (flag("COMPAT4")) {
                        ncompat4++
                        out = syscompat4
                        outdcl = syscompat4dcl
                        wrap = "compat4"
                        prefix = "freebsd4_"
-               } else if ($3 == "COMPAT6") {
+                       descr = "freebsd4"
+               } else if (flag("COMPAT6")) {
                        ncompat6++
                        out = syscompat6
                        outdcl = syscompat6dcl
                        wrap = "compat6"
                        prefix = "freebsd6_"
+                       descr = "freebsd6"
                }
                parseline()
-               if (argc != 0 && $3 != "CPT_NOA") {
+               if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \
+                   !flag("NODEF")) {
                        printf("struct %s {\n", argalias) > out
                        for (i = 1; i <= argc; i++)
                                printf("\tchar %s_l_[PADL_(%s)]; %s %s; " \
@@ -431,22 +435,33 @@ s/\$//g
                                    argname[i], argtype[i]) > out
                        printf("};\n") > out
                }
-               else if($3 != "CPT_NOA")
+               else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF"))
                        printf("struct %s {\n\tregister_t dummy;\n};\n",
                            argalias) > sysarg
-               printf("%s\t%s%s(struct thread *, struct %s *);\n",
-                   rettype, prefix, funcname, argalias) > outdcl
-               printf("\t{ %s(%s,%s), %s, NULL, 0, 0 },",
-                   wrap, argssize, funcname, auditev) > sysent
-               align_sysent_comment(8 + 9 + \
-                   length(argssize) + 1 + length(funcname) + length(auditev) + 
4)
-               printf("/* %d = old %s */\n", syscall, funcalias) > sysent
-               printf("\t\"%s.%s\",\t\t/* %d = old %s */\n",
-                   wrap, funcalias, syscall, funcalias) > sysnames
-               if ($3 == "COMPAT" || $3 == "CPT_NOA") {
+               if (!flag("NOPROTO") && !flag("NODEF")) {
+                       printf("%s\t%s%s(struct thread *, struct %s *);\n",
+                           rettype, prefix, funcname, argalias) > outdcl
+                       printf("#define\t%sAUE_%s%s\t%s\n", syscallprefix,
+                           prefix, funcname, auditev) > sysaue
+               }
+               if (flag("NOSTD")) {
+                       printf("\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0 },",
+                           "0", "lkmressys", "AUE_NULL") > sysent
+                       align_sysent_comment(8 + 2 + length("0") + 15 + \
+                           length("lkmressys") + 3)
+               } else {
+                       printf("\t{ %s(%s,%s), %s, NULL, 0, 0 },",
+                           wrap, argssize, funcname, auditev) > sysent
+                       align_sysent_comment(8 + 9 + length(argssize) + 1 + \
+                           length(funcname) + length(auditev) + 4)
+               }
+               printf("/* %d = %s %s */\n", syscall, descr, funcalias) > sysent
+               printf("\t\"%s.%s\",\t\t/* %d = %s %s */\n",
+                   wrap, funcalias, syscall, descr, funcalias) > sysnames
+               if (flag("COMPAT")) {
                        printf("\t\t\t\t/* %d is old %s */\n",
                            syscall, funcalias) > syshdr
-               } else {
+               } else if (!flag("NODEF")) {
                        printf("#define\t%s%s%s\t%d\n", syscallprefix,
                            prefix, funcalias, syscall) > syshdr
                        printf(" \\\n\t%s%s.o", prefix, funcalias) > sysmk
@@ -454,7 +469,7 @@ s/\$//g
                syscall++
                next
        }
-       $3 == "LIBCOMPAT" {
+       type("LIBCOMPAT") {
                ncompat++
                parseline()
                printf("%s\to%s();\n", rettype, funcname) > syscompatdcl
@@ -471,7 +486,7 @@ s/\$//g
                syscall++
                next
        }
-       $3 == "OBSOL" {
+       type("OBSOL") {
                printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },") > 
sysent
                align_sysent_comment(34)
                printf("/* %d = obsolete %s */\n", syscall, comment) > sysent
@@ -482,7 +497,7 @@ s/\$//g
                syscall++
                next
        }
-       $3 == "UNIMPL" {
+       type("UNIMPL") {
                printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 
},\t\t\t/* %d = %s */\n",
                    syscall, comment) > sysent
                printf("\t\"#%d\",\t\t\t/* %d = %s */\n",

Modified: stable/7/sys/kern/syscalls.master
==============================================================================
--- stable/7/sys/kern/syscalls.master   Fri Jul 24 19:12:19 2009        
(r195853)
+++ stable/7/sys/kern/syscalls.master   Fri Jul 24 19:35:06 2009        
(r195854)
@@ -11,8 +11,10 @@
 ;              there is no audit event for the call at this time. For the
 ;              case where the event exists, but we don't want auditing, the
 ;              event should be #defined to AUE_NULL in audit_kevents.h.
-;      type    one of STD, OBSOL, UNIMPL, COMPAT, CPT_NOA, LIBCOMPAT,
-;              NODEF, NOARGS, NOPROTO, NOIMPL, NOSTD, COMPAT4
+;      type    one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6,
+;              LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD
+;              The COMPAT* options may be combined with one or more NO*
+;              options separated by '|' with no spaces (e.g. COMPAT|NOARGS)
 ;      name    psuedo-prototype of syscall routine
 ;              If one of the following alts is different, then all appear:
 ;      altname name of system call if different
@@ -24,15 +26,16 @@
 ;      STD     always included
 ;      COMPAT  included on COMPAT #ifdef
 ;      COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat)
+;      COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat)
 ;      LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h
 ;      OBSOL   obsolete, not included in system, only specifies name
 ;      UNIMPL  not implemented, placeholder only
 ;      NOSTD   implemented but as a lkm that can be statically
-;              compiled in; sysent entry will be filled with lkmsys
+;              compiled in; sysent entry will be filled with lkmressys
 ;              so the SYSCALL_MODULE macro works
 ;      NOARGS  same as STD except do not create structure in sys/sysproto.h
 ;      NODEF   same as STD except only have the entry in the syscall table
-;              added.  Meaning - do do not create structure or function
+;              added.  Meaning - do not create structure or function
 ;              prototype in sys/sysproto.h
 ;      NOPROTO same as STD except do not create structure or
 ;              function prototype in sys/sysproto.h.  Does add a
@@ -214,7 +217,7 @@
                                    int protocol); }
 98     AUE_CONNECT     STD     { int connect(int s, caddr_t name, \
                                    int namelen); }
-99     AUE_ACCEPT      CPT_NOA { int accept(int s, caddr_t name, \
+99     AUE_ACCEPT      COMPAT|NOARGS { int accept(int s, caddr_t name, \
                                    int *anamelen); } accept accept_args int
 100    AUE_GETPRIORITY STD     { int getpriority(int which, int who); }
 101    AUE_SEND        COMPAT  { int send(int s, caddr_t buf, int len, \
@@ -258,7 +261,7 @@
                                    struct timezone *tzp); }
 123    AUE_FCHOWN      STD     { int fchown(int fd, int uid, int gid); }
 124    AUE_FCHMOD      STD     { int fchmod(int fd, int mode); }
-125    AUE_RECVFROM    CPT_NOA { int recvfrom(int s, caddr_t buf, \
+125    AUE_RECVFROM    COMPAT|NOARGS { int recvfrom(int s, caddr_t buf, \
                                    size_t len, int flags, caddr_t from, int \
                                    *fromlenaddr); } recvfrom recvfrom_args \
                                    int
@@ -294,7 +297,7 @@
 148    AUE_QUOTACTL    STD     { int quotactl(char *path, int cmd, int uid, \
                                    caddr_t arg); }
 149    AUE_O_QUOTA     COMPAT  { int quota(void); }
-150    AUE_GETSOCKNAME CPT_NOA { int getsockname(int fdec, \
+150    AUE_GETSOCKNAME COMPAT|NOARGS { int getsockname(int fdec, \
                                    caddr_t asa, int *alen); } getsockname \
                                    getsockname_args int
 
@@ -380,7 +383,7 @@
 197    AUE_MMAP        STD     { caddr_t freebsd6_mmap(caddr_t addr, \
                                    size_t len, int prot, int flags, int fd, \
                                    int pad, off_t pos); }
-198    AUE_NULL        STD     { int nosys(void); } __syscall \
+198    AUE_NULL        NOPROTO { int nosys(void); } __syscall \
                                    __syscall_args int
 199    AUE_LSEEK       STD     { off_t freebsd6_lseek(int fd, int pad, \
                                    off_t offset, int whence); }
@@ -657,7 +660,7 @@
 367    AUE_NULL        UNIMPL  __cap_get_file
 368    AUE_NULL        UNIMPL  __cap_set_fd
 369    AUE_NULL        UNIMPL  __cap_set_file
-370    AUE_NULL        NODEF   lkmressys lkmressys nosys_args int
+370    AUE_NULL        UNIMPL  nosys
 371    AUE_EXTATTR_SET_FD      STD     { int extattr_set_fd(int fd, \
                                    int attrnamespace, const char *attrname, \
                                    void *data, size_t nbytes); }
@@ -668,7 +671,7 @@
                                    int attrnamespace, \
                                    const char *attrname); }
 374    AUE_NULL        STD     { int __setugid(int flag); }
-375    AUE_NULL        NOIMPL  { int nfsclnt(int flag, caddr_t argp); }
+375    AUE_NULL        UNIMPL  nfsclnt
 376    AUE_EACCESS     STD     { int eaccess(char *path, int flags); }
 377    AUE_NULL        UNIMPL  afs_syscall
 378    AUE_NMOUNT      STD     { int nmount(struct iovec *iovp, \

Modified: stable/7/sys/sys/sysent.h
==============================================================================
--- stable/7/sys/sys/sysent.h   Fri Jul 24 19:12:19 2009        (r195853)
+++ stable/7/sys/sys/sysent.h   Fri Jul 24 19:35:06 2009        (r195854)
@@ -158,6 +158,12 @@ int    syscall_register(int *offset, str
 int    syscall_deregister(int *offset, struct sysent *old_sysent);
 int    syscall_module_handler(struct module *mod, int what, void *arg);
 
+/* Special purpose system call functions. */
+struct nosys_args;
+
+int    lkmnosys(struct thread *, struct nosys_args *);
+int    lkmressys(struct thread *, struct nosys_args *);
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_SYSENT_H_ */
_______________________________________________
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