diff --git a/CMakeLists.txt b/CMakeLists.txt index d2f738546..9870db45e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -592,12 +592,12 @@ else() endif() if(UNIX OR CYGWIN) - check_include_files(sys/eventfd.h HAVE_AIO_H) - check_include_files(sys/eventfd.h HAVE_EVENTFD_H) - if (HAVE_EVENTFD_H) + check_include_files(aio.h HAVE_AIO_H) + check_include_files(sys/eventfd.h HAVE_SYS_EVENTFD_H) + if (HAVE_SYS_EVENTFD_H) check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE) endif() - check_include_files(sys/timerfd.h HAVE_TIMERFD_H) + check_include_files(sys/timerfd.h HAVE_SYS_TIMERFD_H) check_include_files(poll.h HAVE_POLL_H) list(APPEND CMAKE_REQUIRED_LIBRARIES m) check_symbol_exists(ceill math.h HAVE_MATH_C99_LONG_DOUBLE) diff --git a/config.h.in b/config.h.in index 38e5c102e..ad4be1c51 100644 --- a/config.h.in +++ b/config.h.in @@ -14,8 +14,8 @@ #cmakedefine HAVE_SYS_SELECT_H #cmakedefine HAVE_SYS_SOCKIO_H #cmakedefine HAVE_SYS_STRTIO_H -#cmakedefine HAVE_EVENTFD_H -#cmakedefine HAVE_TIMERFD_H +#cmakedefine HAVE_SYS_EVENTFD_H +#cmakedefine HAVE_SYS_TIMERFD_H #cmakedefine HAVE_TM_GMTOFF #cmakedefine HAVE_AIO_H #cmakedefine HAVE_POLL_H diff --git a/winpr/libwinpr/pipe/pipe.c b/winpr/libwinpr/pipe/pipe.c index 054c2a5e2..d606a2767 100644 --- a/winpr/libwinpr/pipe/pipe.c +++ b/winpr/libwinpr/pipe/pipe.c @@ -45,11 +45,11 @@ #include #include -#ifdef HAVE_AIO_H -#undef HAVE_AIO_H /* disable for now, incomplete */ +#ifdef HAVE_SYS_AIO_H +#undef HAVE_SYS_AIO_H /* disable for now, incomplete */ #endif -#ifdef HAVE_AIO_H +#ifdef HAVE_SYS_AIO_H #include #endif @@ -327,7 +327,7 @@ BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, return FALSE; pipe->lpOverlapped = lpOverlapped; -#ifdef HAVE_AIO_H +#ifdef HAVE_SYS_AIO_H { int aio_status; struct aiocb cb; @@ -416,7 +416,7 @@ BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, return FALSE; pipe->lpOverlapped = lpOverlapped; -#ifdef HAVE_AIO_H +#ifdef HAVE_SYS_AIO_H { struct aiocb cb; ZeroMemory(&cb, sizeof(struct aiocb)); diff --git a/winpr/libwinpr/synch/event.c b/winpr/libwinpr/synch/event.c index 9f7c16806..1fbc4a56b 100644 --- a/winpr/libwinpr/synch/event.c +++ b/winpr/libwinpr/synch/event.c @@ -37,7 +37,7 @@ #include #endif -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H #include #endif @@ -126,7 +126,7 @@ HANDLE CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, event->pipe_fd[0] = -1; event->pipe_fd[1] = -1; -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H event->pipe_fd[0] = eventfd(0, EFD_NONBLOCK); if (event->pipe_fd[0] < 0) @@ -176,7 +176,7 @@ HANDLE OpenEventA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName) return NULL; } -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H #if !defined(WITH_EVENTFD_READ_WRITE) static int eventfd_read(int fd, eventfd_t* value) { @@ -202,7 +202,7 @@ BOOL SetEvent(HANDLE hEvent) if (winpr_Handle_GetInfo(hEvent, &Type, &Object)) { event = (WINPR_EVENT*) Object; -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H eventfd_t val = 1; do @@ -249,7 +249,7 @@ BOOL ResetEvent(HANDLE hEvent) { do { -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H eventfd_t value; length = eventfd_read(event->pipe_fd[0], &value); #else diff --git a/winpr/libwinpr/synch/synch.h b/winpr/libwinpr/synch/synch.h index f8ff0937a..d4948c32d 100644 --- a/winpr/libwinpr/synch/synch.h +++ b/winpr/libwinpr/synch/synch.h @@ -79,7 +79,7 @@ struct winpr_event }; typedef struct winpr_event WINPR_EVENT; -#ifdef HAVE_TIMERFD_H +#ifdef HAVE_SYS_TIMERFD_H #include #include #include diff --git a/winpr/libwinpr/synch/timer.c b/winpr/libwinpr/synch/timer.c index f324c9555..37746c446 100644 --- a/winpr/libwinpr/synch/timer.c +++ b/winpr/libwinpr/synch/timer.c @@ -109,7 +109,7 @@ BOOL TimerCloseHandle(HANDLE handle) if (!timer->lpArgToCompletionRoutine) { -#ifdef HAVE_TIMERFD_H +#ifdef HAVE_SYS_TIMERFD_H if (timer->fd != -1) close(timer->fd); @@ -179,7 +179,7 @@ int InitializeWaitableTimer(WINPR_TIMER* timer) if (!timer->lpArgToCompletionRoutine) { -#ifdef HAVE_TIMERFD_H +#ifdef HAVE_SYS_TIMERFD_H int status; timer->fd = timerfd_create(CLOCK_MONOTONIC, 0); @@ -293,9 +293,9 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPerio #ifdef WITH_POSIX_TIMER LONGLONG seconds = 0; LONGLONG nanoseconds = 0; -#ifdef HAVE_TIMERFD_H +#ifdef HAVE_SYS_TIMERFD_H int status = 0; -#endif /* HAVE_TIMERFD_H */ +#endif /* HAVE_SYS_TIMERFD_H */ #endif /* WITH_POSIX_TIMER */ if (!winpr_Handle_GetInfo(hTimer, &Type, &Object)) @@ -360,7 +360,7 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPerio if (!timer->pfnCompletionRoutine) { -#ifdef HAVE_TIMERFD_H +#ifdef HAVE_SYS_TIMERFD_H status = timerfd_settime(timer->fd, 0, &(timer->timeout), NULL); if (status) diff --git a/winpr/libwinpr/thread/thread.c b/winpr/libwinpr/thread/thread.c index 6dd3f1fc2..0c678aeac 100644 --- a/winpr/libwinpr/thread/thread.c +++ b/winpr/libwinpr/thread/thread.c @@ -77,7 +77,7 @@ #include #endif -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H #include #endif @@ -215,7 +215,7 @@ static BOOL set_event(WINPR_THREAD* thread) { int length; BOOL status = FALSE; -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H eventfd_t val = 1; do @@ -247,7 +247,7 @@ static BOOL reset_event(WINPR_THREAD* thread) { int length; BOOL status = FALSE; -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H eventfd_t value; do @@ -399,7 +399,7 @@ HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, #endif thread->pipe_fd[0] = -1; thread->pipe_fd[1] = -1; -#ifdef HAVE_EVENTFD_H +#ifdef HAVE_SYS_EVENTFD_H thread->pipe_fd[0] = eventfd(0, EFD_NONBLOCK); if (thread->pipe_fd[0] < 0)