diff lib/signal.in.h @ 10228:9b123d1aa781

Improve robustness of sigprocmask by overriding signal. * lib/signal.in.h (rpl_signal): Override signal when sigprocmask is in use. * lib/sigprocmask.c (blocked_handler): Reinstall block handler. (SIGKILL, SIGSTOP): Provide fallbacks. (rpl_signal): Implement. (old_handlers, blocked_set): Mark volatile, since sigprocmask and signal can be called inside handlers. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Sat, 21 Jun 2008 07:06:28 -0600
parents bbbbbf4cd1c5
children 29502a2dd08a
line wrap: on
line diff
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2006-2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -33,6 +33,10 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
+#if !@HAVE_POSIX_SIGNALBLOCKING@
+# include <sys/types.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -41,9 +45,6 @@
 
 #if !@HAVE_POSIX_SIGNALBLOCKING@
 
-/* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
-# include <sys/types.h>
-
 /* Maximum signal number + 1.  */
 # ifndef NSIG
 #  define NSIG 32
@@ -85,6 +86,11 @@
 # define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
 extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set);
 
+# define signal rpl_signal
+/* Install the handler FUNC for signal SIG, and return the previous
+   handler.  */
+extern void (*signal (int sig, void (*func) (int))) (int);
+
 #endif