We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 314062b commit 9fde3e9Copy full SHA for 9fde3e9
src/libstd/rand/os.rs
@@ -204,12 +204,6 @@ mod imp {
204
_dummy: (),
205
}
206
207
- extern "C" {
208
- fn syscall(number: c_long, ...) -> c_long;
209
- }
210
-
211
- const NR_GETENTROPY: c_long = 7;
212
213
impl OsRng {
214
/// Create a new `OsRng`.
215
pub fn new() -> io::Result<OsRng> {
@@ -232,7 +226,7 @@ mod imp {
232
226
// getentropy(2) permits a maximum buffer size of 256 bytes
233
227
for s in v.chunks_mut(256) {
234
228
let ret = unsafe {
235
- syscall(NR_GETENTROPY, s.as_mut_ptr(), s.len())
229
+ libc::syscall(libc::NR_GETENTROPY, s.as_mut_ptr(), s.len())
236
230
};
237
231
if ret == -1 {
238
panic!("unexpected getentropy error: {}", errno());
0 commit comments