| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sysv_ipc.c,v 1.28 2015/05/13 02:06:25 pgoyette Exp $ */ | | 1 | /* $NetBSD: sysv_ipc.c,v 1.29 2015/11/06 01:00:41 pgoyette Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Charles M. Hannum. | | 8 | * by Charles M. Hannum. |
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,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
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_ipc.c,v 1.28 2015/05/13 02:06:25 pgoyette Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.29 2015/11/06 01:00:41 pgoyette Exp $"); |
34 | | | 34 | |
35 | #ifdef _KERNEL_OPT | | 35 | #ifdef _KERNEL_OPT |
36 | #include "opt_sysv.h" | | 36 | #include "opt_sysv.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <sys/syscall.h> | | 39 | #include <sys/syscall.h> |
40 | #include <sys/syscallargs.h> | | 40 | #include <sys/syscallargs.h> |
41 | #include <sys/syscallvar.h> | | 41 | #include <sys/syscallvar.h> |
42 | #include <sys/param.h> | | 42 | #include <sys/param.h> |
43 | #include <sys/kernel.h> | | 43 | #include <sys/kernel.h> |
44 | #include <sys/proc.h> | | 44 | #include <sys/proc.h> |
45 | #include <sys/ipc.h> | | 45 | #include <sys/ipc.h> |
46 | #ifdef SYSVMSG | | 46 | #ifdef SYSVMSG |
| @@ -127,38 +127,44 @@ struct msginfo msginfo = { | | | @@ -127,38 +127,44 @@ struct msginfo msginfo = { |
127 | | | 127 | |
128 | MODULE(MODULE_CLASS_EXEC, sysv_ipc, NULL); | | 128 | MODULE(MODULE_CLASS_EXEC, sysv_ipc, NULL); |
129 | | | 129 | |
130 | #ifdef _MODULE | | 130 | #ifdef _MODULE |
131 | SYSCTL_SETUP_PROTO(sysctl_ipc_setup); | | 131 | SYSCTL_SETUP_PROTO(sysctl_ipc_setup); |
132 | SYSCTL_SETUP_PROTO(sysctl_ipc_shm_setup); | | 132 | SYSCTL_SETUP_PROTO(sysctl_ipc_shm_setup); |
133 | SYSCTL_SETUP_PROTO(sysctl_ipc_sem_setup); | | 133 | SYSCTL_SETUP_PROTO(sysctl_ipc_sem_setup); |
134 | SYSCTL_SETUP_PROTO(sysctl_ipc_msg_setup); | | 134 | SYSCTL_SETUP_PROTO(sysctl_ipc_msg_setup); |
135 | | | 135 | |
136 | static struct sysctllog *sysctl_sysvipc_clog = NULL; | | 136 | static struct sysctllog *sysctl_sysvipc_clog = NULL; |
137 | #endif | | 137 | #endif |
138 | | | 138 | |
139 | static const struct syscall_package sysvipc_syscalls[] = { | | 139 | static const struct syscall_package sysvipc_syscalls[] = { |
| | | 140 | #ifdef SYSVSHM |
140 | { SYS___shmctl50, 0, (sy_call_t *)sys___shmctl50 }, | | 141 | { SYS___shmctl50, 0, (sy_call_t *)sys___shmctl50 }, |
141 | { SYS_shmat, 0, (sy_call_t *)sys_shmat }, | | 142 | { SYS_shmat, 0, (sy_call_t *)sys_shmat }, |
142 | { SYS_shmdt, 0, (sy_call_t *)sys_shmdt }, | | 143 | { SYS_shmdt, 0, (sy_call_t *)sys_shmdt }, |
143 | { SYS_shmget, 0, (sy_call_t *)sys_shmget }, | | 144 | { SYS_shmget, 0, (sy_call_t *)sys_shmget }, |
| | | 145 | #endif |
| | | 146 | #ifdef SYSVSEM |
144 | { SYS_____semctl50, 0, (sy_call_t *)sys_____semctl50 }, | | 147 | { SYS_____semctl50, 0, (sy_call_t *)sys_____semctl50 }, |
145 | { SYS_semget, 0, (sy_call_t *)sys_semget }, | | 148 | { SYS_semget, 0, (sy_call_t *)sys_semget }, |
146 | { SYS_semop, 0, (sy_call_t *)sys_semop }, | | 149 | { SYS_semop, 0, (sy_call_t *)sys_semop }, |
147 | { SYS_semconfig, 0, (sy_call_t *)sys_semconfig }, | | 150 | { SYS_semconfig, 0, (sy_call_t *)sys_semconfig }, |
| | | 151 | #endif |
| | | 152 | #ifdef SYSVMSG |
148 | { SYS___msgctl50, 0, (sy_call_t *)sys___msgctl50 }, | | 153 | { SYS___msgctl50, 0, (sy_call_t *)sys___msgctl50 }, |
149 | { SYS_msgget, 0, (sy_call_t *)sys_msgget }, | | 154 | { SYS_msgget, 0, (sy_call_t *)sys_msgget }, |
150 | { SYS_msgsnd, 0, (sy_call_t *)sys_msgsnd }, | | 155 | { SYS_msgsnd, 0, (sy_call_t *)sys_msgsnd }, |
151 | { SYS_msgrcv, 0, (sy_call_t *)sys_msgrcv }, | | 156 | { SYS_msgrcv, 0, (sy_call_t *)sys_msgrcv }, |
| | | 157 | #endif |
152 | { 0, 0, NULL } | | 158 | { 0, 0, NULL } |
153 | }; | | 159 | }; |
154 | | | 160 | |
155 | static int | | 161 | static int |
156 | sysv_ipc_modcmd(modcmd_t cmd, void *arg) | | 162 | sysv_ipc_modcmd(modcmd_t cmd, void *arg) |
157 | { | | 163 | { |
158 | int error = 0; | | 164 | int error = 0; |
159 | | | 165 | |
160 | switch (cmd) { | | 166 | switch (cmd) { |
161 | case MODULE_CMD_INIT: | | 167 | case MODULE_CMD_INIT: |
162 | /* Link the system calls */ | | 168 | /* Link the system calls */ |
163 | error = syscall_establish(NULL, sysvipc_syscalls); | | 169 | error = syscall_establish(NULL, sysvipc_syscalls); |
164 | | | 170 | |