Home | History | Annotate | Line # | Download | only in kern
kern_stub.c revision 1.6.2.4
      1  1.6.2.4   yamt /*	$NetBSD: kern_stub.c,v 1.6.2.4 2010/03/11 15:04:17 yamt Exp $	*/
      2      1.1     ad 
      3      1.1     ad /*-
      4  1.6.2.1   yamt  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
      5      1.1     ad  * All rights reserved.
      6      1.1     ad  *
      7      1.1     ad  * Redistribution and use in source and binary forms, with or without
      8      1.1     ad  * modification, are permitted provided that the following conditions
      9      1.1     ad  * are met:
     10      1.1     ad  * 1. Redistributions of source code must retain the above copyright
     11      1.1     ad  *    notice, this list of conditions and the following disclaimer.
     12      1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     14      1.1     ad  *    documentation and/or other materials provided with the distribution.
     15      1.1     ad  *
     16      1.1     ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17      1.1     ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18      1.1     ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19      1.1     ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20      1.1     ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21      1.1     ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22      1.1     ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23      1.1     ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24      1.1     ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25      1.1     ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26      1.1     ad  * POSSIBILITY OF SUCH DAMAGE.
     27      1.1     ad  */
     28      1.1     ad 
     29      1.1     ad /*
     30      1.3     ad  * Copyright (c) 1982, 1986, 1991, 1993
     31      1.3     ad  *	The Regents of the University of California.  All rights reserved.
     32      1.3     ad  *
     33      1.3     ad  * Redistribution and use in source and binary forms, with or without
     34      1.3     ad  * modification, are permitted provided that the following conditions
     35      1.3     ad  * are met:
     36      1.3     ad  * 1. Redistributions of source code must retain the above copyright
     37      1.3     ad  *    notice, this list of conditions and the following disclaimer.
     38      1.3     ad  * 2. Redistributions in binary form must reproduce the above copyright
     39      1.3     ad  *    notice, this list of conditions and the following disclaimer in the
     40      1.3     ad  *    documentation and/or other materials provided with the distribution.
     41      1.3     ad  * 3. Neither the name of the University nor the names of its contributors
     42      1.3     ad  *    may be used to endorse or promote products derived from this software
     43      1.3     ad  *    without specific prior written permission.
     44      1.3     ad  *
     45      1.3     ad  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     46      1.3     ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     47      1.3     ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     48      1.3     ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     49      1.3     ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     50      1.3     ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     51      1.3     ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     52      1.3     ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     53      1.3     ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     54      1.3     ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     55      1.3     ad  * SUCH DAMAGE.
     56      1.3     ad  *
     57      1.3     ad  *	@(#)subr_xxx.c	8.3 (Berkeley) 3/29/95
     58      1.3     ad  */
     59      1.3     ad 
     60      1.3     ad /*
     61      1.1     ad  * Stubs for system calls and facilities not included in the system.
     62      1.1     ad  */
     63      1.1     ad 
     64      1.1     ad #include <sys/cdefs.h>
     65  1.6.2.4   yamt __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.6.2.4 2010/03/11 15:04:17 yamt Exp $");
     66      1.1     ad 
     67      1.1     ad #include "opt_ptrace.h"
     68      1.3     ad #include "opt_ktrace.h"
     69  1.6.2.2   yamt #include "opt_modular.h"
     70  1.6.2.2   yamt #include "opt_sa.h"
     71  1.6.2.2   yamt 
     72  1.6.2.2   yamt /* XXX To get syscall prototypes. */
     73  1.6.2.2   yamt #define SYSVSHM
     74  1.6.2.2   yamt #define SYSVSEM
     75  1.6.2.2   yamt #define SYSVMSG
     76      1.1     ad 
     77      1.1     ad #include <sys/param.h>
     78      1.1     ad #include <sys/kernel.h>
     79      1.1     ad #include <sys/proc.h>
     80  1.6.2.2   yamt #include <sys/fstypes.h>
     81      1.1     ad #include <sys/signalvar.h>
     82  1.6.2.2   yamt #include <sys/syscall.h>
     83      1.1     ad #include <sys/syscallargs.h>
     84  1.6.2.2   yamt #include <sys/syscallvar.h>
     85      1.3     ad #include <sys/ktrace.h>
     86  1.6.2.1   yamt #include <sys/intr.h>
     87  1.6.2.1   yamt #include <sys/cpu.h>
     88  1.6.2.2   yamt #include <sys/module.h>
     89      1.1     ad 
     90      1.1     ad /*
     91      1.1     ad  * Nonexistent system call-- signal process (may want to handle it).  Flag
     92      1.1     ad  * error in case process won't see signal immediately (blocked or ignored).
     93      1.1     ad  */
     94      1.1     ad #ifndef PTRACE
     95      1.2  itohy __weak_alias(sys_ptrace,sys_nosys);
     96      1.3     ad #endif	/* PTRACE */
     97      1.3     ad 
     98      1.3     ad /*
     99      1.3     ad  * ktrace stubs.  ktruser() goes to enosys as we want to fail the syscall,
    100      1.3     ad  * but not kill the process: utrace() is a debugging feature.
    101      1.3     ad  */
    102      1.3     ad #ifndef KTRACE
    103      1.3     ad __weak_alias(ktr_csw,nullop);		/* Probes */
    104      1.3     ad __weak_alias(ktr_emul,nullop);
    105      1.3     ad __weak_alias(ktr_geniov,nullop);
    106      1.3     ad __weak_alias(ktr_genio,nullop);
    107      1.3     ad __weak_alias(ktr_mibio,nullop);
    108      1.3     ad __weak_alias(ktr_namei,nullop);
    109      1.3     ad __weak_alias(ktr_namei2,nullop);
    110      1.3     ad __weak_alias(ktr_psig,nullop);
    111  1.6.2.2   yamt __weak_alias(ktr_saupcall,nullop);
    112      1.3     ad __weak_alias(ktr_syscall,nullop);
    113      1.3     ad __weak_alias(ktr_sysret,nullop);
    114      1.3     ad __weak_alias(ktr_kuser,nullop);
    115      1.3     ad __weak_alias(ktr_mmsg,nullop);
    116      1.3     ad __weak_alias(ktr_mib,nullop);
    117      1.3     ad __weak_alias(ktr_mool,nullop);
    118      1.3     ad __weak_alias(ktr_execarg,nullop);
    119      1.3     ad __weak_alias(ktr_execenv,nullop);
    120      1.3     ad 
    121      1.3     ad __weak_alias(sys_fktrace,sys_nosys);	/* Syscalls */
    122      1.3     ad __weak_alias(sys_ktrace,sys_nosys);
    123      1.3     ad __weak_alias(sys_utrace,sys_nosys);
    124      1.3     ad 
    125      1.3     ad int	ktrace_on;			/* Misc */
    126      1.3     ad __weak_alias(ktruser,enosys);
    127      1.4    dsl __weak_alias(ktr_point,nullop);
    128      1.3     ad #endif	/* KTRACE */
    129      1.1     ad 
    130  1.6.2.4   yamt __weak_alias(spldebug_start, voidop);
    131  1.6.2.4   yamt __weak_alias(spldebug_stop, voidop);
    132  1.6.2.4   yamt __weak_alias(machdep_init,nullop);
    133  1.6.2.4   yamt 
    134  1.6.2.2   yamt #if !defined(KERN_SA)
    135      1.1     ad /*
    136  1.6.2.2   yamt  * Scheduler activations system calls.  These need to remain, even when
    137  1.6.2.2   yamt  * KERN_SA isn't defined, until libc's major version is bumped.
    138      1.1     ad  */
    139      1.2  itohy __strong_alias(sys_sa_register,sys_nosys);
    140      1.2  itohy __strong_alias(sys_sa_stacks,sys_nosys);
    141      1.2  itohy __strong_alias(sys_sa_enable,sys_nosys);
    142      1.2  itohy __strong_alias(sys_sa_setconcurrency,sys_nosys);
    143      1.2  itohy __strong_alias(sys_sa_yield,sys_nosys);
    144      1.2  itohy __strong_alias(sys_sa_preempt,sys_nosys);
    145      1.2  itohy __strong_alias(sys_sa_unblockyield,sys_nosys);
    146      1.1     ad 
    147  1.6.2.1   yamt /*
    148  1.6.2.2   yamt  * Stubs for compat_netbsd32.
    149  1.6.2.2   yamt  */
    150  1.6.2.2   yamt __strong_alias(dosa_register,sys_nosys);
    151  1.6.2.2   yamt __strong_alias(sa_stacks1,sys_nosys);
    152  1.6.2.2   yamt #endif
    153  1.6.2.2   yamt 
    154  1.6.2.2   yamt /*
    155  1.6.2.1   yamt  * Stubs for architectures that do not support kernel preemption.
    156  1.6.2.1   yamt  */
    157  1.6.2.1   yamt #ifndef __HAVE_PREEMPTION
    158  1.6.2.1   yamt bool
    159  1.6.2.1   yamt cpu_kpreempt_enter(uintptr_t where, int s)
    160  1.6.2.1   yamt {
    161  1.6.2.1   yamt 
    162  1.6.2.1   yamt 	return false;
    163  1.6.2.1   yamt }
    164  1.6.2.1   yamt 
    165  1.6.2.1   yamt void
    166  1.6.2.1   yamt cpu_kpreempt_exit(uintptr_t where)
    167  1.6.2.1   yamt {
    168  1.6.2.1   yamt 
    169  1.6.2.1   yamt }
    170  1.6.2.1   yamt 
    171  1.6.2.1   yamt bool
    172  1.6.2.1   yamt cpu_kpreempt_disabled(void)
    173  1.6.2.1   yamt {
    174  1.6.2.1   yamt 
    175  1.6.2.1   yamt 	return true;
    176  1.6.2.1   yamt }
    177  1.6.2.1   yamt #else
    178  1.6.2.1   yamt # ifndef MULTIPROCESSOR
    179  1.6.2.1   yamt #   error __HAVE_PREEMPTION requires MULTIPROCESSOR
    180  1.6.2.1   yamt # endif
    181  1.6.2.1   yamt #endif	/* !__HAVE_PREEMPTION */
    182  1.6.2.1   yamt 
    183      1.1     ad int
    184      1.5    dsl sys_nosys(struct lwp *l, const void *v, register_t *retval)
    185      1.1     ad {
    186      1.1     ad 
    187      1.6     ad 	mutex_enter(proc_lock);
    188      1.1     ad 	psignal(l->l_proc, SIGSYS);
    189      1.6     ad 	mutex_exit(proc_lock);
    190      1.1     ad 	return ENOSYS;
    191      1.1     ad }
    192      1.3     ad 
    193  1.6.2.2   yamt int
    194  1.6.2.2   yamt sys_nomodule(struct lwp *l, const void *v, register_t *retval)
    195  1.6.2.2   yamt {
    196  1.6.2.2   yamt #ifdef MODULAR
    197  1.6.2.2   yamt 	static struct {
    198  1.6.2.2   yamt 		u_int		al_code;
    199  1.6.2.2   yamt 		const char	*al_module;
    200  1.6.2.2   yamt 	} const autoload[] = {
    201  1.6.2.2   yamt 	    { SYS_aio_cancel, "aio" },
    202  1.6.2.2   yamt 	    { SYS_aio_error, "aio" },
    203  1.6.2.2   yamt 	    { SYS_aio_fsync, "aio" },
    204  1.6.2.2   yamt 	    { SYS_aio_read, "aio" },
    205  1.6.2.2   yamt 	    { SYS_aio_return, "aio" },
    206  1.6.2.2   yamt 	    { SYS___aio_suspend50, "aio" },
    207  1.6.2.2   yamt 	    { SYS_aio_write, "aio" },
    208  1.6.2.2   yamt 	    { SYS_lio_listio, "aio" },
    209  1.6.2.3   yamt 	    { SYS_mq_open, "mqueue" },
    210  1.6.2.3   yamt 	    { SYS_mq_close, "mqueue" },
    211  1.6.2.3   yamt 	    { SYS_mq_unlink, "mqueue" },
    212  1.6.2.3   yamt 	    { SYS_mq_getattr, "mqueue" },
    213  1.6.2.3   yamt 	    { SYS_mq_setattr, "mqueue" },
    214  1.6.2.3   yamt 	    { SYS_mq_notify, "mqueue" },
    215  1.6.2.3   yamt 	    { SYS_mq_send, "mqueue" },
    216  1.6.2.3   yamt 	    { SYS_mq_receive, "mqueue" },
    217  1.6.2.3   yamt 	    { SYS___mq_timedsend50, "mqueue" },
    218  1.6.2.3   yamt 	    { SYS___mq_timedreceive50, "mqueue" },
    219  1.6.2.2   yamt 	    { SYS_compat_43_fstat43, "compat" },
    220  1.6.2.2   yamt 	    { SYS_compat_43_lstat43, "compat" },
    221  1.6.2.2   yamt 	    { SYS_compat_43_oaccept, "compat" },
    222  1.6.2.2   yamt 	    { SYS_compat_43_ocreat, "compat" },
    223  1.6.2.2   yamt 	    { SYS_compat_43_oftruncate, "compat" },
    224  1.6.2.2   yamt 	    { SYS_compat_43_ogetdirentries, "compat" },
    225  1.6.2.2   yamt 	    { SYS_compat_43_ogetdtablesize, "compat" },
    226  1.6.2.2   yamt 	    { SYS_compat_43_ogethostid, "compat" },
    227  1.6.2.2   yamt 	    { SYS_compat_43_ogethostname, "compat" },
    228  1.6.2.2   yamt 	    { SYS_compat_43_ogetkerninfo, "compat" },
    229  1.6.2.2   yamt 	    { SYS_compat_43_ogetpagesize, "compat" },
    230  1.6.2.2   yamt 	    { SYS_compat_43_ogetpeername, "compat" },
    231  1.6.2.2   yamt 	    { SYS_compat_43_ogetrlimit, "compat" },
    232  1.6.2.2   yamt 	    { SYS_compat_43_ogetsockname, "compat" },
    233  1.6.2.2   yamt 	    { SYS_compat_43_okillpg, "compat" },
    234  1.6.2.2   yamt 	    { SYS_compat_43_olseek, "compat" },
    235  1.6.2.2   yamt 	    { SYS_compat_43_ommap, "compat" },
    236  1.6.2.2   yamt 	    { SYS_compat_43_oquota, "compat" },
    237  1.6.2.2   yamt 	    { SYS_compat_43_orecv, "compat" },
    238  1.6.2.2   yamt 	    { SYS_compat_43_orecvfrom, "compat" },
    239  1.6.2.2   yamt 	    { SYS_compat_43_orecvmsg, "compat" },
    240  1.6.2.2   yamt 	    { SYS_compat_43_osend, "compat" },
    241  1.6.2.2   yamt 	    { SYS_compat_43_osendmsg, "compat" },
    242  1.6.2.2   yamt 	    { SYS_compat_43_osethostid, "compat" },
    243  1.6.2.2   yamt 	    { SYS_compat_43_osethostname, "compat" },
    244  1.6.2.2   yamt 	    { SYS_compat_43_osetrlimit, "compat" },
    245  1.6.2.2   yamt 	    { SYS_compat_43_osigblock, "compat" },
    246  1.6.2.2   yamt 	    { SYS_compat_43_osigsetmask, "compat" },
    247  1.6.2.2   yamt 	    { SYS_compat_43_osigstack, "compat" },
    248  1.6.2.2   yamt 	    { SYS_compat_43_osigvec, "compat" },
    249  1.6.2.2   yamt 	    { SYS_compat_43_otruncate, "compat" },
    250  1.6.2.2   yamt 	    { SYS_compat_43_owait, "compat" },
    251  1.6.2.2   yamt 	    { SYS_compat_43_stat43, "compat" },
    252  1.6.2.2   yamt 	    { SYS_compat_09_ogetdomainname, "compat" },
    253  1.6.2.2   yamt 	    { SYS_compat_09_osetdomainname, "compat" },
    254  1.6.2.2   yamt 	    { SYS_compat_09_ouname, "compat" },
    255  1.6.2.2   yamt #ifndef _LP64
    256  1.6.2.2   yamt 	    { SYS_compat_10_omsgsys, "compat" },
    257  1.6.2.2   yamt 	    { SYS_compat_10_osemsys, "compat" },
    258  1.6.2.2   yamt 	    { SYS_compat_10_oshmsys, "compat" },
    259  1.6.2.2   yamt #endif
    260  1.6.2.2   yamt 	    { SYS_compat_12_fstat12, "compat" },
    261  1.6.2.2   yamt 	    { SYS_compat_12_getdirentries, "compat" },
    262  1.6.2.2   yamt 	    { SYS_compat_12_lstat12, "compat" },
    263  1.6.2.2   yamt 	    { SYS_compat_12_msync, "compat" },
    264  1.6.2.2   yamt 	    { SYS_compat_12_oreboot, "compat" },
    265  1.6.2.2   yamt 	    { SYS_compat_12_oswapon, "compat" },
    266  1.6.2.2   yamt 	    { SYS_compat_12_stat12, "compat" },
    267  1.6.2.2   yamt 	    { SYS_compat_13_sigaction13, "compat" },
    268  1.6.2.2   yamt 	    { SYS_compat_13_sigaltstack13, "compat" },
    269  1.6.2.2   yamt 	    { SYS_compat_13_sigpending13, "compat" },
    270  1.6.2.2   yamt 	    { SYS_compat_13_sigprocmask13, "compat" },
    271  1.6.2.2   yamt 	    { SYS_compat_13_sigreturn13, "compat" },
    272  1.6.2.2   yamt 	    { SYS_compat_13_sigsuspend13, "compat" },
    273  1.6.2.2   yamt 	    { SYS_compat_14___semctl, "compat" },
    274  1.6.2.2   yamt 	    { SYS_compat_14_msgctl, "compat" },
    275  1.6.2.2   yamt 	    { SYS_compat_14_shmctl, "compat" },
    276  1.6.2.2   yamt 	    { SYS_compat_16___sigaction14, "compat" },
    277  1.6.2.2   yamt 	    { SYS_compat_16___sigreturn14, "compat" },
    278  1.6.2.2   yamt 	    { SYS_compat_20_fhstatfs, "compat" },
    279  1.6.2.2   yamt 	    { SYS_compat_20_fstatfs, "compat" },
    280  1.6.2.2   yamt 	    { SYS_compat_20_getfsstat, "compat" },
    281  1.6.2.2   yamt 	    { SYS_compat_20_statfs, "compat" },
    282  1.6.2.2   yamt 	    { SYS_compat_30___fhstat30, "compat" },
    283  1.6.2.2   yamt 	    { SYS_compat_30___fstat13, "compat" },
    284  1.6.2.2   yamt 	    { SYS_compat_30___lstat13, "compat" },
    285  1.6.2.2   yamt 	    { SYS_compat_30___stat13, "compat" },
    286  1.6.2.2   yamt 	    { SYS_compat_30_fhopen, "compat" },
    287  1.6.2.2   yamt 	    { SYS_compat_30_fhstat, "compat" },
    288  1.6.2.2   yamt 	    { SYS_compat_30_fhstatvfs1, "compat" },
    289  1.6.2.2   yamt 	    { SYS_compat_30_getdents, "compat" },
    290  1.6.2.2   yamt 	    { SYS_compat_30_getfh, "compat" },
    291  1.6.2.2   yamt 	    { SYS_compat_30_socket, "compat" },
    292  1.6.2.2   yamt 	    { SYS_compat_40_mount, "compat" },
    293  1.6.2.2   yamt 	    { SYS_compat_50_wait4, "compat" },
    294  1.6.2.2   yamt 	    { SYS_compat_50_mknod, "compat" },
    295  1.6.2.2   yamt 	    { SYS_compat_50_setitimer, "compat" },
    296  1.6.2.2   yamt 	    { SYS_compat_50_getitimer, "compat" },
    297  1.6.2.2   yamt 	    { SYS_compat_50_select, "compat" },
    298  1.6.2.2   yamt 	    { SYS_compat_50_gettimeofday, "compat" },
    299  1.6.2.2   yamt 	    { SYS_compat_50_getrusage, "compat" },
    300  1.6.2.2   yamt 	    { SYS_compat_50_settimeofday, "compat" },
    301  1.6.2.2   yamt 	    { SYS_compat_50_utimes, "compat" },
    302  1.6.2.2   yamt 	    { SYS_compat_50_adjtime, "compat" },
    303  1.6.2.2   yamt 	    { SYS_compat_50_lfs_segwait, "compat" },
    304  1.6.2.2   yamt 	    { SYS_compat_50_futimes, "compat" },
    305  1.6.2.2   yamt 	    { SYS_compat_50_clock_gettime, "compat" },
    306  1.6.2.2   yamt 	    { SYS_compat_50_clock_settime, "compat" },
    307  1.6.2.2   yamt 	    { SYS_compat_50_clock_getres, "compat" },
    308  1.6.2.2   yamt 	    { SYS_compat_50_timer_settime, "compat" },
    309  1.6.2.2   yamt 	    { SYS_compat_50_timer_gettime, "compat" },
    310  1.6.2.2   yamt 	    { SYS_compat_50_nanosleep, "compat" },
    311  1.6.2.2   yamt 	    { SYS_compat_50___sigtimedwait, "compat" },
    312  1.6.2.2   yamt 	    { SYS_compat_50_mq_timedsend, "compat" },
    313  1.6.2.2   yamt 	    { SYS_compat_50_mq_timedreceive, "compat" },
    314  1.6.2.2   yamt 	    { SYS_compat_50_lutimes, "compat" },
    315  1.6.2.2   yamt 	    { SYS_compat_50_____semctl13, "compat" },
    316  1.6.2.2   yamt 	    { SYS_compat_50___msgctl13, "compat" },
    317  1.6.2.2   yamt 	    { SYS_compat_50___shmctl13, "compat" },
    318  1.6.2.2   yamt 	    { SYS_compat_50__lwp_park, "compat" },
    319  1.6.2.2   yamt 	    { SYS_compat_50_kevent, "compat" },
    320  1.6.2.2   yamt 	    { SYS_compat_50_pselect, "compat" },
    321  1.6.2.2   yamt 	    { SYS_compat_50_pollts, "compat" },
    322  1.6.2.2   yamt 	    { SYS_compat_50___stat30, "compat" },
    323  1.6.2.2   yamt 	    { SYS_compat_50___fstat30, "compat" },
    324  1.6.2.2   yamt 	    { SYS_compat_50___lstat30, "compat" },
    325  1.6.2.2   yamt 	    { SYS_compat_50___ntp_gettime30, "compat" },
    326  1.6.2.2   yamt 	    { SYS_compat_50___fhstat40, "compat" },
    327  1.6.2.2   yamt 	    { SYS_compat_50_aio_suspend, "compat" },
    328  1.6.2.2   yamt 	    { SYS__ksem_init, "ksem" },
    329  1.6.2.2   yamt 	    { SYS__ksem_open, "ksem" },
    330  1.6.2.2   yamt 	    { SYS__ksem_unlink, "ksem" },
    331  1.6.2.2   yamt 	    { SYS__ksem_close, "ksem" },
    332  1.6.2.2   yamt 	    { SYS__ksem_post, "ksem" },
    333  1.6.2.2   yamt 	    { SYS__ksem_wait, "ksem" },
    334  1.6.2.2   yamt 	    { SYS__ksem_trywait, "ksem" },
    335  1.6.2.2   yamt 	    { SYS__ksem_getvalue, "ksem" },
    336  1.6.2.2   yamt 	    { SYS__ksem_destroy, "ksem" },
    337  1.6.2.2   yamt 	    { SYS_nfssvc, "nfsserver" },
    338  1.6.2.2   yamt 	};
    339  1.6.2.2   yamt 	const struct sysent *sy;
    340  1.6.2.2   yamt 	const struct emul *em;
    341  1.6.2.2   yamt 	int code, i;
    342  1.6.2.2   yamt 
    343  1.6.2.2   yamt 	/*
    344  1.6.2.2   yamt 	 * Restart the syscall if we interrupted a module unload that
    345  1.6.2.2   yamt 	 * failed.  Acquiring module_lock delays us until any unload
    346  1.6.2.2   yamt 	 * has been completed or rolled back.
    347  1.6.2.2   yamt 	 */
    348  1.6.2.2   yamt 	mutex_enter(&module_lock);
    349  1.6.2.2   yamt 	sy = l->l_sysent;
    350  1.6.2.2   yamt 	if (sy->sy_call != sys_nomodule) {
    351  1.6.2.2   yamt 		mutex_exit(&module_lock);
    352  1.6.2.2   yamt 		return ERESTART;
    353  1.6.2.2   yamt 	}
    354  1.6.2.2   yamt 	/*
    355  1.6.2.2   yamt 	 * Try to autoload a module to satisfy the request.  If it
    356  1.6.2.2   yamt 	 * works, retry the request.
    357  1.6.2.2   yamt 	 */
    358  1.6.2.2   yamt 	em = l->l_proc->p_emul;
    359  1.6.2.2   yamt 	if (em == &emul_netbsd) {
    360  1.6.2.2   yamt 		code = sy - em->e_sysent;
    361  1.6.2.2   yamt 		for (i = 0; i < __arraycount(autoload); i++) {
    362  1.6.2.2   yamt 			if (autoload[i].al_code != code) {
    363  1.6.2.2   yamt 				continue;
    364  1.6.2.2   yamt 			}
    365  1.6.2.2   yamt 			if (module_autoload(autoload[i].al_module,
    366  1.6.2.2   yamt 			    MODULE_CLASS_ANY) != 0 ||
    367  1.6.2.2   yamt 			    sy->sy_call == sys_nomodule) {
    368  1.6.2.2   yamt 			    	break;
    369  1.6.2.2   yamt 			}
    370  1.6.2.2   yamt 			mutex_exit(&module_lock);
    371  1.6.2.2   yamt 			return ERESTART;
    372  1.6.2.2   yamt 		}
    373  1.6.2.2   yamt 	}
    374  1.6.2.2   yamt 	mutex_exit(&module_lock);
    375  1.6.2.2   yamt #endif	/* MODULAR */
    376  1.6.2.2   yamt 
    377  1.6.2.2   yamt 	return sys_nosys(l, v, retval);
    378  1.6.2.2   yamt }
    379  1.6.2.2   yamt 
    380      1.3     ad /*
    381      1.3     ad  * Unsupported device function (e.g. writing to read-only device).
    382      1.3     ad  */
    383      1.3     ad int
    384      1.3     ad enodev(void)
    385      1.3     ad {
    386      1.3     ad 
    387      1.3     ad 	return (ENODEV);
    388      1.3     ad }
    389      1.3     ad 
    390      1.3     ad /*
    391      1.3     ad  * Unconfigured device function; driver not configured.
    392      1.3     ad  */
    393      1.3     ad int
    394      1.3     ad enxio(void)
    395      1.3     ad {
    396      1.3     ad 
    397      1.3     ad 	return (ENXIO);
    398      1.3     ad }
    399      1.3     ad 
    400      1.3     ad /*
    401      1.3     ad  * Unsupported ioctl function.
    402      1.3     ad  */
    403      1.3     ad int
    404      1.3     ad enoioctl(void)
    405      1.3     ad {
    406      1.3     ad 
    407      1.3     ad 	return (ENOTTY);
    408      1.3     ad }
    409      1.3     ad 
    410      1.3     ad /*
    411      1.3     ad  * Unsupported system function.
    412      1.3     ad  * This is used for an otherwise-reasonable operation
    413      1.3     ad  * that is not supported by the current system binary.
    414      1.3     ad  */
    415      1.3     ad int
    416      1.3     ad enosys(void)
    417      1.3     ad {
    418      1.3     ad 
    419      1.3     ad 	return (ENOSYS);
    420      1.3     ad }
    421      1.3     ad 
    422      1.3     ad /*
    423      1.3     ad  * Return error for operation not supported
    424      1.3     ad  * on a specific object or file type.
    425      1.3     ad  */
    426      1.3     ad int
    427      1.3     ad eopnotsupp(void)
    428      1.3     ad {
    429      1.3     ad 
    430      1.3     ad 	return (EOPNOTSUPP);
    431      1.3     ad }
    432      1.3     ad 
    433      1.3     ad /*
    434  1.6.2.4   yamt  * Generic null operation, void return value.
    435  1.6.2.4   yamt  */
    436  1.6.2.4   yamt void
    437  1.6.2.4   yamt voidop(void)
    438  1.6.2.4   yamt {
    439  1.6.2.4   yamt }
    440  1.6.2.4   yamt 
    441  1.6.2.4   yamt /*
    442      1.3     ad  * Generic null operation, always returns success.
    443      1.3     ad  */
    444      1.3     ad /*ARGSUSED*/
    445      1.3     ad int
    446      1.3     ad nullop(void *v)
    447      1.3     ad {
    448      1.3     ad 
    449      1.3     ad 	return (0);
    450      1.3     ad }
    451