From owner-freebsd-net@FreeBSD.ORG Thu Mar 1 18:22:15 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8F0516A401 for ; Thu, 1 Mar 2007 18:22:15 +0000 (UTC) (envelope-from citrin@citrin.ru) Received: from mail.classis.ru (classis.ru [213.248.60.120]) by mx1.freebsd.org (Postfix) with ESMTP id 8C72B13C491 for ; Thu, 1 Mar 2007 18:22:15 +0000 (UTC) (envelope-from citrin@citrin.ru) Received: from citrin (unknown [81.19.65.100]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: citrin.citrin.ru) by mail.classis.ru (Postfix) with ESMTP id 330781227A01; Thu, 1 Mar 2007 21:22:14 +0300 (MSK) Date: Thu, 1 Mar 2007 21:21:26 +0300 From: Anton Yuzhaninov X-Mailer: The Bat! (v3.62.14) Professional Organization: Rambler X-Priority: 3 (Normal) Message-ID: <11810015988.20070301212126@citrin.ru> To: "Bruce M. Simpson" 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2007 18:22:15 -0000 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