Re: Please use `int_fd` instead of `int` for file descriptors

2017-12-01 Thread Benjamin Bannier
Hi, > I'm not sure how to actually help with the issue of making `int_fd` > more discoverable. The only idea I've got is a ClangTidy check to > complain about variables of type `int` named `fd` and other similar > common names for file descriptors such as `socket`. I was wondering about this as

Re: Please use `int_fd` instead of `int` for file descriptors

2017-11-30 Thread Andrew Schwartzmeyer
Unfortunately the root of our problem is that the cross-platform review bots are still not up-to-snuff. Most people (including myself) won't wait around for a bot that takes sometimes 24 hours to review the patch after an update. So, while increasing the discoverability of `int_fd` I think

Re: Please use `int_fd` instead of `int` for file descriptors

2017-11-30 Thread Michael Park
I agree it would be nice to document the supported operations on an `int_fd`. I'm not sure how to actually help with the issue of making `int_fd` more discoverable. The only idea I've got is a ClangTidy check to complain about variables of type `int` named `fd` and other similar common names for

Re: Please use `int_fd` instead of `int` for file descriptors

2017-11-30 Thread Benjamin Mahler
On Thu, Nov 30, 2017 at 11:12 PM, Andrew Schwartzmeyer < and...@schwartzmeyer.com> wrote: > For Linux it is literally an `int`: > > using int_fd = int; >> > > https://github.com/apache/mesos/blob/bf4bc6380cb99132736fbbe > fc85f3a7ca60b032c/3rdparty/stout/include/stout/os/int_fd.hpp#L35 > > Yes I

Re: Please use `int_fd` instead of `int` for file descriptors

2017-11-30 Thread Andrew Schwartzmeyer
For Linux it is literally an `int`: using int_fd = int; https://github.com/apache/mesos/blob/bf4bc6380cb99132736fbbefc85f3a7ca60b032c/3rdparty/stout/include/stout/os/int_fd.hpp#L35 So it's a safe drop-in replacement on non-Windows platforms, with all the same properties of an `int`. It's

Re: Please use `int_fd` instead of `int` for file descriptors

2017-11-30 Thread Benjamin Mahler
Is it possible to document in that header the properties of int_fd that we can rely on? For example, it has a hash defined for use in unordered map, set, etc. It's a POD type, etc. On Wed, Nov 29, 2017 at 10:17 PM, Andrew Schwartzmeyer < and...@schwartzmeyer.com> wrote: > Hello everyone! > >

Please use `int_fd` instead of `int` for file descriptors

2017-11-29 Thread Andrew Schwartzmeyer
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