Blame gnulib/signal.in.h

Packit Service 392537
/* A GNU-like <signal.h>.
Packit Service 392537
Packit Service 392537
   Copyright (C) 2006-2016 Free Software Foundation, Inc.
Packit Service 392537
Packit Service 392537
   This program is free software: you can redistribute it and/or modify
Packit Service 392537
   it under the terms of the GNU General Public License as published by
Packit Service 392537
   the Free Software Foundation; either version 3 of the License, or
Packit Service 392537
   (at your option) any later version.
Packit Service 392537
Packit Service 392537
   This program is distributed in the hope that it will be useful,
Packit Service 392537
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 392537
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 392537
   GNU General Public License for more details.
Packit Service 392537
Packit Service 392537
   You should have received a copy of the GNU General Public License
Packit Service 392537
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit Service 392537
Packit Service 392537
#if __GNUC__ >= 3
Packit Service 392537
@PRAGMA_SYSTEM_HEADER@
Packit Service 392537
#endif
Packit Service 392537
@PRAGMA_COLUMNS@
Packit Service 392537
Packit Service 392537
#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
Packit Service 392537
/* Special invocation convention:
Packit Service 392537
   - Inside glibc header files.
Packit Service 392537
   - On glibc systems we have a sequence of nested includes
Packit Service 392537
     <signal.h> -> <ucontext.h> -> <signal.h>.
Packit Service 392537
     In this situation, the functions are not yet declared, therefore we cannot
Packit Service 392537
     provide the C++ aliases.
Packit Service 392537
   - On glibc systems with GCC 4.3 we have a sequence of nested includes
Packit Service 392537
     <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
Packit Service 392537
     In this situation, some of the functions are not yet declared, therefore
Packit Service 392537
     we cannot provide the C++ aliases.  */
Packit Service 392537
Packit Service 392537
# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
Packit Service 392537
Packit Service 392537
#else
Packit Service 392537
/* Normal invocation convention.  */
Packit Service 392537
Packit Service 392537
#ifndef _@GUARD_PREFIX@_SIGNAL_H
Packit Service 392537
Packit Service 392537
#define _GL_ALREADY_INCLUDING_SIGNAL_H
Packit Service 392537
Packit Service 392537
/* Define pid_t, uid_t.
Packit Service 392537
   Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
Packit Service 392537
   On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
Packit Service 392537
   us; so include <sys/types.h> now, before the second inclusion guard.  */
Packit Service 392537
#include <sys/types.h>
Packit Service 392537
Packit Service 392537
/* The include_next requires a split double-inclusion guard.  */
Packit Service 392537
#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
Packit Service 392537
Packit Service 392537
#undef _GL_ALREADY_INCLUDING_SIGNAL_H
Packit Service 392537
Packit Service 392537
#ifndef _@GUARD_PREFIX@_SIGNAL_H
Packit Service 392537
#define _@GUARD_PREFIX@_SIGNAL_H
Packit Service 392537
Packit Service 392537
/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android
Packit Service 392537
   declare pthread_sigmask in <pthread.h>, not in <signal.h>.
Packit Service 392537
   But avoid namespace pollution on glibc systems.*/
Packit Service 392537
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
Packit Service 392537
    && ((defined __APPLE__ && defined __MACH__) \
Packit Service 392537
        || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \
Packit Service 392537
        || defined __sun || defined __ANDROID__) \
Packit Service 392537
    && ! defined __GLIBC__
Packit Service 392537
# include <pthread.h>
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
Packit Service 392537
Packit Service 392537
/* The definition of _GL_ARG_NONNULL is copied here.  */
Packit Service 392537
Packit Service 392537
/* The definition of _GL_WARN_ON_USE is copied here.  */
Packit Service 392537
Packit Service 392537
/* On AIX, sig_atomic_t already includes volatile.  C99 requires that
Packit Service 392537
   'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
Packit Service 392537
   Hence, redefine this to a non-volatile type as needed.  */
