1 /* POSIX compatible signal blocking.
2 Copyright (C) 2006 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2006.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 #if ! HAVE_POSIX_SIGNALBLOCKING
23 /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
24 # include <sys/types.h>
28 /* Maximum signal number + 1. */
33 /* This code supports only 32 signals. */
36 /* A set or mask of signals. */
38 typedef unsigned int sigset_t;
41 /* Test whether a given signal is contained in a signal set. */
42 extern int sigismember (const sigset_t *set, int sig);
44 /* Initialize a signal set to the empty set. */
45 extern int sigemptyset (sigset_t *set);
47 /* Add a signal to a signal set. */
48 extern int sigaddset (sigset_t *set, int sig);
50 /* Remove a signal from a signal set. */
51 extern int sigdelset (sigset_t *set, int sig);
53 /* Fill a signal set with all possible signals. */
54 extern int sigfillset (sigset_t *set);
56 /* Return the set of those blocked signals that are pending. */
57 extern int sigpending (sigset_t *set);
59 /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
60 Then, if SET is not NULL, affect the current set of blocked signals by
61 combining it with *SET as indicated in OPERATION.
62 In this implementation, you are not allowed to change a signal handler
63 while the signal is blocked. */
64 # define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */
65 # define SIG_SETMASK 1 /* blocked_set = *set; */
66 # define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
67 extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set);