summaryrefslogtreecommitdiffstats
path: root/lldb/include/lldb/Host/File.h
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/include/lldb/Host/File.h')
-rw-r--r--lldb/include/lldb/Host/File.h53
1 files changed, 45 insertions, 8 deletions
diff --git a/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h
index df7fe92cccb..bb04784a2fe 100644
--- a/lldb/include/lldb/Host/File.h
+++ b/lldb/include/lldb/Host/File.h
@@ -41,17 +41,20 @@ public:
eOpenOptionCanCreateNewOnly = (1u << 6) // Can create file only if it doesn't already exist
};
+ static mode_t
+ ConvertOpenOptionsForPOSIXOpen (uint32_t open_options);
+
enum Permissions
{
- ePermissionsUserRead = (1u << 0),
- ePermissionsUserWrite = (1u << 1),
- ePermissionsUserExecute = (1u << 2),
- ePermissionsGroupRead = (1u << 3),
+ ePermissionsUserRead = (1u << 8),
+ ePermissionsUserWrite = (1u << 7),
+ ePermissionsUserExecute = (1u << 6),
+ ePermissionsGroupRead = (1u << 5),
ePermissionsGroupWrite = (1u << 4),
- ePermissionsGroupExecute = (1u << 5),
- ePermissionsWorldRead = (1u << 6),
- ePermissionsWorldWrite = (1u << 7),
- ePermissionsWorldExecute = (1u << 8),
+ ePermissionsGroupExecute = (1u << 3),
+ ePermissionsWorldRead = (1u << 2),
+ ePermissionsWorldWrite = (1u << 1),
+ ePermissionsWorldExecute = (1u << 0),
ePermissionsUserRW = (ePermissionsUserRead | ePermissionsUserWrite | 0 ),
ePermissionsUserRX = (ePermissionsUserRead | 0 | ePermissionsUserExecute ),
@@ -117,6 +120,27 @@ public:
uint32_t options,
uint32_t permissions = ePermissionsDefault);
+ //------------------------------------------------------------------
+ /// Constructor with FileSpec.
+ ///
+ /// Takes a FileSpec pointing to a file which can be just a filename, or a full
+ /// path. If \a path is not NULL or empty, this function will call
+ /// File::Open (const char *path, uint32_t options, uint32_t permissions).
+ ///
+ /// @param[in] path
+ /// The FileSpec for this file.
+ ///
+ /// @param[in] options
+ /// Options to use when opening (see File::OpenOptions)
+ ///
+ /// @param[in] permissions
+ /// Options to use when opening (see File::Permissions)
+ ///
+ /// @see File::Open (const char *path, uint32_t options, uint32_t permissions)
+ //------------------------------------------------------------------
+ File (const FileSpec& filespec,
+ uint32_t options,
+ uint32_t permissions = ePermissionsDefault);
File (int fd, bool tranfer_ownership) :
m_descriptor (fd),
@@ -451,6 +475,19 @@ public:
//------------------------------------------------------------------
Error
Sync ();
+
+ //------------------------------------------------------------------
+ /// Get the permissions for a this file.
+ ///
+ /// @return
+ /// Bits logical OR'ed together from the permission bits defined
+ /// in lldb_private::File::Permissions.
+ //------------------------------------------------------------------
+ uint32_t
+ GetPermissions(Error &error) const;
+
+ static uint32_t
+ GetPermissions (const char *path, Error &error);
//------------------------------------------------------------------
/// Output printf formatted output to the stream.
OpenPOWER on IntegriCloud