This is an archive of the discontinued LLVM Phabricator instance.

Extend PipePosix with child_processes_inherit support - to control whether pipe handles should be inherited by a child process.
ClosedPublic

Authored by ovyalov on Nov 20 2014, 3:56 PM.

Details

Reviewers
emaste
clayborg
Summary

In order to control resource sharing between processes Pipe::Open() has given a new argument bool child_processes_inherit .
If child_processes_inherit is false take following approaches:

  1. On Linux, FreeBSD 10 or higher - use pipe2 with O_CLOEXEC flag.
  2. Otherwise - set FD_CLOEXEC flag on read and write pipe descriptors after successful pipe creation.

Diff Detail

Event Timeline

ovyalov updated this revision to Diff 16459.Nov 20 2014, 3:56 PM
ovyalov retitled this revision from to Extend PipePosix with child_processes_inherit support - to control whether pipe handles should be inherited by a child process..
ovyalov updated this object.
ovyalov edited the test plan for this revision. (Show Details)
ovyalov added reviewers: clayborg, emaste.
ovyalov added a subscriber: Unknown Object (MLST).
emaste added inline comments.Nov 20 2014, 4:32 PM
source/Host/posix/PipePosix.cpp
183–184

Not sure this is necessary

clayborg accepted this revision.Nov 20 2014, 5:20 PM
clayborg edited edge metadata.

Looks good

This revision is now accepted and ready to land.Nov 20 2014, 5:20 PM
ovyalov updated this revision to Diff 16465.Nov 20 2014, 5:33 PM
ovyalov edited edge metadata.

Removed #undef PIPE2_SUPPORTED - since it's a source file no need to undef the macro explicitly.

Thank you!

emaste accepted this revision.Nov 20 2014, 5:36 PM
emaste edited edge metadata.

LGTM

emaste closed this revision.Jul 7 2015, 11:34 AM