[BACK]Return to kern_stub.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Annotation of src/sys/kern/kern_stub.c, Revision 1.25

1.25    ! pooka       1: /*     $NetBSD: kern_stub.c,v 1.24 2010/04/14 15:12:44 pooka Exp $     */
1.1       ad          2:
                      3: /*-
1.8       ad          4:  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
1.1       ad          5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     17:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     18:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     19:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     20:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     21:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     22:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     23:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     24:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     25:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     26:  * POSSIBILITY OF SUCH DAMAGE.
                     27:  */
                     28:
                     29: /*
1.3       ad         30:  * Copyright (c) 1982, 1986, 1991, 1993
                     31:  *     The Regents of the University of California.  All rights reserved.
                     32:  *
                     33:  * Redistribution and use in source and binary forms, with or without
                     34:  * modification, are permitted provided that the following conditions
                     35:  * are met:
                     36:  * 1. Redistributions of source code must retain the above copyright
                     37:  *    notice, this list of conditions and the following disclaimer.
                     38:  * 2. Redistributions in binary form must reproduce the above copyright
                     39:  *    notice, this list of conditions and the following disclaimer in the
                     40:  *    documentation and/or other materials provided with the distribution.
                     41:  * 3. Neither the name of the University nor the names of its contributors
                     42:  *    may be used to endorse or promote products derived from this software
                     43:  *    without specific prior written permission.
                     44:  *
                     45:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     46:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     47:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     48:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     49:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     50:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     51:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     52:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     53:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     54:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     55:  * SUCH DAMAGE.
                     56:  *
                     57:  *     @(#)subr_xxx.c  8.3 (Berkeley) 3/29/95
                     58:  */
                     59:
                     60: /*
1.1       ad         61:  * Stubs for system calls and facilities not included in the system.
                     62:  */
                     63:
                     64: #include <sys/cdefs.h>
1.25    ! pooka      65: __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.24 2010/04/14 15:12:44 pooka Exp $");
1.1       ad         66:
                     67: #include "opt_ptrace.h"
1.3       ad         68: #include "opt_ktrace.h"
1.10      wrstuden   69: #include "opt_sa.h"
1.1       ad         70:
                     71: #include <sys/param.h>
                     72: #include <sys/kernel.h>
                     73: #include <sys/proc.h>
1.16      christos   74: #include <sys/fstypes.h>
1.1       ad         75: #include <sys/signalvar.h>
1.12      ad         76: #include <sys/syscall.h>
1.3       ad         77: #include <sys/ktrace.h>
1.8       ad         78: #include <sys/intr.h>
                     79: #include <sys/cpu.h>
1.12      ad         80: #include <sys/module.h>
1.1       ad         81:
                     82: /*
                     83:  * Nonexistent system call-- signal process (may want to handle it).  Flag
                     84:  * error in case process won't see signal immediately (blocked or ignored).
                     85:  */
                     86: #ifndef PTRACE
1.2       itohy      87: __weak_alias(sys_ptrace,sys_nosys);
1.3       ad         88: #endif /* PTRACE */
                     89:
                     90: /*
                     91:  * ktrace stubs.  ktruser() goes to enosys as we want to fail the syscall,
                     92:  * but not kill the process: utrace() is a debugging feature.
                     93:  */
                     94: #ifndef KTRACE
                     95: __weak_alias(ktr_csw,nullop);          /* Probes */
                     96: __weak_alias(ktr_emul,nullop);
                     97: __weak_alias(ktr_geniov,nullop);
                     98: __weak_alias(ktr_genio,nullop);
                     99: __weak_alias(ktr_mibio,nullop);
                    100: __weak_alias(ktr_namei,nullop);
                    101: __weak_alias(ktr_namei2,nullop);
                    102: __weak_alias(ktr_psig,nullop);
1.11      wrstuden  103: __weak_alias(ktr_saupcall,nullop);
1.3       ad        104: __weak_alias(ktr_syscall,nullop);
                    105: __weak_alias(ktr_sysret,nullop);
                    106: __weak_alias(ktr_kuser,nullop);
                    107: __weak_alias(ktr_mmsg,nullop);
                    108: __weak_alias(ktr_mib,nullop);
                    109: __weak_alias(ktr_mool,nullop);
                    110: __weak_alias(ktr_execarg,nullop);
                    111: __weak_alias(ktr_execenv,nullop);
                    112:
                    113: __weak_alias(sys_fktrace,sys_nosys);   /* Syscalls */
                    114: __weak_alias(sys_ktrace,sys_nosys);
                    115: __weak_alias(sys_utrace,sys_nosys);
                    116:
                    117: int    ktrace_on;                      /* Misc */
                    118: __weak_alias(ktruser,enosys);
1.4       dsl       119: __weak_alias(ktr_point,nullop);
1.3       ad        120: #endif /* KTRACE */
1.1       ad        121:
1.21      dyoung    122: __weak_alias(spldebug_start, voidop);
                    123: __weak_alias(spldebug_stop, voidop);
1.20      elad      124: __weak_alias(machdep_init,nullop);
                    125:
1.15      ad        126: #if !defined(KERN_SA)
1.1       ad        127: /*
1.10      wrstuden  128:  * Scheduler activations system calls.  These need to remain, even when
                    129:  * KERN_SA isn't defined, until libc's major version is bumped.
1.1       ad        130:  */
1.2       itohy     131: __strong_alias(sys_sa_register,sys_nosys);
                    132: __strong_alias(sys_sa_stacks,sys_nosys);
                    133: __strong_alias(sys_sa_enable,sys_nosys);
                    134: __strong_alias(sys_sa_setconcurrency,sys_nosys);
                    135: __strong_alias(sys_sa_yield,sys_nosys);
                    136: __strong_alias(sys_sa_preempt,sys_nosys);
                    137: __strong_alias(sys_sa_unblockyield,sys_nosys);
1.15      ad        138:
                    139: /*
                    140:  * Stubs for compat_netbsd32.
                    141:  */
                    142: __strong_alias(dosa_register,sys_nosys);
                    143: __strong_alias(sa_stacks1,sys_nosys);
1.10      wrstuden  144: #endif
1.1       ad        145:
1.9       ad        146: /*
                    147:  * Stubs for architectures that do not support kernel preemption.
                    148:  */
1.8       ad        149: #ifndef __HAVE_PREEMPTION
                    150: bool
                    151: cpu_kpreempt_enter(uintptr_t where, int s)
                    152: {
                    153:
                    154:        return false;
                    155: }
                    156:
                    157: void
                    158: cpu_kpreempt_exit(uintptr_t where)
                    159: {
                    160:
                    161: }
                    162:
                    163: bool
                    164: cpu_kpreempt_disabled(void)
                    165: {
                    166:
                    167:        return true;
                    168: }
1.9       ad        169: #else
                    170: # ifndef MULTIPROCESSOR
                    171: #   error __HAVE_PREEMPTION requires MULTIPROCESSOR
                    172: # endif
1.8       ad        173: #endif /* !__HAVE_PREEMPTION */
                    174:
1.1       ad        175: int
1.5       dsl       176: sys_nosys(struct lwp *l, const void *v, register_t *retval)
1.1       ad        177: {
                    178:
1.6       ad        179:        mutex_enter(proc_lock);
1.1       ad        180:        psignal(l->l_proc, SIGSYS);
1.6       ad        181:        mutex_exit(proc_lock);
1.1       ad        182:        return ENOSYS;
                    183: }
1.3       ad        184:
                    185: /*
                    186:  * Unsupported device function (e.g. writing to read-only device).
                    187:  */
                    188: int
                    189: enodev(void)
                    190: {
                    191:
                    192:        return (ENODEV);
                    193: }
                    194:
                    195: /*
                    196:  * Unconfigured device function; driver not configured.
                    197:  */
                    198: int
                    199: enxio(void)
                    200: {
                    201:
                    202:        return (ENXIO);
                    203: }
                    204:
                    205: /*
                    206:  * Unsupported ioctl function.
                    207:  */
                    208: int
                    209: enoioctl(void)
                    210: {
                    211:
                    212:        return (ENOTTY);
                    213: }
                    214:
                    215: /*
                    216:  * Unsupported system function.
                    217:  * This is used for an otherwise-reasonable operation
                    218:  * that is not supported by the current system binary.
                    219:  */
                    220: int
                    221: enosys(void)
                    222: {
                    223:
                    224:        return (ENOSYS);
                    225: }
                    226:
                    227: /*
                    228:  * Return error for operation not supported
                    229:  * on a specific object or file type.
                    230:  */
                    231: int
                    232: eopnotsupp(void)
                    233: {
                    234:
                    235:        return (EOPNOTSUPP);
                    236: }
                    237:
                    238: /*
1.21      dyoung    239:  * Generic null operation, void return value.
                    240:  */
                    241: void
                    242: voidop(void)
                    243: {
                    244: }
                    245:
                    246: /*
1.3       ad        247:  * Generic null operation, always returns success.
                    248:  */
                    249: /*ARGSUSED*/
                    250: int
                    251: nullop(void *v)
                    252: {
                    253:
                    254:        return (0);
                    255: }

CVSweb <webmaster@jp.NetBSD.org>