[core] fix compiler warnings on Mac OS X

(thx wardw)
This commit is contained in:
Glenn Strauss 2017-06-10 13:22:48 -04:00
parent 9fd39690be
commit 6f88c28c44
5 changed files with 16 additions and 3 deletions

View File

@ -224,7 +224,8 @@ if 1:
getuid select signal pathconf madvise prctl\
writev sigaction sendfile64 send_file kqueue port_create localtime_r posix_fadvise issetugid inet_pton \
memset_s explicit_bzero clock_gettime pipe2 \
getentropy arc4random_buf jrand48 srandom getloadavg'))
arc4random_buf jrand48 srandom getloadavg'))
checkFunc(autoconf, 'getentropy', 'sys/random.h')
checkFunc(autoconf, 'getrandom', 'linux/random.h')
checkTypes(autoconf, Split('pid_t size_t off_t'))

View File

@ -863,7 +863,10 @@ AC_CHECK_FUNCS([dup2 getcwd inet_ntoa inet_ntop inet_pton issetugid memset mmap
getuid select signal pathconf madvise posix_fadvise posix_madvise \
writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r \
memset_s explicit_bzero clock_gettime pipe2 \
getentropy arc4random_buf jrand48 srandom getloadavg])
arc4random_buf jrand48 srandom getloadavg])
AC_CHECK_HEADERS([sys/random.h],[
AC_CHECK_FUNC([getentropy], AC_DEFINE([HAVE_GETENTROPY], [1], [getentropy]))
])
AC_CHECK_HEADERS([linux/random.h],[
AC_CHECK_FUNC([getrandom], AC_DEFINE([HAVE_GETRANDOM], [1], [getrandom]))
])

View File

@ -122,6 +122,11 @@ set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
check_type_size(socklen_t HAVE_SOCKLEN_T)
set(CMAKE_EXTRA_INCLUDE_FILES)
check_include_files(sys/random.h HAVE_SYS_RANDOM_H)
set(CMAKE_EXTRA_INCLUDE_FILES sys/random.h)
check_function_exists(getentropy HAVE_GETENTROPY)
set(CMAKE_EXTRA_INCLUDE_FILES)
check_include_files(linux/random.h HAVE_LINUX_RANDOM_H)
set(CMAKE_EXTRA_INCLUDE_FILES linux/random.h)
check_function_exists(getrandom HAVE_GETRANDOM)
@ -134,7 +139,6 @@ check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF)
check_function_exists(chroot HAVE_CHROOT)
check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
check_function_exists(fork HAVE_FORK)
check_function_exists(getentropy HAVE_GETENTROPY)
check_function_exists(getloadavg HAVE_GETLOADAVG)
check_function_exists(getrlimit HAVE_GETRLIMIT)
check_function_exists(getuid HAVE_GETUID)

View File

@ -13,7 +13,9 @@
#include <errno.h>
#include <fcntl.h>
#ifdef SOCK_CLOEXEC
static int use_sock_cloexec;
#endif
fdevents *fdevent_init(server *srv, size_t maxfds, int type) {
fdevents *ev;

View File

@ -21,6 +21,9 @@
#include <openssl/opensslv.h> /* OPENSSL_VERSION_NUMBER */
#include <openssl/rand.h>
#endif
#ifdef HAVE_GETENTROPY
#include <sys/random.h>
#endif
#ifdef HAVE_LINUX_RANDOM_H
#include <sys/syscall.h>
#include <linux/random.h>