> On Oct. 9, 2014, 9:59 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp, lines 442-443
> > <https://reviews.apache.org/r/26472/diff/2/?file=716714#file716714line442>
> >
> >     Hm.. could we avoid the assumption that stringify() keeps errno intact?
> >     
> >     ```
> >     char* error = strerror(errno);
> >     
> >     ABORT("..." + error);
> >     ```

What I would like to do (longer term) is make a couple helpers such as:
```
template <typename T>
Try<T> TryOsReturn(T);

template <typename T>
Try<T> TryOsNonZero(T);
```
That take the os function return and then calls strerror for us when needed to 
set the error message. Would make it much, much harder to accidentally perturb 
errno.


> On Oct. 9, 2014, 9:59 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/thread.hpp, lines 42-44
> > <https://reviews.apache.org/r/26472/diff/2/?file=716719#file716719line42>
> >
> >     How about wrapping `strerror` with `std::string()` in these cases so 
> > that you don't have to deal with the strange indentation here?
> >     
> >     ```
> >     ABORT("Failed to destruct thread local, pthread_key_delete: " +
> >           std::string(strerror(errno)));
> >     ```

Updated


- Cody


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


On Oct. 10, 2014, 12:44 a.m., Cody Maloney wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/26472/
> -----------------------------------------------------------
> 
> (Updated Oct. 10, 2014, 12:44 a.m.)
> 
> 
> Review request for mesos, Adam B and Dominic Hamon.
> 
> 
> Bugs: MESOS-1870
>     https://issues.apache.org/jira/browse/MESOS-1870
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> This makes it so any time there is an abort, we get a line number and at 
> least a basic message as to why there was an abort. If you want a clean(er) 
> exit, use <stout/exit>.
> 
> Also adds an overload which takes a standard string and unwraps it to a const 
> char * automatically, since a lot of the time we are building strings to pass 
> them to abort.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/abort.hpp 
> 6b5b5d1faa488cb3048f6d59bae17123b1b05a33 
>   3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp 
> 9d244b2275f7ef84e8c486f2090b67a57ca8c670 
>   3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp 
> 7138bc24912f35bfd04d2341b2218ea349ab40b8 
>   3rdparty/libprocess/3rdparty/stout/include/stout/os/fork.hpp 
> 8aa21ed10293c3dd7f55b7d30f6014bd05fd7455 
>   3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp 
> ccf80a771c59092cb72d4dac0d868eec7df2f088 
>   3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp 
> ce8dd9b6468fb36daceba60d8b43bf2fbfceab6c 
>   3rdparty/libprocess/3rdparty/stout/include/stout/stringify.hpp 
> ed0a1ef2b617bd87261bf4836706cedb80fdf043 
>   3rdparty/libprocess/3rdparty/stout/include/stout/thread.hpp 
> b1af74f517da75525d0dedacaf4a1c6f8cbf55f4 
>   3rdparty/libprocess/3rdparty/stout/include/stout/try.hpp 
> 87c5fc8391d5213f0d76fa5980176726a0366f56 
>   3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp 
> 9207c551170b747d25207efe7d3c03675b184953 
> 
> Diff: https://reviews.apache.org/r/26472/diff/
> 
> 
> Testing
> -------
> 
> make distcheck
> 
> 
> Thanks,
> 
> Cody Maloney
> 
>

Reply via email to