From 754e15c5a6f9d24fda6b9ddc605515696d127817 Mon Sep 17 00:00:00 2001 From: Finix Date: Fri, 18 Oct 2024 10:42:03 +0800 Subject: [PATCH] config: add HAVE_DEQUEUE_SIGNAL_3ARG_SIGINFO The dequeue_signal API accepts siginfo_t as the third parameter instead of kernel_siginfo_t in 4.18 and 4.19. Signed-off-by: Finix --- config/kernel-kthread.m4 | 20 ++++++++++++++++++++ module/os/linux/spl/spl-thread.c | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/config/kernel-kthread.m4 b/config/kernel-kthread.m4 index 4d580efead6b..dab05d909407 100644 --- a/config/kernel-kthread.m4 +++ b/config/kernel-kthread.m4 @@ -16,6 +16,9 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [ ]) AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL], [ + dnl # + dnl # Earlier than 4.20 API: + dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, siginfo_t *info); dnl # dnl # 5.17 API: enum pid_type * as new 4th dequeue_signal() argument, dnl # 5768d8906bc23d512b1a736c1e198aa833a6daa4 ("signal: Requeue signals in the appropriate queue") @@ -40,6 +43,12 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL], [ [dequeue_signal() takes a task argument]) ], [ AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether dequeue_signal() a siginfo argument]) + ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_3arg_siginfo], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEQUEUE_SIGNAL_3ARG_SIGINFO, 1, + [dequeue_signal() takes a siginfo argument]) + ]) ]) ]) ]) @@ -56,6 +65,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [ ]) AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL], [ + ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_siginfo], [ + #include + ], [ + struct task_struct *task = NULL; + sigset_t *mask = NULL; + siginfo_t *info = NULL; + int error __attribute__ ((unused)); + + error = dequeue_signal(task, mask, info); + ]) + ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_task], [ #include ], [ diff --git a/module/os/linux/spl/spl-thread.c b/module/os/linux/spl/spl-thread.c index 7f74d44f91ff..2841bf4cbfe8 100644 --- a/module/os/linux/spl/spl-thread.c +++ b/module/os/linux/spl/spl-thread.c @@ -171,7 +171,8 @@ issig(void) #if defined(HAVE_DEQUEUE_SIGNAL_4ARG) enum pid_type __type; if (dequeue_signal(current, &set, &__info, &__type) != 0) { -#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK) +#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK) || \ + defined(HAVE_DEQUEUE_SIGNAL_3ARG_SIGINFO) if (dequeue_signal(current, &set, &__info) != 0) { #else enum pid_type __type;