]> sourceware.org Git - glibc.git/blame - sysdeps/generic/sigset.h
Update.
[glibc.git] / sysdeps / generic / sigset.h
CommitLineData
28f540f4 1/* __sig_atomic_t, __sigset_t, and related definitions. Generic/BSD version.
54d79e99
UD
2 Copyright (C) 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
28f540f4 4
54d79e99
UD
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
28f540f4 9
54d79e99
UD
10 The GNU C Library 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 GNU
13 Library General Public License for more details.
28f540f4 14
54d79e99
UD
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
28f540f4
RM
19
20#ifndef _SIGSET_H_types
21#define _SIGSET_H_types 1
22
23typedef int __sig_atomic_t;
24
25/* A `sigset_t' has a bit for each signal. */
26typedef unsigned long int __sigset_t;
27
28#endif
29
30
31/* We only want to define these functions if <signal.h> was actually
32 included; otherwise we were included just to define the types. Since we
33 are namespace-clean, it wouldn't hurt to define extra macros. But
34 trouble can be caused by functions being defined (e.g., any global
35 register vars declared later will cause compilation errors). */
36
37#if !defined (_SIGSET_H_fns) && defined (_SIGNAL_H)
38#define _SIGSET_H_fns 1
39
84384f5b
UD
40#ifndef _EXTERN_INLINE
41#define _EXTERN_INLINE extern __inline
42#endif
43
28f540f4
RM
44/* Return a mask that includes SIG only. The cast to `sigset_t' avoids
45 overflow if `sigset_t' is wider than `int'. */
46#define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1))
47
48#define __sigemptyset(set) ((*(set) = (__sigset_t) 0), 0)
49#define __sigfillset(set) ((*(set) = ~(__sigset_t) 0), 0)
50
84384f5b
UD
51/* These functions needn't check for a bogus signal number -- error
52 checking is done in the non __ versions. */
28f540f4 53
26761c28
UD
54extern int __sigismember (__const __sigset_t *, int);
55extern int __sigaddset (__sigset_t *, int);
56extern int __sigdelset (__sigset_t *, int);
510ca033 57
28f540f4
RM
58#define __SIGSETFN(NAME, BODY, CONST) \
59 _EXTERN_INLINE int \
84384f5b 60 NAME (CONST __sigset_t *__set, int __sig) \
28f540f4 61 { \
84384f5b
UD
62 __sigset_t __mask = __sigmask (__sig); \
63 return BODY; \
28f540f4
RM
64 }
65
84384f5b
UD
66__SIGSETFN (__sigismember, (*__set & __mask) ? 1 : 0, __const)
67__SIGSETFN (__sigaddset, ((*__set |= __mask), 0), )
68__SIGSETFN (__sigdelset, ((*__set &= ~__mask), 0), )
28f540f4
RM
69
70#undef __SIGSETFN
71
72
73#endif /* ! _SIGSET_H_fns. */
This page took 0.070769 seconds and 5 git commands to generate.