From owner-freebsd-bugs Sat Jun 22 23:40:15 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A041E37B400 for ; Sat, 22 Jun 2002 23:40:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5N6e3558605; Sat, 22 Jun 2002 23:40:03 -0700 (PDT) (envelope-from gnats) Date: Sat, 22 Jun 2002 23:40:03 -0700 (PDT) Message-Id: <200206230640.g5N6e3558605@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/39681: hidden kernel boot tunables added to sysctl as read-only mib Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/39681; it has been noted by GNATS. From: Bruce Evans To: Cyrille Lefevre Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: kern/39681: hidden kernel boot tunables added to sysctl as read-only mib Date: Sun, 23 Jun 2002 16:42:09 +1000 (EST) On Sun, 23 Jun 2002, Cyrille Lefevre wrote: > >Description: >... > sys/sys/sysctl.h > sys/kern/kern_sysctl.c > sysctl quad handlers added. quad_t's shouldn't be used anywhere. They are essentially an unportable onsolete version of intmax_t's. > ... > Index: sys/kern/subr_param.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/subr_param.c,v > retrieving revision 1.42.2.10 > diff -u -r1.42.2.10 subr_param.c > --- subr_param.c 9 Mar 2002 21:05:47 -0000 1.42.2.10 > +++ subr_param.c 18 Jun 2002 00:06:24 -0000 > @@ -89,6 +90,33 @@ > > /* maximum # of sf_bufs (sendfile(2) zero-copy virtual buffers) */ > int nsfbufs; > + > +SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RD, > + &hz, 0, "Granularity of operation"); > +SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RD, > + &maxswzone, 0, "Max swmeta KVA storage"); > +SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RD, > + &maxbcache, 0, "Max buffer cache KVA storage"); > +SYSCTL_QUAD(_kern, OID_AUTO, maxtsiz, CTLFLAG_RD, > + &maxtsiz, 0, "Max text size"); > +SYSCTL_QUAD(_kern, OID_AUTO, dfldsiz, CTLFLAG_RD, > + &dfldsiz, 0, "Initial max data size"); > +SYSCTL_QUAD(_kern, OID_AUTO, maxdsiz, CTLFLAG_RD, > + &maxdsiz, 0, "Max data size"); > +SYSCTL_QUAD(_kern, OID_AUTO, dflssiz, CTLFLAG_RD, > + &dflssiz, 0, "Initial max stack size"); > +SYSCTL_QUAD(_kern, OID_AUTO, maxssiz, CTLFLAG_RD, > + &maxssiz, 0, "Max stack size"); > +SYSCTL_QUAD(_kern, OID_AUTO, sgrowsiz, CTLFLAG_RD, > + &sgrowsiz, 0, "Amount to grow stack"); > +SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RD, > + &nbuf, 0, "Number of buffer cache KVM reservation"); > +SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RD, > + &ncallout, 0, "Max # of timer events"); Support for intmax_t's might not even be needed yet, or might not apply. Most of the `siz' variables here have a wrong type (u_quad_t). They should have type vm_size_t or possibly size_t. But there is a problem importing and exporting variables with a typedef'ed types via sysctl() and/or TUNABLE*_FETCH(). Sysctl and the tunable mechanism only support a limited number of types. Even u_quad_t's are not supported. Large u_quad_t's are clipped to QUAD_MAX, without checking for overflow of course. u_quad_t's for the `siz' variables only work because the sizes are normally < QUAD_MAX even on 64-bit machines. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message