[PATCH] Re: is setsockopt SO_NOSIGPIPE work?
Anton Yuzhaninov
citrin at citrin.ru
Thu Mar 1 18:22:15 UTC 2007
Thursday, March 1, 2007, 8:34:50 PM, Bruce M. Simpson wrote:
BMS> Anton Yuzhaninov wrote:
>>
>> Thanks, with send() it works fine.
>> I think it should be documented in setsockopt(2).
BMS> Try this patch. The comment doesn't reflect what the code does. SIGPIPE
BMS> may actually be getting queued twice in your case. It is most likely
BMS> that the process's main thread wasn't preempted before return from the
BMS> syscall.
Works for me.
src/tools/regression/sockets/sigpipe
also pass now (without this patch it failed)
BMS> Perhaps someone more familiar with the signal code than I can chime in.
BMS> --- sys_generic.c 14 Oct 2006 19:01:55 -0000 1.151
BMS> +++ sys_generic.c 1 Mar 2007 17:30:39 -0000
BMS> @@ -489,7 +489,7 @@ dofilewrite(td, fd, fp, auio, offset, fl
BMS> error == EINTR || error == EWOULDBLOCK))
BMS> error = 0;
BMS> /* Socket layer is responsible for issuing SIGPIPE. */
BMS> - if (error == EPIPE) {
+ if (fp->>f_type != DTYPE_SOCKET && error == EPIPE) {
BMS> PROC_LOCK(td->td_proc);
BMS> psignal(td->td_proc, SIGPIPE);
BMS> PROC_UNLOCK(td->td_proc);
--
WBR,
Anton Yuzhaninov
More information about the freebsd-net
mailing list