use matt's powerpc implementation. It is simpler than mine, and it does
matter as far as performance goes.
This commit is contained in:
parent
e333b0fc0e
commit
7152fa1070
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __sigaction14_sigtramp.c,v 1.6 2003/09/12 20:42:15 christos Exp $ */
|
||||
/* $NetBSD: __sigaction14_sigtramp.c,v 1.7 2003/10/12 04:23:17 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,50 +37,42 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <stddef.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
__weak_alias(__sigaction14, __libc_sigaction14)
|
||||
|
||||
static int have_sigreturn = -1;
|
||||
|
||||
static void get_have_sigreturn(void);
|
||||
|
||||
extern int __sigtramp_siginfo_2[];
|
||||
extern int __sigtramp_sigcontext_1[];
|
||||
|
||||
static void
|
||||
get_have_sigreturn(void)
|
||||
{
|
||||
struct sigaction nsa, osa;
|
||||
|
||||
sigemptyset(&nsa.sa_mask);
|
||||
nsa.sa_flags = 0;
|
||||
nsa.sa_handler = SIG_IGN;
|
||||
|
||||
__sigaction_sigtramp(SIGSYS, &nsa, &osa, __sigtramp_siginfo_2, 2);
|
||||
|
||||
(void)syscall(SYS_compat_16___sigreturn14, NULL);
|
||||
have_sigreturn = errno == EFAULT;
|
||||
|
||||
__sigaction_sigtramp(SIGSYS, &osa, NULL, __sigtramp_siginfo_2, 2);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
__libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
{
|
||||
if (have_sigreturn == -1)
|
||||
get_have_sigreturn();
|
||||
extern const int __sigtramp_sigcontext_1[];
|
||||
extern const int __sigtramp_siginfo_2[];
|
||||
int rv;
|
||||
|
||||
if (have_sigreturn && act && (act->sa_flags & SA_SIGINFO) == 0)
|
||||
return __sigaction_sigtramp(sig, act, oact,
|
||||
/*
|
||||
* If no sigaction, use the "default" trampoline since it won't
|
||||
* be used.
|
||||
*/
|
||||
if (act == NULL)
|
||||
return __sigaction_sigtramp(sig, act, oact, NULL, 0);
|
||||
|
||||
/*
|
||||
* We select the non-SA_SIGINFO trampoline if SA_SIGINFO is not
|
||||
* set in the sigaction.
|
||||
*/
|
||||
if ((act->sa_flags & SA_SIGINFO) == 0) {
|
||||
rv = __sigaction_sigtramp(sig, act, oact,
|
||||
__sigtramp_sigcontext_1, 1);
|
||||
if (rv >= 0 || errno != EINVAL)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
* If SA_SIGINFO was specified or the compatibility trampolines
|
||||
* can't be used, use the siginfo trampoline.
|
||||
*/
|
||||
return __sigaction_sigtramp(sig, act, oact, __sigtramp_siginfo_2, 2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user