aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kthread.c')
-rw-r--r--kernel/kthread.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 8b63c7fee73b..2dc3786349d1 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -37,6 +37,7 @@ struct kthread_create_info
37 37
38struct kthread { 38struct kthread {
39 int should_stop; 39 int should_stop;
40 void *data;
40 struct completion exited; 41 struct completion exited;
41}; 42};
42 43
@@ -56,6 +57,19 @@ int kthread_should_stop(void)
56} 57}
57EXPORT_SYMBOL(kthread_should_stop); 58EXPORT_SYMBOL(kthread_should_stop);
58 59
60/**
61 * kthread_data - return data value specified on kthread creation
62 * @task: kthread task in question
63 *
64 * Return the data value specified when kthread @task was created.
65 * The caller is responsible for ensuring the validity of @task when
66 * calling this function.
67 */
68void *kthread_data(struct task_struct *task)
69{
70 return to_kthread(task)->data;
71}
72
59static int kthread(void *_create) 73static int kthread(void *_create)
60{ 74{
61 /* Copy data: it's on kthread's stack */ 75 /* Copy data: it's on kthread's stack */
@@ -66,6 +80,7 @@ static int kthread(void *_create)
66 int ret; 80 int ret;
67 81
68 self.should_stop = 0; 82 self.should_stop = 0;
83 self.data = data;
69 init_completion(&self.exited); 84 init_completion(&self.exited);
70 current->vfork_done = &self.exited; 85 current->vfork_done = &self.exited;
71 86