mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-28 22:21:15 -07:00
Do not include sys/random.h after defining getrandom() on Linux
This commit is contained in:
parent
e8e5fb8ffd
commit
4d1c4bf0ba
configure.ac
src/libsodium/randombytes
@ -792,7 +792,7 @@ dnl Checks for functions and headers
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
||||
AC_CHECK_FUNCS([arc4random arc4random_buf getentropy])
|
||||
AC_CHECK_FUNCS([arc4random arc4random_buf getrandom getentropy])
|
||||
AC_CHECK_FUNCS([mmap mlock madvise mprotect])
|
||||
])
|
||||
AC_CHECK_FUNCS([posix_memalign getpid nanosleep])
|
||||
|
@ -17,26 +17,27 @@
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
# ifdef __dietlibc__
|
||||
# define _LINUX_SOURCE
|
||||
# include <sys/random.h>
|
||||
# define _LINUX_SOURCE
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
# ifdef HAVE_GETRANDOM
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# else /* __dietlibc__ */
|
||||
# else
|
||||
# include <sys/syscall.h>
|
||||
# if defined(SYS_getrandom) && defined(__NR_getrandom)
|
||||
# define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F))
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# endif
|
||||
# endif /* __dietlibc__ */
|
||||
# endif
|
||||
#elif defined(__FreeBSD__)
|
||||
# include <sys/param.h>
|
||||
# if defined(__FreeBSD_version) && __FreeBSD_version >= 1200000
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#if !defined(NO_BLOCKING_RANDOM_POLL) && defined(__linux__)
|
||||
# define BLOCK_ON_DEV_RANDOM
|
||||
#endif
|
||||
|
@ -8,29 +8,32 @@
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef _WIN32
|
||||
# include <sys/stat.h>
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
# ifdef __dietlibc__
|
||||
# define _LINUX_SOURCE
|
||||
# include <sys/random.h>
|
||||
# define _LINUX_SOURCE
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
# ifdef HAVE_GETRANDOM
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# else /* __dietlibc__ */
|
||||
# else
|
||||
# include <sys/syscall.h>
|
||||
# if defined(SYS_getrandom) && defined(__NR_getrandom)
|
||||
# define getrandom(B, S, F) syscall(SYS_getrandom, (B), (int) (S), (F))
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# endif
|
||||
# endif /* __dietlibc */
|
||||
# endif
|
||||
#elif defined(__FreeBSD__)
|
||||
# include <sys/param.h>
|
||||
# if defined(__FreeBSD_version) && __FreeBSD_version >= 1200000
|
||||
# include <sys/random.h>
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user