diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2001-08-09 14:15:23 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2001-08-09 14:15:23 +0000 |
commit | 91614215ff85e9165f2e201ca0a0b3bba8c47d40 (patch) | |
tree | 121a0fdaf61cb89f3e415929cbc84da205e7864a /sys/compat/linux/linux_signal.c | |
parent | 9dbad4f5539700e08d0bab4a256c1c9014e73148 (diff) |
Correct linux-compat sigaltstack implementation.
Helps HotSpot Java VMs a bit, but not totally. I can at least run javac
on J2SE 1.4beta with good results, but anything that uses swing seems to
fail on something else.
Diffstat (limited to 'sys/compat/linux/linux_signal.c')
-rw-r--r-- | sys/compat/linux/linux_signal.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 1a0b12f8476..9115dc93393 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_signal.c,v 1.10 2001/07/27 06:10:38 csapuntz Exp $ */ +/* $OpenBSD: linux_signal.c,v 1.11 2001/08/09 14:15:22 niklas Exp $ */ /* $NetBSD: linux_signal.c,v 1.10 1996/04/04 23:51:36 christos Exp $ */ /* @@ -841,16 +841,23 @@ linux_sys_sigaltstack(p, v, retval) caddr_t sg; sg = stackgap_init(p->p_emul); - bsd_nss = stackgap_alloc(&sg, sizeof *bsd_nss); - error = copyin(SCARG(uap, nss), &linux_ss, sizeof linux_ss); - if (error) - return (error); + if (SCARG(uap, nss) != NULL) { + bsd_nss = stackgap_alloc(&sg, sizeof *bsd_nss); + + error = copyin(SCARG(uap, nss), &linux_ss, sizeof linux_ss); + if (error) + return (error); + + bsd_nss->ss_sp = linux_ss.ss_sp; + bsd_nss->ss_size = linux_ss.ss_size; + bsd_nss->ss_flags = (linux_ss.ss_flags & LINUX_SS_DISABLE) ? + SS_DISABLE : 0; + + SCARG(&sa, nss) = bsd_nss; + } else + SCARG(&sa, nss) = NULL; - bsd_nss->ss_sp = linux_ss.ss_sp; - bsd_nss->ss_size = linux_ss.ss_size; - bsd_nss->ss_flags = linux_ss.ss_flags; - SCARG(&sa, nss) = bsd_nss; if (SCARG(uap, oss) == NULL) { SCARG(&sa, oss) = NULL; return (sys_sigaltstack(p, &sa, retval)); @@ -863,7 +870,11 @@ linux_sys_sigaltstack(p, v, retval) linux_ss.ss_sp = bsd_oss->ss_sp; linux_ss.ss_size = bsd_oss->ss_size; - linux_ss.ss_flags = bsd_oss->ss_flags; + linux_ss.ss_flags = 0; + if (bsd_oss->ss_flags & SS_ONSTACK) + linux_ss.ss_flags |= LINUX_SS_ONSTACK; + if (bsd_oss->ss_flags & SS_DISABLE) + linux_ss.ss_flags |= LINUX_SS_DISABLE; return (copyout(&linux_ss, SCARG(uap, oss), sizeof linux_ss)); } |