mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 22:04:21 +00:00
* Update wasi-libc to a00bf321eeeca836ee2a0d2d25aeb8524107b8cc It includes a port of emscripten's allocator that performs performs much better than the old one. Most importantly, it includes the prerequisites to later add support for POSIX threads.
20 lines
337 B
C
Vendored
20 lines
337 B
C
Vendored
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <wasi/api.h>
|
|
|
|
int __getentropy(void *buffer, size_t len) {
|
|
if (len > 256) {
|
|
errno = EIO;
|
|
return -1;
|
|
}
|
|
|
|
int r = __wasi_random_get(buffer, len);
|
|
|
|
if (r != 0) {
|
|
errno = r;
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
weak_alias(__getentropy, getentropy);
|