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 13:17:45+01:00
logfbbdde41b42a3ecc3773217ae2cf4a9350d3dd00
tree871c913499e5786093749f060f06ef38479bda6d
parentc94d926bba9344cfab9b00b2bb418ca0e7a32b51

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, 3 insertions(+), 1 deletions(-)

lib/std/c.zig+3-1
......@@ -10196,10 +10196,12 @@ pub extern "c" fn sendfile64(out_fd: fd_t, in_fd: fd_t, offset: ?*i64, count: us
1019610196pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_int;
1019710197
1019810198pub const arc4random_buf = switch (native_os) {
10199 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.arc4random_buf,
10199 .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {},
10200 .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
1020010201 else => {},
1020110202};
1020210203pub const getentropy = switch (native_os) {
10204 .linux => if (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 })) private.getentropy else {},
1020310205 .emscripten => private.getentropy,
1020410206 else => {},
1020510207};