| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sysv_mod.c,v 1.1.2.5 2018/03/09 04:48:42 pgoyette Exp $ */ | | 1 | /* $NetBSD: sysv_mod.c,v 1.1.2.6 2018/03/09 09:37:01 pgoyette Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2018 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 Paul Goyette | | 8 | * by Paul Goyette |
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. |
| @@ -20,47 +20,47 @@ | | | @@ -20,47 +20,47 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
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 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v 1.1.2.5 2018/03/09 04:48:42 pgoyette Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: sysv_mod.c,v 1.1.2.6 2018/03/09 09:37:01 pgoyette Exp $"); |
34 | | | 34 | |
35 | #ifdef _KERNEL_OPT | | 35 | #ifdef _KERNEL_OPT |
36 | #include "opt_compat_netbsd.h" | | 36 | #include "opt_compat_netbsd.h" |
37 | #include "opt_sysv.h" | | 37 | #include "opt_sysv.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/module.h> | | 41 | #include <sys/module.h> |
42 | #include <sys/syscall.h> | | 42 | #include <sys/syscall.h> |
43 | #include <sys/syscallargs.h> | | 43 | #include <sys/syscallargs.h> |
44 | #include <sys/syscallvar.h> | | 44 | #include <sys/syscallvar.h> |
45 | #include <sys/sysctl.h> | | 45 | #include <sys/sysctl.h> |
46 | | | 46 | |
47 | #include <compat/common/sysv_mod.h> | | 47 | #include <compat/common/sysv_mod.h> |
48 | | | 48 | |
49 | #ifdef COMPAT_50 | | 49 | #ifdef COMPAT_50 |
50 | int sysctl_kern_sysvipc50(SYSCTLFN_PROTO); | | 50 | int sysctl_kern_sysvipc50(SYSCTLFN_PROTO); |
51 | #endif | | 51 | #endif |
52 | | | 52 | |
53 | MODULE(MODULE_CLASS_EXEC, compat_sysv_ipc, "sysv_ipc"); | | 53 | MODULE(MODULE_CLASS_EXEC, compat_sysv, "sysv_ipc"); |
54 | | | 54 | |
55 | /* Build the syscall package based on options specified */ | | 55 | /* Build the syscall package based on options specified */ |
56 | | | 56 | |
57 | static const struct syscall_package compat_syscalls[] = { | | 57 | static const struct syscall_package compat_syscalls[] = { |
58 | #if defined(COMPAT_10) && !defined(_LP64) | | 58 | #if defined(COMPAT_10) && !defined(_LP64) |
59 | #ifdef SYSVSHM | | 59 | #ifdef SYSVSHM |
60 | { SYS_compat_10_oshmsys, 0, (sy_call_t *)compat_10_sys_shmsys }, | | 60 | { SYS_compat_10_oshmsys, 0, (sy_call_t *)compat_10_sys_shmsys }, |
61 | #endif | | 61 | #endif |
62 | #ifdef SYSVSEM | | 62 | #ifdef SYSVSEM |
63 | { SYS_compat_10_osemsys, 0, (sy_call_t *)compat_10_sys_semsys }, | | 63 | { SYS_compat_10_osemsys, 0, (sy_call_t *)compat_10_sys_semsys }, |
64 | #endif | | 64 | #endif |
65 | #ifdef SYSVMSG | | 65 | #ifdef SYSVMSG |
66 | { SYS_compat_10_omsgsys, 0, (sy_call_t *)compat_10_sys_msgsys }, | | 66 | { SYS_compat_10_omsgsys, 0, (sy_call_t *)compat_10_sys_msgsys }, |
| @@ -85,29 +85,29 @@ static const struct syscall_package comp | | | @@ -85,29 +85,29 @@ static const struct syscall_package comp |
85 | #endif | | 85 | #endif |
86 | #ifdef SYSVSEM | | 86 | #ifdef SYSVSEM |
87 | { SYS_compat_50_____semctl13, 0, (sy_call_t *)compat_50_sys_____semctl13 }, | | 87 | { SYS_compat_50_____semctl13, 0, (sy_call_t *)compat_50_sys_____semctl13 }, |
88 | #endif | | 88 | #endif |
89 | #ifdef SYSVMSG | | 89 | #ifdef SYSVMSG |
90 | { SYS_compat_50___msgctl13, 0, (sy_call_t *)compat_50_sys___msgctl13 }, | | 90 | { SYS_compat_50___msgctl13, 0, (sy_call_t *)compat_50_sys___msgctl13 }, |
91 | #endif | | 91 | #endif |
92 | #endif /* defined(COMPAT_50) */ | | 92 | #endif /* defined(COMPAT_50) */ |
93 | | | 93 | |
94 | { 0, 0, NULL } | | 94 | { 0, 0, NULL } |
95 | }; | | 95 | }; |
96 | | | 96 | |
97 | static int | | 97 | static int |
98 | compat_sysv_ipc_modcmd(modcmd_t cmd, void *arg) | | 98 | compat_sysv_modcmd(modcmd_t cmd, void *arg) |
99 | { | | 99 | { |
100 | static (*orig_sysvipc50_sysctl)(SYSCTLFN_PROTO); | | 100 | static int (*orig_sysvipc50_sysctl)(SYSCTLFN_PROTO); |
101 | | | 101 | |
102 | int error = 0; | | 102 | int error = 0; |
103 | | | 103 | |
104 | switch (cmd) { | | 104 | switch (cmd) { |
105 | case MODULE_CMD_INIT: | | 105 | case MODULE_CMD_INIT: |
106 | error = syscall_establish(NULL, compat_syscalls); | | 106 | error = syscall_establish(NULL, compat_syscalls); |
107 | if (error != 0) { | | 107 | if (error != 0) { |
108 | break; | | 108 | break; |
109 | } | | 109 | } |
110 | #if defined(COMPAT_50) | | 110 | #if defined(COMPAT_50) |
111 | orig_sysvipc50_sysctl = vec_sysvipc50_sysctl; | | 111 | orig_sysvipc50_sysctl = vec_sysvipc50_sysctl; |
112 | vec_sysvipc50_sysctl = sysctl_kern_sysvipc50; | | 112 | vec_sysvipc50_sysctl = sysctl_kern_sysvipc50; |
113 | #endif | | 113 | #endif |