From owner-freebsd-net@FreeBSD.ORG Thu Mar 1 17:34:53 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 D45BB16A401; Thu, 1 Mar 2007 17:34:53 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out5.smtp.messagingengine.com (out5.smtp.messagingengine.com [66.111.4.29]) by mx1.freebsd.org (Postfix) with ESMTP id A5EC113C49D; Thu, 1 Mar 2007 17:34:53 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.internal (unknown [10.202.2.149]) by out1.messagingengine.com (Postfix) with ESMTP id 9E4321F2A85; Thu, 1 Mar 2007 12:34:53 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by out1.internal (MEProxy); Thu, 01 Mar 2007 12:34:53 -0500 X-Sasl-enc: j08B2DY91JEJMzBhi1x5anZwIW73K8be8etfoKyu/TjZ 1172770493 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTP id B0ECD111DC; Thu, 1 Mar 2007 12:34:52 -0500 (EST) Message-ID: <45E70EBA.3030808@FreeBSD.org> Date: Thu, 01 Mar 2007 17:34:50 +0000 From: "Bruce M. Simpson" User-Agent: Thunderbird 1.5.0.9 (X11/20070125) MIME-Version: 1.0 To: Anton Yuzhaninov References: <2110071423.20070301151729@citrin.ru> <20070301152942.GA27336@rambler-co.ru> <1047693239.20070301194653@citrin.ru> In-Reply-To: <1047693239.20070301194653@citrin.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: [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 17:34:53 -0000 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);