diff options
author | Sylvestre Ledru <sylvestre@debian.org> | 2015-08-28 12:24:07 +0000 |
---|---|---|
committer | Sylvestre Ledru <sylvestre@debian.org> | 2015-08-28 12:24:07 +0000 |
commit | 79cb0090ffbd83d24c86a68d7aab4427131f3b59 (patch) | |
tree | 04440b60be5a1d3e0518bc66ceb0cb4e3a5df65e /lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp | |
parent | 16ad032183921979d1c1542ce392f0e585f8a26c (diff) | |
download | bcm5719-llvm-79cb0090ffbd83d24c86a68d7aab4427131f3b59.tar.gz bcm5719-llvm-79cb0090ffbd83d24c86a68d7aab4427131f3b59.zip |
Avoid usage of F_DUPFD_CLOEXEC where not available (e.g. kfreebsd*)
Summary:
kfreebsd doesn't have F_DUPFD_CLOEXEC, so use it conditionally.
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Author: Petr Salinger <Petr.Salinger@seznam.cz>
Author: Gianfranco Costamagna
Reviewers: emaste
Subscribers: emaste
Differential Revision: http://reviews.llvm.org/D12429
llvm-svn: 246294
Diffstat (limited to 'lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index 8d8525481d9..4094169bc29 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -462,11 +462,25 @@ ProcessFreeBSD::DoLaunch (Module *module, int terminal = m_monitor->GetTerminalFD(); if (terminal >= 0) { // The reader thread will close the file descriptor when done, so we pass it a copy. +#ifdef F_DUPFD_CLOEXEC int stdio = fcntl(terminal, F_DUPFD_CLOEXEC, 0); if (stdio == -1) { error.SetErrorToErrno(); return error; } +#else + // Special case when F_DUPFD_CLOEXEC does not exist (Debian kFreeBSD) + int stdio = fcntl(terminal, F_DUPFD, 0); + if (stdio == -1) { + error.SetErrorToErrno(); + return error; + } + stdio = fcntl(terminal, F_SETFD, FD_CLOEXEC); + if (stdio == -1) { + error.SetErrorToErrno(); + return error; + } +#endif SetSTDIOFileDescriptor(stdio); } |