Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2016 20:06:53 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Gleb Smirnoff <glebius@freebsd.org>,  Hans Petter Selasky <hselasky@freebsd.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r300718 - in head/sys: kern sys
Message-ID:  <20160527192816.N2935@besplex.bde.org>
In-Reply-To: <1464303288.1204.65.camel@freebsd.org>
References:  <201605260841.u4Q8ft9r045564@repo.freebsd.org>  <20160526213716.GK58287@FreeBSD.org> <1464303288.1204.65.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 26 May 2016, Ian Lepore wrote:

> On Thu, 2016-05-26 at 14:37 -0700, Gleb Smirnoff wrote:
>>   Hans,
>>
>> On Thu, May 26, 2016 at 08:41:55AM +0000, Hans Petter Selasky wrote:
>> H> Author: hselasky
>> H> Date: Thu May 26 08:41:55 2016
>> H> New Revision: 300718
>> H> URL: https://svnweb.freebsd.org/changeset/base/300718
>> H>
>> H> Log:
>> H>   Add support for boolean sysctl's.
>> H>
>> H>   Because the size of bool can be implementation defined, make a
>> bool
>> H>   sysctl handler which handle bools. Userspace sees the bools like
>> H>   unsigned 8-bit integers. Values are filtered to either 1 or 0
>> upon
>> H>   read and write, similar to what a compiler would do.
>> H>
>> H>   Requested by:	kmacy @
>> H>   Sponsored by:	Mellanox Technologies
>>
>> Would be nice if sysctl(8) would explicitly display them as "true" or
>>
>> "false"
>> instead of 0 and 1. Now the userland can't differ them from uint8_t
>> oids.
>
> If it displayed them that way, then users would want to set them using
> the true/false strings too.  If you start down that path you eventually
> end up adding support for 0/1/true/false/yes/no/on/off, and if you
> don't do that in exactly once place you end up with some oids accepting
> all the values and others accepting only some of them, and the user
> experience is confusing at best.

Don't forget to support mixed case and internationalized spellings, and
add this support to all utilities that might be used to on sysctl output.

Even hex output is more than some other utilities can handle, so there
has to be an option to produce a common format which can only be decimal
integer with no internationalizations like thousand separators.

sysctl -a now produces a disgusting amount amount of xml and other output
that it can't possibly parse as input.  I tried its -h flag but it didn't
fix the xml by removing it :-).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160527192816.N2935>