summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/posix/ProcessLauncherPosixFork.cpp')
-rw-r--r--lldb/source/Host/posix/ProcessLauncherPosixFork.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
index 046cd250393..d46191fd622 100644
--- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
+++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
@@ -131,8 +131,8 @@ static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd,
FixupEnvironment(env);
Environment::Envp envp = env.getEnvp();
- // Clear the signal mask to prevent the child from being affected by
- // any masking done by the parent.
+ // Clear the signal mask to prevent the child from being affected by any
+ // masking done by the parent.
sigset_t set;
if (sigemptyset(&set) != 0 ||
pthread_sigmask(SIG_SETMASK, &set, nullptr) != 0)
@@ -142,8 +142,7 @@ static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd,
// HACK:
// Close everything besides stdin, stdout, and stderr that has no file
// action to avoid leaking. Only do this when debugging, as elsewhere we
- // actually rely on
- // passing open descriptors to child processes.
+ // actually rely on passing open descriptors to child processes.
for (int fd = 3; fd < sysconf(_SC_OPEN_MAX); ++fd)
if (!info.GetFileActionForFD(fd) && fd != error_fd)
close(fd);
@@ -158,18 +157,14 @@ static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd,
#if defined(__linux__)
if (errno == ETXTBSY) {
- // On android M and earlier we can get this error because the adb deamon can
- // hold a write
- // handle on the executable even after it has finished uploading it. This
- // state lasts
- // only a short time and happens only when there are many concurrent adb
- // commands being
- // issued, such as when running the test suite. (The file remains open when
- // someone does
- // an "adb shell" command in the fork() child before it has had a chance to
- // exec.) Since
- // this state should clear up quickly, wait a while and then give it one
- // more go.
+ // On android M and earlier we can get this error because the adb deamon
+ // can hold a write handle on the executable even after it has finished
+ // uploading it. This state lasts only a short time and happens only when
+ // there are many concurrent adb commands being issued, such as when
+ // running the test suite. (The file remains open when someone does an "adb
+ // shell" command in the fork() child before it has had a chance to exec.)
+ // Since this state should clear up quickly, wait a while and then give it
+ // one more go.
usleep(50000);
execve(argv[0], const_cast<char *const *>(argv), envp);
}
OpenPOWER on IntegriCloud