Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Mar 2007 21:21:26 +0300
From:      Anton Yuzhaninov <citrin@citrin.ru>
To:        "Bruce M. Simpson" <bms@FreeBSD.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work?
Message-ID:  <11810015988.20070301212126@citrin.ru>
In-Reply-To: <45E70EBA.3030808@FreeBSD.org>
References:  <2110071423.20070301151729@citrin.ru> <20070301152942.GA27336@rambler-co.ru> <1047693239.20070301194653@citrin.ru> <45E70EBA.3030808@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11810015988.20070301212126>