diff options
author | peter <peter@FreeBSD.org> | 2000-07-29 12:12:39 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-07-29 12:12:39 +0000 |
commit | 16df36990f3116869fa8606fb3df4d2b8be845d6 (patch) | |
tree | f8fd33b33d544258ca8cd5ead649daf145cd6ae7 /lib/libc | |
parent | c749b2743d2232cb7447bb86ac98af43645d1b58 (diff) | |
download | FreeBSD-src-16df36990f3116869fa8606fb3df4d2b8be845d6.zip FreeBSD-src-16df36990f3116869fa8606fb3df4d2b8be845d6.tar.gz |
Add a skeleton rfork_thread(3) man page.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/gen/rfork_thread.3 | 77 |
2 files changed, 79 insertions, 1 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 86c67b1..87b415c 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -46,7 +46,8 @@ MAN3+= alarm.3 arc4random.3 clock.3 \ glob.3 initgroups.3 isinf.3 \ ldexp.3 lockf.3 modf.3 msgctl.3 msgget.3 msgrcv.3 msgsnd.3 \ nice.3 nlist.3 pause.3 popen.3 psignal.3 pwcache.3 \ - raise.3 rand48.3 scandir.3 setjmp.3 setmode.3 shm_open.3 \ + raise.3 rand48.3 rfork_thread.3 \ + scandir.3 setjmp.3 setmode.3 shm_open.3 \ siginterrupt.3 signal.3 sigsetops.3 sleep.3 stringlist.3 \ strtofflags.3 sysconf.3 sysctl.3 syslog.3 tcgetpgrp.3 \ tcsendbreak.3 tcsetattr.3 tcsetpgrp.3 time.3 times.3 timezone.3 \ diff --git a/lib/libc/gen/rfork_thread.3 b/lib/libc/gen/rfork_thread.3 new file mode 100644 index 0000000..1b2b9f0 --- /dev/null +++ b/lib/libc/gen/rfork_thread.3 @@ -0,0 +1,77 @@ +.\" +.\" Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. +.\" +.\" $FreeBSD$ +.\" +.Dd Jul 29, 2000 +.Dt RFORK_THREAD 3 +.Os +.Sh NAME +.Nm rfork_thread +.Nd create a rfork-based process thread +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.Fd #include <unistd.h> +.Ft int +.Fn rfork_thread "int flags" "void *stack" "int (*func)(void *arg)" "void *arg" +.Sh DESCRIPTION +.Fn rfork_thread 3 +is a helper function for +.Xr rfork 2 . +It arranges for a new process to be created and the child process will +call the specified function with the specified argument, while running on +the supplied stack. +.Pp +Using this function should avoid the need to implement complex stack +swap code. +.Sh RETURN VALUES +Upon successful completion, +.Fn rfork_thread 3 +returns the process ID of the child process to the parent process. +Otherwise, a value of -1 is returned +to the parent process, no child process is created, and the global +variable +.Va errno +is set to indicate the error. +.Pp +The child process context is not aware of a return from the +.Fn rfork_thread 3 +function as it begins executing directly with the supplied function. +.Sh ERRORS +See +.Xr rfork 2 +for error return codes. +.Sh SEE ALSO +.Xr fork 2 , +.Xr intro 2 , +.Xr minherit 2 , +.Xr rfork 2 , +.Xr vfork 2 +.Sh HISTORY +The +.Fn rfork_thread 3 +function call first appeared in +.Fx 5.0 |