Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/llbuild/Basic/PlatformUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ template <typename = FD> struct FileDescriptorTraits;

#if defined(_WIN32)
template <> struct FileDescriptorTraits<HANDLE> {
typedef HANDLE DescriptorType;
static bool IsValid(HANDLE hFile) { return hFile != INVALID_HANDLE_VALUE; }
static void Close(HANDLE hFile) { CloseHandle(hFile); }
static int Read(HANDLE hFile, void *destinationBuffer,
Expand All @@ -85,6 +86,8 @@ template <> struct FileDescriptorTraits<HANDLE> {
};
#endif
template <> struct FileDescriptorTraits<int> {
typedef int DescriptorType;
static const int InvalidDescriptor = -1;
static bool IsValid(int fd) { return fd >= 0; }
static void Close(int fd) { close(fd); }
static int Read(int hFile, void *destinationBuffer,
Expand Down
Loading