From owner-svn-src-head@freebsd.org Fri Feb 26 12:46:35 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 911CFAB4FA4; Fri, 26 Feb 2016 12:46:35 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4923917EE; Fri, 26 Feb 2016 12:46:35 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1QCkY1x062528; Fri, 26 Feb 2016 12:46:34 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1QCkYu0062527; Fri, 26 Feb 2016 12:46:34 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201602261246.u1QCkYu0062527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 26 Feb 2016 12:46:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296092 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Fri, 26 Feb 2016 12:46:35 -0000 Author: ed Date: Fri Feb 26 12:46:34 2016 New Revision: 296092 URL: https://svnweb.freebsd.org/changeset/base/296092 Log: Remove the errno argument from unp_drop(). While there, add a comment to clarify that ECONNRESET should always be returned for POSIX conformance. Suggested by: Steven Hartland Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Fri Feb 26 12:16:11 2016 (r296091) +++ head/sys/kern/uipc_usrreq.c Fri Feb 26 12:46:34 2016 (r296092) @@ -280,7 +280,7 @@ static void unp_disconnect(struct unpcb static void unp_dispose(struct mbuf *); static void unp_dispose_so(struct socket *so); static void unp_shutdown(struct unpcb *); -static void unp_drop(struct unpcb *, int); +static void unp_drop(struct unpcb *); static void unp_gc(__unused void *, int); static void unp_scan(struct mbuf *, void (*)(struct filedescent **, int)); static void unp_discard(struct file *); @@ -354,7 +354,7 @@ uipc_abort(struct socket *so) unp2 = unp->unp_conn; if (unp2 != NULL) { UNP_PCB_LOCK(unp2); - unp_drop(unp2, ECONNRESET); + unp_drop(unp2); UNP_PCB_UNLOCK(unp2); } UNP_PCB_UNLOCK(unp); @@ -682,7 +682,7 @@ uipc_detach(struct socket *so) struct unpcb *ref = LIST_FIRST(&unp->unp_refs); UNP_PCB_LOCK(ref); - unp_drop(ref, ECONNRESET); + unp_drop(ref); UNP_PCB_UNLOCK(ref); } local_unp_rights = unp_rights; @@ -1698,7 +1698,7 @@ unp_shutdown(struct unpcb *unp) } static void -unp_drop(struct unpcb *unp, int errno) +unp_drop(struct unpcb *unp) { struct socket *so = unp->unp_socket; struct unpcb *unp2; @@ -1706,7 +1706,12 @@ unp_drop(struct unpcb *unp, int errno) UNP_LINK_WLOCK_ASSERT(); UNP_PCB_LOCK_ASSERT(unp); - so->so_error = errno; + /* + * Regardless of whether the socket's peer dropped the connection + * with this socket by aborting or disconnecting, POSIX requires + * that ECONNRESET is returned. + */ + so->so_error = ECONNRESET; unp2 = unp->unp_conn; if (unp2 == NULL) return;