You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Michael Park <mp...@apache.org> on 2017/02/06 20:39:42 UTC

Introduction of `int_fd`.

I'd like to announce that we've introduced an `int_fd` type in stout.
It is __not__ an RAII file descriptor type! It's actually not fancy
what-so-ever.

On POSIX, it's simply aliased to an `int`, so there's no change in usage at
all.
Just remember to use `int_fd` rather than `int` for file descriptors.

If you're wondering why we introduced this in the first place, continue
reading:

On Windows, `int_fd` is aliased to a type called `WindowsFD`. The reason is
that the abstraction on Windows has multiple types that represent
"file descriptors" from various APIs. Namely, WinCRT, Win32, WinSock.

Due to this, on Windows we have to deal with `int` from WinCRT, `HANDLE`
from Win32, and `SOCKET` from WinSock. In order to not require large changes
through the entire codebase, we've decided to rendezvous at the POSIX `int`.

`WindowsFD` is one of: `int`, `HANDLE`, and `SOCKET`, and tries its best to
provide the same API as the POSIX `int` file descriptor. Notably, the
comparison
operators are implemented to support expressions such as `fd < 0` and `fd
!= -1`.

Thanks to Daniel Pravat, Alex Clemmer, and Benjamin Hindman for helping out
with this work.

You know who you ping if you run into issues or have questions =D

Thanks,

MPark

Re: Introduction of `int_fd`.

Posted by Alex Clemmer <cl...@gmail.com>.
It's great to see this shipped! Thanks, mpark.

As an aside: One of the impacts of this work is that it is the last
major change blocking the Windows Containers patches, which will be very
exciting to see finally lit up.

I will follow up this work with some more in-depth tests to prevent
regressions around some of the more subtle behavior of the Windows
codepaths. (The POSIX codepaths are supposed to remain unaffected, so
the risk is incurred only on the Windows side.)


__
Transcribed by my voice-enabled refrigerator, please pardon chilly messages.

On Mon, 6 Feb 2017, Michael Park wrote:

> I'd like to announce that we've introduced an `int_fd` type in stout.
> It is __not__ an RAII file descriptor type! It's actually not fancy
> what-so-ever.
>
> On POSIX, it's simply aliased to an `int`, so there's no change in usage at
> all.
> Just remember to use `int_fd` rather than `int` for file descriptors.
>
> If you're wondering why we introduced this in the first place, continue
> reading:
>
> On Windows, `int_fd` is aliased to a type called `WindowsFD`. The reason is
> that the abstraction on Windows has multiple types that represent
> "file descriptors" from various APIs. Namely, WinCRT, Win32, WinSock.
>
> Due to this, on Windows we have to deal with `int` from WinCRT, `HANDLE`
> from Win32, and `SOCKET` from WinSock. In order to not require large changes
> through the entire codebase, we've decided to rendezvous at the POSIX `int`.
>
> `WindowsFD` is one of: `int`, `HANDLE`, and `SOCKET`, and tries its best to
> provide the same API as the POSIX `int` file descriptor. Notably, the
> comparison
> operators are implemented to support expressions such as `fd < 0` and `fd
> != -1`.
>
> Thanks to Daniel Pravat, Alex Clemmer, and Benjamin Hindman for helping out
> with this work.
>
> You know who you ping if you run into issues or have questions =D
>
> Thanks,
>
> MPark
>