From owner-freebsd-arch@FreeBSD.ORG Wed Aug 1 23:31:56 2012 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3753E1065670; Wed, 1 Aug 2012 23:31:56 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1E5C68FC19; Wed, 1 Aug 2012 23:31:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q71NVrDi021580; Wed, 1 Aug 2012 23:31:54 GMT (envelope-from listlog2011@gmail.com) Message-ID: <5019BC67.9000601@gmail.com> Date: Thu, 02 Aug 2012 07:31:51 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Bruce Evans References: <5018992C.8000207@freebsd.org> <20120801071934.GJ2676@deviant.kiev.zoral.com.ua> <20120801183240.K1291@besplex.bde.org> <20120801162836.GO2676@deviant.kiev.zoral.com.ua> <20120802040542.G2978@besplex.bde.org> In-Reply-To: <20120802040542.G2978@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , arch@freebsd.org, David Xu Subject: Re: short read/write and error code X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2012 23:31:56 -0000 On 2012/8/2 2:58, Bruce Evans wrote: > On Wed, 1 Aug 2012, Konstantin Belousov wrote: > >> As I said, patch behaviour in regard of SIGPIPE is just wrong. > > It is too simple. The pipe code already reset error code zero if the writer have written all bytes to pipe buffer, it does not return EPIPE even if reader closed the pipe, so SIGPIPE is not sent in the case. The SIGPIPE is only generated for short write, this is an intention, it is for applications which takes no notice of short write, such an application does not check return value from write(), when kernel generates SIGPIPE, the default action is to kill the application, if application setup a sigaction for SIGPIPE, this implies that application knows short write. So the patch is correct when it sees EPIPE code. Regards, David Xu