Skip to content

Commit b0a9b3d

Browse files
committed
Use libc's Linux syscall()
There's no need for us to redeclare it in an extern block.
1 parent 4ce1daf commit b0a9b3d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/libstd/rand/os.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ mod imp {
3232
target_arch = "aarch64",
3333
target_arch = "powerpc")))]
3434
fn getrandom(buf: &mut [u8]) -> libc::c_long {
35-
extern "C" {
36-
fn syscall(number: libc::c_long, ...) -> libc::c_long;
37-
}
38-
3935
#[cfg(target_arch = "x86_64")]
4036
const NR_GETRANDOM: libc::c_long = 318;
4137
#[cfg(target_arch = "x86")]
@@ -46,7 +42,7 @@ mod imp {
4642
const NR_GETRANDOM: libc::c_long = 278;
4743

4844
unsafe {
49-
syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
45+
libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
5046
}
5147
}
5248

0 commit comments

Comments
 (0)