Uh oh!
There was an error while loading. Please reload this page.
Freebsd: Try getrandom() first - #57
Conversation
valpackett
commented
Jul 7, 2019
Looks good, works fine. |
newpavlov
commented
Jul 8, 2019
Maybe it's worth to make this PR independent from #54? I think it will be some time before we will converge our opinions on that one, while changes in this PR look quite straightforward. |
josephlr
commented
Jul 8, 2019
The main reason for the change is that this implementation uses the |
I do not insist on it, you can leave it as-is. I was simply thinking it may be easier for you, since no syncing with #54 would be needed. |
josephlr
commented
Jul 9, 2019
dhardy
left a comment
There was a problem hiding this comment.
Looks good, other than a comment as mentioned.
| while !buf.is_empty() { | ||
| let res = f(buf); | ||
| if res < 0 { | ||
| let err = io::Error::last_os_error(); |
There was a problem hiding this comment.
Seems odd to me to assume that calling last_os_error is appropriate here given the function name. At least this should be mentioned by function documentation.
There was a problem hiding this comment.
During removal of std dependency it will have to be replaced with an explicit errno, so I think it's fine to keep it as-is for the time being.
There was a problem hiding this comment.
So I changed the function to be named sys_fill_exact and added a comment to explain the expected semantics of the sys_fill function. @newpavlov is right that this will be replaced with an explicit call to an errno function in #54
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Depends on #54fixes#35
Implementation is quite similar to the Solaris/Illumos implementation. @myfreeweb PTAL
Edit: Also adds a
fill_exacthelper method for making repeated OS calls to fill a buffer. This let's us simplify the Linux/Solaris/FreeBSD code, as well as adding some changes useful for #54 and #58