From owner-svn-src-all@freebsd.org Wed Feb 24 17:14:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E405EAB2DBE for ; Wed, 24 Feb 2016 17:14:45 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79F471A5A for ; Wed, 24 Feb 2016 17:14:45 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x236.google.com with SMTP id g62so39738458wme.0 for ; Wed, 24 Feb 2016 09:14:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=L8UC9JdLv+AaeNeERenq+MY/PTucY6tg4CWqYolKBZM=; b=lBGYNzHukhEbcjlYOdpgB0XuJNZvZn1Z1fXzxWefiT28KdoOquOiFfM6gxZ/Ygt7hg wEZA9BFJP6lYSZafUJZOsX9Umq/ZYcmB4amsZhZa0dHKPwGU+L9YOMyOg9vNKP9aFxZV QQaq31M/UZXkzs6jIGIw1oxH9ee1GySIV44WF3ufgdFa3V8aYALlH+7uh15qVK+7Sr+K 3aoYo8RxANN088ZTd7z9XdzJ02s1b4Are+Ow8lYgPCVDcRYO1PdT+4SkzSkyOZtkiLL1 vQCIlQ+Wpj0Zl8l523XBtuM6X+rbVJuYVoh2z1ItDs4sqrZNSSI/AtsVhNoaSvprZ5A8 eqVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=L8UC9JdLv+AaeNeERenq+MY/PTucY6tg4CWqYolKBZM=; b=Lcvedtye4GfUlpXEKggwZjOhsvYQMU87/SokejMqpFK5mv8EBzxRx+be9JK5VOe9E/ pK9sh+Yh1gxQ7K5zMc05Pb2tjSrr/IlRH4KF+UrCvN/CIV2Bdcet9hGJReRcYyLl4qDP /JwIjUFLbRJuWG3sX+gQtsfHX+u3TjgmJR7NNlm3ZskLpyw/p/r+dIupD8t1ZsvJK3/7 QpW2nR0s064TuoOZuPUIFnlUklFwlyOohLToHN0x5nz80kboSaekZ1kHJ6dgLiBqTV2e 3TDGBm5dtN0GAFCRZAWRcI3aWWJIfRSEy/xu/Yudd1SQ+QmS3fOqxiSwvzoJErh+dd1Q wVIQ== X-Gm-Message-State: AG10YORNGiFdeatRmZ5ICgOnJHLfQZEFmW45tXt9R0P6DVS8iAaP+ynEUq0aHHShbBYvDjtQ X-Received: by 10.194.61.209 with SMTP id s17mr39847455wjr.35.1456334083655; Wed, 24 Feb 2016 09:14:43 -0800 (PST) Received: from [10.10.1.58] (liv3d.labs.multiplay.co.uk. [82.69.141.171]) by smtp.gmail.com with ESMTPSA id u9sm32291445wmd.4.2016.02.24.09.14.41 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Feb 2016 09:14:42 -0800 (PST) Subject: Re: svn commit: r295974 - head/sys/kern To: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201602241710.u1OHAWwM086142@repo.freebsd.org> From: Steven Hartland Message-ID: <56CDE508.5000903@multiplay.co.uk> Date: Wed, 24 Feb 2016 17:14:48 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <201602241710.u1OHAWwM086142@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2016 17:14:46 -0000 This should really be commented to this effect in the code otherwise someone reading the source will think its a mistake. On 24/02/2016 17:10, Ed Schouten wrote: > Author: ed > Date: Wed Feb 24 17:10:32 2016 > New Revision: 295974 > URL: https://svnweb.freebsd.org/changeset/base/295974 > > Log: > Make asynchronous connection failures on UNIX sockets fail with ECONNRESET. > > While making CloudABI work well on Linux, I discovered that I had a > FreeBSD-ism in one of my unit tests. The test did the following: > > - Create UNIX socket 1, bind it, make it listen. > - Create UNIX socket 2, connect it to UNIX socket 1. > - Close UNIX socket 1. > - Obtain SO_ERROR from socket 2. > > On FreeBSD this returns ECONNABORTED, while on Linux it returns > ECONNRESET. I dug through some of the relevant specifications[1] and it > looks like Linux is all right here. ECONNABORTED should only be returned > when the local connection (socket 2) is aborted; not the peer (socket 1). > > It is of course slightly misleading: the function in which we set this > error is called uipc_abort(), but keep in mind that we're aborting the > peer, thus resetting the local socket. > > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html > > Reviewed by: cem > Sponsored by: Nuxi, the Netherlands > Differential Revision: https://reviews.freebsd.org/D5419 > > Modified: > head/sys/kern/uipc_usrreq.c > > Modified: head/sys/kern/uipc_usrreq.c > ============================================================================== > --- head/sys/kern/uipc_usrreq.c Wed Feb 24 16:52:03 2016 (r295973) > +++ head/sys/kern/uipc_usrreq.c Wed Feb 24 17:10:32 2016 (r295974) > @@ -354,7 +354,7 @@ uipc_abort(struct socket *so) > unp2 = unp->unp_conn; > if (unp2 != NULL) { > UNP_PCB_LOCK(unp2); > - unp_drop(unp2, ECONNABORTED); > + unp_drop(unp2, ECONNRESET); > UNP_PCB_UNLOCK(unp2); > } > UNP_PCB_UNLOCK(unp); >