1
0
Files
irix-657m-src/eoe/man/man3c/sysctl.3n
2022-09-29 17:59:04 +03:00

178 lines
5.8 KiB
Plaintext

'\"macro stdmacro
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)sysctl.3 8.1 (Berkeley) 6/4/93
.\"
.TH sysctl
.Uc
.SH NAME
sysctl \- get or set system information
.SH SYNOPSIS
.nf
.B #include <sys/sysctl.h>
.B #include <sys/socket.h>
.PP
.B "sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,"
.B " void *newp, size_t newlen)
.SH DESCRIPTION
The
.I sysctl
function retrieves system information.
The information available from
.I sysctl
consists of integers, strings, and tables,
and is a small subset of that available from the function of the
same name in
.IR 4.4BSD\-Lite .
.PP
Unless explicitly noted below,
.I 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.
.PP
The state is described using a ``Management Information Base'' (MIB)
style name, listed in
.IR name ,
which is a
.I namelen
length array of integers.
.PP
The information is copied into the buffer specified by
.IR oldp .
The size of the buffer is given by the location specified by
.I 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,
.I oldp
and
.I oldlenp
should be set to NULL.
.PP
The size of the available data can be determined by calling
.I sysctl
with a NULL parameter for
.IR oldp .
The size of the available data will be returned in the location pointed to by
.IR 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.
.PP
To set a new value,
.I newp
is set to point to a buffer of length
.I newlen
from which the requested value is to be taken.
If a new value is not to be set,
.I newp
should be set to NULL and
.I newlen
set to 0.
.PP
The top level names are defined with a CTL_ prefix in
.IR <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.
.IP
.nf
.DT
.I Name Next level names Description
CTL\_NET sys/socket.h Networking
.fi
.PP
.SS CTL_NET
The string and integer information available for the CTL_NET level
is detailed below.
The changeable column shows whether a process with appropriate
privilege may change the value.
.IP
.nf
.DT
.I Second level name Type
PF\_ROUTE routing messages
PF\_INET internet values
.fi
.PP
.IP \f2PF_ROUTE\f1 5
Return the entire routing table or a subset of it.
The data is returned as a sequence of routing messages.
See
.IR 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:
.IP
.nf
.DT
.I 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
.fi
.IP \f2PF_INET\f1
Get or set various global information about the internet protocols.
The third level name is the protocol.
The fourth level name is the variable name.
The currently defined protocols and names are:
.IP
.nf
.DT
.I Protocol name Variable name Type
ip forwarding integer
ip redirect integer
udp checksum integer
.fi
.PP
The variables are as follows:
.IP ip.forwarding
Returns 1 when IP forwarding is enabled for the host,
meaning that the host is acting as a router.
.IP ip.redirect
Returns 1 when ICMP redirects may be sent by the host.
This option is ignored unless the host is routing IP packets,
and should normally be enabled on all systems.
.IP udp.checksum
Returns 1 when UDP checksums are being computed and checked.
Disabling UDP checksums is strongly discouraged.