Packit Service 392537
#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
Packit Service 392537
# if !GNULIB_defined_sig_atomic_t
Packit Service 392537
typedef int rpl_sig_atomic_t;
Packit Service 392537
#  undef sig_atomic_t
Packit Service 392537
#  define sig_atomic_t rpl_sig_atomic_t
Packit Service 392537
#  define GNULIB_defined_sig_atomic_t 1
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
/* A set or mask of signals.  */
Packit Service 392537
#if !@HAVE_SIGSET_T@
Packit Service 392537
# if !GNULIB_defined_sigset_t
Packit Service 392537
typedef unsigned int sigset_t;
Packit Service 392537
#  define GNULIB_defined_sigset_t 1
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
/* Define sighandler_t, the type of signal handlers.  A GNU extension.  */
Packit Service 392537
#if !@HAVE_SIGHANDLER_T@
Packit Service 392537
# ifdef __cplusplus
Packit Service 392537
extern "C" {
Packit Service 392537
# endif
Packit Service 392537
# if !GNULIB_defined_sighandler_t
Packit Service 392537
typedef void (*sighandler_t) (int);
Packit Service 392537
#  define GNULIB_defined_sighandler_t 1
Packit Service 392537
# endif
Packit Service 392537
# ifdef __cplusplus
Packit Service 392537
}
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
Packit Service 392537
#if @GNULIB_SIGNAL_H_SIGPIPE@
Packit Service 392537
# ifndef SIGPIPE
Packit Service 392537
/* Define SIGPIPE to a value that does not overlap with other signals.  */
Packit Service 392537
#  define SIGPIPE 13
Packit Service 392537
#  define GNULIB_defined_SIGPIPE 1
Packit Service 392537
/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
Packit Service 392537
   'write', 'stdio'.  */
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
Packit Service 392537
/* Maximum signal number + 1.  */
Packit Service 392537
#ifndef NSIG
Packit Service 392537
# if defined __TANDEM
Packit Service 392537
#  define NSIG 32
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
Packit Service 392537
#if @GNULIB_PTHREAD_SIGMASK@
Packit Service 392537
# if @REPLACE_PTHREAD_SIGMASK@
Packit Service 392537
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 392537
#   undef pthread_sigmask
Packit Service 392537
#   define pthread_sigmask rpl_pthread_sigmask
Packit Service 392537
#  endif
Packit Service 392537
_GL_FUNCDECL_RPL (pthread_sigmask, int,
Packit Service 392537
                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
Packit Service 392537
_GL_CXXALIAS_RPL (pthread_sigmask, int,
Packit Service 392537
                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
Packit Service 392537
# else
Packit Service 392537
#  if !@HAVE_PTHREAD_SIGMASK@
Packit Service 392537
_GL_FUNCDECL_SYS (pthread_sigmask, int,
Packit Service 392537
                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
Packit Service 392537
#  endif
Packit Service 392537
_GL_CXXALIAS_SYS (pthread_sigmask, int,
Packit Service 392537
                  (int how, const sigset_t *new_mask, sigset_t *old_mask));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIASWARN (pthread_sigmask);
Packit Service 392537
#elif defined GNULIB_POSIXCHECK
Packit Service 392537
# undef pthread_sigmask
Packit Service 392537
# if HAVE_RAW_DECL_PTHREAD_SIGMASK
Packit Service 392537
_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
Packit Service 392537
                 "use gnulib module pthread_sigmask for portability");
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
Packit Service 392537
#if @GNULIB_RAISE@
Packit Service 392537
# if @REPLACE_RAISE@
Packit Service 392537
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 392537
#   undef raise
Packit Service 392537
#   define raise rpl_raise
Packit Service 392537
#  endif
Packit Service 392537
_GL_FUNCDECL_RPL (raise, int, (int sig));
Packit Service 392537
_GL_CXXALIAS_RPL (raise, int, (int sig));
Packit Service 392537
# else
Packit Service 392537
#  if !@HAVE_RAISE@
Packit Service 392537
_GL_FUNCDECL_SYS (raise, int, (int sig));
Packit Service 392537
#  endif
Packit Service 392537
_GL_CXXALIAS_SYS (raise, int, (int sig));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIASWARN (raise);
Packit Service 392537
#elif defined GNULIB_POSIXCHECK
Packit Service 392537
# undef raise
Packit Service 392537
/* Assume raise is always declared.  */
Packit Service 392537
_GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
Packit Service 392537
                 "use gnulib module raise for portability");
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
Packit Service 392537
#if @GNULIB_SIGPROCMASK@
Packit Service 392537
# if !@HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
Packit Service 392537
#  ifndef GNULIB_defined_signal_blocking
Packit Service 392537
#   define GNULIB_defined_signal_blocking 1
Packit Service 392537
#  endif
Packit Service 392537
Packit Service 392537
/* Maximum signal number + 1.  */
Packit Service 392537
#  ifndef NSIG
Packit Service 392537
#   define NSIG 32
Packit Service 392537
#  endif
Packit Service 392537
Packit Service 392537
/* This code supports only 32 signals.  */
Packit Service 392537
#  if !GNULIB_defined_verify_NSIG_constraint
Packit Service 392537
typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
Packit Service 392537
#   define GNULIB_defined_verify_NSIG_constraint 1
Packit Service 392537
#  endif
Packit Service 392537
Packit Service 392537
# endif
Packit Service 392537
Packit Service 392537
/* When also using extern inline, suppress the use of static inline in
Packit Service 392537
   standard headers of problematic Apple configurations, as Libc at
Packit Service 392537
   least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
Packit Service 392537
   <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
Packit Service 392537
   Perhaps Apple will fix this some day.  */
Packit Service 392537
#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
Packit Service 392537
     && (defined __i386__ || defined __x86_64__))
