]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/clone.2
pipe.2: Note that 'pipefd' is left unchanged in the event of an error
[thirdparty/man-pages.git] / man2 / clone.2
index 6099654cae30ffef4886c730f14062640954ebfb..f3b042ccd5c8d99b76eb02dbbc7d8fb217119390 100644 (file)
@@ -39,7 +39,7 @@
 .\" 2008-11-19, mtk, document CLONE_NEWIPC
 .\" 2008-11-19, Jens Axboe, mtk, document CLONE_IO
 .\"
-.TH CLONE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH CLONE 2 2019-03-06 "Linux" "Linux Programmer's Manual"
 .SH NAME
 clone, __clone2 \- create a child process
 .SH SYNOPSIS
@@ -191,8 +191,9 @@ or change file descriptor flags,
 performed by either the calling
 process or the child process do not affect the other process.
 Note, however,
-that the duplicated file descriptors in the child refer to the same open file
-descriptions as the corresponding file descriptors in the calling process,
+that the duplicated file descriptors in the child refer to the same
+open file descriptions as the corresponding file descriptors
+in the calling process,
 and thus share file offsets and file status flags (see
 .BR open (2)).
 .TP
@@ -588,7 +589,8 @@ Calls to
 performed later by one of the processes have no effect on the other
 process.
 .IP
-Since Linux 2.6.0-test6,
+Since Linux 2.6.0,
+.\" Precisely: Linux 2.6.0-test6
 .I flags
 must also include
 .B CLONE_VM
@@ -596,7 +598,8 @@ if
 .B CLONE_SIGHAND
 is specified
 .TP
-.BR CLONE_STOPPED " (since Linux 2.6.0-test2)"
+.BR CLONE_STOPPED " (since Linux 2.6.0)"
+.\" Precisely: Linux 2.6.0-test2
 If
 .B CLONE_STOPPED
 is set, then the child is initially stopped (as though it was sent a
@@ -635,7 +638,8 @@ If this flag is not set, then the child has a separate
 .I semadj
 list that is initially empty.
 .TP
-.BR CLONE_THREAD " (since Linux 2.4.0-test8)"
+.BR CLONE_THREAD " (since Linux 2.4.0)"
+.\" Precisely: Linux 2.6.0-test8
 If
 .B CLONE_THREAD
 is set, the child is placed in the same thread group as the calling process.
@@ -716,7 +720,8 @@ must also include
 if
 .B CLONE_THREAD
 is specified
-(and note that, since Linux 2.6.0-test6,
+(and note that, since Linux 2.6.0,
+.\" Precisely: Linux 2.6.0-test6
 .BR CLONE_SIGHAND
 also requires
 .BR CLONE_VM
@@ -734,7 +739,7 @@ A signal may be process-directed or thread-directed.
 A process-directed signal is targeted at a thread group (i.e., a TGID),
 and is delivered to an arbitrarily selected thread from among those
 that are not blocking the signal.
-A signal may be process directed because it is was generated by the kernel
+A signal may be process directed because it was generated by the kernel
 for reasons other than a hardware exception, or because it was sent using
 .BR kill (2)
 or
@@ -936,8 +941,9 @@ On ia64, a different interface is used:
 .EE
 .in
 .PP
-The prototype shown above is for the glibc wrapper function; for the syscall
-itself, prototype can be described as follows (it is identical to the
+The prototype shown above is for the glibc wrapper function;
+for the system call itself,
+the prototype can be described as follows (it is identical to the
 .BR clone ()
 prototype on microblaze):
 .PP
@@ -988,7 +994,8 @@ Too many processes are already running; see
 was specified, but
 .B CLONE_VM
 was not.
-(Since Linux 2.6.0-test6.)
+(Since Linux 2.6.0.)
+.\" Precisely: Linux 2.6.0-test6
 .TP
 .B EINVAL
 .B CLONE_THREAD
@@ -1006,6 +1013,16 @@ was not.
 .\" (Since Linux 2.6.0-test6.)
 .TP
 .B EINVAL
+.B CLONE_THREAD
+was specified, but the current process previously called
+.BR unshare (2)
+with the
+.B CLONE_NEWPID
+flag or used
+.BR setns (2)
+to reassociate itself with a PID namespace.
+.TP
+.B EINVAL
 .\" commit e66eded8309ebf679d3d3c1f5820d1f2ca332c71
 Both
 .B CLONE_FS
@@ -1297,7 +1314,7 @@ For an example of the use of this program, see
 #include <stdlib.h>
 #include <unistd.h>
 
-#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\
+#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \e
                         } while (0)
 
 static int              /* Start function for cloned child */
@@ -1314,7 +1331,7 @@ childFunc(void *arg)
 
     if (uname(&uts) == \-1)
         errExit("uname");
-    printf("uts.nodename in child:  %s\\n", uts.nodename);
+    printf("uts.nodename in child:  %s\en", uts.nodename);
 
     /* Keep the namespace open for a while, by sleeping.
        This allows some experimentation\-\-for example, another
@@ -1336,7 +1353,7 @@ main(int argc, char *argv[])
     struct utsname uts;
 
     if (argc < 2) {
-        fprintf(stderr, "Usage: %s <child\-hostname>\\n", argv[0]);
+        fprintf(stderr, "Usage: %s <child\-hostname>\en", argv[0]);
         exit(EXIT_SUCCESS);
     }
 
@@ -1353,7 +1370,7 @@ main(int argc, char *argv[])
     pid = clone(childFunc, stackTop, CLONE_NEWUTS | SIGCHLD, argv[1]);
     if (pid == \-1)
         errExit("clone");
-    printf("clone() returned %ld\\n", (long) pid);
+    printf("clone() returned %ld\en", (long) pid);
 
     /* Parent falls through to here */
 
@@ -1364,11 +1381,11 @@ main(int argc, char *argv[])
 
     if (uname(&uts) == \-1)
         errExit("uname");
-    printf("uts.nodename in parent: %s\\n", uts.nodename);
+    printf("uts.nodename in parent: %s\en", uts.nodename);
 
     if (waitpid(pid, NULL, 0) == \-1)    /* Wait for child */
         errExit("waitpid");
-    printf("child has terminated\\n");
+    printf("child has terminated\en");
 
     exit(EXIT_SUCCESS);
 }