Implement in_atomic() function in the LinuxKPI.

Obtained from:		kmacy @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
This commit is contained in:
hselasky 2017-05-31 15:05:44 +00:00
parent d1f96a5c3d
commit fc09dd7cd5
2 changed files with 14 additions and 1 deletions

View File

@ -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_ */

View File

@ -73,8 +73,9 @@ __FBSDID("$FreeBSD$");
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/kthread.h>
#include <linux/kernel.h>
#include <linux/compat.h>
#include <linux/poll.h>
#include <linux/smp.h>
@ -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)
{