Invoke the proper signal trampoline depending on SA_SIGINFO.
This commit is contained in:
parent
60ff688f72
commit
20745b5469
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: __sigaction14_sigtramp.c,v 1.2 2003/01/18 11:12:55 thorpej Exp $ */
|
||||
/* $NetBSD: __sigaction14_sigtramp.c,v 1.3 2003/09/27 01:03:40 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -39,7 +39,9 @@
|
|||
#define __LIBC12_SOURCE__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
|
@ -48,13 +50,31 @@ __weak_alias(__sigaction14, __libc_sigaction14)
|
|||
int
|
||||
__libc_sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
{
|
||||
extern int __sigtramp_sigcontext_1[];
|
||||
extern const int __sigtramp_sigcontext_1[];
|
||||
extern const int __sigtramp_siginfo_2[];
|
||||
int rv;
|
||||
|
||||
/*
|
||||
* Right here we should select the SA_SIGINFO trampoline
|
||||
* if SA_SIGINFO is set in the sigaction.
|
||||
* If no sigaction, use the "default" trampoline since it won't
|
||||
* be used.
|
||||
*/
|
||||
if (act == NULL)
|
||||
return __sigaction_sigtramp(sig, act, oact, NULL, 0);
|
||||
|
||||
return (__sigaction_sigtramp(sig, act, oact,
|
||||
__sigtramp_sigcontext_1, 1));
|
||||
/*
|
||||
* 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 specificed 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