klibc-bot for Ben Hutchings
2020-Aug-29 16:36 UTC
[klibc] [klibc:master] signal: Add config flag for additional sigaction fixup
Commit-ID: 755b07d826618779a2232199cb53e2a44809ad89 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=755b07d826618779a2232199cb53e2a44809ad89 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Fri, 28 Aug 2020 19:37:19 +0100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 29 Aug 2020 17:22:38 +0100 [klibc] signal: Add config flag for additional sigaction fixup On ia64, sigaction() needs to make further changes to the given struct sigaction. Add a config flag for this, that forces copying of struct sigaction. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/klibc/sysconfig.h | 11 +++++++++++ usr/klibc/sigaction.c | 20 ++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/usr/include/klibc/sysconfig.h b/usr/include/klibc/sysconfig.h index 5722e04f..d658ad30 100644 --- a/usr/include/klibc/sysconfig.h +++ b/usr/include/klibc/sysconfig.h @@ -176,6 +176,17 @@ #endif +/* + * _KLIBC_NEEDS_SIGACTION_FIXUP + * + * On some architectures, struct sigaction needs additional + * changes before passing to the kernel. + */ +#ifndef _KLIBC_NEEDS_SIGACTION_FIXUP +# define _KLIBC_NEEDS_SIGACTION_FIXUP 0 +#endif + + /* * _KLIBC_STATFS_F_TYPE_64: * diff --git a/usr/klibc/sigaction.c b/usr/klibc/sigaction.c index d2223843..a8181a41 100644 --- a/usr/klibc/sigaction.c +++ b/usr/klibc/sigaction.c @@ -8,11 +8,17 @@ #include <klibc/sysconfig.h> __extern void __sigreturn(void); + +#if _KLIBC_NEEDS_SIGACTION_FIXUP +typedef struct sigaction *act_type; +#else +typedef const struct sigaction *act_type; +#endif + #if _KLIBC_USE_RT_SIG -__extern int __rt_sigaction(int, const struct sigaction *, struct sigaction *, - size_t); +__extern int __rt_sigaction(int, act_type, struct sigaction *, size_t); #else -__extern int __sigaction(int, const struct sigaction *, struct sigaction *); +__extern int __sigaction(int, act_type, struct sigaction *); #endif int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) @@ -28,7 +34,9 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) struct sigaction sa; int rv; - if (act && (act->sa_flags & needed_flags) != needed_flags) { + if (act && + ((act->sa_flags & needed_flags) != needed_flags || + _KLIBC_NEEDS_SIGACTION_FIXUP)) { sa = *act; sa.sa_flags |= needed_flags; #if _KLIBC_NEEDS_SA_RESTORER @@ -46,9 +54,9 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) + sizeof(sigset_t) == sizeof(struct sigaction) ? 1 : -1]); - rv = __rt_sigaction(sig, act, oact, sizeof(sigset_t)); + rv = __rt_sigaction(sig, (act_type)act, oact, sizeof(sigset_t)); #else - rv = __sigaction(sig, act, oact); + rv = __sigaction(sig, (act_type)act, oact); #endif #if _KLIBC_NEEDS_SA_RESTORER
Seemingly Similar Threads
- [klibc:ia64-signal-fix] signal: Add config flag for additional sigaction fixup
- [klibc:ia64-signal-fix] signal: Move rt_sigaction() argument mangling to arch directories
- [klibc:master] signal: Add sysconfig setting to force SA_SIGINFO on
- [klibc:master] ia64: Fix sigaction function implementation
- [klibc:ia64-signal-fix] ia64: Fix sigaction struct layout and function implementation