diff options
author | jhb <jhb@FreeBSD.org> | 2008-09-25 20:07:42 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-09-25 20:07:42 +0000 |
commit | 00776aeb581a27af198e57c4d7c48198c3af6f03 (patch) | |
tree | 2d86342cfddf85672b7cabbaa1c75a865dff4583 | |
parent | a87bfbe313ff337a63706aaefb95e607c7192367 (diff) | |
download | FreeBSD-src-00776aeb581a27af198e57c4d7c48198c3af6f03.zip FreeBSD-src-00776aeb581a27af198e57c4d7c48198c3af6f03.tar.gz |
Tidy up a few things with syscall generation:
- Instead of using a syscall slot (370) just to get a function prototype
for lkmressys(), add an explicit function prototype to <sys/sysent.h>.
This also removes unused special case checks for 'lkmressys' from
makesyscalls.sh.
- Instead of having magic logic in makesyscalls.sh to only generate a
function prototype the first time 'lkmnosys' is seen, make 'NODEF'
always not generate a function prototype and include an explicit
prototype for 'lkmnosys' in <sys/sysent.h>.
- As a result of the fix in (2), update the LKM syscall entries in
the freebsd32 syscall table to use 'lkmnosys' rather than 'nosys'.
- Use NOPROTO for the __syscall() entry (198) in the native ABI. This
avoids the need for magic logic in makesyscalls.h to only generate
a function prototype the first time 'nosys' is encountered.
-rw-r--r-- | sys/compat/freebsd32/syscalls.master | 24 | ||||
-rw-r--r-- | sys/kern/makesyscalls.sh | 38 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 6 | ||||
-rw-r--r-- | sys/sys/sysent.h | 6 |
4 files changed, 35 insertions, 39 deletions
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index 576b85f..0e70981 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -33,7 +33,7 @@ ; 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 +388,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 @@ -637,7 +637,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); } diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh index 74737f2..2b778b1 100644 --- a/sys/kern/makesyscalls.sh +++ b/sys/kern/makesyscalls.sh @@ -345,37 +345,27 @@ 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 (argc != 0 && $3 != "NOARGS" && $3 != "NOPROTO" && \ + $3 != "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 } - if (($3 != "NOPROTO" && $3 != "NODEF" && \ - (funcname != "nosys" || !nosys)) || \ - (funcname == "lkmnosys" && !lkmnosys) || \ - funcname == "lkmressys") { + else if ($3 != "NOARGS" && $3 != "NOPROTO" && $3 != "NODEF") + printf("struct %s {\n\tregister_t dummy;\n};\n", + argalias) > sysarg + if ($3 != "NOPROTO" && $3 != "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") { diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 3bbe2e6..38adf73 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -32,7 +32,7 @@ ; 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 @@ -380,7 +380,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 +657,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); } diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index bdbd809..57459b1 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -156,6 +156,12 @@ int syscall_register(int *offset, struct sysent *new_sysent, 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_ */ |