Re: [Patch] Create a new session in postmaster by calling setsid() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [Patch] Create a new session in postmaster by calling setsid()
Date
Msg-id 15239.1536782100@sss.pgh.pa.us
Whole thread Raw
In response to Re: [Patch] Create a new session in postmaster by calling setsid()  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: [Patch] Create a new session in postmaster by calling setsid()
List pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>  Tom> Hmph.  Can't we just ignore that error?

> If you ignore the error from setsid(), then you're still a process group
> leader (as you would be after running setsid()), but you're still
> attached to whatever controlling terminal (if any) you were previously
> attached to.

Oh, got it.  So actually, the setsid has to be done by what is/will be
the postmaster process.

Although pg_ctl could sneak it in between forking and execing, it seems
like it'd be cleaner to have the postmaster proper do it in response to
a switch that pg_ctl passes it.  That avoids depending on the fork/exec
separation, and makes the functionality available for other postmaster
startup mechanisms, and opens the possibility of delaying the detach
to the end of startup.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: [Patch] Create a new session in postmaster by calling setsid()
Next
From: Tom Lane
Date:
Subject: Re: PATCH: Update snowball stemmers