1 /* $NetBSD: netbsd32_compat_43.c,v 1.50 2008/05/29 14:51:26 mrg Exp $ */
4 * Copyright (c) 1998, 2001 Matthew R. Green
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.50 2008/05/29 14:51:26 mrg Exp $");
32 #if defined(_KERNEL_OPT)
33 #include "opt_compat_43.h"
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/fcntl.h>
39 #include <sys/filedesc.h>
40 #include <sys/malloc.h>
42 #include <sys/mount.h>
43 #include <sys/namei.h>
44 #include <sys/socket.h>
46 #include <sys/socket.h>
47 #include <sys/socketvar.h>
49 #include <sys/syscallargs.h>
51 #include <sys/ucred.h>
52 #include <sys/vfs_syscalls.h>
53 #include <uvm/uvm_extern.h>
54 #include <sys/sysctl.h>
57 #include <compat/netbsd32/netbsd32.h>
58 #include <compat/netbsd32/netbsd32_syscallargs.h>
60 #include <compat/sys/stat.h>
61 #include <compat/sys/signal.h>
62 #include <compat/sys/signalvar.h>
63 #include <compat/sys/socket.h>
65 #define SYS_DEF(foo) struct foo##_args; \
66 int foo(struct lwp *, const struct foo##_args *, register_t *)
68 SYS_DEF(compat_43_netbsd32_sethostid
);
69 SYS_DEF(compat_43_netbsd32_killpg
);
70 SYS_DEF(compat_43_netbsd32_sigblock
);
71 SYS_DEF(compat_43_netbsd32_sigblock
);
72 SYS_DEF(compat_43_netbsd32_sigsetmask
);
76 netbsd32_from_stat(const struct stat
*sb
, struct netbsd32_stat43
*sp32
)
79 sp32
->st_dev
= sb
->st_dev
;
80 sp32
->st_ino
= sb
->st_ino
;
81 sp32
->st_mode
= sb
->st_mode
;
82 sp32
->st_nlink
= sb
->st_nlink
;
83 sp32
->st_uid
= sb
->st_uid
;
84 sp32
->st_gid
= sb
->st_gid
;
85 sp32
->st_rdev
= sb
->st_rdev
;
86 sp32
->st_size
= sb
->st_size
< (quad_t
)1 << 32 ? sb
->st_size
: -2;
87 sp32
->st_atimespec
.tv_sec
= sb
->st_atimespec
.tv_sec
;
88 sp32
->st_atimespec
.tv_nsec
= sb
->st_atimespec
.tv_nsec
;
89 sp32
->st_mtimespec
.tv_sec
= sb
->st_mtimespec
.tv_sec
;
90 sp32
->st_mtimespec
.tv_nsec
= sb
->st_mtimespec
.tv_nsec
;
91 sp32
->st_ctimespec
.tv_sec
= sb
->st_ctimespec
.tv_sec
;
92 sp32
->st_ctimespec
.tv_nsec
= sb
->st_ctimespec
.tv_nsec
;
93 sp32
->st_blksize
= sb
->st_blksize
;
94 sp32
->st_blocks
= sb
->st_blocks
;
95 sp32
->st_flags
= sb
->st_flags
;
96 sp32
->st_gen
= sb
->st_gen
;
99 /* file system syscalls */
101 compat_43_netbsd32_ocreat(struct lwp
*l
, const struct compat_43_netbsd32_ocreat_args
*uap
, register_t
*retval
)
104 syscallarg(const netbsd32_charp) path;
105 syscallarg(mode_t) mode;
107 struct sys_open_args ua
;
109 NETBSD32TOP_UAP(path
, const char);
110 NETBSD32TO64_UAP(mode
);
111 SCARG(&ua
, flags
) = O_WRONLY
| O_CREAT
| O_TRUNC
;
113 return (sys_open(l
, &ua
, retval
));
117 compat_43_netbsd32_olseek(struct lwp
*l
, const struct compat_43_netbsd32_olseek_args
*uap
, register_t
*retval
)
121 syscallarg(netbsd32_long) offset;
122 syscallarg(int) whence;
124 struct sys_lseek_args ua
;
126 SCARG(&ua
, fd
) = SCARG(uap
, fd
);
127 NETBSD32TOX_UAP(offset
, long);
128 NETBSD32TO64_UAP(whence
);
129 /* Maybe offsets > 2^32 should generate an error ? */
130 return sys_lseek(l
, &ua
, retval
);
134 compat_43_netbsd32_stat43(struct lwp
*l
, const struct compat_43_netbsd32_stat43_args
*uap
, register_t
*retval
)
137 syscallarg(const netbsd32_charp) path;
138 syscallarg(netbsd32_stat43p_t) ub;
141 struct netbsd32_stat43 sb32
;
144 error
= do_sys_stat(SCARG_P32(uap
, path
), FOLLOW
, &sb
);
146 netbsd32_from_stat(&sb
, &sb32
);
147 error
= copyout(&sb32
, SCARG_P32(uap
, ub
), sizeof(sb32
));
153 compat_43_netbsd32_lstat43(struct lwp
*l
, const struct compat_43_netbsd32_lstat43_args
*uap
, register_t
*retval
)
156 syscallarg(const netbsd32_charp) path;
157 syscallarg(netbsd32_stat43p_t) ub;
160 struct netbsd32_stat43 sb32
;
163 error
= do_sys_stat(SCARG_P32(uap
, path
), NOFOLLOW
, &sb
);
165 netbsd32_from_stat(&sb
, &sb32
);
166 error
= copyout(&sb32
, SCARG_P32(uap
, ub
), sizeof(sb32
));
172 compat_43_netbsd32_fstat43(struct lwp
*l
, const struct compat_43_netbsd32_fstat43_args
*uap
, register_t
*retval
)
176 syscallarg(netbsd32_stat43p_t) sb;
179 struct netbsd32_stat43 sb32
;
182 error
= do_sys_fstat(SCARG(uap
, fd
), &sb
);
184 netbsd32_from_stat(&sb
, &sb32
);
185 error
= copyout(&sb32
, SCARG_P32(uap
, sb
), sizeof(sb32
));
191 compat_43_netbsd32_otruncate(struct lwp
*l
, const struct compat_43_netbsd32_otruncate_args
*uap
, register_t
*retval
)
194 syscallarg(const netbsd32_charp) path;
195 syscallarg(netbsd32_long) length;
197 struct sys_truncate_args ua
;
199 NETBSD32TOP_UAP(path
, const char);
200 NETBSD32TO64_UAP(length
);
201 return (sys_truncate(l
, &ua
, retval
));
205 compat_43_netbsd32_oftruncate(struct lwp
*l
, const struct compat_43_netbsd32_oftruncate_args
*uap
, register_t
*retval
)
209 syscallarg(netbsd32_long) length;
211 struct sys_ftruncate_args ua
;
213 NETBSD32TO64_UAP(fd
);
214 NETBSD32TO64_UAP(length
);
215 return (sys_ftruncate(l
, &ua
, retval
));
219 compat_43_netbsd32_ogetdirentries(struct lwp
*l
, const struct compat_43_netbsd32_ogetdirentries_args
*uap
, register_t
*retval
)
223 syscallarg(netbsd32_charp) buf;
224 syscallarg(u_int) count;
225 syscallarg(netbsd32_longp) basep;
227 struct compat_43_sys_getdirentries_args ua
;
229 NETBSD32TO64_UAP(fd
);
230 NETBSD32TOP_UAP(buf
, char);
231 NETBSD32TO64_UAP(count
);
232 NETBSD32TOP_UAP(basep
, long);
233 return (compat_43_sys_getdirentries(l
, &ua
, retval
));
236 /* kernel syscalls */
238 compat_43_netbsd32_ogetkerninfo(struct lwp
*l
, const struct compat_43_netbsd32_ogetkerninfo_args
*uap
, register_t
*retval
)
242 syscallarg(netbsd32_charp) where;
243 syscallarg(netbsd32_intp) size;
246 struct compat_43_sys_getkerninfo_args ua
;
248 NETBSD32TO64_UAP(op
);
249 NETBSD32TOP_UAP(where
, char);
250 NETBSD32TOP_UAP(size
, int);
251 NETBSD32TO64_UAP(arg
);
252 return (compat_43_sys_getkerninfo(l
, &ua
, retval
));
256 compat_43_netbsd32_ogethostname(struct lwp
*l
, const struct compat_43_netbsd32_ogethostname_args
*uap
, register_t
*retval
)
259 syscallarg(netbsd32_charp) hostname;
260 syscallarg(u_int) len;
266 name
[1] = KERN_HOSTNAME
;
267 sz
= SCARG(uap
, len
);
268 return (old_sysctl(&name
[0], 2,
269 SCARG_P32(uap
, hostname
), &sz
, 0, 0, l
));
273 compat_43_netbsd32_osethostname(struct lwp
*l
, const struct compat_43_netbsd32_osethostname_args
*uap
, register_t
*retval
)
276 syscallarg(netbsd32_charp) hostname;
277 syscallarg(u_int) len;
282 name
[1] = KERN_HOSTNAME
;
283 return old_sysctl(&name
[0], 2, 0, 0, (char *)SCARG_P32(uap
,
284 hostname
), SCARG(uap
, len
), l
);
288 compat_43_netbsd32_sethostid(struct lwp
*l
, const struct compat_43_netbsd32_sethostid_args
*uap
, register_t
*retval
)
291 syscallarg(int32_t) hostid;
293 struct compat_43_sys_sethostid_args ua
;
295 NETBSD32TO64_UAP(hostid
);
296 return (compat_43_sys_sethostid(l
, &ua
, retval
));
300 compat_43_netbsd32_ogetrlimit(struct lwp
*l
, const struct compat_43_netbsd32_ogetrlimit_args
*uap
, register_t
*retval
)
303 syscallarg(int) which;
304 syscallarg(netbsd32_orlimitp_t) rlp;
306 struct compat_43_sys_getrlimit_args ua
;
308 NETBSD32TO64_UAP(which
);
309 NETBSD32TOP_UAP(rlp
, struct orlimit
);
310 return (compat_43_sys_getrlimit(l
, &ua
, retval
));
314 compat_43_netbsd32_osetrlimit(struct lwp
*l
, const struct compat_43_netbsd32_osetrlimit_args
*uap
, register_t
*retval
)
317 syscallarg(int) which;
318 syscallarg(netbsd32_orlimitp_t) rlp;
320 struct compat_43_sys_setrlimit_args ua
;
322 NETBSD32TO64_UAP(which
);
323 NETBSD32TOP_UAP(rlp
, struct orlimit
);
324 return (compat_43_sys_setrlimit(l
, &ua
, retval
));
328 compat_43_netbsd32_killpg(struct lwp
*l
, const struct compat_43_netbsd32_killpg_args
*uap
, register_t
*retval
)
331 syscallarg(int) pgid;
332 syscallarg(int) signum;
334 struct compat_43_sys_killpg_args ua
;
336 NETBSD32TO64_UAP(pgid
);
337 NETBSD32TO64_UAP(signum
);
338 return (compat_43_sys_killpg(l
, &ua
, retval
));
341 /* virtual memory syscalls */
343 compat_43_netbsd32_ommap(struct lwp
*l
, const struct compat_43_netbsd32_ommap_args
*uap
, register_t
*retval
)
346 syscallarg(netbsd32_voidp) addr;
347 syscallarg(netbsd32_size_t) len;
348 syscallarg(int) prot;
349 syscallarg(int) flags;
351 syscallarg(netbsd32_long) pos;
353 struct compat_43_sys_mmap_args ua
;
355 NETBSD32TOP_UAP(addr
, void *);
356 NETBSD32TOX_UAP(len
, size_t);
357 NETBSD32TO64_UAP(prot
);
358 NETBSD32TO64_UAP(flags
);
359 NETBSD32TO64_UAP(fd
);
360 NETBSD32TOX_UAP(pos
, long);
361 return (compat_43_sys_mmap(l
, &ua
, retval
));
364 /* network syscalls */
366 compat_43_netbsd32_oaccept(struct lwp
*l
, const struct compat_43_netbsd32_oaccept_args
*uap
, register_t
*retval
)
370 syscallarg(netbsd32_voidp) name;
371 syscallarg(netbsd32_intp) anamelen;
373 struct compat_43_sys_accept_args ua
;
375 NETBSD32TOX_UAP(s
, int);
376 NETBSD32TOP_UAP(name
, void *);
377 NETBSD32TOP_UAP(anamelen
, int);
378 return (compat_43_sys_accept(l
, &ua
, retval
));
382 compat_43_netbsd32_osend(struct lwp
*l
, const struct compat_43_netbsd32_osend_args
*uap
, register_t
*retval
)
386 syscallarg(netbsd32_voidp) buf;
388 syscallarg(int) flags;
390 struct compat_43_sys_send_args ua
;
393 NETBSD32TOP_UAP(buf
, void *);
394 NETBSD32TO64_UAP(len
);
395 NETBSD32TO64_UAP(flags
);
396 return (compat_43_sys_send(l
, &ua
, retval
));
400 compat_43_netbsd32_orecv(struct lwp
*l
, const struct compat_43_netbsd32_orecv_args
*uap
, register_t
*retval
)
404 syscallarg(netbsd32_voidp) buf;
406 syscallarg(int) flags;
408 struct compat_43_sys_recv_args ua
;
411 NETBSD32TOP_UAP(buf
, void *);
412 NETBSD32TO64_UAP(len
);
413 NETBSD32TO64_UAP(flags
);
414 return (compat_43_sys_recv(l
, &ua
, retval
));
418 * This is a brutal clone of compat_43_sys_recvmsg().
421 compat_43_netbsd32_orecvmsg(struct lwp
*l
, const struct compat_43_netbsd32_orecvmsg_args
*uap
, register_t
*retval
)
425 syscallarg(netbsd32_omsghdrp_t) msg;
426 syscallarg(int) flags;
428 struct netbsd32_omsghdr omsg
;
430 struct mbuf
*from
, *control
;
431 struct iovec
*iov
, aiov
[UIO_SMALLIOV
];
434 error
= copyin(SCARG_P32(uap
, msg
), &omsg
, sizeof (struct omsghdr
));
438 if (NETBSD32PTR64(omsg
.msg_accrights
) == NULL
)
439 omsg
.msg_accrightslen
= 0;
440 /* it was this way in 4.4BSD */
441 if (omsg
.msg_accrightslen
> MLEN
)
444 iov
= netbsd32_get_iov(NETBSD32PTR64(omsg
.msg_iov
), omsg
.msg_iovlen
,
445 aiov
, __arraycount(aiov
));
449 msg
.msg_name
= NETBSD32PTR64(omsg
.msg_name
);
450 msg
.msg_namelen
= omsg
.msg_namelen
;
451 msg
.msg_iovlen
= omsg
.msg_iovlen
;
453 msg
.msg_flags
= SCARG(uap
, flags
) & MSG_USERFLAGS
;
455 error
= do_sys_recvmsg(l
, SCARG(uap
, s
), &msg
, &from
,
456 NETBSD32PTR64(omsg
.msg_accrights
) != NULL
? &control
: NULL
,
462 * If there is any control information and it's SCM_RIGHTS,
463 * pass it back to the program.
464 * XXX: maybe there can be more than one chunk of control data?
466 if (NETBSD32PTR64(omsg
.msg_accrights
) != NULL
&& control
!= NULL
) {
467 struct cmsghdr
*cmsg
= mtod(control
, void *);
469 if (cmsg
->cmsg_level
== SOL_SOCKET
470 && cmsg
->cmsg_type
== SCM_RIGHTS
471 && cmsg
->cmsg_len
< omsg
.msg_accrightslen
472 && copyout(CMSG_DATA(cmsg
),
473 NETBSD32PTR64(omsg
.msg_accrights
),
474 cmsg
->cmsg_len
) == 0) {
475 omsg
.msg_accrightslen
= cmsg
->cmsg_len
;
476 free_control_mbuf(l
, control
, control
->m_next
);
478 omsg
.msg_accrightslen
= 0;
479 free_control_mbuf(l
, control
, control
);
482 omsg
.msg_accrightslen
= 0;
485 /* convert from sockaddr sa_family to osockaddr one here */
486 mtod(from
, struct osockaddr
*)->sa_family
=
487 mtod(from
, struct sockaddr
*)->sa_family
;
489 error
= copyout_sockname(NETBSD32PTR64(omsg
.msg_name
),
490 &omsg
.msg_namelen
, 0, from
);
495 error
= copyout(&omsg
, SCARG_P32(uap
, msg
), sizeof(omsg
));
501 compat_43_netbsd32_osendmsg(struct lwp
*l
, const struct compat_43_netbsd32_osendmsg_args
*uap
, register_t
*retval
)
505 syscallarg(netbsd32_voidp) msg;
506 syscallarg(int) flags;
508 struct iovec
*iov
, aiov
[UIO_SMALLIOV
];
509 struct netbsd32_omsghdr omsg
;
513 struct osockaddr
*osa
;
516 error
= copyin(SCARG_P32(uap
, msg
), &omsg
, sizeof (struct omsghdr
));
520 iov
= netbsd32_get_iov(NETBSD32PTR64(omsg
.msg_iov
), omsg
.msg_iovlen
,
521 aiov
, __arraycount(aiov
));
525 msg
.msg_iovlen
= omsg
.msg_iovlen
;
527 msg
.msg_flags
= MSG_NAMEMBUF
;
529 error
= sockargs(&nam
, NETBSD32PTR64(omsg
.msg_name
), omsg
.msg_namelen
,
534 sa
= mtod(nam
, void *);
535 osa
= mtod(nam
, void *);
536 sa
->sa_family
= osa
->sa_family
;
537 sa
->sa_len
= omsg
.msg_namelen
;
540 msg
.msg_namelen
= omsg
.msg_namelen
;
541 error
= compat43_set_accrights(&msg
, NETBSD32PTR64(omsg
.msg_accrights
),
542 omsg
.msg_accrightslen
);
548 error
= do_sys_sendmsg(l
, SCARG(uap
, s
), &msg
, SCARG(uap
, flags
), retval
);
557 compat_43_netbsd32_orecvfrom(struct lwp
*l
, const struct compat_43_netbsd32_orecvfrom_args
*uap
, register_t
*retval
)
561 syscallarg(netbsd32_voidp) buf;
562 syscallarg(netbsd32_size_t) len;
563 syscallarg(int) flags;
564 syscallarg(netbsd32_voidp) from;
565 syscallarg(netbsd32_intp) fromlenaddr;
567 struct compat_43_sys_recvfrom_args ua
;
570 NETBSD32TOP_UAP(buf
, void *);
571 NETBSD32TOX_UAP(len
, size_t);
572 NETBSD32TO64_UAP(flags
);
573 NETBSD32TOP_UAP(from
, void *);
574 NETBSD32TOP_UAP(fromlenaddr
, int);
575 return (compat_43_sys_recvfrom(l
, &ua
, retval
));
579 compat_43_netbsd32_ogetsockname(struct lwp
*l
, const struct compat_43_netbsd32_ogetsockname_args
*uap
, register_t
*retval
)
582 syscallarg(int) fdec;
583 syscallarg(netbsd32_voidp) asa;
584 syscallarg(netbsd32_intp) alen;
586 struct compat_43_sys_getsockname_args ua
;
588 NETBSD32TO64_UAP(fdec
);
589 NETBSD32TOP_UAP(asa
, void *);
590 NETBSD32TOP_UAP(alen
, int *);
591 return (compat_43_sys_getsockname(l
, &ua
, retval
));
595 compat_43_netbsd32_ogetpeername(struct lwp
*l
, const struct compat_43_netbsd32_ogetpeername_args
*uap
, register_t
*retval
)
598 syscallarg(int) fdes;
599 syscallarg(netbsd32_voidp) asa;
600 syscallarg(netbsd32_intp) alen;
602 struct compat_43_sys_getpeername_args ua
;
604 NETBSD32TO64_UAP(fdes
);
605 NETBSD32TOP_UAP(asa
, void *);
606 NETBSD32TOP_UAP(alen
, int *);
607 return (compat_43_sys_getpeername(l
, &ua
, retval
));
610 /* signal syscalls */
612 compat_43_netbsd32_osigvec(struct lwp
*l
, const struct compat_43_netbsd32_osigvec_args
*uap
, register_t
*retval
)
615 syscallarg(int) signum;
616 syscallarg(netbsd32_sigvecp_t) nsv;
617 syscallarg(netbsd32_sigvecp_t) osv;
619 struct netbsd32_sigvec sv32
;
620 struct sigaction nsa
, osa
;
623 if (SCARG(uap
, signum
) >= 32)
626 if (SCARG_P32(uap
, nsv
)) {
627 error
= copyin(SCARG_P32(uap
, nsv
), &sv32
, sizeof(sv32
));
630 nsa
.sa_handler
= NETBSD32PTR64(sv32
.sv_handler
);
631 nsa
.sa_mask
.__bits
[0] = sv32
.sv_mask
;
632 nsa
.sa_mask
.__bits
[1] = 0;
633 nsa
.sa_mask
.__bits
[2] = 0;
634 nsa
.sa_mask
.__bits
[3] = 0;
635 nsa
.sa_flags
= sv32
.sv_flags
^ SA_RESTART
;
636 error
= sigaction1(l
, SCARG(uap
, signum
), &nsa
, &osa
, NULL
, 0);
638 error
= sigaction1(l
, SCARG(uap
, signum
), NULL
, &osa
, NULL
, 0);
642 if (SCARG_P32(uap
, osv
)) {
643 NETBSD32PTR32(sv32
.sv_handler
, osa
.sa_handler
);
644 sv32
.sv_mask
= osa
.sa_mask
.__bits
[0];
645 sv32
.sv_flags
= osa
.sa_flags
^ SA_RESTART
;
646 error
= copyout(&sv32
, SCARG_P32(uap
, osv
), sizeof(sv32
));
653 compat_43_netbsd32_sigblock(struct lwp
*l
, const struct compat_43_netbsd32_sigblock_args
*uap
, register_t
*retval
)
656 syscallarg(int) mask;
658 struct compat_43_sys_sigblock_args ua
;
660 NETBSD32TO64_UAP(mask
);
661 return (compat_43_sys_sigblock(l
, &ua
, retval
));
665 compat_43_netbsd32_sigsetmask(struct lwp
*l
, const struct compat_43_netbsd32_sigsetmask_args
*uap
, register_t
*retval
)
668 syscallarg(int) mask;
670 struct compat_43_sys_sigsetmask_args ua
;
672 NETBSD32TO64_UAP(mask
);
673 return (compat_43_sys_sigsetmask(l
, &ua
, retval
));
677 compat_43_netbsd32_osigstack(struct lwp
*l
, const struct compat_43_netbsd32_osigstack_args
*uap
, register_t
*retval
)
680 syscallarg(netbsd32_sigstackp_t) nss;
681 syscallarg(netbsd32_sigstackp_t) oss;
683 struct netbsd32_sigstack ss32
;
684 struct sigaltstack nsa
, osa
;
687 if (SCARG_P32(uap
, nss
)) {
688 error
= copyin(SCARG_P32(uap
, nss
), &ss32
, sizeof(ss32
));
691 nsa
.ss_sp
= NETBSD32PTR64(ss32
.ss_sp
);
692 nsa
.ss_size
= SIGSTKSZ
; /* Use the recommended size */
693 nsa
.ss_flags
= ss32
.ss_onstack
? SS_ONSTACK
: 0;
694 error
= sigaltstack1(l
, &nsa
, &osa
);
696 error
= sigaltstack1(l
, NULL
, &osa
);
700 if (SCARG_P32(uap
, oss
)) {
701 NETBSD32PTR32(ss32
.ss_sp
, osa
.ss_sp
);
702 ss32
.ss_onstack
= (osa
.ss_flags
& SS_ONSTACK
) != 0;
703 error
= copyout(&ss32
, SCARG_P32(uap
, oss
), sizeof(ss32
));