Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/powerpc/sys Invoke the proper signal trampolin...



details:   https://anonhg.NetBSD.org/src/rev/0e8dd31d5df1
branches:  trunk
changeset: 552546:0e8dd31d5df1
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Sep 27 01:03:40 2003 +0000

description:
Invoke the proper signal trampoline depending on SA_SIGINFO.

diffstat:

 lib/libc/arch/powerpc/sys/__sigaction14_sigtramp.c |  32 +++++++++++++++++----
 1 files changed, 26 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r 140666386fd3 -r 0e8dd31d5df1 lib/libc/arch/powerpc/sys/__sigaction14_sigtramp.c
--- a/lib/libc/arch/powerpc/sys/__sigaction14_sigtramp.c        Sat Sep 27 00:58:32 2003 +0000
+++ b/lib/libc/arch/powerpc/sys/__sigaction14_sigtramp.c        Sat Sep 27 01:03:40 2003 +0000
@@ -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 @@
 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;
+
+       /*
+        * If no sigaction, use the "default" trampoline since it won't
+        * be used.
+        */
+       if (act == NULL)
+               return  __sigaction_sigtramp(sig, act, oact, NULL, 0);
 
        /*
-        * Right here we should select the SA_SIGINFO trampoline
-        * if SA_SIGINFO is set in the sigaction.
+        * 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;
+       }
 
-       return (__sigaction_sigtramp(sig, act, oact,
-                                    __sigtramp_sigcontext_1, 1));
+       /*
+        * 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);
 }



Home | Main Index | Thread Index | Old Index