aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-05-30 16:55:49 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-05-30 16:55:49 +0000
commit7a7cee558501a27e5b7437d012a1139ca77d97f2 (patch)
treea044368c223cd628d71d5b113280d51b333dd074 /sys/compat/linux
parent669516a1a16efe51f85ef203c3b93e6db7a3ed51 (diff)
downloadsrc-7a7cee558501a27e5b7437d012a1139ca77d97f2.tar.gz
src-7a7cee558501a27e5b7437d012a1139ca77d97f2.zip
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
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux.c10
1 files 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));