netbsd32_compat_43.c revision 1.40 1 1.40 dsl /* $NetBSD: netbsd32_compat_43.c,v 1.40 2007/04/22 08:29:58 dsl Exp $ */
2 1.1 mrg
3 1.1 mrg /*
4 1.19 mrg * Copyright (c) 1998, 2001 Matthew R. Green
5 1.1 mrg * All rights reserved.
6 1.1 mrg *
7 1.1 mrg * Redistribution and use in source and binary forms, with or without
8 1.1 mrg * modification, are permitted provided that the following conditions
9 1.1 mrg * are met:
10 1.1 mrg * 1. Redistributions of source code must retain the above copyright
11 1.1 mrg * notice, this list of conditions and the following disclaimer.
12 1.1 mrg * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 mrg * notice, this list of conditions and the following disclaimer in the
14 1.1 mrg * documentation and/or other materials provided with the distribution.
15 1.1 mrg * 3. The name of the author may not be used to endorse or promote products
16 1.1 mrg * derived from this software without specific prior written permission.
17 1.1 mrg *
18 1.1 mrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.1 mrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.1 mrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.1 mrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 1.7 mrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 1.1 mrg * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 1.1 mrg * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 1.1 mrg * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 1.7 mrg * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1 mrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1 mrg * SUCH DAMAGE.
29 1.1 mrg */
30 1.20 lukem
31 1.20 lukem #include <sys/cdefs.h>
32 1.40 dsl __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.40 2007/04/22 08:29:58 dsl Exp $");
33 1.13 fvdl
34 1.17 mrg #if defined(_KERNEL_OPT)
35 1.13 fvdl #include "opt_compat_43.h"
36 1.13 fvdl #endif
37 1.1 mrg
38 1.1 mrg #include <sys/param.h>
39 1.1 mrg #include <sys/systm.h>
40 1.1 mrg #include <sys/fcntl.h>
41 1.1 mrg #include <sys/malloc.h>
42 1.1 mrg #include <sys/mount.h>
43 1.32 chs #include <sys/socket.h>
44 1.1 mrg #include <sys/proc.h>
45 1.1 mrg #include <sys/stat.h>
46 1.1 mrg #include <sys/syscallargs.h>
47 1.1 mrg #include <sys/time.h>
48 1.1 mrg #include <sys/ucred.h>
49 1.10 mrg #include <uvm/uvm_extern.h>
50 1.1 mrg #include <sys/sysctl.h>
51 1.3 mrg #include <sys/swap.h>
52 1.1 mrg
53 1.5 mrg #include <compat/netbsd32/netbsd32.h>
54 1.5 mrg #include <compat/netbsd32/netbsd32_syscallargs.h>
55 1.1 mrg
56 1.31 christos #include <compat/sys/stat.h>
57 1.31 christos #include <compat/sys/signal.h>
58 1.31 christos #include <compat/sys/signalvar.h>
59 1.33 christos #include <compat/sys/socket.h>
60 1.31 christos
61 1.24 thorpej int compat_43_netbsd32_sethostid __P((struct lwp *, void *, register_t *));
62 1.24 thorpej int compat_43_netbsd32_killpg __P((struct lwp *, void *, register_t *retval));
63 1.24 thorpej int compat_43_netbsd32_sigblock __P((struct lwp *, void *, register_t *retval));
64 1.24 thorpej int compat_43_netbsd32_sigblock __P((struct lwp *, void *, register_t *retval));
65 1.24 thorpej int compat_43_netbsd32_sigsetmask __P((struct lwp *, void *, register_t *retval));
66 1.9 eeh
67 1.30 perry void
68 1.5 mrg netbsd32_from_stat43(sp43, sp32)
69 1.1 mrg struct stat43 *sp43;
70 1.5 mrg struct netbsd32_stat43 *sp32;
71 1.1 mrg {
72 1.1 mrg
73 1.1 mrg sp32->st_dev = sp43->st_dev;
74 1.1 mrg sp32->st_ino = sp43->st_ino;
75 1.1 mrg sp32->st_mode = sp43->st_mode;
76 1.1 mrg sp32->st_nlink = sp43->st_nlink;
77 1.1 mrg sp32->st_uid = sp43->st_uid;
78 1.1 mrg sp32->st_gid = sp43->st_gid;
79 1.1 mrg sp32->st_rdev = sp43->st_rdev;
80 1.1 mrg sp32->st_size = sp43->st_size;
81 1.1 mrg sp32->st_atimespec.tv_sec = sp43->st_atimespec.tv_sec;
82 1.1 mrg sp32->st_atimespec.tv_nsec = sp43->st_atimespec.tv_nsec;
83 1.1 mrg sp32->st_mtimespec.tv_sec = sp43->st_mtimespec.tv_sec;
84 1.1 mrg sp32->st_mtimespec.tv_nsec = sp43->st_mtimespec.tv_nsec;
85 1.1 mrg sp32->st_ctimespec.tv_sec = sp43->st_ctimespec.tv_sec;
86 1.1 mrg sp32->st_ctimespec.tv_nsec = sp43->st_ctimespec.tv_nsec;
87 1.1 mrg sp32->st_blksize = sp43->st_blksize;
88 1.1 mrg sp32->st_blocks = sp43->st_blocks;
89 1.1 mrg sp32->st_flags = sp43->st_flags;
90 1.1 mrg sp32->st_gen = sp43->st_gen;
91 1.1 mrg }
92 1.1 mrg
93 1.1 mrg /* file system syscalls */
94 1.1 mrg int
95 1.24 thorpej compat_43_netbsd32_ocreat(l, v, retval)
96 1.24 thorpej struct lwp *l;
97 1.1 mrg void *v;
98 1.1 mrg register_t *retval;
99 1.1 mrg {
100 1.8 eeh struct compat_43_netbsd32_ocreat_args /* {
101 1.5 mrg syscallarg(const netbsd32_charp) path;
102 1.1 mrg syscallarg(mode_t) mode;
103 1.1 mrg } */ *uap = v;
104 1.1 mrg struct sys_open_args ua;
105 1.1 mrg
106 1.6 mrg NETBSD32TOP_UAP(path, const char);
107 1.6 mrg NETBSD32TO64_UAP(mode);
108 1.1 mrg SCARG(&ua, flags) = O_WRONLY | O_CREAT | O_TRUNC;
109 1.1 mrg
110 1.24 thorpej return (sys_open(l, &ua, retval));
111 1.1 mrg }
112 1.1 mrg
113 1.1 mrg int
114 1.24 thorpej compat_43_netbsd32_olseek(l, v, retval)
115 1.24 thorpej struct lwp *l;
116 1.1 mrg void *v;
117 1.1 mrg register_t *retval;
118 1.1 mrg {
119 1.8 eeh struct compat_43_netbsd32_olseek_args /* {
120 1.1 mrg syscallarg(int) fd;
121 1.5 mrg syscallarg(netbsd32_long) offset;
122 1.1 mrg syscallarg(int) whence;
123 1.1 mrg } */ *uap = v;
124 1.1 mrg struct sys_lseek_args ua;
125 1.1 mrg int rv;
126 1.1 mrg off_t rt;
127 1.1 mrg
128 1.1 mrg SCARG(&ua, fd) = SCARG(uap, fd);
129 1.6 mrg NETBSD32TOX_UAP(offset, long);
130 1.6 mrg NETBSD32TO64_UAP(whence);
131 1.24 thorpej rv = sys_lseek(l, &ua, (register_t *)&rt);
132 1.18 eeh *retval = rt;
133 1.1 mrg
134 1.1 mrg return (rv);
135 1.1 mrg }
136 1.1 mrg
137 1.1 mrg int
138 1.24 thorpej compat_43_netbsd32_stat43(l, v, retval)
139 1.24 thorpej struct lwp *l;
140 1.1 mrg void *v;
141 1.1 mrg register_t *retval;
142 1.1 mrg {
143 1.24 thorpej struct proc *p = l->l_proc;
144 1.8 eeh struct compat_43_netbsd32_stat43_args /* {
145 1.5 mrg syscallarg(const netbsd32_charp) path;
146 1.5 mrg syscallarg(netbsd32_stat43p_t) ub;
147 1.1 mrg } */ *uap = v;
148 1.15 mrg struct stat43 sb43, *sgsbp;
149 1.15 mrg struct netbsd32_stat43 sb32;
150 1.1 mrg struct compat_43_sys_stat_args ua;
151 1.36 christos void *sg = stackgap_init(p, 0);
152 1.15 mrg int rv, error;
153 1.1 mrg
154 1.6 mrg NETBSD32TOP_UAP(path, const char);
155 1.21 christos SCARG(&ua, ub) = sgsbp = stackgap_alloc(p, &sg, sizeof(sb43));
156 1.24 thorpej rv = compat_43_sys_stat(l, &ua, retval);
157 1.1 mrg
158 1.15 mrg error = copyin(sgsbp, &sb43, sizeof(sb43));
159 1.15 mrg if (error)
160 1.15 mrg return error;
161 1.15 mrg netbsd32_from_stat43(&sb43, &sb32);
162 1.39 dsl error = copyout(&sb32, SCARG_P32(uap, ub), sizeof(sb32));
163 1.15 mrg if (error)
164 1.15 mrg return error;
165 1.1 mrg
166 1.1 mrg return (rv);
167 1.1 mrg }
168 1.1 mrg
169 1.1 mrg int
170 1.24 thorpej compat_43_netbsd32_lstat43(l, v, retval)
171 1.24 thorpej struct lwp *l;
172 1.1 mrg void *v;
173 1.1 mrg register_t *retval;
174 1.1 mrg {
175 1.24 thorpej struct proc *p = l->l_proc;
176 1.8 eeh struct compat_43_netbsd32_lstat43_args /* {
177 1.5 mrg syscallarg(const netbsd32_charp) path;
178 1.5 mrg syscallarg(netbsd32_stat43p_t) ub;
179 1.1 mrg } */ *uap = v;
180 1.15 mrg struct stat43 sb43, *sgsbp;
181 1.15 mrg struct netbsd32_stat43 sb32;
182 1.1 mrg struct compat_43_sys_lstat_args ua;
183 1.36 christos void *sg = stackgap_init(p, 0);
184 1.15 mrg int rv, error;
185 1.1 mrg
186 1.6 mrg NETBSD32TOP_UAP(path, const char);
187 1.21 christos SCARG(&ua, ub) = sgsbp = stackgap_alloc(p, &sg, sizeof(sb43));
188 1.24 thorpej rv = compat_43_sys_stat(l, &ua, retval);
189 1.1 mrg
190 1.15 mrg error = copyin(sgsbp, &sb43, sizeof(sb43));
191 1.15 mrg if (error)
192 1.15 mrg return error;
193 1.15 mrg netbsd32_from_stat43(&sb43, &sb32);
194 1.39 dsl error = copyout(&sb32, SCARG_P32(uap, ub), sizeof(sb32));
195 1.15 mrg if (error)
196 1.15 mrg return error;
197 1.1 mrg
198 1.1 mrg return (rv);
199 1.1 mrg }
200 1.1 mrg
201 1.1 mrg int
202 1.24 thorpej compat_43_netbsd32_fstat43(l, v, retval)
203 1.24 thorpej struct lwp *l;
204 1.1 mrg void *v;
205 1.1 mrg register_t *retval;
206 1.1 mrg {
207 1.24 thorpej struct proc *p = l->l_proc;
208 1.8 eeh struct compat_43_netbsd32_fstat43_args /* {
209 1.1 mrg syscallarg(int) fd;
210 1.5 mrg syscallarg(netbsd32_stat43p_t) sb;
211 1.1 mrg } */ *uap = v;
212 1.15 mrg struct stat43 sb43, *sgsbp;
213 1.15 mrg struct netbsd32_stat43 sb32;
214 1.1 mrg struct compat_43_sys_fstat_args ua;
215 1.36 christos void *sg = stackgap_init(p, 0);
216 1.15 mrg int rv, error;
217 1.1 mrg
218 1.6 mrg NETBSD32TO64_UAP(fd);
219 1.21 christos SCARG(&ua, sb) = sgsbp = stackgap_alloc(p, &sg, sizeof(sb43));
220 1.24 thorpej rv = compat_43_sys_fstat(l, &ua, retval);
221 1.1 mrg
222 1.15 mrg error = copyin(sgsbp, &sb43, sizeof(sb43));
223 1.15 mrg if (error)
224 1.15 mrg return error;
225 1.15 mrg netbsd32_from_stat43(&sb43, &sb32);
226 1.39 dsl error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
227 1.15 mrg if (error)
228 1.15 mrg return error;
229 1.1 mrg
230 1.1 mrg return (rv);
231 1.1 mrg }
232 1.1 mrg
233 1.1 mrg int
234 1.24 thorpej compat_43_netbsd32_otruncate(l, v, retval)
235 1.24 thorpej struct lwp *l;
236 1.1 mrg void *v;
237 1.1 mrg register_t *retval;
238 1.1 mrg {
239 1.8 eeh struct compat_43_netbsd32_otruncate_args /* {
240 1.5 mrg syscallarg(const netbsd32_charp) path;
241 1.5 mrg syscallarg(netbsd32_long) length;
242 1.1 mrg } */ *uap = v;
243 1.1 mrg struct sys_truncate_args ua;
244 1.1 mrg
245 1.6 mrg NETBSD32TOP_UAP(path, const char);
246 1.6 mrg NETBSD32TO64_UAP(length);
247 1.24 thorpej return (sys_ftruncate(l, &ua, retval));
248 1.1 mrg }
249 1.1 mrg
250 1.1 mrg int
251 1.24 thorpej compat_43_netbsd32_oftruncate(l, v, retval)
252 1.24 thorpej struct lwp *l;
253 1.1 mrg void *v;
254 1.1 mrg register_t *retval;
255 1.1 mrg {
256 1.8 eeh struct compat_43_netbsd32_oftruncate_args /* {
257 1.1 mrg syscallarg(int) fd;
258 1.5 mrg syscallarg(netbsd32_long) length;
259 1.1 mrg } */ *uap = v;
260 1.1 mrg struct sys_ftruncate_args ua;
261 1.1 mrg
262 1.6 mrg NETBSD32TO64_UAP(fd);
263 1.6 mrg NETBSD32TO64_UAP(length);
264 1.24 thorpej return (sys_ftruncate(l, &ua, retval));
265 1.1 mrg }
266 1.1 mrg
267 1.1 mrg int
268 1.24 thorpej compat_43_netbsd32_ogetdirentries(l, v, retval)
269 1.24 thorpej struct lwp *l;
270 1.1 mrg void *v;
271 1.1 mrg register_t *retval;
272 1.1 mrg {
273 1.8 eeh struct compat_43_netbsd32_ogetdirentries_args /* {
274 1.1 mrg syscallarg(int) fd;
275 1.5 mrg syscallarg(netbsd32_charp) buf;
276 1.1 mrg syscallarg(u_int) count;
277 1.5 mrg syscallarg(netbsd32_longp) basep;
278 1.1 mrg } */ *uap = v;
279 1.1 mrg struct compat_43_sys_getdirentries_args ua;
280 1.1 mrg
281 1.6 mrg NETBSD32TO64_UAP(fd);
282 1.6 mrg NETBSD32TOP_UAP(buf, char);
283 1.6 mrg NETBSD32TO64_UAP(count);
284 1.6 mrg NETBSD32TOP_UAP(basep, long);
285 1.24 thorpej return (compat_43_sys_getdirentries(l, &ua, retval));
286 1.1 mrg }
287 1.1 mrg
288 1.1 mrg /* kernel syscalls */
289 1.1 mrg int
290 1.24 thorpej compat_43_netbsd32_ogetkerninfo(l, v, retval)
291 1.24 thorpej struct lwp *l;
292 1.1 mrg void *v;
293 1.1 mrg register_t *retval;
294 1.1 mrg {
295 1.8 eeh struct compat_43_netbsd32_ogetkerninfo_args /* {
296 1.1 mrg syscallarg(int) op;
297 1.5 mrg syscallarg(netbsd32_charp) where;
298 1.5 mrg syscallarg(netbsd32_intp) size;
299 1.1 mrg syscallarg(int) arg;
300 1.1 mrg } */ *uap = v;
301 1.1 mrg struct compat_43_sys_getkerninfo_args ua;
302 1.1 mrg
303 1.6 mrg NETBSD32TO64_UAP(op);
304 1.6 mrg NETBSD32TOP_UAP(where, char);
305 1.6 mrg NETBSD32TOP_UAP(size, int);
306 1.6 mrg NETBSD32TO64_UAP(arg);
307 1.24 thorpej return (compat_43_sys_getkerninfo(l, &ua, retval));
308 1.1 mrg }
309 1.1 mrg
310 1.1 mrg int
311 1.24 thorpej compat_43_netbsd32_ogethostname(l, v, retval)
312 1.24 thorpej struct lwp* l;
313 1.1 mrg void *v;
314 1.1 mrg register_t *retval;
315 1.1 mrg {
316 1.8 eeh struct compat_43_netbsd32_ogethostname_args /* {
317 1.5 mrg syscallarg(netbsd32_charp) hostname;
318 1.1 mrg syscallarg(u_int) len;
319 1.1 mrg } */ *uap = v;
320 1.29 atatat int name[2];
321 1.1 mrg size_t sz;
322 1.1 mrg
323 1.29 atatat name[0] = CTL_KERN;
324 1.29 atatat name[1] = KERN_HOSTNAME;
325 1.1 mrg sz = SCARG(uap, len);
326 1.29 atatat return (old_sysctl(&name[0], 2,
327 1.39 dsl SCARG_P32(uap, hostname), &sz, 0, 0, l));
328 1.1 mrg }
329 1.1 mrg
330 1.1 mrg int
331 1.24 thorpej compat_43_netbsd32_osethostname(l, v, retval)
332 1.24 thorpej struct lwp* l;
333 1.1 mrg void *v;
334 1.1 mrg register_t *retval;
335 1.1 mrg {
336 1.8 eeh struct compat_43_netbsd32_osethostname_args /* {
337 1.5 mrg syscallarg(netbsd32_charp) hostname;
338 1.1 mrg syscallarg(u_int) len;
339 1.1 mrg } */ *uap = v;
340 1.29 atatat int name[2];
341 1.1 mrg
342 1.29 atatat name[0] = CTL_KERN;
343 1.29 atatat name[1] = KERN_HOSTNAME;
344 1.39 dsl return old_sysctl(&name[0], 2, 0, 0, (char *)SCARG_P32(uap,
345 1.39 dsl hostname), SCARG(uap, len), l);
346 1.1 mrg }
347 1.1 mrg
348 1.1 mrg int
349 1.24 thorpej compat_43_netbsd32_sethostid(l, v, retval)
350 1.24 thorpej struct lwp* l;
351 1.4 eeh void *v;
352 1.4 eeh register_t *retval;
353 1.4 eeh {
354 1.8 eeh struct compat_43_netbsd32_sethostid_args /* {
355 1.4 eeh syscallarg(int32_t) hostid;
356 1.4 eeh } */ *uap = v;
357 1.4 eeh struct compat_43_sys_sethostid_args ua;
358 1.4 eeh
359 1.6 mrg NETBSD32TO64_UAP(hostid);
360 1.24 thorpej return (compat_43_sys_sethostid(l, &ua, retval));
361 1.4 eeh }
362 1.4 eeh
363 1.4 eeh int
364 1.24 thorpej compat_43_netbsd32_ogetrlimit(l, v, retval)
365 1.24 thorpej struct lwp* l;
366 1.1 mrg void *v;
367 1.1 mrg register_t *retval;
368 1.1 mrg {
369 1.8 eeh struct compat_43_netbsd32_ogetrlimit_args /* {
370 1.1 mrg syscallarg(int) which;
371 1.5 mrg syscallarg(netbsd32_orlimitp_t) rlp;
372 1.1 mrg } */ *uap = v;
373 1.1 mrg struct compat_43_sys_getrlimit_args ua;
374 1.1 mrg
375 1.6 mrg NETBSD32TO64_UAP(which);
376 1.6 mrg NETBSD32TOP_UAP(rlp, struct orlimit);
377 1.24 thorpej return (compat_43_sys_getrlimit(l, &ua, retval));
378 1.1 mrg }
379 1.1 mrg
380 1.1 mrg int
381 1.24 thorpej compat_43_netbsd32_osetrlimit(l, v, retval)
382 1.24 thorpej struct lwp* l;
383 1.1 mrg void *v;
384 1.1 mrg register_t *retval;
385 1.1 mrg {
386 1.8 eeh struct compat_43_netbsd32_osetrlimit_args /* {
387 1.1 mrg syscallarg(int) which;
388 1.5 mrg syscallarg(netbsd32_orlimitp_t) rlp;
389 1.1 mrg } */ *uap = v;
390 1.1 mrg struct compat_43_sys_setrlimit_args ua;
391 1.1 mrg
392 1.6 mrg NETBSD32TO64_UAP(which);
393 1.6 mrg NETBSD32TOP_UAP(rlp, struct orlimit);
394 1.24 thorpej return (compat_43_sys_setrlimit(l, &ua, retval));
395 1.1 mrg }
396 1.1 mrg
397 1.4 eeh int
398 1.24 thorpej compat_43_netbsd32_killpg(l, v, retval)
399 1.24 thorpej struct lwp* l;
400 1.4 eeh void *v;
401 1.4 eeh register_t *retval;
402 1.4 eeh {
403 1.8 eeh struct compat_43_netbsd32_killpg_args /* {
404 1.4 eeh syscallarg(int) pgid;
405 1.4 eeh syscallarg(int) signum;
406 1.4 eeh } */ *uap = v;
407 1.4 eeh struct compat_43_sys_killpg_args ua;
408 1.4 eeh
409 1.6 mrg NETBSD32TO64_UAP(pgid);
410 1.6 mrg NETBSD32TO64_UAP(signum);
411 1.24 thorpej return (compat_43_sys_killpg(l, &ua, retval));
412 1.4 eeh }
413 1.4 eeh
414 1.1 mrg /* virtual memory syscalls */
415 1.1 mrg int
416 1.24 thorpej compat_43_netbsd32_ommap(l, v, retval)
417 1.24 thorpej struct lwp* l;
418 1.1 mrg void *v;
419 1.1 mrg register_t *retval;
420 1.1 mrg {
421 1.8 eeh struct compat_43_netbsd32_ommap_args /* {
422 1.37 christos syscallarg(netbsd32_caddr_t) addr;
423 1.5 mrg syscallarg(netbsd32_size_t) len;
424 1.1 mrg syscallarg(int) prot;
425 1.1 mrg syscallarg(int) flags;
426 1.1 mrg syscallarg(int) fd;
427 1.5 mrg syscallarg(netbsd32_long) pos;
428 1.1 mrg } */ *uap = v;
429 1.1 mrg struct compat_43_sys_mmap_args ua;
430 1.1 mrg
431 1.38 dsl NETBSD32TOP_UAP(addr, void *);
432 1.6 mrg NETBSD32TOX_UAP(len, size_t);
433 1.6 mrg NETBSD32TO64_UAP(prot);
434 1.6 mrg NETBSD32TO64_UAP(flags);
435 1.6 mrg NETBSD32TO64_UAP(fd);
436 1.6 mrg NETBSD32TOX_UAP(pos, long);
437 1.24 thorpej return (compat_43_sys_mmap(l, &ua, retval));
438 1.4 eeh }
439 1.4 eeh
440 1.1 mrg /* network syscalls */
441 1.1 mrg int
442 1.24 thorpej compat_43_netbsd32_oaccept(l, v, retval)
443 1.24 thorpej struct lwp* l;
444 1.1 mrg void *v;
445 1.1 mrg register_t *retval;
446 1.1 mrg {
447 1.8 eeh struct compat_43_netbsd32_oaccept_args /* {
448 1.1 mrg syscallarg(int) s;
449 1.37 christos syscallarg(netbsd32_caddr_t) name;
450 1.5 mrg syscallarg(netbsd32_intp) anamelen;
451 1.1 mrg } */ *uap = v;
452 1.1 mrg struct compat_43_sys_accept_args ua;
453 1.1 mrg
454 1.6 mrg NETBSD32TOX_UAP(s, int);
455 1.38 dsl NETBSD32TOP_UAP(name, void *);
456 1.6 mrg NETBSD32TOP_UAP(anamelen, int);
457 1.24 thorpej return (compat_43_sys_accept(l, &ua, retval));
458 1.1 mrg }
459 1.1 mrg
460 1.1 mrg int
461 1.24 thorpej compat_43_netbsd32_osend(l, v, retval)
462 1.24 thorpej struct lwp* l;
463 1.1 mrg void *v;
464 1.1 mrg register_t *retval;
465 1.1 mrg {
466 1.8 eeh struct compat_43_netbsd32_osend_args /* {
467 1.1 mrg syscallarg(int) s;
468 1.37 christos syscallarg(netbsd32_caddr_t) buf;
469 1.1 mrg syscallarg(int) len;
470 1.1 mrg syscallarg(int) flags;
471 1.1 mrg } */ *uap = v;
472 1.1 mrg struct compat_43_sys_send_args ua;
473 1.1 mrg
474 1.6 mrg NETBSD32TO64_UAP(s);
475 1.38 dsl NETBSD32TOP_UAP(buf, void *);
476 1.6 mrg NETBSD32TO64_UAP(len);
477 1.6 mrg NETBSD32TO64_UAP(flags);
478 1.24 thorpej return (compat_43_sys_send(l, &ua, retval));
479 1.1 mrg }
480 1.1 mrg
481 1.1 mrg int
482 1.24 thorpej compat_43_netbsd32_orecv(l, v, retval)
483 1.24 thorpej struct lwp* l;
484 1.1 mrg void *v;
485 1.1 mrg register_t *retval;
486 1.1 mrg {
487 1.8 eeh struct compat_43_netbsd32_orecv_args /* {
488 1.1 mrg syscallarg(int) s;
489 1.37 christos syscallarg(netbsd32_caddr_t) buf;
490 1.1 mrg syscallarg(int) len;
491 1.1 mrg syscallarg(int) flags;
492 1.1 mrg } */ *uap = v;
493 1.1 mrg struct compat_43_sys_recv_args ua;
494 1.1 mrg
495 1.6 mrg NETBSD32TO64_UAP(s);
496 1.38 dsl NETBSD32TOP_UAP(buf, void *);
497 1.6 mrg NETBSD32TO64_UAP(len);
498 1.6 mrg NETBSD32TO64_UAP(flags);
499 1.24 thorpej return (compat_43_sys_recv(l, &ua, retval));
500 1.1 mrg }
501 1.1 mrg
502 1.1 mrg /*
503 1.1 mrg * XXX convert these to use a common iovec code to the native
504 1.1 mrg * netbsd call.
505 1.1 mrg */
506 1.1 mrg int
507 1.24 thorpej compat_43_netbsd32_orecvmsg(l, v, retval)
508 1.24 thorpej struct lwp* l;
509 1.1 mrg void *v;
510 1.1 mrg register_t *retval;
511 1.1 mrg {
512 1.24 thorpej struct proc *p = l->l_proc;
513 1.8 eeh struct compat_43_netbsd32_orecvmsg_args /* {
514 1.1 mrg syscallarg(int) s;
515 1.5 mrg syscallarg(netbsd32_omsghdrp_t) msg;
516 1.1 mrg syscallarg(int) flags;
517 1.1 mrg } */ *uap = v;
518 1.1 mrg struct compat_43_sys_recvmsg_args ua;
519 1.16 mrg struct omsghdr omh, *sgsbp;
520 1.16 mrg struct netbsd32_omsghdr omh32;
521 1.16 mrg struct iovec iov, *sgsbp2;
522 1.16 mrg struct netbsd32_iovec iov32, *iovec32p;
523 1.36 christos void *sg = stackgap_init(p, 0);
524 1.16 mrg int i, error, rv;
525 1.1 mrg
526 1.6 mrg NETBSD32TO64_UAP(s);
527 1.6 mrg NETBSD32TO64_UAP(flags);
528 1.1 mrg
529 1.16 mrg /*
530 1.16 mrg * this is annoying:
531 1.16 mrg * - copyin the msghdr32 struct
532 1.16 mrg * - stackgap_alloc a msghdr struct
533 1.16 mrg * - convert msghdr32 to msghdr:
534 1.16 mrg * - stackgap_alloc enough space for iovec's
535 1.16 mrg * - copy in each iov32, and convert to iov
536 1.16 mrg * - copyout converted iov
537 1.16 mrg * - copyout converted msghdr
538 1.16 mrg * - do real syscall
539 1.16 mrg * - copyin the msghdr struct
540 1.16 mrg * - convert msghdr to msghdr32
541 1.16 mrg * - copyin each iov and convert to iov32
542 1.16 mrg * - copyout converted iov32
543 1.16 mrg * - copyout converted msghdr32
544 1.16 mrg */
545 1.39 dsl error = copyin(SCARG_P32(uap, msg), &omh32, sizeof(omh32));
546 1.16 mrg if (error)
547 1.16 mrg return (error);
548 1.16 mrg
549 1.21 christos SCARG(&ua, msg) = sgsbp = stackgap_alloc(p, &sg, sizeof(omh));
550 1.36 christos omh.msg_name = (void *)NETBSD32PTR64(omh32.msg_name);
551 1.16 mrg omh.msg_namelen = omh32.msg_namelen;
552 1.16 mrg omh.msg_iovlen = (size_t)omh32.msg_iovlen;
553 1.21 christos omh.msg_iov = sgsbp2 = stackgap_alloc(p, &sg, sizeof(struct iovec) * omh.msg_iovlen);
554 1.23 scw iovec32p = (struct netbsd32_iovec *)NETBSD32PTR64(omh32.msg_iov);
555 1.16 mrg for (i = 0; i < omh.msg_iovlen; i++, sgsbp2++, iovec32p++) {
556 1.16 mrg error = copyin(iovec32p, &iov32, sizeof(iov32));
557 1.16 mrg if (error)
558 1.16 mrg return (error);
559 1.23 scw iov.iov_base =
560 1.23 scw (struct iovec *)NETBSD32PTR64(iovec32p->iov_base);
561 1.16 mrg iov.iov_len = (size_t)iovec32p->iov_len;
562 1.16 mrg error = copyout(&iov, sgsbp2, sizeof(iov));
563 1.16 mrg if (error)
564 1.16 mrg return (error);
565 1.1 mrg }
566 1.36 christos omh.msg_accrights = (void *)NETBSD32PTR64(omh32.msg_accrights);
567 1.16 mrg omh.msg_accrightslen = omh32.msg_accrightslen;
568 1.16 mrg error = copyout(&omh, sgsbp, sizeof(omh));
569 1.16 mrg if (error)
570 1.16 mrg return (error);
571 1.1 mrg
572 1.24 thorpej rv = compat_43_sys_recvmsg(l, &ua, retval);
573 1.1 mrg
574 1.16 mrg error = copyin(sgsbp, &omh, sizeof(omh));
575 1.16 mrg if (error)
576 1.16 mrg return error;
577 1.38 dsl NETBSD32PTR32(omh32.msg_name, omh.msg_name);
578 1.16 mrg omh32.msg_namelen = omh.msg_namelen;
579 1.16 mrg omh32.msg_iovlen = (netbsd32_size_t)omh.msg_iovlen;
580 1.38 dsl iovec32p = NETBSD32PTR64(omh32.msg_iov);
581 1.16 mrg sgsbp2 = omh.msg_iov;
582 1.16 mrg for (i = 0; i < omh.msg_iovlen; i++, sgsbp2++, iovec32p++) {
583 1.16 mrg error = copyin(sgsbp2, &iov, sizeof(iov));
584 1.16 mrg if (error)
585 1.16 mrg return (error);
586 1.38 dsl NETBSD32PTR32(iov32.iov_base, iov.iov_base);
587 1.16 mrg iov32.iov_len = (netbsd32_size_t)iov.iov_len;
588 1.16 mrg error = copyout(&iov32, iovec32p, sizeof(iov32));
589 1.16 mrg if (error)
590 1.16 mrg return (error);
591 1.16 mrg }
592 1.38 dsl NETBSD32PTR32(omh32.msg_accrights, omh.msg_accrights);
593 1.16 mrg omh32.msg_accrightslen = omh.msg_accrightslen;
594 1.16 mrg
595 1.39 dsl error = copyout(&omh32, SCARG_P32(uap, msg), sizeof(omh32));
596 1.16 mrg if (error)
597 1.16 mrg return error;
598 1.16 mrg
599 1.16 mrg return (rv);
600 1.1 mrg }
601 1.1 mrg
602 1.1 mrg int
603 1.24 thorpej compat_43_netbsd32_osendmsg(l, v, retval)
604 1.24 thorpej struct lwp* l;
605 1.1 mrg void *v;
606 1.1 mrg register_t *retval;
607 1.1 mrg {
608 1.24 thorpej struct proc *p = l->l_proc;
609 1.8 eeh struct compat_43_netbsd32_osendmsg_args /* {
610 1.1 mrg syscallarg(int) s;
611 1.37 christos syscallarg(netbsd32_caddr_t) msg;
612 1.1 mrg syscallarg(int) flags;
613 1.1 mrg } */ *uap = v;
614 1.16 mrg struct compat_43_sys_recvmsg_args ua;
615 1.16 mrg struct omsghdr omh, *sgsbp;
616 1.16 mrg struct netbsd32_omsghdr omh32;
617 1.16 mrg struct iovec iov, *sgsbp2;
618 1.16 mrg struct netbsd32_iovec iov32, *iovec32p;
619 1.36 christos void *sg = stackgap_init(p, 0);
620 1.16 mrg int i, error, rv;
621 1.1 mrg
622 1.6 mrg NETBSD32TO64_UAP(s);
623 1.6 mrg NETBSD32TO64_UAP(flags);
624 1.1 mrg
625 1.16 mrg /*
626 1.16 mrg * this is annoying:
627 1.16 mrg * - copyin the msghdr32 struct
628 1.16 mrg * - stackgap_alloc a msghdr struct
629 1.16 mrg * - convert msghdr32 to msghdr:
630 1.16 mrg * - stackgap_alloc enough space for iovec's
631 1.16 mrg * - copy in each iov32, and convert to iov
632 1.16 mrg * - copyout converted iov
633 1.16 mrg * - copyout converted msghdr
634 1.16 mrg * - do real syscall
635 1.16 mrg * - copyin the msghdr struct
636 1.16 mrg * - convert msghdr to msghdr32
637 1.16 mrg * - copyin each iov and convert to iov32
638 1.16 mrg * - copyout converted iov32
639 1.16 mrg * - copyout converted msghdr32
640 1.16 mrg */
641 1.39 dsl error = copyin(SCARG_P32(uap, msg), &omh32, sizeof(omh32));
642 1.16 mrg if (error)
643 1.16 mrg return (error);
644 1.16 mrg
645 1.21 christos SCARG(&ua, msg) = sgsbp = stackgap_alloc(p, &sg, sizeof(omh));
646 1.38 dsl omh.msg_name = NETBSD32PTR64(omh32.msg_name);
647 1.16 mrg omh.msg_namelen = omh32.msg_namelen;
648 1.16 mrg omh.msg_iovlen = (size_t)omh32.msg_iovlen;
649 1.21 christos omh.msg_iov = sgsbp2 = stackgap_alloc(p, &sg, sizeof(struct iovec) * omh.msg_iovlen);
650 1.38 dsl iovec32p = NETBSD32PTR64(omh32.msg_iov);
651 1.16 mrg for (i = 0; i < omh.msg_iovlen; i++, sgsbp2++, iovec32p++) {
652 1.16 mrg error = copyin(iovec32p, &iov32, sizeof(iov32));
653 1.16 mrg if (error)
654 1.16 mrg return (error);
655 1.38 dsl iov.iov_base = NETBSD32PTR64(iovec32p->iov_base);
656 1.16 mrg iov.iov_len = (size_t)iovec32p->iov_len;
657 1.16 mrg error = copyout(&iov, sgsbp2, sizeof(iov));
658 1.16 mrg if (error)
659 1.16 mrg return (error);
660 1.1 mrg }
661 1.38 dsl omh.msg_accrights = NETBSD32PTR64(omh32.msg_accrights);
662 1.16 mrg omh.msg_accrightslen = omh32.msg_accrightslen;
663 1.16 mrg error = copyout(&omh, sgsbp, sizeof(omh));
664 1.16 mrg if (error)
665 1.16 mrg return (error);
666 1.1 mrg
667 1.24 thorpej rv = compat_43_sys_sendmsg(l, &ua, retval);
668 1.1 mrg
669 1.16 mrg error = copyin(sgsbp, &omh, sizeof(omh));
670 1.16 mrg if (error)
671 1.16 mrg return error;
672 1.38 dsl NETBSD32PTR32(omh32.msg_name, omh.msg_name);
673 1.16 mrg omh32.msg_namelen = omh.msg_namelen;
674 1.16 mrg omh32.msg_iovlen = (netbsd32_size_t)omh.msg_iovlen;
675 1.38 dsl iovec32p = NETBSD32PTR64(omh32.msg_iov);
676 1.16 mrg sgsbp2 = omh.msg_iov;
677 1.16 mrg for (i = 0; i < omh.msg_iovlen; i++, sgsbp2++, iovec32p++) {
678 1.16 mrg error = copyin(sgsbp2, &iov, sizeof(iov));
679 1.16 mrg if (error)
680 1.16 mrg return (error);
681 1.38 dsl NETBSD32PTR32(iov32.iov_base, iov.iov_base);
682 1.16 mrg iov32.iov_len = (netbsd32_size_t)iov.iov_len;
683 1.16 mrg error = copyout(&iov32, iovec32p, sizeof(iov32));
684 1.16 mrg if (error)
685 1.16 mrg return (error);
686 1.16 mrg }
687 1.38 dsl NETBSD32PTR32(omh32.msg_accrights, omh.msg_accrights);
688 1.16 mrg omh32.msg_accrightslen = omh.msg_accrightslen;
689 1.16 mrg
690 1.39 dsl error = copyout(&omh32, SCARG_P32(uap, msg), sizeof(omh32));
691 1.16 mrg if (error)
692 1.16 mrg return error;
693 1.16 mrg
694 1.16 mrg return (rv);
695 1.1 mrg }
696 1.1 mrg
697 1.1 mrg int
698 1.24 thorpej compat_43_netbsd32_orecvfrom(l, v, retval)
699 1.24 thorpej struct lwp* l;
700 1.1 mrg void *v;
701 1.1 mrg register_t *retval;
702 1.1 mrg {
703 1.8 eeh struct compat_43_netbsd32_orecvfrom_args /* {
704 1.1 mrg syscallarg(int) s;
705 1.37 christos syscallarg(netbsd32_caddr_t) buf;
706 1.5 mrg syscallarg(netbsd32_size_t) len;
707 1.1 mrg syscallarg(int) flags;
708 1.37 christos syscallarg(netbsd32_caddr_t) from;
709 1.5 mrg syscallarg(netbsd32_intp) fromlenaddr;
710 1.1 mrg } */ *uap = v;
711 1.1 mrg struct compat_43_sys_recvfrom_args ua;
712 1.1 mrg
713 1.6 mrg NETBSD32TO64_UAP(s);
714 1.38 dsl NETBSD32TOP_UAP(buf, void *);
715 1.6 mrg NETBSD32TOX_UAP(len, size_t);
716 1.6 mrg NETBSD32TO64_UAP(flags);
717 1.38 dsl NETBSD32TOP_UAP(from, void *);
718 1.6 mrg NETBSD32TOP_UAP(fromlenaddr, int);
719 1.24 thorpej return (compat_43_sys_recvfrom(l, &ua, retval));
720 1.1 mrg }
721 1.1 mrg
722 1.1 mrg int
723 1.24 thorpej compat_43_netbsd32_ogetsockname(l, v, retval)
724 1.24 thorpej struct lwp* l;
725 1.1 mrg void *v;
726 1.1 mrg register_t *retval;
727 1.1 mrg {
728 1.8 eeh struct compat_43_netbsd32_ogetsockname_args /* {
729 1.1 mrg syscallarg(int) fdec;
730 1.37 christos syscallarg(netbsd32_caddr_t) asa;
731 1.5 mrg syscallarg(netbsd32_intp) alen;
732 1.1 mrg } */ *uap = v;
733 1.1 mrg struct compat_43_sys_getsockname_args ua;
734 1.1 mrg
735 1.6 mrg NETBSD32TO64_UAP(fdec);
736 1.38 dsl NETBSD32TOP_UAP(asa, void *);
737 1.38 dsl NETBSD32TOP_UAP(alen, int *);
738 1.24 thorpej return (compat_43_sys_getsockname(l, &ua, retval));
739 1.1 mrg }
740 1.1 mrg
741 1.1 mrg int
742 1.24 thorpej compat_43_netbsd32_ogetpeername(l, v, retval)
743 1.24 thorpej struct lwp* l;
744 1.1 mrg void *v;
745 1.1 mrg register_t *retval;
746 1.1 mrg {
747 1.8 eeh struct compat_43_netbsd32_ogetpeername_args /* {
748 1.1 mrg syscallarg(int) fdes;
749 1.37 christos syscallarg(netbsd32_caddr_t) asa;
750 1.5 mrg syscallarg(netbsd32_intp) alen;
751 1.1 mrg } */ *uap = v;
752 1.1 mrg struct compat_43_sys_getpeername_args ua;
753 1.1 mrg
754 1.6 mrg NETBSD32TO64_UAP(fdes);
755 1.38 dsl NETBSD32TOP_UAP(asa, void *);
756 1.38 dsl NETBSD32TOP_UAP(alen, int *);
757 1.24 thorpej return (compat_43_sys_getpeername(l, &ua, retval));
758 1.1 mrg }
759 1.1 mrg
760 1.1 mrg /* signal syscalls */
761 1.1 mrg int
762 1.24 thorpej compat_43_netbsd32_osigvec(l, v, retval)
763 1.24 thorpej struct lwp* l;
764 1.1 mrg void *v;
765 1.1 mrg register_t *retval;
766 1.1 mrg {
767 1.24 thorpej struct proc *p = l->l_proc;
768 1.8 eeh struct compat_43_netbsd32_osigvec_args /* {
769 1.1 mrg syscallarg(int) signum;
770 1.5 mrg syscallarg(netbsd32_sigvecp_t) nsv;
771 1.5 mrg syscallarg(netbsd32_sigvecp_t) osv;
772 1.1 mrg } */ *uap = v;
773 1.1 mrg struct compat_43_sys_sigvec_args ua;
774 1.16 mrg struct netbsd32_sigvec sv32;
775 1.28 christos struct sigvec sv;
776 1.36 christos void *sg = stackgap_init(p, 0);
777 1.16 mrg int rv, error;
778 1.1 mrg
779 1.6 mrg NETBSD32TO64_UAP(signum);
780 1.39 dsl if (SCARG_P32(uap, osv))
781 1.28 christos SCARG(&ua, osv) = stackgap_alloc(p, &sg, sizeof(sv));
782 1.1 mrg else
783 1.1 mrg SCARG(&ua, osv) = NULL;
784 1.39 dsl if (SCARG_P32(uap, nsv)) {
785 1.28 christos SCARG(&ua, nsv) = stackgap_alloc(p, &sg, sizeof(sv));
786 1.39 dsl error = copyin(SCARG_P32(uap, nsv), &sv32, sizeof(sv32));
787 1.16 mrg if (error)
788 1.16 mrg return (error);
789 1.23 scw sv.sv_handler = (void *)NETBSD32PTR64(sv32.sv_handler);
790 1.16 mrg sv.sv_mask = sv32.sv_mask;
791 1.16 mrg sv.sv_flags = sv32.sv_flags;
792 1.28 christos error = copyout(&sv, SCARG(&ua, nsv), sizeof(sv));
793 1.16 mrg if (error)
794 1.16 mrg return (error);
795 1.1 mrg } else
796 1.1 mrg SCARG(&ua, nsv) = NULL;
797 1.24 thorpej rv = compat_43_sys_sigvec(l, &ua, retval);
798 1.1 mrg if (rv)
799 1.1 mrg return (rv);
800 1.1 mrg
801 1.39 dsl if (SCARG_P32(uap, osv)) {
802 1.28 christos error = copyin(SCARG(&ua, osv), &sv, sizeof(sv));
803 1.16 mrg if (error)
804 1.16 mrg return (error);
805 1.38 dsl NETBSD32PTR32(sv32.sv_handler, sv.sv_handler);
806 1.16 mrg sv32.sv_mask = sv.sv_mask;
807 1.16 mrg sv32.sv_flags = sv.sv_flags;
808 1.39 dsl error = copyout(&sv32, SCARG_P32(uap, osv), sizeof(sv32));
809 1.16 mrg if (error)
810 1.16 mrg return (error);
811 1.1 mrg }
812 1.1 mrg
813 1.1 mrg return (0);
814 1.4 eeh }
815 1.4 eeh
816 1.4 eeh int
817 1.24 thorpej compat_43_netbsd32_sigblock(l, v, retval)
818 1.24 thorpej struct lwp* l;
819 1.4 eeh void *v;
820 1.4 eeh register_t *retval;
821 1.4 eeh {
822 1.8 eeh struct compat_43_netbsd32_sigblock_args /* {
823 1.4 eeh syscallarg(int) mask;
824 1.4 eeh } */ *uap = v;
825 1.4 eeh struct compat_43_sys_sigblock_args ua;
826 1.4 eeh
827 1.6 mrg NETBSD32TO64_UAP(mask);
828 1.24 thorpej return (compat_43_sys_sigblock(l, &ua, retval));
829 1.4 eeh }
830 1.4 eeh
831 1.4 eeh int
832 1.24 thorpej compat_43_netbsd32_sigsetmask(l, v, retval)
833 1.24 thorpej struct lwp* l;
834 1.4 eeh void *v;
835 1.4 eeh register_t *retval;
836 1.4 eeh {
837 1.8 eeh struct compat_43_netbsd32_sigsetmask_args /* {
838 1.4 eeh syscallarg(int) mask;
839 1.4 eeh } */ *uap = v;
840 1.4 eeh struct compat_43_sys_sigsetmask_args ua;
841 1.4 eeh
842 1.6 mrg NETBSD32TO64_UAP(mask);
843 1.24 thorpej return (compat_43_sys_sigsetmask(l, &ua, retval));
844 1.1 mrg }
845 1.1 mrg
846 1.1 mrg int
847 1.24 thorpej compat_43_netbsd32_osigstack(l, v, retval)
848 1.24 thorpej struct lwp* l;
849 1.1 mrg void *v;
850 1.1 mrg register_t *retval;
851 1.1 mrg {
852 1.24 thorpej struct proc *p = l->l_proc;
853 1.8 eeh struct compat_43_netbsd32_osigstack_args /* {
854 1.5 mrg syscallarg(netbsd32_sigstackp_t) nss;
855 1.5 mrg syscallarg(netbsd32_sigstackp_t) oss;
856 1.1 mrg } */ *uap = v;
857 1.1 mrg struct compat_43_sys_sigstack_args ua;
858 1.16 mrg struct netbsd32_sigstack ss32;
859 1.28 christos struct sigstack ss;
860 1.36 christos void *sg = stackgap_init(p, 0);
861 1.16 mrg int error, rv;
862 1.1 mrg
863 1.39 dsl if (SCARG_P32(uap, oss))
864 1.28 christos SCARG(&ua, oss) = stackgap_alloc(p, &sg, sizeof(ss));
865 1.1 mrg else
866 1.1 mrg SCARG(&ua, oss) = NULL;
867 1.39 dsl if (SCARG_P32(uap, nss)) {
868 1.28 christos SCARG(&ua, nss) = stackgap_alloc(p, &sg, sizeof(ss));
869 1.39 dsl error = copyin(SCARG_P32(uap, nss), &ss32, sizeof(ss32));
870 1.16 mrg if (error)
871 1.16 mrg return (error);
872 1.38 dsl ss.ss_sp = NETBSD32PTR64(ss32.ss_sp);
873 1.16 mrg ss.ss_onstack = ss32.ss_onstack;
874 1.28 christos error = copyout(&ss, SCARG(&ua, nss), sizeof(ss));
875 1.16 mrg if (error)
876 1.16 mrg return (error);
877 1.1 mrg } else
878 1.1 mrg SCARG(&ua, nss) = NULL;
879 1.1 mrg
880 1.24 thorpej rv = compat_43_sys_sigstack(l, &ua, retval);
881 1.1 mrg if (rv)
882 1.1 mrg return (rv);
883 1.1 mrg
884 1.39 dsl if (SCARG_P32(uap, oss)) {
885 1.28 christos error = copyin(SCARG(&ua, oss), &ss, sizeof(ss));
886 1.16 mrg if (error)
887 1.16 mrg return (error);
888 1.38 dsl NETBSD32PTR32(ss32.ss_sp, ss.ss_sp);
889 1.16 mrg ss32.ss_onstack = ss.ss_onstack;
890 1.39 dsl error = copyout(&ss32, SCARG_P32(uap, oss), sizeof(ss32));
891 1.16 mrg if (error)
892 1.16 mrg return (error);
893 1.1 mrg }
894 1.1 mrg
895 1.1 mrg return (0);
896 1.1 mrg }
897