Packit Service 392537
# undef sigaddset
Packit Service 392537
# undef sigdelset
Packit Service 392537
# undef sigemptyset
Packit Service 392537
# undef sigfillset
Packit Service 392537
# undef sigismember
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
/* Test whether a given signal is contained in a signal set.  */
Packit Service 392537
# if @HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
/* This function is defined as a macro on Mac OS X.  */
Packit Service 392537
#  if defined __cplusplus && defined GNULIB_NAMESPACE
Packit Service 392537
#   undef sigismember
Packit Service 392537
#  endif
Packit Service 392537
# else
Packit Service 392537
_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
Packit Service 392537
                                    _GL_ARG_NONNULL ((1)));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
Packit Service 392537
_GL_CXXALIASWARN (sigismember);
Packit Service 392537
Packit Service 392537
/* Initialize a signal set to the empty set.  */
Packit Service 392537
# if @HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
/* This function is defined as a macro on Mac OS X.  */
Packit Service 392537
#  if defined __cplusplus && defined GNULIB_NAMESPACE
Packit Service 392537
#   undef sigemptyset
Packit Service 392537
#  endif
Packit Service 392537
# else
Packit Service 392537
_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
Packit Service 392537
_GL_CXXALIASWARN (sigemptyset);
Packit Service 392537
Packit Service 392537
/* Add a signal to a signal set.  */
Packit Service 392537
# if @HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
/* This function is defined as a macro on Mac OS X.  */
Packit Service 392537
#  if defined __cplusplus && defined GNULIB_NAMESPACE
Packit Service 392537
#   undef sigaddset
Packit Service 392537
#  endif
Packit Service 392537
# else
Packit Service 392537
_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
Packit Service 392537
                                  _GL_ARG_NONNULL ((1)));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
Packit Service 392537
_GL_CXXALIASWARN (sigaddset);
Packit Service 392537
Packit Service 392537
/* Remove a signal from a signal set.  */
Packit Service 392537
# if @HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
/* This function is defined as a macro on Mac OS X.  */
Packit Service 392537
#  if defined __cplusplus && defined GNULIB_NAMESPACE
Packit Service 392537
#   undef sigdelset
Packit Service 392537
#  endif
Packit Service 392537
# else
Packit Service 392537
_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
Packit Service 392537
                                  _GL_ARG_NONNULL ((1)));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
Packit Service 392537
_GL_CXXALIASWARN (sigdelset);
Packit Service 392537
Packit Service 392537
/* Fill a signal set with all possible signals.  */
Packit Service 392537
# if @HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
/* This function is defined as a macro on Mac OS X.  */
Packit Service 392537
#  if defined __cplusplus && defined GNULIB_NAMESPACE
Packit Service 392537
#   undef sigfillset
Packit Service 392537
#  endif
Packit Service 392537
# else
Packit Service 392537
_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
Packit Service 392537
_GL_CXXALIASWARN (sigfillset);
Packit Service 392537
Packit Service 392537
/* Return the set of those blocked signals that are pending.  */
Packit Service 392537
# if !@HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
Packit Service 392537
_GL_CXXALIASWARN (sigpending);
Packit Service 392537
Packit Service 392537
/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
Packit Service 392537
   Then, if SET is not NULL, affect the current set of blocked signals by
