From owner-svn-src-head@freebsd.org Wed Dec 7 00:45:01 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 00FEEC690E6; Wed, 7 Dec 2016 00:45:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id C027DF1E; Wed, 7 Dec 2016 00:45:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 8F1113C13A9; Wed, 7 Dec 2016 11:44:49 +1100 (AEDT) Date: Wed, 7 Dec 2016 11:44:49 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309658 - head/sys/vm In-Reply-To: <201612062252.uB6Mqjhr019191@repo.freebsd.org> Message-ID: <20161207110947.V1119@besplex.bde.org> References: <201612062252.uB6Mqjhr019191@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=BKLDlBYG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=OfRePtsSlY3vNsTKZMEA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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, 07 Dec 2016 00:45:01 -0000 On Tue, 6 Dec 2016, Mark Johnston wrote: > Log: > Provide dummy sysctls for v_cache_count and v_tcached. > > Some utilities (notably top(1)) exit if any of their input sysctls don't > exist, and the removal of the above-mentioned PG_CACHE-related sysctls > makes it difficult to run such utilities on different versions of the > kernel without recompiling. > > Requested by: bde Thanks. > Modified: head/sys/vm/vm_meter.c > ============================================================================== > --- head/sys/vm/vm_meter.c Tue Dec 6 22:48:28 2016 (r309657) > +++ head/sys/vm/vm_meter.c Tue Dec 6 22:52:45 2016 (r309658) > @@ -314,3 +314,14 @@ VM_STATS_VM(v_forkpages, "VM pages affec > VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()"); > VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()"); > VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel"); > + > +#ifndef BURN_BRIDGES > +/* > + * Provide compatibility sysctls for the benefit of old utilities which exit > + * with an error if they cannot be found. > + */ > +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD, > + (u_int *)NULL, 0, "Dummy for compatibility"); > +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD, > + (u_int *)NULL, 0, "Dummy for compatibility"); > +#endif I don't like casting NULL, but SYSCTL_* enforces type safety for pointers to variables in a way that breaks normal use of NULL. You are supposed to obfuscate this by spelling the value as SYSCTL_UINT_NULL. This is actually documented in sysctl(9). Bruc