1 /* $NetBSD: netbsd32_compat_10.c,v 1.22.24.1 2009/01/04 02:56:09 christos Exp $ */
4 * Copyright (c) 1994 Adam Glass and Charles M. Hannum. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Adam Glass and Charles M.
18 * 4. The names of the authors may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_10.c,v 1.22.24.1 2009/01/04 02:56:09 christos Exp $");
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/kernel.h>
45 #include <sys/malloc.h>
47 #include <sys/mount.h>
48 #include <sys/syscallargs.h>
50 #include <compat/netbsd32/netbsd32.h>
51 #include <compat/netbsd32/netbsd32_syscallargs.h>
52 #include <compat/sys/shm.h>
54 #if defined(SYSVSEM) || !defined(_KERNEL_OPT)
56 compat_10_netbsd32_semsys(struct lwp
*l
, const struct compat_10_netbsd32_semsys_args
*uap
, register_t
*retval
)
59 syscallarg(int) which;
65 struct compat_50_netbsd32___semctl14_args
/* {
66 syscallarg(int) semid;
67 syscallarg(int) semnum;
69 syscallarg(union semun *) arg;
71 struct sys_semget_args
/* {
72 syscallarg(key_t) key;
73 syscallarg(int) nsems;
74 syscallarg(int) semflg;
76 struct sys_semop_args
/* {
77 syscallarg(int) semid;
78 syscallarg(struct sembuf *) sops;
79 syscallarg(u_int) nsops;
81 struct sys_semconfig_args
/* {
86 switch (SCARG(uap
, which
)) {
87 case 0: /* __semctl() */
88 SCARG(&__semctl_args
, semid
) = SCARG(uap
, a2
);
89 SCARG(&__semctl_args
, semnum
) = SCARG(uap
, a3
);
90 SCARG(&__semctl_args
, cmd
) = SCARG(uap
, a4
);
92 return do_netbsd32___semctl14(l
, &__semctl_args
, retval
, &a5
);
94 case 1: /* semget() */
95 SCARG(&semget_args
, key
) = SCARG(uap
, a2
);
96 SCARG(&semget_args
, nsems
) = SCARG(uap
, a3
);
97 SCARG(&semget_args
, semflg
) = SCARG(uap
, a4
);
98 return (sys_semget(l
, &semget_args
, retval
));
100 case 2: /* semop() */
101 SCARG(&semop_args
, semid
) = SCARG(uap
, a2
);
102 SCARG(&semop_args
, sops
) = NETBSD32IPTR64(SCARG(uap
, a3
));
103 SCARG(&semop_args
, nsops
) = SCARG(uap
, a4
);
104 return (sys_semop(l
, &semop_args
, retval
));
106 case 3: /* semconfig() */
107 SCARG(&semconfig_args
, flag
) = SCARG(uap
, a2
);
108 return (sys_semconfig(l
, &semconfig_args
, retval
));
116 #if defined(SYSVSHM) || !defined(_KERNEL_OPT)
118 compat_10_netbsd32_shmsys(struct lwp
*l
, const struct compat_10_netbsd32_shmsys_args
*uap
, register_t
*retval
)
121 syscallarg(int) which;
126 struct sys_shmat_args
/* {
127 syscallarg(int) shmid;
128 syscallarg(void *) shmaddr;
129 syscallarg(int) shmflg;
131 struct compat_14_sys_shmctl_args
/* {
132 syscallarg(int) shmid;
134 syscallarg(struct shmid_ds50 *) buf;
136 struct sys_shmdt_args
/* {
137 syscallarg(void *) shmaddr;
139 struct sys_shmget_args
/* {
140 syscallarg(key_t) key;
141 syscallarg(int) size;
142 syscallarg(int) shmflg;
145 switch (SCARG(uap
, which
)) {
146 case 0: /* shmat() */
147 SCARG(&shmat_args
, shmid
) = SCARG(uap
, a2
);
148 SCARG(&shmat_args
, shmaddr
) = NETBSD32IPTR64(SCARG(uap
, a3
));
149 SCARG(&shmat_args
, shmflg
) = SCARG(uap
, a4
);
150 return (sys_shmat(l
, &shmat_args
, retval
));
152 case 1: /* shmctl() */
153 SCARG(&shmctl_args
, shmid
) = SCARG(uap
, a2
);
154 SCARG(&shmctl_args
, cmd
) = SCARG(uap
, a3
);
155 SCARG(&shmctl_args
, buf
) = NETBSD32IPTR64(SCARG(uap
, a4
));
156 return (compat_14_sys_shmctl(l
, &shmctl_args
, retval
));
158 case 2: /* shmdt() */
159 SCARG(&shmdt_args
, shmaddr
) = NETBSD32IPTR64(SCARG(uap
, a2
));
160 return (sys_shmdt(l
, &shmdt_args
, retval
));
162 case 3: /* shmget() */
163 SCARG(&shmget_args
, key
) = SCARG(uap
, a2
);
164 SCARG(&shmget_args
, size
) = SCARG(uap
, a3
);
165 SCARG(&shmget_args
, shmflg
) = SCARG(uap
, a4
);
166 return (sys_shmget(l
, &shmget_args
, retval
));
174 #if defined(SYSVMSG) || !defined(_KERNEL)
176 compat_10_netbsd32_msgsys(struct lwp
*l
, const struct compat_10_netbsd32_msgsys_args
*uap
, register_t
*retval
)
179 syscallarg(int) which;
186 struct compat_14_sys_msgctl_args
/* {
187 syscallarg(int) msqid;
189 syscallarg(struct msqid_ds *) buf;
191 struct sys_msgget_args
/* {
192 syscallarg(key_t) key;
193 syscallarg(int) msgflg;
195 struct sys_msgsnd_args
/* {
196 syscallarg(int) msqid;
197 syscallarg(void *) msgp;
198 syscallarg(size_t) msgsz;
199 syscallarg(int) msgflg;
201 struct sys_msgrcv_args
/* {
202 syscallarg(int) msqid;
203 syscallarg(void *) msgp;
204 syscallarg(size_t) msgsz;
205 syscallarg(long) msgtyp;
206 syscallarg(int) msgflg;
209 switch (SCARG(uap
, which
)) {
210 case 0: /* msgctl()*/
211 SCARG(&msgctl_args
, msqid
) = SCARG(uap
, a2
);
212 SCARG(&msgctl_args
, cmd
) = SCARG(uap
, a3
);
213 SCARG(&msgctl_args
, buf
) = NETBSD32IPTR64(SCARG(uap
, a4
));
214 return (compat_14_sys_msgctl(l
, &msgctl_args
, retval
));
216 case 1: /* msgget() */
217 SCARG(&msgget_args
, key
) = SCARG(uap
, a2
);
218 SCARG(&msgget_args
, msgflg
) = SCARG(uap
, a3
);
219 return (sys_msgget(l
, &msgget_args
, retval
));
221 case 2: /* msgsnd() */
222 SCARG(&msgsnd_args
, msqid
) = SCARG(uap
, a2
);
223 SCARG(&msgsnd_args
, msgp
) = NETBSD32IPTR64(SCARG(uap
, a3
));
224 SCARG(&msgsnd_args
, msgsz
) = SCARG(uap
, a4
);
225 SCARG(&msgsnd_args
, msgflg
) = SCARG(uap
, a5
);
226 return (sys_msgsnd(l
, &msgsnd_args
, retval
));
228 case 3: /* msgrcv() */
229 SCARG(&msgrcv_args
, msqid
) = SCARG(uap
, a2
);
230 SCARG(&msgrcv_args
, msgp
) = NETBSD32IPTR64(SCARG(uap
, a3
));
231 SCARG(&msgrcv_args
, msgsz
) = SCARG(uap
, a4
);
232 SCARG(&msgrcv_args
, msgtyp
) = SCARG(uap
, a5
);
233 SCARG(&msgrcv_args
, msgflg
) = SCARG(uap
, a6
);
234 return (sys_msgrcv(l
, &msgrcv_args
, retval
));