From owner-svn-src-head@freebsd.org Wed Feb 24 17:14:45 2016 Return-Path: Delivered-To: svn-src-head@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 D904AAB2DBD for ; Wed, 24 Feb 2016 17:14:45 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (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 7A0101A5C for ; Wed, 24 Feb 2016 17:14:45 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x22d.google.com with SMTP id g62so282248962wme.1 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=KPruNc1DHjG9SKc3Dxg24Z59aasiYcCV1nqYuPiFFzJSdkNXbWS6HzEAkZ4EHiTDvS d0cYA9GxuNCpTfY9dslpN5G1RKzxhVh0E6KLBP/sz+N90yDimOJDlrERtm9+ioCE4D9I BX3zQTuO3g1QU237fAbmlyfxekzyi7zs8zMYEHitr72EZgVftVJf3nol2C2LWfwAkLcO 6KSsR0P/rezuMnQ5IUY6X+fbWvEG6Z/+0c+zi9oi4vacBexDgn212MZE5KMET0TSc3H3 Q1Qf3sTvb++UBpy0mOWZ663M7p7TaRlk2Wp3h+7sO+ykwh0lfr8dgYeFnlS8kN04+hj+ iKbg== X-Gm-Message-State: AG10YORiwN8y2GKrO7fVMI3vZEMbdEX0QhXsZU6P5U3zUn4ihaj2ELF078ZJqu/g9kiDO6oR 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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); >