Tue Jan 22 01:47:21 2013 UTC ()
Simplify the ifdef mess. No functional context.


(christos)
diff -r1.14 -r1.15 src/sys/compat/common/compat_mod.c

cvs diff -r1.14 -r1.15 src/sys/compat/common/Attic/compat_mod.c (expand / switch to unified diff)

--- src/sys/compat/common/Attic/compat_mod.c 2011/08/08 23:44:06 1.14
+++ src/sys/compat/common/Attic/compat_mod.c 2013/01/22 01:47:20 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $ */ 1/* $NetBSD: compat_mod.c,v 1.15 2013/01/22 01:47:20 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software developed for The NetBSD Foundation 7 * This code is derived from software developed for The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Linkage for the compat module: spaghetti. 33 * Linkage for the compat module: spaghetti.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.14 2011/08/08 23:44:06 jakllsch Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.15 2013/01/22 01:47:20 christos Exp $");
38 38
39#ifdef _KERNEL_OPT 39#ifdef _KERNEL_OPT
40#include "opt_compat_netbsd.h" 40#include "opt_compat_netbsd.h"
41#include "opt_compat_43.h" 41#include "opt_compat_43.h"
42#include "opt_ntp.h" 42#include "opt_ntp.h"
43#include "opt_sysv.h" 43#include "opt_sysv.h"
44#include "opt_lfs.h" 44#include "opt_lfs.h"
45#endif 45#endif
46 46
47#include <sys/systm.h> 47#include <sys/systm.h>
48#include <sys/module.h> 48#include <sys/module.h>
49#include <sys/rwlock.h> 49#include <sys/rwlock.h>
50#include <sys/tty.h> 50#include <sys/tty.h>
@@ -53,27 +53,28 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c @@ -53,27 +53,28 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
53#include <sys/syscallargs.h> 53#include <sys/syscallargs.h>
54#include <sys/syscallvar.h> 54#include <sys/syscallvar.h>
55 55
56#include <uvm/uvm_extern.h> 56#include <uvm/uvm_extern.h>
57#include <uvm/uvm_object.h> 57#include <uvm/uvm_object.h>
58 58
59#include <compat/common/compat_util.h> 59#include <compat/common/compat_util.h>
60 60
61MODULE(MODULE_CLASS_MISC, compat, NULL); 61MODULE(MODULE_CLASS_MISC, compat, NULL);
62 62
63int ttcompat(struct tty *, u_long, void *, int, struct lwp *); 63int ttcompat(struct tty *, u_long, void *, int, struct lwp *);
64 64
65#ifdef COMPAT_16 65#ifdef COMPAT_16
66#if !(defined(__amd64__) && !defined(COMPAT_NETBSD32)) 66#if !defined(__amd64__) || defined(COMPAT_NETBSD32)
 67#define COMPAT_SIGCONTEXT
67extern char sigcode[], esigcode[]; 68extern char sigcode[], esigcode[];
68struct uvm_object *emul_netbsd_object; 69struct uvm_object *emul_netbsd_object;
69#endif 70#endif
70#endif 71#endif
71 72
72extern krwlock_t exec_lock; 73extern krwlock_t exec_lock;
73extern krwlock_t ttcompat_lock; 74extern krwlock_t ttcompat_lock;
74 75
75static const struct syscall_package compat_syscalls[] = { 76static const struct syscall_package compat_syscalls[] = {
76#if defined(COMPAT_43) 77#if defined(COMPAT_43)
77 { SYS_compat_43_fstat43, 0, (sy_call_t *)compat_43_sys_fstat }, 78 { SYS_compat_43_fstat43, 0, (sy_call_t *)compat_43_sys_fstat },
78 { SYS_compat_43_lstat43, 0, (sy_call_t *)compat_43_sys_lstat }, 79 { SYS_compat_43_lstat43, 0, (sy_call_t *)compat_43_sys_lstat },
79 { SYS_compat_43_oaccept, 0, (sy_call_t *)compat_43_sys_accept }, 80 { SYS_compat_43_oaccept, 0, (sy_call_t *)compat_43_sys_accept },
@@ -149,27 +150,27 @@ static const struct syscall_package comp @@ -149,27 +150,27 @@ static const struct syscall_package comp
149#if defined(COMPAT_14) 150#if defined(COMPAT_14)
150# if defined(SYSVSEM) 151# if defined(SYSVSEM)
151 { SYS_compat_14___semctl, 0, (sy_call_t *)compat_14_sys___semctl }, 152 { SYS_compat_14___semctl, 0, (sy_call_t *)compat_14_sys___semctl },
152# endif 153# endif
153# if defined(SYSVMSG) 154# if defined(SYSVMSG)
154 { SYS_compat_14_msgctl, 0, (sy_call_t *)compat_14_sys_msgctl }, 155 { SYS_compat_14_msgctl, 0, (sy_call_t *)compat_14_sys_msgctl },
155# endif 156# endif
156# if defined(SYSVSHM) 157# if defined(SYSVSHM)
157 { SYS_compat_14_shmctl, 0, (sy_call_t *)compat_14_sys_shmctl }, 158 { SYS_compat_14_shmctl, 0, (sy_call_t *)compat_14_sys_shmctl },
158# endif 159# endif
159#endif 160#endif
160 161
161#if defined(COMPAT_16) 162#if defined(COMPAT_16)
162#if !(defined(__amd64__) && !defined(COMPAT_NETBSD32)) 163#if defined(COMPAT_SIGCONTEXT)
163 { SYS_compat_16___sigaction14, 0, (sy_call_t *)compat_16_sys___sigaction14 }, 164 { SYS_compat_16___sigaction14, 0, (sy_call_t *)compat_16_sys___sigaction14 },
164 { SYS_compat_16___sigreturn14, 0, (sy_call_t *)compat_16_sys___sigreturn14 }, 165 { SYS_compat_16___sigreturn14, 0, (sy_call_t *)compat_16_sys___sigreturn14 },
165#endif 166#endif
166#endif 167#endif
167 168
168#if defined(COMPAT_20) 169#if defined(COMPAT_20)
169 { SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs }, 170 { SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs },
170 { SYS_compat_20_fstatfs, 0, (sy_call_t *)compat_20_sys_fstatfs }, 171 { SYS_compat_20_fstatfs, 0, (sy_call_t *)compat_20_sys_fstatfs },
171 { SYS_compat_20_getfsstat, 0, (sy_call_t *)compat_20_sys_getfsstat }, 172 { SYS_compat_20_getfsstat, 0, (sy_call_t *)compat_20_sys_getfsstat },
172 { SYS_compat_20_statfs, 0, (sy_call_t *)compat_20_sys_statfs }, 173 { SYS_compat_20_statfs, 0, (sy_call_t *)compat_20_sys_statfs },
173#endif 174#endif
174 175
175#if defined(COMPAT_30) 176#if defined(COMPAT_30)
@@ -248,27 +249,27 @@ compat_modcmd(modcmd_t cmd, void *arg) @@ -248,27 +249,27 @@ compat_modcmd(modcmd_t cmd, void *arg)
248 int error; 249 int error;
249 250
250 switch (cmd) { 251 switch (cmd) {
251 case MODULE_CMD_INIT: 252 case MODULE_CMD_INIT:
252 error = syscall_establish(NULL, compat_syscalls); 253 error = syscall_establish(NULL, compat_syscalls);
253 if (error != 0) { 254 if (error != 0) {
254 return error; 255 return error;
255 } 256 }
256#ifdef COMPAT_43 257#ifdef COMPAT_43
257 KASSERT(ttcompatvec == NULL); 258 KASSERT(ttcompatvec == NULL);
258 ttcompatvec = ttcompat; 259 ttcompatvec = ttcompat;
259#endif 260#endif
260#ifdef COMPAT_16 261#ifdef COMPAT_16
261#if !(defined(__amd64__) && !defined(COMPAT_NETBSD32)) 262#if defined(COMPAT_SIGCONTEXT)
262 KASSERT(emul_netbsd.e_sigobject == NULL); 263 KASSERT(emul_netbsd.e_sigobject == NULL);
263 rw_enter(&exec_lock, RW_WRITER); 264 rw_enter(&exec_lock, RW_WRITER);
264 emul_netbsd.e_sigcode = sigcode; 265 emul_netbsd.e_sigcode = sigcode;
265 emul_netbsd.e_esigcode = esigcode; 266 emul_netbsd.e_esigcode = esigcode;
266 emul_netbsd.e_sigobject = &emul_netbsd_object; 267 emul_netbsd.e_sigobject = &emul_netbsd_object;
267 rw_exit(&exec_lock); 268 rw_exit(&exec_lock);
268 KASSERT(sendsig_sigcontext_vec == NULL); 269 KASSERT(sendsig_sigcontext_vec == NULL);
269 sendsig_sigcontext_vec = sendsig_sigcontext; 270 sendsig_sigcontext_vec = sendsig_sigcontext;
270#endif 271#endif
271#endif 272#endif
272#if defined(COMPAT_09) || defined(COMPAT_43) 273#if defined(COMPAT_09) || defined(COMPAT_43)
273 compat_sysctl_init(); 274 compat_sysctl_init();
274#endif 275#endif
@@ -301,27 +302,27 @@ compat_modcmd(modcmd_t cmd, void *arg) @@ -301,27 +302,27 @@ compat_modcmd(modcmd_t cmd, void *arg)
301 } 302 }
302#ifdef COMPAT_43 303#ifdef COMPAT_43
303 /* Unlink ttcompatvec. */ 304 /* Unlink ttcompatvec. */
304 if (rw_tryenter(&ttcompat_lock, RW_WRITER)) { 305 if (rw_tryenter(&ttcompat_lock, RW_WRITER)) {
305 ttcompatvec = NULL; 306 ttcompatvec = NULL;
306 rw_exit(&ttcompat_lock); 307 rw_exit(&ttcompat_lock);
307 } else { 308 } else {
308 error = syscall_establish(NULL, compat_syscalls); 309 error = syscall_establish(NULL, compat_syscalls);
309 KASSERT(error == 0); 310 KASSERT(error == 0);
310 return EBUSY; 311 return EBUSY;
311 } 312 }
312#endif 313#endif
313#ifdef COMPAT_16 314#ifdef COMPAT_16
314#if !(defined(__amd64__) && !defined(COMPAT_NETBSD32)) 315#if defined(COMPAT_SIGCONTEXT)
315 /* 316 /*
316 * The sigobject may persist if still in use, but 317 * The sigobject may persist if still in use, but
317 * is reference counted so will die eventually. 318 * is reference counted so will die eventually.
318 */ 319 */
319 rw_enter(&exec_lock, RW_WRITER); 320 rw_enter(&exec_lock, RW_WRITER);
320 if (emul_netbsd_object != NULL) { 321 if (emul_netbsd_object != NULL) {
321 (*emul_netbsd_object->pgops->pgo_detach) 322 (*emul_netbsd_object->pgops->pgo_detach)
322 (emul_netbsd_object); 323 (emul_netbsd_object);
323 } 324 }
324 emul_netbsd_object = NULL; 325 emul_netbsd_object = NULL;
325 emul_netbsd.e_sigcode = NULL; 326 emul_netbsd.e_sigcode = NULL;
326 emul_netbsd.e_esigcode = NULL; 327 emul_netbsd.e_esigcode = NULL;
327 emul_netbsd.e_sigobject = NULL; 328 emul_netbsd.e_sigobject = NULL;