Re: SIGPIPE handling

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: SIGPIPE handling
Дата
Msg-id 200401072308.i07N80v22744@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: SIGPIPE handling  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: SIGPIPE handling  (Manfred Spraul <manfred@colorfullife.com>)
Список pgsql-patches
One issue I had is in the following function.  How can I easily find the
current signal value without causing possible signal loss during
testing, or possible abort if signals were previously ignored.  I could
use sigblock, and I think that would exist on a system that doesn't have
sigaction, but is it worth the portability issue?  Does any platform
have threads and not sigaction?

---------------------------------------------------------------------------

> +
> + pqsigfunc
> + pqsignalinquire(int signo)
> + {
> + #if !defined(HAVE_POSIX_SIGNALS)
> +     pqsigfunc old;
> +
> +     /*
> +      *    We could lose a signal during this test.
> +      *    In a multi-threaded application, this might
> +      *    be a problem.  Do any non-threaded platforms
> +      *    lack sigaction()?
> +      */
> +      old = signal(signo, SIG_IGN);
> +     signal(signo, old);
> +     return old;
> + #else
> +     struct sigaction oact;
> +
> +     if (sigaction(signo, NULL, &oact) < 0)
> +        return SIG_ERR;
> +     return oact.sa_handler;
> + #endif   /* !HAVE_POSIX_SIGNALS */
> + }

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: SIGPIPE handling
Следующее
От: Zach Irmen
Дата:
Сообщение: psql error in \? output on \w line