Merge branch 'cmake-configure-fixes-v2'

Fixes in cmake, to make it more like configure and support some
cross-compiling.

* cmake-configure-fixes-v2:
  cmake: fix extracting of the version from git (check for number of matches)
  Detect arch4random_addrandom() existence
  Use off_t instead of ev_off_t for sendfile() (fixes android build)
  cmake: detect _GNU_SOURCE not by __GNU_LIBRARY__ only (fallback to _GNU_SOURCE)
  Check for WNOWAIT in waitpid() in runtime (not in cmake/configure)
  cmake: add <pthread.h> into CMAKE_REQUIRED_INCLUDES for sizeof(pthread_t)
  cmake: fix values for #cmakedefine
  cmake: drop duplicates from event-config template
  cmake: add value for the #cmakedefine macros (like autoconf)
  cmake: Fix checking of enum values from sysctl.h

(cherry picked from commit 5aade2d30b6c5eff226cbf7b63fda5a01987ba4f)
This commit is contained in:
Azat Khuzhin 2017-03-08 17:58:26 +03:00 committed by Azat Khuzhin
parent 0864138a8f
commit a0bfe2c451
No known key found for this signature in database
GPG Key ID: B86086848EF8686D
10 changed files with 201 additions and 207 deletions

View File

@ -52,6 +52,7 @@ include(CheckStructHasMember)
include(CheckCSourceCompiles)
include(CheckPrototypeDefinition)
include(CheckFunctionKeywords)
include(CheckConstExists)
include(AddCompilerFlags)
include(VersionViaGit)
@ -223,7 +224,14 @@ if (SOLARIS)
endif()
# Check if _GNU_SOURCE is available.
CHECK_SYMBOL_EXISTS(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
if (NOT _GNU_SOURCE)
CHECK_SYMBOL_EXISTS(__GNU_LIBRARY__ "features.h" _GNU_SOURCE)
if (NOT _GNU_SOURCE)
unset(_GNU_SOURCE CACHE)
CHECK_SYMBOL_EXISTS(_GNU_SOURCE "features.h" _GNU_SOURCE)
endif()
endif()
if (_GNU_SOURCE)
add_definitions(-D_GNU_SOURCE)
@ -330,6 +338,7 @@ CHECK_FUNCTION_EXISTS_EX(sysctl EVENT__HAVE_SYSCTL)
CHECK_FUNCTION_EXISTS_EX(accept4 EVENT__HAVE_ACCEPT4)
CHECK_FUNCTION_EXISTS_EX(arc4random EVENT__HAVE_ARC4RANDOM)
CHECK_FUNCTION_EXISTS_EX(arc4random_buf EVENT__HAVE_ARC4RANDOM_BUF)
CHECK_FUNCTION_EXISTS_EX(arc4random_addrandom EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
CHECK_FUNCTION_EXISTS_EX(epoll_create1 EVENT__HAVE_EPOLL_CREATE1)
CHECK_FUNCTION_EXISTS_EX(getegid EVENT__HAVE_GETEGID)
CHECK_FUNCTION_EXISTS_EX(geteuid EVENT__HAVE_GETEUID)
@ -412,10 +421,10 @@ else()
endif()
CHECK_SYMBOL_EXISTS(TAILQ_FOREACH sys/queue.h EVENT__HAVE_TAILQFOREACH)
CHECK_SYMBOL_EXISTS(CTL_KERN sys/sysctl.h EVENT__HAVE_DECL_CTL_KERN)
CHECK_SYMBOL_EXISTS(KERN_ARND sys/sysctl.h EVENT__HAVE_DECL_KERN_ARND)
CHECK_SYMBOL_EXISTS(KERN_RANDOM sys/sysctl.h EVENT__HAVE_DECL_KERN_RANDOM)
CHECK_SYMBOL_EXISTS(RANDOM_UUID sys/sysctl.h EVENT__HAVE_DECL_RANDOM_UUID)
CHECK_CONST_EXISTS(CTL_KERN sys/sysctl.h EVENT__HAVE_DECL_CTL_KERN)
CHECK_CONST_EXISTS(KERN_ARND sys/sysctl.h EVENT__HAVE_DECL_KERN_ARND)
CHECK_CONST_EXISTS(KERN_RANDOM sys/sysctl.h EVENT__HAVE_DECL_KERN_RANDOM)
CHECK_CONST_EXISTS(RANDOM_UUID sys/sysctl.h EVENT__HAVE_DECL_RANDOM_UUID)
CHECK_SYMBOL_EXISTS(F_SETFD fcntl.h EVENT__HAVE_SETFD)
CHECK_TYPE_SIZE(fd_mask EVENT__HAVE_FD_MASK)
@ -470,6 +479,7 @@ else()
endif()
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
list(APPEND CMAKE_EXTRA_INCLUDE_FILES pthread.h)
CHECK_TYPE_SIZE(pthread_t EVENT__SIZEOF_PTHREAD_T)
endif()
@ -492,8 +502,6 @@ CHECK_TYPE_SIZE("void *" EVENT__SIZEOF_VOID_P)
#CHECK_FILE_OFFSET_BITS()
#set(EVENT___FILE_OFFSET_BITS _FILE_OFFSET_BITS)
include(CheckWaitpidSupportWNOWAIT)
# Verify kqueue works with pipes.
if (EVENT__HAVE_KQUEUE)
if (CMAKE_CROSSCOMPILING AND NOT EVENT__FORCE_KQUEUE_CHECK)

View File

@ -2465,7 +2465,7 @@ evbuffer_write_sendfile(struct evbuffer *buffer, evutil_socket_t dest_fd,
ev_off_t len = chain->off;
#elif defined(SENDFILE_IS_LINUX) || defined(SENDFILE_IS_SOLARIS)
ev_ssize_t res;
ev_off_t offset = chain->misalign;
off_t offset = chain->misalign;
#endif
ASSERT_EVBUFFER_LOCKED(buffer);

View File

@ -0,0 +1,23 @@
include(CheckCSourceCompiles)
macro(check_const_exists CONST FILES VARIABLE)
set(check_const_exists_source "")
foreach(file ${FILES})
set(check_const_exists_source
"${check_const_exists_source}
#include <${file}>")
endforeach()
set(check_const_exists_source
"${check_const_exists_source}
int main() { (void)${CONST}; return 0; }")
check_c_source_compiles("${check_const_exists_source}" ${VARIABLE})
if (${${VARIABLE}})
set(${VARIABLE} 1 CACHE INTERNAL "Have const ${CONST}")
message(STATUS "Looking for ${CONST} - found")
else()
set(${VARIABLE} 0 CACHE INTERNAL "Have const ${CONST}")
message(STATUS "Looking for ${CONST} - not found")
endif()
endmacro(check_const_exists)

View File

@ -1,18 +0,0 @@
include(CheckCSourceRuns)
check_c_source_runs(
"
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int
main(int argc, char** argv)
{
pid_t pid;
int status;
if ((pid = fork()) == 0) _exit(0);
_exit(waitpid(pid, &status, WNOWAIT) == -1);
}"
EVENT__HAVE_WAITPID_WITH_WNOWAIT)

View File

@ -38,24 +38,27 @@ macro(event_fuzzy_version_from_git)
GITRET
OUTPUT_VARIABLE
GITVERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (GITRET EQUAL 0)
string(REGEX REPLACE "[\\._-]" ";" VERSION_LIST "${GITVERSION}")
list(GET VERSION_LIST 1 _MAJOR)
list(GET VERSION_LIST 2 _MINOR)
list(GET VERSION_LIST 3 _PATCH)
list(GET VERSION_LIST 4 _STAGE)
string(REGEX REPLACE "[\\._-]" ";" VERSION_LIST "${GITVERSION}")
list(LENGTH VERSION_LIST VERSION_LIST_LENGTH)
set(_DEFAULT_VERSION "${EVENT_GIT___VERSION_MAJOR}.${EVENT_GIT___VERSION_MINOR}.${EVENT_GIT___VERSION_PATCH}-${EVENT_GIT___VERSION_STAGE}")
set(_GIT_VERSION "${_MAJOR}.${_MINOR}.${_PATCH}-${_STAGE}")
if ((GITRET EQUAL 0) AND (VERSION_LIST_LENGTH EQUAL 5))
list(GET VERSION_LIST 1 _MAJOR)
list(GET VERSION_LIST 2 _MINOR)
list(GET VERSION_LIST 3 _PATCH)
list(GET VERSION_LIST 4 _STAGE)
if (${_DEFAULT_VERSION} VERSION_LESS ${_GIT_VERSION})
set(EVENT_GIT___VERSION_MAJOR ${_MAJOR})
set(EVENT_GIT___VERSION_MINOR ${_MINOR})
set(EVENT_GIT___VERSION_PATCH ${_PATCH})
set(EVENT_GIT___VERSION_STAGE ${_STAGE})
endif()
set(_DEFAULT_VERSION "${EVENT_GIT___VERSION_MAJOR}.${EVENT_GIT___VERSION_MINOR}.${EVENT_GIT___VERSION_PATCH}-${EVENT_GIT___VERSION_STAGE}")
set(_GIT_VERSION "${_MAJOR}.${_MINOR}.${_PATCH}-${_STAGE}")
if (${_DEFAULT_VERSION} VERSION_LESS ${_GIT_VERSION})
set(EVENT_GIT___VERSION_MAJOR ${_MAJOR})
set(EVENT_GIT___VERSION_MINOR ${_MINOR})
set(EVENT_GIT___VERSION_PATCH ${_PATCH})
set(EVENT_GIT___VERSION_STAGE ${_STAGE})
endif()
endif()
endif()
endmacro()

View File

@ -342,6 +342,7 @@ AC_CHECK_FUNCS([ \
accept4 \
arc4random \
arc4random_buf \
arc4random_addrandom \
eventfd \
epoll_create1 \
fcntl \
@ -599,26 +600,6 @@ main(int argc, char **argv)
fi
AM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"])
AC_MSG_CHECKING(waitpid support WNOWAIT)
AC_TRY_RUN(
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int
main(int argc, char** argv)
{
pid_t pid;
int status;
if ((pid = fork()) == 0) _exit(0);
_exit(waitpid(pid, &status, WNOWAIT) == -1);
}, [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WAITPID_WITH_WNOWAIT, 1,
[Define if waitpid() supports WNOWAIT])
], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
haveeventports=no
AC_CHECK_FUNCS(port_create, [haveeventports=yes], )
if test "x$haveeventports" = "xyes" ; then

View File

@ -36,397 +36,397 @@
#define EVENT__PACKAGE_TARNAME ""
/* Define if libevent should build without support for a debug mode */
#cmakedefine EVENT__DISABLE_DEBUG_MODE
#cmakedefine EVENT__DISABLE_DEBUG_MODE 1
/* Define if libevent should not allow replacing the mm functions */
#cmakedefine EVENT__DISABLE_MM_REPLACEMENT
#cmakedefine EVENT__DISABLE_MM_REPLACEMENT 1
/* Define if libevent should not be compiled with thread support */
#cmakedefine EVENT__DISABLE_THREAD_SUPPORT
#cmakedefine EVENT__DISABLE_THREAD_SUPPORT 1
/* Define to 1 if you have the `accept4' function. */
#cmakedefine EVENT__HAVE_ACCEPT4
#cmakedefine EVENT__HAVE_ACCEPT4 1
/* Define to 1 if you have the `arc4random' function. */
#cmakedefine EVENT__HAVE_ARC4RANDOM
#cmakedefine EVENT__HAVE_ARC4RANDOM 1
/* Define to 1 if you have the `arc4random_buf' function. */
#cmakedefine EVENT__HAVE_ARC4RANDOM_BUF
#cmakedefine EVENT__HAVE_ARC4RANDOM_BUF 1
/* Define if clock_gettime is available in libc */
#cmakedefine EVENT__DNS_USE_CPU_CLOCK_FOR_ID
#cmakedefine EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1
/* Define is no secure id variant is available */
#cmakedefine EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID
#cmakedefine EVENT__DNS_USE_FTIME_FOR_ID
#cmakedefine EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID 1
#cmakedefine EVENT__DNS_USE_FTIME_FOR_ID 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine EVENT__HAVE_ARPA_INET_H
#cmakedefine EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */
#cmakedefine EVENT__HAVE_CLOCK_GETTIME
#cmakedefine EVENT__HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the declaration of `CTL_KERN'. */
#cmakedefine EVENT__HAVE_DECL_CTL_KERN
#define EVENT__HAVE_DECL_CTL_KERN @EVENT__HAVE_DECL_CTL_KERN@
/* Define to 1 if you have the declaration of `KERN_ARND'. */
#cmakedefine EVENT__HAVE_DECL_KERN_ARND
#define EVENT__HAVE_DECL_KERN_ARND @EVENT__HAVE_DECL_KERN_ARND@
/* Define to 1 if you have the declaration of `KERN_RANDOM'. */
#cmakedefine EVENT__HAVE_DECL_KERN_RANDOM
#define EVENT__HAVE_DECL_KERN_RANDOM @EVENT__HAVE_DECL_KERN_RANDOM@
/* Define to 1 if you have the declaration of `RANDOM_UUID'. */
#define EVENT__HAVE_DECL_RANDOM_UUID @EVENT__HAVE_DECL_RANDOM_UUID@
/* Define if /dev/poll is available */
#cmakedefine EVENT__HAVE_DEVPOLL
#cmakedefine EVENT__HAVE_DEVPOLL 1
/* Define to 1 if you have the <netdb.h> header file. */
#cmakedefine EVENT__HAVE_NETDB_H
#cmakedefine EVENT__HAVE_NETDB_H 1
/* Define to 1 if fd_mask type is defined */
#cmakedefine EVENT__HAVE_FD_MASK
#cmakedefine EVENT__HAVE_FD_MASK 1
/* Define to 1 if the <sys/queue.h> header file defines TAILQ_FOREACH. */
#cmakedefine EVENT__HAVE_TAILQFOREACH
#cmakedefine EVENT__HAVE_TAILQFOREACH 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine EVENT__HAVE_DLFCN_H
#cmakedefine EVENT__HAVE_DLFCN_H 1
/* Define if your system supports the epoll system calls */
#cmakedefine EVENT__HAVE_EPOLL
#cmakedefine EVENT__HAVE_EPOLL 1
/* Define to 1 if you have the `epoll_create1' function. */
#cmakedefine EVENT__HAVE_EPOLL_CREATE1
#cmakedefine EVENT__HAVE_EPOLL_CREATE1 1
/* Define to 1 if you have the `epoll_ctl' function. */
#cmakedefine EVENT__HAVE_EPOLL_CTL
#cmakedefine EVENT__HAVE_EPOLL_CTL 1
/* Define to 1 if you have the `eventfd' function. */
#cmakedefine EVENT__HAVE_EVENTFD
#cmakedefine EVENT__HAVE_EVENTFD 1
/* Define if your system supports event ports */
#cmakedefine EVENT__HAVE_EVENT_PORTS
#cmakedefine EVENT__HAVE_EVENT_PORTS 1
/* Define to 1 if you have the `fcntl' function. */
#cmakedefine EVENT__HAVE_FCNTL
#cmakedefine EVENT__HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine EVENT__HAVE_FCNTL_H
#cmakedefine EVENT__HAVE_FCNTL_H 1
/* Define to 1 if you have the `getaddrinfo' function. */
#cmakedefine EVENT__HAVE_GETADDRINFO
#cmakedefine EVENT__HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getegid' function. */
#cmakedefine EVENT__HAVE_GETEGID
#cmakedefine EVENT__HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
#cmakedefine EVENT__HAVE_GETEUID
#cmakedefine EVENT__HAVE_GETEUID 1
/* TODO: Check for different gethostname argument counts. CheckPrototypeDefinition.cmake can be used. */
/* Define this if you have any gethostbyname_r() */
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R 1
/* Define this if gethostbyname_r takes 3 arguments */
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_3_ARG
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_3_ARG 1
/* Define this if gethostbyname_r takes 5 arguments */
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_5_ARG
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_5_ARG 1
/* Define this if gethostbyname_r takes 6 arguments */
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_6_ARG
#cmakedefine EVENT__HAVE_GETHOSTBYNAME_R_6_ARG 1
/* Define to 1 if you have the `getifaddrs' function. */
#cmakedefine EVENT__HAVE_GETIFADDRS
#cmakedefine EVENT__HAVE_GETIFADDRS 1
/* Define to 1 if you have the `getnameinfo' function. */
#cmakedefine EVENT__HAVE_GETNAMEINFO
#cmakedefine EVENT__HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getprotobynumber' function. */
#cmakedefine EVENT__HAVE_GETPROTOBYNUMBER
#cmakedefine EVENT__HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the `getservbyname' function. */
#cmakedefine EVENT__HAVE_GETSERVBYNAME
#cmakedefine EVENT__HAVE_GETSERVBYNAME 1
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine EVENT__HAVE_GETTIMEOFDAY
#cmakedefine EVENT__HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <ifaddrs.h> header file. */
#cmakedefine EVENT__HAVE_IFADDRS_H
#cmakedefine EVENT__HAVE_IFADDRS_H 1
/* Define to 1 if you have the `inet_ntop' function. */
#cmakedefine EVENT__HAVE_INET_NTOP
#cmakedefine EVENT__HAVE_INET_NTOP 1
/* Define to 1 if you have the `inet_pton' function. */
#cmakedefine EVENT__HAVE_INET_PTON
#cmakedefine EVENT__HAVE_INET_PTON 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine EVENT__HAVE_INTTYPES_H
#cmakedefine EVENT__HAVE_INTTYPES_H 1
/* Define to 1 if you have the `issetugid' function. */
#cmakedefine EVENT__HAVE_ISSETUGID
#cmakedefine EVENT__HAVE_ISSETUGID 1
/* Define to 1 if you have the `kqueue' function. */
#cmakedefine EVENT__HAVE_KQUEUE
#cmakedefine EVENT__HAVE_KQUEUE 1
/* Define if the system has zlib */
#cmakedefine EVENT__HAVE_LIBZ
#cmakedefine EVENT__HAVE_LIBZ 1
/* Define to 1 if you have the `mach_absolute_time' function. */
#cmakedefine EVENT__HAVE_MACH_ABSOLUTE_TIME
#cmakedefine EVENT__HAVE_MACH_ABSOLUTE_TIME 1
/* Define to 1 if you have the <mach/mach_time.h> header file. */
#cmakedefine EVENT__HAVE_MACH_MACH_TIME_H
#cmakedefine EVENT__HAVE_MACH_MACH_TIME_H 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine EVENT__HAVE_MEMORY_H
#cmakedefine EVENT__HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
#cmakedefine EVENT__HAVE_MMAP
#cmakedefine EVENT__HAVE_MMAP 1
/* Define to 1 if you have the `nanosleep' function. */
#cmakedefine EVENT__HAVE_NANOSLEEP
#cmakedefine EVENT__HAVE_NANOSLEEP 1
/* Define to 1 if you have the `usleep' function. */
#cmakedefine EVENT__HAVE_USLEEP
#cmakedefine EVENT__HAVE_USLEEP 1
/* Define to 1 if you have the <netinet/in6.h> header file. */
#cmakedefine EVENT__HAVE_NETINET_IN6_H
#cmakedefine EVENT__HAVE_NETINET_IN6_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#cmakedefine EVENT__HAVE_NETINET_IN_H
#cmakedefine EVENT__HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#cmakedefine EVENT__HAVE_NETINET_TCP_H
#cmakedefine EVENT__HAVE_NETINET_TCP_H 1
/* Define if the system has openssl */
#cmakedefine EVENT__HAVE_OPENSSL
#cmakedefine EVENT__HAVE_OPENSSL 1
/* Define to 1 if you have the `pipe' function. */
#cmakedefine EVENT__HAVE_PIPE
#cmakedefine EVENT__HAVE_PIPE 1
/* Define to 1 if you have the `pipe2' function. */
#cmakedefine EVENT__HAVE_PIPE2
#cmakedefine EVENT__HAVE_PIPE2 1
/* Define to 1 if you have the `poll' function. */
#cmakedefine EVENT__HAVE_POLL
#cmakedefine EVENT__HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#cmakedefine EVENT__HAVE_POLL_H
#cmakedefine EVENT__HAVE_POLL_H 1
/* Define to 1 if you have the `port_create' function. */
#cmakedefine EVENT__HAVE_PORT_CREATE
#cmakedefine EVENT__HAVE_PORT_CREATE 1
/* Define to 1 if you have the <port.h> header file. */
#cmakedefine EVENT__HAVE_PORT_H
#cmakedefine EVENT__HAVE_PORT_H 1
/* Define if we have pthreads on this system */
#cmakedefine EVENT__HAVE_PTHREADS
#cmakedefine EVENT__HAVE_PTHREADS 1
/* Define to 1 if you have the `putenv' function. */
#cmakedefine EVENT__HAVE_PUTENV
#cmakedefine EVENT__HAVE_PUTENV 1
/* Define to 1 if the system has the type `sa_family_t'. */
#cmakedefine EVENT__HAVE_SA_FAMILY_T
#cmakedefine EVENT__HAVE_SA_FAMILY_T 1
/* Define to 1 if you have the `select' function. */
#cmakedefine EVENT__HAVE_SELECT
#cmakedefine EVENT__HAVE_SELECT 1
/* Define to 1 if you have the `setenv' function. */
#cmakedefine EVENT__HAVE_SETENV
#cmakedefine EVENT__HAVE_SETENV 1
/* Define if F_SETFD is defined in <fcntl.h> */
#cmakedefine EVENT__HAVE_SETFD
#cmakedefine EVENT__HAVE_SETFD 1
/* Define to 1 if you have the `setrlimit' function. */
#cmakedefine EVENT__HAVE_SETRLIMIT
#cmakedefine EVENT__HAVE_SETRLIMIT 1
/* Define to 1 if you have the `sendfile' function. */
#cmakedefine EVENT__HAVE_SENDFILE
/* Define if F_SETFD is defined in <fcntl.h> */
#cmakedefine EVENT__HAVE_SETFD
#cmakedefine EVENT__HAVE_SENDFILE 1
/* Define to 1 if you have the `sigaction' function. */
#cmakedefine EVENT__HAVE_SIGACTION
#cmakedefine EVENT__HAVE_SIGACTION 1
/* Define to 1 if you have the `signal' function. */
#cmakedefine EVENT__HAVE_SIGNAL
#cmakedefine EVENT__HAVE_SIGNAL 1
/* Define to 1 if you have the `splice' function. */
#cmakedefine EVENT__HAVE_SPLICE
#cmakedefine EVENT__HAVE_SPLICE 1
/* Define to 1 if you have the <stdarg.h> header file. */
#cmakedefine EVENT__HAVE_STDARG_H
#cmakedefine EVENT__HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine EVENT__HAVE_STDDEF_H
#cmakedefine EVENT__HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine EVENT__HAVE_STDINT_H
#cmakedefine EVENT__HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine EVENT__HAVE_STDLIB_H
#cmakedefine EVENT__HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine EVENT__HAVE_STRINGS_H
#cmakedefine EVENT__HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine EVENT__HAVE_STRING_H
#cmakedefine EVENT__HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
#cmakedefine EVENT__HAVE_STRLCPY
#cmakedefine EVENT__HAVE_STRLCPY 1
/* Define to 1 if you have the `strsep' function. */
#cmakedefine EVENT__HAVE_STRSEP
#cmakedefine EVENT__HAVE_STRSEP 1
/* Define to 1 if you have the `strtok_r' function. */
#cmakedefine EVENT__HAVE_STRTOK_R
#cmakedefine EVENT__HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */
#cmakedefine EVENT__HAVE_STRTOLL
#cmakedefine EVENT__HAVE_STRTOLL 1
/* Define to 1 if the system has the type `struct addrinfo'. */
#cmakedefine EVENT__HAVE_STRUCT_ADDRINFO
#cmakedefine EVENT__HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct in6_addr'. */
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if `s6_addr16' is member of `struct in6_addr'. */
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
/* Define to 1 if `s6_addr32' is member of `struct in6_addr'. */
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32
#cmakedefine EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN6
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
/* Define to 1 if `sin6_len' is member of `struct sockaddr_in6'. */
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
/* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
#cmakedefine EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY 1
/* Define to 1 if the system has the type `struct linger'. */
#cmakedefine EVENT__HAVE_STRUCT_LINGER
#cmakedefine EVENT__HAVE_STRUCT_LINGER 1
/* Define to 1 if you have the `sysctl' function. */
#cmakedefine EVENT__HAVE_SYSCTL
#cmakedefine EVENT__HAVE_SYSCTL 1
/* Define to 1 if you have the <sys/devpoll.h> header file. */
#cmakedefine EVENT__HAVE_SYS_DEVPOLL_H
#cmakedefine EVENT__HAVE_SYS_DEVPOLL_H 1
/* Define to 1 if you have the <sys/epoll.h> header file. */
#cmakedefine EVENT__HAVE_SYS_EPOLL_H
#cmakedefine EVENT__HAVE_SYS_EPOLL_H 1
/* Define to 1 if you have the <sys/eventfd.h> header file. */
#cmakedefine EVENT__HAVE_SYS_EVENTFD_H
#cmakedefine EVENT__HAVE_SYS_EVENTFD_H 1
/* Define to 1 if you have the <sys/event.h> header file. */
#cmakedefine EVENT__HAVE_SYS_EVENT_H
#cmakedefine EVENT__HAVE_SYS_EVENT_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#cmakedefine EVENT__HAVE_SYS_IOCTL_H
#cmakedefine EVENT__HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#cmakedefine EVENT__HAVE_SYS_MMAN_H
#cmakedefine EVENT__HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#cmakedefine EVENT__HAVE_SYS_PARAM_H
#cmakedefine EVENT__HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/queue.h> header file. */
#cmakedefine EVENT__HAVE_SYS_QUEUE_H
#cmakedefine EVENT__HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine EVENT__HAVE_SYS_RESOURCE_H
#cmakedefine EVENT__HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#cmakedefine EVENT__HAVE_SYS_SELECT_H
#cmakedefine EVENT__HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#cmakedefine EVENT__HAVE_SYS_SENDFILE_H
#cmakedefine EVENT__HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#cmakedefine EVENT__HAVE_SYS_SOCKET_H
#cmakedefine EVENT__HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine EVENT__HAVE_SYS_STAT_H
#cmakedefine EVENT__HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#cmakedefine EVENT__HAVE_SYS_SYSCTL_H
#cmakedefine EVENT__HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/timerfd.h> header file. */
#cmakedefine EVENT__HAVE_SYS_TIMERFD_H */
#cmakedefine EVENT__HAVE_SYS_TIMERFD_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine EVENT__HAVE_SYS_TIME_H
#cmakedefine EVENT__HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine EVENT__HAVE_SYS_TYPES_H
#cmakedefine EVENT__HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#cmakedefine EVENT__HAVE_SYS_UIO_H
#cmakedefine EVENT__HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#cmakedefine EVENT__HAVE_SYS_WAIT_H
#cmakedefine EVENT__HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine EVENT__HAVE_ERRNO_H
#cmakedefine EVENT__HAVE_ERRNO_H 1
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
#cmakedefine EVENT__HAVE_TAILQFOREACH
#cmakedefine EVENT__HAVE_TAILQFOREACH 1
/* Define if timeradd is defined in <sys/time.h> */
#cmakedefine EVENT__HAVE_TIMERADD
#cmakedefine EVENT__HAVE_TIMERADD 1
/* Define if timerclear is defined in <sys/time.h> */
#cmakedefine EVENT__HAVE_TIMERCLEAR
#cmakedefine EVENT__HAVE_TIMERCLEAR 1
/* Define if timercmp is defined in <sys/time.h> */
#cmakedefine EVENT__HAVE_TIMERCMP
#cmakedefine EVENT__HAVE_TIMERCMP 1
/* Define to 1 if you have the `timerfd_create' function. */
#cmakedefine EVENT__HAVE_TIMERFD_CREATE
#cmakedefine EVENT__HAVE_TIMERFD_CREATE 1
/* Define if timerisset is defined in <sys/time.h> */
#cmakedefine EVENT__HAVE_TIMERISSET
#cmakedefine EVENT__HAVE_TIMERISSET 1
/* Define to 1 if the system has the type `uint8_t'. */
#cmakedefine EVENT__HAVE_UINT8_T
#cmakedefine EVENT__HAVE_UINT8_T 1
/* Define to 1 if the system has the type `uint16_t'. */
#cmakedefine EVENT__HAVE_UINT16_T
#cmakedefine EVENT__HAVE_UINT16_T 1
/* Define to 1 if the system has the type `uint32_t'. */
#cmakedefine EVENT__HAVE_UINT32_T
#cmakedefine EVENT__HAVE_UINT32_T 1
/* Define to 1 if the system has the type `uint64_t'. */
#cmakedefine EVENT__HAVE_UINT64_T
#cmakedefine EVENT__HAVE_UINT64_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
#cmakedefine EVENT__HAVE_UINTPTR_T
#cmakedefine EVENT__HAVE_UINTPTR_T 1
/* Define to 1 if you have the `umask' function. */
#cmakedefine EVENT__HAVE_UMASK
#cmakedefine EVENT__HAVE_UMASK 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine EVENT__HAVE_UNISTD_H
#cmakedefine EVENT__HAVE_UNISTD_H 1
/* Define to 1 if you have the `unsetenv' function. */
#cmakedefine EVENT__HAVE_UNSETENV
#cmakedefine EVENT__HAVE_UNSETENV 1
/* Define to 1 if you have the `vasprintf' function. */
#cmakedefine EVENT__HAVE_VASPRINTF
#cmakedefine EVENT__HAVE_VASPRINTF 1
/* Define if kqueue works correctly with pipes */
#cmakedefine EVENT__HAVE_WORKING_KQUEUE
#cmakedefine EVENT__HAVE_WORKING_KQUEUE 1
#ifdef __USE_UNUSED_DEFINITIONS__
/* Define to necessary symbol if this constant uses a non-standard name on your system. */
@ -459,10 +459,10 @@
#define EVENT__SIZEOF_SIZE_T @EVENT__SIZEOF_SIZE_T@
/* Define to 1 if you have the ANSI C header files. */
#cmakedefine EVENT__STDC_HEADERS
#cmakedefine EVENT__STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#cmakedefine EVENT__TIME_WITH_SYS_TIME
#cmakedefine EVENT__TIME_WITH_SYS_TIME 1
/* The size of `socklen_t', as computed by sizeof. */
#define EVENT__SIZEOF_SOCKLEN_T @EVENT__SIZEOF_SOCKLEN_T@
@ -524,9 +524,6 @@
/* Define to `int' if <sys/types.h> does not define. */
#define EVENT__ssize_t @EVENT__ssize_t@
#cmakedefine EVENT__NEED_DLLIMPORT
#cmakedefine EVENT__NEED_DLLIMPORT 1
/* Define if waitpid() supports WNOWAIT */
#cmakedefine EVENT__HAVE_WAITPID_WITH_WNOWAIT
#endif
#endif /* \EVENT2_EVENT_CONFIG_H_INCLUDED_ */

View File

@ -192,12 +192,14 @@ evutil_secure_rng_get_bytes(void *buf, size_t n)
ev_arc4random_buf(buf, n);
}
#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
void
evutil_secure_rng_add_bytes(const char *buf, size_t n)
{
arc4random_addrandom((unsigned char*)buf,
n>(size_t)INT_MAX ? INT_MAX : (int)n);
}
#endif
void
evutil_free_secure_rng_globals_(void)

View File

@ -842,6 +842,7 @@ int evutil_secure_rng_init(void);
EVENT2_EXPORT_SYMBOL
int evutil_secure_rng_set_urandom_device_file(char *fname);
#ifdef EVENT__HAVE_ARC4RANDOM_ADDRANDOM
/** Seed the random number generator with extra random bytes.
You should almost never need to call this function; it should be
@ -858,6 +859,7 @@ int evutil_secure_rng_set_urandom_device_file(char *fname);
*/
EVENT2_EXPORT_SYMBOL
void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
#endif
#ifdef __cplusplus
}

View File

@ -855,11 +855,6 @@ test_fork(void)
int status;
struct event ev, sig_ev, usr_ev, existing_ev;
pid_t pid;
int wait_flags = 0;
#ifdef EVENT__HAVE_WAITPID_WITH_WNOWAIT
wait_flags |= WNOWAIT;
#endif
setup_test("After fork: ");
@ -934,7 +929,8 @@ test_fork(void)
}
TT_BLATHER(("Before waitpid"));
if (waitpid(pid, &status, wait_flags) == -1) {
if ((waitpid(pid, &status, WNOWAIT) == -1 && errno == EINVAL) &&
waitpid(pid, &status, 0) == -1) {
perror("waitpid");
exit(1);
}