xref: /freebsd/sys/contrib/openzfs/config/kernel-kthread.m4 (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [
2	dnl #
3	dnl # 5.17 API,
4	dnl # cead18552660702a4a46f58e65188fe5f36e9dfe ("exit: Rename complete_and_exit to kthread_complete_and_exit")
5	dnl #
6	dnl # Also moves the definition from include/linux/kernel.h to include/linux/kthread.h
7	dnl #
8	AC_MSG_CHECKING([whether kthread_complete_and_exit() is available])
9	ZFS_LINUX_TEST_RESULT([kthread_complete_and_exit], [
10		AC_MSG_RESULT(yes)
11		AC_DEFINE(SPL_KTHREAD_COMPLETE_AND_EXIT, kthread_complete_and_exit, [kthread_complete_and_exit() available])
12	], [
13		AC_MSG_RESULT(no)
14		AC_DEFINE(SPL_KTHREAD_COMPLETE_AND_EXIT, complete_and_exit, [using complete_and_exit() instead])
15	])
16])
17
18AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
19	dnl #
20	dnl # 5.17 API: enum pid_type * as new 4th dequeue_signal() argument,
21	dnl # 5768d8906bc23d512b1a736c1e198aa833a6daa4 ("signal: Requeue signals in the appropriate queue")
22	dnl #
23	dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info);
24	dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
25	dnl #
26	AC_MSG_CHECKING([whether dequeue_signal() takes 4 arguments])
27	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal], [
28		AC_MSG_RESULT(yes)
29		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1, [dequeue_signal() takes 4 arguments])
30	], [
31		AC_MSG_RESULT(no)
32	])
33])
34
35AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [
36	ZFS_LINUX_TEST_SRC([kthread_complete_and_exit], [
37		#include <linux/kthread.h>
38	], [
39		struct completion *completion = NULL;
40		long code = 0;
41
42		kthread_complete_and_exit(completion, code);
43	])
44])
45
46AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
47	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal], [
48		#include <linux/sched/signal.h>
49	], [
50		struct task_struct *task = NULL;
51		sigset_t *mask = NULL;
52		kernel_siginfo_t *info = NULL;
53		enum pid_type *type = NULL;
54		int error __attribute__ ((unused));
55
56		error = dequeue_signal(task, mask, info, type);
57	])
58])
59
60AC_DEFUN([ZFS_AC_KERNEL_KTHREAD], [
61	ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT
62	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG
63])
64
65AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD], [
66	ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT
67	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG
68])
69