.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd August 16, 2010
-.Os
.Dt MPIPE 9
+.Os
.Sh NAME
.Nm mpipe_init ,
.Nm mpipe_done ,
.Sh SYNOPSIS
.In sys/mpipe.h
.Ft void
-.Fn mpipe_init "malloc_pipe_t mpipe" "malloc_type_t type" "int bytes" "int nnom" "int nmax" "int mpflags" "void (*destructor)(struct malloc_pipe *, void*)"
+.Fn mpipe_init "malloc_pipe_t mpipe" "malloc_type_t type" "int bytes" \
+"int nnom" "int nmax" "int mpflags" \
+"void (*destructor)(struct malloc_pipe *, void *)"
.Ft void
.Fn mpipe_done "malloc_pipe_t mpipe"
.Ft void *
.Fn mpipe_free "malloc_pipe_t mpipe" "void *buf"
.Sh DESCRIPTION
.Pp
-A malloc pipeline is a linear pool of buffers of a single type. A malloc
+A malloc pipeline is a linear pool of buffers of a single type.
+A malloc
pipeline guarantees a number of outstanding allocations and provides both
blocking and non-blocking behavior above the guaranteed allocation amounts.
A malloc pipeline can have an upper limit, beyond which allocations sleep
-or fail respectively. Malloc pipelines are intended for situations where
+or fail respectively.
+Malloc pipelines are intended for situations where
a minimum number of buffers are required to make progress.
.Pp
The
.Fa mpipe .
The pipeline allocates buffers of size
.Fa bytes
-from the
-malloc zone
+from the malloc zone
.Fa type .
The pipeline is prefilled with
.Fa nnom
buffers and has a limit of
.Fa nmax
-buffers. The
+buffers.
+The
.Fa destructor
-argument is a callback, invoked when the malloc pipeline is destroyed. The
+argument is a callback, invoked when the malloc pipeline is destroyed.
+The
.Fa flags
argument controls allocation parameters:
.Bl -tag -width ".Dv MPF_NOZERO" -offset indent
.Pp
The
.Fn mpipe_done
-function destroys a malloc pipeline. The pipeline's destructor is invoked on
-each buffer and then they are returned to the system. It is an error to invoke
-this function on a pipeline with outstanding allocations. This function may
-block.
+function destroys a malloc pipeline.
+The pipeline's destructor is invoked on
+each buffer and then they are returned to the system.
+It is an error to invoke
+this function on a pipeline with outstanding allocations.
+This function may block.
.Pp
The
.Fn mpipe_alloc_nowait
-function allocates a buffer from the malloc pipeline. It will first allocate
-from the pipeline itself; if that is exhausted, it will fall back on kmalloc,
-up to the pipeline maximum. This function may not block.
+function allocates a buffer from the malloc pipeline.
+It will first allocate from the pipeline itself; if that is exhausted,
+it will fall back on
+.Xr kmalloc 9 ,
+up to the pipeline maximum.
+This function may not block.
.Pp
The
.Fn mpipe_alloc_waitok
-function allocates a buffer from the malloc pipeline. It will first allocate
-from the pipeline; if that is exhausted, it will fall back on kmalloc, up to
-the pipeline maximum. It will sleep if it reaches the maximum, potentially
-releasing any tokens.
+function allocates a buffer from the malloc pipeline.
+It will first allocate from the pipeline; if that is exhausted,
+it will fall back on
+.Xr kmalloc 9 ,
+up to the pipeline maximum.
+It will sleep if it reaches the maximum, potentially releasing any tokens.
.Pp
The
.Fn mpipe_free
-function frees a buffer to the malloc pipeline. If the pipeline is full, it
-will free directly to the kernel allocator, calling the destructor as it does.
+function frees a buffer to the malloc pipeline.
+If the pipeline is full, it will free directly to the kernel allocator,
+calling the destructor as it does.
This function may block.
.Pp
-The mpipe functions do not synchronize access to a pipeline. It is
-up to higher-level code to use appropriate locks to ensure that multiple
-CPUs are not simultaneously accessing a pipeline. The pipeline functions do
+The mpipe functions do not synchronize access to a pipeline.
+It is up to higher-level code to use appropriate locks to ensure that
+multiple CPUs are not simultaneously accessing a pipeline.
+The pipeline functions do
guard against preemption by entering critical sections.
.Sh FILES
The MPIPE implementation is in
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd August 19, 2010
-.Os
.Dt SYSTIMER 9
+.Os
.Sh NAME
.Nm systimer_init_periodic ,
.Nm systimer_init_periodic_nq ,
.Fn systimer_init_oneshot "systimer_t info" "void *func" "void *data" "int us"
.Sh DESCRIPTION
.Pp
-Systimers invoke callbacks at either fixed frequencies or after time delays. The
-callbacks are invoked in an interrupt thread and should only be used for limited
-work.
+Systimers invoke callbacks at either fixed frequencies or after time delays.
+The callbacks are invoked in an interrupt thread and should only be used
+for limited work.
.Pp
-The
+The
.Fn systimer_init_periodic
function initializes a systimer callback function to be called at frequency
.Fa hz .
The
-.Fa info
-argument is an allocated systimer structure; the
+.Fa info
+argument is an allocated systimer structure; the
.Fa func
argument is the function to call, with argument
.Fa data .
.Pp
-The
+The
.Fn systimer_init_periodic_nq
function initializes a systimer callback function to be called at a frequency
.Fa hz .
-Unlike the
+Unlike the
.Fn systimer_init_periodic
-function, the
+function, the
.Fn systimer_init_periodic_nq
function's callback is only called once at a given time, even if delays caused
multiple time intervals to have occured.
.Pp
The
.Fn systimer_adjust_periodic
-function changes the frequency at which a systimer's callback is invoked. The
-current time interval is not affected. The
+function changes the frequency at which a systimer's callback is invoked.
+The
+current time interval is not affected.
+The
.Fa hz
argument specifies the new frequency.
.Pp
.Fa data
once, after at least
.Fa us
-microseconds.
+microseconds.
.Sh EXAMPLE
A simple example of using a one-short systimer to call a function after a short
time:
-.Bd -literal
-...
+.Bd -literal -offset indent
+\&...
static struct systimer short_st;
char *str = "goodbye!";
-...
+\&...
systimer_init_oneshot(&short_st, panic, str, 1000);
-...
+\&...
.Ed
.Sh FILES
The systimer implementation is in
.Sh HISTORY
Systimers first appeared in
.Dx 1.0 .
-