summaryrefslogtreecommitdiffstats
path: root/share/man/man9
diff options
context:
space:
mode:
Diffstat (limited to 'share/man/man9')
-rw-r--r--share/man/man9/Makefile6
-rw-r--r--share/man/man9/SYSCALL_MODULE.915
-rw-r--r--share/man/man9/counter.948
-rw-r--r--share/man/man9/fail.991
-rw-r--r--share/man/man9/kqueue.92
-rw-r--r--share/man/man9/netisr.92
-rw-r--r--share/man/man9/osd.964
-rw-r--r--share/man/man9/rwlock.919
-rw-r--r--share/man/man9/sx.922
9 files changed, 221 insertions, 48 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index fa768f5..702fafa 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -641,7 +641,11 @@ MLINKS+=counter.9 counter_u64_alloc.9 \
counter.9 counter_exit.9 \
counter.9 counter_u64_add_protected.9 \
counter.9 counter_u64_fetch.9 \
- counter.9 counter_u64_zero.9
+ counter.9 counter_u64_zero.9 \
+ counter.9 SYSCTL_COUNTER_U64.9 \
+ counter.9 SYSCTL_ADD_COUNTER_U64.9 \
+ counter.9 SYSCTL_COUNTER_U64_ARRAY.9 \
+ counter.9 SYSCTL_ADD_COUNTER_U64_ARRAY.9
MLINKS+=cpuset.9 CPUSET_T_INITIALIZER.9 \
cpuset.9 CPUSET_FSET.9 \
cpuset.9 CPU_CLR.9 \
diff --git a/share/man/man9/SYSCALL_MODULE.9 b/share/man/man9/SYSCALL_MODULE.9
index eb90aeb..8fc92aa 100644
--- a/share/man/man9/SYSCALL_MODULE.9
+++ b/share/man/man9/SYSCALL_MODULE.9
@@ -57,6 +57,10 @@ A pointer to an
which saves the offset in
.Vt "struct sysent"
where the syscall is allocated.
+If the location pointed to by
+.Fa offset
+holds a non 0 number it will be used if possible.
+If it holds 0 then one will be assigned.
.It Fa new_sysent
is a pointer to a structure that specifies the function implementing
the syscall and the number of arguments this function needs (see
@@ -72,6 +76,17 @@ The argument passed to the callback functions of the
.Fa evh
event handler when it is called.
.El
+.Pp
+The syscall number assigned to the module can be retrieved using the
+.Xr modstat 3
+and
+.Xr modfind 3
+library functions in libc.
+The MACRO
+.Fn SYSCALL_MODULE_HELPER
+includes
+.Fn SYSCALL_MODULE
+and much of its boilerplate code.
.Sh EXAMPLES
A minimal example for a syscall module can be found in
.Pa /usr/share/examples/kld/syscall/module/syscall.c .
diff --git a/share/man/man9/counter.9 b/share/man/man9/counter.9
index f703ccf..0fcf2ad 100644
--- a/share/man/man9/counter.9
+++ b/share/man/man9/counter.9
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 7, 2014
+.Dd March 14, 2016
.Dt COUNTER 9
.Os
.Sh NAME
@@ -54,6 +54,8 @@
.In sys/sysctl.h
.Fn SYSCTL_COUNTER_U64 parent nbr name access ptr descr
.Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr
+.Fn SYSCTL_COUNTER_U64_ARRAY parent nbr name access ptr len descr
+.Fn SYSCTL_ADD_COUNTER_U64_ARRAY ctx parent nbr name access ptr len descr
.Sh DESCRIPTION
.Nm
is a generic facility to create counters
@@ -150,6 +152,40 @@ argument should be a pointer to allocated
A read of the oid returns value obtained through
.Fn counter_u64_fetch .
Any write to the oid zeroes it.
+.It Fn SYSCTL_COUNTER_U64_ARRAY parent nbr name access ptr len descr
+Declare a static
+.Xr sysctl
+oid that would represent an array of
+.Nm .
+The
+.Fa ptr
+argument should be a pointer to allocated array of
+.Vt counter_u64_t's .
+The
+.Fa len
+argument should specify number of elements in the array.
+A read of the oid returns len-sized array of
+.Vt uint64_t
+values obtained through
+.Fn counter_u64_fetch .
+Any write to the oid zeroes all array elements.
+.It Fn SYSCTL_ADD_COUNTER_U64_ARRAY ctx parent nbr name access ptr len descr
+Create a
+.Xr sysctl
+oid that would represent an array of
+.Nm .
+The
+.Fa ptr
+argument should be a pointer to allocated array of
+.Vt counter_u64_t's .
+The
+.Fa len
+argument should specify number of elements in the array.
+A read of the oid returns len-sized array of
+.Vt uint64_t
+values obtained through
+.Fn counter_u64_fetch .
+Any write to the oid zeroes all array elements.
.El
.Sh IMPLEMENTATION DETAILS
On all architectures
@@ -179,6 +215,16 @@ amd64 single-instruction implementation.
On some architectures updating a counter require a
.Xr critical 9
section.
+.Sh EXAMPLES
+The following example creates a static counter array exported to
+userspace through a sysctl:
+.Bd -literal -offset indent
+#define MY_SIZE 8
+static counter_u64_t array[MY_SIZE];
+SYSCTL_COUNTER_U64_ARRAY(_debug, OID_AUTO, counter_array, CTLFLAG_RW,
+ &array[0], MY_SIZE, "Test counter array");
+.Ed
+.Pp
.Sh SEE ALSO
.Xr atomic 9 ,
.Xr critical 9 ,
diff --git a/share/man/man9/fail.9 b/share/man/man9/fail.9
index 8dbba1b..cf62365 100644
--- a/share/man/man9/fail.9
+++ b/share/man/man9/fail.9
@@ -26,25 +26,31 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 10, 2009
+.Dd March 15, 2016
.Dt FAIL 9
.Os
.Sh NAME
.Nm KFAIL_POINT_CODE ,
+.Nm KFAIL_POINT_CODE_FLAGS ,
+.Nm KFAIL_POINT_CODE_COND ,
.Nm KFAIL_POINT_RETURN ,
.Nm KFAIL_POINT_RETURN_VOID ,
.Nm KFAIL_POINT_ERROR ,
.Nm KFAIL_POINT_GOTO ,
+.Nm KFAIL_POINT_SLEEP_CALLBACKS ,
.Nm fail_point ,
.Nm DEBUG_FP
.Nd fail points
.Sh SYNOPSIS
.In sys/fail.h
.Fn KFAIL_POINT_CODE "parent" "name" "code"
+.Fn KFAIL_POINT_CODE_FLAGS "parent" "name" "flags" "code"
+.Fn KFAIL_POINT_CODE_COND "parent" "name" "cond" "flags" "code"
.Fn KFAIL_POINT_RETURN "parent" "name"
.Fn KFAIL_POINT_RETURN_VOID "parent" "name"
.Fn KFAIL_POINT_ERROR "parent" "name" "error_var"
.Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
+.Fn KFAIL_POINT_SLEEP_CALLBACKS "parent" "name" "pre_func" "pre_arg" "post_func" "post_arg" "code"
.Sh DESCRIPTION
Fail points are used to add code points where errors may be injected
in a user controlled fashion.
@@ -77,6 +83,42 @@ argument, the evaluation of
is derived from the
.Fn return
value set in the sysctl MIB.
+.Pp
+Additionally,
+.Fn KFAIL_POINT_CODE_FLAGS
+provides a
+.Fa flags
+argument which controls the fail point's behaviour.
+This can be used to e.g., mark the fail point's context as non-sleepable,
+which causes the
+.Sy sleep
+action to be coerced to a busy wait.
+The supported flags are:
+.Bl -ohang -offset indent
+.It FAIL_POINT_USE_TIMEOUT_PATH
+Rather than sleeping on a
+.Fn sleep
+call, just fire the post-sleep function after a timeout fires.
+.It FAIL_POINT_NONSLEEPABLE
+Mark the fail point as being in a non-sleepable context, which coerces
+.Fn sleep
+calls to
+.Fn delay
+calls.
+.El
+.Pp
+Likewise,
+.Fn KFAIL_POINT_CODE_COND
+supplies a
+.Fa cond
+argument, which allows you to set the condition under which the fail point's
+code may fire.
+This is equivalent to:
+.Bd -literal
+ if (cond)
+ KFAIL_POINT_CODE_FLAGS(...);
+
+.Ed
See
.Sx SYSCTL VARIABLES
below.
@@ -107,26 +149,12 @@ Many base kernel MIBs can be found in the
tree (referenced in code by
.Sy DEBUG_FP ) .
.Pp
-The sysctl variable may be set using the following grammar:
+The sysctl variable may be set in a number of ways:
.Bd -literal
- <fail_point> ::
- <term> ( "->" <term> )*
-
- <term> ::
- ( (<float> "%") | (<integer> "*" ) )*
- <type>
- [ "(" <integer> ")" ]
- [ "[pid " <integer> "]" ]
-
- <float> ::
- <integer> [ "." <integer> ] |
- "." <integer>
-
- <type> ::
- "off" | "return" | "sleep" | "panic" | "break" | "print"
+ [<pct>%][<cnt>*]<type>[(args...)][-><more terms>]
.Ed
.Pp
-The <type> argument specifies which action to take:
+The <type> argument specifies which action to take; it can be one of:
.Bl -tag -width ".Dv return"
.It Sy off
Take no action (does not trigger fail point code)
@@ -140,13 +168,23 @@ Panic
Break into the debugger, or trap if there is no debugger support
.It Sy print
Print that the fail point executed
+.It Sy pause
+Threads sleep at the fail point until the fail point is set to
+.Sy off
+.It Sy yield
+Thread yields the cpu when the fail point is evaluated
+.It Sy delay
+Similar to sleep, but busy waits the cpu.
+(Useful in non-sleepable contexts.)
.El
.Pp
-The <float>% and <integer>* modifiers prior to <type> control when
+The <pct>% and <cnt>* modifiers prior to <type> control when
<type> is executed.
-The <float>% form (e.g. "1.2%") can be used to specify a
+The <pct>% form (e.g. "1.2%") can be used to specify a
probability that <type> will execute.
-The <integer>* form (e.g. "5*") can be used to specify the number of
+This is a decimal in the range (0, 100] which can specify up to
+1/10,000% precision.
+The <cnt>* form (e.g. "5*") can be used to specify the number of
times <type> should be executed before this <term> is disabled.
Only the last probability and the last count are used if multiple
are specified, i.e. "1.2%2%" is the same as "2%".
@@ -191,6 +229,10 @@ Return 5 once, when pid 1234 executes the fail point.
.Sh AUTHORS
.An -nosplit
This manual page was written by
+.Pp
+.An Matthew Bryan Aq Mt matthew.bryan@isilon.com
+and
+.Pp
.An Zach Loafman Aq Mt zml@FreeBSD.org .
.Sh CAVEATS
It is easy to shoot yourself in the foot by setting fail points too
@@ -206,3 +248,10 @@ Currently,
.Fn fail_point_eval
does not verify whether the context is appropriate for calling
.Fn msleep .
+You can force it to evaluate a
+.Sy sleep
+action as a
+.Sy delay
+action by specifying the
+.Sy FAIL_POINT_NONSLEEPABLE
+flag at the point the fail point is declared.
diff --git a/share/man/man9/kqueue.9 b/share/man/man9/kqueue.9
index a8137bd..ff379d1 100644
--- a/share/man/man9/kqueue.9
+++ b/share/man/man9/kqueue.9
@@ -372,7 +372,7 @@ The function
will not be called, and the
.Vt knote
will not be returned on the next scan.
-Using this function could leak user land resources if a process uses the
+Using this function could leak userland resources if a process uses the
.Vt knote
to track resources.
.Pp
diff --git a/share/man/man9/netisr.9 b/share/man/man9/netisr.9
index 6d79c57..63112be 100644
--- a/share/man/man9/netisr.9
+++ b/share/man/man9/netisr.9
@@ -120,7 +120,7 @@ whose fields are defined as follows:
.Bl -tag -width "netisr_handler_t nh_handler"
.It Vt "const char *" Va nh_name
Unique character string name of the protocol, which may be included in
-.Xr sysctl 2
+.Xr sysctl 3
MIB names, so should not contain whitespace.
.It Vt netisr_handler_t Va nh_handler
Protocol handler function that will be invoked on each packet received for
diff --git a/share/man/man9/osd.9 b/share/man/man9/osd.9
index e8260fe..c27b5d9 100644
--- a/share/man/man9/osd.9
+++ b/share/man/man9/osd.9
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 5, 2011
+.Dd March 30, 2016
.Dt OSD 9
.Os
.Sh NAME
@@ -33,6 +33,9 @@
.Nm osd_register ,
.Nm osd_deregister ,
.Nm osd_set ,
+.Nm osd_reserve ,
+.Nm osd_set_reserved ,
+.Nm osd_free_reserved ,
.Nm osd_get ,
.Nm osd_del ,
.Nm osd_call ,
@@ -63,6 +66,22 @@
.Fa "void *value"
.Fc
.Ft void *
+.Fo osd_reserve
+.Fa "u_int slot"
+.Fc
+.Ft int
+.Fo osd_set_reserved
+.Fa "u_int type"
+.Fa "struct osd *osd"
+.Fa "u_int slot"
+.Fa "void *rsv"
+.Fa "void *value"
+.Fc
+.Ft void
+.Fo osd_free_reserved
+.Fa "void *rsv"
+.Fc
+.Ft void *
.Fo osd_get
.Fa "u_int type"
.Fa "struct osd *osd"
@@ -198,6 +217,15 @@ argument points to a data object to associate with
.Fa osd .
.Pp
The
+.Fn osd_set_reserved
+function does the same as
+.Fn osd_set ,
+but with an extra argument
+.Fa rsv
+that is internal-use memory previously allocated via
+.Fn osd_reserve .
+.Pp
+The
.Fn osd_get
function returns the data pointer associated with a kernel data structure's
.Vt struct osd
@@ -324,6 +352,24 @@ will proceed without any
.Xr realloc 9
calls.
.Pp
+It is possible for
+.Fn osd_set
+to fail to allocate this array. To ensure that such allocation succeeds,
+.Fn osd_reserve
+may be called (in a non-blocking context), and it will pre-allocate the
+memory via
+.Xr malloc 9
+with M_WAITOK.
+Then this pre-allocated memory is passed to
+.Fn osd_set_reserved ,
+which will use it if necessary or otherwise discard it.
+The memory may also be explicitly discarded by calling
+.Fn osd_free_reserved .
+As this method always allocates memory whether or not it is ultimately needed,
+it should be used only rarely, such as in the unlikely event that
+.Fn osd_set
+fails.
+.Pp
The
.Nm
API is geared towards slot identifiers storing pointers to the same underlying
@@ -359,15 +405,27 @@ the kernel including most fast paths.
returns the slot identifier for the newly registered data type.
.Pp
.Fn osd_set
-returns zero on success or ENOMEM if the specified type/slot identifier pair
+and
+.Fn osd_set_reserved
+return zero on success or ENOMEM if the specified type/slot identifier pair
triggered an internal
.Xr realloc 9
-which failed.
+which failed
+.Fn ( osd_set_reserved
+will always succeed when
+.Fa rsv
+is non-NULL).
.Pp
.Fn osd_get
returns the data pointer for the specified type/slot identifier pair, or NULL if
the slot has not been initialised yet.
.Pp
+.Fn osd_reserve
+returns a pointer suitable for passing to
+.Fn osd_set_reserved
+or
+.Fn osd_free_reserved .
+.Pp
.Fn osd_call
returns zero if no method is run or the method for each slot runs successfully.
If a method for a slot returns non-zero,
diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9
index 7598826..9ee16fc 100644
--- a/share/man/man9/rwlock.9
+++ b/share/man/man9/rwlock.9
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 13, 2014
+.Dd March 28, 2016
.Dt RWLOCK 9
.Os
.Sh NAME
@@ -313,18 +313,19 @@ facility was written by
This manual page was written by
.An "Gleb Smirnoff" .
.Sh BUGS
-If
+A kernel without
.Dv WITNESS
-is not included in the kernel,
-then it is impossible to assert that the current thread does or does not
-hold a read lock.
-In the
-.Pf non- Dv WITNESS
-case, the
+cannot assert whether the current thread does or does not hold a read lock.
.Dv RA_LOCKED
and
.Dv RA_RLOCKED
-assertions merely check that some thread holds a read lock.
+can only assert that
+.Em any
+thread holds a read lock.
+They cannot ensure that the current thread holds a read lock.
+Further,
+.Dv RA_UNLOCKED
+can only assert that the current thread does not hold a write lock.
.Pp
Reader/writer is a bit of an awkward name.
An
diff --git a/share/man/man9/sx.9 b/share/man/man9/sx.9
index a9931a9..f09584a 100644
--- a/share/man/man9/sx.9
+++ b/share/man/man9/sx.9
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 13, 2016
+.Dd March 28, 2016
.Dt SX 9
.Os
.Sh NAME
@@ -320,16 +320,16 @@ end up sleeping while holding a mutex, which is not allowed.
.Xr rwlock 9 ,
.Xr sema 9
.Sh BUGS
-Currently there is no way to assert that a lock is not held.
-This is not possible in the
-.No non- Ns Dv WITNESS
-case for asserting that this thread
-does not hold a shared lock.
-In the
-.No non- Ns Dv WITNESS
-case, the
+A kernel without
+.Dv WITNESS
+cannot assert whether the current thread does or does not hold a shared lock.
.Dv SA_LOCKED
and
.Dv SA_SLOCKED
-assertions merely check that some thread holds a shared lock.
-They do not ensure that the current thread holds a shared lock.
+can only assert that
+.Em any
+thread holds a shared lock.
+They cannot ensure that the current thread holds a shared lock.
+Further,
+.Dv SA_UNLOCKED
+can only assert that the current thread does not hold an exclusive lock.
OpenPOWER on IntegriCloud