1/* signals.h -- Header to include system dependent signal definitions. 2 $Id: signals.h,v 1.1 2004/10/28 18:14:09 zooey Exp $ 3 4 This file is part of GNU Info, a program for reading online documentation 5 stored in Info format. 6 7 Copyright (C) 1993, 94, 95, 97 Free Software Foundation, Inc. 8 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) 12 any later version. 13 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. 18 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. 22 23 Written by Brian Fox (bfox@ai.mit.edu). */ 24 25#ifndef INFO_SIGNALS_H 26#define INFO_SIGNALS_H 27 28#include <sys/types.h> 29#include <signal.h> 30 31/* For sysV68 --phdm@info.ucl.ac.be. */ 32#if !defined (SIGCHLD) && defined (SIGCLD) 33#define SIGCHLD SIGCLD 34#endif 35 36#if !defined (HAVE_SIGPROCMASK) && !defined (sigmask) 37# define sigmask(x) (1 << ((x)-1)) 38#endif /* !HAVE_SIGPROCMASK && !sigmask */ 39 40#if !defined (HAVE_SIGPROCMASK) 41# if !defined (SIG_BLOCK) 42# define SIG_UNBLOCK 1 43# define SIG_BLOCK 2 44# define SIG_SETMASK 3 45# endif /* SIG_BLOCK */ 46 47/* Type of a signal set. */ 48# define sigset_t int 49 50/* Make SET have no signals in it. */ 51# define sigemptyset(set) (*(set) = (sigset_t)0x0) 52 53/* Make SET have the full range of signal specifications possible. */ 54# define sigfillset(set) (*(set) = (sigset_t)0xffffffffff) 55 56/* Add SIG to the contents of SET. */ 57# define sigaddset(set, sig) *(set) |= sigmask (sig) 58 59/* Delete SIG from the contents of SET. */ 60# define sigdelset(set, sig) *(set) &= ~(sigmask (sig)) 61 62/* Tell if SET contains SIG. */ 63# define sigismember(set, sig) (*(set) & (sigmask (sig))) 64 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 */ 69 70#if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK) 71/* These definitions are used both in POSIX and non-POSIX implementations. */ 72 73#define BLOCK_SIGNAL(sig) \ 74 do { \ 75 sigset_t nvar, ovar; \ 76 sigemptyset (&nvar); \ 77 sigemptyset (&ovar); \ 78 sigaddset (&nvar, sig); \ 79 sigprocmask (SIG_BLOCK, &nvar, &ovar); \ 80 } while (0) 81 82#define UNBLOCK_SIGNAL(sig) \ 83 do { \ 84 sigset_t nvar, ovar; \ 85 sigemptyset (&ovar); \ 86 sigemptyset (&nvar); \ 87 sigaddset (&nvar, sig); \ 88 sigprocmask (SIG_UNBLOCK, &nvar, &ovar); \ 89 } while (0) 90 91#else /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */ 92# define BLOCK_SIGNAL(sig) 93# define UNBLOCK_SIGNAL(sig) 94#endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */ 95 96#endif /* not INFO_SIGNALS_H */ 97