Hello everyone!
I've realized that a lot of developers working in libprocess (and
elsewhere) may not know about how to handle file descriptors in a
cross-platform way for Mesos.
IMPORTANT: You cannot just use `int`. File descriptors on Windows are
various types of handles, but not just an `int`.
The abstraction we use in Mesos is `int_fd`, found here:
https://github.com/apache/mesos/blob/master/3rdparty/stout/include/stout/os/int_fd.hpp
On non-Windows platforms, it's just an `int`. But on Windows, it's a
`WindowsFD` which can be an `int` (from the Windows CRT which we're
deprecating), a `HANDLE` (the Windows 32 API), and a `SOCKET` (from the
WinSock library). If you're curious, the implementation is here:
https://github.com/apache/mesos/blob/master/3rdparty/stout/include/stout/os/windows/fd.hpp
I just want you to be aware that if you're writing code and need an
`int` file descriptor, please use `int_fd` (and include the appropriate
header) instead of `int`, as otherwise you break the Windows build.
Thank you,
Andy
- Please use `int_fd` instead of `int` for file descrip... Andrew Schwartzmeyer
-