GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / arm-brcm-linux-uclibcgnueabi / sysroot / usr / include / bits / sigset.h
blob92a542d61ae1b621ad6e3d8cbfcbbee0a40d3e7f
1 /* __sig_atomic_t, __sigset_t, and related definitions. Linux version.
2 Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _SIGSET_H_types
21 # define _SIGSET_H_types 1
23 typedef int __sig_atomic_t;
25 /* A 'sigset_t' has a bit for each signal.
26 * glibc has space for 1024 signals (!), but most arches supported
27 * by Linux have 64 signals, and only MIPS has 128.
28 * There seems to be some historical baggage in sparc[64]
29 * where they might have (or had in the past) 32 signals only,
30 * I hope it's irrelevant now.
31 * Signal 0 does not exist, so we have signals 1..64, not 0..63.
32 * In uclibc, kernel and userspace sigset_t is always the same.
33 * BTW, struct sigaction is also the same on kernel and userspace side.
35 #if defined(__mips__)
36 # define _SIGSET_NWORDS (128 / (8 * sizeof (unsigned long)))
37 #else
38 # define _SIGSET_NWORDS (64 / (8 * sizeof (unsigned long)))
39 #endif
40 typedef struct {
41 unsigned long __val[_SIGSET_NWORDS];
42 } __sigset_t;
44 #endif
47 /* We only want to define these functions if <signal.h> was actually
48 included; otherwise we were included just to define the types. Since we
49 are namespace-clean, it wouldn't hurt to define extra macros. But
50 trouble can be caused by functions being defined (e.g., any global
51 register vars declared later will cause compilation errors). */
53 #if !defined _SIGSET_H_fns && defined _SIGNAL_H
54 # define _SIGSET_H_fns 1
56 /* Return a mask that includes the bit for SIG only. */
57 /* Unsigned cast ensures shift/mask insns are used. */
58 # define __sigmask(sig) \
59 (((unsigned long) 1) << ((unsigned)((sig) - 1) % (8 * sizeof (unsigned long))))
61 /* Return the word index for SIG. */
62 # define __sigword(sig) ((unsigned)((sig) - 1) / (8 * sizeof (unsigned long)))
64 /* gcc 4.3.1 is not clever enough to optimize for _SIGSET_NWORDS == 1 and 2,
65 * which are about the only values which can be there */
67 # if defined __GNUC__ && __GNUC__ >= 2
68 # define __sigemptyset(set) \
69 (__extension__ ({ \
70 sigset_t *__set = (set); \
71 if (_SIGSET_NWORDS <= 2) { \
72 __set->__val[0] = 0; \
73 if (_SIGSET_NWORDS == 2) \
74 __set->__val[1] = 0; \
75 } else { \
76 int __cnt = _SIGSET_NWORDS; \
77 while (--__cnt >= 0) __set->__val[__cnt] = 0; \
78 } \
79 0; \
80 }))
81 # define __sigfillset(set) \
82 (__extension__ ({ \
83 sigset_t *__set = (set); \
84 if (_SIGSET_NWORDS <= 2) { \
85 __set->__val[0] = ~0UL; \
86 if (_SIGSET_NWORDS == 2) \
87 __set->__val[1] = ~0UL; \
88 } else { \
89 int __cnt = _SIGSET_NWORDS; \
90 while (--__cnt >= 0) __set->__val[__cnt] = ~0UL; \
91 } \
92 0; \
93 }))
95 # ifdef __USE_GNU
96 /* The POSIX does not specify for handling the whole signal set in one
97 command. This is often wanted and so we define three more functions
98 here. */
99 # define __sigisemptyset(set) \
100 (__extension__ ({ \
101 long __ret; \
102 const sigset_t *__set = (set); \
103 if (_SIGSET_NWORDS == 1) { \
104 __ret = __set->__val[0]; \
105 } else if (_SIGSET_NWORDS == 2) { \
106 __ret = __set->__val[0] | __set->__val[1]; \
107 } else { \
108 int __cnt = _SIGSET_NWORDS; \
109 __ret = __set->__val[--__cnt]; \
110 while (!__ret && --__cnt >= 0) \
111 __ret = __set->__val[__cnt]; \
113 __ret == 0; \
115 # define __sigandset(dest, left, right) \
116 (__extension__ ({ \
117 sigset_t *__dest = (dest); \
118 const sigset_t *__left = (left); \
119 const sigset_t *__right = (right); \
120 if (_SIGSET_NWORDS <= 2) { \
121 __dest->__val[0] = __left->__val[0] & __right->__val[0];\
122 if (_SIGSET_NWORDS == 2) \
123 __dest->__val[1] = __left->__val[1] & __right->__val[1];\
124 } else { \
125 int __cnt = _SIGSET_NWORDS; \
126 while (--__cnt >= 0) \
127 __dest->__val[__cnt] = (__left->__val[__cnt] \
128 & __right->__val[__cnt]); \
130 0; \
132 # define __sigorset(dest, left, right) \
133 (__extension__ ({ \
134 sigset_t *__dest = (dest); \
135 const sigset_t *__left = (left); \
136 const sigset_t *__right = (right); \
137 if (_SIGSET_NWORDS <= 2) { \
138 __dest->__val[0] = __left->__val[0] | __right->__val[0];\
139 if (_SIGSET_NWORDS == 2) \
140 __dest->__val[1] = __left->__val[1] | __right->__val[1];\
141 } else { \
142 int __cnt = _SIGSET_NWORDS; \
143 while (--__cnt >= 0) \
144 __dest->__val[__cnt] = (__left->__val[__cnt] \
145 | __right->__val[__cnt]); \
147 0; \
149 # endif
150 # endif
152 /* These functions needn't check for a bogus signal number -- error
153 checking is done in the non __ versions. */
155 # if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN
156 extern int __sigismember (__const __sigset_t *, int);
157 extern int __sigaddset (__sigset_t *, int);
158 extern int __sigdelset (__sigset_t *, int);
159 # endif
161 # ifdef __USE_EXTERN_INLINES
162 # undef _EXTERN_INLINE
163 # ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN
164 # define _EXTERN_INLINE
165 # else /* normal case */
166 /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES
167 * will have its own copy of out-of line function emitted. */
168 # define _EXTERN_INLINE /*extern*/ __always_inline
169 # endif
170 # define __SIGSETFN(NAME, BODY, CONST) \
171 _EXTERN_INLINE int \
172 NAME (CONST __sigset_t *__set, int __sig) \
174 unsigned long __mask = __sigmask (__sig); \
175 unsigned __word = __sigword (__sig); \
176 return BODY; \
179 __SIGSETFN (__sigismember, (__set->__val[__word] & __mask) ? 1 : 0, __const)
180 __SIGSETFN (__sigaddset, ((__set->__val[__word] |= __mask), 0), )
181 __SIGSETFN (__sigdelset, ((__set->__val[__word] &= ~__mask), 0), )
183 # undef __SIGSETFN
184 # endif
187 #endif /* ! _SIGSET_H_fns. */