Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-17 Thread Alex Clemmer

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

(Updated April 17, 2016, 10:46 p.m.)


Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, Joris 
Van Remoortere, Michael Park, M Lawindi, and Yi Sun.


Bugs: MESOS-4470
https://issues.apache.org/jira/browse/MESOS-4470


Repository: mesos


Description
---

Stout: Implemented `uname` on Windows.


Diffs (updated)
-

  3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
  3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
edaa76a5322d0bf60b7172405aa754b5aca95458 
  3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
c48106e5905e3be0faeba7177ef534766089faff 

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


Testing
---


Thanks,

Alex Clemmer



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-17 Thread Alex Clemmer


> On April 15, 2016, 10:56 p.m., Michael Park wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp, line 66
> > 
> >
> > `std::unique_ptr` semantically means that it's pointing to a single 
> > element. We should use  `std::unique_ptr` to use the array of elements 
> > version. We should also use `new` so that we don't have to manually 
> > calcaluate the number of bytes.
> > 
> > ```
> > std::unique_ptr name(new char[size + 1]);
> > ```

You're right, that is a lot cleaner, thanks!


- Alex


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


On April 15, 2016, 8:42 a.m., Alex Clemmer wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46191/
> ---
> 
> (Updated April 15, 2016, 8:42 a.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, 
> Joris Van Remoortere, Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-4470
> https://issues.apache.org/jira/browse/MESOS-4470
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Stout: Implemented `uname` on Windows.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
> 79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
>   3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
> edaa76a5322d0bf60b7172405aa754b5aca95458 
>   3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
> c48106e5905e3be0faeba7177ef534766089faff 
> 
> Diff: https://reviews.apache.org/r/46191/diff/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-15 Thread Michael Park

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


Fix it, then Ship it!





3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 55)


Add newline.



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 62)


```
  if (!::GetComputerNameEx(ComputerNameDnsHostname, NULL, ) &&
  ::GetLastError() != ERROR_MORE_DATA) {
```



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 66)


`std::unique_ptr` semantically means that it's pointing to a single 
element. We should use  `std::unique_ptr` to use the array of elements 
version. We should also use `new` so that we don't have to manually calcaluate 
the number of bytes.

```
std::unique_ptr name(new char[size + 1]);
```



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (lines 333 - 
336)


This fits in one line.



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 348)


`s/computer name/nodename/`



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 349)


`s/name/nodename/`


- Michael Park


