Date: Thu, 01 Mar 2007 17:34:50 +0000 From: "Bruce M. Simpson" <bms@FreeBSD.org> To: Anton Yuzhaninov <citrin@citrin.ru> Cc: freebsd-net@freebsd.org Subject: [PATCH] Re: is setsockopt SO_NOSIGPIPE work? Message-ID: <45E70EBA.3030808@FreeBSD.org> In-Reply-To: <1047693239.20070301194653@citrin.ru> References: <2110071423.20070301151729@citrin.ru> <20070301152942.GA27336@rambler-co.ru> <1047693239.20070301194653@citrin.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Anton Yuzhaninov wrote:
>
> Thanks, with send() it works fine.
> I think it should be documented in setsockopt(2).
Try this patch. The comment doesn't reflect what the code does. SIGPIPE
may actually be getting queued twice in your case. It is most likely
that the process's main thread wasn't preempted before return from the
syscall.
Perhaps someone more familiar with the signal code than I can chime in.
--- sys_generic.c 14 Oct 2006 19:01:55 -0000 1.151
+++ sys_generic.c 1 Mar 2007 17:30:39 -0000
@@ -489,7 +489,7 @@ dofilewrite(td, fd, fp, auio, offset, fl
error == EINTR || error == EWOULDBLOCK))
error = 0;
/* Socket layer is responsible for issuing SIGPIPE. */
- if (error == EPIPE) {
+ if (fp->f_type != DTYPE_SOCKET && error == EPIPE) {
PROC_LOCK(td->td_proc);
psignal(td->td_proc, SIGPIPE);
PROC_UNLOCK(td->td_proc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45E70EBA.3030808>
