getentropy.c (529B)
- // utils-std: Collection of commonly available Unix tools
- // SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- // SPDX-License-Identifier: MPL-2.0
- #define _POSIX_C_SOURCE 202405L
- #ifndef HAS_POSIX_2024
- #define _DEFAULT_SOURCE // getentropy
- #endif
- #include <unistd.h> // getentropy
- int
- main(int argc, char *argv[])
- {
- // Silence unused warnings
- (void)argc;
- (void)argv;
- #define BUFLEN 42
- size_t buflen = BUFLEN;
- char buf[BUFLEN] = "";
- int res = getentropy(buf, buflen);
- return res;
- }