[BACK]Return to sysctl.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Annotation of src/lib/libc/gen/sysctl.3, Revision 1.5

1.5     ! cgd         1: .\"    $NetBSD$
        !             2: .\"
1.1       cgd         3: .\" Copyright (c) 1993
                      4: .\"    The Regents of the University of California.  All rights reserved.
                      5: .\"
                      6: .\" Redistribution and use in source and binary forms, with or without
                      7: .\" modification, are permitted provided that the following conditions
                      8: .\" are met:
                      9: .\" 1. Redistributions of source code must retain the above copyright
                     10: .\"    notice, this list of conditions and the following disclaimer.
                     11: .\" 2. Redistributions in binary form must reproduce the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer in the
                     13: .\"    documentation and/or other materials provided with the distribution.
                     14: .\" 3. All advertising materials mentioning features or use of this software
                     15: .\"    must display the following acknowledgement:
                     16: .\"    This product includes software developed by the University of
                     17: .\"    California, Berkeley and its contributors.
                     18: .\" 4. Neither the name of the University nor the names of its contributors
                     19: .\"    may be used to endorse or promote products derived from this software
                     20: .\"    without specific prior written permission.
                     21: .\"
                     22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     25: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     32: .\" SUCH DAMAGE.
                     33: .\"
                     34: .\"    @(#)sysctl.3    8.1 (Berkeley) 6/4/93
                     35: .\"
                     36: .Dd "June 4, 1993"
                     37: .Dt SYSCTL 3
                     38: .Os
                     39: .Sh NAME
                     40: .Nm sysctl
                     41: .Nd get or set system information
                     42: .Sh SYNOPSIS
                     43: .Fd #include <sys/sysctl.h>
                     44: .Ft int
                     45: .Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
                     46: .Sh DESCRIPTION
                     47: The
                     48: .Nm sysctl
                     49: function retrieves system information and allows processes with
                     50: appropriate privileges to set system information.
                     51: The information available from
                     52: .Nm sysctl
                     53: consists of integers, strings, and tables.
                     54: Information may be retrieved and set from the command interface
                     55: using the
1.2       jtc        56: .Xr sysctl 8
1.1       cgd        57: utility.
                     58: .Pp
                     59: Unless explicitly noted below,
                     60: .Nm sysctl
                     61: returns a consistent snapshot of the data requested.
                     62: Consistency is obtained by locking the destination
                     63: buffer into memory so that the data may be copied out without blocking.
                     64: Calls to
                     65: .Nm sysctl
                     66: are serialized to avoid deadlock.
                     67: .Pp
                     68: The state is described using a ``Management Information Base'' (MIB)
                     69: style name, listed in
                     70: .Fa name ,
                     71: which is a
                     72: .Fa namelen
                     73: length array of integers.
                     74: .Pp
                     75: The information is copied into the buffer specified by
                     76: .Fa oldp .
                     77: The size of the buffer is given by the location specified by
                     78: .Fa oldlenp
                     79: before the call,
                     80: and that location gives the amount of data copied after a successful call.
                     81: If the amount of data available is greater
                     82: than the size of the buffer supplied,
                     83: the call supplies as much data as fits in the buffer provided
                     84: and returns with the error code ENOMEM.
                     85: If the old value is not desired,
                     86: .Fa oldp
                     87: and
                     88: .Fa oldlenp
                     89: should be set to NULL.
                     90: .Pp
                     91: The size of the available data can be determined by calling
                     92: .Nm sysctl
                     93: with a NULL parameter for
                     94: .Fa oldp .
                     95: The size of the available data will be returned in the location pointed to by
                     96: .Fa oldlenp .
                     97: For some operations, the amount of space may change often.
                     98: For these operations,
                     99: the system attempts to round up so that the returned size is
                    100: large enough for a call to return the data shortly thereafter.
                    101: .Pp
                    102: To set a new value,
                    103: .Fa newp
                    104: is set to point to a buffer of length
                    105: .Fa newlen
                    106: from which the requested value is to be taken.
                    107: If a new value is not to be set,
                    108: .Fa newp
                    109: should be set to NULL and
                    110: .Fa newlen
                    111: set to 0.
                    112: .Pp
                    113: The top level names are defined with a CTL_ prefix in
                    114: .Pa <sys/sysctl.h> ,
                    115: and are as follows.
                    116: The next and subsequent levels down are found in the include files
                    117: listed here, and described in separate sections below.
                    118: .Pp
                    119: .Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
                    120: .It Sy Pa Name Next level names        Description
                    121: .It CTL\_DEBUG sys/sysctl.h    Debugging
                    122: .It CTL\_FS    sys/sysctl.h    File system
                    123: .It CTL\_HW    sys/sysctl.h    Generic CPU, I/O
                    124: .It CTL\_KERN  sys/sysctl.h    High kernel limits
                    125: .It CTL\_MACHDEP       sys/sysctl.h    Machine dependent
                    126: .It CTL\_NET   sys/socket.h    Networking
                    127: .It CTL\_USER  sys/sysctl.h    User-level
                    128: .It CTL\_VM    vm/vm_param.h   Virtual memory
                    129: .El
                    130: .Pp
                    131: For example, the following retrieves the maximum number of processes allowed
                    132: in the system:
                    133: .Bd -literal -offset indent -compact
                    134: int mib[2], maxproc;
                    135: size_t len;
                    136: .sp
                    137: mib[0] = CTL_KERN;
                    138: mib[1] = KERN_MAXPROC;
                    139: len = sizeof(maxproc);
                    140: sysctl(mib, 2, &maxproc, &len, NULL, 0);
                    141: .Ed
                    142: .sp
                    143: To retrieve the standard search path for the system utilities:
                    144: .Bd -literal -offset indent -compact
                    145: int mib[2];
                    146: size_t len;
                    147: char *p;
                    148: .sp
                    149: mib[0] = CTL_USER;
                    150: mib[1] = USER_CS_PATH;
                    151: sysctl(mib, 2, NULL, &len, NULL, 0);
                    152: p = malloc(len);
                    153: sysctl(mib, 2, p, &len, NULL, 0);
                    154: .Ed
                    155: .Sh CTL_DEBUG
                    156: The debugging variables vary from system to system.
                    157: A debugging variable may be added or deleted without need to recompile
                    158: .Nm sysctl
                    159: to know about it.
                    160: Each time it runs,
                    161: .Nm sysctl
                    162: gets the list of debugging variables from the kernel and
                    163: displays their current values.
                    164: The system defines twenty
                    165: .Ns ( Va struct ctldebug )
                    166: variables named
                    167: .Nm debug0
                    168: through
                    169: .Nm debug19 .
                    170: They are declared as separate variables so that they can be
                    171: individually initialized at the location of their associated variable.
                    172: The loader prevents multiple use of the same variable by issuing errors
                    173: if a variable is initialized in more than one place.
                    174: For example, to export the variable
                    175: .Nm dospecialcheck
                    176: as a debugging variable, the following declaration would be used:
                    177: .Bd -literal -offset indent -compact
                    178: int dospecialcheck = 1;
                    179: struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
                    180: .Ed
                    181: .Sh CTL_FS
                    182: There are currently no second level names for the file system.
                    183: .Sh CTL_HW
                    184: The string and integer information available for the CTL_HW level
                    185: is detailed below.
                    186: The changeable column shows whether a process with appropriate
                    187: privilege may change the value.
                    188: .Bl -column "Second level nameXXXXXX" integerXXX -offset indent
                    189: .It Sy Pa Second level name    Type    Changeable
                    190: .It HW\_MACHINE        string  no
                    191: .It HW\_MODEL  string  no
                    192: .It HW\_NCPU   integer no
                    193: .It HW\_BYTEORDER      integer no
                    194: .It HW\_PHYSMEM        integer no
                    195: .It HW\_USERMEM        integer no
                    196: .It HW\_PAGESIZE       integer no
                    197: .\".It HW\_DISKNAMES   integer no
                    198: .\".It HW\_DISKSTATS   integer no
                    199: .El
                    200: .Pp
                    201: .Bl -tag -width "123456"
                    202: .It Li HW_MACHINE
                    203: The machine class.
                    204: .It Li HW_MODEL
                    205: The machine model
                    206: .It Li HW_NCPU
                    207: The number of cpus.
                    208: .It Li HW_BYTEORDER
                    209: The byteorder (4,321, or 1,234).
                    210: .It Li HW_PHYSMEM
                    211: The bytes of physical memory.
                    212: .It Li HW_USERMEM
                    213: The bytes of non-kernel memory.
                    214: .It Li HW_PAGESIZE
                    215: The software page size.
                    216: .\".It Fa HW_DISKNAMES
                    217: .\".It Fa HW_DISKSTATS
                    218: .El
                    219: .Sh CTL_KERN
                    220: The string and integer information available for the CTL_KERN level
                    221: is detailed below.
                    222: The changeable column shows whether a process with appropriate
                    223: privilege may change the value.
                    224: The types of data currently available are process information,
                    225: system vnodes, the open file entries, routing table entries,
                    226: virtual memory statistics, load average history, and clock rate
                    227: information.
                    228: .Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent
                    229: .It Sy Pa Second level name    Type    Changeable
                    230: .It KERN\_ARGMAX       integer no
                    231: .It KERN\_BOOTTIME     struct timeval  no
                    232: .It KERN\_CHOWN\_RESTRICTED    integer no
                    233: .It KERN\_CLOCKRATE    struct clockinfo        no
