MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / real_getrandom

Function real_getrandom

crates/runtime/src/sim_std.rs:152–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150
151#[cfg(target_os = "linux")]
152fn real_getrandom() -> unsafe extern "C" fn(*mut u8, usize, u32) -> isize {
153 type GetrandomFn = unsafe extern "C" fn(*mut u8, usize, u32) -> isize;
154 static GETRANDOM: OnceLock<GetrandomFn> = OnceLock::new();
155 *GETRANDOM.get_or_init(|| unsafe {
156 let ptr = libc::dlsym(libc::RTLD_NEXT, c"getrandom".as_ptr().cast());
157 assert!(!ptr.is_null(), "failed to resolve original getrandom");
158 std::mem::transmute(ptr)
159 })
160}
161
162#[cfg(not(target_os = "linux"))]
163fn real_getrandom() -> unsafe extern "C" fn(*mut u8, usize, u32) -> isize {

Callers 1

getrandomFunction · 0.85

Calls 2

castMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…