From: enh <enh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
To: Michael Kerrisk-manpages
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: CLONE_FILES description confusing
Date: Tue, 23 Aug 2016 15:19:37 -0700 [thread overview]
Message-ID: <CAJgzZopmS1ph4G4zMu-_chLjsyE4CLnZiuOPqXBC=vdUE9R96w@mail.gmail.com> (raw)
CLONE_FILES (since Linux 2.0)
If CLONE_FILES is set, the calling process and the child process
share the same file descriptor table. Any file descriptor cre‐
ated 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 fcntl(2) F_SETFD operation), the other process is also
affected.
this is fine.
If CLONE_FILES is not set, the child process inherits a copy of
all file descriptors opened in the calling process at the time
of clone(). (The duplicated file descriptors in the child refer
to the same open file descriptions (see open(2)) as the corre‐
sponding 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.
this is strictly correct, but (having just had to explain what this
descriptor/description distinction actually means in practice here) i
think it would be helpful to explicitly mention that changes to the
file offset or file status flags in one process *does* affect the
other process.
less important, but another suggestion would be that maybe we should
also explicitly say that "clone calls for thread creation pass
CLONE_FILES, but fork(3) calls clone without CLONE_FILES" so that
folks who know how to use the C library but not how it's implemented
don't need to ask their friendly local C library implementer (me)
exactly how CLONE_FILES works :-)
--elliott
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2016-08-23 22:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 22:19 enh [this message]
[not found] ` <CAJgzZopmS1ph4G4zMu-_chLjsyE4CLnZiuOPqXBC=vdUE9R96w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-23 23:52 ` CLONE_FILES description confusing Michael Kerrisk (man-pages)
[not found] ` <e9dc2d61-4d72-32f4-3fb7-8864dd575f32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-24 0:11 ` enh
[not found] ` <CAJgzZor_Ru3TJfjA0L9PFo7r+2asCD+BxW=GAgmdFHY_UR2Gag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-27 11:07 ` walter harms
[not found] ` <57C17454.80707-fPG8STNUNVg@public.gmane.org>
2016-08-28 4:43 ` Michael Kerrisk (man-pages)
[not found] ` <63e31345-ccb2-22c8-4584-62fb32db7d96-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-09-05 18:10 ` walter harms
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJgzZopmS1ph4G4zMu-_chLjsyE4CLnZiuOPqXBC=vdUE9R96w@mail.gmail.com' \
--to=enh-hpiqsd4aklfqt0dzr+alfa@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).