Packit Service 392537
   combining it with *SET as indicated in OPERATION.
Packit Service 392537
   In this implementation, you are not allowed to change a signal handler
Packit Service 392537
   while the signal is blocked.  */
Packit Service 392537
# if !@HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
#  define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
Packit Service 392537
#  define SIG_SETMASK 1  /* blocked_set = *set; */
Packit Service 392537
#  define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
Packit Service 392537
_GL_FUNCDECL_SYS (sigprocmask, int,
Packit Service 392537
                  (int operation, const sigset_t *set, sigset_t *old_set));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIAS_SYS (sigprocmask, int,
Packit Service 392537
                  (int operation, const sigset_t *set, sigset_t *old_set));
Packit Service 392537
_GL_CXXALIASWARN (sigprocmask);
Packit Service 392537
Packit Service 392537
/* Install the handler FUNC for signal SIG, and return the previous
Packit Service 392537
   handler.  */
Packit Service 392537
# ifdef __cplusplus
Packit Service 392537
extern "C" {
Packit Service 392537
# endif
Packit Service 392537
# if !GNULIB_defined_function_taking_int_returning_void_t
Packit Service 392537
typedef void (*_gl_function_taking_int_returning_void_t) (int);
Packit Service 392537
#  define GNULIB_defined_function_taking_int_returning_void_t 1
Packit Service 392537
# endif
Packit Service 392537
# ifdef __cplusplus
Packit Service 392537
}
Packit Service 392537
# endif
Packit Service 392537
# if !@HAVE_POSIX_SIGNALBLOCKING@
Packit Service 392537
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit Service 392537
#   define signal rpl_signal
Packit Service 392537
#  endif
Packit Service 392537
_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
Packit Service 392537
                  (int sig, _gl_function_taking_int_returning_void_t func));
Packit Service 392537
_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
Packit Service 392537
                  (int sig, _gl_function_taking_int_returning_void_t func));
Packit Service 392537
# else
Packit Service 392537
_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
Packit Service 392537
                  (int sig, _gl_function_taking_int_returning_void_t func));
Packit Service 392537
# endif
Packit Service 392537
_GL_CXXALIASWARN (signal);
Packit Service 392537
Packit Service 392537
# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
Packit Service 392537
/* Raise signal SIGPIPE.  */
Packit Service 392537
_GL_EXTERN_C int _gl_raise_SIGPIPE (void);
Packit Service 392537
# endif
Packit Service 392537
Packit Service 392537
#elif defined GNULIB_POSIXCHECK
Packit Service 392537
# undef sigaddset
Packit Service 392537
# if HAVE_RAW_DECL_SIGADDSET
Packit Service 392537
_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
# undef sigdelset
Packit Service 392537
# if HAVE_RAW_DECL_SIGDELSET
Packit Service 392537
_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
# undef sigemptyset
Packit Service 392537
# if HAVE_RAW_DECL_SIGEMPTYSET
Packit Service 392537
_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
# undef sigfillset
Packit Service 392537
# if HAVE_RAW_DECL_SIGFILLSET
Packit Service 392537
_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
# undef sigismember
Packit Service 392537
# if HAVE_RAW_DECL_SIGISMEMBER
Packit Service 392537
_GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
# undef sigpending
Packit Service 392537
# if HAVE_RAW_DECL_SIGPENDING
Packit Service 392537
_GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
# undef sigprocmask
Packit Service 392537
# if HAVE_RAW_DECL_SIGPROCMASK
Packit Service 392537
_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
Packit Service 392537
                 "use the gnulib module sigprocmask for portability");
