mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Split openFileForRead into Windows and Unix versions.
This has some advantages: * Lets us use native, utf16 windows functions. * Easy to produce good errors on windows about trying to use a directory when we want a file. * Simplifies the unix version a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -815,6 +815,15 @@ error_code unmap_file_pages(void *base, size_t size) {
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
error_code openFileForRead(const Twine &Name, int &ResultFD) {
|
||||
SmallString<128> Storage;
|
||||
StringRef P = Name.toNullTerminatedStringRef(Storage);
|
||||
while ((ResultFD = open(P.begin(), O_RDONLY)) < 0) {
|
||||
if (errno != EINTR)
|
||||
return error_code(errno, system_category());
|
||||
}
|
||||
return error_code::success();
|
||||
}
|
||||
|
||||
} // end namespace fs
|
||||
} // end namespace sys
|
||||
|
||||
Reference in New Issue
Block a user