You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Michael Park <mp...@apache.org> on 2017/01/10 02:47:26 UTC

Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/
-----------------------------------------------------------

(Updated Jan. 9, 2017, 6:47 p.m.)


Review request for mesos, Daniel Pravat and Joris Van Remoortere.


Changes
-------

Rebased.


Repository: mesos


Description
-------

In POSIX the socket, pipe and a file are represented by the `int` type.
In Windows:
  - A socket is kept in a `SOCKET` type (64 bit wide)
  - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
  - A CRT file descriptor in an `int`

The `WindowsFD` class is a type that brings all of these things
together and behaves analogously to an `int` in POSIX.


Diffs (updated)
-----

  3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
  3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
  3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 

Diff: https://reviews.apache.org/r/54591/diff/


Testing
-------


Thanks,

Michael Park


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Alex Clemmer <cl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164276
-----------------------------------------------------------




3rdparty/stout/include/stout/os.hpp (line 49)
<https://reviews.apache.org/r/54591/#comment235945>

    Oh, also, don't we need to add all of these headers to the `Makefile.am`?


- Alex Clemmer


On Feb. 5, 2017, 1:36 a.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2017, 1:36 a.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Alex Clemmer <cl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164303
-----------------------------------------------------------


Ship it!




I greatly appreciate the goal of maintaining the integrity of the POSIX code paths by minimizing the changes required to make them work. So, while I have very serious reservations about doing things like implementing a `<` operator semantics on something that ends up being a `HANDLE` under the hood, for now, I think this is good enough, and accomplishes the goals that are important to the project.

- Alex Clemmer


On Feb. 6, 2017, 1:04 a.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 6, 2017, 1:04 a.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/
-----------------------------------------------------------

(Updated Feb. 5, 2017, 5:04 p.m.)


Review request for mesos, Daniel Pravat and Joris Van Remoortere.


Changes
-------

Addressed Alex's comments.


Repository: mesos


Description
-------

In POSIX the socket, pipe and a file are represented by the `int` type.
In Windows:
  - A socket is kept in a `SOCKET` type (64 bit wide)
  - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
  - A CRT file descriptor in an `int`

The `WindowsFD` class is a type that brings all of these things
together and behaves analogously to an `int` in POSIX.


Diffs (updated)
-----

  3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
  3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
  3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
  3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 

Diff: https://reviews.apache.org/r/54591/diff/


Testing
-------


Thanks,

Michael Park


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/
-----------------------------------------------------------

(Updated Feb. 5, 2017, 1:24 p.m.)


Review request for mesos, Daniel Pravat and Joris Van Remoortere.


Repository: mesos


Description
-------

In POSIX the socket, pipe and a file are represented by the `int` type.
In Windows:
  - A socket is kept in a `SOCKET` type (64 bit wide)
  - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
  - A CRT file descriptor in an `int`

The `WindowsFD` class is a type that brings all of these things
together and behaves analogously to an `int` in POSIX.


Diffs
-----

  3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
  3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
  3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 

Diff: https://reviews.apache.org/r/54591/diff/


Testing
-------


Thanks,

Michael Park


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Michael Park <mp...@apache.org>.

> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 59
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line59>
> >
> >     I'm not super up on the semantics of these newfangled C++11 constructor things, but is there any particular reason we need this to be trivially constructible, or anything like that? Because, if there's not any significant gain, I think it's worth wondering whether having a default value is slightly dangerous.

We probably don't need triviality, but to support the "Use it just as if you would an `int`", we do need a default constructor.
If we don't allow default construction, either we don't use `int` on Linux, or we just live with the fact that Windows builds
break if/when someone tries to say `int_fd fd; ... // initalize later`. I think I'd rather just let it work. What would you prefer?


> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 311
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line311>
> >
> >     Just for my own education, we are doing a `reinterpret_cast` here? Can we not just `static_cast<HANDLE>`?

`HANDLE` is a `void*`, and an `int` cannot be `static_cast`ed to a `void*`.


> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 71
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line71>
> >
> >     Is it true that we're expecting `HANDLE`s passed to this class to only correspond to files?
> >     
> >     If not, I think it's worth noting that `INVALID_HANDLE_VALUE` is not the error value of all `HANDLE`s returned from the win32 APIs, _cf_. the "documentation" at [1]. Depending on the "type" of `HANDLE` returned, an error could be denoted by the handle being `== NULL`, `== -1`, and even `<= 32` in the case of `ShellExecute`. See [2].
> >     
> >     If yes, I think it's worth at least documenting this as part of the class. (Honestly, I would prefer file `HANDLE`s be a different type entirely, but here we are.)
> >     
> >     [1] https://blogs.msdn.microsoft.com/oldnewthing/20040302-00/?p=40443
> >     [2] http://stackoverflow.com/questions/3905538/testing-for-an-invalid-windows-handle-should-i-compare-with-null-0-or-even