1.3       cgd       234: .It KERN\_DOMAINNAME   string  yes
1.1       cgd       235: .It KERN\_FILE struct file     no
                    236: .It KERN\_HOSTID       integer yes
                    237: .It KERN\_HOSTNAME     string  yes
                    238: .It KERN\_JOB\_CONTROL integer no
                    239: .It KERN\_LINK\_MAX    integer no
                    240: .It KERN\_MAXFILES     integer yes
1.4       cgd       241: .It KERN\_MAXPARTITIONS        integer no
1.1       cgd       242: .It KERN\_MAXPROC      integer yes
                    243: .It KERN\_MAXVNODES    integer yes
                    244: .It KERN\_MAX\_CANON   integer no
                    245: .It KERN\_MAX\_INPUT   integer no
                    246: .It KERN\_NAME\_MAX    integer no
                    247: .It KERN\_NGROUPS      integer no
                    248: .It KERN\_NO\_TRUNC    integer no
                    249: .It KERN\_OSRELEASE    string  no
                    250: .It KERN\_OSREV        integer no
                    251: .It KERN\_OSTYPE       string  no
                    252: .It KERN\_PATH\_MAX    integer no
                    253: .It KERN\_PIPE\_BUF    integer no
                    254: .It KERN\_POSIX1       integer no
                    255: .It KERN\_PROC struct proc     no
                    256: .It KERN\_PROF node    not applicable
                    257: .It KERN\_SAVED\_IDS   integer no
                    258: .It KERN\_SECURELVL    integer raise only
                    259: .It KERN\_VDISABLE     integer no
                    260: .It KERN\_VERSION      string  no
                    261: .It KERN\_VNODE        struct vnode    no
                    262: .El
                    263: .Pp
                    264: .Bl -tag -width "123456"
                    265: .It Li KERN_ARGMAX
                    266: The maximum bytes of argument to
                    267: .Xr exec 2 .
                    268: .It Li KERN_BOOTTIME
                    269: A
                    270: .Va struct timeval
                    271: structure is returned.
                    272: This structure contains the time that the system was booted.
                    273: .It Li KERN_CHOWN_RESTRICTED
                    274: Return 1 if appropriate privileges are required for the
                    275: .Xr chown 2
                    276: system call, otherwise 0.
                    277: .It Li KERN_CLOCKRATE
                    278: A
                    279: .Va struct clockinfo
                    280: structure is returned.
                    281: This structure contains the clock, statistics clock and profiling clock
1.3       cgd       282: frequencies, the number of micro-seconds per hz tick, and the clock
                    283: skew rate.
                    284: .It Li KERN_DOMAINNAME
                    285: Get or set the YP domain name.
