SIGCHLD handler in Postgres C function. - Mailing list pgsql-hackers

From spshealy@yahoo.com
Subject SIGCHLD handler in Postgres C function.
Date
Msg-id 4cdf286e.0107112040.4d22874a@posting.google.com
Whole thread Raw
Responses Re: SIGCHLD handler in Postgres C function.
List pgsql-hackers
I was wondering if some of you Postgres hackers could advise me on the
safety of the following.  I have written a postgres C function that
uses a popen linux system call. Orginally when I first tried it I kept
getting an ECHILD.  I read a little bit more on the pclose function
and the wait system calls and discoverd that on LINUX if the signal
handler for  SIGCHLD is set to SIG_IGN you will get the ECHILD error
on pclose(or wait4 for that matter).  So I did some snooping around in
the postgres backend code and found that in the traffic cop that the
SIGCHLD signal handler is set to SIG_IGN.  So in my C function right
before the popen call I set the signal handler for SIGCHLD to SIG_DFL
and right after the pclose I set it back to SIG_IGN.  I tested this
and it seems to solve my problem.  Not knowing much about the
internals of the postgres backend I would like to know...  Is setting
the signal handler to SIG_IGN temorarily going to do anything funky
with by database or the backend?

Thanks in advance for your insights,
Scott Shealy


pgsql-hackers by date:

Previous
From: "Dominic J. Eidson"
Date:
Subject: Re: Odd error...
Next
From: Bruce Momjian
Date:
Subject: Re: pg_depend