svn commit: r330711 - head/sbin/sysctl

John Baldwin jhb at freebsd.org
Mon Mar 12 17:51:34 UTC 2018


On Saturday, March 10, 2018 10:46:53 AM Eugene Grosbein wrote:
> 10.03.2018 6:37, John Baldwin wrote:
> 
> > Author: jhb
> > Date: Fri Mar  9 23:37:19 2018
> > New Revision: 330711
> > URL: https://svnweb.freebsd.org/changeset/base/330711
> > 
> > Log:
> >   Permit sysctl(8) to set an array of numeric values for a single node.
> >   
> >   Most sysctl nodes only return a single value, but some nodes return an
> >   array of values (e.g. kern.cp_time).  sysctl(8) understand how to display
> >   the values of a node that returns multiple values (it prints out each
> >   numeric value separated by spaces).  However, until now sysctl(8) has
> >   only been able to set sysctl nodes to a single value.  This change
> >   allows sysctl to accept a new value for a numeric sysctl node that contains
> >   multiple values separated by either spaces or commas.  sysctl(8) parses
> >   this list into an array of values and passes the array as the "new" value
> >   to sysctl(2).
> 
> Note well: we already have some examples of complex sysctl comma-separated "list" values such as:
> 
> security.mac.portacl.rules=uid:53:tcp:53,uid:53:udp:53

Yes, but those are stored as strings (CTLTYPE_STRING) and require string parsing
in the kernel.  This permits nodes that just need a flat array of integers to be
set without requiring string parsing in the kernel.

-- 
John Baldwin


More information about the svn-src-head mailing list