question about non-blocking I/O and SIGPIPE

Sundar Narasimhan sundar at ai.mit.edu
Tue Mar 26 07:39:48 AEST 1991


In article <27643 at uflorida.cis.ufl.EDU>, leh at atlantis.cis.ufl.edu (Les Hill) writes:
|> In article <14318 at life.ai.mit.edu>, sundar at ai.mit.edu (Sundar Narasimhan) writes:
|> |> I've read the man pages, but this info is not found anywhere. 
|> ...asks why he is dying on a SIGPIPE...
|> 
|> You may have indeed read the man pages, you did NOT read them carefully.
|> The SunOS man page for write(2v) under the ERRORS heading clearly answers your question (look at EPIPE.)
Ok. Maybe I wasn't clear enough in my message. I did read the stuff about
EPIPE but I'm trying to reconcile my understanding of EINTR/EPIPE and 
the sequence of events as they occur when you do a write(). 

Supposing you do a write(fd, buf, 20); Which of the foll. is correct?
	*  If the process on the other side dies DURING the write,
	   (i.e. say after 10 bytes were written), then write will
	   return -1 and errno will be set to EPIPE. SIGPIPE will 
	   be delivered AFTER write() returns.
	* SIGPIPE may be raised DURING the write, causing it to notice
           this, return -1 with errno set to EINTR.
	
Is it also true that with non-blocking I/O set, write returning 0 should
be handled exactly identical to the case when write returns any other
value < bc? 



More information about the Comp.unix.programmer mailing list