summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2000-12-15 20:39:35 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2000-12-15 20:39:35 +0000
commitaea5b8ffe15a2f970d3427e7bf3f77f77cf8003b (patch)
tree9ba60c539debd590c6c8b4f8412756a6b17c07fd
parentb1df743d8a25d5c1f1ae2c1e447dd8fd27463257 (diff)
Notes
-rw-r--r--share/man/man9/Makefile6
-rw-r--r--share/man/man9/kthread.971
2 files changed, 46 insertions, 31 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 1023dbe0f91b..84b7872e7c9f 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -85,10 +85,10 @@ MLINKS+=devstat.9 devstat_end_transaction.9
MLINKS+=fetch.9 fubyte.9 fetch.9 fuswintr.9 fetch.9 fusword.9 fetch.9 fuword.9
MLINKS+=ifnet.9 if_data.9 ifnet.9 ifaddr.9 ifnet.9 ifqueue.9
MLINKS+=kernacc.9 useracc.9
-MLINKS+=kthread.9 kproc_start.9 kthread.9 kproc_suspend_loop.9
+MLINKS+=kthread.9 kproc_start.9 kthread.9 kproc_shutdown.9
MLINKS+=kthread.9 kthread_create.9 kthread.9 kthread_exit.9
-MLINKS+=kthread.9 resume_kproc.9 kthread.9 shutdown_kproc.9
-MLINKS+=kthread.9 suspend_kproc.9
+MLINKS+=kthread.9 kthread_resume.9 kthread.9 kthread_suspend.9
+MLINKS+=kthread.9 kthread_suspend_check.9
MLINKS+=make_dev.9 destroy_dev.9
MLINKS+=malloc.9 FREE.9 malloc.9 MALLOC.9 malloc.9 free.9
MLINKS+=mi_switch.9 cpu_switch.9
diff --git a/share/man/man9/kthread.9 b/share/man/man9/kthread.9
index 65adef953c33..e894c3a6df17 100644
--- a/share/man/man9/kthread.9
+++ b/share/man/man9/kthread.9
@@ -30,29 +30,29 @@
.Os
.Sh NAME
.Nm kproc_start ,
-.Nm kproc_suspend_loop ,
+.Nm kproc_shutdown ,
.Nm kthread_create ,
.Nm kthread_exit ,
-.Nm resume_kproc ,
-.Nm shutdown_kproc ,
-.Nm suspend_kproc
+.Nm kthread_resume ,
+.Nm kthread_suspend ,
+.Nm kthread_suspend_check
.Nd kernel threads
.Sh SYNOPSIS
.Fd #include <sys/kthread.h>
.Ft void
.Fn kproc_start "const void *udata"
.Ft void
-.Fn kproc_suspend_loop "struct proc *p"
+.Fn kproc_shutdown "void *arg" "int howto"
.Ft int
.Fn kthread_create "void (*func)(void *)" "void *arg" "struct proc **newpp" "int flags" "const char *fmt" "..."
.Ft void
.Fn kthread_exit "int ecode"
.Ft int
-.Fn resume_kproc "struct proc *p"
-.Ft void
-.Fn shutdown_kproc "void *arg" "int howto"
+.Fn kthread_resume "struct proc *p"
.Ft int
-.Fn suspend_kproc "struct proc *p" "int timo"
+.Fn kthread_suspend "struct proc *p" "int timo"
+.Ft void
+.Fn kthread_suspend_check "struct proc *p"
.Sh DESCRIPTION
.Pp
The function
@@ -140,14 +140,14 @@ The
argument specifies the exit status of the thread.
.Pp
The
-.Fn kproc_suspend_loop ,
-.Fn resume_kproc ,
+.Fn kthread_resume ,
+.Fn kthread_suspend ,
and
-.Fn suspend_kproc
+.Fn kthread_suspend_check
functions are used to suspend and resume a kernel thread.
During the main loop of its execution, a kernel thread that wishes to allow
itself to be suspended should call
-.Fn kproc_suspend_loop
+.Fn kthread_suspend_check
passing in
.Va curproc
as the only argument.
@@ -165,25 +165,25 @@ argument points to the
.Li struct proc
of the kernel thread to suspend or resume.
For
-.Fn suspend_kproc ,
+.Fn kthread_suspend ,
the
.Fa timo
argument specifies a timeout to wait for the kernel thread to acknowledge the
suspend request and suspend itself.
.Pp
The
-.Fn shutdown_kproc
+.Fn kproc_shutdown
function is meant to be registered as a shutdown event for kernel threads that
need to be suspended voluntarily during system shutdown so as not to interfere
with system shutdown activities.
The actual suspension of the kernel thread is done with
-.Fn suspend_kproc .
+.Fn kthread_suspend .
.Sh RETURN VALUES
The
.Fn kthread_create ,
-.Fn resume_kproc ,
+.Fn kthread_resume ,
and
-.Fn suspend_kproc
+.Fn kthread_suspend
functions return zero on success and non-zero on failure.
Upon failure, the global variable
.Va errno
@@ -193,9 +193,9 @@ This example demonstrates the use of a
.Li struct kproc_desc
and the functions
.Fn kproc_start ,
-.Fn shutdown_kproc,
+.Fn kproc_shutdown ,
and
-.Fn kproc_suspend_loop
+.Fn kthread_suspend_check
to run the
.Dq bufdaemon
process.
@@ -217,20 +217,20 @@ buf_daemon()
/*
* This process needs to be suspended prior to shutdown sync.
*/
- EVENTHANDLER_REGISTER(shutdown_pre_sync, shutdown_kproc,
+ EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown,
bufdaemonproc, SHUTDOWN_PRI_LAST);
...
for (;;) {
- kproc_suspend_loop(bufdaemonproc);
+ kthread_suspend_check(bufdaemonproc);
...
}
}
.Ed
.Sh ERRORS
The
-.Fn resume_kproc
+.Fn kthread_resume
and
-.Fn suspend_kproc
+.Fn kthread_suspend
functions will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
@@ -265,15 +265,30 @@ The
function first appeared in
.Fx 2.2 .
The
-.Fn kproc_suspend_loop ,
+.Fn kproc_shutdown ,
.Fn kthread_create ,
.Fn kthread_exit ,
-.Fn resume_kproc ,
-.Fn shutdown_kproc ,
+.Fn kthread_resume ,
+.Fn kthread_suspend ,
and
-.Fn suspend_kproc
+.Fn kthread_suspend_check
functions were introducted in
.Fx 4.0 .
+Prior to
+.Fx 5.0 ,
+the
+.Fn kproc_shutdown ,
+.Fn kthread_resume ,
+.Fn kthread_suspend ,
+and
+.Fn kthread_suspend_check
+functions were named
+.Fn shutdown_kproc ,
+.Fn resume_kproc ,
+.Fn shutdown_kproc ,
+and
+.Fn kproc_suspend_loop ,
+respectively.
.Sh BUGS
If a kernel thread exits its main function (specified as the
.Fa func