diff --git a/sys/compat/linuxkpi/common/include/linux/kthread.h b/sys/compat/linuxkpi/common/include/linux/kthread.h index eaf2b31a71ab..8c7e3c899829 100644 --- a/sys/compat/linuxkpi/common/include/linux/kthread.h +++ b/sys/compat/linuxkpi/common/include/linux/kthread.h @@ -48,10 +48,15 @@ __task; \ }) +#define in_atomic() ({ \ + linux_in_atomic(); \ +}) + extern int kthread_stop(struct task_struct *); extern bool kthread_should_stop_task(struct task_struct *); extern bool kthread_should_stop(void); extern void linux_kthread_fn(void *); extern struct task_struct *linux_kthread_setup_and_run(struct thread *, linux_task_fn_t *, void *arg); +extern int linux_in_atomic(void); #endif /* _LINUX_KTHREAD_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index e69966a9e6ce..4f6b61d5a812 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -73,8 +73,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include +#include +#include #include #include #include @@ -1679,6 +1680,13 @@ linux_on_each_cpu(void callback(void *), void *data) return (0); } +int +linux_in_atomic(void) +{ + + return ((curthread->td_pflags & TDP_NOFAULTING) != 0); +} + struct linux_cdev * linux_find_cdev(const char *name, unsigned major, unsigned minor) {