lkml.org 
[lkml]   [1996]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: setsid() semantics changed...
From
Date
> Miquel van Smoorenburg:
>
> : Today I noticed that setsid() didn't work anymore. This is due to
> : a change in 2.0.1. I know that around that time some patches went in
> : to let Linux comform more to POSIX, so that may be the cause. This
> : is what changed:
>
> : diff -u --recursive --new-file v2.0.0/linux/kernel/sys.c linux/kernel/sys.c
> : --- v2.0.0/linux/kernel/sys.c Thu Jun 6 17:42:38 1996
> : +++ linux/kernel/sys.c Tue Jul 2 19:08:43 1996
> : @@ -634,8 +634,13 @@
> :
> : asmlinkage int sys_setsid(void)
> : {
> : - if (current->leader)
> : - return -EPERM;
> : + struct task_struct * p;
> : +
> : + for_each_task(p) {
> : + if (p->pgrp == current->pid)
> : + return -EPERM;
> : + }
> : +
>
> : Now a process that gets spawned by a shell that sets up the process group
> : for it (so it's the leader of it's own group, not session) cannot do
> : a setsid() anymore because the "if (p->pgrp == current->pid)" check will
> : match on itself.

If it is a group leader POSIX says it can't do setsid() so it doesn't
seem like checking whether p == current matters? I may be missing something.

Melvin


\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.083 / U:21.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site