summaryrefslogtreecommitdiffstats
path: root/base/base.gyp
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 19:40:03 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 19:40:03 +0000
commit3f04f2b1152b3c2b1db720792ed43c7600919953 (patch)
treeeb9e8606323e0cf51fdde717f2a351f3685f0c95 /base/base.gyp
parente611fd66e64564d17865ed19658dc0b56e1ee746 (diff)
downloadchromium_src-3f04f2b1152b3c2b1db720792ed43c7600919953.zip
chromium_src-3f04f2b1152b3c2b1db720792ed43c7600919953.tar.gz
chromium_src-3f04f2b1152b3c2b1db720792ed43c7600919953.tar.bz2
POSIX: Add code for shuffling file descriptors.
When forking a child process, one often wants to move existing file descriptors to well known locations (stdout, stderr etc). However, this is a process bedeviled with corner cases. Consider the case where you open two file descriptors, get assigned fds 1 and 0 for them and wish to shuffle them so that they end up in slots 0 and 1. Our current code fails in this case. We also have a problem where we're currently trying to mark file descriptors as close-on-exec rather than closing them in the child process. This is inherently broken in a multithreaded process where another thread can open a file descriptor and race the loop which is trying to mark them. Thus, on Linux we switch to close-after-fork where we known that no other threads exist in the process. On Mac, the code is sufficiently different that this simple fix isn't applicable and one of the Mac folks will need to take a look. http://codereview.chromium.org/100127 BUG=11174 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base.gyp')
-rw-r--r--base/base.gyp5
1 files changed, 5 insertions, 0 deletions
diff --git a/base/base.gyp b/base/base.gyp
index eef97fb..1ad079b 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -95,6 +95,8 @@
'event_recorder_stubs.cc',
'field_trial.cc',
'field_trial.h',
+ 'file_descriptor_shuffle.cc',
+ 'file_descriptor_shuffle.h',
'file_path.cc',
'file_path.h',
'file_util.cc',
@@ -446,6 +448,7 @@
'sources!': [
'data_pack.cc',
'event_recorder_stubs.cc',
+ 'file_descriptor_shuffle.cc',
'message_pump_libevent.cc',
'string16.cc',
],
@@ -558,6 +561,7 @@
'debug_util_unittest.cc',
'directory_watcher_unittest.cc',
'field_trial_unittest.cc',
+ 'file_descriptor_shuffle_unittest.cc',
'file_path_unittest.cc',
'file_util_unittest.cc',
'file_version_info_unittest.cc',
@@ -655,6 +659,7 @@
],
'sources!': [
'data_pack_unittest.cc',
+ 'file_descriptor_shuffle_unittest.cc',
],
}, { # OS != "win"
'sources!': [