Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2020 13:10:47 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r365268 - in head: sbin/sysctl sys/kern
Message-ID:  <688a0c4e-a0b3-a74f-dc6d-d52d1e5deaed@FreeBSD.org>
In-Reply-To: <20200902190917.GA12944@raichu>
References:  <202009021817.082IH8nM005599@repo.freebsd.org> <043d4fe6-9961-c6fe-e93e-eb2533e0f130@FreeBSD.org> <20200902190917.GA12944@raichu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9/2/20 12:09 PM, Mark Johnston wrote:
> On Wed, Sep 02, 2020 at 11:43:56AM -0700, John Baldwin wrote:
>> On 9/2/20 11:17 AM, Mark Johnston wrote:
>>> Author: markj
>>> Date: Wed Sep  2 18:17:08 2020
>>> New Revision: 365268
>>> URL: https://svnweb.freebsd.org/changeset/base/365268
>>>
>>> Log:
>>>   Add sysctl(8) formatting for hw.pagesizes.
>>>   
>>>   - Change the type of hw.pagesizes to OPAQUE, since it returns an array.
>>>   - Modify the handler to only truncate the returned length if the caller
>>>     supplied an output buffer.  This allows use of the trick of passing a
>>>     NULL output buffer to fetch the output size, while preserving
>>>     compatibility if MAXPAGESIZES is increased.
>>>   - Add a "S,pagesize" formatter to sysctl(8).
>>
>> Doesn't sysctl(8) handle scalar types that are arrays?  That is, couldn't
>> this change just be the change to not truncate 'len' without needing to make
>> it opaque and needing a custom printer, etc.?
> 
> I think you are right.  I didn't know sysctl(8) could do that.

I only know from dealing with it in the past.  kern.cp_time is an array
for example.  In the past year or so I updated sysctl to permit setting
an array of values (for dev.t6nex.0.toe.rx_tls_ports which takes a list
of TCP ports to enable TOE TLS on).

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?688a0c4e-a0b3-a74f-dc6d-d52d1e5deaed>