Re: setsid() semantics changed...

Michiel Boland (
Tue, 16 Jul 1996 15:52:00 +0200

>Reading this carefully, I see that the current Linux behaviour _is_
>Posix compliant; read the first line after EPERM again. It says
>"The calling process is already a process group leader". So what I did,
>calling "setpgrp(0, getpgid(getppid()))" first is indeed the right thing
>to do if you really want to setsid(). I still think it doesn't make sense,
>but.. I'll attribute a section to the setsid() manpage about this if
>you want ;) (what is the latest version?)

Included below is a warning from the setsid(2) manpage for
Solaris. Something like this should be included in the linux man

A call to setsid() by a process that is a process group
leader will fail. A process can become a process group
leader by being the last member of a pipeline started by a
job control shell. Thus, a process that expects to be part
of a pipeline, and that calls setsid(), should always first
fork; the parent should exit and the child should call set-
sid(). This will ensure that the calling process will work
reliably when started by both job control shells and non-job
control shells.

Michiel Boland <>
University of Nijmegen
The Netherlands