fix fd_in_limits test on Windows #52779
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #52506.
OS_HANDLE
on Windows is an alias forWindowsRawSocket
, so I looked at the win32 socket documentation, which says that a socket handle "may take any value in the range0
toINVALID_SOCKET–1
." TheINVALID_SOCKET
is defined as~0
, i.e.0xffffffff
.But I'm not 100% sure the socket docs apply here? @vtjnash's comment said it should be "in
typemax(DWORD)
" (== typemax(UInt32)
), which would correspond to0xffffffff
and not0xffffffff - 1
. But I can't find clear docs on the value of aHANDLE
— if it is really just a pointer, couldn't it be just about anything? (The old code corresponds totypemax(Int16) == 0x7fff
, which suggests changing it totypemax(Int32) == 0x7fffffff
, but I'm not sure where that is coming from either.) Is there a relevant section of the Win32 docs I should be looking at?Note that this test dates back to #26341 by @vtjnash.