Added a comment for this.


> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 86
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line86>
> >
> >     In `crt`, why not check the `type_` here and `abort` if the type is not compatible with what is requested, sort of like how we do in `Try`? It seems like it's better to replace a subtle error with an obvious one.
> >     
> >     I'm not sure if this also makes sense for the `operator`s below, too?

Added `CHECK_EQ`s for this.


> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 20
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line20>
> >
> >     Should these be alphabetized?

Yes, fixed. Thanks.


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164273
-----------------------------------------------------------


On Feb. 5, 2017, 5:04 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2017, 5:04 p.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Michael Park <mp...@apache.org>.

> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 306
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line306>
> >
> >     I'm a bit confused about the conversion logic here... if `left` is a CRT type, can't we just `static_cast<HANDLE>(left)` and compare that to the right? What am I missing?
> >     
> >     Also just so I'm clear: your comment above is saying that the check of `< 0` is just because `left` is signed, while `right` is unsigned, so they can't be equal in this case? Is it appropriate to do a `static_assert` to make sure `HANDLE` is unsigned in the future, too?

If `left` is `CRT` let's say constructed from `0`, then the `HANDLE` is set to the result of `::_open_osfhandle(0)`.

At the same time, if `right` is an `INVALID_HANDLE_VALUE`, we don't want to compare the result of `open_osfhandle(-1)` with `INVALID_HANDLE_VALUE`, we simply want to compare the CRT with `-1`.

Does that make sense?


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164273
-----------------------------------------------------------


On Feb. 5, 2017, 5:04 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2017, 5:04 p.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Michael Park <mp...@apache.org>.

> On Feb. 5, 2017, 12:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 306
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line306>
> >
> >     I'm a bit confused about the conversion logic here... if `left` is a CRT type, can't we just `static_cast<HANDLE>(left)` and compare that to the right? What am I missing?
> >     
> >     Also just so I'm clear: your comment above is saying that the check of `< 0` is just because `left` is signed, while `right` is unsigned, so they can't be equal in this case? Is it appropriate to do a `static_assert` to make sure `HANDLE` is unsigned in the future, too?
> 
> Michael Park wrote:
>     If `left` is `CRT` let's say constructed from `0`, then the `HANDLE` is set to the result of `::_open_osfhandle(0)`.
>     
>     At the same time, if `right` is an `INVALID_HANDLE_VALUE`, we don't want to compare the result of `open_osfhandle(-1)` with `INVALID_HANDLE_VALUE`, we simply want to compare the CRT with `-1`.
>     
>     Does that make sense?

`s/open_osfhandle(-1)/open_osfhandle(0)/`


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164273
-----------------------------------------------------------


On Feb. 5, 2017, 5:04 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2017, 5:04 p.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Alex Clemmer <cl...@gmail.com>.

> On Feb. 5, 2017, 8:48 a.m., Alex Clemmer wrote:
> > 3rdparty/stout/include/stout/os/windows/fd.hpp, line 59
> > <https://reviews.apache.org/r/54591/diff/7/?file=1624392#file1624392line59>
> >
> >     I'm not super up on the semantics of these newfangled C++11 constructor things, but is there any particular reason we need this to be trivially constructible, or anything like that? Because, if there's not any significant gain, I think it's worth wondering whether having a default value is slightly dangerous.
> 
> Michael Park wrote:
>     We probably don't need triviality, but to support the "Use it just as if you would an `int`", we do need a default constructor.
>     If we don't allow default construction, either we don't use `int` on Linux, or we just live with the fact that Windows builds
>     break if/when someone tries to say `int_fd fd; ... // initalize later`. I think I'd rather just let it work. What would you prefer?

Your case is comelling, let's mark it dropped and do as you suggest.


- Alex


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164273
-----------------------------------------------------------


On Feb. 6, 2017, 1:04 a.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 6, 2017, 1:04 a.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/Makefile.am 53d04a9b6c4a0d8b35d3c84ef24d619fdb8a2c82 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Alex Clemmer <cl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/#review164273
-----------------------------------------------------------




