Author: sylvestre Date: Fri Aug 28 07:24:07 2015 New Revision: 246294 URL: http://llvm.org/viewvc/llvm-project?rev=246294&view=rev Log: 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 <po...@debian.org> Author: Petr Salinger <petr.salin...@seznam.cz> Author: Gianfranco Costamagna Reviewers: emaste Subscribers: emaste Differential Revision: http://reviews.llvm.org/D12429 Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=246294&r1=246293&r2=246294&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Fri Aug 28 07:24:07 2015 @@ -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); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits