Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2016 09:42:24 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        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:  <da70cbf0-4e4a-7050-f84b-25d00aad7b78@selasky.org>
In-Reply-To: <20160526213716.GK58287@FreeBSD.org>
References:  <201605260841.u4Q8ft9r045564@repo.freebsd.org> <20160526213716.GK58287@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 05/26/16 23:37, 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.
>

Hi,

We cannot use the "bool" type in userspace at least, because 
sizeof(bool) depends on the compiler. So the interface must use an 
integer type at least, possibly uint8_t like now.

Your suggestion makes sense. I'll look at some existing patches 
extending sysctl and test and make one for bool.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?da70cbf0-4e4a-7050-f84b-25d00aad7b78>