diff options
Diffstat (limited to 'signal')
-rw-r--r-- | signal/Makefile | 12 | ||||
-rw-r--r-- | signal/Versions | 8 | ||||
-rw-r--r-- | signal/bits/types/sig_atomic_t.h | 10 | ||||
-rw-r--r-- | signal/bits/types/sigset_t.h | 9 | ||||
-rw-r--r-- | signal/bits/types/sigval_t.h | 13 | ||||
-rw-r--r-- | signal/sigaddset.c | 7 | ||||
-rw-r--r-- | signal/sigandset.c | 8 | ||||
-rw-r--r-- | signal/sigdelset.c | 7 | ||||
-rw-r--r-- | signal/sigisempty.c | 7 | ||||
-rw-r--r-- | signal/sigismem.c | 4 | ||||
-rw-r--r-- | signal/signal.h | 41 | ||||
-rw-r--r-- | signal/sigorset.c | 8 | ||||
-rw-r--r-- | signal/sigsetops.c | 58 | ||||
-rw-r--r-- | signal/sigsetops.h | 32 |
14 files changed, 129 insertions, 95 deletions
diff --git a/signal/Makefile b/signal/Makefile index 077aaea6ad..de92558f2c 100644 --- a/signal/Makefile +++ b/signal/Makefile @@ -22,10 +22,14 @@ subdir := signal include ../Makeconfig -headers := signal.h sys/signal.h bits/signum.h bits/sigcontext.h \ - bits/sigaction.h bits/sigset.h bits/siginfo.h bits/sigstack.h \ - bits/sigthread.h bits/types/struct_sigstack.h bits/types/stack_t.h \ - bits/ss_flags.h +headers := signal.h sys/signal.h \ + bits/signum.h bits/sigcontext.h bits/sigaction.h \ + bits/sigevent-consts.h bits/siginfo-consts.h \ + bits/sigstack.h bits/sigthread.h bits/ss_flags.h \ + bits/types/__sigset_t.h bits/types/sig_atomic_t.h \ + bits/types/sigevent_t.h bits/types/siginfo_t.h \ + bits/types/sigset_t.h bits/types/stack_t.h \ + bits/types/struct_sigstack.h routines := signal raise killpg \ sigaction sigprocmask kill \ diff --git a/signal/Versions b/signal/Versions index 4d86930ec6..a915ef400f 100644 --- a/signal/Versions +++ b/signal/Versions @@ -1,13 +1,13 @@ libc { GLIBC_2.0 { # functions with special/multiple interfaces - __sigaddset; __sigdelset; __sigismember; __sysv_signal; + __sigpause; __sysv_signal; - # functions used in inline functions or macros - __sigpause; + # functions formerly used in inline functions or macros + __sigaddset; __sigdelset; __sigismember; # functions used in other libraries - __sigaction; + __sigaction; # b* bsd_signal; diff --git a/signal/bits/types/sig_atomic_t.h b/signal/bits/types/sig_atomic_t.h new file mode 100644 index 0000000000..47eaa28311 --- /dev/null +++ b/signal/bits/types/sig_atomic_t.h @@ -0,0 +1,10 @@ +#ifndef __sig_atomic_t_defined +#define __sig_atomic_t_defined 1 + +#include <bits/types.h> + +/* An integral type that can be modified atomically, without the + possibility of a signal arriving in the middle of the operation. */ +typedef __sig_atomic_t sig_atomic_t; + +#endif diff --git a/signal/bits/types/sigset_t.h b/signal/bits/types/sigset_t.h new file mode 100644 index 0000000000..8b27e9112d --- /dev/null +++ b/signal/bits/types/sigset_t.h @@ -0,0 +1,9 @@ +#ifndef __sigset_t_defined +#define __sigset_t_defined 1 + +#include <bits/types/__sigset_t.h> + +/* A set of signals to be blocked, unblocked, or waited for. */ +typedef __sigset_t sigset_t; + +#endif diff --git a/signal/bits/types/sigval_t.h b/signal/bits/types/sigval_t.h new file mode 100644 index 0000000000..666598f0ca --- /dev/null +++ b/signal/bits/types/sigval_t.h @@ -0,0 +1,13 @@ +#ifndef __sigval_t_defined +#define __sigval_t_defined + +/* Type for data associated with a signal. */ +union sigval +{ + int sival_int; + void *sival_ptr; +}; + +typedef union sigval sigval_t; + +#endif diff --git a/signal/sigaddset.c b/signal/sigaddset.c index ca280d8e76..161be7b352 100644 --- a/signal/sigaddset.c +++ b/signal/sigaddset.c @@ -15,7 +15,9 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include "sigsetops.h" +#include <errno.h> +#include <signal.h> +#include <sigsetops.h> /* Add SIGNO to SET. */ int @@ -27,6 +29,7 @@ sigaddset (sigset_t *set, int signo) return -1; } - return __sigaddset (set, signo); + __sigaddset (set, signo); + return 0; } libc_hidden_def (sigaddset) diff --git a/signal/sigandset.c b/signal/sigandset.c index f81a5939ee..ffea141c63 100644 --- a/signal/sigandset.c +++ b/signal/sigandset.c @@ -17,18 +17,18 @@ #include <errno.h> #include <signal.h> -#define __need_NULL -#include <stddef.h> +#include <sigsetops.h> /* Combine sets LEFT and RIGHT by logical AND and place result in DEST. */ int sigandset (sigset_t *dest, const sigset_t *left, const sigset_t *right) { - if (dest == NULL || left == NULL || right == NULL) + if (!dest || !left || !right) { __set_errno (EINVAL); return -1; } - return __sigandset (dest, left, right); + __sigandset (dest, left, right); + return 0; } diff --git a/signal/sigdelset.c b/signal/sigdelset.c index 4632103b22..2aaa536937 100644 --- a/signal/sigdelset.c +++ b/signal/sigdelset.c @@ -15,7 +15,9 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include "sigsetops.h" +#include <errno.h> +#include <signal.h> +#include <sigsetops.h> /* Add SIGNO to SET. */ int @@ -27,6 +29,7 @@ sigdelset (sigset_t *set, int signo) return -1; } - return __sigdelset (set, signo); + __sigdelset (set, signo); + return 0; } libc_hidden_def (sigdelset) diff --git a/signal/sigisempty.c b/signal/sigisempty.c index eabe71ce6b..bea03f1216 100644 --- a/signal/sigisempty.c +++ b/signal/sigisempty.c @@ -17,18 +17,17 @@ #include <errno.h> #include <signal.h> -#define __need_NULL -#include <stddef.h> +#include <sigsetops.h> /* Test whether SET is empty. */ int sigisemptyset (const sigset_t *set) { - if (set == NULL) + if (!set) { __set_errno (EINVAL); return -1; } - return __sigisemptyset (set); + return __sigisemptyset (set); } diff --git a/signal/sigismem.c b/signal/sigismem.c index 8da14ac26d..6ef4a4d19d 100644 --- a/signal/sigismem.c +++ b/signal/sigismem.c @@ -15,7 +15,9 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include "sigsetops.h" +#include <errno.h> +#include <signal.h> +#include <sigsetops.h> /* Return 1 if SIGNO is in SET, 0 if not. */ int diff --git a/signal/signal.h b/signal/signal.h index d01df3290a..a51e912d08 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -20,40 +20,21 @@ */ #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 -typedef __sig_atomic_t sig_atomic_t; -# 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; @@ -73,8 +54,10 @@ 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/types/sigevent_t.h> +# include <bits/siginfo-consts.h> +# include <bits/sigevent-consts.h> #endif @@ -174,7 +157,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__; @@ -366,8 +349,6 @@ 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 */ - __END_DECLS #endif /* not signal.h */ diff --git a/signal/sigorset.c b/signal/sigorset.c index 9ea867d79d..8a586db6b5 100644 --- a/signal/sigorset.c +++ b/signal/sigorset.c @@ -17,18 +17,18 @@ #include <errno.h> #include <signal.h> -#define __need_NULL -#include <stddef.h> +#include <sigsetops.h> /* Combine sets LEFT and RIGHT by logical OR and place result in DEST. */ int sigorset (sigset_t *dest, const sigset_t *left, const sigset_t *right) { - if (dest == NULL || left == NULL || right == NULL) + if (!dest || !left || !right) { __set_errno (EINVAL); return -1; } - return __sigorset (dest, left, right); + __sigorset (dest, left, right); + return 0; } diff --git a/signal/sigsetops.c b/signal/sigsetops.c index 0317662a14..d56412f94b 100644 --- a/signal/sigsetops.c +++ b/signal/sigsetops.c @@ -1,11 +1,53 @@ -/* Define the real-function versions of all inline functions - defined in signal.h (or bits/sigset.h). */ +/* Compatibility symbols for old versions of signal.h. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#include <features.h> + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. -#define _EXTERN_INLINE -#ifndef __USE_EXTERN_INLINES -# define __USE_EXTERN_INLINES 1 -#endif + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <signal.h> +#include <sigsetops.h> +#include <shlib-compat.h> + +/* These were formerly defined by <signal.h> as inline functions, + so they require out-of-line compatibility definitions. */ +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_26) -#include "signal.h" +int +attribute_compat_text_section +(__sigismember) (const __sigset_t *set, int sig) +{ + return __sigismember (set, sig); +} +compat_symbol (libc, __sigismember, __sigismember, GLIBC_2_0); + +int +attribute_compat_text_section +(__sigaddset) (__sigset_t *set, int sig) +{ + __sigaddset (set, sig); + return 0; +} +compat_symbol (libc, __sigaddset, __sigaddset, GLIBC_2_0); + +int +attribute_compat_text_section +(__sigdelset) (__sigset_t *set, int sig) +{ + __sigdelset (set, sig); + return 0; +} +compat_symbol (libc, __sigdelset, __sigdelset, GLIBC_2_0); + +#endif diff --git a/signal/sigsetops.h b/signal/sigsetops.h deleted file mode 100644 index cd1282000e..0000000000 --- a/signal/sigsetops.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1991-2017 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 - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* Definitions relevant to functions that operate on `sigset_t's. */ - -#include <errno.h> -#include <signal.h> -#include <string.h> - -#define BITS (_NSIG - 1) -#define ELT(signo) (((signo) - 1) / BITS) -#define MASK(signo) (1 << (((signo) - 1) % BITS)) - -#undef sigemptyset -#undef sigfillset -#undef sigaddset -#undef sigdelset -#undef sigismember |