authorgravatar for sunb@qmrz.net孙冰 <sunb@qmrz.net> 2025-03-25 10:30:39+08:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-03-25 15:24:07+01:00
logd67bf8bde39fae7ccc23a6ab3aacc3136ffb6b61
treece6c4898d45fa6c2a066f18e75a7d539dfccee0c
parent7d8a556ba92474d78b465b30c8d5df64e9775d93
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.c: android bionic C supports arc4random_buf and getentropy

1. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/bits/getentropy.h 2. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/stdlib.h

1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/c.zig+2
...@@ -9331,9 +9331,11 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_...@@ -9331,9 +9331,11 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_
93319331
9332pub const arc4random_buf = switch (native_os) {9332pub const arc4random_buf = switch (native_os) {
9333 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,9333 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
9334 .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {},
9334 else => {},9335 else => {},
9335};9336};
9336pub const getentropy = switch (native_os) {9337pub const getentropy = switch (native_os) {
9338 .linux => if (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 })) private.getentropy else {},
9337 .emscripten => private.getentropy,9339 .emscripten => private.getentropy,
9338 else => {},9340 else => {},
9339};9341};