================ @@ -0,0 +1,290 @@ +//===-- NativeProcessAIX.cpp --------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "NativeProcessAIX.h" +#include "Plugins/Process/POSIX/ProcessPOSIXLog.h" +#include "lldb/Host/Host.h" +#include "lldb/Host/HostProcess.h" +#include "lldb/Host/ProcessLaunchInfo.h" +#include "lldb/Host/posix/ProcessLauncherPosixFork.h" +#include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/State.h" +#include "lldb/Utility/Status.h" +#include "llvm/Support/Errno.h" +#include "llvm/Support/Error.h" +#include <cerrno> +#include <cstdint> +#include <cstring> +#include <sstream> +#include <string> +#include <sys/ptrace.h> +#include <unistd.h> + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_aix; +using namespace llvm; + +static constexpr unsigned k_ptrace_word_size = sizeof(void *); +static_assert(sizeof(long) >= k_ptrace_word_size, + "Size of long must be larger than ptrace word size"); + +// Simple helper function to ensure flags are enabled on the given file +// descriptor. +static Status EnsureFDFlags(int fd, int flags) { + Status error; + + int status = fcntl(fd, F_GETFL); + if (status == -1) { + error = Status::FromErrno(); + return error; + } + + if (fcntl(fd, F_SETFL, status | flags) == -1) { + error = Status::FromErrno(); + return error; + } + + return error; +} ---------------- labath wrote:
```suggestion static llvm::Error EnsureFDFlags(int fd, int flags) { int status = fcntl(fd, F_GETFL); if (status == -1) return errorCodeToError(errnoAsErrorCode()); if (fcntl(fd, F_SETFL, status | flags) == -1) return errorCodeToError(errnoAsErrorCode()); return llvm::Error::success(); } ``` https://github.com/llvm/llvm-project/pull/118160 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits