1 /* signals.h -- Header to include system dependent signal definitions.
2 $Id: signals.h,v 1.1.1.2 1998/03/22 20:42:55 law Exp $
4 This file is part of GNU Info, a program for reading online documentation
7 Copyright (C) 1993, 94, 95, 97 Free Software Foundation, Inc.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Written by Brian Fox (bfox@ai.mit.edu). */
25 #ifndef INFO_SIGNALS_H
26 #define INFO_SIGNALS_H
28 #include <sys/types.h>
31 /* For sysV68 --phdm@info.ucl.ac.be. */
32 #if !defined (SIGCHLD) && defined (SIGCLD)
33 #define SIGCHLD SIGCLD
36 #if !defined (HAVE_SIGPROCMASK) && !defined (sigmask)
37 # define sigmask(x) (1 << ((x)-1))
38 #endif /* !HAVE_SIGPROCMASK && !sigmask */
40 #if !defined (HAVE_SIGPROCMASK)
41 # if !defined (SIG_BLOCK)
42 # define SIG_UNBLOCK 1
44 # define SIG_SETMASK 3
45 # endif /* SIG_BLOCK */
47 /* Type of a signal set. */
50 /* Make SET have no signals in it. */
51 # define sigemptyset(set) (*(set) = (sigset_t)0x0)
53 /* Make SET have the full range of signal specifications possible. */
54 # define sigfillset(set) (*(set) = (sigset_t)0xffffffffff)
56 /* Add SIG to the contents of SET. */
57 # define sigaddset(set, sig) *(set) |= sigmask (sig)
59 /* Delete SIG from the contents of SET. */
60 # define sigdelset(set, sig) *(set) &= ~(sigmask (sig))
62 /* Tell if SET contains SIG. */
63 # define sigismember(set, sig) (*(set) & (sigmask (sig)))
65 /* Suspend the process until the reception of one of the signals
66 not present in SET. */
67 # define sigsuspend(set) sigpause (*(set))
68 #endif /* !HAVE_SIGPROCMASK */
70 #if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK)
71 /* These definitions are used both in POSIX and non-POSIX implementations. */
73 #define BLOCK_SIGNAL(sig) \
75 sigset_t nvar, ovar; \
76 sigemptyset (&nvar); \
77 sigemptyset (&ovar); \
78 sigaddset (&nvar, sig); \
79 sigprocmask (SIG_BLOCK, &nvar, &ovar); \
82 #define UNBLOCK_SIGNAL(sig) \
84 sigset_t nvar, ovar; \
85 sigemptyset (&ovar); \
86 sigemptyset (&nvar); \
87 sigaddset (&nvar, sig); \
88 sigprocmask (SIG_UNBLOCK, &nvar, &ovar); \
91 #else /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */
92 # define BLOCK_SIGNAL(sig)
93 # define UNBLOCK_SIGNAL(sig)
94 #endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */
96 #endif /* not INFO_SIGNALS_H */