diff options
| author | christos <christos@NetBSD.org> | 2002-11-26 18:42:38 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2002-11-26 18:42:38 +0000 |
| commit | daa59d895703c1edded8cbd5272e52a540cb88ea (patch) | |
| tree | e0ca7cf83003528ef1c63332ddd42b4a29f03610 /sys/compat/linux | |
| parent | f176c534d22469deec7aed6fa45e3289f7c35400 (diff) | |
rename sa_ -> linux_sa_
first attempt at providing siginfo_t to the signal handler.
Diffstat (limited to 'sys/compat/linux')
| -rw-r--r-- | sys/compat/linux/arch/i386/linux_machdep.c | 29 | ||||
| -rw-r--r-- | sys/compat/linux/arch/i386/linux_machdep.h | 9 | ||||
| -rw-r--r-- | sys/compat/linux/arch/i386/linux_signal.h | 20 |
3 files changed, 35 insertions, 23 deletions
diff --git a/sys/compat/linux/arch/i386/linux_machdep.c b/sys/compat/linux/arch/i386/linux_machdep.c index b0d5b4eee27..d4dd5de2b52 100644 --- a/sys/compat/linux/arch/i386/linux_machdep.c +++ b/sys/compat/linux/arch/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.c,v 1.81 2002/10/09 05:07:55 junyoung Exp $ */ +/* $NetBSD: linux_machdep.c,v 1.82 2002/11/26 18:42:38 christos Exp $ */ /*- * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.81 2002/10/09 05:07:55 junyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.82 2002/11/26 18:42:38 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -192,18 +192,18 @@ linux_sendsig(sig, mask, code) struct linux_sigframe *fp, frame; int onstack; sig_t catcher = SIGACTION(p, sig).sa_handler; + struct sigaltstack *sas = &p->p_sigctx.ps_sigstk; tf = p->p_md.md_regs; /* Do we need to jump onto the signal stack? */ - onstack = - (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && + onstack = (sas->ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; /* Allocate space for the signal handler context. */ if (onstack) - fp = (struct linux_sigframe *)((caddr_t)p->p_sigctx.ps_sigstk.ss_sp + - p->p_sigctx.ps_sigstk.ss_size); + fp = (struct linux_sigframe *) ((caddr_t)sas->ss_sp + + sas->ss_size); else fp = (struct linux_sigframe *)tf->tf_esp; fp--; @@ -211,6 +211,12 @@ linux_sendsig(sig, mask, code) /* Build stack frame for signal trampoline. */ frame.sf_handler = catcher; frame.sf_sig = native_to_linux_signo[sig]; + frame.sf_sip = &fp->sf_si; + frame.sf_scp = &fp->sf_sc; + /* + * XXX: zero siginfo out until we provide more info. + */ + (void)memset(&frame.sf_si, 0, sizeof(frame.sf_si)); /* Save register context. */ #ifdef VM86 @@ -274,7 +280,7 @@ linux_sendsig(sig, mask, code) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + sas->ss_flags |= SS_ONSTACK; } /* @@ -310,6 +316,7 @@ linux_sys_sigreturn(p, v, retval) struct trapframe *tf; sigset_t mask; ssize_t ss_gap; + struct sigaltstack *sas = &p->p_sigctx.ps_sigstk; /* * The trampoline code hands us the context. @@ -366,11 +373,11 @@ linux_sys_sigreturn(p, v, retval) * to save the onstack flag. */ ss_gap = (ssize_t) - ((caddr_t) context.sc_esp_at_signal - (caddr_t) p->p_sigctx.ps_sigstk.ss_sp); - if (ss_gap >= 0 && ss_gap < p->p_sigctx.ps_sigstk.ss_size) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + ((caddr_t) context.sc_esp_at_signal - (caddr_t) sas->ss_sp); + if (ss_gap >= 0 && ss_gap < sas->ss_size) + sas->ss_flags |= SS_ONSTACK; else - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + sas->ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ linux_old_to_native_sigset(&mask, &context.sc_mask); diff --git a/sys/compat/linux/arch/i386/linux_machdep.h b/sys/compat/linux/arch/i386/linux_machdep.h index 0885bd95f27..f79422bad21 100644 --- a/sys/compat/linux/arch/i386/linux_machdep.h +++ b/sys/compat/linux/arch/i386/linux_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_machdep.h,v 1.23 2002/09/06 13:18:43 gehenna Exp $ */ +/* $NetBSD: linux_machdep.h,v 1.24 2002/11/26 18:42:38 christos Exp $ */ /*- * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc. @@ -39,7 +39,9 @@ #ifndef _I386_LINUX_MACHDEP_H #define _I386_LINUX_MACHDEP_H +#include <compat/linux/common/linux_types.h> #include <compat/linux/common/linux_signal.h> +#include <compat/linux/common/linux_siginfo.h> /* * The Linux sigcontext, pretty much a standard 386 trapframe. @@ -80,8 +82,11 @@ struct linux_sigcontext { struct linux_sigframe { int sf_sig; - struct linux_sigcontext sf_sc; + struct linux_siginfo *sf_sip; + struct linux_sigcontext *sf_scp; sig_t sf_handler; + struct linux_siginfo sf_si; + struct linux_sigcontext sf_sc; }; #ifdef _KERNEL diff --git a/sys/compat/linux/arch/i386/linux_signal.h b/sys/compat/linux/arch/i386/linux_signal.h index 2dd0a521bd0..66b0b0ba219 100644 --- a/sys/compat/linux/arch/i386/linux_signal.h +++ b/sys/compat/linux/arch/i386/linux_signal.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_signal.h,v 1.11 2002/03/19 20:51:59 christos Exp $ */ +/* $NetBSD: linux_signal.h,v 1.12 2002/11/26 18:42:38 christos Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -106,23 +106,23 @@ typedef struct { } linux_sigset_t; struct linux_old_sigaction { - linux_handler_t sa_handler; - linux_old_sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer) __P((void)); + linux_handler_t linux_sa_handler; + linux_old_sigset_t linux_sa_mask; + unsigned long linux_sa_flags; + void (*linux_sa_restorer) __P((void)); }; /* Used in rt_* calls */ struct linux_sigaction { - linux_handler_t sa_handler; - unsigned long sa_flags; - void (*sa_restorer) __P((void)); - linux_sigset_t sa_mask; + linux_handler_t linux_sa_handler; + unsigned long linux_sa_flags; + void (*linux_sa_restorer) __P((void)); + linux_sigset_t linux_sa_mask; }; struct linux_k_sigaction { struct linux_sigaction sa; -#define k_sa_restorer sa.sa_restorer +#define k_sa_restorer sa.linux_sa_restorer }; #define LINUX_SS_ONSTACK 1 |
