Skip to contentSkip to conversation

Explicitly set pgid/sid of init

PATCH New Sukadev Bhattiprolu 1 participant 1 message Jan 20, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Explicitly set pgid/sid of init

Pls treat this patch as Patch 2/2 where Patch 1/2 is

	http://lkml.org/lkml/2007/1/19/159

---

From: Sukadev Bhattiprolu <[email protected]>

Explicitly set pgid and sid of init process to 1.

Cc Cedric Le Goater <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Serge Hallyn <[email protected]>
Cc Eric Biederman <[email protected]>
---
 init/main.c   |    1 +
 kernel/exit.c |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
init/main.c +1 -0
Index: lx26-20-rc4-mm1/init/main.c
===================================================================
@@ -774,6 +774,7 @@ static int __init init(void * unused)
 	 */
 	init_pid_ns.child_reaper = current;
 
+	__set_special_pids(1, 1);
 	cad_pid = task_pid(current);
 
 	smp_prepare_cpus(max_cpus);
kernel/exit.c +2 -2
Index: lx26-20-rc4-mm1/kernel/exit.c
===================================================================
@@ -297,12 +297,12 @@ void __set_special_pids(pid_t session, p
 {
 	struct task_struct *curr = current->group_leader;
 
-	if (process_session(curr) != session) {
+	if (pid_nr(task_session(curr)) != session) {
 		detach_pid(curr, PIDTYPE_SID);
 		set_signal_session(curr->signal, session);
 		attach_pid(curr, PIDTYPE_SID, find_pid(session));
 	}
-	if (process_group(curr) != pgrp) {
+	if (pid_nr(task_pgrp(curr)) != pgrp) {
 		detach_pid(curr, PIDTYPE_PGID);
 		curr->signal->pgrp = pgrp;
 		attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp));