1*0a6a1f1dSLionel Sambuc.\" $NetBSD: sysctl.3,v 1.202 2014/06/13 22:05:15 wiz Exp $ 22fe8fb19SBen Gras.\" 32fe8fb19SBen Gras.\" Copyright (c) 1993 42fe8fb19SBen Gras.\" The Regents of the University of California. All rights reserved. 52fe8fb19SBen Gras.\" 62fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without 72fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions 82fe8fb19SBen Gras.\" are met: 92fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright 102fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer. 112fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 122fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer in the 132fe8fb19SBen Gras.\" documentation and/or other materials provided with the distribution. 142fe8fb19SBen Gras.\" 3. Neither the name of the University nor the names of its contributors 152fe8fb19SBen Gras.\" may be used to endorse or promote products derived from this software 162fe8fb19SBen Gras.\" without specific prior written permission. 172fe8fb19SBen Gras.\" 182fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 192fe8fb19SBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 202fe8fb19SBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 212fe8fb19SBen Gras.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 222fe8fb19SBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 232fe8fb19SBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 242fe8fb19SBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 252fe8fb19SBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 262fe8fb19SBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 272fe8fb19SBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 282fe8fb19SBen Gras.\" SUCH DAMAGE. 292fe8fb19SBen Gras.\" 302fe8fb19SBen Gras.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 312fe8fb19SBen Gras.\" 32*0a6a1f1dSLionel Sambuc.Dd June 13, 2014 332fe8fb19SBen Gras.Dt SYSCTL 3 342fe8fb19SBen Gras.Os 352fe8fb19SBen Gras.Sh NAME 362fe8fb19SBen Gras.Nm sysctl , 372fe8fb19SBen Gras.Nm sysctlbyname , 382fe8fb19SBen Gras.Nm sysctlgetmibinfo , 39*0a6a1f1dSLionel Sambuc.Nm sysctlnametomib , 40*0a6a1f1dSLionel Sambuc.Nm asysctl , 41*0a6a1f1dSLionel Sambuc.Nm asysctlbyname 422fe8fb19SBen Gras.Nd get or set system information 432fe8fb19SBen Gras.Sh LIBRARY 442fe8fb19SBen Gras.Lb libc 452fe8fb19SBen Gras.Sh SYNOPSIS 462fe8fb19SBen Gras.In sys/param.h 472fe8fb19SBen Gras.In sys/sysctl.h 482fe8fb19SBen Gras.Ft int 492fe8fb19SBen Gras.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" \ 502fe8fb19SBen Gras"const void *newp" "size_t newlen" 512fe8fb19SBen Gras.Ft int 522fe8fb19SBen Gras.Fn sysctlbyname "const char *sname" "void *oldp" "size_t *oldlenp" \ 532fe8fb19SBen Gras"const void *newp" "size_t newlen" 542fe8fb19SBen Gras.Ft int 552fe8fb19SBen Gras.Fn sysctlgetmibinfo "const char *sname" "int *name" "u_int *namelenp" \ 562fe8fb19SBen Gras"char *cname" "size_t *csz" "struct sysctlnode **rnode" "int v" 572fe8fb19SBen Gras.Ft int 582fe8fb19SBen Gras.Fn sysctlnametomib "const char *sname" "int *name" "size_t *namelenp" 59*0a6a1f1dSLionel Sambuc.Ft void * 60*0a6a1f1dSLionel Sambuc.Fn asysctl "const int *name" "size_t namelen" "size_t *len" 61*0a6a1f1dSLionel Sambuc.Ft void * 62*0a6a1f1dSLionel Sambuc.Fn asysctlbyname "const char *sname" "size_t *len" 632fe8fb19SBen Gras.Sh DESCRIPTION 642fe8fb19SBen GrasThe 652fe8fb19SBen Gras.Nm 662fe8fb19SBen Grasfunction retrieves system information and allows processes with 672fe8fb19SBen Grasappropriate privileges to set system information. 682fe8fb19SBen GrasThe information available from 692fe8fb19SBen Gras.Nm 702fe8fb19SBen Grasconsists of integers, strings, and tables. 712fe8fb19SBen GrasInformation may be retrieved and set from the command interface 722fe8fb19SBen Grasusing the 732fe8fb19SBen Gras.Xr sysctl 8 742fe8fb19SBen Grasutility. 752fe8fb19SBen Gras.Pp 762fe8fb19SBen GrasUnless explicitly noted below, 772fe8fb19SBen Gras.Nm 782fe8fb19SBen Grasreturns a consistent snapshot of the data requested. 792fe8fb19SBen GrasConsistency is obtained by locking the destination 802fe8fb19SBen Grasbuffer into memory so that the data may be copied out without blocking. 812fe8fb19SBen GrasCalls to 822fe8fb19SBen Gras.Nm 832fe8fb19SBen Grasare serialized to avoid deadlock. 842fe8fb19SBen Gras.Pp 852fe8fb19SBen GrasThe state is described using a ``Management Information Base'' (MIB) 862fe8fb19SBen Grasstyle name, listed in 872fe8fb19SBen Gras.Fa name , 882fe8fb19SBen Graswhich is a 892fe8fb19SBen Gras.Fa namelen 902fe8fb19SBen Graslength array of integers. 912fe8fb19SBen Gras.Pp 922fe8fb19SBen GrasThe 932fe8fb19SBen Gras.Fn sysctlbyname 942fe8fb19SBen Grasfunction accepts a string representation of a MIB entry and internally 952fe8fb19SBen Grasmaps it to the appropriate numeric MIB representation. 962fe8fb19SBen GrasIts semantics are otherwise no different from 972fe8fb19SBen Gras.Fn sysctl . 982fe8fb19SBen Gras.Pp 992fe8fb19SBen GrasThe information is copied into the buffer specified by 1002fe8fb19SBen Gras.Fa oldp . 1012fe8fb19SBen GrasThe size of the buffer is given by the location specified by 1022fe8fb19SBen Gras.Fa oldlenp 1032fe8fb19SBen Grasbefore the call, 1042fe8fb19SBen Grasand that location gives the amount of data copied after a successful call. 1052fe8fb19SBen GrasIf the amount of data available is greater 1062fe8fb19SBen Grasthan the size of the buffer supplied, 1072fe8fb19SBen Grasthe call supplies as much data as fits in the buffer provided 1082fe8fb19SBen Grasand returns with the error code ENOMEM. 1092fe8fb19SBen GrasIf the old value is not desired, 1102fe8fb19SBen Gras.Fa oldp 1112fe8fb19SBen Grasand 1122fe8fb19SBen Gras.Fa oldlenp 1132fe8fb19SBen Grasshould be set to 1142fe8fb19SBen Gras.Dv NULL . 1152fe8fb19SBen Gras.Pp 1162fe8fb19SBen GrasThe size of the available data can be determined by calling 1172fe8fb19SBen Gras.Nm 1182fe8fb19SBen Graswith a 1192fe8fb19SBen Gras.Dv NULL 1202fe8fb19SBen Grasparameter for 1212fe8fb19SBen Gras.Fa oldp . 1222fe8fb19SBen GrasThe size of the available data will be returned in the location pointed to by 1232fe8fb19SBen Gras.Fa oldlenp . 1242fe8fb19SBen GrasFor some operations, the amount of space may change often. 1252fe8fb19SBen GrasFor these operations, 1262fe8fb19SBen Grasthe system attempts to round up so that the returned size is 1272fe8fb19SBen Graslarge enough for a call to return the data shortly thereafter. 1282fe8fb19SBen Gras.Pp 1292fe8fb19SBen GrasTo set a new value, 1302fe8fb19SBen Gras.Fa newp 1312fe8fb19SBen Grasis set to point to a buffer of length 1322fe8fb19SBen Gras.Fa newlen 1332fe8fb19SBen Grasfrom which the requested value is to be taken. 1342fe8fb19SBen GrasIf a new value is not to be set, 1352fe8fb19SBen Gras.Fa newp 1362fe8fb19SBen Grasshould be set to 1372fe8fb19SBen Gras.Dv NULL 1382fe8fb19SBen Grasand 1392fe8fb19SBen Gras.Fa newlen 1402fe8fb19SBen Grasset to 0. 1412fe8fb19SBen Gras.Pp 1422fe8fb19SBen GrasThe 1432fe8fb19SBen Gras.Fn sysctlnametomib 1442fe8fb19SBen Grasfunction can be used to map the string representation of a MIB entry 1452fe8fb19SBen Grasto the numeric version. 1462fe8fb19SBen GrasThe 1472fe8fb19SBen Gras.Fa name 1482fe8fb19SBen Grasargument should point to an array of integers large enough to hold the 1492fe8fb19SBen GrasMIB, and 1502fe8fb19SBen Gras.Fa namelenp 1512fe8fb19SBen Grasshould indicate the number of integer slots available. 1522fe8fb19SBen GrasFollowing a successful translation, the size_t indicated by 1532fe8fb19SBen Gras.Fa namelenp 1542fe8fb19SBen Graswill be changed to show the number of slots consumed. 1552fe8fb19SBen Gras.Pp 1562fe8fb19SBen GrasThe 1572fe8fb19SBen Gras.Fn sysctlgetmibinfo 1582fe8fb19SBen Grasfunction performs name translation similar to 1592fe8fb19SBen Gras.Fn sysctlnametomib , 1602fe8fb19SBen Grasbut also canonicalizes the name (or returns the first erroneous token 1612fe8fb19SBen Grasfrom the string being parsed) into the space indicated by 1622fe8fb19SBen Gras.Fa cname 1632fe8fb19SBen Grasand 1642fe8fb19SBen Gras.Fa csz . 1652fe8fb19SBen Gras.Fa csz 1662fe8fb19SBen Grasshould indicate the size of the buffer pointed to by 1672fe8fb19SBen Gras.Fa cname 1682fe8fb19SBen Grasand on return, will indicate the size of the returned string including 1692fe8fb19SBen Grasthe trailing 1702fe8fb19SBen Gras.Sq nul 1712fe8fb19SBen Grascharacter. 1722fe8fb19SBen Gras.Pp 1732fe8fb19SBen GrasThe 1742fe8fb19SBen Gras.Fa rnode 1752fe8fb19SBen Grasand 1762fe8fb19SBen Gras.Fa v 1772fe8fb19SBen Grasarguments to 1782fe8fb19SBen Gras.Fn sysctlgetmibinfo 1792fe8fb19SBen Grasare used to provide a tree for it to parse into, and to get back 1802fe8fb19SBen Graseither a pointer to, or a copy of, the terminal node. 1812fe8fb19SBen GrasIf 1822fe8fb19SBen Gras.Fa rnode 1832fe8fb19SBen Grasis 1842fe8fb19SBen Gras.Dv NULL , 1852fe8fb19SBen Gras.Fn sysctlgetmibinfo 1862fe8fb19SBen Grasuses its own internal tree for parsing, and checks it against the 1872fe8fb19SBen Graskernel at each call, to make sure that the name-to-number mapping is 1882fe8fb19SBen Graskept up to date. 1892fe8fb19SBen GrasThe 1902fe8fb19SBen Gras.Fa v 1912fe8fb19SBen Grasargument is ignored in this case. 1922fe8fb19SBen GrasIf 1932fe8fb19SBen Gras.Fa rnode 1942fe8fb19SBen Grasis not 1952fe8fb19SBen Gras.Dv NULL 1962fe8fb19SBen Grasbut the pointer it references is, on a successful return, 1972fe8fb19SBen Gras.Fa rnode 1982fe8fb19SBen Graswill be adjusted to point to a copy of the terminal node. 1992fe8fb19SBen GrasThe 2002fe8fb19SBen Gras.Fa v 2012fe8fb19SBen Grasargument indicates which version of the 2022fe8fb19SBen Gras.Nm 2032fe8fb19SBen Grasnode structure the caller wants. 2042fe8fb19SBen GrasThe application must later 2052fe8fb19SBen Gras.Fn free 2062fe8fb19SBen Grasthis copy. 2072fe8fb19SBen GrasIf neither 2082fe8fb19SBen Gras.Fa rnode 2092fe8fb19SBen Grasnor the pointer it references are 2102fe8fb19SBen Gras.Dv NULL , 2112fe8fb19SBen Grasthe pointer is used as the address of a tree over which the parsing is 2122fe8fb19SBen Grasdone. 2132fe8fb19SBen GrasIn this last case, the tree is not checked against the kernel, no 2142fe8fb19SBen Grasrefreshing of the mappings is performed, and the value given by 2152fe8fb19SBen Gras.Fa v 2162fe8fb19SBen Grasmust agree with the version indicated by the tree. 2172fe8fb19SBen GrasIt is recommended that applications always use 2182fe8fb19SBen Gras.Dv SYSCTL_VERSION 2192fe8fb19SBen Grasas the value for 2202fe8fb19SBen Gras.Fa v , 2212fe8fb19SBen Grasas defined in the include file 2222fe8fb19SBen Gras.Pa sys/sysctl.h . 2232fe8fb19SBen Gras.Pp 2242fe8fb19SBen GrasThe numeric and text names of sysctl variables are described in 2252fe8fb19SBen Gras.Xr sysctl 7 . 2262fe8fb19SBen GrasThe numeric names are defined as preprocessor macros. 2272fe8fb19SBen GrasThe top level names are defined with a CTL_ prefix in 2282fe8fb19SBen Gras.In sys/sysctl.h . 2292fe8fb19SBen GrasThe next and subsequent levels down have different prefixes for each 2302fe8fb19SBen Grassubtree. 2312fe8fb19SBen Gras.Pp 2322fe8fb19SBen GrasFor example, the following retrieves the maximum number of processes allowed 2332fe8fb19SBen Grasin the system - the 2342fe8fb19SBen Gras.Li kern.maxproc 2352fe8fb19SBen Grasvariable: 2362fe8fb19SBen Gras.Bd -literal -offset indent -compact 2372fe8fb19SBen Grasint mib[2], maxproc; 2382fe8fb19SBen Grassize_t len; 2392fe8fb19SBen Gras.sp 2402fe8fb19SBen Grasmib[0] = CTL_KERN; 2412fe8fb19SBen Grasmib[1] = KERN_MAXPROC; 2422fe8fb19SBen Graslen = sizeof(maxproc); 2432fe8fb19SBen Grassysctl(mib, 2, \*[Am]maxproc, \*[Am]len, NULL, 0); 2442fe8fb19SBen Gras.Ed 2452fe8fb19SBen Gras.sp 2462fe8fb19SBen GrasTo retrieve the standard search path for the system utilities - 2472fe8fb19SBen Gras.Li user.cs_path : 2482fe8fb19SBen Gras.Bd -literal -offset indent -compact 2492fe8fb19SBen Grasint mib[2]; 2502fe8fb19SBen Grassize_t len; 2512fe8fb19SBen Graschar *p; 2522fe8fb19SBen Gras.sp 2532fe8fb19SBen Grasmib[0] = CTL_USER; 2542fe8fb19SBen Grasmib[1] = USER_CS_PATH; 2552fe8fb19SBen Grassysctl(mib, 2, NULL, \*[Am]len, NULL, 0); 2562fe8fb19SBen Grasp = malloc(len); 2572fe8fb19SBen Grassysctl(mib, 2, p, \*[Am]len, NULL, 0); 2582fe8fb19SBen Gras.Ed 259*0a6a1f1dSLionel Sambuc.Pp 260*0a6a1f1dSLionel SambucThe 261*0a6a1f1dSLionel Sambuc.Fn asysctl 262*0a6a1f1dSLionel Sambucand 263*0a6a1f1dSLionel Sambuc.Fn asysctlbyname 264*0a6a1f1dSLionel Sambucfunctions are wrappers for 265*0a6a1f1dSLionel Sambuc.Fn sysctl 266*0a6a1f1dSLionel Sambucand 267*0a6a1f1dSLionel Sambuc.Fn sysctlbyname . 268*0a6a1f1dSLionel SambucThey return memory allocated with 269*0a6a1f1dSLionel Sambuc.Xr malloc 3 270*0a6a1f1dSLionel Sambucand resize the buffer in a loop until all data fits. 2712fe8fb19SBen Gras.Sh DYNAMIC OPERATIONS 2722fe8fb19SBen GrasSeveral meta-identifiers are provided to perform operations on the 2732fe8fb19SBen Gras.Nm 2742fe8fb19SBen Grastree itself, or support alternate means of accessing the data 2752fe8fb19SBen Grasinstrumented by the 2762fe8fb19SBen Gras.Nm 2772fe8fb19SBen Grastree. 2782fe8fb19SBen Gras.Bl -column CTLXCREATESYMXXX 2792fe8fb19SBen Gras.It Sy Name Description 2802fe8fb19SBen Gras.It CTL\_QUERY Retrieve a mapping of names to numbers below a given node 2812fe8fb19SBen Gras.It CTL\_CREATE Create a new node 2822fe8fb19SBen Gras.It CTL\_CREATESYM Create a new node by its kernel symbol 2832fe8fb19SBen Gras.It CTL\_DESTROY Destroy a node 2842fe8fb19SBen Gras.It CTL\_DESCRIBE Retrieve node descriptions 2852fe8fb19SBen Gras.El 2862fe8fb19SBen Gras.Pp 2872fe8fb19SBen GrasThe core interface to all of these meta-functions is the structure 2882fe8fb19SBen Grasthat the kernel uses to describe the tree internally, as defined in 2892fe8fb19SBen Gras.In sys/sysctl.h 2902fe8fb19SBen Grasas: 2912fe8fb19SBen Gras.Pp 2922fe8fb19SBen Gras.Bd -literal 2932fe8fb19SBen Grasstruct sysctlnode { 2942fe8fb19SBen Gras uint32_t sysctl_flags; /* flags and type */ 2952fe8fb19SBen Gras int32_t sysctl_num; /* mib number */ 2962fe8fb19SBen Gras char sysctl_name[SYSCTL_NAMELEN]; /* node name */ 2972fe8fb19SBen Gras uint32_t sysctl_ver; /* node's version vs. rest of tree */ 2982fe8fb19SBen Gras uint32_t __rsvd; 2992fe8fb19SBen Gras union { 3002fe8fb19SBen Gras struct { 3012fe8fb19SBen Gras uint32_t suc_csize; /* size of child node array */ 3022fe8fb19SBen Gras uint32_t suc_clen; /* number of valid children */ 3032fe8fb19SBen Gras struct sysctlnode* suc_child; /* array of child nodes */ 3042fe8fb19SBen Gras } scu_child; 3052fe8fb19SBen Gras struct { 3062fe8fb19SBen Gras void *sud_data; /* pointer to external data */ 3072fe8fb19SBen Gras size_t sud_offset; /* offset to data */ 3082fe8fb19SBen Gras } scu_data; 3092fe8fb19SBen Gras int32_t scu_alias; /* node this node refers to */ 3102fe8fb19SBen Gras int32_t scu_idata; /* immediate "int" data */ 3112fe8fb19SBen Gras u_quad_t scu_qdata; /* immediate "u_quad_t" data */ 3122fe8fb19SBen Gras } sysctl_un; 3132fe8fb19SBen Gras size_t _sysctl_size; /* size of instrumented data */ 3142fe8fb19SBen Gras sysctlfn _sysctl_func; /* access helper function */ 3152fe8fb19SBen Gras struct sysctlnode *sysctl_parent; /* parent of this node */ 3162fe8fb19SBen Gras const char *sysctl_desc; /* description of node */ 3172fe8fb19SBen Gras}; 3182fe8fb19SBen Gras 3192fe8fb19SBen Gras#define sysctl_csize sysctl_un.scu_child.suc_csize 3202fe8fb19SBen Gras#define sysctl_clen sysctl_un.scu_child.suc_clen 3212fe8fb19SBen Gras#define sysctl_child sysctl_un.scu_child.suc_child 3222fe8fb19SBen Gras#define sysctl_data sysctl_un.scu_data.sud_data 3232fe8fb19SBen Gras#define sysctl_offset sysctl_un.scu_data.sud_offset 3242fe8fb19SBen Gras#define sysctl_alias sysctl_un.scu_alias 3252fe8fb19SBen Gras#define sysctl_idata sysctl_un.scu_idata 3262fe8fb19SBen Gras#define sysctl_qdata sysctl_un.scu_qdata 3272fe8fb19SBen Gras.Ed 3282fe8fb19SBen Gras.Pp 3292fe8fb19SBen GrasQuerying the tree to discover the name to number mapping permits 3302fe8fb19SBen Grasdynamic discovery of all the data that the tree currently has 3312fe8fb19SBen Grasinstrumented. 3322fe8fb19SBen GrasFor example, to discover all the nodes below the 3332fe8fb19SBen GrasCTL_VFS node: 3342fe8fb19SBen Gras.Pp 3352fe8fb19SBen Gras.Bd -literal -offset indent -compact 3362fe8fb19SBen Grasstruct sysctlnode query, vfs[128]; 3372fe8fb19SBen Grasint mib[2]; 3382fe8fb19SBen Grassize_t len; 3392fe8fb19SBen Gras.sp 3402fe8fb19SBen Grasmib[0] = CTL_VFS; 3412fe8fb19SBen Grasmib[1] = CTL_QUERY; 3422fe8fb19SBen Grasmemset(\*[Am]query, 0, sizeof(query)); 3432fe8fb19SBen Grasquery.sysctl_flags = SYSCTL_VERSION; 3442fe8fb19SBen Graslen = sizeof(vfs); 3452fe8fb19SBen Grassysctl(mib, 2, \*[Am]vfs[0], \*[Am]len, \*[Am]query, sizeof(query)); 3462fe8fb19SBen Gras.Ed 3472fe8fb19SBen Gras.Pp 3482fe8fb19SBen GrasNote that a reference to an empty node with 3492fe8fb19SBen Gras.Fa sysctl_flags 3502fe8fb19SBen Grasset to 3512fe8fb19SBen Gras.Dv SYSCTL_VERSION 3522fe8fb19SBen Grasis passed to sysctl in order to indicate the version that the program 3532fe8fb19SBen Grasis using. 3542fe8fb19SBen GrasAll dynamic operations passing nodes into sysctl require that the 3552fe8fb19SBen Grasversion be explicitly specified. 3562fe8fb19SBen Gras.Pp 3572fe8fb19SBen GrasCreation and destruction of nodes works by constructing part of a new 3582fe8fb19SBen Grasnode description (or a description of the existing node) and invoking 3592fe8fb19SBen GrasCTL_CREATE (or CTL_CREATESYM) or CTL_DESTROY at the parent of the new 3602fe8fb19SBen Grasnode, with a pointer to the new node passed via the 3612fe8fb19SBen Gras.Fa new 3622fe8fb19SBen Grasand 3632fe8fb19SBen Gras.Fa newlen 3642fe8fb19SBen Grasarguments. 3652fe8fb19SBen GrasIf valid values for 3662fe8fb19SBen Gras.Fa old 3672fe8fb19SBen Grasand 3682fe8fb19SBen Gras.Fa oldlenp 3692fe8fb19SBen Grasare passed, a copy of the new node once in the tree will be returned. 3702fe8fb19SBen GrasIf the create operation fails because a node with the same name or MIB 3712fe8fb19SBen Grasnumber exists, a copy of the conflicting node will be returned. 3722fe8fb19SBen Gras.Pp 3732fe8fb19SBen GrasThe minimum requirements for creating a node are setting the 3742fe8fb19SBen Gras.Fa sysctl_flags 3752fe8fb19SBen Grasto indicate the new node's type, 3762fe8fb19SBen Gras.Fa sysctl_num 3772fe8fb19SBen Grasto either the new node's number (or CTL_CREATE or CTL_CREATESYM if a 3782fe8fb19SBen Grasdynamically allocated MIB number is acceptable), 3792fe8fb19SBen Gras.Fa sysctl_size 3802fe8fb19SBen Grasto the size of the data to be instrumented (which must agree with the 3812fe8fb19SBen Grasgiven type), and 3822fe8fb19SBen Gras.Fa sysctl_name 3832fe8fb19SBen Grasmust be set to the new node's name. 3842fe8fb19SBen GrasNodes that are not of type 3852fe8fb19SBen Gras.Dq node 3862fe8fb19SBen Grasmust also have some description of the data to be instrumented, which 3872fe8fb19SBen Graswill vary depending on what is to be instrumented. 3882fe8fb19SBen Gras.Pp 3892fe8fb19SBen GrasIf existing kernel data is to be covered by this new node, its address 3902fe8fb19SBen Grasshould be given in 3912fe8fb19SBen Gras.Fa sysctl_data 3922fe8fb19SBen Grasor, if CTL_CREATESYM is used, 3932fe8fb19SBen Gras.Fa sysctl_data 3942fe8fb19SBen Grasshould be set to a string containing its name from the kernel's symbol 3952fe8fb19SBen Grastable. 3962fe8fb19SBen GrasIf new data is to be instrumented and an initial value is available, 3972fe8fb19SBen Grasthe new integer or quad type data should be placed into either 3982fe8fb19SBen Gras.Fa sysctl_idata 3992fe8fb19SBen Grasor 4002fe8fb19SBen Gras.Fa sysctl_qdata , 4012fe8fb19SBen Grasrespectively, along with the SYSCTL_IMMEDIATE flag being set, or 4022fe8fb19SBen Gras.Fa sysctl_data 4032fe8fb19SBen Grasshould be set to point to a copy of the new data, and the 4042fe8fb19SBen GrasSYSCTL_OWNDATA flag must be set. 4052fe8fb19SBen GrasThis latter method is the only way that new string and struct type 4062fe8fb19SBen Grasnodes can be initialized. 4072fe8fb19SBen GrasInvalid kernel addresses are accepted, but any attempt to access those 4082fe8fb19SBen Grasnodes will return an error. 4092fe8fb19SBen Gras.Pp 4102fe8fb19SBen GrasThe 4112fe8fb19SBen Gras.Fa sysctl_csize , 4122fe8fb19SBen Gras.Fa sysctl_clen , 4132fe8fb19SBen Gras.Fa sysctl_child , 4142fe8fb19SBen Gras.Fa sysctl_parent , 4152fe8fb19SBen Grasand 4162fe8fb19SBen Gras.Fa sysctl_alias 4172fe8fb19SBen Grasmembers are used by the kernel to link the tree together and must be 4182fe8fb19SBen Gras.Dv NULL 4192fe8fb19SBen Grasor 0. 4202fe8fb19SBen GrasNodes created in this manner cannot have helper functions, so 4212fe8fb19SBen Gras.Fa sysctl_func 4222fe8fb19SBen Grasmust also be 4232fe8fb19SBen Gras.Dv NULL . 4242fe8fb19SBen GrasIf the 4252fe8fb19SBen Gras.Fa sysctl_ver 4262fe8fb19SBen Grasmember is non-zero, it must match either the version of the parent or 4272fe8fb19SBen Grasthe version at the root of the MIB or an error is returned. 4282fe8fb19SBen GrasThis can be used to ensure that nodes are only added or removed from a 4292fe8fb19SBen Grasknown state of the tree. 4302fe8fb19SBen GrasNote: It may not be possible to determine the version at the root 4312fe8fb19SBen Grasof the tree. 4322fe8fb19SBen Gras.Pp 4332fe8fb19SBen GrasThis example creates a new subtree and adds a node to it that controls the 4342fe8fb19SBen Gras.Fa audiodebug 4352fe8fb19SBen Graskernel variable, thereby making it tunable at at any time, without 4362fe8fb19SBen Grasneeding to use 4372fe8fb19SBen Gras.Xr ddb 4 4382fe8fb19SBen Grasor 4392fe8fb19SBen Gras.Xr kvm 3 4402fe8fb19SBen Grasto alter the kernel's memory directly. 4412fe8fb19SBen Gras.Pp 4422fe8fb19SBen Gras.Bd -literal -offset indent -compact 4432fe8fb19SBen Grasstruct sysctlnode node; 4442fe8fb19SBen Grasint mib[2]; 4452fe8fb19SBen Grassize_t len; 4462fe8fb19SBen Gras.sp 4472fe8fb19SBen Grasmib[0] = CTL_CREATE; /* create at top-level */ 4482fe8fb19SBen Graslen = sizeof(node); 4492fe8fb19SBen Grasmemset(\*[Am]node, 0, len); 4502fe8fb19SBen Grasnode.sysctl_flags = SYSCTL_VERSION|CTLFLAG_READWRITE|CTLTYPE_NODE; 4512fe8fb19SBen Grassnprintf(node.sysctl_name, sizeof(node.sysctl_name), "local"); 4522fe8fb19SBen Grasnode.sysctl_num = CTL_CREATE; /* request dynamic MIB number */ 4532fe8fb19SBen Grassysctl(\*[Am]mib[0], 1, \*[Am]node, \*[Am]len, \*[Am]node, len); 4542fe8fb19SBen Gras.sp 4552fe8fb19SBen Grasmib[0] = node.sysctl_num; /* use new MIB number */ 4562fe8fb19SBen Grasmib[1] = CTL_CREATESYM; /* create at second level */ 4572fe8fb19SBen Graslen = sizeof(node); 4582fe8fb19SBen Grasmemset(\*[Am]node, 0, len); 4592fe8fb19SBen Grasnode.sysctl_flags = SYSCTL_VERSION|CTLFLAG_READWRITE|CTLTYPE_INT; 4602fe8fb19SBen Grassnprintf(node.sysctl_name, sizeof(node.sysctl_name), "audiodebug"); 4612fe8fb19SBen Grasnode.sysctl_num = CTL_CREATE; 4622fe8fb19SBen Grasnode.sysctl_data = "audiodebug"; /* kernel symbol to be used */ 4632fe8fb19SBen Grassysctl(\*[Am]mib[0], 2, NULL, NULL, \*[Am]node, len); 4642fe8fb19SBen Gras.Ed 4652fe8fb19SBen Gras.Pp 4662fe8fb19SBen GrasThe process for deleting nodes is similar, but less data needs to 4672fe8fb19SBen Grasbe supplied. 4682fe8fb19SBen GrasOnly the 4692fe8fb19SBen Gras.Fa sysctl_num 4702fe8fb19SBen Grasfield 4712fe8fb19SBen Grasneeds to be filled in; almost all other fields must be left blank. 4722fe8fb19SBen GrasThe 4732fe8fb19SBen Gras.Fa sysctl_name 4742fe8fb19SBen Grasand/or 4752fe8fb19SBen Gras.Fa sysctl_ver 4762fe8fb19SBen Grasfields can be filled in with the name and version of the existing node 4772fe8fb19SBen Grasas additional checks on what will be deleted. 4782fe8fb19SBen GrasIf all the given data fail to match any node, nothing will be deleted. 4792fe8fb19SBen GrasIf valid values for 4802fe8fb19SBen Gras.Fa old 4812fe8fb19SBen Grasand 4822fe8fb19SBen Gras.Fa oldlenp 4832fe8fb19SBen Grasare supplied and a node is deleted, a copy of what was in the MIB tree 4842fe8fb19SBen Graswill be returned. 4852fe8fb19SBen Gras.Pp 4862fe8fb19SBen GrasThis sample code shows the deletion of the two nodes created in the 4872fe8fb19SBen Grasabove example: 4882fe8fb19SBen Gras.Pp 4892fe8fb19SBen Gras.Bd -literal -offset indent -compact 4902fe8fb19SBen Grasint mib[2]; 4912fe8fb19SBen Gras.sp 4922fe8fb19SBen Graslen = sizeof(node); 4932fe8fb19SBen Grasmemset(\*[Am]node, 0, len); 4942fe8fb19SBen Grasnode.sysctl_flags = SYSCTL_VERSION; 4952fe8fb19SBen Gras.sp 4962fe8fb19SBen Grasmib[0] = 3214; /* assumed number for "local" */ 4972fe8fb19SBen Grasmib[1] = CTL_DESTROY; 4982fe8fb19SBen Grasnode.sysctl_num = 3215; /* assumed number for "audiodebug" */ 4992fe8fb19SBen Grassysctl(\*[Am]mib[0], 2, NULL, NULL, \*[Am]node, len); 5002fe8fb19SBen Gras.sp 5012fe8fb19SBen Grasmib[0] = CTL_DESTROY; 5022fe8fb19SBen Grasnode.sysctl_num = 3214; /* now deleting "local" */ 5032fe8fb19SBen Grassysctl(\*[Am]mib[0], 1, NULL, NULL, \*[Am]node, len); 5042fe8fb19SBen Gras.Ed 5052fe8fb19SBen Gras.Pp 5062fe8fb19SBen GrasDescriptions of each of the nodes can also be retrieved, if they are 5072fe8fb19SBen Grasavailable. 5082fe8fb19SBen GrasDescriptions can be retrieved in bulk at each level or on a per-node 5092fe8fb19SBen Grasbasis. 5102fe8fb19SBen GrasThe layout of the buffer into which the descriptions are returned is a 5112fe8fb19SBen Grasseries of variable length structures, each of which describes its own 5122fe8fb19SBen Grassize. 5132fe8fb19SBen GrasThe length indicated includes the terminating 5142fe8fb19SBen Gras.Sq nul 5152fe8fb19SBen Grascharacter. 5162fe8fb19SBen GrasNodes that have no description or where the description is not 5172fe8fb19SBen Grasavailable are indicated by an empty string. 5182fe8fb19SBen GrasThe 5192fe8fb19SBen Gras.Fa descr_ver 5202fe8fb19SBen Graswill match the 5212fe8fb19SBen Gras.Fa sysctl_ver 5222fe8fb19SBen Grasvalue for a given node, so that descriptions for nodes whose number 5232fe8fb19SBen Grashave been recycled can be detected and ignored or discarded. 5242fe8fb19SBen Gras.Pp 5252fe8fb19SBen Gras.Bd -literal 5262fe8fb19SBen Grasstruct sysctldesc { 5272fe8fb19SBen Gras int32_t descr_num; /* mib number of node */ 5282fe8fb19SBen Gras uint32_t descr_ver; /* version of node */ 5292fe8fb19SBen Gras uint32_t descr_len; /* length of description string */ 5302fe8fb19SBen Gras char descr_str[1]; /* not really 1...see above */ 5312fe8fb19SBen Gras}; 5322fe8fb19SBen Gras.Ed 5332fe8fb19SBen Gras.Pp 5342fe8fb19SBen GrasThe 5352fe8fb19SBen Gras.Fn NEXT_DESCR 5362fe8fb19SBen Grasmacro can be used to skip to the next description in the retrieved 5372fe8fb19SBen Graslist. 5382fe8fb19SBen Gras.Pp 5392fe8fb19SBen Gras.Bd -literal -offset indent -compact 5402fe8fb19SBen Grasstruct sysctlnode desc; 5412fe8fb19SBen Grasstruct sysctldesc *d; 5422fe8fb19SBen Graschar buf[1024]; 5432fe8fb19SBen Grasint mib[2]; 5442fe8fb19SBen Grassize_t len; 5452fe8fb19SBen Gras.sp 5462fe8fb19SBen Gras/* retrieve kern-level descriptions */ 5472fe8fb19SBen Grasmib[0] = CTL_KERN; 5482fe8fb19SBen Grasmib[1] = CTL_DESCRIBE; 5492fe8fb19SBen Grasd = (struct sysctldesc *)\*[Am]buf[0]; 5502fe8fb19SBen Graslen = sizeof(buf); 5512fe8fb19SBen Grassysctl(mib, 2, d, \*[Am]len, NULL, 0); 5522fe8fb19SBen Graswhile ((caddr_t)d \*[Lt] (caddr_t)\*[Am]buf[len]) { 5532fe8fb19SBen Gras printf("node %d: %.*s\\n", d-\*[Gt]descr_num, d-\*[Gt]descr_len, 5542fe8fb19SBen Gras d-\*[Gt]descr_str); 5552fe8fb19SBen Gras d = NEXT_DESCR(d); 5562fe8fb19SBen Gras} 5572fe8fb19SBen Gras.sp 5582fe8fb19SBen Gras/* retrieve description for kern.securelevel */ 5592fe8fb19SBen Grasmemset(\*[Am]desc, 0, sizeof(desc)); 5602fe8fb19SBen Grasdesc.sysctl_flags = SYSCTL_VERSION; 5612fe8fb19SBen Grasdesc.sysctl_num = KERN_SECURELEVEL; 5622fe8fb19SBen Grasd = (struct sysctldesc *)\*[Am]buf[0]; 5632fe8fb19SBen Graslen = sizeof(buf); 5642fe8fb19SBen Grassysctl(mib, 2, d, \*[Am]len, \*[Am]desc, sizeof(desc)); 5652fe8fb19SBen Grasprintf("kern.securelevel: %.*s\\n", d-\*[Gt]descr_len, d-\*[Gt]descr_str); 5662fe8fb19SBen Gras.Ed 5672fe8fb19SBen Gras.Pp 5682fe8fb19SBen GrasDescriptions can also be set as follows, subject to the following rules: 5692fe8fb19SBen Gras.Pp 5702fe8fb19SBen Gras.Bl -bullet -compact 5712fe8fb19SBen Gras.It 5722fe8fb19SBen GrasThe kernel securelevel is at zero or lower 5732fe8fb19SBen Gras.It 5742fe8fb19SBen GrasThe caller has super-user privileges 5752fe8fb19SBen Gras.It 5762fe8fb19SBen GrasThe node does not currently have a description 5772fe8fb19SBen Gras.It 5782fe8fb19SBen GrasThe node is not marked as 5792fe8fb19SBen Gras.Dq permanent 5802fe8fb19SBen Gras.El 5812fe8fb19SBen Gras.Pp 5822fe8fb19SBen Gras.Bd -literal -offset indent -compact 5832fe8fb19SBen Grasstruct sysctlnode desc; 5842fe8fb19SBen Grasint mib[2]; 5852fe8fb19SBen Gras.sp 5862fe8fb19SBen Gras/* presuming the given top-level node was just added... */ 5872fe8fb19SBen Grasmib[0] = 3214; /* mib numbers taken from previous examples */ 5882fe8fb19SBen Grasmib[1] = CTL_DESCRIBE; 5892fe8fb19SBen Grasmemset(\*[Am]desc, 0, sizeof(desc)); 5902fe8fb19SBen Grasdesc.sysctl_flags = SYSCTL_VERSION; 5912fe8fb19SBen Grasdesc.sysctl_num = 3215; 5922fe8fb19SBen Grasdesc.sysctl_desc = "audio debug control knob"; 5932fe8fb19SBen Grassysctl(mib, 2, NULL, NULL, \*[Am]desc, sizeof(desc)); 5942fe8fb19SBen Gras.Ed 5952fe8fb19SBen Gras.Pp 5962fe8fb19SBen GrasUpon successfully setting a description, the new description will be 5972fe8fb19SBen Grasreturned in the space indicated by the 5982fe8fb19SBen Gras.Fa oldp 5992fe8fb19SBen Grasand 6002fe8fb19SBen Gras.Fa oldlenp 6012fe8fb19SBen Grasarguments. 6022fe8fb19SBen Gras.Pp 6032fe8fb19SBen GrasThe 6042fe8fb19SBen Gras.Fa sysctl_flags 6052fe8fb19SBen Grasfield in the struct sysctlnode contains the sysctl version, node type 6062fe8fb19SBen Grasinformation, and a number of flags. 6072fe8fb19SBen GrasThe macros 6082fe8fb19SBen Gras.Fn SYSCTL_VERS , 6092fe8fb19SBen Gras.Fn SYSCTL_TYPE , 6102fe8fb19SBen Grasand 6112fe8fb19SBen Gras.Fn SYSCTL_FLAGS 6122fe8fb19SBen Grascan be used to access the different fields. 6132fe8fb19SBen GrasValid flags are: 6142fe8fb19SBen Gras.Bl -column CTLFLAGXPERMANENTXXX 6152fe8fb19SBen Gras.It Sy Name Description 6162fe8fb19SBen Gras.It CTLFLAG\_READONLY Node is read-only 6172fe8fb19SBen Gras.It CTLFLAG\_READWRITE Node is writable by the superuser 6182fe8fb19SBen Gras.It CTLFLAG\_ANYWRITE Node is writable by anyone 6192fe8fb19SBen Gras.It CTLFLAG\_PRIVATE Node is readable only by the superuser 6202fe8fb19SBen Gras.It CTLFLAG\_PERMANENT Node cannot be removed (cannot be set by 6212fe8fb19SBen Grasprocesses) 6222fe8fb19SBen Gras.It CTLFLAG\_OWNDATA Node owns data and does not instrument 6232fe8fb19SBen Grasexisting data 6242fe8fb19SBen Gras.It CTLFLAG\_IMMEDIATE Node contains instrumented data and does not 6252fe8fb19SBen Grasinstrument existing data 6262fe8fb19SBen Gras.It CTLFLAG\_HEX Node's contents should be displayed in a hexadecimal 6272fe8fb19SBen Grasform 6282fe8fb19SBen Gras.It CTLFLAG\_ROOT Node is the root of a tree (cannot be set at 6292fe8fb19SBen Grasany time) 6302fe8fb19SBen Gras.It CTLFLAG\_ANYNUMBER Node matches any MIB number (cannot be set by 6312fe8fb19SBen Grasprocesses) 6322fe8fb19SBen Gras.It CTLFLAG\_HIDDEN Node not displayed by default 6332fe8fb19SBen Gras.It CTLFLAG\_ALIAS Node refers to a sibling node (cannot be set 6342fe8fb19SBen Grasby processes) 6352fe8fb19SBen Gras.It CTLFLAG\_OWNDESC Node owns its own description string space 6362fe8fb19SBen Gras.El 6372fe8fb19SBen Gras.Sh RETURN VALUES 6382fe8fb19SBen GrasIf the call to 6392fe8fb19SBen Gras.Nm 6402fe8fb19SBen Grasis successful, 0 is returned. 6412fe8fb19SBen GrasOtherwise \-1 is returned and 6422fe8fb19SBen Gras.Va errno 6432fe8fb19SBen Grasis set appropriately. 6442fe8fb19SBen Gras.Sh FILES 6452fe8fb19SBen Gras.Bl -tag -width \*[Lt]netinet6/udp6Xvar.h\*[Gt] -compact 6462fe8fb19SBen Gras.It Aq Pa sys/sysctl.h 6472fe8fb19SBen Grasdefinitions for top level identifiers, second level kernel and hardware 6482fe8fb19SBen Grasidentifiers, and user level identifiers 6492fe8fb19SBen Gras.It Aq Pa sys/socket.h 6502fe8fb19SBen Grasdefinitions for second level network identifiers 6512fe8fb19SBen Gras.It Aq Pa sys/gmon.h 6522fe8fb19SBen Grasdefinitions for third level profiling identifiers 6532fe8fb19SBen Gras.It Aq Pa uvm/uvm_param.h 6542fe8fb19SBen Grasdefinitions for second level virtual memory identifiers 6552fe8fb19SBen Gras.It Aq Pa netinet/in.h 6562fe8fb19SBen Grasdefinitions for third level IPv4/v6 identifiers and 6572fe8fb19SBen Grasfourth level IPv4/v6 identifiers 6582fe8fb19SBen Gras.It Aq Pa netinet/icmp_var.h 6592fe8fb19SBen Grasdefinitions for fourth level ICMP identifiers 6602fe8fb19SBen Gras.It Aq Pa netinet/icmp6.h 6612fe8fb19SBen Grasdefinitions for fourth level ICMPv6 identifiers 6622fe8fb19SBen Gras.It Aq Pa netinet/tcp_var.h 6632fe8fb19SBen Grasdefinitions for fourth level TCP identifiers 6642fe8fb19SBen Gras.It Aq Pa netinet/udp_var.h 6652fe8fb19SBen Grasdefinitions for fourth level UDP identifiers 6662fe8fb19SBen Gras.It Aq Pa netinet6/udp6_var.h 6672fe8fb19SBen Grasdefinitions for fourth level IPv6 UDP identifiers 6682fe8fb19SBen Gras.It Aq Pa netinet6/ipsec.h 6692fe8fb19SBen Grasdefinitions for fourth level IPsec identifiers 6702fe8fb19SBen Gras.It Aq Pa netkey/key_var.h 6712fe8fb19SBen Grasdefinitions for third level PF_KEY identifiers 6722fe8fb19SBen Gras.It Aq Pa machine/cpu.h 6732fe8fb19SBen Grasdefinitions for second level machdep identifiers 6742fe8fb19SBen Gras.El 6752fe8fb19SBen Gras.Sh ERRORS 6762fe8fb19SBen GrasThe following errors may be reported: 6772fe8fb19SBen Gras.Bl -tag -width Er 6782fe8fb19SBen Gras.It Bq Er EFAULT 6792fe8fb19SBen GrasThe buffer 6802fe8fb19SBen Gras.Fa name , 6812fe8fb19SBen Gras.Fa oldp , 6822fe8fb19SBen Gras.Fa newp , 6832fe8fb19SBen Grasor length pointer 6842fe8fb19SBen Gras.Fa oldlenp 6852fe8fb19SBen Grascontains an invalid address, or the requested value is temporarily 6862fe8fb19SBen Grasunavailable. 6872fe8fb19SBen Gras.It Bq Er EINVAL 6882fe8fb19SBen GrasThe 6892fe8fb19SBen Gras.Fa name 690*0a6a1f1dSLionel Sambucarray is zero or greater than 691*0a6a1f1dSLionel Sambuc.Dv CTL_MAXNAME ; 692*0a6a1f1dSLionel Sambucor a non-null 6932fe8fb19SBen Gras.Fa newp 6942fe8fb19SBen Grasis given and its specified length in 6952fe8fb19SBen Gras.Fa newlen 6962fe8fb19SBen Grasis too large or too small, or the given value is not acceptable for 6972fe8fb19SBen Grasthe given node. 6982fe8fb19SBen Gras.It Bq Er EISDIR 6992fe8fb19SBen GrasThe 7002fe8fb19SBen Gras.Fa name 7012fe8fb19SBen Grasarray specifies an intermediate rather than terminal name. 7022fe8fb19SBen Gras.It Bq Er ENOENT 7032fe8fb19SBen GrasThe 7042fe8fb19SBen Gras.Fa name 705*0a6a1f1dSLionel Sambucarray specifies a node that does not exist in the tree; 706*0a6a1f1dSLionel Sambucor an attempt was made to destroy a node that does not exist, or to 7072fe8fb19SBen Grascreate or destroy a node below a node that does not exist. 7082fe8fb19SBen Gras.It Bq Er ENOMEM 7092fe8fb19SBen GrasThe length pointed to by 7102fe8fb19SBen Gras.Fa oldlenp 7112fe8fb19SBen Grasis too short to hold the requested value. 7122fe8fb19SBen Gras.It Bq Er ENOTDIR 7132fe8fb19SBen GrasThe 7142fe8fb19SBen Gras.Fa name 7152fe8fb19SBen Grasarray specifies a node below a node that addresses data. 7162fe8fb19SBen Gras.It Bq Er ENOTEMPTY 7172fe8fb19SBen GrasAn attempt was made to destroy a node that still has children. 7182fe8fb19SBen Gras.It Bq Er EOPNOTSUPP 7192fe8fb19SBen GrasThe 7202fe8fb19SBen Gras.Fa name 7212fe8fb19SBen Grasarray specifies a value that is unknown or a meta-operation was 7222fe8fb19SBen Grasattempted that the requested node does not support. 7232fe8fb19SBen Gras.It Bq Er EPERM 724*0a6a1f1dSLionel SambucAn attempt is made to set a read-only value; or 725*0a6a1f1dSLionel Sambuca process without appropriate privilege attempts to set a value or to 726*0a6a1f1dSLionel Sambuccreate or destroy a node; or 727*0a6a1f1dSLionel Sambucan attempt to change a value protected by the current kernel security 7282fe8fb19SBen Graslevel is made. 7292fe8fb19SBen Gras.El 7302fe8fb19SBen Gras.Sh SEE ALSO 7312fe8fb19SBen Gras.Xr sysctl 7 , 7322fe8fb19SBen Gras.Xr sysctl 8 , 7332fe8fb19SBen Gras.Xr secmodel_securelevel 9 7342fe8fb19SBen Gras.\" .Xr sysctl 9 7352fe8fb19SBen Gras.Sh HISTORY 7362fe8fb19SBen GrasThe 7372fe8fb19SBen Gras.Nm 7382fe8fb19SBen Grasfunction first appeared in 7392fe8fb19SBen Gras.Bx 4.4 . 740