summaryrefslogtreecommitdiff
path: root/src/unix/bsd
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2022-02-14 20:23:23 +0000
committerDavid Carlier <devnexen@gmail.com>2022-02-14 20:23:23 +0000
commit0a0158947b3d70511f04b4e236cf86eb9ad3c863 (patch)
tree7138c019197d1c463c2e49ea5ba5f20108241b69 /src/unix/bsd
parente2e056bc50e22dc475a798bb648d117a88298f5f (diff)
downloadrust-libc-0a0158947b3d70511f04b4e236cf86eb9ad3c863.tar.gz
BSD add deterministic rand api
Diffstat (limited to 'src/unix/bsd')
-rw-r--r--src/unix/bsd/mod.rs10
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index a08506d16a..a0729ee545 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -867,6 +867,16 @@ extern "C" {
pub fn arc4random() -> u32;
pub fn arc4random_buf(buf: *mut ::c_void, size: ::size_t);
pub fn arc4random_uniform(l: u32) -> u32;
+
+ pub fn drand48() -> ::c_double;
+ pub fn erand48(xseed: *mut ::c_ushort) -> ::c_double;
+ pub fn lrand48() -> ::c_long;
+ pub fn nrand48(xseed: *mut ::c_ushort) -> ::c_long;
+ pub fn mrand48() -> ::c_long;
+ pub fn jrand48(xseed: *mut ::c_ushort) -> ::c_long;
+ pub fn srand48(seed: ::c_long);
+ pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
+ pub fn lcong48(p: *mut ::c_ushort);
}
cfg_if! {
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 2365343205..9cab0b1a2d 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -1633,6 +1633,10 @@ extern "C" {
pub fn freezero(ptr: *mut ::c_void, size: ::size_t);
pub fn malloc_conceal(size: ::size_t) -> *mut ::c_void;
pub fn calloc_conceal(nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
+
+ pub fn srand48_deterministic(seed: ::c_long);
+ pub fn seed48_deterministic(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
+ pub fn lcong48_deterministic(p: *mut ::c_ushort);
}
#[link(name = "execinfo")]