getrandom.c 392 B

123456789101112131415161718
  1. #include <sys/random.h>
  2. #include "syscall.h"
  3. #if defined(__has_feature)
  4. #if __has_feature(memory_sanitizer)
  5. #include <sanitizer/msan_interface.h>
  6. #endif
  7. #endif
  8. ssize_t getrandom(void *buf, size_t buflen, unsigned flags)
  9. {
  10. #if defined(__has_feature)
  11. #if __has_feature(memory_sanitizer)
  12. __msan_unpoison(buf, buflen);
  13. #endif
  14. #endif
  15. return syscall(SYS_getrandom, buf, buflen, flags);
  16. }