summaryrefslogtreecommitdiff
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.osdl.org>2003-10-04 21:11:08 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-10-04 21:11:08 -0700
commitda3103c8efd7570939617bfa1f06fcdab9a9a11d (patch)
treef0e07dbc22384372c17d6b836f3a794fef62eed8 /kernel/fork.c
parent799cc173710f8bac2e3d234445dbcf59483a872f (diff)
parent11d3c5ea4e4b16afcbe5f0966ed44b8b8f5ce5e5 (diff)
Merge bk://kernel.bkbits.net/davem/net-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 2005c5c180de..f804f3124820 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -725,6 +725,12 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
sig->curr_target = NULL;
init_sigpending(&sig->shared_pending);
+ sig->tty = process_tty(current);
+ sig->pgrp = process_group(current);
+ sig->session = process_session(current);
+ sig->leader = 0; /* session leadership doesn't inherit */
+ sig->tty_old_pgrp = 0;
+
return 0;
}
@@ -771,7 +777,9 @@ struct task_struct *copy_process(unsigned long clone_flags,
* Thread groups must share signals as well, and detached threads
* can only be started up within the thread group.
*/
- if ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND))
+ if ((clone_flags & CLONE_THREAD) &&
+ (clone_flags & (CLONE_SIGHAND|CLONE_DETACHED)) !=
+ (CLONE_SIGHAND|CLONE_DETACHED))
return ERR_PTR(-EINVAL);
/*
@@ -876,8 +884,6 @@ struct task_struct *copy_process(unsigned long clone_flags,
init_timer(&p->real_timer);
p->real_timer.data = (unsigned long) p;
- p->leader = 0; /* session leadership doesn't inherit */
- p->tty_old_pgrp = 0;
p->utime = p->stime = 0;
p->cutime = p->cstime = 0;
p->array = NULL;
@@ -1022,7 +1028,7 @@ struct task_struct *copy_process(unsigned long clone_flags,
if (thread_group_leader(p)) {
attach_pid(p, PIDTYPE_TGID, p->tgid);
attach_pid(p, PIDTYPE_PGID, process_group(p));
- attach_pid(p, PIDTYPE_SID, p->session);
+ attach_pid(p, PIDTYPE_SID, process_session(p));
if (p->pid)
__get_cpu_var(process_counts)++;
} else