bug-gnulib
[Top][All Lists]
Advanced

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

Re: sigaction, SA_SIGINFO, and SIG_IGN


From: Eric Blake
Subject: Re: sigaction, SA_SIGINFO, and SIG_IGN
Date: Mon, 23 Jun 2008 06:05:11 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 6/21/2008 4:31 PM:
| Done as follows, as part of committing sigaction.  It turns out that since
| mingw lacks struct sigaction, this only makes sense when using
| sigaction().  I named the helper file sig-handler.h.

I was a little overeager.  sigprocmask should not use sig-handler.h, since
it does not rely on sigaction (and can't, or that would be a recursive
module dependency), so it was failing to compile on mingw.  Checking in this:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhfkXcACgkQ84KuGfSFAYAC/wCfVaucD71JscZMnR9ZpTNvOJWB
QRgAoJCJaWzHA8EnNNwY2GjTLeuJmlEO
=0U1C
-----END PGP SIGNATURE-----
>From 748f9f2821b9c61a6a523564fce059ae8bec884f Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 23 Jun 2008 06:02:40 -0600
Subject: [PATCH] Revert use of sig-handler.h in sigprocmask.c.

* modules/sigprocmask (Files): Don't rely on sig-handler.h, since
it requires the existence of struct sigaction.
* lib/sigprocmask.c (handler_t): Restore typedef.
(rpl_signal, old_handlers): Use local type.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog           |    8 ++++++++
 lib/sigprocmask.c   |   12 ++++++------
 modules/sigprocmask |    1 -
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a3bdbfe..fe2dade 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-23  Eric Blake  <address@hidden>
+
+       Revert use of sig-handler.h in sigprocmask.c.
+       * modules/sigprocmask (Files): Don't rely on sig-handler.h, since
+       it requires the existence of struct sigaction.
+       * lib/sigprocmask.c (handler_t): Restore typedef.
+       (rpl_signal, old_handlers): Use local type.
+
 2008-06-22  Bruno Haible  <address@hidden>
 
        * tests/test-stdint.c: Disable the INTMAX_MAX preprocessor test
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c
index 54e9c68..d6daca6 100644
--- a/lib/sigprocmask.c
+++ b/lib/sigprocmask.c
@@ -24,8 +24,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 
-#include "sig-handler.h"
-
 /* We assume that a platform without POSIX signal blocking functions
    also does not have the POSIX sigaction() function, only the
    signal() function.  We also assume signal() has SysV semantics,
@@ -45,6 +43,8 @@
 # define SIGSTOP (-1)
 #endif
 
+typedef void (*handler_t) (int);
+
 int
 sigismember (const sigset_t *set, int sig)
 {
@@ -133,7 +133,7 @@ sigpending (sigset_t *set)
 
 /* The previous signal handlers.
    Only the array elements corresponding to blocked signals are relevant.  */
-static volatile sa_handler_t old_handlers[NSIG];
+static volatile handler_t old_handlers[NSIG];
 
 int
 sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
@@ -208,8 +208,8 @@ sigprocmask (int operation, const sigset_t *set, sigset_t 
*old_set)
 
 /* Install the handler FUNC for signal SIG, and return the previous
    handler.  */
-sa_handler_t
-rpl_signal (int sig, sa_handler_t handler)
+handler_t
+rpl_signal (int sig, handler_t handler)
 {
   /* We must provide a wrapper, so that a user can query what handler
      they installed even if that signal is currently blocked.  */
@@ -227,7 +227,7 @@ rpl_signal (int sig, sa_handler_t handler)
             stale information if it calls signal(B).  Oh well -
             signal handlers really shouldn't try to manipulate the
             installed handlers of unrelated signals.  */
-         sa_handler_t result = old_handlers[sig];
+         handler_t result = old_handlers[sig];
          old_handlers[sig] = handler;
          return result;
        }
diff --git a/modules/sigprocmask b/modules/sigprocmask
index 37adc63..e093112 100644
--- a/modules/sigprocmask
+++ b/modules/sigprocmask
@@ -3,7 +3,6 @@ POSIX compatible signal blocking.
 
 Files:
 lib/sigprocmask.c
-lib/sig-handler.h
 m4/signalblocking.m4
 
 Depends-on:
-- 
1.5.6


reply via email to

[Prev in Thread] Current Thread [Next in Thread]