From a894053318f1ca246d13bb9efa65bd702df6b63e Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 15 Mar 2021 15:23:40 -0300 Subject: 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. --- signal/Makefile | 2 +- signal/libc_sigaction.c | 32 ++++++++++++++++++++++++++++++++ signal/sigaction.c | 7 ++----- 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 signal/libc_sigaction.c (limited to 'signal') diff --git a/signal/Makefile b/signal/Makefile index 3d8cab1f50..99889a53a4 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 0000000000..c25913b9bd --- /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 3bfc17945c..8d9f755ccc 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) -- cgit 1.4.1