Hi Michael,
This very small patch against man-pages-3.50 adds a description of the
way in which a shared file descriptor table, as created by the
CLONE_FILES flag of clone(2), is unshared when a process calls execve(2).
It's easy to see this from the source - there's an unshare_files()
call early in do_execve_common().
- Kevin
diff -urN man-pages-3.50.orig/man2/clone.2 man-pages-3.50/man2/clone.2
--- man-pages-3.50.orig/man2/clone.2 2013-03-15 18:17:35.000000000 +1100
+++ man-pages-3.50/man2/clone.2 2013-03-28 21:50:04.745932956 +1100
@@ -180,6 +180,9 @@
.BR fcntl (2)
.B F_SETFD
operation), the other process is also affected.
+If a process sharing a file descriptor table calls
+.BR execve (2),
+its file descriptor table is duplicated (unshared).
If
.B CLONE_FILES
diff -urN man-pages-3.50.orig/man2/execve.2 man-pages-3.50/man2/execve.2
--- man-pages-3.50.orig/man2/execve.2 2013-03-15 18:17:35.000000000 +1100
+++ man-pages-3.50/man2/execve.2 2013-03-28 22:02:56.793844616 +1100
@@ -204,6 +204,11 @@
.B SIGCHLD
(see
.BR clone (2)).
+.IP *
+The file descriptor table is unshared, undoing the effect of the
+.B CLONE_FILES
+flag of
+.BR clone (2).
.PP
Note the following further points:
.IP * 3