1 //===-- FileAction.h --------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_HOST_FILEACTION_H
10 #define LLDB_HOST_FILEACTION_H
12 #include "lldb/Utility/FileSpec.h"
15 namespace lldb_private {
32 bool Duplicate(int fd, int dup_fd);
34 bool Open(int fd, const FileSpec &file_spec, bool read, bool write);
36 int GetFD() const { return m_fd; }
38 Action GetAction() const { return m_action; }
40 int GetActionArgument() const { return m_arg; }
42 llvm::StringRef GetPath() const;
44 const FileSpec &GetFileSpec() const;
46 void Dump(Stream &stream) const;
49 Action m_action; // The action for this file
50 int m_fd; // An existing file descriptor
51 int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
53 m_file_spec; // A file spec to use for opening after fork or posix_spawn
56 } // namespace lldb_private