Re: [RFC] Fix getsid(0)

From:

Thomas Bushnell BSG

Subject:

Re: [RFC] Fix getsid(0)

Date:

Tue, 17 Jan 2006 11:33:48 -0800

User-agent:

Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Samuel Thibault <address@hidden> writes:
> Thomas Bushnell BSG, le Tue 17 Jan 2006 00:46:49 -0800, a écrit :
>> Samuel Thibault <address@hidden> writes:
>>
>> > Currently, setsid(0) always return 1, while it should return the sid of
>> > the calling process. Here is a proposed patch:
>>
>> I have no particular objection, but what is the standard that
>> specifies its return value this way?
>>
>> Despite the suggestive name of setsid, there is no such thing in Posix
>> as a "session id".
>
> It's an XSI extension:
>
> « The getsid() function shall obtain the process group ID of the
> process that is the session leader of the process specified by pid. If
> pid is (pid_t)0, it specifies the calling process. »
Oh, getsid certainly should do this.
So is there a bug in setsid? Is there one in getsid?