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