zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d67bf8bde39fae7ccc23a6ab3aacc3136ffb6b61 (tree)
parent 7d8a556ba92474d78b465b30c8d5df64e9775d93
Author: 孙冰 <sunb@qmrz.net>
Date:   Tue, 25 Mar 2025 10:30:39 +0800

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

Diffstat:
Mlib/std/c.zig | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/std/c.zig b/lib/std/c.zig @@ -9331,9 +9331,11 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_ pub const arc4random_buf = switch (native_os) { .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf, + .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {}, else => {}, }; pub const getentropy = switch (native_os) { + .linux => if (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 })) private.getentropy else {}, .emscripten => private.getentropy, else => {}, };