-
-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add /dev/(u)random on nt #1163
add /dev/(u)random on nt #1163
Conversation
Are there examples of software that have a config check for |
It doesn't do a config check, but Perl defaults to WAMR does a platform config check, rather than one on the symbol: |
Conceptually I like this change, it definitely is the case that build systems will often check for I have not looked closely at the PR yet and do not currently have time to; I will try to later on, if you haven't heard back from me by Friday and still need a review please ping me. One thing is that you may want to use |
Did you mean I think
BoringSSL only uses For |
Yep. I am not a Windows guy, I just remembered that function existing and In any case it sounds like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments. Overall I like it and the implementation seems basically sound to me.
I would want to run it by @jart prior to merging since this is a pretty major API change.
Oh actually on closer inspection it looks like maybe you should use |
This was not done, following @jart 's comments here:
If we need /dev/(u)random emulation on other plaforms we may have to. |
Hmm, okay, yeah. Using Sorry, I hadn't noticed that issue link previously - in that case I'm fine with this and see no need to bug her again. ETA: like, since you are always putting your code under a |
…behavior, cleanup tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -107,8 +107,9 @@ static int ioctl_fionread(int fd, uint32_t *arg) { | |||
*arg = MAX(0, bytes); | |||
return 0; | |||
} else if (g_fds.p[fd].kind == kFdDevNull) { | |||
*arg = 1; | |||
return 0; | |||
return enotty(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I approve as well. However weirdly it doesn't seem like you can do that in the UI after something's been merged.)
Resolves #1001
Uses
ProcessPrng
asgetrandom
does.When feature detection fails software often falls back to
/dev/urandom
, this is a problem as development with cosmo is often done on Linux where tests will pass using/dev/urandom
, but then won't work on Windows. While it's easy enough to patch and usinggetrandom
is better, this makes building correct ports with cosmopolitan/cosmocc easier.