diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-09-02 17:24:36 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-09-02 17:24:36 +0000 |
commit | a534391e94ff0c57dd5023ece96c4129ff6c9a8b (patch) | |
tree | f7504fb0dc7c3bbaca48b7033a8529b4b7a9bba6 /share/man/man9/kthread.9 | |
parent | 1a6ced1bd67ddbd46e9592bd601abc999000a182 (diff) |
More manpages.
Diffstat (limited to 'share/man/man9/kthread.9')
-rw-r--r-- | share/man/man9/kthread.9 | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/share/man/man9/kthread.9 b/share/man/man9/kthread.9 new file mode 100644 index 00000000000..cbc20560f14 --- /dev/null +++ b/share/man/man9/kthread.9 @@ -0,0 +1,90 @@ +.\" $OpenBSD: kthread.9,v 1.1 1999/09/02 17:24:35 espie Exp $ +.\" +.\" Copyright (c) 1999 Marc Espie +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by Marc Espie +.\" for the OpenBSD Project. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 1, 1999 +.Dt KTHREAD 9 +.Os +.Sh NAME +.Nm kthread_create , +.Nm kthread_exit , +.Nm kthread_create_deferred +.Nd kernel threads. +.Sh SYNOPSIS +.Fd #include <sys/kthread.h> +.Ft int +.Fn kthread_create "void (*func)(void)" "void *arg" "struct proc **newpp" "const char *fmt" ... +.Ft void +.Fn kthread_exit "int ecode" +.Ft void +.Fn kthread_create_deferred "void (*func)(void)" "void *arg" +.Sh DESCRIPTION +Kernel threads are system light-weight processes: cloned from process 0 +(the swapper), sharing its memory map and limits, but with a copy of its +file descriptor table. They don't receive broadcast nor group signals and +they can't be swapped. +.Pp +Any process can call +.Fn kthread_create +to create a kernel thread. The new process starts up executing +.Fa func +with argument +.Fa arg . +If +.Fa newpp +is not NULL, it is filled with the address of the new process. +.Fa fmt +and the remaining arguments are used to name the process. +.Pp +A kernel thread will terminate by calling +.Fn kthread_exit , +with exit code +.Fa ecode . +.Pp +Since the system has to be up and running for creating +new processes, device drivers that want to create kernel threads early +(eg, at attach time) may use +.Fn kthread_create_deferred +instead. The system will call back the function +.Fa func +with argument +.Fa arg +when it can create threads, so it is up to +.Fa func +to call +.Fn kthread_create +at that point. +.Sh SEE ALSO +.Xr fork1 9 +.Sh BUGS +There is currently no way to use +.Va ecode +to any sensible purpose from +.Fn kthread_exit . |