version 1.24, 1998/04/13 21:24:49 |
version 1.25, 1998/04/28 20:11:35 |
|
|
.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" |
.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
The |
The |
.Nm sysctl |
.Nm |
function retrieves system information and allows processes with |
function retrieves system information and allows processes with |
appropriate privileges to set system information. |
appropriate privileges to set system information. |
The information available from |
The information available from |
.Nm sysctl |
.Nm |
consists of integers, strings, and tables. |
consists of integers, strings, and tables. |
Information may be retrieved and set from the command interface |
Information may be retrieved and set from the command interface |
using the |
using the |
.Xr sysctl 8 |
.Xr sysctl 8 |
utility. |
utility. |
.Pp |
.Pp |
Unless explicitly noted below, |
Unless explicitly noted below, |
.Nm sysctl |
.Nm |
returns a consistent snapshot of the data requested. |
returns a consistent snapshot of the data requested. |
Consistency is obtained by locking the destination |
Consistency is obtained by locking the destination |
buffer into memory so that the data may be copied out without blocking. |
buffer into memory so that the data may be copied out without blocking. |
Calls to |
Calls to |
.Nm sysctl |
.Nm |
are serialized to avoid deadlock. |
are serialized to avoid deadlock. |
.Pp |
.Pp |
The state is described using a ``Management Information Base'' (MIB) |
The state is described using a ``Management Information Base'' (MIB) |
|
|
.Fa oldlenp |
.Fa oldlenp |
should be set to NULL. |
should be set to NULL. |
.Pp |
.Pp |
The size of the available data can be determined by calling |
The size of the available data can be determined by calling |
.Nm sysctl |
.Nm |
with a NULL parameter for |
with a NULL parameter for |
.Fa oldp . |
.Fa oldp . |
The size of the available data will be returned in the location pointed to by |
The size of the available data will be returned in the location pointed to by |
Line 158 sysctl(mib, 2, p, &len, NULL, 0); |
|
Line 158 sysctl(mib, 2, p, &len, NULL, 0); |
|
.Sh CTL_DEBUG |
.Sh CTL_DEBUG |
The debugging variables vary from system to system. |
The debugging variables vary from system to system. |
A debugging variable may be added or deleted without need to recompile |
A debugging variable may be added or deleted without need to recompile |
.Nm sysctl |
.Nm |
to know about it. |
to know about it. |
Each time it runs, |
Each time it runs, |
.Nm sysctl |
.Nm |
gets the list of debugging variables from the kernel and |
gets the list of debugging variables from the kernel and |
displays their current values. |
displays their current values. |
The system defines twenty |
The system defines twenty |
.Ns ( Va struct ctldebug ) |
.Ns ( Va struct ctldebug ) |
variables named |
variables named |
.Nm debug0 |
.Dv debug0 |
through |
through |
.Nm debug19 . |
.Dv debug19 . |
They are declared as separate variables so that they can be |
They are declared as separate variables so that they can be |
individually initialized at the location of their associated variable. |
individually initialized at the location of their associated variable. |
The loader prevents multiple use of the same variable by issuing errors |
The loader prevents multiple use of the same variable by issuing errors |
if a variable is initialized in more than one place. |
if a variable is initialized in more than one place. |
For example, to export the variable |
For example, to export the variable |
.Nm dospecialcheck |
.Dv dospecialcheck |
as a debugging variable, the following declaration would be used: |
as a debugging variable, the following declaration would be used: |
.Bd -literal -offset indent -compact |
.Bd -literal -offset indent -compact |
int dospecialcheck = 1; |
int dospecialcheck = 1; |
|
|
.Bl -tag -width "123456" |
.Bl -tag -width "123456" |
.It Li KERN_ARGMAX |
.It Li KERN_ARGMAX |
The maximum bytes of argument to |
The maximum bytes of argument to |
.Xr exec 2 . |
.Xr execve 2 . |
.It Li KERN_AUTONICETIME |
.It Li KERN_AUTONICETIME |
The number of seconds of cpu-time a non-root process may accumulate before |
The number of seconds of cpu-time a non-root process may accumulate before |
having its priority lowered from the default to the value of KERN_AUTONICEVAL. |
having its priority lowered from the default to the value of KERN_AUTONICEVAL. |
Line 387 Return profiling information about the k |
|
Line 387 Return profiling information about the k |
|
If the kernel is not compiled for profiling, |
If the kernel is not compiled for profiling, |
attempts to retrieve any of the KERN_PROF values will |
attempts to retrieve any of the KERN_PROF values will |
fail with EOPNOTSUPP. |
fail with EOPNOTSUPP. |
The third level names for the string and integer profiling information |
The third level names for the string and integer profiling information |
is detailed below. |
is detailed below. |
The changeable column shows whether a process with appropriate |
The changeable column shows whether a process with appropriate |
privilege may change the value. |
privilege may change the value. |
|
|
for more details. |
for more details. |
.Sh RETURN VALUES |
.Sh RETURN VALUES |
If the call to |
If the call to |
.Nm sysctl |
.Nm |
is successful, the number of bytes copied out is returned. |
is successful, the number of bytes copied out is returned. |
Otherwise \-1 is returned and |
Otherwise \-1 is returned and |
.Va errno |
.Va errno |
Line 790 definitions for fourth level UDP identif |
|
Line 790 definitions for fourth level UDP identif |
|
.Xr sysctl 8 |
.Xr sysctl 8 |
.Sh HISTORY |
.Sh HISTORY |
The |
The |
.Nm sysctl |
.Nm |
function first appeared in |
function first appeared in |
.Bx 4.4 . |
.Bx 4.4 . |