(root)/
glibc-2.38/
bits/
sigaction.h
       1  /* Copyright (C) 1991-2023 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     <https://www.gnu.org/licenses/>.  */
      17  
      18  #ifndef _BITS_SIGACTION_H
      19  #define _BITS_SIGACTION_H 1
      20  
      21  #ifndef _SIGNAL_H
      22  # error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
      23  #endif
      24  
      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.  */
      32  struct sigaction
      33    {
      34      /* Signal handler.  */
      35  #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
      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
      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'.  */
      58  #if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
      59  # define SA_ONSTACK	0x0001	/* Take signal on signal stack.  */
      60  #endif
      61  #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
      62  # define SA_RESTART	0x0002	/* Restart syscall on signal return.  */
      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.  */
      66  #endif
      67  #define	SA_NOCLDSTOP	0x0008	/* Don't send SIGCHLD when children stop.  */
      68  #define SA_SIGINFO	0x0040	/* Signal handler with SA_SIGINFO args */
      69  
      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  
      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.  */
      84  
      85  #endif