Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - BSD style SA_RESTART flags for signal handling?: (2 Items)
   
BSD style SA_RESTART flags for signal handling?  
Hi,

I have a forking TCP server and would like to use a SIGCHLD handler to prevent zombies when the worker process dies.

The easiest way to do this is to use the SA_RESTART flag on the sigaction() call, since this will make sure that the 
system calls are restarted - so no extra monkeying around with checking for EINTR is needed with all the syscalls.

Now it seems QNX doesn't really support this flag: according to signals.h, this is "not supported yet" (commented out) 
as of 6.4.1 ... Is there a specific reason for this?

I know, it's not POSIX. But it's kind of neat to have this flag available. Note that otherwise, when using signals to be
 really safe you'd have to call every "syscall" (read, write, MsgSend, ...) in a while-Loop until errno != EINTR... 

Greetings,
 Marc

Re: BSD style SA_RESTART flags for signal handling?  
On Mon, Jun 22, 2009 at 12:04:52PM -0400, Marc Roessler wrote:
> Hi,
> 
> I have a forking TCP server and would like to use a SIGCHLD handler to prevent zombies when the worker process dies.
> 
> The easiest way to do this is to use the SA_RESTART flag on the sigaction() call, since this will make sure that the 
system calls are restarted - so no extra monkeying around with checking for EINTR is needed with all the syscalls.
> 
> Now it seems QNX doesn't really support this flag: according to signals.h, this is "not supported yet" (commented out)
 as of 6.4.1 ... Is there a specific reason for this?
> 
> I know, it's not POSIX. But it's kind of neat to have this flag available. Note that otherwise, when using signals to 
be really safe you'd have to call every "syscall" (read, write, MsgSend, ...) in a while-Loop until errno != EINTR... 

I think SA_RESTART has been commented out for a while pre
6.4.1.  I wouldn't mind having it too but until then here's
two workarounds:

- set signal(SIGCHLD, SIG_IGN) and you shouldn't get zombies.
- handle SIGCHLD in a dedicated thread like our ftp utility
http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/utils/f/ftp/?root=core_networking&system=exsy1001

Regards,

-seanb