3rdparty/stout/include/stout/os/windows/fd.hpp (line 20)
<https://reviews.apache.org/r/54591/#comment235939>

    Should these be alphabetized?



3rdparty/stout/include/stout/os/windows/fd.hpp (line 59)
<https://reviews.apache.org/r/54591/#comment235941>

    I'm not super up on the semantics of these newfangled C++11 constructor things, but is there any particular reason we need this to be trivially constructible, or anything like that? Because, if there's not any significant gain, I think it's worth wondering whether having a default value is slightly dangerous.



3rdparty/stout/include/stout/os/windows/fd.hpp (line 71)
<https://reviews.apache.org/r/54591/#comment235940>

    Is it true that we're expecting `HANDLE`s passed to this class to only correspond to files?
    
    If not, I think it's worth noting that `INVALID_HANDLE_VALUE` is not the error value of all `HANDLE`s returned from the win32 APIs, _cf_. the "documentation" at [1]. Depending on the "type" of `HANDLE` returned, an error could be denoted by the handle being `== NULL`, `== -1`, and even `<= 32` in the case of `ShellExecute`. See [2].
    
    If yes, I think it's worth at least documenting this as part of the class. (Honestly, I would prefer file `HANDLE`s be a different type entirely, but here we are.)
    
    [1] https://blogs.msdn.microsoft.com/oldnewthing/20040302-00/?p=40443
    [2] http://stackoverflow.com/questions/3905538/testing-for-an-invalid-windows-handle-should-i-compare-with-null-0-or-even



3rdparty/stout/include/stout/os/windows/fd.hpp (line 86)
<https://reviews.apache.org/r/54591/#comment235942>

    In `crt`, why not check the `type_` here and `abort` if the type is not compatible with what is requested, sort of like how we do in `Try`? It seems like it's better to replace a subtle error with an obvious one.
    
    I'm not sure if this also makes sense for the `operator`s below, too?



3rdparty/stout/include/stout/os/windows/fd.hpp (line 306)
<https://reviews.apache.org/r/54591/#comment235944>

    I'm a bit confused about the conversion logic here... if `left` is a CRT type, can't we just `static_cast<HANDLE>(left)` and compare that to the right? What am I missing?
    
    Also just so I'm clear: your comment above is saying that the check of `< 0` is just because `left` is signed, while `right` is unsigned, so they can't be equal in this case? Is it appropriate to do a `static_assert` to make sure `HANDLE` is unsigned in the future, too?



3rdparty/stout/include/stout/os/windows/fd.hpp (line 311)
<https://reviews.apache.org/r/54591/#comment235943>

    Just for my own education, we are doing a `reinterpret_cast` here? Can we not just `static_cast<HANDLE>`?


- Alex Clemmer


On Feb. 5, 2017, 1:36 a.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54591/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2017, 1:36 a.m.)
> 
> 
> Review request for mesos, Daniel Pravat and Joris Van Remoortere.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In POSIX the socket, pipe and a file are represented by the `int` type.
> In Windows:
>   - A socket is kept in a `SOCKET` type (64 bit wide)
>   - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
>   - A CRT file descriptor in an `int`
> 
> The `WindowsFD` class is a type that brings all of these things
> together and behaves analogously to an `int` in POSIX.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
>   3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
>   3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/54591/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 54591: Introduced `WindowsFD` class which is analogous to an `int` in POSIX.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/54591/
-----------------------------------------------------------

(Updated Feb. 4, 2017, 5:36 p.m.)


Review request for mesos, Daniel Pravat and Joris Van Remoortere.


Changes
-------

Fixed the bug around `CRT` vs `HANDLE` comparisons.


Repository: mesos


Description
-------

In POSIX the socket, pipe and a file are represented by the `int` type.
In Windows:
  - A socket is kept in a `SOCKET` type (64 bit wide)
  - A pipe or a WinAPI file descriptor in a `HANDLE` (64 bit wide)
  - A CRT file descriptor in an `int`

The `WindowsFD` class is a type that brings all of these things
together and behaves analogously to an `int` in POSIX.


Diffs (updated)
-----

  3rdparty/stout/include/stout/os.hpp ed6fec3ac1c1f9dfb0585178401f4b552822a0a1 
  3rdparty/stout/include/stout/os/int_fd.hpp PRE-CREATION 
  3rdparty/stout/include/stout/os/windows/fd.hpp PRE-CREATION 

Diff: https://reviews.apache.org/r/54591/diff/


Testing
-------


Thanks,

Michael Park