On April 15, 2016, 8:42 a.m., Alex Clemmer wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46191/
> ---
> 
> (Updated April 15, 2016, 8:42 a.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, 
> Joris Van Remoortere, Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-4470
> https://issues.apache.org/jira/browse/MESOS-4470
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Stout: Implemented `uname` on Windows.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
> 79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
>   3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
> edaa76a5322d0bf60b7172405aa754b5aca95458 
>   3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
> c48106e5905e3be0faeba7177ef534766089faff 
> 
> Diff: https://reviews.apache.org/r/46191/diff/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-15 Thread Michael Park


> On April 14, 2016, 9:55 p.m., Michael Park wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp, line 310
> > 
> >
> > Please use a C++ cast.
> 
> Alex Clemmer wrote:
> I don't really know enough about C++ casts to know what the "right thing" 
> to do here is. My simpleton's understanding is the preference is: (1) 
> `static_cast` (2) `dynamic_cast`, and (3) `reinterpret_cast`. That said, I 
> think only the last works, so that's what I guessed you wanted.

Yep, you did the right thing.


- Michael


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


On April 15, 2016, 8:42 a.m., Alex Clemmer wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46191/
> ---
> 
> (Updated April 15, 2016, 8:42 a.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, 
> Joris Van Remoortere, Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-4470
> https://issues.apache.org/jira/browse/MESOS-4470
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Stout: Implemented `uname` on Windows.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
> 79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
>   3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
> edaa76a5322d0bf60b7172405aa754b5aca95458 
>   3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
> c48106e5905e3be0faeba7177ef534766089faff 
> 
> Diff: https://reviews.apache.org/r/46191/diff/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-15 Thread Michael Park


> On April 14, 2016, 9:55 p.m., Michael Park wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp, lines 
> > 355-360
> > 
> >
> > If we pull out `internal::os_version`, we could do less work here:
> > 
> > ```
> > Try os_version = internal::os_version();
> > if (os_version.isError()) {
> >   return Error(os_version.error());
> > }
> > 
> > return internal::sysname(os_version);
> > ```
> > 
> > If the idea is to keep the implementation consistent with 
> > `posix/os.hpp` that sounds fine as well, in which case we should just 
> > define this in `os.hpp`.
> 
> Alex Clemmer wrote:
> Actually, we should just pull this out into `stout/os.hpp` because the 
> different implementations are identical right now.

Yep, that's exactly what I meant by "just define this in `os.hpp`".


- Michael


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


On April 15, 2016, 8:42 a.m., Alex Clemmer wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46191/
> ---
> 
> (Updated April 15, 2016, 8:42 a.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, 
> Joris Van Remoortere, Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-4470
> https://issues.apache.org/jira/browse/MESOS-4470
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Stout: Implemented `uname` on Windows.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
> 79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
>   3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
> edaa76a5322d0bf60b7172405aa754b5aca95458 
>   3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
> c48106e5905e3be0faeba7177ef534766089faff 
> 
> Diff: https://reviews.apache.org/r/46191/diff/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-15 Thread Alex Clemmer


> On April 14, 2016, 9:55 p.m., Michael Park wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp, lines 
> > 355-360
> > 
> >
> > If we pull out `internal::os_version`, we could do less work here:
> > 
> > ```
> > Try os_version = internal::os_version();
> > if (os_version.isError()) {
> >   return Error(os_version.error());
> > }
> > 
> > return internal::sysname(os_version);
> > ```
> > 
> > If the idea is to keep the implementation consistent with 
> > `posix/os.hpp` that sounds fine as well, in which case we should just 
> > define this in `os.hpp`.

Actually, we should just pull this out into `stout/os.hpp` because the 
different implementations are identical right now.


> On April 14, 2016, 9:55 p.m., Michael Park wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp, line 310
> > 
> >
> > Please use a C++ cast.

I don't really know enough about C++ casts to know what the "right thing" to do 
here is. My simpleton's understanding is the preference is: (1) `static_cast` 
(2) `dynamic_cast`, and (3) `reinterpret_cast`. That said, I think only the 
last works, so that's what I guessed you wanted.


- Alex


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


On April 15, 2016, 8:42 a.m., Alex Clemmer wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46191/
> ---
> 
> (Updated April 15, 2016, 8:42 a.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, 
> Joris Van Remoortere, Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-4470
> https://issues.apache.org/jira/browse/MESOS-4470
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Stout: Implemented `uname` on Windows.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
> 79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
>   3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
> edaa76a5322d0bf60b7172405aa754b5aca95458 
>   3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
> c48106e5905e3be0faeba7177ef534766089faff 
> 
> Diff: https://reviews.apache.org/r/46191/diff/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-15 Thread Alex Clemmer

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

(Updated April 15, 2016, 8:42 a.m.)


Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, Joris 
Van Remoortere, Michael Park, M Lawindi, and Yi Sun.


Bugs: MESOS-4470
https://issues.apache.org/jira/browse/MESOS-4470


Repository: mesos


Description
---

Stout: Implemented `uname` on Windows.


Diffs (updated)
-

  3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp 
79e30ca04c6d23f92e3a2f80fbe38ae63fde3520 
  3rdparty/libprocess/3rdparty/stout/include/stout/posix/os.hpp 
edaa76a5322d0bf60b7172405aa754b5aca95458 
  3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
c48106e5905e3be0faeba7177ef534766089faff 

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


Testing
---


Thanks,

Alex Clemmer



Re: Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-14 Thread Michael Park

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




3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 44)


How about naming this `nodename` to match the field name?



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 64)


How about naming this `machine` to match the field name?



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (lines 98 - 99)


This is the correct format? Do we not want `major.minor.patch`? If we do 
want `major.minor.patch`, then we could just do `return 
stringify(Version(os_version.dwMajorVersion, os_version.dwMinorVersion, 0));`



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (lines 308 - 
312)


Can we pull this out to `Try internal::os_version();`?



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (line 310)


Please use a C++ cast.



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (lines 326 - 
330)


We can use `internal::os_version` here instead if we pull it out as 
suggested above.



3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp (lines 355 - 
360)


If we pull out `internal::os_version`, we could do less work here:

```
Try os_version = internal::os_version();
if (os_version.isError()) {
  return Error(os_version.error());
}

return internal::sysname(os_version);
```

If the idea is to keep the implementation consistent with `posix/os.hpp` 
that sounds fine as well, in which case we should just define this in `os.hpp`.


- Michael Park


On April 14, 2016, 8:28 a.m., Alex Clemmer wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46191/
> ---
> 
> (Updated April 14, 2016, 8:28 a.m.)
> 
> 
> Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, 
> Joris Van Remoortere, Michael Park, M Lawindi, and Yi Sun.
> 
> 
> Bugs: MESOS-4470
> https://issues.apache.org/jira/browse/MESOS-4470
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Stout: Implemented `uname` on Windows.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
> c48106e5905e3be0faeba7177ef534766089faff 
> 
> Diff: https://reviews.apache.org/r/46191/diff/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Alex Clemmer
> 
>



Review Request 46191: Stout: Implemented `uname` on Windows.

2016-04-14 Thread Alex Clemmer

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

Review request for mesos, Alex Naparu, Daniel Pravat, Artem Harutyunyan, Joris 
Van Remoortere, Michael Park, M Lawindi, and Yi Sun.


Bugs: MESOS-4470
https://issues.apache.org/jira/browse/MESOS-4470


Repository: mesos


Description
---

Stout: Implemented `uname` on Windows.


Diffs
-

  3rdparty/libprocess/3rdparty/stout/include/stout/windows/os.hpp 
c48106e5905e3be0faeba7177ef534766089faff 

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


Testing
---


Thanks,

Alex Clemmer