Date: Wed, 17 Jun 2009 19:50:38 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194390 - in head/sys: compat/freebsd32 kern Message-ID: <200906171950.n5HJocFM086247@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Jun 17 19:50:38 2009 New Revision: 194390 URL: http://svn.freebsd.org/changeset/base/194390 Log: - Add the ability to mix multiple flags seperated by pipe ('|') characters in the type field of system call tables. Specifically, one can now use the 'NO*' types as flags in addition to the 'COMPAT*' types. For example, to tag 'COMPAT*' system calls as living in a KLD via NOSTD. The COMPAT* type is required to be listed first in this case. - Add new functions 'type()' and 'flag()' to the embedded awk script in makesyscalls.sh that return true if a requested flag is found in the type field ($3). The flag() function checks all of the flags in the field, but type() only checks the first flag. type() is meant to be used in the top-level "switch" statement and flag() should be used otherwise. - Retire the CPT_NOA type, it is now replaced with "COMPAT|NOARGS" using the flags approach. - Tweak the comment descriptions of COMPAT[46] system calls so that they say "freebsd[46] foo" rather than "old foo". - Document the COMPAT6 type. - Sync comments in compat32 syscall table with the master table. Modified: head/sys/compat/freebsd32/syscalls.master head/sys/kern/makesyscalls.sh head/sys/kern/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Jun 17 19:40:53 2009 (r194389) +++ head/sys/compat/freebsd32/syscalls.master Wed Jun 17 19:50:38 2009 (r194390) @@ -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,11 +27,12 @@ ; STD always included ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) +; COMPAT6 included on COMPAT4 #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 Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Wed Jun 17 19:40:53 2009 (r194389) +++ head/sys/kern/makesyscalls.sh Wed Jun 17 19:50:38 2009 (r194390) @@ -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++ @@ -325,8 +338,8 @@ s/\$//g flags = "0"; } - $3 == "STD" || $3 == "NODEF" || $3 == "NOARGS" || $3 == "NOPROTO" \ - || $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 @@ -352,8 +365,8 @@ s/\$//g } printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace printf("\t\tbreak;\n") > systracetmp - if (argc != 0 && $3 != "NOARGS" && $3 != "NOPROTO" && \ - $3 != "NODEF") { + 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)]; " \ @@ -363,10 +376,10 @@ s/\$//g argname[i], argtype[i]) > sysarg printf("};\n") > sysarg } - else if ($3 != "NOARGS" && $3 != "NOPROTO" && $3 != "NODEF") + else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) printf("struct %s {\n\tregister_t dummy;\n};\n", argalias) > sysarg - if ($3 != "NOPROTO" && $3 != "NODEF") { + if (!flag("NOPROTO") && !flag("NODEF")) { printf("%s\t%s(struct thread *, struct %s *)", rettype, funcname, argalias) > sysdcl printf(";\n") > sysdcl @@ -375,7 +388,7 @@ s/\$//g } printf("\t{ %s, (sy_call_t *)", argssize) > sysent column = 8 + 2 + length(argssize) + 15 - if ($3 == "NOSTD") { + if (flag("NOSTD")) { printf("%s },", "lkmressys, AUE_NULL, NULL, 0, 0, 0") > sysent column = column + length("lkmressys") + length("AUE_NULL") + 3 } else { @@ -386,7 +399,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 @@ -394,28 +407,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; " \ @@ -425,22 +442,32 @@ 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, %s },", - wrap, argssize, funcname, auditev, flags) > sysent - align_sysent_comment(8 + 9 + \ - length(argssize) + 1 + length(funcname) + length(auditev) + length(flags) + 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 + } + if (flag("NOSTD")) { + printf("\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0, 0 },", + "0", "lkmressys", "AUE_NULL") > sysent + align_sysent_comment(8 + 2 + length("0") + 15 + \ + length("lkmressys") + length("AUE_NULL") + 3) + } else { + printf("\t{ %s(%s,%s), %s, NULL, 0, 0, %s },", + wrap, argssize, funcname, auditev, flags) > sysent + align_sysent_comment(8 + 9 + length(argssize) + 1 + \ + length(funcname) + length(auditev) + \ + length(flags) + 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 @@ -448,7 +475,7 @@ s/\$//g syscall++ next } - $3 == "LIBCOMPAT" { + type("LIBCOMPAT") { ncompat++ parseline() printf("%s\to%s();\n", rettype, funcname) > syscompatdcl @@ -465,7 +492,7 @@ s/\$//g syscall++ next } - $3 == "OBSOL" { + type("OBSOL") { printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 },") > sysent align_sysent_comment(34) printf("/* %d = obsolete %s */\n", syscall, comment) > sysent @@ -476,7 +503,7 @@ s/\$//g syscall++ next } - $3 == "UNIMPL" { + type("UNIMPL") { printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 },\t\t\t/* %d = %s */\n", syscall, comment) > sysent printf("\t\"#%d\",\t\t\t/* %d = %s */\n", Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Jun 17 19:40:53 2009 (r194389) +++ head/sys/kern/syscalls.master Wed Jun 17 19:50:38 2009 (r194390) @@ -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, 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,6 +26,7 @@ ; STD always included ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) +; COMPAT6 included on COMPAT4 #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 @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906171950.n5HJocFM086247>