Packit Service 392537
# endif
Packit Service 392537
#endif /* @GNULIB_SIGPROCMASK@ */
Packit Service 392537
Packit Service 392537
Packit Service 392537
#if @GNULIB_SIGACTION@
Packit Service 392537
# if !@HAVE_SIGACTION@
Packit Service 392537
Packit Service 392537
#  if !@HAVE_SIGINFO_T@
Packit Service 392537
Packit Service 392537
#   if !GNULIB_defined_siginfo_types
Packit Service 392537
Packit Service 392537
/* Present to allow compilation, but unsupported by gnulib.  */
Packit Service 392537
union sigval
Packit Service 392537
{
Packit Service 392537
  int sival_int;
Packit Service 392537
  void *sival_ptr;
Packit Service 392537
};
Packit Service 392537
Packit Service 392537
/* Present to allow compilation, but unsupported by gnulib.  */
Packit Service 392537
struct siginfo_t
Packit Service 392537
{
Packit Service 392537
  int si_signo;
Packit Service 392537
  int si_code;
Packit Service 392537
  int si_errno;
Packit Service 392537
  pid_t si_pid;
Packit Service 392537
  uid_t si_uid;
Packit Service 392537
  void *si_addr;
Packit Service 392537
  int si_status;
Packit Service 392537
  long si_band;
Packit Service 392537
  union sigval si_value;
Packit Service 392537
};
Packit Service 392537
typedef struct siginfo_t siginfo_t;
Packit Service 392537
Packit Service 392537
#    define GNULIB_defined_siginfo_types 1
Packit Service 392537
#   endif
Packit Service 392537
Packit Service 392537
#  endif /* !@HAVE_SIGINFO_T@ */
Packit Service 392537
Packit Service 392537
/* We assume that platforms which lack the sigaction() function also lack
Packit Service 392537
   the 'struct sigaction' type, and vice versa.  */
Packit Service 392537
Packit Service 392537
#  if !GNULIB_defined_struct_sigaction
Packit Service 392537
Packit Service 392537
struct sigaction
Packit Service 392537
{
Packit Service 392537
  union
Packit Service 392537
  {
Packit Service 392537
    void (*_sa_handler) (int);
Packit Service 392537
    /* Present to allow compilation, but unsupported by gnulib.  POSIX
Packit Service 392537
       says that implementations may, but not must, make sa_sigaction
Packit Service 392537
       overlap with sa_handler, but we know of no implementation where
Packit Service 392537
       they do not overlap.  */
Packit Service 392537
    void (*_sa_sigaction) (int, siginfo_t *, void *);
Packit Service 392537
  } _sa_func;
Packit Service 392537
  sigset_t sa_mask;
Packit Service 392537
  /* Not all POSIX flags are supported.  */
Packit Service 392537
  int sa_flags;
Packit Service 392537
};
Packit Service 392537
#   define sa_handler _sa_func._sa_handler
Packit Service 392537
#   define sa_sigaction _sa_func._sa_sigaction
Packit Service 392537
/* Unsupported flags are not present.  */
Packit Service 392537
#   define SA_RESETHAND 1
Packit Service 392537
#   define SA_NODEFER 2
Packit Service 392537
#   define SA_RESTART 4
Packit Service 392537
Packit Service 392537
#   define GNULIB_defined_struct_sigaction 1
Packit Service 392537
#  endif
Packit Service 392537
Packit Service 392537
_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
Packit Service 392537
                                   struct sigaction *restrict));
Packit Service 392537
Packit Service 392537
# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
Packit Service 392537
Packit Service 392537
#  define sa_sigaction sa_handler
Packit Service 392537
Packit Service 392537
# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
Packit Service 392537
Packit Service 392537
_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
Packit Service 392537
                                   struct sigaction *restrict));
Packit Service 392537
_GL_CXXALIASWARN (sigaction);
Packit Service 392537
Packit Service 392537
#elif defined GNULIB_POSIXCHECK
Packit Service 392537
# undef sigaction
Packit Service 392537
# if HAVE_RAW_DECL_SIGACTION
Packit Service 392537
_GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
Packit Service 392537
                 "use the gnulib module sigaction for portability");
Packit Service 392537
# endif
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
/* Some systems don't have SA_NODEFER.  */
Packit Service 392537
#ifndef SA_NODEFER
Packit Service 392537
# define SA_NODEFER 0
Packit Service 392537
#endif
Packit Service 392537
Packit Service 392537
Packit Service 392537
#endif /* _@GUARD_PREFIX@_SIGNAL_H */
Packit Service 392537
#endif /* _@GUARD_PREFIX@_SIGNAL_H */
Packit Service 392537
#endif