diff options
author | Pavel Labath <labath@google.com> | 2016-08-12 11:20:21 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2016-08-12 11:20:21 +0000 |
commit | fdb2d99eaf9fd6b3f75b1294c92a327f2ad0c480 (patch) | |
tree | d0e5a7230288c8260ce3d096ed0431d09fe992a7 /lldb/source/Utility/SelectHelper.cpp | |
parent | be976d4ea92707106468d24d1d8a70f466420b70 (diff) | |
download | bcm5719-llvm-fdb2d99eaf9fd6b3f75b1294c92a327f2ad0c480.tar.gz bcm5719-llvm-fdb2d99eaf9fd6b3f75b1294c92a327f2ad0c480.zip |
Fix-up r278299 for windows
FD_SETSIZE on windows limits the number of file descriptors, rather than their individual
magnitude (the underlying implementation uses an array rather than a bitset). This meant that the
assert in the SelectHelper was incorrect, and failing all the time. Fix that.
I am not sure whether this should be #ifdef MSVC, or #ifdef WINDOWS, but my feeling is that a
more posix-conforming implementation on windows would choose the bitset implementation, so I'm
sticking with the former.
llvm-svn: 278500
Diffstat (limited to 'lldb/source/Utility/SelectHelper.cpp')
-rw-r--r-- | lldb/source/Utility/SelectHelper.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp index 7d616d5745a..44282d26a50 100644 --- a/lldb/source/Utility/SelectHelper.cpp +++ b/lldb/source/Utility/SelectHelper.cpp @@ -100,6 +100,12 @@ lldb_private::Error SelectHelper::Select() { lldb_private::Error error; +#ifdef _MSC_VER + // On windows FD_SETSIZE limits the number of file descriptors, not their numeric value. + lldbassert(m_fd_map.size() <= FD_SETSIZE); + if (m_fd_map.size() > FD_SETSIZE) + return lldb_private::Error("Too many file descriptors for select()"); +#endif int max_read_fd = -1; int max_write_fd = -1; @@ -109,7 +115,7 @@ SelectHelper::Select() { pair.second.PrepareForSelect(); const int fd = pair.first; -#if !defined(__APPLE__) +#if !defined(__APPLE__) && !defined(_MSC_VER) lldbassert(fd < FD_SETSIZE); if (fd >= FD_SETSIZE) { |