Skip to content

Commit

Permalink
[PATCH] session_of_pgrp: kill unnecessary do_each_task_pid(PIDTYPE_PGID)
Browse files Browse the repository at this point in the history
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: c7c6464

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>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Dec 8, 2006
1 parent f020bc4 commit 62dfb55
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,18 @@ void release_task(struct task_struct * p)
int session_of_pgrp(int pgrp)
{
struct task_struct *p;
int sid = -1;
int sid = 0;

read_lock(&tasklist_lock);
do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
if (process_session(p) > 0) {
sid = process_session(p);
goto out;
}
} while_each_task_pid(pgrp, PIDTYPE_PGID, p);
p = find_task_by_pid(pgrp);
if (p)

p = find_task_by_pid_type(PIDTYPE_PGID, pgrp);
if (p == NULL)
p = find_task_by_pid(pgrp);
if (p != NULL)
sid = process_session(p);
out:

read_unlock(&tasklist_lock);

return sid;
}

Expand Down

0 comments on commit 62dfb55

Please sign in to comment.