On Feb24, 2011, at 04:14 , Robert Haas wrote:
> On Wed, Feb 23, 2011 at 4:54 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
>> IOW, at least on Linux, you *can* arrange to get a signal when your
>> parent process dies.
> 
> That's pretty cool.
> 
>> Not sure how ugly it'd be to use this call when available and a time
>> delay when not, but it's something to think about.
> 
> Yeah.  It may be worth thinking about whether we want to use the
> postmaster-pipe trick someone was proposing.  That might be more
> portable.


FWIW, I did some experiments which this when it was discussion a while ago.

To actually get a signal when the parent dies, I set the FASYNC flag
on the pipe's receiving end's fd. To be able to signal multiple children
using only one pipe, I set the fd's owner to -getgrp() using
fcntl(F_SETOWN). On both linux and OSX 10.6 this caused SIGIO to be sent
to all processes in the process group once sending end of the pipe was
closed.

I don't have access to any other Unixes to test this on, but I since it
works on OSX chances are high that it'll work on FreeBSD also.

best regards,
Florian Pflug


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to