sysctl(3N)
sysctl - get or set system information
Showing IRIX 6.5.30 (default release). Last changed in IRIX 6.5.30.
NAME sysctl - get or set system information SYNOPSIS #include <sys/sysctl.h> #include <sys/socket.h> sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen) DESCRIPTION The sysctl function retrieves system information. The information available from sysctl consists of integers, strings, and tables, and is a small subset of that available from the function of the same name in 4.4BSD-Lite. Unless explicitly noted below, sysctl returns a consistent snapshot of the data requested. Consistency is obtained by locking the destination buffer into memory so that the data may be copied out without blocking. The state is described using a ``Management Information Base'' (MIB) style name, listed in name, which is a namelen length array of integers. The information is copied into the buffer specified by oldp. The size of the buffer is given by the location specified by oldlenp before the call, and that location gives the amount of data copied after a successful call. If the amount of data available is greater than the size of the buffer supplied, the call supplies as much data as fits in the buffer provided and returns with the error code ENOMEM. If the old value is not desired, oldp and oldlenp should be set to NULL. The size of the available data can be determined by calling sysctl with a NULL parameter for oldp. The size of the available data will be returned in the location pointed to by oldlenp. For some operations, the amount of space may change often. For these operations, the system attempts to round up so that the returned size is large enough for a call to return the data shortly thereafter. To set a new value, newp is set to point to a buffer of length newlen from which the requested value is to be taken. If a new value is not to be set, newp should be set to NULL and newlen set to 0. The top level names are defined with a CTL_ prefix in <sys/sysctl.h>, and are as follows. The next and subsequent levels down are found in the include files listed here, and described in separate sections below. Name Next level names Description CTL_NET sys/socket.h Networking CTL_NET The string and integer information available for the CTL_NET level is detailed below. Second level name Type PF_ROUTE routing messages PF_INET internet values PF_ROUTE Return the entire routing table or a subset of it. The data is returned as a sequence of routing messages. See route(7p) for the header file, format and meaning). The length of each message is contained in the message header. The third level name is a protocol number, which is currently always 0. The fourth level name is an address family, which may be set to 0 to select all address families. The fifth and sixth level names are as follows: Fifth level name Sixth level is: Table NET_RT_FLAGS rtflags Routing NET_RT_DUMP None Routing (by flags) NET_RT_IFLIST None Interface list PF_INET Get or set various global information about IP (version 4) and related transport protocols. The third level name is the protocol. The fourth level name is the variable name. The currently defined protocols and names are: Protocol name Variable name Type ip forwarding integer ip redirect integer udp checksum integer The variables are as follows: ip.forwarding Indicates whether IPv4 forwarding is enabled for the host, meaning that the host is acting as an IPv4 router. A value of 1 means that the system will forward IPv4 packets, a value of 0 means it will not. A privileged user may modify this value. ip.redirect Indicates whether ICMP redirects may be sent by the host. A value of 1 means that ICMP redirects may be sent, a value of 0 means they will not. This option is ignored unless the host is routing IPv4 packets, and should normally be enabled on all systems. A privileged user may modify this value. udp.checksum Returns 1 when UDP checksums are being computed and checked. The value is always 1. It cannot be modified. PF_INET6 Get or set various global information about IP (version 6). The third level name is the protocol. The fourth level name is the variable name. The currently defined protocols and names are: Protocol name Variable name Type ipv6 forwarding integer The variables are as follows: ipv6.forwarding Indicates whether IPv6 forwarding is enabled for the host, meaning that the host is acting as an IPv6 router. A value of 1 means that the system will forward IPv6 packets, a value of 0 means it will not. A privileged user may modify this value. SEE ALSO The set of metrics available from sysctl(3N) is very limited in the context of all metrics available from IRIX. For uniform access to the widest possible collection of metrics, the Performance Co-Pilot (PCP) APIs provide an alternative to sysctl(3N) that includes a number additional features (e.g. distributed operation and archive creation and replay). The PCP APIs are fully documented in the Performance Co-Pilot Programmer's Guide (avaliable from http://techpubs.sgi.com) and source code for many example applications using the APIs are included in the open source release of PCP available from http://oss.sgi.com/projects/pcp).