From owner-freebsd-arch@FreeBSD.ORG Fri Jan 21 05:14:49 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAA07106567A; Fri, 21 Jan 2011 05:14:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 617078FC14; Fri, 21 Jan 2011 05:14:49 +0000 (UTC) Received: from c122-106-165-206.carlnfd1.nsw.optusnet.com.au (c122-106-165-206.carlnfd1.nsw.optusnet.com.au [122.106.165.206]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p0L5EeVT027514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Jan 2011 16:14:42 +1100 Date: Fri, 21 Jan 2011 16:14:40 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper In-Reply-To: Message-ID: <20110121153528.P2616@besplex.bde.org> References: <201101201830.p0KIUFx9067555@hergotha.csail.mit.edu> <4D38A476.10709@bsdimp.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1396774578-1295586880=:2616" Cc: freebsd-arch@freebsd.org Subject: Re: Weed-whacking sysctl(8) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2011 05:14:50 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1396774578-1295586880=:2616 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 20 Jan 2011, Garrett Cooper wrote: > On Thu, Jan 20, 2011 at 1:09 PM, Warner Losh wrote: >> On 01/20/2011 11:43, Garrett Cooper wrote: >>> >>> Tunables support mixed-case units incorrectly as well, i.e. >>> 1. 'g' / 'G' -> =A0'giga' >>> 2. 'm' / 'M' -> =A0'mega' >>> 3. 'k' / 'K' -> =A0'kilo' >>> Something that Bruce brought up in another email thread with me. >>> >> >> No. =A0'k' is the proper SI prefix for kilo. =A0And all the SI prefixes = are >> powers of ten only, but that's another can of worms. >> >> http://physics.nist.gov/cuu/Units/prefixes.html > > 1. 'g' doesn't map to anything. > 2. 'm' is incorrect ('milli' vs 'mega'). > 3. 'K' doesn't map to anything. > > That's what I meant. Same can. There is a significant shortage of letters, and significant confusion between prefixes for powers of 10 and powers of 2, and significant need for both, but scientificize^Wde^Whumanize_number() is of such quality that it wastes a letter for an alias for every supported "prefix". (I'm looking at the possibly-old man page on ref9-amd64, where "suffix" is still spelled "prefix" and the aliases are of course undocumented. Garrett started fixing this.) 'K' is the most broken in the man page. SI 'k' comflicts with computerspeak 'K' least among the prefixes (I think all others are capitals in both SI and computerspeak), but the man page says that the "prefix" for 1024 and 1000 is 'k' and doesn't mention its undocumented alias 'K'. OTOH, humanize_number() actually agrees with both SI and computerspeak according to df output, since the suffix is 'k' for powers of 10 format (df -H) and 'K' for powers of 2 format (df -h). Bugs noticed while testing this: - inode counts are printed in power of 10 even with df -h. This is actuall= y documented. You can see the difference if their suffix is k, but not if it is M or larger. - verbose names (mostly for nfs mounts) cause the output to not fit in 80 columns even with -h and without -i. Lots of columns are usually wasted in -h format. This despite df having lots of dynamic formatting. So k vs K more or less works as well as possible for scientificize_number()= , but is not documented to do so. parse^Wexpand_number() is considerably more primitive and broken. It only supports power of 2 format, and only documents k, but accepts K as an alias for k. So it converts 1000 printed as 1k by scientificize_number() to 1024. Bruce --0-1396774578-1295586880=:2616--