diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2006-12-08 05:38:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:52 -0500 |
commit | 62dfb5541a025b47df9405ff0219c7829a97d83b (patch) | |
tree | 4690d5d0bb750f977a0b73662019e5ced3ab99b4 /kernel/exit.c | |
parent | f020bc468fe4a91d32046d448511978c7b611315 (diff) |
[PATCH] session_of_pgrp: kill unnecessary do_each_task_pid(PIDTYPE_PGID)
All members of the process group have the same sid and it can't be == 0.
NOTE: this code (and a similar one in sys_setpgid) was needed because it
was possibe to have ->session == 0. It's not possible any longer since
[PATCH] pidhash: don't use zero pids
Commit: c7c6464117a02b0d54feb4ebeca4db70fa493678
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index fd0e067952ab..03e64fe4a14a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -189,21 +189,18 @@ repeat: | |||
189 | int session_of_pgrp(int pgrp) | 189 | int session_of_pgrp(int pgrp) |
190 | { | 190 | { |
191 | struct task_struct *p; | 191 | struct task_struct *p; |
192 | int sid = -1; | 192 | int sid = 0; |
193 | 193 | ||
194 | read_lock(&tasklist_lock); | 194 | read_lock(&tasklist_lock); |
195 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 195 | |
196 | if (process_session(p) > 0) { | 196 | p = find_task_by_pid_type(PIDTYPE_PGID, pgrp); |
197 | sid = process_session(p); | 197 | if (p == NULL) |
198 | goto out; | 198 | p = find_task_by_pid(pgrp); |
199 | } | 199 | if (p != NULL) |
200 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); | ||
201 | p = find_task_by_pid(pgrp); | ||
202 | if (p) | ||
203 | sid = process_session(p); | 200 | sid = process_session(p); |
204 | out: | 201 | |
205 | read_unlock(&tasklist_lock); | 202 | read_unlock(&tasklist_lock); |
206 | 203 | ||
207 | return sid; | 204 | return sid; |
208 | } | 205 | } |
209 | 206 | ||