[winpr] use WINPR_ prefix for conditional includes

This commit is contained in:
akallabeth 2023-01-10 14:30:23 +01:00 committed by akallabeth
parent 2479ebd816
commit 92d3e3c64a
41 changed files with 176 additions and 176 deletions

View File

@ -79,7 +79,7 @@ if (NOT WIN32 AND NOT ANDROID AND NOT IOS)
if(KRB5_FLAVOUR STREQUAL "MIT")
add_definitions("-DWITH_KRB5 -DWITH_KRB5_MIT")
if(KRB5_VERSION_1_13)
add_definitions("-DHAVE_AT_LEAST_KRB_V1_13")
add_definitions("-DWINPR_HAVE_AT_LEAST_KRB_V1_13")
endif()
include_directories(${_KRB5_INCLUDE_DIR})
elseif(KRB5_FLAVOUR STREQUAL "Heimdal")
@ -176,36 +176,36 @@ else()
endif()
if(NOT IOS)
CHECK_SYMBOL_EXISTS(strndup string.h HAVE_STRNDUP)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(execinfo.h HAVE_EXECINFO_HEADER)
if (HAVE_EXECINFO_HEADER)
check_symbol_exists(backtrace execinfo.h HAVE_EXECINFO_BACKTRACE)
check_symbol_exists(backtrace_symbols execinfo.h HAVE_EXECINFO_BACKTRACE_SYMBOLS)
check_symbol_exists(backtrace_symbols_fd execinfo.h HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD)
CHECK_SYMBOL_EXISTS(strndup string.h WINPR_HAVE_STRNDUP)
check_include_files(unistd.h WINPR_HAVE_UNISTD_H)
check_include_files(execinfo.h WINPR_HAVE_EXECINFO_HEADER)
if (WINPR_HAVE_EXECINFO_HEADER)
check_symbol_exists(backtrace execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE)
check_symbol_exists(backtrace_symbols execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS)
check_symbol_exists(backtrace_symbols_fd execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD)
# Some implementations (e.g. Android NDK API < 33) provide execinfo.h but do not define
# the backtrace functions. Disable detection for these cases
if (HAVE_EXECINFO_BACKTRACE AND HAVE_EXECINFO_BACKTRACE_SYMBOLS AND HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD)
set(HAVE_EXECINFO_H ON)
if (WINPR_HAVE_EXECINFO_BACKTRACE AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD)
set(WINPR_HAVE_EXECINFO_H ON)
endif()
endif()
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
check_include_files(stdint.h WINPR_HAVE_STDINT_H)
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
else(NOT IOS)
set(HAVE_STDINT_H 1)
set(HAVE_STRNDUP 1)
set(HAVE_INTTYPES_H 1)
set(WINPR_HAVE_STDINT_H 1)
set(WINPR_HAVE_STRNDUP 1)
set(WINPR_HAVE_INTTYPES_H 1)
endif(NOT IOS)
if (NOT IOS)
check_include_files(stdbool.h HAVE_STDBOOL_H)
if (NOT HAVE_STDBOOL_H)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)
if (NOT WINPR_HAVE_STDBOOL_H)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool)
endif()
else()
set(HAVE_STDBOOL_H 1)
set(WINPR_HAVE_STDBOOL_H 1)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
@ -216,31 +216,31 @@ endif()
# Include files
if(NOT IOS)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(aio.h HAVE_AIO_H)
check_include_files(sys/timerfd.h HAVE_SYS_TIMERFD_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
check_include_files(sys/sockio.h HAVE_SYS_SOCKIO_H)
check_include_files(syslog.h HAVE_SYSLOG_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/eventfd.h HAVE_SYS_EVENTFD_H)
check_include_files(unwind.h HAVE_UNWIND_H)
if (HAVE_SYS_EVENTFD_H)
check_include_files(fcntl.h WINPR_HAVE_FCNTL_H)
check_include_files(aio.h WINPR_HAVE_AIO_H)
check_include_files(sys/timerfd.h WINPR_HAVE_SYS_TIMERFD_H)
check_include_files(unistd.h WINPR_HAVE_UNISTD_H)
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
check_include_files(sys/filio.h WINPR_HAVE_SYS_FILIO_H)
check_include_files(sys/sockio.h WINPR_HAVE_SYS_SOCKIO_H)
check_include_files(syslog.h WINPR_HAVE_SYSLOG_H)
check_include_files(sys/select.h WINPR_HAVE_SYS_SELECT_H)
check_include_files(sys/eventfd.h WINPR_HAVE_SYS_EVENTFD_H)
check_include_files(unwind.h WINPR_HAVE_UNWIND_H)
if (WINPR_HAVE_SYS_EVENTFD_H)
check_symbol_exists(eventfd_read sys/eventfd.h WITH_EVENTFD_READ_WRITE)
endif()
include(CheckFunctionExists)
check_function_exists(getlogin_r HAVE_GETLOGIN_R)
check_function_exists(getpwuid_r HAVE_GETPWUID_R)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
check_function_exists(getlogin_r WINPR_HAVE_GETLOGIN_R)
check_function_exists(getpwuid_r WINPR_HAVE_GETPWUID_R)
check_struct_has_member("struct tm" tm_gmtoff time.h WINPR_HAVE_TM_GMTOFF)
else()
set(HAVE_FCNTL_H 1)
set(HAVE_UNISTD_H 1)
set(HAVE_INTTYPES_H 1)
set(HAVE_SYS_FILIO_H 1)
set(HAVE_TM_GMTOFF 1)
set(WINPR_HAVE_FCNTL_H 1)
set(WINPR_HAVE_UNISTD_H 1)
set(WINPR_HAVE_INTTYPES_H 1)
set(WINPR_HAVE_SYS_FILIO_H 1)
set(WINPR_HAVE_TM_GMTOFF 1)
endif()
if(UNIX OR CYGWIN)
@ -252,25 +252,25 @@ if(UNIX OR CYGWIN)
endif()
option(WITH_POLL "Check for and include poll.h" ON)
if (WITH_POLL)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(poll.h WINPR_HAVE_POLL_H)
endif()
endif()
if(NOT WIN32 AND NOT IOS)
if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
if (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
endif (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
if (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
endif (NOT WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
list(APPEND CMAKE_REQUIRED_LIBRARIES pthread)
CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
if (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
set(HAVE_PTHREAD_MUTEX_TIMEDLOCK ON)
endif (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
if (WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
set(WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK ON)
endif (WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES pthread)
endif()

View File

@ -2,27 +2,27 @@
#define WINPR_CONFIG_H
/* Include files */
#cmakedefine HAVE_FCNTL_H
#cmakedefine HAVE_UNISTD_H
#cmakedefine HAVE_INTTYPES_H
#cmakedefine HAVE_STDBOOL_H
#cmakedefine HAVE_AIO_H
#cmakedefine HAVE_SYS_FILIO_H
#cmakedefine HAVE_SYS_SELECT_H
#cmakedefine HAVE_SYS_SOCKIO_H
#cmakedefine HAVE_SYS_EVENTFD_H
#cmakedefine HAVE_SYS_TIMERFD_H
#cmakedefine HAVE_TM_GMTOFF
#cmakedefine HAVE_AIO_H
#cmakedefine HAVE_POLL_H
#cmakedefine HAVE_SYSLOG_H
#cmakedefine HAVE_JOURNALD_H
#cmakedefine HAVE_PTHREAD_MUTEX_TIMEDLOCK
#cmakedefine HAVE_EXECINFO_H
#cmakedefine HAVE_GETLOGIN_R
#cmakedefine HAVE_GETPWUID_R
#cmakedefine HAVE_STRNDUP
#cmakedefine HAVE_UNWIND_H
#cmakedefine WINPR_HAVE_FCNTL_H
#cmakedefine WINPR_HAVE_UNISTD_H
#cmakedefine WINPR_HAVE_INTTYPES_H
#cmakedefine WINPR_HAVE_STDBOOL_H
#cmakedefine WINPR_HAVE_AIO_H
#cmakedefine WINPR_HAVE_SYS_FILIO_H
#cmakedefine WINPR_HAVE_SYS_SELECT_H
#cmakedefine WINPR_HAVE_SYS_SOCKIO_H
#cmakedefine WINPR_HAVE_SYS_EVENTFD_H
#cmakedefine WINPR_HAVE_SYS_TIMERFD_H
#cmakedefine WINPR_HAVE_TM_GMTOFF
#cmakedefine WINPR_HAVE_AIO_H
#cmakedefine WINPR_HAVE_POLL_H
#cmakedefine WINPR_HAVE_SYSLOG_H
#cmakedefine WINPR_HAVE_JOURNALD_H
#cmakedefine WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK
#cmakedefine WINPR_HAVE_EXECINFO_H
#cmakedefine WINPR_HAVE_GETLOGIN_R
#cmakedefine WINPR_HAVE_GETPWUID_R
#cmakedefine WINPR_HAVE_STRNDUP
#cmakedefine WINPR_HAVE_UNWIND_H
#cmakedefine WITH_EVENTFD_READ_WRITE

View File

@ -21,12 +21,12 @@
#define WINPR_WTYPES_H
/* Set by CMake during configuration */
#cmakedefine HAVE_STDINT_H
#cmakedefine HAVE_STDBOOL_H
#cmakedefine WINPR_HAVE_STDINT_H
#cmakedefine WINPR_HAVE_STDBOOL_H
#if !defined(_MSC_VER) || _MSC_VER >= 1900
/* Microsoft's inttypes.h is broken before MSVC 2015 */
#cmakedefine HAVE_INTTYPES_H
#cmakedefine WINPR_HAVE_INTTYPES_H
#endif
/* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
@ -37,15 +37,15 @@
#include <winpr/spec.h>
#ifdef HAVE_STDBOOL_H
#ifdef WINPR_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#ifdef HAVE_STDINT_H
#ifdef WINPR_HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#ifdef WINPR_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
@ -96,7 +96,7 @@ typedef LONG_PTR SSIZE_T;
#define NEAR
#endif
#ifdef HAVE_STDINT_H
#ifdef WINPR_HAVE_STDINT_H
typedef int8_t __int8;
typedef uint8_t __uint8;
typedef int16_t __int16;
@ -138,9 +138,9 @@ typedef unsigned long long __uint64;
#else
#error "64-bit type not configured"
#endif
#endif /* HAVE_STDINT_H */
#endif /* WINPR_HAVE_STDINT_H */
#ifdef HAVE_STDINT_H
#ifdef WINPR_HAVE_STDINT_H
#if defined(__ILP64__) || defined(__LP64__)
#define __int3264 int64_t
#define __uint3264 uint64_t
@ -156,7 +156,7 @@ typedef unsigned long long __uint64;
#define __int3264 __int32
#define __uint3264 __uint32
#endif
#endif /* HAVE_STDINT_H */
#endif /* WINPR_HAVE_STDINT_H */
typedef void* PVOID, *LPVOID, *PVOID64, *LPVOID64;
@ -486,7 +486,7 @@ typedef const BYTE* LPCBYTE;
#endif
/* integer format specifiers */
#ifndef HAVE_INTTYPES_H
#ifndef WINPR_HAVE_INTTYPES_H
#define PRId8 "hhd"
#define PRIi8 "hhi"
#define PRIu8 "hhu"
@ -535,7 +535,7 @@ typedef const BYTE* LPCBYTE;
#define PRIX64 "llX"
#endif
#endif /* _MSC_VER */
#endif /* HAVE_INTTYPES_H not defined*/
#endif /* WINPR_HAVE_INTTYPES_H not defined*/
#ifndef SSIZE_MAX
#if defined(_POSIX_SSIZE_MAX)

View File

@ -25,9 +25,9 @@
#include <winpr/error.h>
#include <winpr/wtypes.h>
//#define HAVE_PATHCCH_H 1
//#define WINPR_HAVE_PATHCCH_H 1
#ifdef HAVE_PATHCCH_H
#ifdef WINPR_HAVE_PATHCCH_H
#include <Pathcch.h>

View File

@ -423,7 +423,7 @@ extern "C"
WINPR_API INT64 GetLine(char** lineptr, size_t* size, FILE* stream);
#if !defined(HAVE_STRNDUP)
#if !defined(WINPR_HAVE_STRNDUP)
WINPR_API char* strndup(const char* s, size_t n);
#endif

View File

@ -694,7 +694,7 @@ INT64 GetLine(char** lineptr, size_t* size, FILE* stream)
#endif
}
#if !defined(HAVE_STRNDUP)
#if !defined(WINPR_HAVE_STRNDUP)
char* strndup(const char* src, size_t n)
{
char* dst = calloc(n + 1, sizeof(char));

View File

@ -33,7 +33,7 @@
#include <winpr/crt.h>
#include <winpr/platform.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -26,11 +26,11 @@
#include <winpr/path.h>
#include <winpr/file.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#ifdef WINPR_HAVE_FCNTL_H
#include <fcntl.h>
#endif
@ -51,11 +51,11 @@
#include <sys/stat.h>
#include <sys/socket.h>
#ifdef HAVE_AIO_H
#undef HAVE_AIO_H /* disable for now, incomplete */
#ifdef WINPR_HAVE_AIO_H
#undef WINPR_HAVE_AIO_H /* disable for now, incomplete */
#endif
#ifdef HAVE_AIO_H
#ifdef WINPR_HAVE_AIO_H
#include <aio.h>
#endif
@ -202,7 +202,7 @@ static void _HandleCreatorsInit()
ArrayList_Append(_HandleCreators, GetFileHandleCreator());
}
#ifdef HAVE_AIO_H
#ifdef WINPR_HAVE_AIO_H
static BOOL g_AioSignalHandlerInstalled = FALSE;
@ -227,7 +227,7 @@ int InstallAioSignalHandler()
return 0;
}
#endif /* HAVE_AIO_H */
#endif /* WINPR_HAVE_AIO_H */
HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,

View File

@ -25,7 +25,7 @@
#include <winpr/path.h>
#include <winpr/file.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -24,11 +24,11 @@
#include <winpr/file.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#ifdef WINPR_HAVE_FCNTL_H
#include <fcntl.h>
#endif

View File

@ -32,7 +32,7 @@
#include "../comm/comm.h"
#include "../security/security.h"
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -30,7 +30,7 @@
#include <stdlib.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -23,7 +23,7 @@
#ifndef _WIN32
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -23,7 +23,7 @@
#include <winpr/memory.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -28,7 +28,7 @@
#include <winpr/pipe.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -43,11 +43,11 @@
#include <winpr/assert.h>
#include <unistd.h>
#ifdef HAVE_SYS_AIO_H
#undef HAVE_SYS_AIO_H /* disable for now, incomplete */
#ifdef WINPR_HAVE_SYS_AIO_H
#undef WINPR_HAVE_SYS_AIO_H /* disable for now, incomplete */
#endif
#ifdef HAVE_SYS_AIO_H
#ifdef WINPR_HAVE_SYS_AIO_H
#include <aio.h>
#endif
@ -306,7 +306,7 @@ BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
return FALSE;
pipe->lpOverlapped = lpOverlapped;
#ifdef HAVE_SYS_AIO_H
#ifdef WINPR_HAVE_SYS_AIO_H
{
int aio_status;
struct aiocb cb = { 0 };
@ -394,7 +394,7 @@ BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
return FALSE;
pipe->lpOverlapped = lpOverlapped;
#ifdef HAVE_SYS_AIO_H
#ifdef WINPR_HAVE_SYS_AIO_H
{
struct aiocb cb = { 0 };

View File

@ -21,7 +21,7 @@
#include <winpr/crt.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -32,7 +32,7 @@
#include <winpr/crt.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -198,7 +198,7 @@ krb5_error_code krb5glue_get_init_creds(krb5_context ctx, krb5_principal princ,
cleanup:
krb5_init_creds_free(ctx, creds_ctx);
#ifdef HAVE_AT_LEAST_KRB_V1_13
#ifdef WINPR_HAVE_AT_LEAST_KRB_V1_13
krb5_get_init_creds_opt_free(ctx, gic_opt);
#endif
winpr_DeleteFile(tmp_profile_path);

View File

@ -55,11 +55,11 @@
#include <winpr/crt.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(HAVE_GETPWUID_R)
#if defined(WINPR_HAVE_GETPWUID_R)
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
@ -204,7 +204,7 @@ BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG
switch (NameFormat)
{
case NameSamCompatible:
#if defined(HAVE_GETPWUID_R)
#if defined(WINPR_HAVE_GETPWUID_R)
{
int rc;
struct passwd pwd = { 0 };
@ -217,7 +217,7 @@ BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG
if (result == NULL)
return FALSE;
}
#elif defined(HAVE_GETLOGIN_R)
#elif defined(WINPR_HAVE_GETLOGIN_R)
if (getlogin_r(lpNameBuffer, *nSize) != 0)
return FALSE;
#else

View File

@ -28,7 +28,7 @@
#include "synch.h"
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -31,11 +31,11 @@
#include "synch.h"
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
#include <sys/eventfd.h>
#endif
@ -77,7 +77,7 @@ static void dump_event(WINPR_EVENT* event, size_t index)
}
#endif /* WITH_DEBUG_EVENTS */
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
#if !defined(WITH_EVENTFD_READ_WRITE)
static int eventfd_read(int fd, eventfd_t* value)
{
@ -91,7 +91,7 @@ static int eventfd_write(int fd, eventfd_t value)
#endif
#endif
#ifndef HAVE_SYS_EVENTFD_H
#ifndef WINPR_HAVE_SYS_EVENTFD_H
static BOOL set_non_blocking_fd(int fd)
{
int flags;
@ -101,11 +101,11 @@ static BOOL set_non_blocking_fd(int fd)
return fcntl(fd, F_SETFL, flags | O_NONBLOCK) >= 0;
}
#endif /* !HAVE_SYS_EVENTFD_H */
#endif /* !WINPR_HAVE_SYS_EVENTFD_H */
BOOL winpr_event_init(WINPR_EVENT_IMPL* event)
{
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
event->fds[1] = -1;
event->fds[0] = eventfd(0, EFD_NONBLOCK);
@ -130,7 +130,7 @@ out_error:
void winpr_event_init_from_fd(WINPR_EVENT_IMPL* event, int fd)
{
event->fds[0] = fd;
#ifndef HAVE_SYS_EVENTFD_H
#ifndef WINPR_HAVE_SYS_EVENTFD_H
event->fds[1] = fd;
#endif
}
@ -140,7 +140,7 @@ BOOL winpr_event_set(WINPR_EVENT_IMPL* event)
int ret;
do
{
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
eventfd_t value = 1;
ret = eventfd_write(event->fds[0], value);
#else
@ -158,7 +158,7 @@ BOOL winpr_event_reset(WINPR_EVENT_IMPL* event)
{
do
{
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
eventfd_t value = 1;
ret = eventfd_read(event->fds[0], &value);
#else

View File

@ -23,7 +23,7 @@
#include <winpr/config.h>
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
#include <sys/eventfd.h>
#endif

View File

@ -9,7 +9,7 @@
#define TAG WINPR_TAG("sync.pollset")
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
static INT16 handle_mode_to_pollevent(ULONG mode)
{
INT16 event = 0;
@ -27,7 +27,7 @@ static INT16 handle_mode_to_pollevent(ULONG mode)
BOOL pollset_init(WINPR_POLL_SET* set, size_t nhandles)
{
WINPR_ASSERT(set);
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
if (nhandles > MAXIMUM_WAIT_OBJECTS)
{
set->isStatic = FALSE;
@ -61,7 +61,7 @@ BOOL pollset_init(WINPR_POLL_SET* set, size_t nhandles)
void pollset_uninit(WINPR_POLL_SET* set)
{
WINPR_ASSERT(set);
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
if (!set->isStatic)
free(set->pollset);
#else
@ -72,7 +72,7 @@ void pollset_uninit(WINPR_POLL_SET* set)
void pollset_reset(WINPR_POLL_SET* set)
{
WINPR_ASSERT(set);
#ifndef HAVE_POLL_H
#ifndef WINPR_HAVE_POLL_H
FD_ZERO(&set->rset_base);
FD_ZERO(&set->wset_base);
set->maxFd = 0;
@ -84,7 +84,7 @@ void pollset_reset(WINPR_POLL_SET* set)
BOOL pollset_add(WINPR_POLL_SET* set, int fd, ULONG mode)
{
WINPR_ASSERT(set);
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
struct pollfd* item;
if (set->fillIndex == set->size)
return FALSE;
@ -129,7 +129,7 @@ int pollset_poll(WINPR_POLL_SET* set, DWORD dwMilliseconds)
else
dueTime = now + dwMilliseconds;
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
int timeout;
do
@ -212,7 +212,7 @@ BOOL pollset_isSignaled(WINPR_POLL_SET* set, size_t idx)
return FALSE;
}
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
return !!(set->pollset[idx].revents & set->pollset[idx].events);
#else
FdIndex* fdIndex = &set->fdIndex[idx];
@ -240,7 +240,7 @@ BOOL pollset_isReadSignaled(WINPR_POLL_SET* set, size_t idx)
return FALSE;
}
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
return !!(set->pollset[idx].revents & POLLIN);
#else
FdIndex* fdIndex = &set->fdIndex[idx];
@ -262,7 +262,7 @@ BOOL pollset_isWriteSignaled(WINPR_POLL_SET* set, size_t idx)
return FALSE;
}
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
return !!(set->pollset[idx].revents & POLLOUT);
#else
FdIndex* fdIndex = &set->fdIndex[idx];

View File

@ -26,7 +26,7 @@
#ifndef _WIN32
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
#include <poll.h>
#else
#include <sys/select.h>
@ -40,7 +40,7 @@ typedef struct
struct winpr_poll_set
{
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
struct pollfd* pollset;
struct pollfd staticSet[MAXIMUM_WAIT_OBJECTS];
BOOL isStatic;

View File

@ -23,7 +23,7 @@
#include "synch.h"
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -39,7 +39,7 @@
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#endif
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 500
#endif

View File

@ -65,7 +65,7 @@ struct winpr_semaphore
};
typedef struct winpr_semaphore WINPR_SEMAPHORE;
#ifdef HAVE_SYS_TIMERFD_H
#ifdef WINPR_HAVE_SYS_TIMERFD_H
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

View File

@ -20,7 +20,7 @@
#include <winpr/config.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -118,7 +118,7 @@ int _mach_safe_clock_gettime(int clk_id, struct timespec* t)
* http://code.google.com/p/android/issues/detail?id=7807
* http://aleksmaus.blogspot.ca/2011/12/missing-pthreadmutextimedlock-on.html
*/
#if !defined(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
#if !defined(WINPR_HAVE_PTHREAD_MUTEX_TIMEDLOCK)
#include <pthread.h>
static long long ts_difftime(const struct timespec* o, const struct timespec* n)
@ -458,7 +458,7 @@ DWORD WaitForMultipleObjectsEx(DWORD nCount, const HANDLE* lpHandles, BOOL bWait
status = pollset_poll(&pollset, waitTime);
if (status < 0)
{
#ifdef HAVE_POLL_H
#ifdef WINPR_HAVE_POLL_H
WLog_ERR(TAG, "poll() handle %" PRIu32 " (%" PRIu32 ") failure [%d] %s", index,
nCount, errno, strerror(errno));
#else

View File

@ -61,7 +61,7 @@
#include <time.h>
#include <sys/time.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -24,7 +24,7 @@
#include <winpr/thread.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -73,11 +73,11 @@
#include <winpr/crt.h>
#include <winpr/platform.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_EVENTFD_H
#ifdef WINPR_HAVE_SYS_EVENTFD_H
#include <sys/eventfd.h>
#endif

View File

@ -401,7 +401,7 @@ DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
goto out_error;
memset(tz, 0, sizeof(TIME_ZONE_INFORMATION));
#ifdef HAVE_TM_GMTOFF
#ifdef WINPR_HAVE_TM_GMTOFF
{
long bias = -(local_time->tm_gmtoff / 60L);

View File

@ -40,7 +40,7 @@ set(LODEPNG_SRCS
lodepng/lodepng.c
lodepng/lodepng.h)
if (HAVE_SYSLOG_H)
if (WINPR_HAVE_SYSLOG_H)
set(SYSLOG_SRCS
wlog/SyslogAppender.c
wlog/SyslogAppender.h
@ -107,13 +107,13 @@ set(SRCS
if (ANDROID)
list(APPEND SRCS android.h android.c)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if (NOT HAVE_UNWIND_H)
if (NOT WINPR_HAVE_UNWIND_H)
message("[backtrace] android NDK without unwind.h, falling back to corkscrew")
set(HAVE_CORKSCREW 1)
set(WINPR_HAVE_CORKSCREW 1)
endif()
endif()
if (HAVE_CORKSCREW)
if (WINPR_HAVE_CORKSCREW)
list(APPEND SRCS
corkscrew/debug.c
corkscrew/debug.h)
@ -125,13 +125,13 @@ if (WIN32)
windows/debug.h)
endif()
if (HAVE_EXECINFO_H)
if (WINPR_HAVE_EXECINFO_H)
list(APPEND SRCS
execinfo/debug.c
execinfo/debug.h)
endif()
if (HAVE_UNWIND_H)
if (WINPR_HAVE_UNWIND_H)
option(USE_UNWIND "Use unwind.h to generate backtraces" ON)
if (USE_UNWIND)
add_definitions(-DUSE_UNWIND)

View File

@ -19,7 +19,7 @@
#include <winpr/config.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -19,7 +19,7 @@
#include <winpr/config.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -26,7 +26,7 @@
#include <winpr/crt.h>
#include <winpr/string.h>
#if defined(HAVE_EXECINFO_H)
#if defined(WINPR_HAVE_EXECINFO_H)
#include <execinfo/debug.h>
#endif
@ -34,7 +34,7 @@
#include <unwind/debug.h>
#endif
#if defined(HAVE_CORKSCREW)
#if defined(WINPR_HAVE_CORKSCREW)
#include <corkscrew/debug.h>
#endif
@ -92,9 +92,9 @@ void winpr_backtrace_free(void* buffer)
#if defined(USE_UNWIND)
winpr_unwind_backtrace_free(buffer);
#elif defined(HAVE_EXECINFO_H)
#elif defined(WINPR_HAVE_EXECINFO_H)
winpr_execinfo_backtrace_free(buffer);
#elif defined(HAVE_CORKSCREW)
#elif defined(WINPR_HAVE_CORKSCREW)
winpr_corkscrew_backtrace_free(buffer);
#elif defined(_WIN32) || defined(_WIN64)
winpr_win_backtrace_free(buffer);
@ -107,9 +107,9 @@ void* winpr_backtrace(DWORD size)
{
#if defined(USE_UNWIND)
return winpr_unwind_backtrace(size);
#elif defined(HAVE_EXECINFO_H)
#elif defined(WINPR_HAVE_EXECINFO_H)
return winpr_execinfo_backtrace(size);
#elif defined(HAVE_CORKSCREW)
#elif defined(WINPR_HAVE_CORKSCREW)
return winpr_corkscrew_backtrace(size);
#elif (defined(_WIN32) || defined(_WIN64)) && !defined(_UWP)
return winpr_win_backtrace(size);
@ -132,9 +132,9 @@ char** winpr_backtrace_symbols(void* buffer, size_t* used)
#if defined(USE_UNWIND)
return winpr_unwind_backtrace_symbols(buffer, used);
#elif defined(HAVE_EXECINFO_H)
#elif defined(WINPR_HAVE_EXECINFO_H)
return winpr_execinfo_backtrace_symbols(buffer, used);
#elif defined(HAVE_CORKSCREW)
#elif defined(WINPR_HAVE_CORKSCREW)
return winpr_corkscrew_backtrace_symbols(buffer, used);
#elif (defined(_WIN32) || defined(_WIN64)) && !defined(_UWP)
return winpr_win_backtrace_symbols(buffer, used);
@ -152,7 +152,7 @@ void winpr_backtrace_symbols_fd(void* buffer, int fd)
return;
}
#if defined(HAVE_EXECINFO_H) && !defined(USE_UNWIND)
#if defined(WINPR_HAVE_EXECINFO_H) && !defined(USE_UNWIND)
winpr_execinfo_backtrace_symbols_fd(buffer, fd);
#elif !defined(ANDROID)
{

View File

@ -31,7 +31,7 @@
#include "../log.h"
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -112,12 +112,12 @@ static wLogAppender* WLog_Appender_New(wLog* log, DWORD logAppenderType)
case WLOG_APPENDER_CALLBACK:
appender = WLog_CallbackAppender_New(log);
break;
#ifdef HAVE_SYSLOG_H
#ifdef WINPR_HAVE_SYSLOG_H
case WLOG_APPENDER_SYSLOG:
appender = WLog_SyslogAppender_New(log);
break;
#endif
#ifdef HAVE_JOURNALD_H
#ifdef WINPR_HAVE_JOURNALD_H
case WLOG_APPENDER_JOURNALD:
appender = WLog_JournaldAppender_New(log);
break;

View File

@ -26,10 +26,10 @@
#include "ConsoleAppender.h"
#include "BinaryAppender.h"
#include "CallbackAppender.h"
#ifdef HAVE_JOURNALD_H
#ifdef WINPR_HAVE_JOURNALD_H
#include "JournaldAppender.h"
#endif
#ifdef HAVE_SYSLOG_H
#ifdef WINPR_HAVE_SYSLOG_H
#include "SyslogAppender.h"
#endif
#include "UdpAppender.h"

View File

@ -145,12 +145,12 @@ static BOOL CALLBACK WLog_InitializeRoot(PINIT_ONCE InitOnce, PVOID Parameter, P
else if (_stricmp(env, "BINARY") == 0)
logAppenderType = WLOG_APPENDER_BINARY;
#ifdef HAVE_SYSLOG_H
#ifdef WINPR_HAVE_SYSLOG_H
else if (_stricmp(env, "SYSLOG") == 0)
logAppenderType = WLOG_APPENDER_SYSLOG;
#endif /* HAVE_SYSLOG_H */
#ifdef HAVE_JOURNALD_H
#endif /* WINPR_HAVE_SYSLOG_H */
#ifdef WINPR_HAVE_JOURNALD_H
else if (_stricmp(env, "JOURNALD") == 0)
logAppenderType = WLOG_APPENDER_JOURNALD;

View File

@ -24,13 +24,13 @@
#include <winpr/winsock.h>
#ifdef HAVE_UNISTD_H
#ifdef WINPR_HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_FILIO_H
#ifdef WINPR_HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
#ifdef WINPR_HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif