diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 74c67629ee62..0c32e28cdc5f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1181,25 +1181,26 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1181 | */ | 1181 | */ |
1182 | p->ioprio = current->ioprio; | 1182 | p->ioprio = current->ioprio; |
1183 | 1183 | ||
1184 | add_parent(p); | 1184 | if (likely(p->pid)) { |
1185 | if (unlikely(p->ptrace & PT_PTRACED)) | 1185 | add_parent(p); |
1186 | __ptrace_link(p, current->parent); | 1186 | if (unlikely(p->ptrace & PT_PTRACED)) |
1187 | 1187 | __ptrace_link(p, current->parent); | |
1188 | if (thread_group_leader(p)) { | 1188 | |
1189 | p->signal->tty = current->signal->tty; | 1189 | if (thread_group_leader(p)) { |
1190 | p->signal->pgrp = process_group(current); | 1190 | p->signal->tty = current->signal->tty; |
1191 | p->signal->session = current->signal->session; | 1191 | p->signal->pgrp = process_group(current); |
1192 | attach_pid(p, PIDTYPE_PGID, process_group(p)); | 1192 | p->signal->session = current->signal->session; |
1193 | attach_pid(p, PIDTYPE_SID, p->signal->session); | 1193 | attach_pid(p, PIDTYPE_PGID, process_group(p)); |
1194 | 1194 | attach_pid(p, PIDTYPE_SID, p->signal->session); | |
1195 | list_add_tail(&p->tasks, &init_task.tasks); | 1195 | |
1196 | if (p->pid) | 1196 | list_add_tail(&p->tasks, &init_task.tasks); |
1197 | __get_cpu_var(process_counts)++; | 1197 | __get_cpu_var(process_counts)++; |
1198 | } | ||
1199 | attach_pid(p, PIDTYPE_TGID, p->tgid); | ||
1200 | attach_pid(p, PIDTYPE_PID, p->pid); | ||
1201 | nr_threads++; | ||
1198 | } | 1202 | } |
1199 | attach_pid(p, PIDTYPE_TGID, p->tgid); | ||
1200 | attach_pid(p, PIDTYPE_PID, p->pid); | ||
1201 | 1203 | ||
1202 | nr_threads++; | ||
1203 | total_forks++; | 1204 | total_forks++; |
1204 | spin_unlock(¤t->sighand->siglock); | 1205 | spin_unlock(¤t->sighand->siglock); |
1205 | write_unlock_irq(&tasklist_lock); | 1206 | write_unlock_irq(&tasklist_lock); |
@@ -1263,7 +1264,7 @@ task_t * __devinit fork_idle(int cpu) | |||
1263 | if (!task) | 1264 | if (!task) |
1264 | return ERR_PTR(-ENOMEM); | 1265 | return ERR_PTR(-ENOMEM); |
1265 | init_idle(task, cpu); | 1266 | init_idle(task, cpu); |
1266 | unhash_process(task); | 1267 | |
1267 | return task; | 1268 | return task; |
1268 | } | 1269 | } |
1269 | 1270 | ||