Date: Fri, 8 Jun 2001 17:56:19 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Dima Dorfman <dima@unixfreak.org> Cc: Poul-Henning Kamp <phk@critter.freebsd.dk>, Jim Pirzyk <Jim.Pirzyk@disney.com>, freebsd-arch@FreeBSD.ORG Subject: Re: sysctl interger type max Message-ID: <Pine.BSF.4.21.0106081726240.11440-100000@besplex.bde.org> In-Reply-To: <20010608030837.DC9373E0B@bazooka.unixfreak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 7 Jun 2001, Dima Dorfman wrote: > Poul-Henning Kamp <phk@critter.freebsd.dk> writes: > > In message <01060412491406.00744@snoopy>, Jim Pirzyk writes: > > >Yes, so how should it be fixed? Add another CTLTYPE_* or make > > >CTLTYPE_INT handle say up to 'long long'? > > > > CTLTYPE_UINT should be fixed in sysctl(8) to handle [0..2^32-1] > > CTLTYPE_UINT doesn't exist. SYSCTL_(U)(INT|LONG) set the format > argument to indicate the type. Currently, sysctl(8) ignores this > format and treats everything that's a CTLTYPE_INT as being a signed > integer, which is obviously wrong. Attached is a patch which makes it > look up the format to determine how to deal with it. This seems a > little too simple to me, but it seems to work. Did I miss anything? I think you only missed fixing the (nonexistent) error handling and range checking for the results of strto*() :-). I think it would be better to have CTLTYPE_UINT, etc., and not have oid_fmt. The format string isn't any more general than a fixed set of CTLTYPE's, at least in the current implementation, since sysctl(8) needs to decode the format string to turn it into a fixed set of cases. Keeping part of the type info in oid_fmt mainly wastes space. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0106081726240.11440-100000>