Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12


signal.h
001: /* Copyright (C) 1991-2004, 2007, 2009, 2010 Free Software Foundation, Inc.
002:    This file is part of the GNU C Library.
003: 
004:    The GNU C Library is free software; you can redistribute it and/or
005:    modify it under the terms of the GNU Lesser General Public
006:    License as published by the Free Software Foundation; either
007:    version 2.1 of the License, or (at your option) any later version.
008: 
009:    The GNU C Library is distributed in the hope that it will be useful,
010:    but WITHOUT ANY WARRANTY; without even the implied warranty of
011:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:    Lesser General Public License for more details.
013: 
014:    You should have received a copy of the GNU Lesser General Public
015:    License along with the GNU C Library; if not, write to the Free
016:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
017:    02111-1307 USA.  */
018: 
019: /*
020:  *      ISO C99 Standard: 7.14 Signal handling <signal.h>
021:  */
022: 
023: #ifndef _SIGNAL_H
024: 
025: #if !defined __need_sig_atomic_t && !defined __need_sigset_t
026: # define _SIGNAL_H
027: #endif
028: 
029: #include <features.h>
030: 
031: __BEGIN_DECLS
032: 
033: #include <bits/sigset.h>                /* __sigset_t, __sig_atomic_t.  */
034: 
035: /* An integral type that can be modified atomically, without the
036:    possibility of a signal arriving in the middle of the operation.  */
037: #if defined __need_sig_atomic_t || defined _SIGNAL_H
038: # ifndef __sig_atomic_t_defined
039: #  define __sig_atomic_t_defined
040: __BEGIN_NAMESPACE_STD
041: typedef __sig_atomic_t sig_atomic_t;
042: __END_NAMESPACE_STD
043: # endif
044: # undef __need_sig_atomic_t
045: #endif
046: 
047: #if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX)
048: # ifndef __sigset_t_defined
049: #  define __sigset_t_defined
050: typedef __sigset_t sigset_t;
051: # endif
052: # undef __need_sigset_t
053: #endif
054: 
055: #ifdef _SIGNAL_H
056: 
057: #include <bits/types.h>
058: #include <bits/signum.h>
059: 
060: #if defined __USE_XOPEN || defined __USE_XOPEN2K
061: # ifndef __pid_t_defined
062: typedef __pid_t pid_t;
063: #  define __pid_t_defined
064: #endif
065: #ifdef __USE_XOPEN
066: # endif
067: # ifndef __uid_t_defined
068: typedef __uid_t uid_t;
069: #  define __uid_t_defined
070: # endif
071: #endif  /* Unix98 */
072: 
073: #ifdef __USE_POSIX199309
074: /* We need `struct timespec' later on.  */
075: # define __need_timespec
076: # include <time.h>
077: 
078: /* Get the `siginfo_t' type plus the needed symbols.  */
079: # include <bits/siginfo.h>
080: #endif
081: 
082: 
083: /* Type of a signal handler.  */
084: typedef void (*__sighandler_t) (int);
085: 
086: /* The X/Open definition of `signal' specifies the SVID semantic.  Use
087:    the additional function `sysv_signal' when X/Open compatibility is
088:    requested.  */
089: extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
090:      __THROW;
091: #ifdef __USE_GNU
092: extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
093:      __THROW;
094: #endif
095: 
096: /* Set the handler for the signal SIG to HANDLER, returning the old
097:    handler, or SIG_ERR on error.
098:    By default `signal' has the BSD semantic.  */
099: __BEGIN_NAMESPACE_STD
100: #ifdef __USE_BSD
101: extern __sighandler_t signal (int __sig, __sighandler_t __handler)
102:      __THROW;
103: #else
104: /* Make sure the used `signal' implementation is the SVID version. */
105: # ifdef __REDIRECT_NTH
106: extern __sighandler_t __REDIRECT_NTH (signal,
107:                                       (int __sig, __sighandler_t __handler),
108:                                       __sysv_signal);
109: # else
110: #  define signal __sysv_signal
111: # endif
112: #endif
113: __END_NAMESPACE_STD
114: 
115: #ifdef __USE_XOPEN
116: /* The X/Open definition of `signal' conflicts with the BSD version.
117:    So they defined another function `bsd_signal'.  */
118: extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
119:      __THROW;
120: #endif
121: 
122: /* Send signal SIG to process number PID.  If PID is zero,
123:    send SIG to all processes in the current process's process group.
124:    If PID is < -1, send SIG to all processes in process group - PID.  */
125: #ifdef __USE_POSIX
126: extern int kill (__pid_t __pid, int __sig) __THROW;
127: #endif /* Use POSIX.  */
128: 
129: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
130: /* Send SIG to all processes in process group PGRP.
131:    If PGRP is zero, send SIG to all processes in
132:    the current process's process group.  */
133: extern int killpg (__pid_t __pgrp, int __sig) __THROW;
134: #endif /* Use BSD || X/Open Unix.  */
135: 
136: __BEGIN_NAMESPACE_STD
137: /* Raise signal SIG, i.e., send SIG to yourself.  */
138: extern int raise (int __sig) __THROW;
139: __END_NAMESPACE_STD
140: 
141: #ifdef __USE_SVID
142: /* SVID names for the same things.  */
143: extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
144:      __THROW;
145: extern int gsignal (int __sig) __THROW;
146: #endif /* Use SVID.  */
147: 
148: #if defined __USE_MISC || defined __USE_XOPEN2K
149: /* Print a message describing the meaning of the given signal number.  */
150: extern void psignal (int __sig, __const char *__s);
151: #endif /* Use misc or POSIX 2008.  */
152: 
153: #ifdef __USE_XOPEN2K
154: /* Print a message describing the meaning of the given signal information.  */
155: extern void psiginfo (__const siginfo_t *__pinfo, __const char *__s);
156: #endif /* POSIX 2008.  */
157: 
158: 
159: 
160: /* The `sigpause' function has two different interfaces.  The original
161:    BSD definition defines the argument as a mask of the signal, while
162:    the more modern interface in X/Open defines it as the signal
163:    number.  We go with the BSD version unless the user explicitly
164:    selects the X/Open version.
165: 
166:    This function is a cancellation point and therefore not marked with
167:    __THROW.  */
168: extern int __sigpause (int __sig_or_mask, int __is_sig);
169: 
170: #ifdef __FAVOR_BSD
171: /* Set the mask of blocked signals to MASK,
172:    wait for a signal to arrive, and then restore the mask.  */
173: extern int sigpause (int __mask) __THROW __attribute_deprecated__;
174: #else
175: # ifdef __USE_XOPEN
176: #  ifdef __GNUC__
177: extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
178: #  else
179: /* Remove a signal from the signal mask and suspend the process.  */
180: #   define sigpause(sig) __sigpause ((sig), 1)
181: #  endif
182: # endif
183: #endif
184: 
185: 
186: #ifdef __USE_BSD
187: /* None of the following functions should be used anymore.  They are here
188:    only for compatibility.  A single word (`int') is not guaranteed to be
189:    enough to hold a complete signal mask and therefore these functions
190:    simply do not work in many situations.  Use `sigprocmask' instead.  */
191: 
192: /* Compute mask for signal SIG.  */
193: # define sigmask(sig)   __sigmask(sig)
194: 
195: /* Block signals in MASK, returning the old mask.  */
196: extern int sigblock (int __mask) __THROW __attribute_deprecated__;
197: 
198: /* Set the mask of blocked signals to MASK, returning the old mask.  */
199: extern int sigsetmask (int __mask) __THROW __attribute_deprecated__;
200: 
201: /* Return currently selected signal mask.  */
202: extern int siggetmask (void) __THROW __attribute_deprecated__;
203: #endif /* Use BSD.  */
204: 
205: 
206: #ifdef __USE_MISC
207: # define NSIG   _NSIG
208: #endif
209: 
210: #ifdef __USE_GNU
211: typedef __sighandler_t sighandler_t;
212: #endif
213: 
214: /* 4.4 BSD uses the name `sig_t' for this.  */
215: #ifdef __USE_BSD
216: typedef __sighandler_t sig_t;
217: #endif
218: 
219: #ifdef __USE_POSIX
220: 
221: /* Clear all signals from SET.  */
222: extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
223: 
224: /* Set all signals in SET.  */
225: extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
226: 
227: /* Add SIGNO to SET.  */
228: extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
229: 
230: /* Remove SIGNO from SET.  */
231: extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
232: 
233: /* Return 1 if SIGNO is in SET, 0 if not.  */
234: extern int sigismember (__const sigset_t *__set, int __signo)
235:      __THROW __nonnull ((1));
236: 
237: # ifdef __USE_GNU
238: /* Return non-empty value is SET is not empty.  */
239: extern int sigisemptyset (__const sigset_t *__set) __THROW __nonnull ((1));
240: 
241: /* Build new signal set by combining the two inputs set using logical AND.  */
242: extern int sigandset (sigset_t *__set, __const sigset_t *__left,
243:                       __const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
244: 
245: /* Build new signal set by combining the two inputs set using logical OR.  */
246: extern int sigorset (sigset_t *__set, __const sigset_t *__left,
247:                      __const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
248: # endif /* GNU */
249: 
250: /* Get the system-specific definitions of `struct sigaction'
251:    and the `SA_*' and `SIG_*'. constants.  */
252: # include <bits/sigaction.h>
253: 
254: /* Get and/or change the set of blocked signals.  */
255: extern int sigprocmask (int __how, __const sigset_t *__restrict __set,
256:                         sigset_t *__restrict __oset) __THROW;
257: 
258: /* Change the set of blocked signals to SET,
259:    wait until a signal arrives, and restore the set of blocked signals.
260: 
261:    This function is a cancellation point and therefore not marked with
262:    __THROW.  */
263: extern int sigsuspend (__const sigset_t *__set) __nonnull ((1));
264: 
265: /* Get and/or set the action for signal SIG.  */
266: extern int sigaction (int __sig, __const struct sigaction *__restrict __act,
267:                       struct sigaction *__restrict __oact) __THROW;
268: 
269: /* Put in SET all signals that are blocked and waiting to be delivered.  */
270: extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
271: 
272: 
273: /* Select any of pending signals from SET or wait for any to arrive.
274: 
275:    This function is a cancellation point and therefore not marked with
276:    __THROW.  */
277: extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
278:      __nonnull ((1, 2));
279: 
280: # ifdef __USE_POSIX199309
281: /* Select any of pending signals from SET and place information in INFO.
282: 
283:    This function is a cancellation point and therefore not marked with
284:    __THROW.  */
285: extern int sigwaitinfo (__const sigset_t *__restrict __set,
286:                         siginfo_t *__restrict __info) __nonnull ((1));
287: 
288: /* Select any of pending signals from SET and place information in INFO.
289:    Wait the time specified by TIMEOUT if no signal is pending.
290: 
291:    This function is a cancellation point and therefore not marked with
292:    __THROW.  */
293: extern int sigtimedwait (__const sigset_t *__restrict __set,
294:                          siginfo_t *__restrict __info,
295:                          __const struct timespec *__restrict __timeout)
296:      __nonnull ((1));
297: 
298: /* Send signal SIG to the process PID.  Associate data in VAL with the
299:    signal.  */
300: extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
301:      __THROW;
302: # endif /* Use POSIX 199306.  */
303: 
304: #endif /* Use POSIX.  */
305: 
306: #ifdef __USE_BSD
307: 
308: /* Names of the signals.  This variable exists only for compatibility.
309:    Use `strsignal' instead (see <string.h>).  */
310: extern __const char *__const _sys_siglist[_NSIG];
311: extern __const char *__const sys_siglist[_NSIG];
312: 
313: /* Structure passed to `sigvec'.  */
314: struct sigvec
315:   {
316:     __sighandler_t sv_handler;  /* Signal handler.  */
317:     int sv_mask;                /* Mask of signals to be blocked.  */
318: 
319:     int sv_flags;               /* Flags (see below).  */
320: # define sv_onstack     sv_flags /* 4.2 BSD compatibility.  */
321:   };
322: 
323: /* Bits in `sv_flags'.  */
324: # define SV_ONSTACK     (1 << 0)/* Take the signal on the signal stack.  */
325: # define SV_INTERRUPT   (1 << 1)/* Do not restart system calls.  */
326: # define SV_RESETHAND   (1 << 2)/* Reset handler to SIG_DFL on receipt.  */
327: 
328: 
329: /* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
330:    of VEC.  The signals in `sv_mask' will be blocked while the handler runs.
331:    If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
332:    reset to SIG_DFL before `sv_handler' is entered.  If OVEC is non-NULL,
333:    it is filled in with the old information for SIG.  */
334: extern int sigvec (int __sig, __const struct sigvec *__vec,
335:                    struct sigvec *__ovec) __THROW;
336: 
337: 
338: /* Get machine-dependent `struct sigcontext' and signal subcodes.  */
339: # include <bits/sigcontext.h>
340: 
341: /* Restore the state saved in SCP.  */
342: extern int sigreturn (struct sigcontext *__scp) __THROW;
343: 
344: #endif /*  use BSD.  */
345: 
346: 
347: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
348: # define __need_size_t
349: # include <stddef.h>
350: 
351: /* If INTERRUPT is nonzero, make signal SIG interrupt system calls
352:    (causing them to fail with EINTR); if INTERRUPT is zero, make system
353:    calls be restarted after signal SIG.  */
354: extern int siginterrupt (int __sig, int __interrupt) __THROW;
355: 
356: # include <bits/sigstack.h>
357: # if defined __USE_XOPEN || defined __USE_XOPEN2K8
358: /* This will define `ucontext_t' and `mcontext_t'.  */
359: #  include <sys/ucontext.h>
360: # endif
361: 
362: /* Run signals handlers on the stack specified by SS (if not NULL).
363:    If OSS is not NULL, it is filled in with the old signal stack status.
364:    This interface is obsolete and on many platform not implemented.  */
365: extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
366:      __THROW __attribute_deprecated__;
367: 
368: /* Alternate signal handler stack interface.
369:    This interface should always be preferred over `sigstack'.  */
370: extern int sigaltstack (__const struct sigaltstack *__restrict __ss,
371:                         struct sigaltstack *__restrict __oss) __THROW;
372: 
373: #endif /* use BSD or X/Open Unix.  */
374: 
375: #ifdef __USE_XOPEN_EXTENDED
376: /* Simplified interface for signal management.  */
377: 
378: /* Add SIG to the calling process' signal mask.  */
379: extern int sighold (int __sig) __THROW;
380: 
381: /* Remove SIG from the calling process' signal mask.  */
382: extern int sigrelse (int __sig) __THROW;
383: 
384: /* Set the disposition of SIG to SIG_IGN.  */
385: extern int sigignore (int __sig) __THROW;
386: 
387: /* Set the disposition of SIG.  */
388: extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
389: #endif
390: 
391: #if defined __USE_POSIX199506 || defined __USE_UNIX98
392: /* Some of the functions for handling signals in threaded programs must
393:    be defined here.  */
394: # include <bits/pthreadtypes.h>
395: # include <bits/sigthread.h>
396: #endif /* use Unix98 */
397: 
398: /* The following functions are used internally in the C library and in
399:    other code which need deep insights.  */
400: 
401: /* Return number of available real-time signal with highest priority.  */
402: extern int __libc_current_sigrtmin (void) __THROW;
403: /* Return number of available real-time signal with lowest priority.  */
404: extern int __libc_current_sigrtmax (void) __THROW;
405: 
406: #endif /* signal.h  */
407: 
408: __END_DECLS
409: 
410: #endif /* not signal.h */
411: 


for client 3.133.160.156
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/