]> git.ipfire.org Git - thirdparty/glibc.git/blame - bits/sigaction.h
benchtests: Improve benchtests for strstr
[thirdparty/glibc.git] / bits / sigaction.h
CommitLineData
dff8da6b 1/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
478b92f0 2 This file is part of the GNU C Library.
28f540f4 3
478b92f0 4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
28f540f4 8
478b92f0
UD
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
41bdb6e2 12 Lesser General Public License for more details.
28f540f4 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
28f540f4 17
a1ede3a4
ST
18#ifndef _BITS_SIGACTION_H
19#define _BITS_SIGACTION_H 1
20
f4017d20
UD
21#ifndef _SIGNAL_H
22# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
23#endif
24
28f540f4
RM
25/* These definitions match those used by the 4.4 BSD kernel.
26 If the operating system has a `sigaction' system call that correctly
27 implements the POSIX.1 behavior, there should be a system-dependent
28 version of this file that defines `struct sigaction' and the `SA_*'
29 constants appropriately. */
30
31/* Structure describing the action to be taken when a signal arrives. */
32struct sigaction
33 {
34 /* Signal handler. */
cd65836b 35#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
bedbf86c
RM
36 union
37 {
38 /* Used if SA_SIGINFO is not set. */
39 __sighandler_t sa_handler;
40 /* Used if SA_SIGINFO is set. */
41 void (*sa_sigaction) (int, siginfo_t *, void *);
42 }
43 __sigaction_handler;
44# define sa_handler __sigaction_handler.sa_handler
45# define sa_sigaction __sigaction_handler.sa_sigaction
46#else
47 __sighandler_t sa_handler;
48#endif
28f540f4
RM
49
50 /* Additional set of signals to be blocked. */
51 __sigset_t sa_mask;
52
53 /* Special flags. */
54 int sa_flags;
55 };
56
57/* Bits in `sa_flags'. */
cd65836b 58#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
7ce241a0 59# define SA_ONSTACK 0x0001 /* Take signal on signal stack. */
ee16e894 60#endif
cd65836b 61#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
7ce241a0 62# define SA_RESTART 0x0002 /* Restart syscall on signal return. */
393aec52
RM
63# define SA_NODEFER 0x0010 /* Don't automatically block the signal when
64 its handler is being executed. */
65# define SA_RESETHAND 0x0004 /* Reset to SIG_DFL on entry to handler. */
28f540f4 66#endif
7ce241a0 67#define SA_NOCLDSTOP 0x0008 /* Don't send SIGCHLD when children stop. */
d865ff74 68#define SA_SIGINFO 0x0040 /* Signal handler with SA_SIGINFO args */
28f540f4 69
393aec52
RM
70#ifdef __USE_MISC
71# define SA_INTERRUPT 0 /* Historical no-op ("not SA_RESTART"). */
72
73/* Some aliases for the SA_ constants. */
74# define SA_NOMASK SA_NODEFER
75# define SA_ONESHOT SA_RESETHAND
76# define SA_STACK SA_ONSTACK
77#endif
78
28f540f4
RM
79
80/* Values for the HOW argument to `sigprocmask'. */
81#define SIG_BLOCK 1 /* Block signals. */
82#define SIG_UNBLOCK 2 /* Unblock signals. */
83#define SIG_SETMASK 3 /* Set the set of blocked signals. */
a1ede3a4
ST
84
85#endif