SIGCHLD handler in Postgres C function.

Поиск
Список
Период
Сортировка
От spshealy@yahoo.com
Тема SIGCHLD handler in Postgres C function.
Дата
Msg-id 4cdf286e.0107112040.4d22874a@posting.google.com
обсуждение исходный текст
Ответы Re: SIGCHLD handler in Postgres C function.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Dominic J. Eidson"
Дата:
Сообщение: Re: Odd error...
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_depend