From owner-freebsd-arch Fri Jun 8 0:58:35 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 6F93537B401 for ; Fri, 8 Jun 2001 00:58:32 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id RAB23260; Fri, 8 Jun 2001 17:58:12 +1000 Date: Fri, 8 Jun 2001 17:56:19 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Dima Dorfman Cc: Poul-Henning Kamp , Jim Pirzyk , freebsd-arch@FreeBSD.ORG Subject: Re: sysctl interger type max In-Reply-To: <20010608030837.DC9373E0B@bazooka.unixfreak.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 7 Jun 2001, Dima Dorfman wrote: > Poul-Henning Kamp 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