lkml.org 
[lkml]   [2007]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/3] reduce reparent_to_init()
Move some random stuff which doesn't need tasklist_lock from reparent_to_init()
to its caller, daemonize(). Strictly speaking, rlim is protected by task_lock()
but we don't need it to copy init_task->rlim.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.21-rc5/kernel/exit.c~1_REDUCE 2007-04-05 12:18:28.000000000 +0400
+++ 2.6.21-rc5/kernel/exit.c 2007-04-10 21:32:44.000000000 +0400
@@ -271,7 +271,6 @@ static void reparent_to_init(void)
write_lock_irq(&tasklist_lock);

ptrace_unlink(current);
- /* Reparent to init */
remove_parent(current);
current->parent = child_reaper(current);
current->real_parent = child_reaper(current);
@@ -280,17 +279,8 @@ static void reparent_to_init(void)
/* Set the exit signal to SIGCHLD so we signal init on exit */
current->exit_signal = SIGCHLD;

- if (!has_rt_policy(current) && (task_nice(current) < 0))
- set_user_nice(current, 0);
- /* cpus_allowed? */
- /* rt_priority? */
- /* signals? */
security_task_reparent_to_init(current);
- memcpy(current->signal->rlim, init_task.signal->rlim,
- sizeof(current->signal->rlim));
- atomic_inc(&(INIT_USER->__count));
write_unlock_irq(&tasklist_lock);
- switch_uid(INIT_USER);
}

void __set_special_pids(pid_t session, pid_t pgrp)
@@ -402,6 +392,17 @@ void daemonize(const char *name, ...)
atomic_inc(&current->files->count);

reparent_to_init();
+
+ if (!has_rt_policy(current) && (task_nice(current) < 0))
+ set_user_nice(current, 0);
+ /* cpus_allowed? */
+ /* rt_priority? */
+ /* signals? */
+ memcpy(current->signal->rlim, init_task.signal->rlim,
+ sizeof(current->signal->rlim));
+
+ atomic_inc(&(INIT_USER->__count));
+ switch_uid(INIT_USER);
}

EXPORT_SYMBOL(daemonize);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-10 20:53    [W:0.030 / U:8.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site