summaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-01-21 22:34:01 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-01-21 22:34:01 +0000
commit9e30c3705aed9fbec4c3304570e4d6e707856bcb (patch)
treeb19e6acb5a67af31a4e7742e05c2166dc3f1444c /kernel/sched.c
parent72919904796333a20c6a5d5c380091b42e407aa9 (diff)
Merge with Linux 2.3.22.
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 431d5c719..ac68af2e3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -510,6 +510,7 @@ signed long schedule_timeout(signed long timeout)
printk(KERN_ERR "schedule_timeout: wrong timeout "
"value %lx from %p\n", timeout,
__builtin_return_address(0));
+ current->state = TASK_RUNNING;
goto out;
}
}
@@ -1181,7 +1182,7 @@ static void update_wall_time(unsigned long ticks)
static inline void do_process_times(struct task_struct *p,
unsigned long user, unsigned long system)
{
- long psecs;
+ unsigned long psecs;
psecs = (p->times.tms_utime += user);
psecs += (p->times.tms_stime += system);
@@ -1808,6 +1809,35 @@ void show_state(void)
read_unlock(&tasklist_lock);
}
+/*
+ * Put all the gunge required to become a kernel thread without
+ * attached user resources in one place where it belongs.
+ */
+
+void daemonize(void)
+{
+ struct fs_struct *fs;
+
+
+ /*
+ * If we were started as result of loading a module, close all of the
+ * user space pages. We don't need them, and if we didn't close them
+ * they would be locked into memory.
+ */
+ exit_mm(current);
+
+ current->session = 1;
+ current->pgrp = 1;
+
+ /* Become as one with the init task */
+
+ exit_fs(current); /* current->fs->count--; */
+ fs = init_task.fs;
+ current->fs = fs;
+ atomic_inc(&fs->count);
+
+}
+
void __init init_idle(void)
{
cycles_t t;