xref: /linux/arch/s390/kernel/vdso64/vgetrandom.c (revision 870b7fdc660b38c4e1bd8bf48e62aa352ddf8f42)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <asm/facility.h>
4 #include <uapi/asm-generic/errno.h>
5 #include "vdso.h"
6 
7 ssize_t __kernel_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
8 {
9 	if (test_facility(129))
10 		return __cvdso_getrandom(buffer, len, flags, opaque_state, opaque_len);
11 	if (unlikely(opaque_len == ~0UL && !buffer && !len && !flags))
12 		return -ENOSYS;
13 	return getrandom_syscall(buffer, len, flags);
14 }
15