diff options
-rw-r--r-- | sys/kern/makesyscalls.sh | 33 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 18 |
2 files changed, 33 insertions, 18 deletions
diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh index bdbd5c6..090616c 100644 --- a/sys/kern/makesyscalls.sh +++ b/sys/kern/makesyscalls.sh @@ -253,6 +253,14 @@ s/\$//g for (i = 5; i <= NF; i++) comment = comment " " $i } + mpsafe = 0; + # if the "MPSAFE" keyword is found, note it and shift the line + $2 == "MPSAFE" { + for (i = 2; i <= NF; i++) + $i = $(i + 1); + NF -= 1; + mpsafe = 1; + } $2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "NOPROTO" \ || $2 == "NOIMPL" { parseline() @@ -282,19 +290,22 @@ s/\$//g nosys = 1 if (funcname == "lkmnosys") lkmnosys = 1 + printf("\t{ %s%d, (sy_call_t *)", + mpsafe == 1 ? "SYF_MPSAFE | " : "", argc+bigargc) > sysent if ($2 != "NOIMPL") { - printf("\t{ %d, (sy_call_t *)%s },\t\t", - argc+bigargc, funcname) > sysent + printf("%s },\t", + funcname) > sysent if(length(funcname) < 11) - printf("\t") > sysent - printf("/* %d = %s */\n", syscall, funcalias) > sysent + printf("\t") > sysent } else { - printf("\t{ %d, (sy_call_t *)%s },\t\t", - argc+bigargc, "nosys") > sysent + printf("%s },\t", + "nosys") > sysent if(length("nosys") < 11) - printf("\t") > sysent - printf("/* %d = %s */\n", syscall, funcalias) > sysent + printf("\t") > sysent } + if (mpsafe == 0) + printf("\t") > sysent + printf("/* %d = %s */\n", syscall, funcalias) > sysent printf("\t\"%s\",\t\t\t/* %d = %s */\n", funcalias, syscall, funcalias) > sysnames if ($2 != "NODEF") { @@ -323,7 +334,8 @@ s/\$//g argalias) > sysarg printf("%s\to%s __P((struct proc *, struct %s *));\n", rettype, funcname, argalias) > syscompatdcl - printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", + printf("\t{ compat(%s%d,%s) },\t\t/* %d = old %s */\n", + mpsafe == 1 ? "SYF_MPSAFE | " : "", argc+bigargc, funcname, syscall, funcalias) > sysent printf("\t\"old.%s\",\t\t/* %d = old %s */\n", funcalias, syscall, funcalias) > sysnames @@ -338,7 +350,8 @@ s/\$//g ncompat++ parseline() printf("%s\to%s();\n", rettype, funcname) > syscompatdcl - printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", + printf("\t{ compat(%s%d,%s) },\t\t/* %d = old %s */\n", + mpsafe == 1 ? "SYF_MPSAFE | " : "", argc+bigargc, funcname, syscall, funcalias) > sysent printf("\t\"old.%s\",\t\t/* %d = old %s */\n", funcalias, syscall, funcalias) > sysnames diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 8375e43..89faed5 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -4,8 +4,10 @@ ; System call name/number master file. ; Processed to created init_sysent.c, syscalls.c and syscall.h. -; Columns: number type nargs namespc name alt{name,tag,rtyp}/comments +; Columns: number [MPSAFE] type nargs namespc name alt{name,tag,rtyp}/comments ; number system call number, must be in order +; MPSAFE optional field, specifies that syscall does not want the +; BGL grabbed automatically (it is SMP safe). ; type one of STD, OBSOL, UNIMPL, COMPAT, CPT_NOA, LIBCOMPAT, ; NODEF, NOARGS, NOPROTO, NOIMPL ; namespc one of POSIX, BSD, NOHIDE @@ -67,8 +69,8 @@ ; XXX `path' should have type `const char *' but we're not ready for that. 22 STD BSD { int unmount(char *path, int flags); } 23 STD POSIX { int setuid(uid_t uid); } -24 STD POSIX { uid_t getuid(void); } -25 STD POSIX { uid_t geteuid(void); } +24 MPSAFE STD POSIX { uid_t getuid(void); } +25 MPSAFE STD POSIX { uid_t geteuid(void); } 26 STD BSD { int ptrace(int req, pid_t pid, caddr_t addr, \ int data); } 27 STD BSD { int recvmsg(int s, struct msghdr *msg, int flags); } @@ -95,8 +97,8 @@ int pid); } 46 COMPAT POSIX { int sigaction(int signum, struct osigaction *nsa, \ struct osigaction *osa); } -47 STD POSIX { gid_t getgid(void); } -48 COMPAT POSIX { int sigprocmask(int how, osigset_t mask); } +47 MPSAFE STD POSIX { gid_t getgid(void); } +48 MPSAFE COMPAT POSIX { int sigprocmask(int how, osigset_t mask); } ; XXX note nonstandard (bogus) calling convention - the libc stub passes ; us the mask, not a pointer to it, and we return the old mask as the ; (int) return value. @@ -111,7 +113,7 @@ 57 STD POSIX { int symlink(char *path, char *link); } 58 STD POSIX { int readlink(char *path, char *buf, int count); } 59 STD POSIX { int execve(char *fname, char **argv, char **envv); } -60 STD POSIX { int umask(int newmask); } umask umask_args int +60 MPSAFE STD POSIX { int umask(int newmask); } umask umask_args int 61 STD BSD { int chroot(char *path); } 62 COMPAT POSIX { int fstat(int fd, struct ostat *sb); } 63 COMPAT BSD { int getkerninfo(int op, char *where, size_t *size, \ @@ -136,7 +138,7 @@ char *vec); } 79 STD POSIX { int getgroups(u_int gidsetsize, gid_t *gidset); } 80 STD POSIX { int setgroups(u_int gidsetsize, gid_t *gidset); } -81 STD POSIX { int getpgrp(void); } +81 MPSAFE STD POSIX { int getpgrp(void); } 82 STD POSIX { int setpgid(int pid, int pgid); } 83 STD BSD { int setitimer(u_int which, struct itimerval *itv, \ struct itimerval *oitv); } @@ -476,7 +478,7 @@ 337 STD BSD { int kldsym(int fileid, int cmd, void *data); } 338 STD BSD { int jail(struct jail *jail); } 339 UNIMPL BSD pioctl -340 STD POSIX { int sigprocmask(int how, const sigset_t *set, \ +340 MPSAFE STD POSIX { int sigprocmask(int how, const sigset_t *set, \ sigset_t *oset); } 341 STD POSIX { int sigsuspend(const sigset_t *sigmask); } 342 STD POSIX { int sigaction(int sig, const struct sigaction *act, \ |