-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
On macOS, try getentropy() before opening /dev/urandom? #70179
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.O-macosOperating system: macOSOperating system: macOST-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.O-macosOperating system: macOSOperating system: macOST-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Background
Hi, I'm developing a HTTP load generator called oha. The application often exceeds the number of open file limit and then, tokio runtime crashes because it tries to open
/dev/urandomto generate random on macOS.hatoo/oha#23
issue
On macOS, according to https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/rand.rs,
fill_bytesalways read/dev/urandombut opening/dev/urandommay fail because of the limit of the number of open files.So it would be better to try
getentropylike getrandom before reading/dev/urandom.Thanks.