summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason McIntyre <jmc@cvs.openbsd.org>2006-01-19 15:16:50 +0000
committerJason McIntyre <jmc@cvs.openbsd.org>2006-01-19 15:16:50 +0000
commitfebe1e2330002089883ac263528bb33f98eb5505 (patch)
tree0c3dea38f94763a3da37f9cfe8bd646eab4d1cf9
parent1fc48afb47ca0d13066fce2f09272dadbf219414 (diff)
tweaks; ok mickey
-rw-r--r--share/man/man9/sysctl_int.9110
1 files changed, 57 insertions, 53 deletions
diff --git a/share/man/man9/sysctl_int.9 b/share/man/man9/sysctl_int.9
index 2a8fbf19038..34b05ca82f9 100644
--- a/share/man/man9/sysctl_int.9
+++ b/share/man/man9/sysctl_int.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl_int.9,v 1.1 2006/01/18 14:51:43 mickey Exp $
+.\" $OpenBSD: sysctl_int.9,v 1.2 2006/01/19 15:16:49 jmc Exp $
.\"
.\" Copyright (c) 2006 Michael Shalayeff
.\" All rights reserved.
@@ -54,19 +54,21 @@
.Ft int
.Fn sysctl_struct "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" "void *sp" "int len"
.Sh DESCRIPTION
-These functions and data structures are aimed to simplify and partially
-implement oprations for kernel and user implementation of sysctl interface.
-Single
+These functions and data structures aim to simplify and partially
+implement operations for the kernel and user implementations of the
+.Xr sysctl 3
+interface.
+A single
.Xr syscall 9
is used to request and modify kernel variables.
The
-.Nm mib
-argument is recursively scanned as an array of integers either calling
-futher function for parsing the rest of the MIB for nodes or operating
+.Fa mib
+argument is recursively scanned as an array of integers, either calling
+further functions for parsing the rest of the MIB for nodes or operating
on kernel data for leaf nodes.
.Ss Data Structures
-For each level of MIB tree kernel header files provide a
-.Nm cpp 1
+For each level of the MIB tree, the kernel header files provide a
+.Xr cpp 1
macro initialiser for an array of the following data structures:
.Bd -literal -offset indent
struct ctlname {
@@ -77,28 +79,29 @@ struct ctlname {
.Pp
For example:
.Bd -literal -offset indent
-#define CTL_NAMES { \\
- { 0, 0 }, \\
- { "kern", CTLTYPE_NODE }, \\
- { "vm", CTLTYPE_NODE }, \\
- { "fs", CTLTYPE_NODE }, \\
- { "net", CTLTYPE_NODE }, \\
- { "debug", CTLTYPE_NODE }, \\
- { "hw", CTLTYPE_NODE }, \\
- { "machdep", CTLTYPE_NODE }, \\
- { "user", CTLTYPE_NODE }, \\
- { "ddb", CTLTYPE_NODE }, \\
- { "vfs", CTLTYPE_NODE }, \\
+#define CTL_NAMES { \e
+ { 0, 0 }, \e
+ { "kern", CTLTYPE_NODE }, \e
+ { "vm", CTLTYPE_NODE }, \e
+ { "fs", CTLTYPE_NODE }, \e
+ { "net", CTLTYPE_NODE }, \e
+ { "debug", CTLTYPE_NODE }, \e
+ { "hw", CTLTYPE_NODE }, \e
+ { "machdep", CTLTYPE_NODE }, \e
+ { "user", CTLTYPE_NODE }, \e
+ { "ddb", CTLTYPE_NODE }, \e
+ { "vfs", CTLTYPE_NODE }, \e
}
.Ed
.Pp
Each array element initialiser maps the correspondent MIB identifier.
The
-.Nm ctl_name
+.Fa ctl_name
field provides a string name.
The
-.Nm ctl_type
-field describes the identifier type where possible values are:
+.Fa ctl_type
+field describes the identifier type, where possible values are:
+.Pp
.Bl -tag -width CTLTYPE_STRING_ -compact -offset indent
.It CTLTYPE_NODE
The name is a node;
@@ -111,51 +114,52 @@ The name describes a 64-bit number;
.It CTLTYPE_STRUCT
The name describes a structure.
.El
+.Pp
For each of the types there are two functions provided to perform both
-read and write or only a read operations on the identifier (see the
+read and write or only a read operation on the identifier (see the
following subsection).
.Pp
These data structures are used by the
.Xr sysctl 8
program to provide mapping into MIB identifiers.
.Ss Functions
-All of the functions perform a write shall
+All of the functions perform a write provided that
.Ar newp
-argument be not
-.Nm NULL
+is not a
+.Dv NULL
pointer and
.Ar newlen
-be specifies appropriate data length.
+specifies an appropriate data length.
All read-only versions of the functions return
-.Nm EPERM
-shall a write operation be requested.
+.Dv EPERM
+if a write operation is requested.
.Pp
-The following helper functions are provided to aid operating on the
+The following helper functions are provided to aid operation on the
kernel data variables referenced by the leaf nodes in the MIBs:
.Bl -tag -width sysctl_
.It Fn sysctl_int "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" "int *valp"
-The variable referenced by the
+The variable referenced by
.Ar valp
is a 32-bit integer.
-Read or write returning previous value in the user memory location
-pointed by the
+Read or write returning the previous value in the user memory location
+pointed to by the
.Ar oldp
argument.
-The value pointed to by the
+The value pointed to by
.Ar oldlenp
-has to be no less then four.
+has to be no less than four.
.It Fn sysctl_rdint "void *oldp" "size_t *oldlenp" "void *newp" "int val"
A read-only version of the above.
.\" .It sysctl_int_arr
.It Fn sysctl_quad "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" "int64_t *valp"
The variable referenced is a 64-bit integer.
-Read or write returning previous value in the user memory location
-pointed by the
+Read or write returning the previous value in the user memory location
+pointed to by the
.Ar oldp
argument.
-The value pointed to by the
+The value pointed to by
.Ar oldlenp
-has to be no less then eight.
+has to be no less than eight.
.It Fn sysctl_rdquad "void *oldp" "size_t *oldlenp" "void *newp" "int64_t val"
A read-only version of the above.
.It Fn sysctl_string "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" "char *str" "int maxlen"
@@ -163,32 +167,32 @@ The variable referenced by the
.Ar str
argument is a string of maximum length of
.Ar maxlen .
-Copy out old value into user buffer pointed to by the
+The old value is copied out into a user buffer pointed to by the
.Ar oldp
argument.
-If there is not enough space to store that a
-.Nm ENOMEM
+If there is not enough space to store it, an
+.Dv ENOMEM
is returned.
If
.Ar newlen
-larger than
-.Ar maxlen
-a
-.Nm EINVAL
+is larger than
+.Ar maxlen ,
+an
+.Dv EINVAL
error is returned.
.It Fn sysctl_tstring "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" "char *str" "int maxlen"
A version of the above that truncates the old value that does not fit
-into the buffer provided byt
+into the buffer provided by
.Ar oldp
instead of returning
-.Nm ENOMEM .
+.Dv ENOMEM .
.It Fn sysctl_rdstring "void *oldp" "size_t *oldlenp" "void *newp" "const char *str"
-A read-only version of the
-.Nm sysctl_string .
+A read-only version of
+.Fn sysctl_string .
.It Fn sysctl_struct "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" "void *sp" "int len"
Aassume the area pointed to by the
.Ar sp
-argument be an opaque array of byte of size
+argument is an opaque array of bytes of size
.Ar len .
Old and new length checks are performed and data is copied in and/or out.
.It Fn sysctl_rdstruct "void *oldp" "size_t *oldlenp" "void *newp" "const void *sp" "int len"