Skip to content

Commit

Permalink
Use libc's Linux syscall()
Browse files Browse the repository at this point in the history
There's no need for us to redeclare it in an extern block.
  • Loading branch information
mmcco committed Dec 24, 2015
1 parent 4ce1daf commit b0a9b3d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/libstd/rand/os.rs
Expand Up @@ -32,10 +32,6 @@ mod imp {
target_arch = "aarch64",
target_arch = "powerpc")))]
fn getrandom(buf: &mut [u8]) -> libc::c_long {
extern "C" {
fn syscall(number: libc::c_long, ...) -> libc::c_long;
}

#[cfg(target_arch = "x86_64")]
const NR_GETRANDOM: libc::c_long = 318;
#[cfg(target_arch = "x86")]
Expand All @@ -46,7 +42,7 @@ mod imp {
const NR_GETRANDOM: libc::c_long = 278;

unsafe {
syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0)
}
}

Expand Down

0 comments on commit b0a9b3d

Please sign in to comment.