summaryrefslogtreecommitdiffstats
path: root/kernel
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
parent72919904796333a20c6a5d5c380091b42e407aa9 (diff)
Merge with Linux 2.3.22.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ksyms.c3
-rw-r--r--kernel/sched.c32
2 files changed, 34 insertions, 1 deletions
diff --git a/kernel/ksyms.c b/kernel/ksyms.c
index d35ce640a..910341fc6 100644
--- a/kernel/ksyms.c
+++ b/kernel/ksyms.c
@@ -366,6 +366,7 @@ EXPORT_SYMBOL(secure_tcp_sequence_number);
EXPORT_SYMBOL(get_random_bytes);
EXPORT_SYMBOL(securebits);
EXPORT_SYMBOL(cap_bset);
+EXPORT_SYMBOL(daemonize);
/* Program loader interfaces */
EXPORT_SYMBOL(setup_arg_pages);
@@ -425,3 +426,5 @@ EXPORT_SYMBOL(get_fast_time);
/* library functions */
EXPORT_SYMBOL(strnicmp);
+
+EXPORT_SYMBOL(init_task_union);
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;