aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Target/FileAction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Target/FileAction.h')
-rw-r--r--include/lldb/Target/FileAction.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h
new file mode 100644
index 000000000000..db84c0ef468c
--- /dev/null
+++ b/include/lldb/Target/FileAction.h
@@ -0,0 +1,68 @@
+//===-- ProcessLaunchInfo.h -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Target_FileAction_h
+#define liblldb_Target_FileAction_h
+
+#include <string>
+
+namespace lldb_private
+{
+
+class FileAction
+{
+ public:
+ enum Action
+ {
+ eFileActionNone,
+ eFileActionClose,
+ eFileActionDuplicate,
+ eFileActionOpen
+ };
+
+ FileAction();
+
+ void Clear();
+
+ bool Close(int fd);
+
+ bool Duplicate(int fd, int dup_fd);
+
+ bool Open(int fd, const char *path, bool read, bool write);
+
+ int
+ GetFD() const
+ {
+ return m_fd;
+ }
+
+ Action
+ GetAction() const
+ {
+ return m_action;
+ }
+
+ int
+ GetActionArgument() const
+ {
+ return m_arg;
+ }
+
+ const char *GetPath() const;
+
+ protected:
+ Action m_action; // The action for this file
+ int m_fd; // An existing file descriptor
+ int m_arg; // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
+ std::string m_path; // A file path to use for opening after fork or posix_spawn
+};
+
+} // namespace lldb_private
+
+#endif