aboutsummaryrefslogtreecommitdiff
path: root/lib/std/c.zig
diff options
context:
space:
mode:
author孙冰 <sunb@qmrz.net>2025-03-25 10:30:39 +0800
committerAlex Rønne Petersen <alex@alexrp.com>2025-03-25 13:17:45 +0100
commitfbbdde41b42a3ecc3773217ae2cf4a9350d3dd00 (patch)
tree871c913499e5786093749f060f06ef38479bda6d /lib/std/c.zig
parentc94d926bba9344cfab9b00b2bb418ca0e7a32b51 (diff)
downloadzig-fbbdde41b42a3ecc3773217ae2cf4a9350d3dd00.tar.gz
zig-fbbdde41b42a3ecc3773217ae2cf4a9350d3dd00.zip
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 (limited to 'lib/std/c.zig')
-rw-r--r--lib/std/c.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/c.zig b/lib/std/c.zig
index 53cd75f789..2a68a68c4d 100644
--- a/lib/std/c.zig
+++ b/lib/std/c.zig
@@ -10196,10 +10196,12 @@ pub extern "c" fn sendfile64(out_fd: fd_t, in_fd: fd_t, offset: ?*i64, count: us
pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_int;
pub const arc4random_buf = switch (native_os) {
- .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.arc4random_buf,
+ .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {},
+ .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf,
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 => {},
};