aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libc_compat/random/getrandom.c
blob: ba2d393c6b67734195f5f44d2c319e2b9ad9cf39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <sys/random.h>
#include "syscall.h"

#if defined(__has_feature)
	#if __has_feature(memory_sanitizer)
		#include <sanitizer/msan_interface.h>
	#endif
#endif

ssize_t getrandom(void *buf, size_t buflen, unsigned flags)
{
#if defined(__has_feature)
	#if __has_feature(memory_sanitizer)
	__msan_unpoison(buf, buflen);
	#endif
#endif
	return syscall(SYS_getrandom, buf, buflen, flags);
}