1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/lib/Support/Unix
James Henderson dff2d6c589 [Support] Add support for getting file system permissions on Windows and implement sys::fs::set/getPermissions to work with them
This change adds support for functions to set and get file permissions, in a similar manner to the C++17 permissions() function in <filesystem>. The setter uses chmod on Unix systems and SetFileAttributes on Windows, setting the permissions as passed in. The getter simply uses the existing status() function.

Prior to this change, status() would always return an unknown value for the permissions on a Windows file, making it impossible to test the new function on Windows. I have therefore added support for this as well. On Linux, prior to this change, the permissions included the file type, which should actually be accessed via a different member of the file_status class.

Note that on Windows, only the *_write permission bits have any affect - if any are set, the file is writable, and if not, the file is read-only. This is in common with what MSDN describes for their behaviour of std::filesystem::permissions(), and also what boost::filesystem does.

The motivation behind this change is so that we can easily test behaviour on read-only files in LLVM unit tests, but I am sure that others may find it useful in some situations.

Reviewers: zturner, amccarth, aaron.ballman

Differential Revision: https://reviews.llvm.org/D30736

llvm-svn: 297945
2017-03-16 11:22:09 +00:00
..
COM.inc
Host.inc
Memory.inc Correct mprotect page boundries to round up end page. Fixes PR30905. 2016-11-05 04:22:15 +00:00
Mutex.inc
Path.inc [Support] Add support for getting file system permissions on Windows and implement sys::fs::set/getPermissions to work with them 2017-03-16 11:22:09 +00:00
Process.inc Zero-initialize chrono duration objects 2016-11-09 11:43:57 +00:00
Program.inc
README.txt
RWMutex.inc
Signals.inc Fix LLDB Android AArch64 GCC debug info build 2017-02-02 01:17:49 +00:00
Threading.inc Try to fix thread name truncation on non-Windows. 2017-03-04 18:53:09 +00:00
ThreadLocal.inc
Unix.h Remove TimeValue usage from llvm/Support 2016-10-24 10:59:17 +00:00
Watchdog.inc

llvm/lib/Support/Unix README
===========================

This directory provides implementations of the lib/System classes that
are common to two or more variants of UNIX. For example, the directory
structure underneath this directory could look like this:

Unix           - only code that is truly generic to all UNIX platforms
  Posix        - code that is specific to Posix variants of UNIX
  SUS          - code that is specific to the Single Unix Specification
  SysV         - code that is specific to System V variants of UNIX

As a rule, only those directories actually needing to be created should be
created. Also, further subdirectories could be created to reflect versions of
the various standards. For example, under SUS there could be v1, v2, and v3
subdirectories to reflect the three major versions of SUS.