]> git.lizzy.rs Git - rust.git/commitdiff
Use getrandom() syscall number from libc
authorAaron Hill <aa1ronham@gmail.com>
Sun, 7 Apr 2019 23:57:14 +0000 (19:57 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Sun, 7 Apr 2019 23:57:14 +0000 (19:57 -0400)
Cargo.toml
src/fn_call.rs

index 6c77315bea48b238cfe1512b8a405bc672f1f682..b0e278c1b54c00f72e4efe822b3795d100555b45 100644 (file)
@@ -46,6 +46,7 @@ shell-escape = "0.1.4"
 rustc-workspace-hack = "1.0.0"
 hex = "0.3.2"
 rand = "0.6.5"
+libc = "0.2.51"
 
 [build-dependencies]
 vergen = "3"
index ba610e8b230c25fa36bcb38d82767b30622710d0..74352302f36e184d13fe0d682b9ad48234bece0d 100644 (file)
@@ -216,8 +216,8 @@ fn emulate_foreign_item(
                 //
                 // `libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK)`
                 // is called if a `HashMap` is created the regular way.
-                match this.read_scalar(args[0])?.to_usize(this)? {
-                    318 | 511 => {
+                match this.read_scalar(args[0])?.to_usize(this)? as i64 {
+                    libc::SYS_getrandom => {
                         match this.machine.rng.as_ref() {
                             Some(rng) => {
                                 let ptr = this.read_scalar(args[1])?.to_ptr()?;