Module Name: src Committed By: pgoyette Date: Mon Nov 30 22:47:19 UTC 2015
Modified Files: src/sys/kern: kern_exec.c kern_syscall.c makesyscalls.sh syscalls.conf src/sys/sys: param.h proc.h Log Message: Make the list of syscalls which can trigger a module autoload an attribute of each emulation, rather than having a single global list which applies only to the default emulation. This changes 'struct emul' so Welcome to 7.99.23 ! To generate a diff of this commit: cvs rdiff -u -r1.422 -r1.423 src/sys/kern/kern_exec.c cvs rdiff -u -r1.11 -r1.12 src/sys/kern/kern_syscall.c cvs rdiff -u -r1.154 -r1.155 src/sys/kern/makesyscalls.sh cvs rdiff -u -r1.24 -r1.25 src/sys/kern/syscalls.conf cvs rdiff -u -r1.487 -r1.488 src/sys/sys/param.h cvs rdiff -u -r1.324 -r1.325 src/sys/sys/proc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.422 src/sys/kern/kern_exec.c:1.423 --- src/sys/kern/kern_exec.c:1.422 Thu Nov 26 13:15:34 2015 +++ src/sys/kern/kern_exec.c Mon Nov 30 22:47:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.422 2015/11/26 13:15:34 martin Exp $ */ +/* $NetBSD: kern_exec.c,v 1.423 2015/11/30 22:47:19 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.422 2015/11/26 13:15:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.423 2015/11/30 22:47:19 pgoyette Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -181,6 +181,11 @@ struct exec_entry { void syscall(void); #endif +/* NetBSD autoloadable syscalls */ +#ifdef MODULAR +#include <kern/syscalls_autoload.c> +#endif + /* NetBSD emul struct */ struct emul emul_netbsd = { .e_name = "netbsd", @@ -195,6 +200,9 @@ struct emul emul_netbsd = { .e_nosys = SYS_syscall, .e_nsysent = SYS_NSYSENT, #endif +#ifdef MODULAR + .e_sc_autoload = netbsd_syscalls_autoload, +#endif .e_sysent = sysent, #ifdef SYSCALL_DEBUG .e_syscallnames = syscallnames, Index: src/sys/kern/kern_syscall.c diff -u src/sys/kern/kern_syscall.c:1.11 src/sys/kern/kern_syscall.c:1.12 --- src/sys/kern/kern_syscall.c:1.11 Sat May 9 05:56:36 2015 +++ src/sys/kern/kern_syscall.c Mon Nov 30 22:47:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_syscall.c,v 1.11 2015/05/09 05:56:36 pgoyette Exp $ */ +/* $NetBSD: kern_syscall.c,v 1.12 2015/11/30 22:47:19 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.11 2015/05/09 05:56:36 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.12 2015/11/30 22:47:19 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_modular.h" @@ -60,11 +60,11 @@ int sys_nomodule(struct lwp *l, const void *v, register_t *retval) { #ifdef MODULAR -#include <kern/syscalls_autoload.c> const struct sysent *sy; const struct emul *em; - int code, i; + const struct sc_auto *auto_list; + int code; /* * Restart the syscall if we interrupted a module unload that @@ -82,21 +82,21 @@ sys_nomodule(struct lwp *l, const void * * works, retry the request. */ em = l->l_proc->p_emul; - if (em == &emul_netbsd) { - code = sy - em->e_sysent; - for (i = 0; i < __arraycount(syscalls_autoload); i++) { - if (syscalls_autoload[i].al_code != code) { + code = sy - em->e_sysent; + + if ((auto_list = em->e_sc_autoload) != NULL) + for (; auto_list->al_code > 0; auto_list++) { + if (auto_list->al_code != code) { continue; } - if (module_autoload(syscalls_autoload[i].al_module, - MODULE_CLASS_ANY) != 0 || + if (module_autoload(auto_list->al_module, + MODULE_CLASS_ANY) != 0 || sy->sy_call == sys_nomodule) { break; } kernconfig_unlock(); return ERESTART; } - } kernconfig_unlock(); #endif /* MODULAR */ Index: src/sys/kern/makesyscalls.sh diff -u src/sys/kern/makesyscalls.sh:1.154 src/sys/kern/makesyscalls.sh:1.155 --- src/sys/kern/makesyscalls.sh:1.154 Thu Sep 24 14:30:52 2015 +++ src/sys/kern/makesyscalls.sh Mon Nov 30 22:47:19 2015 @@ -1,4 +1,4 @@ -# $NetBSD: makesyscalls.sh,v 1.154 2015/09/24 14:30:52 christos Exp $ +# $NetBSD: makesyscalls.sh,v 1.155 2015/11/30 22:47:19 pgoyette Exp $ # # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou # All rights reserved. @@ -51,6 +51,7 @@ esac # switchname the name for the 'struct sysent' we define # namesname the name for the 'const char *[]' we define # constprefix the prefix for the system call constants +# autoloadprefix the prefix for the autoload table name # registertype the type for register_t # nsysent the size of the sysent table # sys_nosys [optional] name of function called for unsupported @@ -165,6 +166,7 @@ BEGIN { switchname = \"$switchname\" namesname = \"$namesname\" constprefix = \"$constprefix\" + autoloadprefix = \"$autoloadprefix\" registertype = \"$registertype\" sysalign=\"$sysalign\" if (!registertype) { @@ -255,10 +257,9 @@ NR == 1 { printf " * created from%s\n */\n\n", $0 > sysautoload printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysautoload - printf("static struct {\n") > sysautoload - printf("\tu_int\t\tal_code;\n") > sysautoload - printf("\tconst char\t*al_module;\n") > sysautoload - printf("} const syscalls_autoload[] = {\n") > sysautoload + printf("#include <sys/proc.h>\n") > sysautoload + printf("static struct sc_auto " autoloadprefix \ + "_syscalls_autoload[] = {\n") > sysautoload printf " * created from%s\n */\n\n", $0 > rumpcalls printf "#ifdef RUMP_CLIENT\n" > rumpcalls @@ -1149,6 +1150,7 @@ END { cat $sysprotos >> $sysarghdr echo "#endif /* _${constprefix}SYSCALL_H_ */" >> $sysnumhdr echo "#endif /* _${constprefix}SYSCALLARGS_H_ */" >> $sysarghdr +echo "\t { 0, NULL }" >> $sysautoload echo "};" >> $sysautoload printf "\n#endif /* _RUMP_RUMP_SYSCALLS_H_ */\n" >> $rumpprotos cat $sysdcl $sysent > $syssw Index: src/sys/kern/syscalls.conf diff -u src/sys/kern/syscalls.conf:1.24 src/sys/kern/syscalls.conf:1.25 --- src/sys/kern/syscalls.conf:1.24 Mon Aug 24 16:05:46 2015 +++ src/sys/kern/syscalls.conf Mon Nov 30 22:47:19 2015 @@ -1,4 +1,4 @@ -# $NetBSD: syscalls.conf,v 1.24 2015/08/24 16:05:46 pooka Exp $ +# $NetBSD: syscalls.conf,v 1.25 2015/11/30 22:47:19 pgoyette Exp $ sysnames="syscalls.c" sysnumhdr="../sys/syscall.h" @@ -17,4 +17,5 @@ libcompatopts="" switchname="sysent" namesname="syscallnames" constprefix="SYS_" +autoloadprefix="netbsd" nsysent=512 Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.487 src/sys/sys/param.h:1.488 --- src/sys/sys/param.h:1.487 Thu Nov 26 13:17:07 2015 +++ src/sys/sys/param.h Mon Nov 30 22:47:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.487 2015/11/26 13:17:07 martin Exp $ */ +/* $NetBSD: param.h,v 1.488 2015/11/30 22:47:19 pgoyette Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 799002200 /* NetBSD 7.99.22 */ +#define __NetBSD_Version__ 799002300 /* NetBSD 7.99.23 */ #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) Index: src/sys/sys/proc.h diff -u src/sys/sys/proc.h:1.324 src/sys/sys/proc.h:1.325 --- src/sys/sys/proc.h:1.324 Thu Nov 26 13:15:34 2015 +++ src/sys/sys/proc.h Mon Nov 30 22:47:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.324 2015/11/26 13:15:34 martin Exp $ */ +/* $NetBSD: proc.h,v 1.325 2015/11/30 22:47:19 pgoyette Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -124,6 +124,14 @@ struct pgrp { }; /* + * Autoloadable syscall definition + */ +struct sc_auto { + u_int al_code; + const char *al_module; +}; + +/* * One structure allocated per emulation. */ struct exec_package; @@ -143,6 +151,7 @@ struct emul { struct sysent *e_sysent; /* System call array */ const char * const *e_syscallnames; /* System call name array */ /* Signal sending function */ + struct sc_auto *e_sc_autoload; /* List of autoloadable syscalls */ void (*e_sendsig)(const struct ksiginfo *, const sigset_t *); void (*e_trapsignal)(struct lwp *, struct ksiginfo *);