SIGCHLD handler in Postgres C function.

From: spshealy(at)yahoo(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: SIGCHLD handler in Postgres C function.
Date: 2001-07-12 04:40:55
Message-ID: 4cdf286e.0107112040.4d22874a@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Klaus Reger 2001-07-12 05:05:23 Re: Repost: Get table/field-identifiers in uppercase
Previous Message Bruce Momjian 2001-07-12 03:50:26 Re: Possible bug in plpgsql/src/gram.y