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