git: 7a7cee558501 - main - linux(4): Refactor SIGPWR mapping
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 May 2022 17:04:23 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=7a7cee558501a27e5b7437d012a1139ca77d97f2 commit 7a7cee558501a27e5b7437d012a1139ca77d97f2 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-30 16:55:49 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-05-30 16:55:49 +0000 linux(4): Refactor SIGPWR mapping Map Linux RT signals to the native RT signals starting from SIGRTMIN, and Linux SIGPWR signal map to after the last RT signal. MFC after: 2 weeks --- sys/compat/linux/linux.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index f29fc2b6743a..340fdb37e2a2 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -92,6 +92,8 @@ static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = { LINUX_SIGUSR2 /* SIGUSR2 */ }; +#define LINUX_SIGPWREMU (SIGRTMIN + (LINUX_SIGRTMAX - LINUX_SIGRTMIN) + 1) + static int linux_to_bsd_sigtbl[LINUX_SIGTBLSZ] = { SIGHUP, /* LINUX_SIGHUP */ SIGINT, /* LINUX_SIGINT */ @@ -127,7 +129,7 @@ static int linux_to_bsd_sigtbl[LINUX_SIGTBLSZ] = { * to the first unused FreeBSD signal number. Since Linux supports * signals from 1 to 64 we are ok here as our SIGRTMIN = 65. */ - SIGRTMIN, /* LINUX_SIGPWR */ + LINUX_SIGPWREMU,/* LINUX_SIGPWR */ SIGSYS /* LINUX_SIGSYS */ }; @@ -144,14 +146,14 @@ static inline int linux_to_bsd_rt_signal(int sig) { - return (SIGRTMIN + 1 + sig - LINUX_SIGRTMIN); + return (SIGRTMIN + sig - LINUX_SIGRTMIN); } static inline int bsd_to_linux_rt_signal(int sig) { - return (sig - SIGRTMIN - 1 + LINUX_SIGRTMIN); + return (sig - SIGRTMIN + LINUX_SIGRTMIN); } int @@ -172,7 +174,7 @@ bsd_to_linux_signal(int sig) if (sig <= LINUX_SIGTBLSZ) return (bsd_to_linux_sigtbl[_SIG_IDX(sig)]); - if (sig == SIGRTMIN) + if (sig == LINUX_SIGPWREMU) return (LINUX_SIGPWR); return (bsd_to_linux_rt_signal(sig));