1 #ifndef _LINUX_KTHREAD_H
2 #define _LINUX_KTHREAD_H
3 /* Simple interface for creating and stopping kernel threads without mess. */
5 #include <linux/sched.h>
7 struct task_struct
*kthread_create(int (*threadfn
)(void *data
),
9 const char namefmt
[], ...)
10 __attribute__((format(printf
, 3, 4)));
13 * kthread_run - create and wake a thread.
14 * @threadfn: the function to run until signal_pending(current).
15 * @data: data ptr for @threadfn.
16 * @namefmt: printf-style name for the thread.
18 * Description: Convenient wrapper for kthread_create() followed by
19 * wake_up_process(). Returns the kthread or ERR_PTR(-ENOMEM).
21 #define kthread_run(threadfn, data, namefmt, ...) \
23 struct task_struct *__k \
24 = kthread_create(threadfn, data, namefmt, ## __VA_ARGS__); \
26 wake_up_process(__k); \
30 void kthread_bind(struct task_struct
*k
, unsigned int cpu
);
31 int kthread_stop(struct task_struct
*k
);
32 int kthread_should_stop(void);
34 int kthreadd(void *unused
);
35 extern struct task_struct
*kthreadd_task
;
37 #endif /* _LINUX_KTHREAD_H */