Namespaces | |
namespace | detail |
Classes | |
class | basic_file_status |
Represents the result of a call to directory_iterator::status().More... | |
class | directory_entry |
directory_entry - A single entry in a directory.More... | |
class | directory_iterator |
directory_iterator - Iterates through the entries in path.More... | |
class | file_status |
Represents the result of a call tosys::fs::status().More... | |
class | FileLocker |
RAII class that facilitates file locking.More... | |
class | mapped_file_region |
This class represents a memory mapped file.More... | |
class | recursive_directory_iterator |
recursive_directory_iterator - Same asdirectory_iterator except for it recurses down into child directories.More... | |
struct | space_info |
space_info - Self explanatory.More... | |
class | TempFile |
Represents a temporary file.More... | |
class | UniqueID |
Typedefs | |
using | file_t = int |
Enumerations | |
enum class | file_type { status_error,file_not_found,regular_file,directory_file, symlink_file,block_file,character_file,fifo_file, socket_file,type_unknown } |
An enumeration for the file system's view of the type.More... | |
enum | perms { no_perms = 0,owner_read = 0400,owner_write = 0200,owner_exe = 0100, owner_all = owner_read | owner_write | owner_exe,group_read = 040,group_write = 020,group_exe = 010, group_all = group_read | group_write | group_exe,others_read = 04,others_write = 02,others_exe = 01, others_all = others_read | others_write | others_exe,all_read = owner_read | group_read | others_read,all_write = owner_write | group_write | others_write,all_exe = owner_exe | group_exe | others_exe, all_all = owner_all | group_all | others_all,set_uid_on_exe = 04000,set_gid_on_exe = 02000,sticky_bit = 01000, all_perms = all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit,perms_not_known = 0xFFFF } |
Functions | |
perms | operator| (perms l,perms r) |
perms | operator& (perms l,perms r) |
perms & | operator|= (perms &l,perms r) |
perms & | operator&= (perms &l,perms r) |
perms | operator~ (perms x) |
static std::error_code | createTemporaryFile (constTwine &Model, int &ResultFD,llvm::SmallVectorImpl<char > &ResultPath,FSEntityType,sys::fs::OpenFlags Flags=sys::fs::OF_None) |
static std::error_code | createTemporaryFile (constTwine &Prefix,StringRef Suffix, int &ResultFD,llvm::SmallVectorImpl<char > &ResultPath,FSEntityType,sys::fs::OpenFlags Flags=sys::fs::OF_None) |
static std::error_code | copy_file_internal (int ReadFD, int WriteFD) |
Physical Operators | |
void | make_absolute (constTwine ¤t_directory,SmallVectorImpl<char > &path) |
Makepath an absolute path. | |
std::error_code | make_absolute (SmallVectorImpl<char > &path) |
Makepath an absolute path. | |
std::error_code | create_directories (constTwine &path,bool IgnoreExisting=true,perms Perms=owner_all|group_all) |
Create all the non-existent directories in path. | |
std::error_code | create_directory (constTwine &path,bool IgnoreExisting=true,perms Perms=owner_all|group_all) |
Create the directory in path. | |
std::error_code | create_link (constTwine &to,constTwine &from) |
Create a link fromfrom toto. | |
std::error_code | create_hard_link (constTwine &to,constTwine &from) |
Create a hard link fromfrom toto, or return an error. | |
std::error_code | real_path (constTwine &path,SmallVectorImpl<char > &output,boolexpand_tilde=false) |
Collapse all . | |
void | expand_tilde (constTwine &path,SmallVectorImpl<char > &output) |
Expands ~ expressions to the user's home directory. | |
std::error_code | current_path (SmallVectorImpl<char > &result) |
Get the current path. | |
std::error_code | set_current_path (constTwine &path) |
Set the current path. | |
std::error_code | remove (constTwine &path,bool IgnoreNonExisting=true) |
Remove path. | |
std::error_code | remove_directories (constTwine &path,bool IgnoreErrors=true) |
Recursively delete a directory. | |
std::error_code | rename (constTwine &from,constTwine &to) |
Renamefrom toto. | |
std::error_code | copy_file (constTwine &From,constTwine &To) |
Copy the contents ofFrom toTo. | |
std::error_code | copy_file (constTwine &From, int ToFD) |
Copy the contents ofFrom toTo. | |
std::error_code | resize_file (int FD,uint64_tSize) |
Resize path to size. | |
std::error_code | resize_file_before_mapping_readwrite (int FD,uint64_tSize) |
ResizeFD toSize before mappingmapped_file_region::readwrite. | |
ErrorOr<MD5::MD5Result > | md5_contents (int FD) |
Compute anMD5 hash of a file's contents. | |
ErrorOr<MD5::MD5Result > | md5_contents (constTwine &Path) |
Version of compute_md5 that doesn't require an open file descriptor. | |
Variables | |
constfile_t | kInvalidFile |
Physical Observers | |
enum class | AccessMode {Exist,Write,Execute } |
enum | CreationDisposition : unsigned {CD_CreateAlways = 0,CD_CreateNew = 1,CD_OpenExisting = 2,CD_OpenAlways = 3 } |
enum | FileAccess : unsigned {FA_Read = 1,FA_Write = 2 } |
enum | OpenFlags : unsigned { OF_None = 0,OF_Text = 1,OF_CRLF = 2,OF_TextWithCRLF = OF_Text | OF_CRLF, OF_Append = 4,OF_Delete = 8,OF_ChildInherit = 16,OF_UpdateAtime = 32 } |
enum | : size_t {DefaultReadChunkSize = 4 * 4096 } |
Default chunk size forreadNativeFileToEOF().More... | |
bool | exists (constbasic_file_status &status) |
Does file exist? | |
std::error_code | access (constTwine &Path,AccessModeMode) |
Can the file be accessed? | |
bool | exists (constTwine &Path) |
Does file exist? | |
bool | can_execute (constTwine &Path) |
Can we execute this file? | |
bool | can_write (constTwine &Path) |
Can we write this file? | |
bool | equivalent (file_statusA,file_statusB) |
Dofile_status's represent the same thing? | |
std::error_code | equivalent (constTwine &A,constTwine &B,bool &result) |
Do paths represent the same thing? | |
bool | equivalent (constTwine &A,constTwine &B) |
Simpler version of equivalent for clients that don't need to differentiate between an error and false. | |
std::error_code | is_local (constTwine &path,bool &result) |
Is the file mounted on a local filesystem? | |
std::error_code | is_local (int FD,bool &result) |
Version of is_local accepting an open file descriptor. | |
bool | is_local (constTwine &Path) |
Simpler version of is_local for clients that don't need to differentiate between an error and false. | |
bool | is_local (int FD) |
Simpler version of is_local accepting an open file descriptor for clients that don't need to differentiate between an error and false. | |
file_type | get_file_type (constTwine &Path,bool Follow=true) |
Does status represent a directory? | |
bool | is_directory (constbasic_file_status &status) |
Does status represent a directory? | |
std::error_code | is_directory (constTwine &path,bool &result) |
Is path a directory? | |
bool | is_directory (constTwine &Path) |
Simpler version of is_directory for clients that don't need to differentiate between an error and false. | |
bool | is_regular_file (constbasic_file_status &status) |
Does status represent a regular file? | |
std::error_code | is_regular_file (constTwine &path,bool &result) |
Is path a regular file? | |
bool | is_regular_file (constTwine &Path) |
Simpler version of is_regular_file for clients that don't need to differentiate between an error and false. | |
bool | is_symlink_file (constbasic_file_status &status) |
Does status represent a symlink file? | |
std::error_code | is_symlink_file (constTwine &path,bool &result) |
Is path a symlink file? | |
bool | is_symlink_file (constTwine &Path) |
Simpler version of is_symlink_file for clients that don't need to differentiate between an error and false. | |
bool | is_other (constbasic_file_status &status) |
Does this status represent something that exists but is not a directory or regular file? | |
std::error_code | is_other (constTwine &path,bool &result) |
Is path something that exists but is not a directory, regular file, or symlink? | |
std::error_code | status (constTwine &path,file_status &result,bool follow=true) |
Get file status as if by POSIX stat(). | |
std::error_code | status (int FD,file_status &Result) |
A version for when a file descriptor is already available. | |
unsigned | getUmask () |
Get file creation mode mask of the process. | |
std::error_code | setPermissions (constTwine &Path,perms Permissions) |
Set file permissions. | |
std::error_code | setPermissions (int FD,perms Permissions) |
Vesion of setPermissions accepting a file descriptor. | |
ErrorOr<perms > | getPermissions (constTwine &Path) |
Get file permissions. | |
std::error_code | file_size (constTwine &Path,uint64_t &Result) |
Get file size. | |
std::error_code | setLastAccessAndModificationTime (int FD,TimePoint<> AccessTime,TimePoint<> ModificationTime) |
Set the file modification and access time. | |
std::error_code | setLastAccessAndModificationTime (int FD,TimePoint<> Time) |
Simpler version that sets both file modification and access time to the same time. | |
bool | status_known (constbasic_file_status &s) |
Is status available? | |
std::error_code | status_known (constTwine &path,bool &result) |
Is status available? | |
void | createUniquePath (constTwine &Model,SmallVectorImpl<char > &ResultPath,bool MakeAbsolute) |
Create a potentially unique file name but does not create it. | |
std::error_code | createUniqueFile (constTwine &Model, int &ResultFD,SmallVectorImpl<char > &ResultPath,OpenFlags Flags=OF_None,unsignedMode=all_read|all_write) |
Create a uniquely named file. | |
std::error_code | createUniqueFile (constTwine &Model,SmallVectorImpl<char > &ResultPath,unsignedMode=all_read|all_write) |
Simpler version for clients that don't want an open file. | |
std::error_code | createTemporaryFile (constTwine &Prefix,StringRef Suffix, int &ResultFD,SmallVectorImpl<char > &ResultPath,OpenFlags Flags=OF_None) |
Create a file in the system temporary directory. | |
std::error_code | createTemporaryFile (constTwine &Prefix,StringRef Suffix,SmallVectorImpl<char > &ResultPath,OpenFlags Flags=OF_None) |
Simpler version for clients that don't want an open file. | |
std::error_code | createUniqueDirectory (constTwine &Prefix,SmallVectorImpl<char > &ResultPath) |
std::error_code | getPotentiallyUniqueFileName (constTwine &Model,SmallVectorImpl<char > &ResultPath) |
Get a unique name, not currently exisiting in the filesystem. | |
std::error_code | getPotentiallyUniqueTempFileName (constTwine &Prefix,StringRef Suffix,SmallVectorImpl<char > &ResultPath) |
Get a unique temporary file name, not currently exisiting in the filesystem. | |
OpenFlags | operator| (OpenFlagsA,OpenFlagsB) |
OpenFlags & | operator|= (OpenFlags &A,OpenFlagsB) |
FileAccess | operator| (FileAccessA,FileAccessB) |
FileAccess & | operator|= (FileAccess &A,FileAccessB) |
std::error_code | openFile (constTwine &Name, int &ResultFD,CreationDisposition Disp,FileAccessAccess,OpenFlags Flags,unsignedMode=0666) |
Opens a file with the specified creation disposition, access mode, and flags and returns a file descriptor. | |
Expected<file_t > | openNativeFile (constTwine &Name,CreationDisposition Disp,FileAccessAccess,OpenFlags Flags,unsignedMode=0666) |
Opens a file with the specified creation disposition, access mode, and flags and returns a platform-specific file object. | |
file_t | convertFDToNativeFile (int FD) |
Converts from a Posix file descriptor number to a native file handle. | |
file_t | getStdinHandle () |
Return an open handle to standard in. | |
file_t | getStdoutHandle () |
Return an open handle to standard out. | |
file_t | getStderrHandle () |
Return an open handle to standard error. | |
Expected< size_t > | readNativeFile (file_t FileHandle,MutableArrayRef<char > Buf) |
ReadsBuf.size() bytes fromFileHandle intoBuf . | |
Error | readNativeFileToEOF (file_t FileHandle,SmallVectorImpl<char > &Buffer, ssize_t ChunkSize=DefaultReadChunkSize) |
Reads fromFileHandle until EOF, appending toBuffer in chunks of sizeChunkSize . | |
Expected< size_t > | readNativeFileSlice (file_t FileHandle,MutableArrayRef<char > Buf,uint64_tOffset) |
ReadsBuf.size() bytes fromFileHandle at offsetOffset intoBuf . | |
std::error_code | openFileForWrite (constTwine &Name, int &ResultFD,CreationDisposition Disp=CD_CreateAlways,OpenFlags Flags=OF_None,unsignedMode=0666) |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor. | |
Expected<file_t > | openNativeFileForWrite (constTwine &Name,CreationDisposition Disp,OpenFlags Flags,unsignedMode=0666) |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor. | |
std::error_code | openFileForReadWrite (constTwine &Name, int &ResultFD,CreationDisposition Disp,OpenFlags Flags,unsignedMode=0666) |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor. | |
Expected<file_t > | openNativeFileForReadWrite (constTwine &Name,CreationDisposition Disp,OpenFlags Flags,unsignedMode=0666) |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor. | |
std::error_code | openFileForRead (constTwine &Name, int &ResultFD,OpenFlags Flags=OF_None,SmallVectorImpl<char > *RealPath=nullptr) |
Opens the file with the given name in a read-only mode, returning its open file descriptor. | |
Expected<file_t > | openNativeFileForRead (constTwine &Name,OpenFlags Flags=OF_None,SmallVectorImpl<char > *RealPath=nullptr) |
Opens the file with the given name in a read-only mode, returning its open file descriptor. | |
std::error_code | tryLockFile (int FD, std::chrono::milliseconds Timeout=std::chrono::milliseconds(0)) |
Try to locks the file during the specified time. | |
std::error_code | lockFile (int FD) |
Lock the file. | |
std::error_code | unlockFile (int FD) |
Unlock the file. | |
std::error_code | closeFile (file_t &F) |
Close the file object. | |
std::error_code | changeFileOwnership (int FD,uint32_t Owner,uint32_t Group) |
Change ownership of a file. | |
std::error_code | getUniqueID (constTwine Path,UniqueID &Result) |
ErrorOr<space_info > | disk_space (constTwine &Path) |
Get disk space usage information. | |
std::string | getMainExecutable (constchar *argv0, void *MainExecAddr) |
Return the path to the main executable, given the value of argv[0] from program startup and the address of main itself. | |
typedef intllvm::sys::fs::file_t |
Definition at line55 of fileFileSystem.h.
anonymous enum : size_t |
Default chunk size forreadNativeFileToEOF().
Enumerator | |
---|---|
DefaultReadChunkSize |
Definition at line1011 of fileFileSystem.h.
| strong |
Enumerator | |
---|---|
Exist | |
Write | |
Execute |
Definition at line443 of fileFileSystem.h.
Definition at line722 of fileFileSystem.h.
| strong |
An enumeration for the file system's view of the type.
Enumerator | |
---|---|
status_error | |
file_not_found | |
regular_file | |
directory_file | |
symlink_file | |
block_file | |
character_file | |
fifo_file | |
socket_file | |
type_unknown |
Definition at line61 of fileFileSystem.h.
Enumerator | |
---|---|
FA_Read | |
FA_Write |
Definition at line744 of fileFileSystem.h.
Definition at line749 of fileFileSystem.h.
Definition at line81 of fileFileSystem.h.
std::error_code llvm::sys::fs::access | ( | constTwine & | Path, |
AccessMode | Mode | ||
) |
Can the file be accessed?
Path | Input path. |
Referenced bycan_write(),createUniqueEntity(),exists(), andllvm::LockFileManager::waitForUnlock().
Can we execute this file?
Path | Input path. |
Referenced byllvm::object::writeUniversalBinary().
Can we write this file?
Path | Input path. |
Definition at line470 of fileFileSystem.h.
Change ownership of a file.
Owner | The owner of the file to change to. |
Group | The group of the file to change to. |
Referenced byllvm::FilePermissionsApplier::apply().
std::error_code llvm::sys::fs::closeFile | ( | file_t & | F | ) |
Close the file object.
This should be used instead of ::close for portability. On error, the caller should assume the file is closed, as is the case forProcess::SafelyCloseFileDescriptor
F | On input, this is the file to close. On output, the file is set to kInvalidFile. |
Referenced byllvm::NewArchiveMember::getFile(),llvm::MemoryBuffer::getFileAsStream(),getFileAux(),llvm::orc::loadLinkableFile(),llvm::orc::loadMachORelocatableObject(),llvm::xray::loadProfile(),llvm::xray::loadTraceFile(),loadYAML(),llvm::localCache(),llvm::streamFile(), andllvm::InteractiveModelRunner::~InteractiveModelRunner().
| inline |
Converts from a Posix file descriptor number to a native file handle.
On Windows, this retreives the underlying handle. On non-Windows, this is a no-op.
Definition at line986 of fileFileSystem.h.
Referenced byllvm::LTOModule::createFromOpenFileSlice(),createOnDiskBuffer(),llvm::localCache(), andllvm::InteractiveModelRunner::~InteractiveModelRunner().
Copy the contents ofFrom toTo.
From | The path to copy from. |
To | The path to copy to. This is created. |
Definition at line1016 of filePath.cpp.
ReferencesCD_CreateAlways,copy_file_internal(),From,OF_None,openFileForRead(), andopenFileForWrite().
Referenced byllvm::FileCollector::copyFiles(),llvm::sys::fs::TempFile::keep(), andllvm::ThinLTOCodeGenerator::writeGeneratedObject().
Copy the contents ofFrom toTo.
From | The path to copy from. |
ToFD | The open file descriptor of the destination file. |
Definition at line1035 of filePath.cpp.
Referencescopy_file_internal(),From,OF_None, andopenFileForRead().
| static |
Definition at line991 of filePath.cpp.
Referencesllvm::errnoAsErrorCode(),llvm::support::endian::read(), andllvm::write().
Referenced bycopy_file().
std::error_code llvm::sys::fs::create_directories | ( | constTwine & | path, |
bool | IgnoreExisting =true , | ||
perms | Perms =owner_all | group_all | ||
) |
Create all the non-existent directories in path.
path | Directories to create. |
Definition at line967 of filePath.cpp.
Referencescreate_directories(),create_directory(),llvm::StringRef::empty(),llvm::no_such_file_or_directory,P, andllvm::sys::path::parent_path().
Referenced bycodegen(),llvm::FileCollector::copyFiles(),create_directories(),llvm::logicalview::LVSplitContext::createSplitFolder(),llvm::lto::getThinLTOOutputFile(),llvm::localCache(),prepareDumpIRFileDescriptor(), andllvm::ThinLTOCodeGenerator::run().
std::error_code llvm::sys::fs::create_directory | ( | constTwine & | path, |
bool | IgnoreExisting =true , | ||
perms | Perms =owner_all|group_all | ||
) |
Create the directory in path.
path | Directory to create. |
Referenced bycreate_directories(),createUniqueEntity(), andllvm::unittest::TempDir::TempDir().
Create a hard link fromfrom toto, or return an error.
to | The path to hard link to. |
from | The path to hard link from. This is created. |
Referenced byllvm::ThinLTOCodeGenerator::writeGeneratedObject().
Create a link fromfrom toto.
The link may be a soft or a hard link, depending on the platform. The caller may not assume which one. Currently on windows it creates a hard link since soft links require extra privileges. On unix, it creates a soft link since hard links don't work on SMB file systems.
to | The path to hard link to. |
from | The path to hard link from. This is created. |
Referenced byllvm::LockFileManager::LockFileManager(), andllvm::unittest::TempLink::TempLink().
| static |
Definition at line842 of filePath.cpp.
Referencesall_read,all_write,assert(),createUniqueEntity(),llvm::StringRef::npos, andP.
| static |
Definition at line855 of filePath.cpp.
ReferencescreateTemporaryFile(), andllvm::StringRef::empty().
std::error_code llvm::sys::fs::createTemporaryFile | ( | constTwine & | Prefix, |
StringRef | Suffix, | ||
int & | ResultFD, | ||
SmallVectorImpl<char > & | ResultPath, | ||
OpenFlags | Flags =OF_None | ||
) |
Create a file in the system temporary directory.
The filename is of the form prefix-random_chars.suffix. Since the directory is not know to the caller, Prefix and Suffix cannot have path separators. The files are created with mode 0600.
This should be used for things like a temporary .s that is removed after running the assembler.
Definition at line863 of filePath.cpp.
ReferencescreateTemporaryFile(), andFS_File.
Referenced byllvm::createGraphFilename(),createTemporaryFile(),getPotentiallyUniqueTempFileName(),llvm::prepareTempFiles(),printSymbolizedStackTrace(), andllvm::unittest::TempFile::TempFile().
std::error_code llvm::sys::fs::createTemporaryFile | ( | constTwine & | Prefix, |
StringRef | Suffix, | ||
SmallVectorImpl<char > & | ResultPath, | ||
OpenFlags | Flags =OF_None | ||
) |
Simpler version for clients that don't want an open file.
An empty file will still be created.
Definition at line871 of filePath.cpp.
ReferencescreateTemporaryFile().
std::error_code llvm::sys::fs::createUniqueDirectory | ( | constTwine & | Prefix, |
SmallVectorImpl<char > & | ResultPath | ||
) |
Definition at line885 of filePath.cpp.
ReferencescreateUniqueEntity(), andFS_Dir.
Referenced byllvm::unittest::TempDir::TempDir().
std::error_code llvm::sys::fs::createUniqueFile | ( | constTwine & | Model, |
int & | ResultFD, | ||
SmallVectorImpl<char > & | ResultPath, | ||
OpenFlags | Flags =OF_None , | ||
unsigned | Mode =all_read | all_write | ||
) |
Create a uniquely named file.
Generates a unique path suitable for a temporary file and then opens it as a file. The name is based onModel with '' replaced by a random char in [0-9a-f]. IfModel is not an absolute path, the temporary file will be created in the current directory.
Example: clang-%%-%%-%%-%%-%%.s => clang-a0-b1-c2-d3-e4.s
This is an atomic operation. Either the file is created and opened, or the file system is left untouched.
The intended use is for files that are to be kept, possibly after renaming them. For example, when running 'clang -c foo.o', the file can be first created as foo-abc123.o and then renamed.
Model | Name to base unique path off of. |
ResultFD | Set to the opened file's file descriptor. |
ResultPath | Set to the opened file's absolute path. |
Flags | Set to the opened file's flags. |
Mode | Set to the opened file's permissions. |
Definition at line822 of filePath.cpp.
ReferencescreateUniqueEntity(), andFS_File.
Referenced byllvm::sys::fs::TempFile::create(),createUniqueFile(), andllvm::LockFileManager::LockFileManager().
std::error_code llvm::sys::fs::createUniqueFile | ( | constTwine & | Model, |
SmallVectorImpl<char > & | ResultPath, | ||
unsigned | Mode =all_read | all_write | ||
) |
Simpler version for clients that don't want an open file.
An empty file will still be created.
Definition at line829 of filePath.cpp.
ReferencescreateUniqueFile(), andOF_None.
void llvm::sys::fs::createUniquePath | ( | constTwine & | Model, |
SmallVectorImpl<char > & | ResultPath, | ||
bool | MakeAbsolute | ||
) |
Create a potentially unique file name but does not create it.
Generates a unique path suitable for a temporary file but does not open or create the file. The name is based onModel with '' replaced by a random char in [0-9a-f]. IfMakeAbsolute is true then the system's temp directory is prepended first. IfMakeAbsolute is false the current directory will be used instead.
This function does not check if the file exists. If you want to be sure that the file does not yet exist, you should use enough '' characters in your model to ensure this. Each '' gives 4-bits of entropy so you can use 32 of them to get 128 bits of entropy.
Example: clang-%%-%%-%%-%%-%%.s => clang-a0-b1-c2-d3-e4.s
Model | Name to base unique path off of. |
ResultPath | Set to the file's path. |
MakeAbsolute | Whether to use the system temp directory. |
Definition at line796 of filePath.cpp.
Referencesllvm::sys::path::append(),llvm::sys::Process::GetRandomNumber(),llvm::sys::path::is_absolute(),llvm::SmallVectorTemplateBase< T, bool >::pop_back(),llvm::SmallVectorTemplateBase< T, bool >::push_back(),llvm::SmallVectorBase< Size_T >::size(),llvm::SmallVectorImpl< T >::swap(), andllvm::sys::path::system_temp_directory().
Referenced bycreateUniqueEntity(), andllvm::DotCfgChangeReporter::handleFunctionCompare().
std::error_code llvm::sys::fs::current_path | ( | SmallVectorImpl<char > & | result | ) |
Get the current path.
result | Holds the current path on return. |
Referenced bymake_absolute().
ErrorOr<space_info > llvm::sys::fs::disk_space | ( | constTwine & | Path | ) |
Get disk space usage information.
Note: Users must be careful about "Time Of Check, Time Of Use" kind of bug. Note: Windows reports results according to the quota allocated to the user.
Path | Input path. |
Referenced byllvm::pruneCache().
Simpler version of equivalent for clients that don't need to differentiate between an error and false.
Definition at line499 of fileFileSystem.h.
ReferencesA,B, andequivalent().
Do paths represent the same thing?
assert(status_known(A) || status_known(B));
A | Input path A. |
B | Input path B. |
result | Set to true if stat(A) and stat(B) have the same device and inode (or equivalent). |
bool llvm::sys::fs::equivalent | ( | file_status | A, |
file_status | B | ||
) |
Dofile_status's represent the same thing?
A | Inputfile_status. |
B | Inputfile_status. |
assert(status_known(A) || status_known(B));
Referenced byequivalent(),llvm::sys::Process::FindInEnvPath(), andllvm::MachO::shouldSkipSymLink().
bool llvm::sys::fs::exists | ( | constbasic_file_status & | status | ) |
Does file exist?
status | Abasic_file_status previously returned from stat. |
Definition at line1077 of filePath.cpp.
Referencesfile_not_found,status(), andstatus_known().
Referenced byllvm::ListeningSocket::createUnix(),llvm::object::BuildIDFetcher::fetch(),llvm::sys::Process::FindInEnvPath(),findInputFile(),getFilename(),is_other(),llvm::LockFileManager::LockFileManager(),llvm::pdb::InputFile::open(),llvm::orc::DumpObjects::operator()(),printMarkupStackTrace(),printSymbolizedStackTrace(),searchForObj(),llvm::LockFileManager::waitForUnlock(), andllvm::ThinLTOCodeGenerator::writeGeneratedObject().
Does file exist?
Path | Input path. |
Definition at line456 of fileFileSystem.h.
void llvm::sys::fs::expand_tilde | ( | constTwine & | path, |
SmallVectorImpl<char > & | output | ||
) |
Expands ~ expressions to the user's home directory.
On Unix ~user directories are resolved as well.
path | The path to resolve. |
Referenced byllvm::DotCfgChangeReporter::registerCallbacks().
Get file size.
Path | Input path. |
Result | Set to the size of the file inPath. |
Definition at line684 of fileFileSystem.h.
Referencesstatus().
Referenced byllvm::xray::loadInstrumentationMap(),llvm::xray::loadProfile(), andllvm::xray::loadTraceFile().
Does status represent a directory?
Path | The path to get the type of. |
Follow | For symbolic links, indicates whether to return the file type of the link itself, or of the target. |
Definition at line1085 of filePath.cpp.
Referencesstatus(),status_error, andllvm::sys::fs::basic_file_status::type().
Return the path to the main executable, given the value of argv[0] from program startup and the address of main itself.
In extremis, this function may fail and return an empty path.
Referenced byprintMarkupStackTrace(), andprintSymbolizedStackTrace().
Get file permissions.
Path | File to get permissions from. |
Definition at line1151 of filePath.cpp.
Referencesstatus().
Referenced byllvm::FileCollector::copyFiles().
std::error_code llvm::sys::fs::getPotentiallyUniqueFileName | ( | constTwine & | Model, |
SmallVectorImpl<char > & | ResultPath | ||
) |
Get a unique name, not currently exisiting in the filesystem.
Subject to race conditions, prefer to use createUniqueFile instead.
Similar to createUniqueFile, but instead of creating a file only checks if it exists. This function is subject to race conditions, if you want to use the returned name to actually create a file, use createUniqueFile instead.
Definition at line893 of filePath.cpp.
ReferencescreateUniqueEntity(), andFS_Name.
std::error_code llvm::sys::fs::getPotentiallyUniqueTempFileName | ( | constTwine & | Prefix, |
StringRef | Suffix, | ||
SmallVectorImpl<char > & | ResultPath | ||
) |
Get a unique temporary file name, not currently exisiting in the filesystem.
Subject to race conditions, prefer to use createTemporaryFile instead.
Similar to createTemporaryFile, but instead of creating a file only checks if it exists. This function is subject to race conditions, if you want to use the returned name to actually create a file, use createTemporaryFile instead.
Definition at line900 of filePath.cpp.
ReferencescreateTemporaryFile(), andFS_Name.
file_t llvm::sys::fs::getStderrHandle | ( | ) |
Return an open handle to standard error.
On Unix, this is typically FD 2. Returns kInvalidFile when the stream is closed.
file_t llvm::sys::fs::getStdinHandle | ( | ) |
Return an open handle to standard in.
On Unix, this is typically FD 0. Returns kInvalidFile when the stream is closed.
Referenced byllvm::MemoryBuffer::getSTDIN().
file_t llvm::sys::fs::getStdoutHandle | ( | ) |
Return an open handle to standard out.
On Unix, this is typically FD 1. Returns kInvalidFile when the stream is closed.
unsigned llvm::sys::fs::getUmask | ( | ) |
Get file creation mode mask of the process.
Referenced byllvm::FilePermissionsApplier::apply().
Definition at line787 of filePath.cpp.
Referencesstatus().
Referenced byllvm::OpenMPIRBuilder::getTargetEntryUniqueInfo().
bool llvm::sys::fs::is_directory | ( | constbasic_file_status & | status | ) |
Does status represent a directory?
status | Abasic_file_status previously returned from status. |
Definition at line1092 of filePath.cpp.
Referencesdirectory_file, andstatus().
Referenced byllvm::FileCollectorBase::addDirectory(),llvm::object::MachOObjectFile::findDsymObjectMembers(),is_directory(),is_other(),llvm::pruneCache(), andllvm::ThinLTOCodeGenerator::run().
Simpler version of is_directory for clients that don't need to differentiate between an error and false.
Definition at line555 of fileFileSystem.h.
Referencesis_directory().
Is path a directory?
path | Input path. |
result | Set to true ifpath is a directory (after following symlinks, false if it is not. Undefined otherwise. |
Definition at line1096 of filePath.cpp.
Referencesis_directory(), andstatus().
Simpler version of is_local for clients that don't need to differentiate between an error and false.
Definition at line518 of fileFileSystem.h.
Referencesis_local().
Is the file mounted on a local filesystem?
path | Input path. |
result | Set to true ifpath is on fixed media such as a hard disk, false if it is not. |
Referenced byis_local().
| inline |
Simpler version of is_local accepting an open file descriptor for clients that don't need to differentiate between an error and false.
Definition at line525 of fileFileSystem.h.
Referencesis_local().
std::error_code llvm::sys::fs::is_local | ( | int | FD, |
bool & | result | ||
) |
Version of is_local accepting an open file descriptor.
bool llvm::sys::fs::is_other | ( | constbasic_file_status & | status | ) |
Does this status represent something that exists but is not a directory or regular file?
status | Abasic_file_status previously returned from status. |
Definition at line1128 of filePath.cpp.
Referencesexists(),is_directory(),is_regular_file(), andstatus().
Referenced byis_other().
Is path something that exists but is not a directory, regular file, or symlink?
path | Input path. |
result | Set to true ifpath exists, but is not a directory, regular file, or a symlink, false if it does not. Undefined otherwise. |
Definition at line1134 of filePath.cpp.
Referencesis_other(), andstatus().
bool llvm::sys::fs::is_regular_file | ( | constbasic_file_status & | status | ) |
Does status represent a regular file?
status | Abasic_file_status previously returned from status. |
Definition at line1104 of filePath.cpp.
Referencesregular_file, andstatus().
Referenced byfindSrcDirMap(),is_other(), andis_regular_file().
Simpler version of is_regular_file for clients that don't need to differentiate between an error and false.
Definition at line577 of fileFileSystem.h.
Referencesis_regular_file().
Is path a regular file?
path | Input path. |
result | Set to true ifpath is a regular file (after following symlinks), false if it is not. Undefined otherwise. |
Definition at line1108 of filePath.cpp.
Referencesis_regular_file(), andstatus().
bool llvm::sys::fs::is_symlink_file | ( | constbasic_file_status & | status | ) |
Does status represent a symlink file?
status | Abasic_file_status previously returned from status. |
Definition at line1116 of filePath.cpp.
Referencesstatus(), andsymlink_file.
Referenced byis_symlink_file().
Simpler version of is_symlink_file for clients that don't need to differentiate between an error and false.
Definition at line601 of fileFileSystem.h.
Referencesis_symlink_file().
Is path a symlink file?
path | Input path. |
result | Set to true ifpath is a symlink file, false if it is not. Undefined otherwise. |
Definition at line1120 of filePath.cpp.
Referencesis_symlink_file(), andstatus().
std::error_code llvm::sys::fs::lockFile | ( | int | FD | ) |
Lock the file.
This function acts astryLockFile but it waits infinitely.
Referenced byllvm::raw_fd_ostream::lock().
void llvm::sys::fs::make_absolute | ( | constTwine & | current_directory, |
SmallVectorImpl<char > & | path | ||
) |
Makepath an absolute path.
Makespath absolute using thecurrent_directory if it is not already. An emptypath will result in thecurrent_directory.
/absolute/path => /absolute/path relative/../path => <current-directory>/relative/../path
path | A path that is modified to be an absolute path. |
Definition at line906 of filePath.cpp.
Referencesllvm::sys::path::append(),llvm::StringRef::begin(),llvm::SmallVectorTemplateCommon< T, typename >::data(),llvm::StringRef::end(),llvm::sys::path::has_root_directory(),llvm::sys::path::has_root_name(),llvm_unreachable,llvm::sys::path::relative_path(),llvm::sys::path::root_directory(),llvm::sys::path::root_name(),llvm::SmallVectorBase< Size_T >::size(),llvm::SmallVectorImpl< T >::swap(), andllvm::Twine::toVector().
Referenced byllvm::canonicalizePath(),llvm::vfs::RedirectingFileSystem::create(),emitExternalFile(),llvm::AsmPrinter::emitRemarksSection(),findSrcDirMap(),llvm::LockFileManager::LockFileManager(),make_absolute(),llvm::MachO::make_relative(),makeAbsolute(),llvm::vfs::FileSystem::makeAbsolute(), andllvm::DotCfgChangeReporter::registerCallbacks().
std::error_code llvm::sys::fs::make_absolute | ( | SmallVectorImpl<char > & | path | ) |
Makepath an absolute path.
Makespath absolute using the current directory if it is not already. An emptypath will result in the current directory.
/absolute/path => /absolute/path relative/../path => <current-directory>/relative/../path
path | A path that is modified to be an absolute path. |
Definition at line955 of filePath.cpp.
Referencescurrent_path(),llvm::sys::path::is_absolute(), andmake_absolute().
ErrorOr<MD5::MD5Result > llvm::sys::fs::md5_contents | ( | constTwine & | Path | ) |
Version of compute_md5 that doesn't require an open file descriptor.
Definition at line1067 of filePath.cpp.
Referencesmd5_contents(),OF_None, andopenFileForRead().
ErrorOr<MD5::MD5Result > llvm::sys::fs::md5_contents | ( | int | FD | ) |
Compute anMD5 hash of a file's contents.
FD | Input file descriptor. |
Definition at line1047 of filePath.cpp.
Referencesllvm::errnoAsErrorCode(),llvm::MD5::final(),llvm::support::endian::read(), andllvm::MD5::update().
Referenced bymd5_contents().
std::error_code llvm::sys::fs::openFile | ( | constTwine & | Name, |
int & | ResultFD, | ||
CreationDisposition | Disp, | ||
FileAccess | Access, | ||
OpenFlags | Flags, | ||
unsigned | Mode =0666 | ||
) |
Opens a file with the specified creation disposition, access mode, and flags and returns a file descriptor.
The caller is responsible for closing the file descriptor once they are finished with it.
Name | The path of the file to open, relative or absolute. |
ResultFD | If the file could be opened successfully, its descriptor is stored in this location. Otherwise, this is set to -1. |
Disp | Value specifying the existing-file behavior. |
Access | Value specifying whether to open the file in read, write, or read-write mode. |
Flags | Additional flags. |
Mode | The access permissions of the file, represented in octal. |
Referenced byopenFileForReadWrite(),openFileForWrite(), andprepareDumpIRFileDescriptor().
std::error_code llvm::sys::fs::openFileForRead | ( | constTwine & | Name, |
int & | ResultFD, | ||
OpenFlags | Flags =OF_None , | ||
SmallVectorImpl<char > * | RealPath =nullptr | ||
) |
Opens the file with the given name in a read-only mode, returning its open file descriptor.
The caller is responsible for closing the file descriptor once they are finished with it.
Name | The path of the file to open, relative or absolute. |
ResultFD | If the file could be opened successfully, its descriptor is stored in this location. Otherwise, this is set to -1. |
RealPath | If nonnull, extra work is done to determine the real path of the opened file, and that path is stored in this location. |
Referenced bycopy_file(), andmd5_contents().
| inline |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the file descriptor once they are finished with it.
Name | The path of the file to open, relative or absolute. |
ResultFD | If the file could be opened successfully, its descriptor is stored in this location. Otherwise, this is set to -1. |
Flags | Additional flags used to determine whether the file should be opened in, for example, read-write or in write-only mode. |
Mode | The access permissions of the file, represented in octal. |
Definition at line1099 of fileFileSystem.h.
ReferencesFA_Read,FA_Write,Mode,Name, andopenFile().
Referenced bycreateUniqueEntity(), andgetFD().
| inline |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the file descriptor once they are finished with it.
Name | The path of the file to open, relative or absolute. |
ResultFD | If the file could be opened successfully, its descriptor is stored in this location. Otherwise, this is set to -1. |
Flags | Additional flags used to determine whether the file should be opened in, for example, read-write or in write-only mode. |
Mode | The access permissions of the file, represented in octal. |
Definition at line1058 of fileFileSystem.h.
ReferencesFA_Write,Mode,Name, andopenFile().
Referenced byllvm::FilePermissionsApplier::apply(),copy_file(),copyAccessAndModificationTime(),getFD(),llvm::prepareTempFiles(),llvm::unittest::TempFile::TempFile(), andllvm::WriteGraph().
Expected<file_t > llvm::sys::fs::openNativeFile | ( | constTwine & | Name, |
CreationDisposition | Disp, | ||
FileAccess | Access, | ||
OpenFlags | Flags, | ||
unsigned | Mode =0666 | ||
) |
Opens a file with the specified creation disposition, access mode, and flags and returns a platform-specific file object.
The caller is responsible for closing the file object once they are finished with it.
Name | The path of the file to open, relative or absolute. |
Disp | Value specifying the existing-file behavior. |
Access | Value specifying whether to open the file in read, write, or read-write mode. |
Flags | Additional flags. |
Mode | The access permissions of the file, represented in octal. |
Referenced byopenNativeFileForReadWrite(), andopenNativeFileForWrite().
Expected<file_t > llvm::sys::fs::openNativeFileForRead | ( | constTwine & | Name, |
OpenFlags | Flags =OF_None , | ||
SmallVectorImpl<char > * | RealPath =nullptr | ||
) |
Opens the file with the given name in a read-only mode, returning its open file descriptor.
The caller is responsible for closing the freeing the file once they are finished with it.
Name | The path of the file to open, relative or absolute. |
RealPath | If nonnull, extra work is done to determine the real path of the opened file, and that path is stored in this location. |
Referenced byllvm::NewArchiveMember::getFile(),llvm::MemoryBuffer::getFileAsStream(),getFileAux(),llvm::xray::loadInstrumentationMap(),llvm::orc::loadLinkableFile(),llvm::orc::loadMachORelocatableObject(),llvm::xray::loadProfile(),llvm::xray::loadTraceFile(),llvm::localCache(), andllvm::streamFile().
| inline |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the freeing the file once they are finished with it.
Name | The path of the file to open, relative or absolute. |
Flags | Additional flags used to determine whether the file should be opened in, for example, read-write or in write-only mode. |
Mode | The access permissions of the file, represented in octal. |
Definition at line1119 of fileFileSystem.h.
ReferencesFA_Read,FA_Write,Mode,Name, andopenNativeFile().
Referenced bygetReadWriteFile().
| inline |
Opens the file with the given name in a write-only or read-write mode, returning its open file descriptor.
If the file does not exist, it is created.
The caller is responsible for closing the freeing the file once they are finished with it.
Name | The path of the file to open, relative or absolute. |
Flags | Additional flags used to determine whether the file should be opened in, for example, read-write or in write-only mode. |
Mode | The access permissions of the file, represented in octal. |
Definition at line1077 of fileFileSystem.h.
ReferencesFA_Write,Mode,Name, andopenNativeFile().
Definition at line111 of fileFileSystem.h.
Definition at line119 of fileFileSystem.h.
| inline |
Definition at line933 of fileFileSystem.h.
Definition at line924 of fileFileSystem.h.
Definition at line107 of fileFileSystem.h.
| inline |
Definition at line937 of fileFileSystem.h.
Definition at line928 of fileFileSystem.h.
Definition at line115 of fileFileSystem.h.
Definition at line123 of fileFileSystem.h.
Expected< size_t > llvm::sys::fs::readNativeFile | ( | file_t | FileHandle, |
MutableArrayRef<char > | Buf | ||
) |
ReadsBuf.size()
bytes fromFileHandle
intoBuf
.
Returns the number of bytes actually read. On Unix, this is equivalent toreturn ::read(FD, Buf.data(), Buf.size())
, with error reporting. Returns 0 when reaching EOF.
FileHandle | File to read from. |
Buf | Buffer to read into. |
Referenced byreadNativeFileToEOF().
Expected< size_t > llvm::sys::fs::readNativeFileSlice | ( | file_t | FileHandle, |
MutableArrayRef<char > | Buf, | ||
uint64_t | Offset | ||
) |
ReadsBuf.size()
bytes fromFileHandle
at offsetOffset
intoBuf
.
If 'pread' is available, this will use that, otherwise it will use 'lseek'. Returns the number of bytes actually read. Returns 0 when reaching EOF.
FileHandle | File to read from. |
Buf | Buffer to read into. |
Offset | Offset into the file at which the read should occur. |
Referenced bygetOpenFileImpl().
Error llvm::sys::fs::readNativeFileToEOF | ( | file_t | FileHandle, |
SmallVectorImpl<char > & | Buffer, | ||
ssize_t | ChunkSize =DefaultReadChunkSize | ||
) |
Reads fromFileHandle
until EOF, appending toBuffer
in chunks of sizeChunkSize
.
This callsreadNativeFile() in a loop. OnError, previous chunks that were read successfully are left inBuffer
and returned.
Note: For reading the final chunk at EOF,Buffer's
capacity needs extra storage ofChunkSize
.
FileHandle | File to read from. |
Buffer | Where to put the file content. |
ChunkSize | Size of chunks. |
Definition at line1174 of filePath.cpp.
Referencesllvm::SmallVectorTemplateCommon< T, typename >::begin(),llvm::make_scope_exit(),readNativeFile(),llvm::SmallVectorImpl< T >::resize_for_overwrite(),llvm::SmallVectorBase< Size_T >::size(),Size,llvm::Error::success(),llvm::Expected< T >::takeError(), andllvm::SmallVectorImpl< T >::truncate().
Referenced bygetMemoryBufferForStream().
std::error_code llvm::sys::fs::real_path | ( | constTwine & | path, |
SmallVectorImpl<char > & | output, | ||
bool | expand_tilde =false | ||
) |
Collapse all .
and .. patterns, resolve all symlinks, and optionally expand ~ expressions to the user's home directory.
path | The path to resolve. |
output | The location to store the resolved path. |
expand_tilde | If true, resolves ~ expressions to the user's home directory. |
Referenced byllvm::dwarf_linker::parallel::CompileUnit::getFileName(),isCaseSensitivePath(),llvm::dwarf_linker::classic::CachedPathResolver::resolve(), andllvm::unittest::TempDir::TempDir().
Remove path.
Equivalent to POSIXremove().
path | Input path. |
Referenced bycleanUpTempFilesImpl(),llvm::LTOCodeGenerator::compileOptimized(),llvm::sys::fs::TempFile::discard(),ExecGraphViewer(),llvm::DotCfgChangeReporter::handleFunctionCompare(),llvm::sys::fs::TempFile::keep(),llvm::LockFileManager::LockFileManager(),llvm::pruneCache(),llvm::FileRemover::setFile(),llvm::LockFileManager::unsafeRemoveLockFile(),llvm::ThinLTOCodeGenerator::writeGeneratedObject(),llvm::CleanupInstaller::~CleanupInstaller(),llvm::FileRemover::~FileRemover(),llvm::LockFileManager::~LockFileManager(),llvm::unittest::TempFile::~TempFile(), andllvm::unittest::TempLink::~TempLink().
Recursively delete a directory.
path | Input path. |
Referenced byllvm::unittest::TempDir::~TempDir().
Renamefrom toto.
Files are renamed as if by POSIXrename(), except that on Windows there may be a short interval of time during which the destination file does not exist.
from | The path to rename from. |
to | The path to rename to. This is created. |
Referenced byllvm::sys::fs::TempFile::keep().
std::error_code llvm::sys::fs::resize_file | ( | int | FD, |
uint64_t | Size | ||
) |
Resize path to size.
File is resized as if by POSIX truncate().
FD | Input file descriptor. |
Size | Size to resize to. |
Referenced byresize_file_before_mapping_readwrite().
| inline |
ResizeFD
toSize
before mappingmapped_file_region::readwrite.
On non-Windows, this callsresize_file(). On Windows, this is a no-op, since the subsequent mapping (viaCreateFileMapping
) automatically extends the file.
Definition at line411 of fileFileSystem.h.
Referencesresize_file(), andSize.
Referenced bycreateOnDiskBuffer().
Set the current path.
path | The path to set. |
std::error_code llvm::sys::fs::setLastAccessAndModificationTime | ( | int | FD, |
TimePoint<> | AccessTime, | ||
TimePoint<> | ModificationTime | ||
) |
Set the file modification and access time.
Referenced byllvm::FilePermissionsApplier::apply(),copyAccessAndModificationTime(), andsetLastAccessAndModificationTime().
| inline |
Simpler version that sets both file modification and access time to the same time.
Definition at line703 of fileFileSystem.h.
ReferencessetLastAccessAndModificationTime().
Set file permissions.
Path | File to set permissions on. |
Permissions | New file permissions. |
Referenced byllvm::FilePermissionsApplier::apply(), andllvm::FileCollector::copyFiles().
std::error_code llvm::sys::fs::setPermissions | ( | int | FD, |
perms | Permissions | ||
) |
Vesion of setPermissions accepting a file descriptor.
TODO Delete the path based overload once we implement the FD based overload on Windows.
std::error_code llvm::sys::fs::status | ( | constTwine & | path, |
file_status & | result, | ||
bool | follow =true | ||
) |
Get file status as if by POSIX stat().
path | Input path. |
result | Set to the file status. |
follow | When true, follows symlinks. Otherwise, the symlink itself is statted. |
Referenced byllvm::FilePermissionsApplier::apply(),llvm::FileCollector::copyFiles(),llvm::FileOutputBuffer::create(),llvm::FilePermissionsApplier::create(),exists(),file_size(),llvm::object::MachOObjectFile::findDsymObjectMembers(),get_file_type(),llvm::NewArchiveMember::getFile(),getOpenFileImpl(),getPermissions(),getReadWriteFile(),getUniqueID(),llvm::sys::fs::recursive_directory_iterator::increment(),is_directory(),is_other(),is_regular_file(),is_symlink_file(),llvm::pruneCache(),llvm::MachO::shouldSkipSymLink(), andshouldUseMmap().
std::error_code llvm::sys::fs::status | ( | int | FD, |
file_status & | Result | ||
) |
A version for when a file descriptor is already available.
bool llvm::sys::fs::status_known | ( | constbasic_file_status & | s | ) |
Is status available?
s | Input file status. |
Definition at line1081 of filePath.cpp.
Referencesstatus_error, andllvm::sys::fs::basic_file_status::type().
Referenced byexists().
Is status available?
path | Input path. |
result | Set to true ifstatus() != status_error. |
std::error_code llvm::sys::fs::tryLockFile | ( | int | FD, |
std::chrono::milliseconds | Timeout =std::chrono::milliseconds(0) | ||
) |
Try to locks the file during the specified time.
This function implements advisory locking on entire file. If it returnserrc::success, the file is locked by the calling process. Until the process unlocks the file by callingunlockFile, all attempts to lock the same file will fail/block. The process that locked the file may assume that none of other processes read or write this file, provided that all processes lock the file prior to accessing its content.
FD | The descriptor representing the file to lock. |
Timeout | Time in milliseconds that the process should wait before reporting lock failure. Zero value means try to get lock only once. |
Referenced byllvm::raw_fd_ostream::tryLockFor().
std::error_code llvm::sys::fs::unlockFile | ( | int | FD | ) |
Unlock the file.
FD | The descriptor representing the file to unlock. |
Referenced byllvm::sys::fs::FileLocker::unlock(), andllvm::sys::fs::FileLocker::~FileLocker().
Referenced byllvm::NewArchiveMember::getFile().