From owner-svn-src-all@freebsd.org Fri May 27 10:37:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF095B4BD52; Fri, 27 May 2016 10:37:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 4BF471FC2; Fri, 27 May 2016 10:37:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id C3F0AD63DD1; Fri, 27 May 2016 20:06:54 +1000 (AEST) Date: Fri, 27 May 2016 20:06:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: Gleb Smirnoff , Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300718 - in head/sys: kern sys In-Reply-To: <1464303288.1204.65.camel@freebsd.org> Message-ID: <20160527192816.N2935@besplex.bde.org> References: <201605260841.u4Q8ft9r045564@repo.freebsd.org> <20160526213716.GK58287@FreeBSD.org> <1464303288.1204.65.camel@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=EfU1O6SC c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=P0YNdPaFfFjUPGrzGLAA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 10:37:53 -0000 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