From: alex <al...@be...> - 2002-08-31 12:41:51
|
On Sat, 2002-08-31 at 04:00, Michael Core wrote: > alex <al...@be...> wrote: > > > According to the man pages a SIGPIPE signal is sent to the process when > > it tries to write data to something that is not listening. However what > > I can't figure out is what "pipe" is this SIGPIPE referring to. > > The sockets. This happens when you're disconnected unexpectedly. You > cannot really prevent to trigger SIGPIPE because there's a race condition > between write() and receiving a RST/FIN-packet. You cannot predict it. Ahh, I understand now. I assume a lot of network applications must do the same thing, catch SIGPIPEs as they occur whenever a connection goes down suddenly. > > The only clue I have so far is that a null signal handler is set up in > > main.c to handle SIGPIPE's and that a hack is employed as occasionaly > > SIG_IGN doesn't work properly. > > I guess your debugger gets triggered because it registers the signals > itself for being able to handle them. The default action for SIGPIPE is > terminate the process. So if there'd be a problem GtkG should > occasionally crash with "Broken pipe". Thats the bit that confused me, YAMD only installs a signal handler for SIGSEV (to trap buffer over-runs etc) so I assumed the GtkG signal handler should behave as before. I can get round it with linking the YAMD library statically and you'll be pleased to know it currently does not detect any memory trickery. > > Anyone able to eulucidate me? Point me to a decent explanation? > > You might want to read "Advanced Programming in the UNIX Environment" by > Richard W. Stevens. Another book to add to my Amazon wish list, thanks :-) -- Alex@Bennee.com http://www.bennee.com/~alex/ |