Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch/ns32k/sys This is the last part of siginfo sup...



details:   https://anonhg.NetBSD.org/src/rev/608d607a98ec
branches:  trunk
changeset: 554982:608d607a98ec
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 06 02:46:44 2003 +0000

description:
This is the last part of siginfo support for pc532. Simon will make this
work.

diffstat:

 lib/libc/arch/ns32k/sys/__sigaction14_sigtramp.c |  38 ++++++++++++++++++-----
 1 files changed, 29 insertions(+), 9 deletions(-)

diffs (61 lines):

diff -r 85be51af71b2 -r 608d607a98ec lib/libc/arch/ns32k/sys/__sigaction14_sigtramp.c
--- a/lib/libc/arch/ns32k/sys/__sigaction14_sigtramp.c  Thu Nov 06 02:28:00 2003 +0000
+++ b/lib/libc/arch/ns32k/sys/__sigaction14_sigtramp.c  Thu Nov 06 02:46:44 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: __sigaction14_sigtramp.c,v 1.1 2002/07/09 23:32:37 thorpej Exp $       */
+/*     $NetBSD: __sigaction14_sigtramp.c,v 1.2 2003/11/06 02:46:44 christos Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -36,23 +36,43 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define        __LIBC12_SOURCE__
-
 #include <sys/types.h>
+#include <stddef.h>
 #include <signal.h>
+#include <errno.h>
 
 #include "extern.h"
 
+__weak_alias(__sigaction14, __libc_sigaction14)
+
 int
-__sigaction14(int sig, const struct sigaction *act, struct sigaction *oact)
+__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 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