diff options
author | Michael Kerrisk <mtk.manpages@gmail.com> | 2005-06-30 08:58:03 +0000 |
---|---|---|
committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2005-06-30 08:58:03 +0000 |
commit | edcc65ff8a2161896e99493be0f4a7358af890f7 (patch) | |
tree | 2c6d4e96c7a518863925879ed068145c04968ec4 /man2 | |
parent | d1fd6d3d745c57536115edda4aac54a1fb526273 (diff) |
Various minor wording improvements; some formatting fixes
Diffstat (limited to 'man2')
-rw-r--r-- | man2/clone.2 | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/man2/clone.2 b/man2/clone.2 index 7f481a32..7aafb80d 100644 --- a/man2/clone.2 +++ b/man2/clone.2 @@ -48,10 +48,10 @@ clone \- create a child process .br .BI " int *, " child_tidptr ) .SH DESCRIPTION -.B clone -creates a new process, just like +.BR clone () +creates a new process, in a manner similar to .BR fork (2). -.B clone +.BR clone () is a library function layered on top of the underlying .BR clone @@ -73,12 +73,12 @@ the description of below.) The main use of -.B clone +.BR clone () is to implement threads: multiple threads of control in a program that run concurrently in a shared memory space. When the child process is created with -.BR clone , +.BR clone (), it executes the function application .IR fn ( arg ). @@ -116,7 +116,7 @@ it is not possible for the child process to execute in the same stack as the calling process. The calling process must therefore set up memory space for the child stack and pass a pointer to this space to -.BR clone . +.BR clone (). Stacks grow downwards on all processors that run Linux (except the HP PA processors), so .I child_stack @@ -175,14 +175,14 @@ working directory, and the umask. Any call to .BR chdir (2), or .BR umask (2) -performed by the calling process or the child process also takes effect in the +performed by the calling process or the child process also affects the other process. If .B CLONE_FS is not set, the child process works on a copy of the file system information of the calling process at the time of the -.BR clone +.BR clone () call. Calls to .BR chroot (2), @@ -194,19 +194,28 @@ performed later by one of the processes do not affect the other process. If .B CLONE_FILES is set, the calling process and the child processes share the same file -descriptor table. File descriptors always refer to the same files in -the calling process and in the child process. Any file descriptor created by -the calling process or by the child process is also valid in the other -process. Similarly, if one of the processes closes a file descriptor, -or changes its associated flags, the other process is also affected. +descriptor table. +Any file descriptor created by the calling process or by the child +process is also valid in the other process. +Similarly, if one of the processes closes a file descriptor, +or changes its associated flags (using the +.BR fcntl (2) +.B F_SETFD +operation), the other process is also affected. If .B CLONE_FILES is not set, the child process inherits a copy of all file descriptors opened in the calling process at the time of -.BR clone . -Operations on file descriptors performed later by either the calling process or -the child process do not affect the other process. +.BR clone (). +(The duplicated file descriptors in the child refer to the +same open file descriptions (see +.BR open (2)) +as the corresponding file descriptors in the calling process.) +Subsequent operations that open or close file descriptors, +or change file descriptor flags, +performed by either the calling +process or the child process do not affect the other process. .TP .BR CLONE_NEWNS " (since Linux 2.4.19) Start the child in a new namespace. @@ -265,7 +274,7 @@ If .B CLONE_SIGHAND is not set, the child process inherits a copy of the signal handlers of the calling process at the time -.B clone +.BR clone () is called. Calls to .BR sigaction (2) performed later by one of the processes have no effect on the other @@ -337,7 +346,7 @@ If .B CLONE_VM is not set, the child process runs in a separate copy of the memory space of the calling process at the time of -.BR clone . +.BR clone (). Memory writes or file mappings/unmappings performed by one of the processes do not affect the other, as with .BR fork (2). @@ -428,7 +437,7 @@ then any thread in the group can .BR wait (2) for that child. -Since Linux 2.6, +Since Linux 2.5.35, .I flags must also include .B CLONE_SIGHAND @@ -508,7 +517,6 @@ The address involved may be changed by the .BR set_tid_address (2) system call. This is used by threading libraries. - .SS "sys_clone" The .B sys_clone @@ -522,9 +530,9 @@ only requires the and .I child_stack arguments, which have the same meaning as for -.BR clone . +.BR clone (). (Note that the order of these arguments differs from -.BR clone .) +.BR clone ().) Another difference for .B sys_clone @@ -589,7 +597,7 @@ were specified in .TP .B EINVAL Returned by -.B clone +.BR clone () when a zero value is specified for .IR child_stack . .TP @@ -608,9 +616,9 @@ was specified by a process other than process 0. .SH AVAILABILITY There is no entry for -.B clone +.BR clone () in libc5. glibc2 provides -.B clone +.BR clone () as described in this manual page. .SH NOTES @@ -626,7 +634,7 @@ flag (as in kernel 2.6). .SH "CONFORMING TO" The -.B clone +.BR clone () and .B sys_clone calls are Linux-specific and should not be used in programs |