From: Adhemerval Zanella Date: Mon, 15 Mar 2021 18:23:40 +0000 (-0300) Subject: signal: Add __libc_sigaction X-Git-Tag: upstream/2.34~804 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a894053318f1ca246d13bb9efa65bd702df6b63e;p=platform%2Fupstream%2Fglibc.git signal: Add __libc_sigaction The generic implementation basically handle the system agnostic logic (filtering out the invalid signals) while the __libc_sigaction is the function with implements the system and architecture bits. Checked on x86_64-linux-gnu and i686-linux-gnu. --- diff --git a/nptl/Makefile b/nptl/Makefile index d370440..b1948cc 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -225,6 +225,7 @@ libpthread-routines = \ sem_unlink \ sem_wait \ sigaction \ + libc_sigaction \ tpp \ unwind \ unwind-forcedunwind \ diff --git a/signal/Makefile b/signal/Makefile index 3d8cab1..99889a5 100644 --- a/signal/Makefile +++ b/signal/Makefile @@ -35,7 +35,7 @@ headers := signal.h sys/signal.h \ bits/sigstksz.h routines := signal raise killpg \ - sigaction sigprocmask kill \ + sigaction libc_sigaction sigprocmask kill \ sigpending sigsuspend sigwait \ sigblock sigsetmask sigpause sigvec \ sigstack sigaltstack sigintr \ diff --git a/signal/libc_sigaction.c b/signal/libc_sigaction.c new file mode 100644 index 0000000..c25913b --- /dev/null +++ b/signal/libc_sigaction.c @@ -0,0 +1,32 @@ +/* Internal sigaction definitions. + Copyright (C) 2021 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 + . */ + +#include +#include + +/* If ACT is not NULL, change the action for SIG to *ACT. + If OACT is not NULL, put the old action for SIG in *OACT. */ +int +__libc_sigaction (int sig, const struct sigaction *act, + struct sigaction *oact) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (libc_sigaction) +libc_hidden_def (__libc_sigaction) diff --git a/signal/sigaction.c b/signal/sigaction.c index 3bfc179..8d9f755 100644 --- a/signal/sigaction.c +++ b/signal/sigaction.c @@ -17,7 +17,7 @@ #include #include - +#include /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ @@ -30,10 +30,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) return -1; } - __set_errno (ENOSYS); - return -1; + return __libc_sigaction (sig, act, oact); } libc_hidden_def (__sigaction) -stub_warning (sigaction) - weak_alias (__sigaction, sigaction) diff --git a/sysdeps/mach/hurd/sigaction.c b/sysdeps/mach/hurd/libc_sigaction.c similarity index 89% rename from sysdeps/mach/hurd/sigaction.c rename to sysdeps/mach/hurd/libc_sigaction.c index ab91e12..29547e2 100644 --- a/sysdeps/mach/hurd/sigaction.c +++ b/sysdeps/mach/hurd/libc_sigaction.c @@ -24,16 +24,15 @@ /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ int -__sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +__libc_sigaction (int sig, const struct sigaction *act, + struct sigaction *oact) { struct hurd_sigstate *ss; struct sigaction a, old; sigset_t pending; - if (sig <= 0 || sig >= NSIG - || (act != NULL && act->sa_handler != SIG_DFL - && ((__sigmask (sig) & _SIG_CANT_MASK) - || act->sa_handler == SIG_ERR))) + if (act != NULL && act->sa_handler != SIG_DFL + && ((__sigmask (sig) & _SIG_CANT_MASK) || act->sa_handler == SIG_ERR)) { errno = EINVAL; return -1; @@ -87,5 +86,4 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) return 0; } -libc_hidden_def (__sigaction) -weak_alias (__sigaction, sigaction) +libc_hidden_def (__libc_sigaction) diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 7209c24..341eec2 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -74,7 +74,6 @@ setsid - setsid i: __setsid setsid setsockopt - setsockopt i:iiibn setsockopt __setsockopt setuid - setuid i:i __setuid setuid shutdown - shutdown i:ii shutdown -sigaction - sigaction i:ipp __sigaction sigaction sigsuspend - sigsuspend Ci:p sigsuspend socket - socket i:iii __socket socket socketpair - socketpair i:iiif socketpair diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c b/sysdeps/unix/sysv/linux/aarch64/libc_sigaction.c similarity index 95% rename from sysdeps/unix/sysv/linux/aarch64/sigaction.c rename to sysdeps/unix/sysv/linux/aarch64/libc_sigaction.c index 6f44866..a2a2a17 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c +++ b/sysdeps/unix/sysv/linux/aarch64/libc_sigaction.c @@ -27,4 +27,4 @@ #define RESET_SA_RESTORER(act, kact) \ (act)->sa_restorer = (kact)->sa_restorer; -#include +#include diff --git a/sysdeps/unix/sysv/linux/arc/sigaction.c b/sysdeps/unix/sysv/linux/arc/libc_sigaction.c similarity index 95% rename from sysdeps/unix/sysv/linux/arc/sigaction.c rename to sysdeps/unix/sysv/linux/arc/libc_sigaction.c index 2807f74..26da42f 100644 --- a/sysdeps/unix/sysv/linux/arc/sigaction.c +++ b/sysdeps/unix/sysv/linux/arc/libc_sigaction.c @@ -28,4 +28,4 @@ extern void __default_rt_sa_restorer (void); #define RESET_SA_RESTORER(act, kact) -#include +#include diff --git a/sysdeps/unix/sysv/linux/arm/sigaction.c b/sysdeps/unix/sysv/linux/arm/libc_sigaction.c similarity index 96% rename from sysdeps/unix/sysv/linux/arm/sigaction.c rename to sysdeps/unix/sysv/linux/arm/libc_sigaction.c index 76a9abe..de06131 100644 --- a/sysdeps/unix/sysv/linux/arm/sigaction.c +++ b/sysdeps/unix/sysv/linux/arm/libc_sigaction.c @@ -36,4 +36,4 @@ extern void __default_rt_sa_restorer (void); #define RESET_SA_RESTORER(act, kact) \ (act)->sa_restorer = (kact)->sa_restorer; -#include +#include diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/libc_sigaction.c similarity index 97% rename from sysdeps/unix/sysv/linux/i386/sigaction.c rename to sysdeps/unix/sysv/linux/i386/libc_sigaction.c index 46aeca2..1d64576 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/libc_sigaction.c @@ -39,7 +39,7 @@ extern void restore (void) asm ("__restore") attribute_hidden; #define RESET_SA_RESTORER(act, kact) \ (act)->sa_restorer = (kact)->sa_restorer -#include +#include /* NOTE: Please think twice before making any changes to the bits of code below. GDB needs some intimate knowledge about it to diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/libc_sigaction.c similarity index 98% rename from sysdeps/unix/sysv/linux/sigaction.c rename to sysdeps/unix/sysv/linux/libc_sigaction.c index 38088f9..21fe657 100644 --- a/sysdeps/unix/sysv/linux/sigaction.c +++ b/sysdeps/unix/sysv/linux/libc_sigaction.c @@ -70,5 +70,3 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) return result; } libc_hidden_def (__libc_sigaction) - -#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/libc_sigaction.c similarity index 96% rename from sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c rename to sysdeps/unix/sysv/linux/sparc/sparc32/libc_sigaction.c index f1e07fb..09a052f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc_sigaction.c @@ -34,4 +34,4 @@ void __sigreturn_stub (void); : 0, \ (sigsetsize) -#include +#include diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc64/libc_sigaction.c similarity index 95% rename from sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c rename to sysdeps/unix/sysv/linux/sparc/sparc64/libc_sigaction.c index 2e7f940..6cfcf0a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc_sigaction.c @@ -29,4 +29,4 @@ void __rt_sigreturn_stub (void); (((unsigned long) &__rt_sigreturn_stub) - 8), \ (sigsetsize) -#include +#include diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c similarity index 99% rename from sysdeps/unix/sysv/linux/x86_64/sigaction.c rename to sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c index b295037..21367e9 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c +++ b/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c @@ -30,7 +30,7 @@ extern void restore_rt (void) asm ("__restore_rt") attribute_hidden; #include -#include +#include /* NOTE: Please think twice before making any changes to the bits of code below. GDB needs some intimate knowledge about it to