From owner-svn-src-head@FreeBSD.ORG Fri Sep 5 23:36:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44900654; Fri, 5 Sep 2014 23:36:24 +0000 (UTC) Received: from mail-wg0-x234.google.com (mail-wg0-x234.google.com [IPv6:2a00:1450:400c:c00::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C1841F17; Fri, 5 Sep 2014 23:36:23 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id m15so12344865wgh.35 for ; Fri, 05 Sep 2014 16:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=5K02UaCExTtY21L0Uq+DAxZq50TmnuyxA2gl4r7VyVg=; b=FNnDgSSmf4a0iWBU9nwhangMT8WjFYBJCth++ftkGtjgnQLNF252YxVwoG53gVex9l afSJtzsv6CyeeNFwaNmU2wQanexMlk/LF1cdDmPzlbiqp/shKBeaVbwEUhduedaVrE9C 35C9oIDiFDvBbMWCEPiis6VdNieFT65YQQ2gud363QXH/mppHg3ol1cmz8XQdjxWGDKm xjj5bIwAUvuTMfQoV5BZVl6//LlFDO7FL1eyot6Y9hR4SLNbAWIekjyiTXU33jcxxoKV UPcgMBDlhbKiwvlln9cpv87IU+WtKzELUA+rqZWZuRovl7SA0uhJCNA31h7wB1FZr6UR QPmw== X-Received: by 10.180.85.136 with SMTP id h8mr6793112wiz.67.1409960181252; Fri, 05 Sep 2014 16:36:21 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id r19sm3451621wik.0.2014.09.05.16.36.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 16:36:20 -0700 (PDT) Date: Sat, 6 Sep 2014 01:36:12 +0200 From: Mateusz Guzik To: Adrian Chadd Subject: Re: svn commit: r271182 - head/sys/kern Message-ID: <20140905233612.GF722@dft-labs.eu> References: <201409051950.s85JoI3r000416@svn.freebsd.org> <20140905195410.GA722@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Gleb Smirnoff , "src-committers@freebsd.org" , Garrett Cooper X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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, 05 Sep 2014 23:36:24 -0000 On Fri, Sep 05, 2014 at 04:30:24PM -0700, Adrian Chadd wrote: > How's this look? > Malformed. :-P I would prefer: diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index c6c3152..de72da5 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -3245,6 +3245,7 @@ static int filt_soread(struct knote *kn, long hint) { struct socket *so; + int ret; so = kn->kn_fp->f_data; SOCKBUF_LOCK_ASSERT(&so->so_rcv); @@ -3267,11 +3268,12 @@ filt_soread(struct knote *kn, long hint) CURVNET_SET(so->so_vnet); if (V_socket_hhh[HHOOK_FILT_SOREAD]->hhh_nhooks > 0) - /* This hook returning non-zero indicates an event, not error */ - return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD)); + ret = hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD); + else + ret = 0; CURVNET_RESTORE(); - return (0); + return (ret); } static void But I'm fine either way. > > adrian@testbox1:~/work/freebsd/head/src % svnlite diff sys/kern/ > > Index: sys/kern/uipc_socket.c > > =================================================================== > > --- sys/kern/uipc_socket.c (revision 271182) > > +++ sys/kern/uipc_socket.c (working copy) > > @@ -448,10 +448,12 @@ > > mac_socket_destroy(so); > > #endif > > CURVNET_SET(so->so_vnet); > > - if (V_socket_hhh[HHOOK_SOCKET_CLOSE]->hhh_nhooks > 0) > > + if (V_socket_hhh[HHOOK_SOCKET_CLOSE]->hhh_nhooks > 0) { > > hhook_run_socket(so, NULL, HHOOK_SOCKET_CLOSE); > > - CURVNET_RESTORE(); > > - > > + CURVNET_RESTORE(); > > + } else { > > + CURVNET_RESTORE(); > > + } > > crfree(so->so_cred); > > khelp_destroy_osd(&so->osd); > > sx_destroy(&so->so_snd.sb_sx); > > @@ -3245,6 +3247,7 @@ > > filt_soread(struct knote *kn, long hint) > > { > > struct socket *so; > > + int ret; > > > > so = kn->kn_fp->f_data; > > SOCKBUF_LOCK_ASSERT(&so->so_rcv); > > @@ -3266,11 +3269,15 @@ > > } > > > > CURVNET_SET(so->so_vnet); > > - if (V_socket_hhh[HHOOK_FILT_SOREAD]->hhh_nhooks > 0) > > + if (V_socket_hhh[HHOOK_FILT_SOREAD]->hhh_nhooks > 0) { > > /* This hook returning non-zero indicates an event, not error */ > > - return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD)); > > - CURVNET_RESTORE(); > > - > > + ret = (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD)); > > + CURVNET_RESTORE(); > > + return (ret); > > + } else { > > + CURVNET_RESTORE(); > > + } > > + > > return (0); > > } -- Mateusz Guzik