diff options
-rw-r--r-- | sys/compat/netbsd/files.netbsd | 5 | ||||
-rw-r--r-- | sys/compat/netbsd/netbsd_misc.c | 19 | ||||
-rw-r--r-- | sys/compat/netbsd/netbsd_signal.c | 100 | ||||
-rw-r--r-- | sys/compat/netbsd/syscalls.master | 16 |
4 files changed, 112 insertions, 28 deletions
diff --git a/sys/compat/netbsd/files.netbsd b/sys/compat/netbsd/files.netbsd index 4f2d2a39289..81e333d9da0 100644 --- a/sys/compat/netbsd/files.netbsd +++ b/sys/compat/netbsd/files.netbsd @@ -1,4 +1,4 @@ -# $OpenBSD: files.netbsd,v 1.2 1999/09/14 01:05:25 kstailey Exp $ +# $OpenBSD: files.netbsd,v 1.3 1999/09/15 18:36:37 kstailey Exp $ # # Config.new file description for machine-independent NetBSD compat code. # Included by ports that need it. @@ -7,8 +7,9 @@ # own file lists. file compat/netbsd/netbsd_exec.c compat_netbsd -file compat/netbsd/netbsd_stat.c compat_netbsd file compat/netbsd/netbsd_getcwd.c compat_netbsd +file compat/netbsd/netbsd_misc.c compat_netbsd file compat/netbsd/netbsd_signal.c compat_netbsd +file compat/netbsd/netbsd_stat.c compat_netbsd file compat/netbsd/netbsd_sysent.c compat_netbsd file compat/netbsd/netbsd_syscalls.c compat_netbsd diff --git a/sys/compat/netbsd/netbsd_misc.c b/sys/compat/netbsd/netbsd_misc.c new file mode 100644 index 00000000000..473a3dfcca1 --- /dev/null +++ b/sys/compat/netbsd/netbsd_misc.c @@ -0,0 +1,19 @@ +/* $OpenBSD: netbsd_misc.c,v 1.1 1999/09/15 18:36:38 kstailey Exp $ */ + +#include <sys/param.h> +/* #include <sys/systm.h> */ +#include <sys/proc.h> + +#include <compat/netbsd/netbsd_types.h> +#include <compat/netbsd/netbsd_signal.h> +#include <compat/netbsd/netbsd_syscallargs.h> + +/* XXX doesn't do shared address space */ +int +netbsd_sys___vfork14(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + return (fork1(p, ISVFORK, 0, NULL, 0, retval)); +} diff --git a/sys/compat/netbsd/netbsd_signal.c b/sys/compat/netbsd/netbsd_signal.c index 31d70dcea59..793a40f60a5 100644 --- a/sys/compat/netbsd/netbsd_signal.c +++ b/sys/compat/netbsd/netbsd_signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netbsd_signal.c,v 1.2 1999/09/14 02:06:25 kstailey Exp $ */ +/* $OpenBSD: netbsd_signal.c,v 1.3 1999/09/15 18:36:38 kstailey Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ @@ -43,18 +43,6 @@ * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 */ -/* - -missing: - -;293 STD { int netbsd_sys___sigprocmask14(int how, \ -; const sigset_t *set, \ -; sigset_t *oset); } - -;294 STD { int netbsd_sys___sigsuspend14(const sigset_t *set); } - -*/ - #include <sys/param.h> #include <sys/proc.h> #include <sys/signalvar.h> @@ -63,7 +51,6 @@ missing: #include <compat/netbsd/netbsd_types.h> #include <compat/netbsd/netbsd_signal.h> -/* #include <compat/netbsd/netbsd_stat.h> */ #include <compat/netbsd/netbsd_syscallargs.h> static void netbsd_to_openbsd_sigaction __P((struct netbsd_sigaction *, @@ -95,9 +82,8 @@ netbsd_to_openbsd_sigaction(nbsa, obsa) struct netbsd_sigaction *nbsa; struct sigaction *obsa; { - memset(nbsa, 0, sizeof(struct sigaction)); obsa->sa_handler = nbsa->netbsd_sa_handler; - bcopy(&nbsa->netbsd_sa_mask.__bits[0],&obsa->sa_mask, + bcopy(&nbsa->netbsd_sa_mask.__bits[0], &obsa->sa_mask, sizeof(sigset_t)); obsa->sa_flags = nbsa->netbsd_sa_flags; } @@ -245,6 +231,86 @@ netbsd_sys___sigpending14(p, v, retval) } */ *uap = v; netbsd_sigset_t nss; - memcpy(&nss.__bits[0], &p->p_siglist, sizeof(sigset_t)); + bcopy(&p->p_siglist, &nss.__bits[0], sizeof(sigset_t)); return (copyout((caddr_t)&nss, (caddr_t)SCARG(uap, set), sizeof(nss))); } + +int +netbsd_sys___sigprocmask14(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct netbsd_sys___sigprocmask14_args /* { + syscallarg(int) how; + syscallarg(netbsd_sigset_t *) set; + syscallarg(netbsd_sigset_t *) oset; + } */ *uap = v; + netbsd_sigset_t nss, oss; + sigset_t obnss; + int error = 0; + + if (SCARG(uap, set)) { + error = copyin(SCARG(uap, set), &nss, sizeof(nss)); + if (error) + return (error); + } + if (SCARG(uap, oset)) { + bzero(&oss, sizeof(netbsd_sigset_t)); + bcopy(&p->p_sigmask, &oss.__bits[0], sizeof(sigset_t)); + error = copyout((caddr_t)&oss, (caddr_t)SCARG(uap, oset), + sizeof(netbsd_sigset_t)); + if (error) + return (error); + } + bcopy(&nss.__bits[0], &obnss, sizeof(sigset_t)); + (void)splhigh(); + switch (SCARG(uap, how)) { + case SIG_BLOCK: + p->p_sigmask |= obnss &~ sigcantmask; + break; + case SIG_UNBLOCK: + p->p_sigmask &= ~obnss; + break; + case SIG_SETMASK: + p->p_sigmask = obnss &~ sigcantmask; + break; + default: + error = EINVAL; + break; + } + (void) spl0(); + return (error); +} + +int +netbsd_sys___sigsuspend14(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct netbsd_sys___sigsuspend14_args /* { + syscallarg(netbsd_sigset_t *) set; + } */ *uap = v; + register struct sigacts *ps = p->p_sigacts; + netbsd_sigset_t nbset; + sigset_t obset; + + copyin(SCARG(uap, set), &nbset, sizeof(netbsd_sigset_t)); + bcopy(&nbset.__bits[0], &obset, sizeof(sigset_t)); + /* + * When returning from sigpause, we want + * the old mask to be restored after the + * signal handler has finished. Thus, we + * save it here and mark the sigacts structure + * to indicate this. + */ + ps->ps_oldmask = p->p_sigmask; + ps->ps_flags |= SAS_OLDMASK; + p->p_sigmask = obset &~ sigcantmask; + while (tsleep((caddr_t) ps, PPAUSE|PCATCH, "pause", 0) == 0) + /* void */; + /* always return EINTR rather than ERESTART... */ + return (EINTR); +} + diff --git a/sys/compat/netbsd/syscalls.master b/sys/compat/netbsd/syscalls.master index 93c6685c5f6..0d4ecb7f2af 100644 --- a/sys/compat/netbsd/syscalls.master +++ b/sys/compat/netbsd/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.3 1999/09/14 01:05:25 kstailey Exp $ +; $OpenBSD: syscalls.master,v 1.4 1999/09/15 18:36:38 kstailey Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -563,8 +563,7 @@ 281 STD { int netbsd_sys___sigaltstack14( \ const struct netbsd_sigaltstack *nss, \ struct netbsd_sigaltstack *oss); } -282 UNIMPL -;282 STD { int netbsd_sys___vfork14(void); } +282 STD { int netbsd_sys___vfork14(void); } 283 UNIMPL ;283 STD { int netbsd_sys___posix_chown(const char *path, \ ; uid_t uid, gid_t gid); } @@ -596,12 +595,11 @@ struct netbsd_sigaction *osa); } 292 STD { int netbsd_sys___sigpending14(netbsd_sigset_t \ *set); } -293 UNIMPL -;293 STD { int netbsd_sys___sigprocmask14(int how, \ -; const sigset_t *set, \ -; sigset_t *oset); } -294 UNIMPL -;294 STD { int netbsd_sys___sigsuspend14(const sigset_t *set); } +293 STD { int netbsd_sys___sigprocmask14(int how, \ + const netbsd_sigset_t *set, \ + netbsd_sigset_t *oset); } +294 STD { int netbsd_sys___sigsuspend14(const netbsd_sigset_t \ + *set); } 295 STD { int netbsd_sys___sigreturn14(struct \ netbsd_sigcontext *sigcntxp); } 296 STD { int netbsd_sys___getcwd(char *bufp, size_t length); } |