Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/i386/sys use matt's powerpc implementation. It...
details: https://anonhg.NetBSD.org/src/rev/76959c5c592c
branches: trunk
changeset: 553193:76959c5c592c
user: christos <christos%NetBSD.org@localhost>
date: Sun Oct 12 04:23:17 2003 +0000
description:
use matt's powerpc implementation. It is simpler than mine, and it does
matter as far as performance goes.
diffstat:
lib/libc/arch/i386/sys/__sigaction14_sigtramp.c | 58 ++++++++++--------------
1 files changed, 25 insertions(+), 33 deletions(-)
diffs (84 lines):
diff -r e16cb17750d4 -r 76959c5c592c lib/libc/arch/i386/sys/__sigaction14_sigtramp.c
--- a/lib/libc/arch/i386/sys/__sigaction14_sigtramp.c Sun Oct 12 04:14:56 2003 +0000
+++ b/lib/libc/arch/i386/sys/__sigaction14_sigtramp.c Sun Oct 12 04:23:17 2003 +0000
@@ -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 no sigaction, use the "default" trampoline since it won't
+ * be used.
+ */
+ if (act == NULL)
+ return __sigaction_sigtramp(sig, act, oact, NULL, 0);
- if (have_sigreturn && act && (act->sa_flags & SA_SIGINFO) == 0)
- return __sigaction_sigtramp(sig, act, oact,
+ /*
+ * 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);
}
Home |
Main Index |
Thread Index |
Old Index