Date: Tue, 6 Dec 2016 17:24:13 -0800 From: Mark Johnston <markj@freebsd.org> To: Bruce Evans <brde@optusnet.com.au> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309658 - head/sys/vm Message-ID: <20161207012413.GA47261@wkstn-mjohnston.west.isilon.com> In-Reply-To: <20161207110947.V1119@besplex.bde.org> References: <201612062252.uB6Mqjhr019191@repo.freebsd.org> <20161207110947.V1119@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 07, 2016 at 11:44:49AM +1100, Bruce Evans wrote: > 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). Fixed, thanks - I somehow managed to miss those #defines when I was looking at sysctl.h to see why a plain "NULL" doesn't work there.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161207012413.GA47261>