patch-2.4.21 linux-2.4.21/kernel/fork.c
Next file: linux-2.4.21/kernel/ksyms.c
Previous file: linux-2.4.21/ipc/msg.c
Back to the patch index
Back to the overall index
- Lines: 40
- Date:
2003-06-13 07:51:39.000000000 -0700
- Orig file:
linux-2.4.20/kernel/fork.c
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.20/kernel/fork.c linux-2.4.21/kernel/fork.c
@@ -27,6 +27,7 @@
#include <asm/pgalloc.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
+#include <asm/processor.h>
/* The idle threads do not count.. */
int nr_threads;
@@ -565,6 +566,31 @@
p->flags = new_flags;
}
+long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
+{
+ struct task_struct *task = current;
+ unsigned old_task_dumpable;
+ long ret;
+
+ /* lock out any potential ptracer */
+ task_lock(task);
+ if (task->ptrace) {
+ task_unlock(task);
+ return -EPERM;
+ }
+
+ old_task_dumpable = task->task_dumpable;
+ task->task_dumpable = 0;
+ task_unlock(task);
+
+ ret = arch_kernel_thread(fn, arg, flags);
+
+ /* never reached in child process, only in parent */
+ current->task_dumpable = old_task_dumpable;
+
+ return ret;
+}
+
/*
* Ok, this is the main fork-routine. It copies the system process
* information (task[nr]) and sets up the necessary registers. It also
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)