diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-07-11 00:20:47 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-07-11 00:20:47 +0000 |
commit | 8f0d88437ae90da0f6e6e2816078b9ddb05f2d2e (patch) | |
tree | 85796a3824b82063568d3ca6f0b0963cf47e4515 | |
parent | 5f5956ff6c46b9cb957cf649150284eee373cbf6 (diff) |
sigaltstack wrapper
-rw-r--r-- | sys/compat/hpux/hppa/hpux_sig.c | 53 | ||||
-rw-r--r-- | sys/compat/hpux/hppa/syscalls.master | 6 |
2 files changed, 56 insertions, 3 deletions
diff --git a/sys/compat/hpux/hppa/hpux_sig.c b/sys/compat/hpux/hppa/hpux_sig.c index 012bbd1c160..06462c709c0 100644 --- a/sys/compat/hpux/hppa/hpux_sig.c +++ b/sys/compat/hpux/hppa/hpux_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hpux_sig.c,v 1.1 2004/07/09 21:48:21 mickey Exp $ */ +/* $OpenBSD: hpux_sig.c,v 1.2 2004/07/11 00:20:46 mickey Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff. All rights reserved. @@ -53,6 +53,7 @@ #include <compat/hpux/hpux.h> #include <compat/hpux/hpux_sig.h> +#include <compat/hpux/hpux_util.h> #include <compat/hpux/hppa/hpux_syscallargs.h> /* indexed by HPUX signal number - 1 */ @@ -412,3 +413,53 @@ hpux_sigsetreturn(struct proc *p, void *v, register_t *retval) printf("hpux_sigsetreturn(%x)\n", SCARG(uap, cookie)); return (0); } + +int +hpux_sys_sigaltstack(struct proc *p, void *v, register_t *retval) +{ + struct hpux_sys_sigaltstack_args /* { + syscallarg(struct hpux_sigaltstack *) nss; + syscallarg(struct hpux_sigaltstack *) oss; + } */ *uap = v; + struct hpux_sigaltstack { + void *ss_sp; + int ss_flags; +#define HPUX_SS_DISABLE 0x0002 + size_t ss_size; + } hsa; + struct sys_sigaltstack_args saa; + struct sigaltstack *psa, sa; + caddr_t sg; + int error; + + if ((error = copyin(SCARG(uap, nss), &hsa, sizeof hsa))) + return (error); + + sa.ss_sp = hsa.ss_sp; + sa.ss_size = hsa.ss_size; + sa.ss_flags = hsa.ss_flags & SS_ONSTACK; + if (hsa.ss_flags & HPUX_SS_DISABLE) + sa.ss_flags |= SS_DISABLE; + + sg = stackgap_init(p->p_emul); + psa = stackgap_alloc(&sg, 2 * sizeof(struct sigaltstack)); + SCARG(&saa, nss) = &psa[0]; + SCARG(&saa, oss) = &psa[1]; + + if ((error = copyout(&sa, psa, sizeof sa))) + return (error); + + if ((error = sys_sigaltstack(p, &saa, retval))) + return (error); + + if ((error = copyin(SCARG(&saa, oss), &sa, sizeof sa))) + return (error); + + hsa.ss_sp = sa.ss_sp; + hsa.ss_flags = sa.ss_flags & SS_ONSTACK; + if (sa.ss_flags & SS_DISABLE) + hsa.ss_flags |= HPUX_SS_DISABLE; + hsa.ss_size = sa.ss_size; + + return (copyout(&hsa, SCARG(uap, oss), sizeof hsa)); +} diff --git a/sys/compat/hpux/hppa/syscalls.master b/sys/compat/hpux/hppa/syscalls.master index 2aaf9245949..df7feecf4c8 100644 --- a/sys/compat/hpux/hppa/syscalls.master +++ b/sys/compat/hpux/hppa/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.2 2004/07/10 22:37:33 mickey Exp $ + $OpenBSD: syscalls.master,v 1.3 2004/07/11 00:20:46 mickey Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -514,7 +514,9 @@ 378 UNIMPL pwrite64 379 UNIMPL pwritev64 380 UNIMPL setcontext -381 UNIMPL sigaltstack +381 STD { int hpux_sys_sigaltstack( \ + const struct hpux_sigaltstack *nss, \ + struct hpux_sigaltstack *oss); } 382 UNIMPL waitid 383 UNIMPL setpgrp 384 UNIMPL recvmsg2 |