+2008-10-20 Bruno Haible <bruno@clisp.org>
+
+ Take into account the role of SIGABRT_COMPAT on Windows 2008.
+ * lib/sigprocmask.c (SIGABRT_COMPAT, SIGABRT_COMPAT_MASK): New macros.
+ (sigismember, sigaddset, sigdelset, sigfillset, rpl_signal): Handle it
+ as an alias for SIGABRT.
+ * lib/sigaction.c (SIGABRT_COMPAT): New macro.
+ (sigaction): Map it to SIGABRT.
+ Reported by Ramiro Polla <ramiro.polla@gmail.com> via Eric Blake.
+
2008-10-20 Bruno Haible <bruno@clisp.org>
* lib/fts.c: Don't include lstat.h.
# define SIGSTOP (-1)
#endif
+/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias
+ for the signal SIGABRT. Only one signal handler is stored for both
+ SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# undef SIGABRT_COMPAT
+# define SIGABRT_COMPAT 6
+#endif
+
/* A signal handler. */
typedef void (*handler_t) (int signal);
return -1;
}
+ #ifdef SIGABRT_COMPAT
+ if (sig == SIGABRT_COMPAT)
+ sig = SIGABRT;
+ #endif
+
/* POSIX requires sigaction() to be async-signal-safe. In other
words, if an asynchronous signal can occur while we are anywhere
inside this function, the user's handler could then call
# define SIGSTOP (-1)
#endif
+/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias
+ for the signal SIGABRT. Only one signal handler is stored for both
+ SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# undef SIGABRT_COMPAT
+# define SIGABRT_COMPAT 6
+#endif
+#ifdef SIGABRT_COMPAT
+# define SIGABRT_COMPAT_MASK (1U << SIGABRT_COMPAT)
+#else
+# define SIGABRT_COMPAT_MASK 0
+#endif
+
typedef void (*handler_t) (int);
/* Handling of gnulib defined signals. */
sigismember (const sigset_t *set, int sig)
{
if (sig >= 0 && sig < NSIG)
- return (*set >> sig) & 1;
+ {
+ #ifdef SIGABRT_COMPAT
+ if (sig == SIGABRT_COMPAT)
+ sig = SIGABRT;
+ #endif
+
+ return (*set >> sig) & 1;
+ }
else
return 0;
}
{
if (sig >= 0 && sig < NSIG)
{
+ #ifdef SIGABRT_COMPAT
+ if (sig == SIGABRT_COMPAT)
+ sig = SIGABRT;
+ #endif
+
*set |= 1U << sig;
return 0;
}
{
if (sig >= 0 && sig < NSIG)
{
+ #ifdef SIGABRT_COMPAT
+ if (sig == SIGABRT_COMPAT)
+ sig = SIGABRT;
+ #endif
+
*set &= ~(1U << sig);
return 0;
}
}
}
+
int
sigfillset (sigset_t *set)
{
- *set = (2U << (NSIG - 1)) - 1;
+ *set = ((2U << (NSIG - 1)) - 1) & ~ SIGABRT_COMPAT_MASK;
return 0;
}
if (sig >= 0 && sig < NSIG && sig != SIGKILL && sig != SIGSTOP
&& handler != SIG_ERR)
{
+ #ifdef SIGABRT_COMPAT
+ if (sig == SIGABRT_COMPAT)
+ sig = SIGABRT;
+ #endif
+
if (blocked_set & (1U << sig))
{
/* POSIX states that sigprocmask and signal are both