[PATCH] D28854: raw_fd_ostream: Make file handles non-inheritable by default
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 06:34:28 PST 2017
On 18 January 2017 at 14:20, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
> Pavel Labath via Phabricator <reviews at reviews.llvm.org> writes:
>> labath created this revision.
>> Herald added a subscriber: mgorny.
>> This makes the file descriptors on unix platform non-inheritable by default
>> (O_CLOEXEC). I have also added a file open flag F_Inheritable to override this
>> behavior if necessary.
> Does anything need it right now or do you plan to use it soon? If not I
> would suggest leaving it out.
I was considering that as well. For my use case it is sufficient to
make sure the streams have O_CLOEXEC set. I don't need (and I don't
anticipate needing) the opposite behavior. I can leave it out.
>> If the platform supports O_CLOEXEC flag, we will use it
>> to set the descriptor flag during open(2). If the flag is not available, we will
>> revert to the (racy) fcntl(2) call.
> Do you know which OSs don't have O_CLOEXEC?
The current versions of linux, freebsd and osx all support this flag.
However, it's a relatively recent addition, so I am not sure whether
that covers all versions we still support (e.g. on linux, it is
present since kernel version 2.6.23 -- RHEL 5 is on 2.6.18). I am also
not sure what is the state on the more exotic unix variants.
More information about the llvm-commits