Modify the (recently added) compat_sigaltstack() #define to take the
values of the SS_ONSTACK and SS_DISABLE constants. Use it to shorten the source files when this action is replicated. Actually, given the monstrous complexity of sigaltstack1() there is probably a much better way to do this...
This commit is contained in:
parent
5977ce1bd5
commit
ec918d6dc6
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat_sigaltstack.h,v 1.1 2007/06/03 14:59:46 dsl Exp $ */
|
||||
/* $NetBSD: compat_sigaltstack.h,v 1.2 2007/06/16 20:04:27 dsl Exp $ */
|
||||
|
||||
/* Wrapper for calling sigaltstack1() from compat (or other) code */
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
#define COMPAT_SET_PTR(p, v) ((p) = (v))
|
||||
#endif
|
||||
|
||||
#define compat_sigaltstack(uap, compat_ss) do { \
|
||||
#define compat_sigaltstack(uap, compat_ss, ss_onstack, ss_disable) do { \
|
||||
struct compat_ss css; \
|
||||
struct sigaltstack nss, oss; \
|
||||
int error; \
|
||||
|
@ -24,9 +24,14 @@
|
|||
error = copyin(SCARG_COMPAT_PTR(uap, nss), &css, sizeof css); \
|
||||
if (error) \
|
||||
return error; \
|
||||
nss.ss_sp = COMPAT_GET_PTR(css.ss_sp); \
|
||||
nss.ss_size = css.ss_size; \
|
||||
nss.ss_flags = css.ss_flags; \
|
||||
nss.ss_sp = COMPAT_GET_PTR(css.ss_sp); \
|
||||
nss.ss_size = css.ss_size; \
|
||||
if (ss_onstack == SS_ONSTACK && ss_disable == SS_DISABLE) \
|
||||
nss.ss_flags = css.ss_flags; \
|
||||
else \
|
||||
nss.ss_flags = \
|
||||
(css.ss_flags & ss_onstack ? SS_ONSTACK : 0) \
|
||||
| (css.ss_flags & ss_disable ? SS_DISABLE : 0); \
|
||||
} \
|
||||
\
|
||||
error = sigaltstack1(l, SCARG_COMPAT_PTR(uap, nss) ? &nss : 0, \
|
||||
|
@ -37,8 +42,13 @@
|
|||
if (SCARG_COMPAT_PTR(uap, oss)) { \
|
||||
COMPAT_SET_PTR(css.ss_sp, oss.ss_sp); \
|
||||
css.ss_size = oss.ss_size; \
|
||||
css.ss_flags = oss.ss_flags; \
|
||||
error = copyout(&css, SCARG_COMPAT_PTR(uap, oss), sizeof(css)); \
|
||||
if (ss_onstack == SS_ONSTACK && ss_disable == SS_DISABLE) \
|
||||
css.ss_flags = oss.ss_flags; \
|
||||
else \
|
||||
css.ss_flags = \
|
||||
(oss.ss_flags & SS_ONSTACK ? ss_onstack : 0) \
|
||||
| (oss.ss_flags & SS_DISABLE ? ss_disable : 0); \
|
||||
error = copyout(&css, SCARG_COMPAT_PTR(uap, oss), sizeof(css));\
|
||||
if (error) \
|
||||
return (error); \
|
||||
} \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sig_13.c,v 1.14 2007/02/09 21:55:16 ad Exp $ */
|
||||
/* $NetBSD: kern_sig_13.c,v 1.15 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.14 2007/02/09 21:55:16 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.15 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_13.c,v 1.14 2007/02/09 21:55:16 ad Exp $");
|
|||
#include <compat/sys/signal.h>
|
||||
#include <compat/sys/signalvar.h>
|
||||
#include <compat/common/compat_util.h>
|
||||
#include <compat/common/compat_sigaltstack.h>
|
||||
|
||||
void
|
||||
native_sigset13_to_sigset(oss, ss)
|
||||
|
@ -97,28 +98,6 @@ native_sigaction_to_sigaction13(sa, osa)
|
|||
osa->osa_flags = sa->sa_flags;
|
||||
}
|
||||
|
||||
void
|
||||
native_sigaltstack13_to_sigaltstack(osa, sa)
|
||||
const struct sigaltstack13 *osa;
|
||||
struct sigaltstack *sa;
|
||||
{
|
||||
|
||||
sa->ss_sp = osa->ss_sp;
|
||||
sa->ss_size = osa->ss_size;
|
||||
sa->ss_flags = osa->ss_flags;
|
||||
}
|
||||
|
||||
void
|
||||
native_sigaltstack_to_sigaltstack13(sa, osa)
|
||||
const struct sigaltstack *sa;
|
||||
struct sigaltstack13 *osa;
|
||||
{
|
||||
|
||||
osa->ss_sp = sa->ss_sp;
|
||||
osa->ss_size = sa->ss_size;
|
||||
osa->ss_flags = sa->ss_flags;
|
||||
}
|
||||
|
||||
int
|
||||
compat_13_sys_sigaltstack(struct lwp *l, void *v, register_t *retval)
|
||||
{
|
||||
|
@ -126,27 +105,7 @@ compat_13_sys_sigaltstack(struct lwp *l, void *v, register_t *retval)
|
|||
syscallarg(const struct sigaltstack13 *) nss;
|
||||
syscallarg(struct sigaltstack13 *) oss;
|
||||
} */ *uap = v;
|
||||
struct sigaltstack13 ness, oess;
|
||||
struct sigaltstack nbss, obss;
|
||||
int error;
|
||||
|
||||
if (SCARG(uap, nss)) {
|
||||
error = copyin(SCARG(uap, nss), &ness, sizeof(ness));
|
||||
if (error)
|
||||
return (error);
|
||||
native_sigaltstack13_to_sigaltstack(&ness, &nbss);
|
||||
}
|
||||
error = sigaltstack1(l,
|
||||
SCARG(uap, nss) ? &nbss : 0, SCARG(uap, oss) ? &obss : 0);
|
||||
if (error)
|
||||
return (error);
|
||||
if (SCARG(uap, oss)) {
|
||||
native_sigaltstack_to_sigaltstack13(&obss, &oess);
|
||||
error = copyout(&oess, SCARG(uap, oss), sizeof(oess));
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
compat_sigaltstack(uap, sigaltstack13, SS_ONSTACK, SS_DISABLE);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ibcs2_signal.c,v 1.25 2007/02/09 21:55:18 ad Exp $ */
|
||||
/* $NetBSD: ibcs2_signal.c,v 1.26 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Scott Bartram
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.25 2007/02/09 21:55:18 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.26 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.25 2007/02/09 21:55:18 ad Exp $")
|
|||
#include <compat/ibcs2/ibcs2_signal.h>
|
||||
#include <compat/ibcs2/ibcs2_syscallargs.h>
|
||||
#include <compat/ibcs2/ibcs2_util.h>
|
||||
#include <compat/common/compat_sigaltstack.h>
|
||||
|
||||
#define ibcs2_sigmask(n) (1 << ((n) - 1))
|
||||
#define ibcs2_sigemptyset(s) memset((s), 0, sizeof(*(s)))
|
||||
|
@ -58,8 +59,6 @@ extern const int ibcs2_to_native_signo[];
|
|||
|
||||
void ibcs2_to_native_sigaction __P((const struct ibcs2_sigaction *, struct sigaction *));
|
||||
void native_to_ibcs2_sigaction __P((const struct sigaction *, struct ibcs2_sigaction *));
|
||||
void ibcs2_to_native_sigaltstack __P((const struct ibcs2_sigaltstack *, struct sigaltstack *));
|
||||
void native_to_ibcs2_sigaltstack __P((const struct sigaltstack *, struct ibcs2_sigaltstack *));
|
||||
|
||||
void
|
||||
ibcs2_to_native_sigset(iss, bss)
|
||||
|
@ -143,37 +142,6 @@ native_to_ibcs2_sigaction(bsa, isa)
|
|||
isa->ibcs2_sa_flags |= IBCS2_SA_ONSTACK;
|
||||
}
|
||||
|
||||
void
|
||||
ibcs2_to_native_sigaltstack(sss, bss)
|
||||
const struct ibcs2_sigaltstack *sss;
|
||||
struct sigaltstack *bss;
|
||||
{
|
||||
|
||||
bss->ss_sp = sss->ss_sp;
|
||||
bss->ss_size = sss->ss_size;
|
||||
bss->ss_flags = 0;
|
||||
if ((sss->ss_flags & IBCS2_SS_DISABLE) != 0)
|
||||
bss->ss_flags |= SS_DISABLE;
|
||||
if ((sss->ss_flags & IBCS2_SS_ONSTACK) != 0)
|
||||
bss->ss_flags |= SS_ONSTACK;
|
||||
if ((sss->ss_flags & ~IBCS2_SS_ALLBITS) != 0)
|
||||
/*XXX*/ printf("ibcs2_to_native_sigaltstack: extra bits ignored\n");
|
||||
}
|
||||
|
||||
void
|
||||
native_to_ibcs2_sigaltstack(bss, sss)
|
||||
const struct sigaltstack *bss;
|
||||
struct ibcs2_sigaltstack *sss;
|
||||
{
|
||||
|
||||
sss->ss_sp = bss->ss_sp;
|
||||
sss->ss_size = bss->ss_size;
|
||||
sss->ss_flags = 0;
|
||||
if ((bss->ss_flags & SS_DISABLE) != 0)
|
||||
sss->ss_flags |= IBCS2_SS_DISABLE;
|
||||
if ((bss->ss_flags & SS_ONSTACK) != 0)
|
||||
sss->ss_flags |= IBCS2_SS_ONSTACK;
|
||||
}
|
||||
|
||||
int
|
||||
ibcs2_sys_sigaction(struct lwp *l, void *v, register_t *retval)
|
||||
|
@ -218,27 +186,8 @@ ibcs2_sys_sigaltstack(struct lwp *l, void *v, register_t *retval)
|
|||
syscallarg(const struct ibcs2_sigaltstack *) nss;
|
||||
syscallarg(struct ibcs2_sigaltstack *) oss;
|
||||
} */ *uap = v;
|
||||
struct ibcs2_sigaltstack nsss, osss;
|
||||
struct sigaltstack nbss, obss;
|
||||
int error;
|
||||
|
||||
if (SCARG(uap, nss)) {
|
||||
error = copyin(SCARG(uap, nss), &nsss, sizeof(nsss));
|
||||
if (error)
|
||||
return (error);
|
||||
ibcs2_to_native_sigaltstack(&nsss, &nbss);
|
||||
}
|
||||
error = sigaltstack1(l,
|
||||
SCARG(uap, nss) ? &nbss : 0, SCARG(uap, oss) ? &obss : 0);
|
||||
if (error)
|
||||
return (error);
|
||||
if (SCARG(uap, oss)) {
|
||||
native_to_ibcs2_sigaltstack(&obss, &osss);
|
||||
error = copyout(&osss, SCARG(uap, oss), sizeof(osss));
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
compat_sigaltstack(uap, ibcs2_sigaltstack,
|
||||
IBCS2_SS_ONSTACK, IBCS2_SS_DISABLE);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: netbsd32_compat_13.c,v 1.21 2007/06/03 14:59:46 dsl Exp $ */
|
||||
/* $NetBSD: netbsd32_compat_13.c,v 1.22 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001 Matthew R. Green
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_13.c,v 1.21 2007/06/03 14:59:46 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_13.c,v 1.22 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -55,7 +55,7 @@ compat_13_netbsd32_sigaltstack13(l, v, retval)
|
|||
register_t *retval;
|
||||
{
|
||||
struct compat_13_netbsd32_sigaltstack13_args *uap = v;
|
||||
compat_sigaltstack(uap, netbsd32_sigaltstack13);
|
||||
compat_sigaltstack(uap, netbsd32_sigaltstack13, SS_ONSTACK, SS_DISABLE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: netbsd32_signal.c,v 1.24 2007/05/21 15:35:48 christos Exp $ */
|
||||
/* $NetBSD: netbsd32_signal.c,v 1.25 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001 Matthew R. Green
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.24 2007/05/21 15:35:48 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.25 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.24 2007/05/21 15:35:48 christo
|
|||
#include <compat/sys/signalvar.h>
|
||||
#include <compat/sys/siginfo.h>
|
||||
#include <compat/sys/ucontext.h>
|
||||
#include <compat/common/compat_sigaltstack.h>
|
||||
|
||||
#ifdef unused
|
||||
static void netbsd32_si32_to_si(siginfo_t *, const siginfo32_t *);
|
||||
|
@ -111,31 +112,7 @@ netbsd32___sigaltstack14(l, v, retval)
|
|||
syscallarg(const netbsd32_sigaltstackp_t) nss;
|
||||
syscallarg(netbsd32_sigaltstackp_t) oss;
|
||||
} */ *uap = v;
|
||||
struct netbsd32_sigaltstack s32;
|
||||
struct sigaltstack nss, oss;
|
||||
int error;
|
||||
|
||||
if (SCARG_P32(uap, nss)) {
|
||||
error = copyin(SCARG_P32(uap, nss), &s32, sizeof(s32));
|
||||
if (error)
|
||||
return (error);
|
||||
nss.ss_sp = NETBSD32PTR64(s32.ss_sp);
|
||||
nss.ss_size = (size_t)s32.ss_size;
|
||||
nss.ss_flags = s32.ss_flags;
|
||||
}
|
||||
error = sigaltstack1(l, SCARG_P32(uap, nss) ? &nss : 0,
|
||||
SCARG_P32(uap, oss) ? &oss : 0);
|
||||
if (error)
|
||||
return (error);
|
||||
if (SCARG_P32(uap, oss)) {
|
||||
NETBSD32PTR32(s32.ss_sp, oss.ss_sp);
|
||||
s32.ss_size = (netbsd32_size_t)oss.ss_size;
|
||||
s32.ss_flags = oss.ss_flags;
|
||||
error = copyout(&s32, SCARG_P32(uap, oss), sizeof(s32));
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
compat_sigaltstack(uap, netbsd32_sigaltstack, SS_ONSTACK, SS_DISABLE);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: osf1_cvt.c,v 1.21 2007/02/09 21:55:23 ad Exp $ */
|
||||
/* $NetBSD: osf1_cvt.c,v 1.22 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_cvt.c,v 1.21 2007/02/09 21:55:23 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_cvt.c,v 1.22 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -284,26 +284,6 @@ const struct emul_flags_xtab osf1_sigaction_flags_xtab[] = {
|
|||
{ 0 },
|
||||
};
|
||||
|
||||
const struct emul_flags_xtab osf1_sigaltstack_flags_rxtab[] = {
|
||||
{ SS_ONSTACK, SS_ONSTACK, OSF1_SS_ONSTACK },
|
||||
{ SS_DISABLE, SS_DISABLE, OSF1_SS_DISABLE },
|
||||
#if 0 /* XXX no equivalents */
|
||||
{ ???, ???, OSF1_SS_NOMASK },
|
||||
{ ???, ???, OSF1_SS_UCONTEXT },
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
const struct emul_flags_xtab osf1_sigaltstack_flags_xtab[] = {
|
||||
{ OSF1_SS_ONSTACK, OSF1_SS_ONSTACK, SS_ONSTACK },
|
||||
{ OSF1_SS_DISABLE, OSF1_SS_DISABLE, SS_DISABLE },
|
||||
#if 0 /* XXX no equivalents */
|
||||
{ OSF1_SS_NOMASK, OSF1_SS_NOMASK, ??? },
|
||||
{ OSF1_SS_UCONTEXT, OSF1_SS_UCONTEXT, ??? },
|
||||
#endif
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
const struct emul_flags_xtab osf1_wait_options_xtab[] = {
|
||||
{ OSF1_WNOHANG, OSF1_WNOHANG, WNOHANG },
|
||||
{ OSF1_WUNTRACED, OSF1_WUNTRACED, WUNTRACED },
|
||||
|
@ -549,43 +529,6 @@ osf1_cvt_sigaction_to_native(osa, bsa)
|
|||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
osf1_cvt_sigaltstack_from_native(bss, oss)
|
||||
const struct sigaltstack *bss;
|
||||
struct osf1_sigaltstack *oss;
|
||||
{
|
||||
|
||||
oss->ss_sp = bss->ss_sp;
|
||||
oss->ss_size = bss->ss_size;
|
||||
|
||||
/* translate flags */
|
||||
oss->ss_flags = emul_flags_translate(osf1_sigaltstack_flags_rxtab,
|
||||
bss->ss_flags, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
osf1_cvt_sigaltstack_to_native(oss, bss)
|
||||
const struct osf1_sigaltstack *oss;
|
||||
struct sigaltstack *bss;
|
||||
{
|
||||
unsigned long leftovers;
|
||||
|
||||
bss->ss_sp = oss->ss_sp;
|
||||
bss->ss_size = oss->ss_size;
|
||||
|
||||
/* translate flags */
|
||||
bss->ss_flags = emul_flags_translate(osf1_sigaltstack_flags_xtab,
|
||||
oss->ss_flags, &leftovers);
|
||||
|
||||
if (leftovers != 0) {
|
||||
printf("osf1_cvt_sigaltstack_to_native: leftovers = 0x%lx\n",
|
||||
leftovers);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
osf1_cvt_sigset_from_native(bss, oss)
|
||||
const sigset_t *bss;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: osf1_cvt.h,v 1.10 2005/12/11 12:20:23 christos Exp $ */
|
||||
/* $NetBSD: osf1_cvt.h,v 1.11 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -62,10 +62,6 @@ void osf1_cvt_sigaction_from_native(const struct sigaction *nsa,
|
|||
struct osf1_sigaction *osa);
|
||||
int osf1_cvt_sigaction_to_native(const struct osf1_sigaction *osa,
|
||||
struct sigaction *nsa);
|
||||
void osf1_cvt_sigaltstack_from_native(const struct sigaltstack *nss,
|
||||
struct osf1_sigaltstack *oss);
|
||||
int osf1_cvt_sigaltstack_to_native(const struct osf1_sigaltstack *oss,
|
||||
struct sigaltstack *nss);
|
||||
void osf1_cvt_sigset_from_native(const sigset_t *nss, osf1_sigset_t *oss);
|
||||
int osf1_cvt_sigset_to_native(const osf1_sigset_t *oss, sigset_t *nss);
|
||||
void osf1_cvt_stat_from_native(const struct stat *nst,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: osf1_misc.c,v 1.78 2007/05/07 21:18:26 dogcow Exp $ */
|
||||
/* $NetBSD: osf1_misc.c,v 1.79 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.78 2007/05/07 21:18:26 dogcow Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.79 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_syscall_debug.h"
|
||||
|
@ -367,8 +367,6 @@ osf1_sys_uname(l, v, retval)
|
|||
const char *cp;
|
||||
char *dp, *ep;
|
||||
|
||||
/* XXX would use stackgap, but our struct utsname is too big! */
|
||||
|
||||
strncpy(u.sysname, ostype, sizeof(u.sysname));
|
||||
strncpy(u.nodename, hostname, sizeof(u.nodename));
|
||||
strncpy(u.release, osrelease, sizeof(u.release));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: osf1_signal.c,v 1.31 2007/05/13 09:07:25 dsl Exp $ */
|
||||
/* $NetBSD: osf1_signal.c,v 1.32 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_signal.c,v 1.31 2007/05/13 09:07:25 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: osf1_signal.c,v 1.32 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: osf1_signal.c,v 1.31 2007/05/13 09:07:25 dsl Exp $")
|
|||
#include <compat/osf1/osf1_signal.h>
|
||||
#include <compat/osf1/osf1_syscallargs.h>
|
||||
#include <compat/common/compat_util.h>
|
||||
#include <compat/common/compat_sigaltstack.h>
|
||||
#include <compat/osf1/osf1_cvt.h>
|
||||
|
||||
#if 0
|
||||
|
@ -116,26 +117,9 @@ osf1_sys_sigaltstack(l, v, retval)
|
|||
register_t *retval;
|
||||
{
|
||||
struct osf1_sys_sigaltstack_args *uap = v;
|
||||
struct osf1_sigaltstack osf1_ss;
|
||||
struct sigaltstack nbss, obss;
|
||||
int error;
|
||||
|
||||
if (SCARG(uap, nss) != NULL) {
|
||||
error = copyin(SCARG(uap, nss), &osf1_ss, sizeof(osf1_ss));
|
||||
if (error != 0)
|
||||
return error;
|
||||
error = osf1_cvt_sigaltstack_to_native(&osf1_ss, &nbss);
|
||||
if (error != 0)
|
||||
return error;
|
||||
error = sigaltstack1(l, &nbss, &obss);
|
||||
} else
|
||||
error = sigaltstack1(l, NULL, &obss);
|
||||
|
||||
if (error != 0 || SCARG(uap, oss) == NULL)
|
||||
return error;
|
||||
|
||||
osf1_cvt_sigaltstack_from_native(&obss, &osf1_ss);
|
||||
return copyout(&osf1_ss, SCARG(uap, oss), sizeof(osf1_ss));
|
||||
/* We silently ignore OSF1_SS_NOMASK and OSF1_SS_UCONTEXT */
|
||||
compat_sigaltstack(uap, osf1_sigaltstack,
|
||||
OSF1_SS_ONSTACK, OSF1_SS_DISABLE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_signal.c,v 1.58 2007/02/09 21:55:24 ad Exp $ */
|
||||
/* $NetBSD: svr4_signal.c,v 1.59 2007/06/16 20:04:28 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_signal.c,v 1.58 2007/02/09 21:55:24 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_signal.c,v 1.59 2007/06/16 20:04:28 dsl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -63,6 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: svr4_signal.c,v 1.58 2007/02/09 21:55:24 ad Exp $");
|
|||
#include <compat/svr4/svr4_syscallargs.h>
|
||||
#include <compat/svr4/svr4_util.h>
|
||||
|
||||
#include <compat/common/compat_sigaltstack.h>
|
||||
|
||||
#define svr4_sigmask(n) (1 << (((n) - 1) & 31))
|
||||
#define svr4_sigword(n) (((n) - 1) >> 5)
|
||||
#define svr4_sigemptyset(s) memset((s), 0, sizeof(*(s)))
|
||||
|
@ -178,39 +180,6 @@ native_to_svr4_sigaction(bsa, ssa)
|
|||
ssa->svr4_sa_flags |= SVR4_SA_NOCLDSTOP;
|
||||
}
|
||||
|
||||
void
|
||||
svr4_to_native_sigaltstack(sss, bss)
|
||||
const struct svr4_sigaltstack *sss;
|
||||
struct sigaltstack *bss;
|
||||
{
|
||||
|
||||
bss->ss_sp = sss->ss_sp;
|
||||
bss->ss_size = sss->ss_size;
|
||||
bss->ss_flags = 0;
|
||||
if ((sss->ss_flags & SVR4_SS_DISABLE) != 0)
|
||||
bss->ss_flags |= SS_DISABLE;
|
||||
if ((sss->ss_flags & SVR4_SS_ONSTACK) != 0)
|
||||
bss->ss_flags |= SS_ONSTACK;
|
||||
if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0)
|
||||
/*XXX*/ printf("svr4_to_native_sigaltstack: extra bits %x ignored\n",
|
||||
sss->ss_flags & ~SVR4_SS_ALLBITS);
|
||||
}
|
||||
|
||||
void
|
||||
native_to_svr4_sigaltstack(bss, sss)
|
||||
const struct sigaltstack *bss;
|
||||
struct svr4_sigaltstack *sss;
|
||||
{
|
||||
|
||||
sss->ss_sp = bss->ss_sp;
|
||||
sss->ss_size = bss->ss_size;
|
||||
sss->ss_flags = 0;
|
||||
if ((bss->ss_flags & SS_DISABLE) != 0)
|
||||
sss->ss_flags |= SVR4_SS_DISABLE;
|
||||
if ((bss->ss_flags & SS_ONSTACK) != 0)
|
||||
sss->ss_flags |= SVR4_SS_ONSTACK;
|
||||
}
|
||||
|
||||
int
|
||||
svr4_sys_sigaction(struct lwp *l, void *v, register_t *retval)
|
||||
{
|
||||
|
@ -250,27 +219,8 @@ svr4_sys_sigaltstack(struct lwp *l, void *v, register_t *retval)
|
|||
syscallarg(const struct svr4_sigaltstack *) nss;
|
||||
syscallarg(struct svr4_sigaltstack *) oss;
|
||||
} */ *uap = v;
|
||||
struct svr4_sigaltstack nsss, osss;
|
||||
struct sigaltstack nbss, obss;
|
||||
int error;
|
||||
|
||||
if (SCARG(uap, nss)) {
|
||||
error = copyin(SCARG(uap, nss), &nsss, sizeof(nsss));
|
||||
if (error)
|
||||
return (error);
|
||||
svr4_to_native_sigaltstack(&nsss, &nbss);
|
||||
}
|
||||
error = sigaltstack1(l,
|
||||
SCARG(uap, nss) ? &nbss : 0, SCARG(uap, oss) ? &obss : 0);
|
||||
if (error)
|
||||
return (error);
|
||||
if (SCARG(uap, oss)) {
|
||||
native_to_svr4_sigaltstack(&obss, &osss);
|
||||
error = copyout(&osss, SCARG(uap, oss), sizeof(osss));
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
compat_sigaltstack(uap, svr4_sigaltstack,
|
||||
SVR4_SS_ONSTACK, SVR4_SS_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_32_signal.c,v 1.20 2007/03/16 22:21:43 dsl Exp $ */
|
||||
/* $NetBSD: svr4_32_signal.c,v 1.21 2007/06/16 20:04:29 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.20 2007/03/16 22:21:43 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.21 2007/06/16 20:04:29 dsl Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_svr4.h"
|
||||
|
@ -65,6 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: svr4_32_signal.c,v 1.20 2007/03/16 22:21:43 dsl Exp
|
|||
#include <compat/svr4_32/svr4_32_syscallargs.h>
|
||||
#include <compat/svr4_32/svr4_32_util.h>
|
||||
|
||||
#include <compat/common/compat_sigaltstack.h>
|
||||
|
||||
#define svr4_sigmask(n) (1 << (((n) - 1) & 31))
|
||||
#define svr4_sigword(n) (((n) - 1) >> 5)
|
||||
#define svr4_sigemptyset(s) memset((s), 0, sizeof(*(s)))
|
||||
|
@ -314,39 +316,6 @@ native_to_svr4_32_sigaction(bsa, ssa)
|
|||
ssa->svr4_32_sa_flags |= SVR4_SA_NOCLDSTOP;
|
||||
}
|
||||
|
||||
void
|
||||
svr4_32_to_native_sigaltstack(sss, bss)
|
||||
const struct svr4_32_sigaltstack *sss;
|
||||
struct sigaltstack *bss;
|
||||
{
|
||||
|
||||
bss->ss_sp = NETBSD32PTR64(sss->ss_sp);
|
||||
bss->ss_size = sss->ss_size;
|
||||
bss->ss_flags = 0;
|
||||
if ((sss->ss_flags & SVR4_SS_DISABLE) != 0)
|
||||
bss->ss_flags |= SS_DISABLE;
|
||||
if ((sss->ss_flags & SVR4_SS_ONSTACK) != 0)
|
||||
bss->ss_flags |= SS_ONSTACK;
|
||||
if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0)
|
||||
/*XXX*/ printf("svr4_to_native_sigaltstack: extra bits %x ignored\n",
|
||||
sss->ss_flags & ~SVR4_SS_ALLBITS);
|
||||
}
|
||||
|
||||
void
|
||||
native_to_svr4_32_sigaltstack(bss, sss)
|
||||
const struct sigaltstack *bss;
|
||||
struct svr4_32_sigaltstack *sss;
|
||||
{
|
||||
|
||||
NETBSD32PTR32(sss->ss_sp, bss->ss_sp);
|
||||
sss->ss_size = bss->ss_size;
|
||||
sss->ss_flags = 0;
|
||||
if ((bss->ss_flags & SS_DISABLE) != 0)
|
||||
sss->ss_flags |= SVR4_SS_DISABLE;
|
||||
if ((bss->ss_flags & SS_ONSTACK) != 0)
|
||||
sss->ss_flags |= SVR4_SS_ONSTACK;
|
||||
}
|
||||
|
||||
int
|
||||
svr4_32_sys_sigaction(l, v, retval)
|
||||
struct lwp *l;
|
||||
|
@ -392,36 +361,11 @@ svr4_32_sys_sigaltstack(l, v, retval)
|
|||
register_t *retval;
|
||||
{
|
||||
struct svr4_32_sys_sigaltstack_args /* {
|
||||
syscallarg(const struct svr4_32_sigaltstack *) nss;
|
||||
syscallarg(struct svr4_32_sigaltstack *) oss;
|
||||
syscallarg(const struct svr4_32_sigaltstack_tp) nss;
|
||||
syscallarg(struct svr4_32_sigaltstack_tp) oss;
|
||||
} */ *uap = v;
|
||||
struct svr4_32_sigaltstack nsss, osss;
|
||||
struct sigaltstack nbss, obss;
|
||||
struct proc *p;
|
||||
int error;
|
||||
|
||||
if (SCARG_P32(uap, nss)) {
|
||||
error = copyin(SCARG_P32(uap, nss),
|
||||
&nsss, sizeof(nsss));
|
||||
if (error)
|
||||
return (error);
|
||||
p = l->l_proc;
|
||||
mutex_enter(&p->p_smutex);
|
||||
svr4_32_to_native_sigaltstack(&nsss, &nbss);
|
||||
mutex_exit(&p->p_smutex);
|
||||
}
|
||||
error = sigaltstack1(l,
|
||||
SCARG_P32(uap, nss) ? &nbss : 0, SCARG_P32(uap, oss) ? &obss : 0);
|
||||
if (error)
|
||||
return (error);
|
||||
if (SCARG_P32(uap, oss)) {
|
||||
native_to_svr4_32_sigaltstack(&obss, &osss);
|
||||
error = copyout(&osss, SCARG_P32(uap, oss),
|
||||
sizeof(osss));
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
compat_sigaltstack(uap, svr4_32_sigaltstack,
|
||||
SVR4_SS_ONSTACK, SVR4_SS_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -690,8 +634,13 @@ svr4_32_setcontext(l, uc)
|
|||
mutex_enter(&p->p_smutex);
|
||||
|
||||
/* set signal stack */
|
||||
if (uc->uc_flags & SVR4_UC_STACK)
|
||||
svr4_32_to_native_sigaltstack(&uc->uc_stack, &l->l_sigstk);
|
||||
if (uc->uc_flags & SVR4_UC_STACK) {
|
||||
l->l_sigstk.ss_sp = NETBSD32PTR64(uc->uc_stack.ss_sp);
|
||||
l->l_sigstk.ss_size = uc->uc_stack.ss_size;
|
||||
l->l_sigstk.ss_flags =
|
||||
(uc->uc_stack.ss_flags & SVR4_SS_ONSTACK ? SS_ONSTACK : 0) |
|
||||
(uc->uc_stack.ss_flags & SVR4_SS_DISABLE ? SS_DISABLE : 0);
|
||||
}
|
||||
|
||||
/* set signal mask */
|
||||
if (uc->uc_flags & SVR4_UC_SIGMASK) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_32_types.h,v 1.4 2007/03/04 07:54:10 christos Exp $ */
|
||||
/* $NetBSD: svr4_32_types.h,v 1.5 2007/06/16 20:04:29 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,7 @@ typedef int svr4_32_key_t;
|
|||
typedef struct netbsd32_timespec svr4_32_timestruc_t;
|
||||
|
||||
/* Pointer types used by svr4_32_syscallargs.h */
|
||||
#define PTR typedef netbsd32_caddr_t
|
||||
#define PTR typedef netbsd32_pointer_t
|
||||
PTR svr4_32_utimbufp;
|
||||
PTR svr4_32_tms_tp;
|
||||
PTR svr4_32_strbuf_tp;
|
||||
|
|
Loading…
Reference in New Issue