]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/FileAction.h
MFV r266995:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Target / FileAction.h
1 //===-- ProcessLaunchInfo.h -------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_Target_FileAction_h
11 #define liblldb_Target_FileAction_h
12
13 #include <string>
14
15 namespace lldb_private
16 {
17
18 class FileAction
19 {
20   public:
21     enum Action
22     {
23         eFileActionNone,
24         eFileActionClose,
25         eFileActionDuplicate,
26         eFileActionOpen
27     };
28
29     FileAction();
30
31     void Clear();
32
33     bool Close(int fd);
34
35     bool Duplicate(int fd, int dup_fd);
36
37     bool Open(int fd, const char *path, bool read, bool write);
38
39     int
40     GetFD() const
41     {
42         return m_fd;
43     }
44
45     Action
46     GetAction() const
47     {
48         return m_action;
49     }
50
51     int
52     GetActionArgument() const
53     {
54         return m_arg;
55     }
56
57     const char *GetPath() const;
58
59   protected:
60     Action m_action;    // The action for this file
61     int m_fd;           // An existing file descriptor
62     int m_arg;          // oflag for eFileActionOpen*, dup_fd for eFileActionDuplicate
63     std::string m_path; // A file path to use for opening after fork or posix_spawn
64 };
65
66 } // namespace lldb_private
67
68 #endif