Re: [PATCH] setsid: always fork a new process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Hi Mathias,

On Fri, Jul 18, 2008 at 01:46:54AM +0200, Mathias Kende wrote:
> The current setsid utility forks a new process only if its process is
> group leader.

 sure, setsid(2) does not work for group leaders

> But for setsid to work, it needs to spawn a new process in
> any case.

 I don't think so. The setsid(1) does not need to fork when the
 process is not session leader. It simply calls setsid(2) and creates a
 new session. The purpose of the util is "create a new session" and
 nothing other.

> -----
> all:
> 	setsid cat
> -----
> While calling directly "setsid cat" from a shell will return immediatly.

 sure, because the interactive shell creates a new session (to control
 jobs) and when you ask for a next new session (by setsid(1)) you need
 an extra fork().

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux