modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/signal.h (about) 1 /* Copyright (C) 1991-2016 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 /* 19 * ISO C99 Standard: 7.14 Signal handling <signal.h> 20 */ 21 22 #ifndef _SIGNAL_H 23 24 #if !defined __need_sig_atomic_t && !defined __need_sigset_t 25 #define _SIGNAL_H 26 #endif 27 28 #include <features.h> 29 30 __BEGIN_DECLS 31 #include <bits/sigset.h> /* __sigset_t, __sig_atomic_t. */ 32 /* An integral type that can be modified atomically, without the 33 possibility of a signal arriving in the middle of the operation. */ 34 #if defined __need_sig_atomic_t || defined _SIGNAL_H 35 #ifndef __sig_atomic_t_defined 36 #define __sig_atomic_t_defined 37 __BEGIN_NAMESPACE_STD typedef __sig_atomic_t sig_atomic_t; 38 __END_NAMESPACE_STD 39 #endif 40 #undef __need_sig_atomic_t 41 #endif 42 #if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX) 43 #ifndef __sigset_t_defined 44 #define __sigset_t_defined 45 typedef __sigset_t sigset_t; 46 #endif 47 #undef __need_sigset_t 48 #endif 49 50 #ifdef _SIGNAL_H 51 52 #include <bits/types.h> 53 #include <bits/signum.h> 54 55 #if defined __USE_XOPEN || defined __USE_XOPEN2K 56 #ifndef __pid_t_defined 57 typedef __pid_t pid_t; 58 #define __pid_t_defined 59 #endif 60 #ifdef __USE_XOPEN 61 #endif 62 #ifndef __uid_t_defined 63 typedef __uid_t uid_t; 64 #define __uid_t_defined 65 #endif 66 #endif /* Unix98 */ 67 68 #ifdef __USE_POSIX199309 69 /* We need `struct timespec' later on. */ 70 #define __need_timespec 71 #include <time.h> 72 #endif 73 74 #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED 75 /* Get the `siginfo_t' type plus the needed symbols. */ 76 #include <bits/siginfo.h> 77 #endif 78 79 /* Type of a signal handler. */ 80 typedef void (*__sighandler_t) (int); 81 82 /* The X/Open definition of `signal' specifies the SVID semantic. Use 83 the additional function `sysv_signal' when X/Open compatibility is 84 requested. */ 85 extern __sighandler_t __sysv_signal(int __sig, __sighandler_t __handler) __THROW; 86 #ifdef __USE_GNU 87 extern __sighandler_t sysv_signal(int __sig, __sighandler_t __handler) __THROW; 88 #endif 89 90 /* Set the handler for the signal SIG to HANDLER, returning the old 91 handler, or SIG_ERR on error. 92 By default `signal' has the BSD semantic. */ 93 __BEGIN_NAMESPACE_STD 94 #ifdef __USE_MISC 95 extern __sighandler_t signal(int __sig, __sighandler_t __handler) __THROW; 96 #else 97 /* Make sure the used `signal' implementation is the SVID version. */ 98 #ifdef __REDIRECT_NTH 99 extern __sighandler_t __REDIRECT_NTH(signal, (int __sig, __sighandler_t __handler), __sysv_signal); 100 #else 101 #define signal __sysv_signal 102 #endif 103 #endif 104 __END_NAMESPACE_STD 105 #ifdef __USE_XOPEN 106 /* The X/Open definition of `signal' conflicts with the BSD version. 107 So they defined another function `bsd_signal'. */ 108 extern __sighandler_t bsd_signal(int __sig, __sighandler_t __handler) __THROW; 109 #endif 110 111 /* Send signal SIG to process number PID. If PID is zero, 112 send SIG to all processes in the current process's process group. 113 If PID is < -1, send SIG to all processes in process group - PID. */ 114 #ifdef __USE_POSIX 115 extern int kill(__pid_t __pid, int __sig) __THROW; 116 #endif /* Use POSIX. */ 117 118 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 119 /* Send SIG to all processes in process group PGRP. 120 If PGRP is zero, send SIG to all processes in 121 the current process's process group. */ 122 extern int killpg(__pid_t __pgrp, int __sig) __THROW; 123 #endif /* Use misc || X/Open Unix. */ 124 125 __BEGIN_NAMESPACE_STD 126 /* Raise signal SIG, i.e., send SIG to yourself. */ 127 extern int raise(int __sig) __THROW; 128 __END_NAMESPACE_STD 129 #ifdef __USE_MISC 130 /* SVID names for the same things. */ 131 extern __sighandler_t ssignal(int __sig, __sighandler_t __handler) __THROW; 132 extern int gsignal(int __sig) __THROW; 133 #endif /* Use misc. */ 134 135 #ifdef __USE_XOPEN2K8 136 /* Print a message describing the meaning of the given signal number. */ 137 extern void psignal(int __sig, const char *__s); 138 139 /* Print a message describing the meaning of the given signal information. */ 140 extern void psiginfo(const siginfo_t * __pinfo, const char *__s); 141 #endif /* POSIX 2008. */ 142 143 /* The `sigpause' function in X/Open defines the argument as the 144 signal number. This requires redirecting to another function 145 because the default version in glibc uses an old BSD interface. 146 147 This function is a cancellation point and therefore not marked with 148 __THROW. */ 149 150 #ifdef __USE_XOPEN 151 #ifdef __GNUC__ 152 extern int sigpause(int __sig) __asm__("__xpg_sigpause"); 153 #else 154 extern int __sigpause(int __sig_or_mask, int __is_sig); 155 /* Remove a signal from the signal mask and suspend the process. */ 156 #define sigpause(sig) __sigpause ((sig), 1) 157 #endif 158 #endif 159 160 #ifdef __USE_MISC 161 /* None of the following functions should be used anymore. They are here 162 only for compatibility. A single word (`int') is not guaranteed to be 163 enough to hold a complete signal mask and therefore these functions 164 simply do not work in many situations. Use `sigprocmask' instead. */ 165 166 /* Compute mask for signal SIG. */ 167 #define sigmask(sig) __sigmask(sig) 168 169 /* Block signals in MASK, returning the old mask. */ 170 extern int sigblock(int __mask) 171 __THROW __attribute_deprecated__; 172 173 /* Set the mask of blocked signals to MASK, returning the old mask. */ 174 extern int sigsetmask(int __mask) 175 __THROW __attribute_deprecated__; 176 177 /* Return currently selected signal mask. */ 178 extern int siggetmask(void) 179 __THROW __attribute_deprecated__; 180 #endif /* Use misc. */ 181 182 #ifdef __USE_MISC 183 #define NSIG _NSIG 184 #endif 185 186 #ifdef __USE_GNU 187 typedef __sighandler_t sighandler_t; 188 #endif 189 190 /* 4.4 BSD uses the name `sig_t' for this. */ 191 #ifdef __USE_MISC 192 typedef __sighandler_t sig_t; 193 #endif 194 195 #ifdef __USE_POSIX 196 197 /* Clear all signals from SET. */ 198 extern int sigemptyset(sigset_t * __set) 199 __THROW __nonnull((1)); 200 201 /* Set all signals in SET. */ 202 extern int sigfillset(sigset_t * __set) 203 __THROW __nonnull((1)); 204 205 /* Add SIGNO to SET. */ 206 extern int sigaddset(sigset_t * __set, int __signo) 207 __THROW __nonnull((1)); 208 209 /* Remove SIGNO from SET. */ 210 extern int sigdelset(sigset_t * __set, int __signo) 211 __THROW __nonnull((1)); 212 213 /* Return 1 if SIGNO is in SET, 0 if not. */ 214 extern int sigismember(const sigset_t * __set, int __signo) 215 __THROW __nonnull((1)); 216 217 #ifdef __USE_GNU 218 /* Return non-empty value is SET is not empty. */ 219 extern int sigisemptyset(const sigset_t * __set) 220 __THROW __nonnull((1)); 221 222 /* Build new signal set by combining the two inputs set using logical AND. */ 223 extern int sigandset(sigset_t * __set, const sigset_t * __left, const sigset_t * __right) 224 __THROW __nonnull((1, 2, 3)); 225 226 /* Build new signal set by combining the two inputs set using logical OR. */ 227 extern int sigorset(sigset_t * __set, const sigset_t * __left, const sigset_t * __right) 228 __THROW __nonnull((1, 2, 3)); 229 #endif /* GNU */ 230 231 /* Get the system-specific definitions of `struct sigaction' 232 and the `SA_*' and `SIG_*'. constants. */ 233 #include <bits/sigaction.h> 234 235 /* Get and/or change the set of blocked signals. */ 236 extern int sigprocmask(int __how, const sigset_t * __restrict __set, sigset_t * __restrict __oset) __THROW; 237 238 /* Change the set of blocked signals to SET, 239 wait until a signal arrives, and restore the set of blocked signals. 240 241 This function is a cancellation point and therefore not marked with 242 __THROW. */ 243 extern int sigsuspend(const sigset_t * __set) __nonnull((1)); 244 245 /* Get and/or set the action for signal SIG. */ 246 extern int sigaction(int __sig, const struct sigaction *__restrict __act, struct sigaction *__restrict __oact) __THROW; 247 248 /* Put in SET all signals that are blocked and waiting to be delivered. */ 249 extern int sigpending(sigset_t * __set) 250 __THROW __nonnull((1)); 251 252 /* Select any of pending signals from SET or wait for any to arrive. 253 254 This function is a cancellation point and therefore not marked with 255 __THROW. */ 256 extern int sigwait(const sigset_t * __restrict __set, int *__restrict __sig) __nonnull((1, 2)); 257 258 #ifdef __USE_POSIX199309 259 /* Select any of pending signals from SET and place information in INFO. 260 261 This function is a cancellation point and therefore not marked with 262 __THROW. */ 263 extern int sigwaitinfo(const sigset_t * __restrict __set, siginfo_t * __restrict __info) __nonnull((1)); 264 265 /* Select any of pending signals from SET and place information in INFO. 266 Wait the time specified by TIMEOUT if no signal is pending. 267 268 This function is a cancellation point and therefore not marked with 269 __THROW. */ 270 extern int sigtimedwait(const sigset_t * __restrict __set, siginfo_t * __restrict __info, const struct timespec *__restrict __timeout) __nonnull((1)); 271 272 /* Send signal SIG to the process PID. Associate data in VAL with the 273 signal. */ 274 extern int sigqueue(__pid_t __pid, int __sig, const union sigval __val) __THROW; 275 #endif /* Use POSIX 199306. */ 276 277 #endif /* Use POSIX. */ 278 279 #ifdef __USE_MISC 280 281 /* Names of the signals. This variable exists only for compatibility. 282 Use `strsignal' instead (see <string.h>). */ 283 extern const char *const _sys_siglist[_NSIG]; 284 extern const char *const sys_siglist[_NSIG]; 285 286 /* Get machine-dependent `struct sigcontext' and signal subcodes. */ 287 #include <bits/sigcontext.h> 288 289 /* Restore the state saved in SCP. */ 290 extern int sigreturn(struct sigcontext *__scp) __THROW; 291 292 #endif /* Use misc. */ 293 294 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 295 #define __need_size_t 296 #include <stddef.h> 297 298 /* If INTERRUPT is nonzero, make signal SIG interrupt system calls 299 (causing them to fail with EINTR); if INTERRUPT is zero, make system 300 calls be restarted after signal SIG. */ 301 extern int siginterrupt(int __sig, int __interrupt) __THROW; 302 303 #include <bits/sigstack.h> 304 #if defined __USE_XOPEN || defined __USE_XOPEN2K8 305 /* This will define `ucontext_t' and `mcontext_t'. */ 306 #include <sys/ucontext.h> 307 #endif 308 309 /* Run signals handlers on the stack specified by SS (if not NULL). 310 If OSS is not NULL, it is filled in with the old signal stack status. 311 This interface is obsolete and on many platform not implemented. */ 312 extern int sigstack(struct sigstack *__ss, struct sigstack *__oss) 313 __THROW __attribute_deprecated__; 314 315 /* Alternate signal handler stack interface. 316 This interface should always be preferred over `sigstack'. */ 317 extern int sigaltstack(const struct sigaltstack *__restrict __ss, struct sigaltstack *__restrict __oss) __THROW; 318 319 #endif /* Use POSIX.1-2008 or X/Open Unix. */ 320 321 #ifdef __USE_XOPEN_EXTENDED 322 /* Simplified interface for signal management. */ 323 324 /* Add SIG to the calling process' signal mask. */ 325 extern int sighold(int __sig) __THROW; 326 327 /* Remove SIG from the calling process' signal mask. */ 328 extern int sigrelse(int __sig) __THROW; 329 330 /* Set the disposition of SIG to SIG_IGN. */ 331 extern int sigignore(int __sig) __THROW; 332 333 /* Set the disposition of SIG. */ 334 extern __sighandler_t sigset(int __sig, __sighandler_t __disp) __THROW; 335 #endif 336 337 #if defined __USE_POSIX199506 || defined __USE_UNIX98 338 /* Some of the functions for handling signals in threaded programs must 339 be defined here. */ 340 #include <bits/pthreadtypes.h> 341 #include <bits/sigthread.h> 342 #endif /* use Unix98 */ 343 344 /* The following functions are used internally in the C library and in 345 other code which need deep insights. */ 346 347 /* Return number of available real-time signal with highest priority. */ 348 extern int __libc_current_sigrtmin(void) __THROW; 349 /* Return number of available real-time signal with lowest priority. */ 350 extern int __libc_current_sigrtmax(void) __THROW; 351 352 #endif /* signal.h */ 353 354 __END_DECLS 355 #endif /* not signal.h */