]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - signal/signal.h
support: Add support_install_rootsbindir
[thirdparty/glibc.git] / signal / signal.h
index 2c7f9e104333ca51f5dea4b1025a780bfc92cda4..4c0de7f6ce7563eed92a844fdb58bd65140583d5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
  */
 
 #ifndef        _SIGNAL_H
-
-#if !defined __need_sig_atomic_t && !defined __need_sigset_t
-# define _SIGNAL_H
-#endif
+#define _SIGNAL_H
 
 #include <features.h>
 
 __BEGIN_DECLS
 
-#include <bits/sigset.h>               /* __sigset_t, __sig_atomic_t.  */
+#include <bits/types.h>
+#include <bits/signum.h>
 
-/* An integral type that can be modified atomically, without the
-   possibility of a signal arriving in the middle of the operation.  */
-#if defined __need_sig_atomic_t || defined _SIGNAL_H
-# ifndef __sig_atomic_t_defined
-#  define __sig_atomic_t_defined
-__BEGIN_NAMESPACE_STD
-typedef __sig_atomic_t sig_atomic_t;
-__END_NAMESPACE_STD
-# endif
-# undef __need_sig_atomic_t
-#endif
+#include <bits/types/sig_atomic_t.h>
 
-#if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX)
-# ifndef __sigset_t_defined
-#  define __sigset_t_defined
-typedef __sigset_t sigset_t;
-# endif
-# undef __need_sigset_t
+#if defined __USE_POSIX
+#include <bits/types/sigset_t.h>
 #endif
 
-#ifdef _SIGNAL_H
-
-#include <bits/types.h>
-#include <bits/signum.h>
-
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 # ifndef __pid_t_defined
 typedef __pid_t pid_t;
@@ -75,8 +54,17 @@ typedef __uid_t uid_t;
 #endif
 
 #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
-/* Get the `siginfo_t' type plus the needed symbols.  */
-# include <bits/siginfo.h>
+# include <bits/types/siginfo_t.h>
+# include <bits/siginfo-consts.h>
+#endif
+
+#ifdef __USE_MISC
+# include <bits/types/sigval_t.h>
+#endif
+
+#ifdef __USE_POSIX199309
+# include <bits/types/sigevent_t.h>
+# include <bits/sigevent-consts.h>
 #endif
 
 
@@ -96,7 +84,6 @@ extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
 /* Set the handler for the signal SIG to HANDLER, returning the old
    handler, or SIG_ERR on error.
    By default `signal' has the BSD semantic.  */
-__BEGIN_NAMESPACE_STD
 #ifdef __USE_MISC
 extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      __THROW;
@@ -110,9 +97,8 @@ extern __sighandler_t __REDIRECT_NTH (signal,
 #  define signal __sysv_signal
 # endif
 #endif
-__END_NAMESPACE_STD
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8
 /* The X/Open definition of `signal' conflicts with the BSD version.
    So they defined another function `bsd_signal'.  */
 extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
@@ -133,10 +119,8 @@ extern int kill (__pid_t __pid, int __sig) __THROW;
 extern int killpg (__pid_t __pgrp, int __sig) __THROW;
 #endif /* Use misc || X/Open Unix.  */
 
-__BEGIN_NAMESPACE_STD
 /* Raise signal SIG, i.e., send SIG to yourself.  */
 extern int raise (int __sig) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* SVID names for the same things.  */
@@ -162,7 +146,7 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 
-#ifdef __USE_XOPEN
+#ifdef __USE_XOPEN_EXTENDED
 # ifdef __GNUC__
 extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
 # else
@@ -180,7 +164,7 @@ extern int __sigpause (int __sig_or_mask, int __is_sig);
    simply do not work in many situations.  Use `sigprocmask' instead.  */
 
 /* Compute mask for signal SIG.  */
-# define sigmask(sig)  __sigmask(sig)
+# define sigmask(sig) ((int)(1u << ((sig) - 1)))
 
 /* Block signals in MASK, returning the old mask.  */
 extern int sigblock (int __mask) __THROW __attribute_deprecated__;
@@ -260,12 +244,14 @@ extern int sigaction (int __sig, const struct sigaction *__restrict __act,
 extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
 
 
+# ifdef __USE_POSIX199506
 /* Select any of pending signals from SET or wait for any to arrive.
 
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
      __nonnull ((1, 2));
+# endif /* Use POSIX 1995.  */
 
 # ifdef __USE_POSIX199309
 /* Select any of pending signals from SET and place information in INFO.
@@ -314,29 +300,41 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
 # define __need_size_t
 # include <stddef.h>
 
+# include <bits/types/stack_t.h>
+# if defined __USE_XOPEN || defined __USE_XOPEN2K8
+/* This will define `ucontext_t' and `mcontext_t'.  */
+#  include <sys/ucontext.h>
+# endif
+#endif /* Use POSIX.1-2008 or X/Open Unix.  */
+
+#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
 /* If INTERRUPT is nonzero, make signal SIG interrupt system calls
    (causing them to fail with EINTR); if INTERRUPT is zero, make system
    calls be restarted after signal SIG.  */
 extern int siginterrupt (int __sig, int __interrupt) __THROW;
 
 # include <bits/sigstack.h>
-# if defined __USE_XOPEN || defined __USE_XOPEN2K8
-/* This will define `ucontext_t' and `mcontext_t'.  */
-#  include <sys/ucontext.h>
-# endif
+# include <bits/ss_flags.h>
 
+/* Alternate signal handler stack interface.
+   This interface should always be preferred over `sigstack'.  */
+extern int sigaltstack (const stack_t *__restrict __ss,
+                       stack_t *__restrict __oss) __THROW;
+#endif /* __USE_XOPEN_EXTENDED || __USE_MISC */
+
+#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+     || defined __USE_MISC)
+# include <bits/types/struct_sigstack.h>
+#endif
+
+#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K)  \
+     || defined __USE_MISC)
 /* Run signals handlers on the stack specified by SS (if not NULL).
    If OSS is not NULL, it is filled in with the old signal stack status.
    This interface is obsolete and on many platform not implemented.  */
 extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
      __THROW __attribute_deprecated__;
-
-/* Alternate signal handler stack interface.
-   This interface should always be preferred over `sigstack'.  */
-extern int sigaltstack (const struct sigaltstack *__restrict __ss,
-                       struct sigaltstack *__restrict __oss) __THROW;
-
-#endif /* Use POSIX.1-2008 or X/Open Unix.  */
+#endif
 
 #ifdef __USE_XOPEN_EXTENDED
 /* Simplified interface for signal management.  */
@@ -369,7 +367,11 @@ extern int __libc_current_sigrtmin (void) __THROW;
 /* Return number of available real-time signal with lowest priority.  */
 extern int __libc_current_sigrtmax (void) __THROW;
 
-#endif /* signal.h  */
+#define SIGRTMIN        (__libc_current_sigrtmin ())
+#define SIGRTMAX        (__libc_current_sigrtmax ())
+
+/* System-specific extensions.  */
+#include <bits/signal_ext.h>
 
 __END_DECLS