1.1       cgd       286: .It Li KERN_FILE
                    287: Return the entire file table.
                    288: The returned data consists of a single
                    289: .Va struct filehead
                    290: followed by an array of
                    291: .Va struct file ,
                    292: whose size depends on the current number of such objects in the system.
                    293: .It Li KERN_HOSTID
                    294: Get or set the host id.
                    295: .It Li KERN_HOSTNAME
                    296: Get or set the hostname.
                    297: .It Li KERN_JOB_CONTROL
                    298: Return 1 if job control is available on this system, otherwise 0.
                    299: .It Li KERN_LINK_MAX
                    300: The maximum file link count.
                    301: .It Li KERN_MAXFILES
                    302: The maximum number of open files that may be open in the system.
1.4       cgd       303: .It Li KERN_MAXPARTITIONS
                    304: The maximum number of partitions allowed per disk.
1.1       cgd       305: .It Li KERN_MAXPROC
                    306: The maximum number of simultaneous processes the system will allow.
                    307: .It Li KERN_MAXVNODES
                    308: The maximum number of vnodes available on the system.
                    309: .It Li KERN_MAX_CANON
                    310: The maximum number of bytes in terminal canonical input line.
                    311: .It Li KERN_MAX_INPUT
                    312: The minimum maximum number of bytes for which space is available in
                    313: a terminal input queue.
                    314: .It Li KERN_NAME_MAX
                    315: The maximum number of bytes in a file name.
                    316: .It Li KERN_NGROUPS
                    317: The maximum number of supplemental groups.
                    318: .It Li KERN_NO_TRUNC
                    319: Return 1 if file names longer than KERN_NAME_MAX are truncated.
                    320: .It Li KERN_OSRELEASE
                    321: The system release string.
                    322: .It Li KERN_OSREV
                    323: The system revision string.
                    324: .It Li KERN_OSTYPE
                    325: The system type string.
                    326: .It Li KERN_PATH_MAX
                    327: The maximum number of bytes in a pathname.
                    328: .It Li KERN_PIPE_BUF
                    329: The maximum number of bytes which will be written atomically to a pipe.
                    330: .It Li KERN_POSIX1
                    331: The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
                    332: attempts to comply.
                    333: .It Li KERN_PROC
                    334: Return the entire process table, or a subset of it.
                    335: An array of
                    336: .Va struct kinfo_proc
                    337: structures is returned,
                    338: whose size depends on the current number of such objects in the system.
                    339: The third and fourth level names are as follows:
                    340: .Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
                    341: .It Pa Third level name        Fourth level is:
                    342: .It KERN\_PROC\_ALL    None
                    343: .It KERN\_PROC\_PID    A process ID
                    344: .It KERN\_PROC\_PGRP   A process group
                    345: .It KERN\_PROC\_TTY    A tty device
                    346: .It KERN\_PROC\_UID    A user ID
                    347: .It KERN\_PROC\_RUID   A real user ID
                    348: .El
                    349: .It Li KERN_PROF
                    350: Return profiling information about the kernel.
                    351: If the kernel is not compiled for profiling,
                    352: attempts to retrieve any of the KERN_PROF values will
                    353: fail with EOPNOTSUPP.
                    354: The third level names for the string and integer profiling information
                    355: is detailed below.
                    356: The changeable column shows whether a process with appropriate
                    357: privilege may change the value.
                    358: .Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
                    359: .It Sy Pa Third level name     Type    Changeable
                    360: .It GPROF\_STATE       integer yes
                    361: .It GPROF\_COUNT       u_short[\|]     yes
                    362: .It GPROF\_FROMS       u_short[\|]     yes
                    363: .It GPROF\_TOS struct tostruct yes
                    364: .It GPROF\_GMONPARAM   struct gmonparam        no
                    365: .El
                    366: .Pp
                    367: The variables are as follows:
                    368: .Bl -tag -width "123456"
                    369: .It Li GPROF_STATE
                    370: Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
                    371: is running or stopped.
                    372: .It Li GPROF_COUNT
                    373: Array of statistical program counter counts.
                    374: .It Li GPROF_FROMS
                    375: Array indexed by program counter of call-from points.
                    376: .It Li GPROF_TOS
                    377: Array of
                    378: .Va struct tostruct
                    379: describing destination of calls and their counts.
                    380: .It Li GPROF_GMONPARAM
                    381: Structure giving the sizes of the above arrays.
                    382: .El
                    383: .It Li KERN_SAVED_IDS
                    384: Returns 1 if saved set-group and saved set-user ID is available.
                    385: .It Li KERN_SECURELVL
                    386: The system security level.
                    387: This level may be raised by processes with appropriate privilege.
                    388: It may only be lowered by process 1.
                    389: .It Li KERN_VDISABLE
                    390: Returns the terminal character disabling value.
                    391: .It Li KERN_VERSION
                    392: The system version string.
                    393: .It Li KERN_VNODE
                    394: Return the entire vnode table.
                    395: Note, the vnode table is not necessarily a consistent snapshot of
                    396: the system.
                    397: The returned data consists of an array whose size depends on the
                    398: current number of such objects in the system.
                    399: Each element of the array contains the kernel address of a vnode
                    400: .Va struct vnode *
                    401: followed by the vnode itself
                    402: .Va struct vnode .
                    403: .El
                    404: .Sh CTL_MACHDEP
                    405: The set of variables defined is architecture dependent.
                    406: Most architectures define at least the following variables.
                    407: .Bl -column "CONSOLE_DEVICEXXX" "integerXXX" -offset indent
                    408: .It Sy Pa Second level name    Type    Changeable
                    409: .It Li CPU_CONSDEV     dev_t   no
                    410: .El
                    411: .Sh CTL_NET
                    412: The string and integer information available for the CTL_NET level
                    413: is detailed below.
                    414: The changeable column shows whether a process with appropriate
                    415: privilege may change the value.
                    416: .Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
                    417: .It Sy Pa Second level name    Type    Changeable
                    418: .It PF\_ROUTE  routing messages        no
                    419: .It PF\_INET   internet values yes
                    420: .El
                    421: .Pp
                    422: .Bl -tag -width "123456"
                    423: .It Li PF_ROUTE
                    424: Return the entire routing table or a subset of it.
                    425: The data is returned as a sequence of routing messages (see
                    426: .Xr route 4
                    427: for the header file, format and meaning).
                    428: The length of each message is contained in the message header.
                    429: .Pp
                    430: The third level name is a protocol number, which is currently always 0.
                    431: The fourth level name is an address family, which may be set to 0 to
                    432: select all address families.
                    433: The fifth and sixth level names are as follows:
                    434: .Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
                    435: .It Pa Fifth level name        Sixth level is:
                    436: .It NET\_RT\_FLAGS     rtflags
                    437: .It NET\_RT\_DUMP      None
                    438: .It NET\_RT\_IFLIST    None
                    439: .El
                    440: .It Li PF_INET
                    441: Get or set various global information about the internet protocols.
                    442: The third level name is the protocol.
                    443: The fourth level name is the variable name.
                    444: The currently defined protocols and names are:
                    445: .Bl -column "Protocol nameXXXXXX" "Variable nameXXX" "integerXXX" -offset indent
                    446: .It Pa Protocol name   Variable name   Type    Changeable
                    447: .It ip forwarding      integer yes
                    448: .It ip redirect        integer yes
                    449: .It ip ttl     integer yes
                    450: .It icmp       maskrepl        integer yes
                    451: .It udp        checksum        integer yes
                    452: .El
                    453: .Pp
                    454: The variables are as follows:
                    455: .Bl -tag -width "123456"
                    456: .It Li ip.forwarding
                    457: Returns 1 when IP forwarding is enabled for the host,
                    458: meaning that the host is acting as a router.
                    459: .It Li ip.redirect
                    460: Returns 1 when ICMP redirects may be sent by the host.
                    461: This option is ignored unless the host is routing IP packets,
                    462: and should normally be enabled on all systems.
                    463: .It Li ip.ttl
                    464: The maximum time-to-live (hop count) value for an IP packet sourced by
                    465: the system.
                    466: This value applies to normal transport protocols, not to ICMP.
                    467: .It Li icmp.maskrepl
                    468: Returns 1 if ICMP network mask requests are to be answered.
                    469: .It Li udp.checksum
                    470: Returns 1 when UDP checksums are being computed and checked.
                    471: Disabling UDP checksums is strongly discouraged.
                    472: .El
                    473: .Sh CTL_USER
                    474: The string and integer information available for the CTL_USER level
                    475: is detailed below.
                    476: The changeable column shows whether a process with appropriate
                    477: privilege may change the value.
                    478: .Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
                    479: .It Sy Pa Second level name    Type    Changeable
                    480: .It USER\_BC\_BASE\_MAX        integer no
                    481: .It USER\_BC\_DIM\_MAX integer no
                    482: .It USER\_BC\_SCALE\_MAX       integer no
                    483: .It USER\_BC\_STRING\_MAX      integer no
                    484: .It USER\_COLL\_WEIGHTS\_MAX   integer no
                    485: .It USER\_CS\_PATH     string  no
                    486: .It USER\_EXPR\_NEST\_MAX      integer no
                    487: .It USER\_LINE\_MAX    integer no
                    488: .It USER\_POSIX2\_CHAR\_TERM   integer no
                    489: .It USER\_POSIX2\_C\_BIND      integer no
                    490: .It USER\_POSIX2\_C\_DEV       integer no
                    491: .It USER\_POSIX2\_FORT\_DEV    integer no
                    492: .It USER\_POSIX2\_FORT\_RUN    integer no
                    493: .It USER\_POSIX2\_LOCALEDEF    integer no
                    494: .It USER\_POSIX2\_SW\_DEV      integer no
                    495: .It USER\_POSIX2\_UPE  integer no
                    496: .It USER\_POSIX2\_VERSION      integer no
                    497: .It USER\_RE\_DUP\_MAX integer no
                    498: .It USER\_STREAM\_MAX  integer no
                    499: .It USER\_TZNAME\_MAX  integer no
                    500: .El
                    501: .Bl -tag -width "123456"
                    502: .Pp
                    503: .It Li USER_BC_BASE_MAX
                    504: The maximum ibase/obase values in the
                    505: .Xr bc 1
                    506: utility.
                    507: .It Li USER_BC_DIM_MAX
                    508: The maximum array size in the
                    509: .Xr bc 1
                    510: utility.
                    511: .It Li USER_BC_SCALE_MAX
                    512: The maximum scale value in the
                    513: .Xr bc 1
                    514: utility.
                    515: .It Li USER_BC_STRING_MAX
                    516: The maximum string length in the
                    517: .Xr bc 1
                    518: utility.
                    519: .It Li USER_COLL_WEIGHTS_MAX
                    520: The maximum number of weights that can be assigned to any entry of
                    521: the LC_COLLATE order keyword in the locale definition file.
                    522: .It Li USER_CS_PATH
                    523: Return a value for the
                    524: .Ev PATH
                    525: environment variable that finds all the standard utilities.
                    526: .It Li USER_EXPR_NEST_MAX
                    527: The maximum number of expressions that can be nested within
                    528: parenthesis by the
                    529: .Xr expr 1
                    530: utility.
                    531: .It Li USER_LINE_MAX
                    532: The maximum length in bytes of a text-processing utility's input
                    533: line.
                    534: .It Li USER_POSIX2_CHAR_TERM
                    535: Return 1 if the system supports at least one terminal type capable of
                    536: all operations described in POSIX 1003.2, otherwise 0.
                    537: .It Li USER_POSIX2_C_BIND
                    538: Return 1 if the system's C-language development facilities support the
                    539: C-Language Bindings Option, otherwise 0.
                    540: .It Li USER_POSIX2_C_DEV
                    541: Return 1 if the system supports the C-Language Development Utilities Option,
                    542: otherwise 0.
                    543: .It Li USER_POSIX2_FORT_DEV
                    544: Return 1 if the system supports the FORTRAN Development Utilities Option,
                    545: otherwise 0.
                    546: .It Li USER_POSIX2_FORT_RUN
                    547: Return 1 if the system supports the FORTRAN Runtime Utilities Option,
                    548: otherwise 0.
                    549: .It Li USER_POSIX2_LOCALEDEF
                    550: Return 1 if the system supports the creation of locales, otherwise 0.
                    551: .It Li USER_POSIX2_SW_DEV
                    552: Return 1 if the system supports the Software Development Utilities Option,
                    553: otherwise 0.
                    554: .It Li USER_POSIX2_UPE
                    555: Return 1 if the system supports the User Portability Utilities Option,
                    556: otherwise 0.
                    557: .It Li USER_POSIX2_VERSION
                    558: The version of POSIX 1003.2 with which the system attempts to comply.
                    559: .It Li USER_RE_DUP_MAX
                    560: The maximum number of repeated occurrences of a regular expression
                    561: permitted when using interval notation.
                    562: .It Li USER_STREAM_MAX
                    563: The minimum maximum number of streams that a process may have open
                    564: at any one time.
                    565: .It Li USER_TZNAME_MAX
                    566: The minimum maximum number of types supported for the name of a
                    567: timezone.
                    568: .El
                    569: .Sh CTL_VM
                    570: The string and integer information available for the CTL_VM level
                    571: is detailed below.
                    572: The changeable column shows whether a process with appropriate
                    573: privilege may change the value.
                    574: .Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
                    575: .It Sy Pa Second level name    Type    Changeable
                    576: .It VM\_LOADAVG        struct loadavg  no
                    577: .It VM\_METER  struct vmtotal  no
                    578: .El
                    579: .Pp
                    580: .Bl -tag -width "123456"
                    581: .It Li VM_LOADAVG
                    582: Return the load average history.
                    583: The returned data consists of a
                    584: .Va struct loadavg .
                    585: .It Li VM_METER
                    586: Return the system wide virtual memory statistics.
                    587: The returned data consists of a
                    588: .Va struct vmtotal .
                    589: .El
                    590: .Sh RETURN VALUES
                    591: If the call to
                    592: .Nm sysctl
                    593: is successful, 0 is returned.
                    594: Otherwise \-1 is returned and
                    595: .Va errno
                    596: is set appropriately.
                    597: .Sh ERRORS
                    598: The following errors may be reported:
                    599: .Bl -tag -width Er
                    600: .It Bq Er EFAULT
                    601: The buffer
                    602: .Fa name ,
                    603: .Fa oldp ,
                    604: .Fa newp ,
                    605: or length pointer
                    606: .Fa oldlenp
                    607: contains an invalid address.
                    608: .It Bq Er EINVAL
                    609: The
                    610: .Fa name
                    611: array is less than two or greater than CTL_MAXNAME.
                    612: .It Bq Er EINVAL
                    613: A non-null
                    614: .Fa newp
                    615: is given and its specified length in
                    616: .Fa newlen
                    617: is too large or too small.
                    618: .It Bq Er ENOMEM
                    619: The length pointed to by
                    620: .Fa oldlenp
                    621: is too short to hold the requested value.
                    622: .It Bq Er ENOTDIR
                    623: The
                    624: .Fa name
                    625: array specifies an intermediate rather than terminal name.
                    626: .It Bq Er EOPNOTSUPP
                    627: The
                    628: .Fa name
                    629: array specifies a value that is unknown.
                    630: .It Bq Er EPERM
                    631: An attempt is made to set a read-only value.
                    632: .It Bq Er EPERM
                    633: A process without appropriate privilege attempts to set a value.
                    634: .El
                    635: .Sh FILES
                    636: .Bl -tag -width <netinet/icmpXvar.h> -compact
                    637: .It Pa <sys/sysctl.h>
                    638: definitions for top level identifiers, second level kernel and hardware
                    639: identifiers, and user level identifiers
                    640: .It Pa <sys/socket.h>
                    641: definitions for second level network identifiers
                    642: .It Pa <sys/gmon.h>
                    643: definitions for third level profiling identifiers
                    644: .It Pa <vm/vm_param.h>
                    645: definitions for second level virtual memory identifiers
                    646: .It Pa <netinet/in.h>
                    647: definitions for third level Internet identifiers and
                    648: fourth level IP identifiers
                    649: .It Pa <netinet/icmp_var.h>
                    650: definitions for fourth level ICMP identifiers
                    651: .It Pa <netinet/udp_var.h>
                    652: definitions for fourth level UDP identifiers
                    653: .El
                    654: .Sh SEE ALSO
                    655: .Xr sysctl 8
                    656: .Sh HISTORY
                    657: The
                    658: .Nm sysctl
                    659: function first appeared in 4.4BSD.

CVSweb <webmaster@jp.NetBSD.org>