lock_kernel();
exit_mm(c->gc_task);
- current->session = 1;
- current->pgrp = 1;
+ set_special_pids(1, 1);
init_completion(&c->gc_thread_comp); /* barrier */
spin_lock_irq(¤t->sighand->siglock);
siginitsetinv (¤t->blocked, sigmask(SIGHUP) | sigmask(SIGKILL) | sigmask(SIGSTOP) | sigmask(SIGCONT));
extern struct mm_struct init_mm;
extern struct task_struct *find_task_by_pid(int pid);
+extern void set_special_pids(pid_t session, pid_t pgrp);
+extern void __set_special_pids(pid_t session, pid_t pgrp);
/* per-UID process charging. */
extern struct user_struct * alloc_uid(uid_t);
write_unlock_irq(&tasklist_lock);
}
+void __set_special_pids(pid_t session, pid_t pgrp)
+{
+ struct task_struct *curr = current;
+
+ if (curr->session != session) {
+ detach_pid(curr, PIDTYPE_SID);
+ curr->session = session;
+ attach_pid(curr, PIDTYPE_SID, session);
+ }
+ if (curr->pgrp != pgrp) {
+ detach_pid(curr, PIDTYPE_PGID);
+ curr->pgrp = pgrp;
+ attach_pid(curr, PIDTYPE_PGID, pgrp);
+ }
+}
+
+void set_special_pids(pid_t session, pid_t pgrp)
+{
+ write_lock_irq(&tasklist_lock);
+ __set_special_pids(session, pgrp);
+ write_unlock_irq(&tasklist_lock);
+}
+
/*
* Put all the gunge required to become a kernel thread without
* attached user resources in one place where it belongs.
*/
exit_mm(current);
- current->session = 1;
- current->pgrp = 1;
+ set_special_pids(1, 1);
current->tty = NULL;
/* Become as one with the init task */
int i;
struct task_struct *curtask = current;
- curtask->session = 1;
- curtask->pgrp = 1;
+ set_special_pids(1, 1);
use_init_fs_context();
goto out;
current->leader = 1;
- if (current->session != current->pid) {
- detach_pid(current, PIDTYPE_SID);
- current->session = current->pid;
- attach_pid(current, PIDTYPE_SID, current->pid);
- }
- if (current->pgrp != current->pid) {
- detach_pid(current, PIDTYPE_PGID);
- current->pgrp = current->pid;
- attach_pid(current, PIDTYPE_PGID, current->pid);
- }
+ __set_special_pids(current->pid, current->pid);
current->tty = NULL;
current->tty_old_pgrp = 0;
err = current->pgrp;