kern_stub.c revision 1.2.14.1 1 1.2.14.1 jmcneill /* $NetBSD: kern_stub.c,v 1.2.14.1 2007/08/16 11:03:34 jmcneill Exp $ */
2 1.1 ad
3 1.1 ad /*-
4 1.1 ad * Copyright (c) 2007 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 * 3. All advertising materials mentioning features or use of this software
16 1.1 ad * must display the following acknowledgement:
17 1.1 ad * This product includes software developed by the NetBSD
18 1.1 ad * Foundation, Inc. and its contributors.
19 1.1 ad * 4. Neither the name of The NetBSD Foundation nor the names of its
20 1.1 ad * contributors may be used to endorse or promote products derived
21 1.1 ad * from this software without specific prior written permission.
22 1.1 ad *
23 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 1.1 ad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 1.1 ad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 1.1 ad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27 1.1 ad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.1 ad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.1 ad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 1.1 ad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 1.1 ad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 1.1 ad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 1.1 ad * POSSIBILITY OF SUCH DAMAGE.
34 1.1 ad */
35 1.1 ad
36 1.1 ad /*
37 1.2.14.1 jmcneill * Copyright (c) 1982, 1986, 1991, 1993
38 1.2.14.1 jmcneill * The Regents of the University of California. All rights reserved.
39 1.2.14.1 jmcneill *
40 1.2.14.1 jmcneill * Redistribution and use in source and binary forms, with or without
41 1.2.14.1 jmcneill * modification, are permitted provided that the following conditions
42 1.2.14.1 jmcneill * are met:
43 1.2.14.1 jmcneill * 1. Redistributions of source code must retain the above copyright
44 1.2.14.1 jmcneill * notice, this list of conditions and the following disclaimer.
45 1.2.14.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright
46 1.2.14.1 jmcneill * notice, this list of conditions and the following disclaimer in the
47 1.2.14.1 jmcneill * documentation and/or other materials provided with the distribution.
48 1.2.14.1 jmcneill * 3. Neither the name of the University nor the names of its contributors
49 1.2.14.1 jmcneill * may be used to endorse or promote products derived from this software
50 1.2.14.1 jmcneill * without specific prior written permission.
51 1.2.14.1 jmcneill *
52 1.2.14.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 1.2.14.1 jmcneill * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 1.2.14.1 jmcneill * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 1.2.14.1 jmcneill * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 1.2.14.1 jmcneill * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 1.2.14.1 jmcneill * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 1.2.14.1 jmcneill * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 1.2.14.1 jmcneill * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 1.2.14.1 jmcneill * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 1.2.14.1 jmcneill * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 1.2.14.1 jmcneill * SUCH DAMAGE.
63 1.2.14.1 jmcneill *
64 1.2.14.1 jmcneill * @(#)subr_xxx.c 8.3 (Berkeley) 3/29/95
65 1.2.14.1 jmcneill */
66 1.2.14.1 jmcneill
67 1.2.14.1 jmcneill /*
68 1.1 ad * Stubs for system calls and facilities not included in the system.
69 1.1 ad */
70 1.1 ad
71 1.1 ad #include <sys/cdefs.h>
72 1.2.14.1 jmcneill __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.2.14.1 2007/08/16 11:03:34 jmcneill Exp $");
73 1.1 ad
74 1.1 ad #include "opt_ptrace.h"
75 1.2.14.1 jmcneill #include "opt_ktrace.h"
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.1 ad #include <sys/signalvar.h>
81 1.1 ad #include <sys/syscallargs.h>
82 1.2.14.1 jmcneill #include <sys/ktrace.h>
83 1.1 ad
84 1.1 ad /*
85 1.1 ad * Nonexistent system call-- signal process (may want to handle it). Flag
86 1.1 ad * error in case process won't see signal immediately (blocked or ignored).
87 1.1 ad */
88 1.1 ad #ifndef PTRACE
89 1.2 itohy __weak_alias(sys_ptrace,sys_nosys);
90 1.2.14.1 jmcneill #endif /* PTRACE */
91 1.2.14.1 jmcneill
92 1.2.14.1 jmcneill /*
93 1.2.14.1 jmcneill * ktrace stubs. ktruser() goes to enosys as we want to fail the syscall,
94 1.2.14.1 jmcneill * but not kill the process: utrace() is a debugging feature.
95 1.2.14.1 jmcneill */
96 1.2.14.1 jmcneill #ifndef KTRACE
97 1.2.14.1 jmcneill __weak_alias(ktr_csw,nullop); /* Probes */
98 1.2.14.1 jmcneill __weak_alias(ktr_emul,nullop);
99 1.2.14.1 jmcneill __weak_alias(ktr_geniov,nullop);
100 1.2.14.1 jmcneill __weak_alias(ktr_genio,nullop);
101 1.2.14.1 jmcneill __weak_alias(ktr_mibio,nullop);
102 1.2.14.1 jmcneill __weak_alias(ktr_namei,nullop);
103 1.2.14.1 jmcneill __weak_alias(ktr_namei2,nullop);
104 1.2.14.1 jmcneill __weak_alias(ktr_psig,nullop);
105 1.2.14.1 jmcneill __weak_alias(ktr_syscall,nullop);
106 1.2.14.1 jmcneill __weak_alias(ktr_sysret,nullop);
107 1.2.14.1 jmcneill __weak_alias(ktr_kuser,nullop);
108 1.2.14.1 jmcneill __weak_alias(ktr_mmsg,nullop);
109 1.2.14.1 jmcneill __weak_alias(ktr_mib,nullop);
110 1.2.14.1 jmcneill __weak_alias(ktr_mool,nullop);
111 1.2.14.1 jmcneill __weak_alias(ktr_execarg,nullop);
112 1.2.14.1 jmcneill __weak_alias(ktr_execenv,nullop);
113 1.2.14.1 jmcneill
114 1.2.14.1 jmcneill __weak_alias(sys_fktrace,sys_nosys); /* Syscalls */
115 1.2.14.1 jmcneill __weak_alias(sys_ktrace,sys_nosys);
116 1.2.14.1 jmcneill __weak_alias(sys_utrace,sys_nosys);
117 1.2.14.1 jmcneill
118 1.2.14.1 jmcneill int ktrace_on; /* Misc */
119 1.2.14.1 jmcneill __weak_alias(ktruser,enosys);
120 1.2.14.1 jmcneill __weak_alias(ktrpoint,nullop);
121 1.2.14.1 jmcneill #endif /* KTRACE */
122 1.1 ad
123 1.1 ad /*
124 1.1 ad * Scheduler activations system calls. These need to remain until libc's
125 1.1 ad * major version is bumped.
126 1.1 ad */
127 1.2 itohy __strong_alias(sys_sa_register,sys_nosys);
128 1.2 itohy __strong_alias(sys_sa_stacks,sys_nosys);
129 1.2 itohy __strong_alias(sys_sa_enable,sys_nosys);
130 1.2 itohy __strong_alias(sys_sa_setconcurrency,sys_nosys);
131 1.2 itohy __strong_alias(sys_sa_yield,sys_nosys);
132 1.2 itohy __strong_alias(sys_sa_preempt,sys_nosys);
133 1.2 itohy __strong_alias(sys_sa_unblockyield,sys_nosys);
134 1.1 ad
135 1.1 ad /* ARGSUSED */
136 1.1 ad int
137 1.1 ad sys_nosys(struct lwp *l, void *v, register_t *retval)
138 1.1 ad {
139 1.1 ad
140 1.1 ad mutex_enter(&proclist_mutex);
141 1.1 ad psignal(l->l_proc, SIGSYS);
142 1.1 ad mutex_exit(&proclist_mutex);
143 1.1 ad return ENOSYS;
144 1.1 ad }
145 1.2.14.1 jmcneill
146 1.2.14.1 jmcneill /*
147 1.2.14.1 jmcneill * Unsupported device function (e.g. writing to read-only device).
148 1.2.14.1 jmcneill */
149 1.2.14.1 jmcneill int
150 1.2.14.1 jmcneill enodev(void)
151 1.2.14.1 jmcneill {
152 1.2.14.1 jmcneill
153 1.2.14.1 jmcneill return (ENODEV);
154 1.2.14.1 jmcneill }
155 1.2.14.1 jmcneill
156 1.2.14.1 jmcneill /*
157 1.2.14.1 jmcneill * Unconfigured device function; driver not configured.
158 1.2.14.1 jmcneill */
159 1.2.14.1 jmcneill int
160 1.2.14.1 jmcneill enxio(void)
161 1.2.14.1 jmcneill {
162 1.2.14.1 jmcneill
163 1.2.14.1 jmcneill return (ENXIO);
164 1.2.14.1 jmcneill }
165 1.2.14.1 jmcneill
166 1.2.14.1 jmcneill /*
167 1.2.14.1 jmcneill * Unsupported ioctl function.
168 1.2.14.1 jmcneill */
169 1.2.14.1 jmcneill int
170 1.2.14.1 jmcneill enoioctl(void)
171 1.2.14.1 jmcneill {
172 1.2.14.1 jmcneill
173 1.2.14.1 jmcneill return (ENOTTY);
174 1.2.14.1 jmcneill }
175 1.2.14.1 jmcneill
176 1.2.14.1 jmcneill /*
177 1.2.14.1 jmcneill * Unsupported system function.
178 1.2.14.1 jmcneill * This is used for an otherwise-reasonable operation
179 1.2.14.1 jmcneill * that is not supported by the current system binary.
180 1.2.14.1 jmcneill */
181 1.2.14.1 jmcneill int
182 1.2.14.1 jmcneill enosys(void)
183 1.2.14.1 jmcneill {
184 1.2.14.1 jmcneill
185 1.2.14.1 jmcneill return (ENOSYS);
186 1.2.14.1 jmcneill }
187 1.2.14.1 jmcneill
188 1.2.14.1 jmcneill /*
189 1.2.14.1 jmcneill * Return error for operation not supported
190 1.2.14.1 jmcneill * on a specific object or file type.
191 1.2.14.1 jmcneill */
192 1.2.14.1 jmcneill int
193 1.2.14.1 jmcneill eopnotsupp(void)
194 1.2.14.1 jmcneill {
195 1.2.14.1 jmcneill
196 1.2.14.1 jmcneill return (EOPNOTSUPP);
197 1.2.14.1 jmcneill }
198 1.2.14.1 jmcneill
199 1.2.14.1 jmcneill /*
200 1.2.14.1 jmcneill * Generic null operation, always returns success.
201 1.2.14.1 jmcneill */
202 1.2.14.1 jmcneill /*ARGSUSED*/
203 1.2.14.1 jmcneill int
204 1.2.14.1 jmcneill nullop(void *v)
205 1.2.14.1 jmcneill {
206 1.2.14.1 jmcneill
207 1.2.14.1 jmcneill return (0);
208 1.2.14.1 jmcneill }
209