From ae91f4fcbd03c551aa24158261e49e48bbb722c4 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Wed, 6 Mar 2024 11:45:42 +0000 Subject: [PATCH] QNX: Add in build support Support compiling QNX 7 SDK. --- CMakeLists.txt | 2 ++ configure.ac | 5 +++++ src/coap_io.c | 2 +- src/coap_net.c | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99c4123596..8a6ea55def 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,8 @@ check_function_exists(if_nametoindex HAVE_IF_NAMETOINDEX) if(WIN32 AND NOT MINGW) set(HAVE_STRUCT_CMSGHDR 1) message(STATUS "setting HAVE_STRUCT_CMSGHDR") +elseif(${CMAKE_SYSTEM_NAME} STREQUAL QNX) + set(HAVE_STRUCT_CMSGHDR 0) else() check_symbol_exists( CMSG_FIRSTHDR diff --git a/configure.ac b/configure.ac index 08878ea324..488b924ed9 100644 --- a/configure.ac +++ b/configure.ac @@ -1120,6 +1120,11 @@ case $host in LIBS="${LIBS} -lws2_32" ;; + *-qnx*) + AC_MSG_RESULT([QNX]) + ADDITIONAL_CFLAGS="-D_QNX_SOURCE" + ;; + *xtensa-esp32-elf*) AC_MSG_RESULT([XtensaEsp32Elf]) ADDITIONAL_CFLAGS="-D_GNU_SOURCE -DWITH_POSIX" diff --git a/src/coap_io.c b/src/coap_io.c index bab869eb0f..e7baf9d660 100644 --- a/src/coap_io.c +++ b/src/coap_io.c @@ -794,7 +794,7 @@ static __declspec(thread) LPFN_WSARECVMSG lpWSARecvMsg = NULL; #define iov_len_t size_t #endif -#if defined(_CYGWIN_ENV) +#if defined(_CYGWIN_ENV) || defined(__QNXNTO__) #define ipi_spec_dst ipi_addr #endif diff --git a/src/coap_net.c b/src/coap_net.c index 625fd4e5d0..a6ad2c152b 100644 --- a/src/coap_net.c +++ b/src/coap_net.c @@ -4333,6 +4333,7 @@ coap_join_mcast_group_intf(coap_context_t *ctx, const char *group_name, "cannot get interface index for '%s'\n", ifname); } +#elif defined(__QNXNTO__) #else /* !HAVE_IF_NAMETOINDEX */ result = ioctl(ctx->endpoint->sock.fd, SIOCGIFINDEX, &ifr); if (result != 0) {