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 | |
parent | 1a6ced1bd67ddbd46e9592bd601abc999000a182 (diff) |
More manpages.
Diffstat (limited to 'share/man/man9')
-rw-r--r-- | share/man/man9/Makefile | 10 | ||||
-rw-r--r-- | share/man/man9/fork1.9 | 162 | ||||
-rw-r--r-- | share/man/man9/kthread.9 | 90 | ||||
-rw-r--r-- | share/man/man9/pfind.9 | 58 |
4 files changed, 317 insertions, 3 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index ae189176ab2..8cb2e739e73 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,10 +1,11 @@ -# $OpenBSD: Makefile,v 1.10 1999/09/01 20:52:11 espie Exp $ +# $OpenBSD: Makefile,v 1.11 1999/09/02 17:24:35 espie Exp $ # $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $ # Makefile for section 9 (kernel function and variable) manual pages. -MAN= boot.9 copy.9 disk.9 doshutdownhooks.9 fetch.9 hz.9 hzto.9 intro.9 \ - inittodr.9 malloc.9 md5.9 microtime.9 panic.9 psignal.9 resettodr.9 \ +MAN= boot.9 copy.9 disk.9 doshutdownhooks.9 fetch.9 fork1.9 \ + hz.9 hzto.9 intro.9 inittodr.9 kthread.9 \ + malloc.9 md5.9 microtime.9 panic.9 pfind.9 psignal.9 resettodr.9 \ random.9 shutdownhook_establish.9 sleep.9 spl.9 store.9 style.9 \ time.9 timeout.9 vm_allocate.9 vm_map_copy.9 vm_deallocate.9 \ vm_map_inherit.9 vm_map_protect.9 @@ -16,7 +17,10 @@ MLINKS+=disk.9 disk_init.9 disk.9 disk_attach.9 disk.9 disk_detatch.9 \ disk.9 disk_resetstat.9 MLINKS+=fetch.9 fubyte.9 fetch.9 fuibyte.9 fetch.9 fusword.9 \ fetch.9 fuswintr.9 fetch.9 fuword.9 fetch.9 fuiword.9 +MLINKS+=kthread.9 kthread_create.9 kthread.9 kthread_exit.9 \ + kthread.9 kthread_create_deferred.9 MLINKS+=md5.9 MD5Init.9 md5.9 MD5Transform.9 +MLINKS+=pfind.9 pgfind.9 MLINKS+=psignal.9 pgsignal.9 psignal.9 gsignal.9 MLINKS+=shutdownhook_establish.9 shutdownhook_disestablish.9 MLINKS+=sleep.9 tsleep.9 sleep.9 wakeup.9 diff --git a/share/man/man9/fork1.9 b/share/man/man9/fork1.9 new file mode 100644 index 00000000000..cc6ae4c52e1 --- /dev/null +++ b/share/man/man9/fork1.9 @@ -0,0 +1,162 @@ +.\" $OpenBSD: fork1.9,v 1.1 1999/09/02 17:24:35 espie Exp $ +.\" $NetBSD: fork1.9,v 1.3 1999/03/16 00:40:47 garbled Exp $ +.\" +.\" Copyright (c) 1998 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, +.\" NASA Ames Research Center. +.\" +.\" 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 the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``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 FOUNDATION OR CONTRIBUTORS +.\" 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 January 6, 1998 +.Dt FORK1 9 +.Os +.Sh NAME +.Nm fork1 +.Nd create a new process +.Sh SYNOPSIS +.Fd #include <sys/types.h> +.Fd #include <sys/proc.h> +.Ft int +.Fn "fork1" "struct proc *p1" "int forktype" "int rforkflags" "void *stack" "size_t stacksize" "register_t *retval" +.Sh DESCRIPTION +.Fn fork1 +creates a new process out of +.Ar p1 , +which should be the current process. This function is used primarily +to implement the +.Xr fork 2 , +.Xr rfork 2 , +.Xr vfork 2 +system calls, as well as the +.Xr create_kthread 9 +function. +.Pp +The +.Fa forktype +argument can be +.Dv ISFORK , +.Dv ISVFORK +or +.Dv ISRFORK +and controls whether +.Nm +has +.Xr fork 2 , +.Xr vfork 2 +or +.Xr rfork 2 +semantics. +.Pp +The +.Ar rforkflags +argument is only used if +.Fa forktype +equals +.Dv ISRFORK , +and is used to implement +.Xr rfork 2 +semantics. +.Bl -tag -width RFNOWAIT +.It Dv RFPROC +Should always be set. The system currently does not support changing an +existing process characteristics. +.It Dv RFNOWAIT +See +.Xr rfork 2 . +.It Dv RFFDG +If set, the child gets a copy of the parent's file descriptor table +through +.Xr fdcopy 9 . +Otherwise, the file descriptor table is shared through +.Xr fdshare 9 . +.It Dv RFCFDG +If set, the child starts out with a clean file descriptor table created +by +.Xr fdinit 9 . +.It Dv RFMEM +If set, the child will share the parent's address space, apart from the +stack segment, which is always copied. Otherwise, the child will get a +copy-on-write snapshot of the parent address space. +.El +.Pp +If +.Fa stack +is not NULL, the area starting at +.Fa stack +of extent +.Fa stacksize +will be used for the child's stack, instead of cloning the parent's +stack. +.Pp +If +.Fa retval +is not NULL, it will hold the following values after successful completion +of the fork operation: +.Bl -tag -width retval[0] +.It Fa retval[0] +This will contain the pid of the child process. +.It Fa retval[1] +In the parent process, this will contain the value 0. In the child process, +this will contain 1. +.Sh RETURN VALUES +Upon successful completion of the fork operation, +.Fn fork1 +returns 0. Otherwise, the following error values are returned: +.Bl -tag -width [EAGAIN] +.It Bq Er EAGAIN +The limit on the total number of system processes would be exceeded. +.It Bq Er EAGAIN +The limit +.Dv RLIMIT_NPROC +on the total number of processes under execution by this +user id would be exceeded. +.El +.Sh CAVEATS +The +.Nm +function semantics are specific to +.Ox . +Other BSD systems have different semantics. +.Pp +The system never uses +.Nm +with a non-null +.Fa stack , +so that feature is not even tested. +.Sh SEE ALSO +.Xr execve 2 , +.Xr fork 2 , +.Xr rfork 2 , +.Xr vfork 2 , +.Xr pfind 9 , +.Xr psignal 9 , +.Xr create_kthread 9 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 . diff --git a/share/man/man9/pfind.9 b/share/man/man9/pfind.9 new file mode 100644 index 00000000000..97ac808289a --- /dev/null +++ b/share/man/man9/pfind.9 @@ -0,0 +1,58 @@ +.\" $OpenBSD: pfind.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 PFIND 9 +.Os +.Sh NAME +.Nm pfind , +.Nm pgfind +.Nd find process / process group by number +.Sh SYNOPSIS +.Fd #include <sys/cdefs.h> +.Fd #include <sys/proc.h> +.Ft "struct proc *" +.Fn pfind "pid_t pid" +.Ft "struct pgrp *" +.Fn pgfind "pid_t pgid" +.Sh DESCRIPTION +The +.Fn pfind +and +.Fn pgfind +functions retrieve process and progress group structures from process and +process group ids. +.Pp +Both functions return NULL if the requested id can't be found. +.Sh CODE REFERENCES +Those functions are implemented in the file +.Pa sys/kern/kern_proc.c . + |