From owner-freebsd-current@FreeBSD.ORG Wed Feb 25 13:12:49 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 519A316A4CE for ; Wed, 25 Feb 2004 13:12:49 -0800 (PST) Received: from mta6-svc.business.ntl.com (mta6-svc.business.ntl.com [62.253.164.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E37543D2F for ; Wed, 25 Feb 2004 13:12:48 -0800 (PST) (envelope-from bruce@cran.org.uk) Received: from box1.cran ([82.3.86.155]) by mta6-svc.business.ntl.com (InterMail vM.4.01.03.37 201-229-121-137-20020806) with ESMTP id <20040225211247.UTBR27811.mta6-svc.business.ntl.com@box1.cran> for ; Wed, 25 Feb 2004 21:12:47 +0000 Received: from box1.cran (localhost.cran [127.0.0.1]) by box1.cran (8.12.11/8.12.10) with ESMTP id i1PLFNM5003234 for ; Wed, 25 Feb 2004 21:15:23 GMT (envelope-from brucec@box1.cran) Received: (from brucec@localhost) by box1.cran (8.12.11/8.12.11/Submit) id i1PLFNNx003233 for freebsd-current@freebsd.org; Wed, 25 Feb 2004 21:15:23 GMT (envelope-from brucec) Date: Wed, 25 Feb 2004 21:15:23 +0000 From: Bruce Cran To: freebsd-current@freebsd.org Message-ID: <20040225211523.GA3031@box1.cran> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2i Subject: 64-bit values in sysctl X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2004 21:12:49 -0000 After investigating whether FreeBSD will be able to show the correct speed of a 4.3GHz CPU (http://www.theinquirer.net/?article=14319), I found that the sysctl infrastructure doesn't currently have support for 64-bit integers, on a 32-bit platform at least. The only type pertaining to 64-bits is CTLTYPE_QUAD, but since there's no corresponding sysctl_handle_quad, it's still handled as a 32-bit integer. I found PR kern/39681 which explains that it's apparently not as simple as adding a sysctl_handle_quad function. With CPUs getting faster and a few people adding more then 4GB RAM to their machines, there's a need for some sort of solution IMO. In addition, the only place a CTLTYPE_QUAD is used is in sys/i386/i386/tsc.c, and then it mixed CTLTYPE_QUAD and sizeof(u_int). I've also noticed that the machdep.[i8254_freq, tsc_freq, acpi_timer_freq] are all writable, whereas I think they should probably be read-only, as should kern.bootfile. One last thing I've noticed during my look into the kernel code is that a lot of the sysctls are defined as signed integers - wouldn't it be better if these were converted to be unsigned, so that it would be impossible for the writable ones to be set to negative values and thus avoid possible foot-shooting? I already have some diffs, so I could put together a PR if some of these changes (such as making some sysctls read-only) are valid. -- Bruce Cran