Re: restarting signals

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Neal Becker
CC: exim-users
Subject: Re: restarting signals
On 16 Oct 1996, Neal Becker wrote:

> Well, it's not pretty, but if all signal handlers recorded the last
> signal in a global variable then we could do:
>
> inline int READ (a, b, c) {
>   int res;
>   do {
>     res = read (a, b, c);
>   } while (res < 0 && (LastSignalWasUSR1 && errno == EINTR));
>   return res;
> }


We have more problems than that, I realized overnight. As well as
read/write, Exim uses getc, gets, fprintf and maybe other ANSI C library
calls in various places. Wrapping fprintf would be particularly messy
because of the indefinite number of arguments. I'm also not keen on
using "inline" as it is not ANSI C.

I've just done some prowling around those systems to which I have
access, and for the record, I have found the following:

. SunOS5, BSDI, IRIX, FreeBSD (& presumably NetBSD), and OSF1 (Digital
Unix) all have the SA_RESTART option for sigaction() which makes it
possible to set up restarting signals.

. SunOS4 and Ultrix have restartable signals by default, and the
SV_INTERRUPT action to set up non-restarting signals.

. Linux defaults to non-restarting signals for new handlers set up by
signal(), but has the siginterrupt() function to specify the
behaviour for particular signals - though this code is not in use in
Exim at present.

. HP-UX is alone among those systems I've looked at in having no
mechanism for specifying restarting signals. It does have a BSD
compatibility feature which looks like it might provide the facility,
but I wasn't entirely clear about it and it doesn't seem like a good
way to go.

. I have no access to AIX or SCO, so don't know what facilities they
have.



--
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714