From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 9 10:43:16 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 386D41065677 for ; Wed, 9 Jun 2010 10:43:16 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id B48A58FC24 for ; Wed, 9 Jun 2010 10:43:15 +0000 (UTC) Received: by bwz2 with SMTP id 2so2390789bwz.13 for ; Wed, 09 Jun 2010 03:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :organization:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=GFUAiYOwIVMAFPHZh1vgtQL6rlAZpjAU/7IXkAl9REE=; b=sDxV6j7UQqmHhCGKbzkcuHtYNenLVERRfgXCRPjdqAVVwpv8rs1o4sgSouR4Kzrkyd 6KaSTEPnmk8gWn75fH3m7KGRR5aXZipiA/OD8VgNKQ/jigVlV9ltrhAqqvw1+Wll+hjV Lj+JslfIpRJ7ihcYVMvU7QZIizcY7FpCyJI+w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; b=E2SjRoneglhr+RI5dH7m3lmXgp2MUiaqAmPlPt8dIDh339HJZzqNrmkdt3NZwBbHUX BPMFFlD8vxe20Bw4Vm78z3SEzUOorT2HsiZYauWutPYJoeJM6VstMYgJdzkoS6r0oETa g/t6zogzt8pDXPDhJlTp/P2mfsLBNFp+NGpzY= Received: by 10.204.83.85 with SMTP id e21mr1277919bkl.42.1276080194374; Wed, 09 Jun 2010 03:43:14 -0700 (PDT) Received: from localhost (ua1.etadirect.net [91.198.140.16]) by mx.google.com with ESMTPS id v14sm29020728bkz.8.2010.06.09.03.43.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Jun 2010 03:43:13 -0700 (PDT) From: Mikolaj Golub To: Kostik Belousov Organization: TOA Ukraine References: <1276001507.6691.388.camel@kurkku.sapo.corppt.com> <4c0f442f.N55MZNOTsFpdxLGx%perryh@pluto.rain.com> <20100609094552.GE83316@deviant.kiev.zoral.com.ua> Date: Wed, 09 Jun 2010 13:43:10 +0300 In-Reply-To: <20100609094552.GE83316@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Wed, 9 Jun 2010 12:45:52 +0300") Message-ID: <86vd9s32rl.fsf@zhuzha.ua1> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org, tss@iki.fi, perryh@pluto.rain.com Subject: Re: close() failing with ECONNRESET X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2010 10:43:16 -0000 On Wed, 9 Jun 2010 12:45:52 +0300 Kostik Belousov wrote: KB> On Wed, Jun 09, 2010 at 12:35:11AM -0700, perryh@pluto.rain.com wrote: >> Timo Sirainen wrote: >> >> > I see that since FreeBSD 6.3 close() can fail with: >> > >> > > [ECONNRESET] The underlying object was a stream socket that was >> > > shut down by the peer before all pending data was >> > > delivered. >> > >> > Could someone explain what this is useful for? KB> Note that any return from close(2) that does not set errno to EBADF KB> closes the supplied file descriptor. Mentioned errno value supplies KB> caller with the information that not "all pending data was delivered". We have kern/146845 about close(2) returning ECONNRESET for tcp connections. Looking at the code (which I am not very familiar with though) and running some tests make me think that currently ECONNRESET may be only returned by close(2) after shutdown()/close() on our side and simultaneous close() on the other side (and in this case this is wrong). -- Mikolaj Golub