24 #include <sys/types.h>
34 #ifndef _ERRNO_T_DEFINED
35 #define _ERRNO_T_DEFINED
40 # pragma comment(lib, "advapi32.lib") // This provides CryptAcquireContextW.
41 # pragma comment(lib, "ole32.lib") // This provides CoTaskMemFree
69 const size_t MaxDirLen = MAX_PATH - 12;
81 CurPathLen = ::GetCurrentDirectoryW(0, NULL);
87 if ((Path8Str.
size() + CurPathLen) >= MaxDirLen &&
94 FullPath.append(CurPath);
103 if (
I->size() == 1 && *
I ==
".")
105 if (
I->size() == 2 && *
I ==
"..")
142 return std::string(PathNameUTF8.
data());
148 uint64_t FileID = (
static_cast<uint64_t
>(FileIndexHigh) << 32ULL) |
149 static_cast<uint64_t
>(FileIndexLow);
151 return UniqueID(VolumeSerialNumber, FileID);
155 ULARGE_INTEGER Avail, Total, Free;
156 if (!::GetDiskFreeSpaceExA(Path.
str().c_str(), &Avail, &Total, &Free))
158 space_info SpaceInfo;
160 (
static_cast<uint64_t
>(Total.HighPart) << 32) + Total.LowPart;
161 SpaceInfo.free = (
static_cast<uint64_t
>(Free.HighPart) << 32) + Free.LowPart;
162 SpaceInfo.available =
163 (
static_cast<uint64_t
>(Avail.HighPart) << 32) + Avail.LowPart;
169 Time.dwLowDateTime = LastAccessedTimeLow;
170 Time.dwHighDateTime = LastAccessedTimeHigh;
176 Time.dwLowDateTime = LastWriteTimeLow;
177 Time.dwHighDateTime = LastWriteTimeHigh;
183 DWORD len = MAX_PATH;
187 len = ::GetCurrentDirectoryW(cur_path.
capacity(), cur_path.
data());
195 }
while (len > cur_path.
capacity());
207 if (std::error_code ec =
widenPath(path, path_utf16))
210 if (!::CreateDirectoryW(path_utf16.
begin(), NULL)) {
211 DWORD LastError = ::GetLastError();
212 if (LastError != ERROR_ALREADY_EXISTS || !IgnoreExisting)
216 return std::error_code();
224 if (std::error_code ec =
widenPath(from, wide_from))
226 if (std::error_code ec =
widenPath(to, wide_to))
229 if (!::CreateHardLinkW(wide_from.
begin(), wide_to.
begin(), NULL))
232 return std::error_code();
239 std::error_code
remove(
const Twine &path,
bool IgnoreNonExisting) {
243 if (std::error_code EC =
status(path, ST)) {
246 return std::error_code();
249 if (std::error_code ec =
widenPath(path, path_utf16))
253 if (!::RemoveDirectoryW(
c_str(path_utf16))) {
258 return std::error_code();
260 if (!::DeleteFileW(
c_str(path_utf16))) {
265 return std::error_code();
272 if (std::error_code ec =
widenPath(from, wide_from))
274 if (std::error_code ec =
widenPath(to, wide_to))
277 std::error_code ec = std::error_code();
283 bool TryReplace =
true;
285 for (
int i = 0;
i < 2000;
i++) {
292 if (::ReplaceFileW(wide_to.
data(), wide_from.
data(), NULL, 0, NULL, NULL))
293 return std::error_code();
295 DWORD ReplaceError = ::GetLastError();
300 if (ReplaceError == ERROR_UNABLE_TO_MOVE_REPLACEMENT ||
301 ReplaceError == ERROR_UNABLE_TO_MOVE_REPLACEMENT_2) {
307 if (ReplaceError == ERROR_UNABLE_TO_REMOVE_REPLACED)
311 if (ReplaceError != ERROR_ACCESS_DENIED &&
312 ReplaceError != ERROR_FILE_NOT_FOUND &&
313 ReplaceError != ERROR_SHARING_VIOLATION)
317 if (::MoveFileExW(wide_from.
begin(), wide_to.
begin(),
318 MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING))
319 return std::error_code();
321 DWORD MoveError = ::GetLastError();
323 if (MoveError != ERROR_ACCESS_DENIED)
break;
329 std::error_code
resize_file(
int FD, uint64_t Size) {
330 #ifdef HAVE__CHSIZE_S
331 errno_t
error = ::_chsize_s(FD, Size);
333 errno_t error = ::_chsize(FD, Size);
335 return std::error_code(error, std::generic_category());
341 if (std::error_code EC =
widenPath(Path, PathUtf16))
344 DWORD Attributes = ::GetFileAttributesW(PathUtf16.
begin());
346 if (Attributes == INVALID_FILE_ATTRIBUTES) {
348 DWORD LastError = ::GetLastError();
349 if (LastError != ERROR_FILE_NOT_FOUND &&
350 LastError != ERROR_PATH_NOT_FOUND)
358 return std::error_code();
368 return A.FileIndexHigh == B.FileIndexHigh &&
369 A.FileIndexLow == B.FileIndexLow &&
370 A.FileSizeHigh == B.FileSizeHigh &&
371 A.FileSizeLow == B.FileSizeLow &&
372 A.LastAccessedTimeHigh == B.LastAccessedTimeHigh &&
373 A.LastAccessedTimeLow == B.LastAccessedTimeLow &&
374 A.LastWriteTimeHigh == B.LastWriteTimeHigh &&
375 A.LastWriteTimeLow == B.LastWriteTimeLow &&
376 A.VolumeSerialNumber == B.VolumeSerialNumber;
380 file_status fsA, fsB;
381 if (std::error_code ec =
status(A, fsA))
383 if (std::error_code ec =
status(B, fsB))
386 return std::error_code();
389 static bool isReservedName(
StringRef path) {
392 static const char *
const sReservedNames[] = {
"nul",
"con",
"prn",
"aux",
393 "com1",
"com2",
"com3",
"com4",
394 "com5",
"com6",
"com7",
"com8",
395 "com9",
"lpt1",
"lpt2",
"lpt3",
396 "lpt4",
"lpt5",
"lpt6",
"lpt7",
414 static std::error_code getStatus(HANDLE FileHandle, file_status &Result) {
415 if (FileHandle == INVALID_HANDLE_VALUE)
416 goto handle_status_error;
418 switch (::GetFileType(FileHandle)) {
421 case FILE_TYPE_UNKNOWN: {
422 DWORD Err = ::GetLastError();
426 return std::error_code();
432 return std::error_code();
435 return std::error_code();
438 BY_HANDLE_FILE_INFORMATION Info;
439 if (!::GetFileInformationByHandle(FileHandle, &Info))
440 goto handle_status_error;
443 file_type Type = (Info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
447 file_status(Type, Info.ftLastAccessTime.dwHighDateTime,
448 Info.ftLastAccessTime.dwLowDateTime,
449 Info.ftLastWriteTime.dwHighDateTime,
450 Info.ftLastWriteTime.dwLowDateTime,
451 Info.dwVolumeSerialNumber, Info.nFileSizeHigh,
452 Info.nFileSizeLow, Info.nFileIndexHigh, Info.nFileIndexLow);
453 return std::error_code();
457 DWORD LastError = ::GetLastError();
458 if (LastError == ERROR_FILE_NOT_FOUND ||
459 LastError == ERROR_PATH_NOT_FOUND)
461 else if (LastError == ERROR_SHARING_VIOLATION)
468 std::error_code
status(
const Twine &path, file_status &result) {
473 if (isReservedName(path8)) {
475 return std::error_code();
478 if (std::error_code ec =
widenPath(path8, path_utf16))
481 DWORD attr = ::GetFileAttributesW(path_utf16.
begin());
482 if (attr == INVALID_FILE_ATTRIBUTES)
483 return getStatus(INVALID_HANDLE_VALUE, result);
486 if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
488 ::CreateFileW(path_utf16.
begin(),
490 FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
493 FILE_FLAG_BACKUP_SEMANTICS,
496 return getStatus(INVALID_HANDLE_VALUE, result);
500 ::CreateFileW(path_utf16.
begin(), 0,
501 FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
502 NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0));
504 return getStatus(INVALID_HANDLE_VALUE, result);
506 return getStatus(h, result);
509 std::error_code
status(
int FD, file_status &Result) {
510 HANDLE FileHandle =
reinterpret_cast<HANDLE
>(_get_osfhandle(FD));
511 return getStatus(FileHandle, Result);
516 HANDLE FileHandle =
reinterpret_cast<HANDLE
>(_get_osfhandle(FD));
517 if (!SetFileTime(FileHandle, NULL, &FT, &FT))
519 return std::error_code();
522 std::error_code mapped_file_region::init(
int FD, uint64_t
Offset,
525 if (Size > std::numeric_limits<SIZE_T>::max())
528 HANDLE FileHandle =
reinterpret_cast<HANDLE
>(_get_osfhandle(FD));
529 if (FileHandle == INVALID_HANDLE_VALUE)
534 case readonly: flprotect = PAGE_READONLY;
break;
535 case readwrite: flprotect = PAGE_READWRITE;
break;
536 case priv: flprotect = PAGE_WRITECOPY;
break;
539 HANDLE FileMappingHandle =
540 ::CreateFileMappingW(FileHandle, 0, flprotect,
541 (Offset + Size) >> 32,
542 (Offset + Size) & 0xffffffff,
544 if (FileMappingHandle == NULL) {
549 DWORD dwDesiredAccess;
551 case readonly: dwDesiredAccess = FILE_MAP_READ;
break;
552 case readwrite: dwDesiredAccess = FILE_MAP_WRITE;
break;
553 case priv: dwDesiredAccess = FILE_MAP_COPY;
break;
555 Mapping = ::MapViewOfFile(FileMappingHandle,
560 if (Mapping == NULL) {
562 ::CloseHandle(FileMappingHandle);
567 MEMORY_BASIC_INFORMATION mbi;
568 SIZE_T Result = VirtualQuery(Mapping, &mbi,
sizeof(mbi));
571 ::UnmapViewOfFile(Mapping);
572 ::CloseHandle(FileMappingHandle);
575 Size = mbi.RegionSize;
580 ::CloseHandle(FileMappingHandle);
581 return std::error_code();
585 uint64_t offset, std::error_code &ec)
586 : Size(length), Mapping() {
587 ec =
init(fd, offset, mode);
592 mapped_file_region::~mapped_file_region() {
594 ::UnmapViewOfFile(Mapping);
597 uint64_t mapped_file_region::size()
const {
598 assert(Mapping &&
"Mapping failed but used anyway!");
602 char *mapped_file_region::data()
const {
603 assert(Mapping &&
"Mapping failed but used anyway!");
604 return reinterpret_cast<char*
>(Mapping);
607 const char *mapped_file_region::const_data()
const {
608 assert(Mapping &&
"Mapping failed but used anyway!");
609 return reinterpret_cast<const char*
>(Mapping);
612 int mapped_file_region::alignment() {
614 ::GetSystemInfo(&SysInfo);
615 return SysInfo.dwAllocationGranularity;
622 if (std::error_code ec =
widenPath(path, path_utf16))
626 if (path_utf16.
size() > 0 &&
628 path_utf16[path.
size() - 1] !=
L':') {
636 WIN32_FIND_DATAW FirstFind;
641 size_t FilenameLen = ::wcslen(FirstFind.cFileName);
642 while ((FilenameLen == 1 && FirstFind.cFileName[0] ==
L'.') ||
643 (FilenameLen == 2 && FirstFind.cFileName[0] ==
L'.' &&
644 FirstFind.cFileName[1] ==
L'.'))
645 if (!::FindNextFileW(FindHandle, &FirstFind)) {
646 DWORD LastError = ::GetLastError();
648 if (LastError == ERROR_NO_MORE_FILES)
652 FilenameLen = ::wcslen(FirstFind.cFileName);
656 if (std::error_code ec =
657 UTF16ToUTF8(FirstFind.cFileName, ::wcslen(FirstFind.cFileName),
658 directory_entry_name_utf8))
661 it.IterationHandle =
intptr_t(FindHandle.take());
663 path::append(directory_entry_path, directory_entry_name_utf8);
664 it.CurrentEntry = directory_entry(directory_entry_path);
666 return std::error_code();
670 if (it.IterationHandle != 0)
673 it.IterationHandle = 0;
674 it.CurrentEntry = directory_entry();
675 return std::error_code();
679 WIN32_FIND_DATAW FindData;
680 if (!::FindNextFileW(HANDLE(it.IterationHandle), &FindData)) {
681 DWORD LastError = ::GetLastError();
683 if (LastError == ERROR_NO_MORE_FILES)
688 size_t FilenameLen = ::wcslen(FindData.cFileName);
689 if ((FilenameLen == 1 && FindData.cFileName[0] ==
L'.') ||
690 (FilenameLen == 2 && FindData.cFileName[0] ==
L'.' &&
691 FindData.cFileName[1] ==
L'.'))
695 if (std::error_code ec =
696 UTF16ToUTF8(FindData.cFileName, ::wcslen(FindData.cFileName),
697 directory_entry_path_utf8))
700 it.CurrentEntry.replace_filename(
Twine(directory_entry_path_utf8));
701 return std::error_code();
708 if (std::error_code EC =
widenPath(Name, PathUTF16))
712 ::CreateFileW(PathUTF16.
begin(), GENERIC_READ,
713 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
714 NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
715 if (H == INVALID_HANDLE_VALUE) {
716 DWORD LastError = ::GetLastError();
721 if (LastError != ERROR_ACCESS_DENIED)
728 int FD = ::_open_osfhandle(
intptr_t(H), 0);
737 wchar_t RealPathUTF16[MAX_PATH];
739 ::GetFinalPathNameByHandleW(H, RealPathUTF16, MAX_PATH,
740 FILE_NAME_NORMALIZED);
741 if (CountChars > 0 && CountChars < MAX_PATH) {
744 if (!
UTF16ToUTF8(RealPathUTF16, CountChars, RealPathUTF8))
746 RealPathUTF8.
data() + strlen(RealPathUTF8.
data()));
751 return std::error_code();
758 "Cannot specify both 'excl' and 'append' file creation flags!");
762 if (std::error_code EC =
widenPath(Name, PathUTF16))
765 DWORD CreationDisposition;
767 CreationDisposition = CREATE_NEW;
769 CreationDisposition = OPEN_ALWAYS;
771 CreationDisposition = CREATE_ALWAYS;
773 DWORD Access = GENERIC_WRITE;
775 Access |= GENERIC_READ;
777 HANDLE H = ::CreateFileW(PathUTF16.
begin(), Access,
778 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
779 CreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
781 if (H == INVALID_HANDLE_VALUE) {
782 DWORD LastError = ::GetLastError();
787 if (LastError != ERROR_ACCESS_DENIED)
795 if (Flags & F_Append)
796 OpenFlags |= _O_APPEND;
799 OpenFlags |= _O_TEXT;
801 int FD = ::_open_osfhandle(
intptr_t(H), OpenFlags);
808 return std::error_code();
812 HANDLE FileHandle =
reinterpret_cast<HANDLE
>(::_get_osfhandle(FD));
813 if (FileHandle == INVALID_HANDLE_VALUE)
819 CharCount = ::GetFinalPathNameByHandleW(FileHandle, TempPath.
begin(),
821 FILE_NAME_NORMALIZED);
822 if (CharCount < TempPath.
capacity())
829 TempPath.
reserve(CharCount + 1);
839 if (TempPath.
back() ==
L'\0') {
849 static bool getKnownFolderPath(KNOWNFOLDERID folderId,
851 wchar_t *path =
nullptr;
852 if (::SHGetKnownFolderPath(folderId, KF_FLAG_CREATE,
nullptr, &path) != S_OK)
855 bool ok = !
UTF16ToUTF8(path, ::wcslen(path), result);
856 ::CoTaskMemFree(path);
861 return getKnownFolderPath(FOLDERID_LocalAppData, Result);
865 return getKnownFolderPath(FOLDERID_Profile, result);
873 Size = GetEnvironmentVariableW(Var, Buf.
data(), Buf.
capacity());
885 const wchar_t *EnvironmentVariables[] = {
L"TMP",
L"TEMP", L
"USERPROFILE"};
886 for (
auto *Env : EnvironmentVariables) {
887 if (getTempDirEnvVar(Env, Res))
894 (void)ErasedOnReboot;
901 if (getTempDirEnvVar(Result)) {
902 assert(!Result.
empty() &&
"Unexpected empty path");
909 const char *DefaultResult =
"C:\\Temp";
910 Result.
append(DefaultResult, DefaultResult + strlen(DefaultResult));
918 int len = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8.
begin(),
927 len = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8.
begin(),
938 return std::error_code();
942 std::error_code UTF16ToCodePage(
unsigned codepage,
const wchar_t *utf16,
947 int len = ::WideCharToMultiByte(codepage, 0, utf16, utf16_len, utf8.
begin(),
957 len = ::WideCharToMultiByte(codepage, 0, utf16, utf16_len, utf8.
data(),
958 utf8.
size(), NULL, NULL);
968 return std::error_code();
971 std::error_code
UTF16ToUTF8(
const wchar_t *utf16,
size_t utf16_len,
973 return UTF16ToCodePage(CP_UTF8, utf16, utf16_len, utf8);
976 std::error_code
UTF16ToCurCP(
const wchar_t *utf16,
size_t utf16_len,
978 return UTF16ToCodePage(CP_ACP, utf16, utf16_len, utf8);
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
void push_back(const T &Elt)
const_iterator end(StringRef path)
Get end iterator over path.
F_Append - When opening a file, if it already exists append to the existing file instead of returning...
bool can_execute(const Twine &Path)
Can we execute this file?
Represents either an error or a value T.
size_t capacity() const
Return the total number of elements in the currently allocated buffer.
FILETIME toFILETIME(TimePoint<> TP)
std::error_code openFileForRead(const Twine &Name, int &ResultFD, SmallVectorImpl< char > *RealPath=nullptr)
F_Excl - When opening a file, this flag makes raw_fd_ostream report an error if the file already exis...
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
UniqueID getUniqueID() const
std::error_code setLastModificationAndAccessTime(int FD, TimePoint<> Time)
Set the file modification and access time.
opt Optimize addressing mode
std::error_code current_path(SmallVectorImpl< char > &result)
Get the current path.
const_iterator begin(StringRef path)
Get begin iterator over path.
void reserve(size_type N)
LLVM_ATTRIBUTE_ALWAYS_INLINE TimePoint< std::chrono::seconds > toTimePoint(std::time_t T)
Convert a std::time_t to a TimePoint.
bool status_known(file_status s)
Is status available?
mapped_file_region()=delete
std::error_code directory_iterator_increment(DirIterState &)
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
std::string str() const
Return the twine contents as a std::string.
void native(const Twine &path, SmallVectorImpl< char > &result)
Convert path to the native form.
void remove_filename(SmallVectorImpl< char > &path)
Remove the last component from path unless it is the root dir.
struct fuzzer::@269 Flags
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
std::error_code make_error_code(BitcodeError E)
bool is_absolute(const Twine &path)
Is path absolute?
May access map via data and modify it. Written to path.
LLVM_NODISCARD bool empty() const
May only access map via const_data as read only.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
bool is_separator(char value)
Check whether the given char is a path separator on the host OS.
std::error_code create_link(const Twine &to, const Twine &from)
Create a link from from to to.
Open the file for read and write.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
std::string getMainExecutable(const char *argv0, void *MainExecAddr)
Return the path to the main executable, given the value of argv[0] from program startup and the addre...
initializer< Ty > init(const Ty &Val)
The instances of the Type class are immutable: once they are created, they are never changed...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
std::error_code directory_iterator_construct(DirIterState &, StringRef)
TimePoint getLastAccessedTime() const
std::error_code mapWindowsError(unsigned EV)
std::error_code UTF8ToUTF16(StringRef utf8, SmallVectorImpl< wchar_t > &utf16)
std::error_code resize_file(int FD, uint64_t Size)
Resize path to size.
bool startswith(StringRef Prefix) const
startswith - Check if this string starts with the given Prefix.
std::error_code getPathFromOpenFD(int FD, SmallVectorImpl< char > &ResultPath)
Fetch a path to an open file, as specified by a file descriptor.
std::error_code make_absolute(const Twine ¤t_directory, SmallVectorImpl< char > &path)
Make path an absolute path.
std::error_code create_hard_link(const Twine &to, const Twine &from)
Create a hard link from from to to, or return an error.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool is_directory(file_status status)
Does status represent a directory?
std::error_code UTF16ToUTF8(const wchar_t *utf16, size_t utf16_len, SmallVectorImpl< char > &utf8)
std::error_code rename(const Twine &from, const Twine &to)
Rename from to to.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
std::error_code UTF16ToCurCP(const wchar_t *utf16, size_t utf16_len, SmallVectorImpl< char > &utf8)
Convert from UTF16 to the current code page used in the system.
The file should be opened in text mode on platforms that make this distinction.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
May modify via data, but changes are lost on destruction.
ErrorOr< space_info > disk_space(const Twine &Path)
Get disk space usage information.
void set_size(size_type N)
Set the array size to N, which the current array must have enough capacity for.
std::error_code directory_iterator_destruct(DirIterState &)
pointer data()
Return a pointer to the vector's buffer, even if empty().
file_type
An enumeration for the file system's view of the type.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
TimePoint getLastModificationTime() const
std::error_code create_directory(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create the directory in path.
void system_temp_directory(bool erasedOnReboot, SmallVectorImpl< char > &result)
Get the typical temporary directory for the system, e.g., "/var/tmp" or "C:/TEMP".
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool equivalent(file_status A, file_status B)
Do file_status's represent the same thing?
bool home_directory(SmallVectorImpl< char > &result)
Get the user's home directory.
std::error_code access(const Twine &Path, AccessMode Mode)
Can the file be accessed?
StringRef - Represent a constant reference to a string, i.e.
std::error_code status(const Twine &path, file_status &result)
Get file status as if by POSIX stat().
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
std::error_code widenPath(const Twine &Path8, SmallVectorImpl< wchar_t > &Path16)
std::error_code openFileForWrite(const Twine &Name, int &ResultFD, OpenFlags Flags, unsigned Mode=0666)