diff --git a/asio/include/asio/detail/impl/posix_thread.ipp b/asio/include/asio/detail/impl/posix_thread.ipp index 760237733..71077b33c 100644 --- a/asio/include/asio/detail/impl/posix_thread.ipp +++ b/asio/include/asio/detail/impl/posix_thread.ipp @@ -47,6 +47,11 @@ std::size_t posix_thread::hardware_concurrency() { #if defined(_SC_NPROCESSORS_ONLN) long result = sysconf(_SC_NPROCESSORS_ONLN); + +#if defined(__QNX__) + result &= 0xFFFFFFFF; +#endif //defined(__QNX__) + if (result > 0) return result; #endif // defined(_SC_NPROCESSORS_ONLN) diff --git a/asio/include/asio/detail/socket_types.hpp b/asio/include/asio/detail/socket_types.hpp index cf4f746a4..634591534 100644 --- a/asio/include/asio/detail/socket_types.hpp +++ b/asio/include/asio/detail/socket_types.hpp @@ -411,7 +411,13 @@ const int max_iov_len = IOV_MAX; // POSIX platforms are not required to define IOV_MAX. const int max_iov_len = 16; # endif -# define ASIO_OS_DEF_SA_RESTART SA_RESTART +// Note: QNX does not support SA_RESTART +// Therefore they are specifically excluded here. +# if defined(__QNX__) +# define ASIO_OS_DEF_SA_RESTART 0 +# else +# define ASIO_OS_DEF_SA_RESTART SA_RESTART +# endif # define ASIO_OS_DEF_SA_NOCLDSTOP SA_NOCLDSTOP # define ASIO_OS_DEF_SA_NOCLDWAIT SA_NOCLDWAIT #endif diff --git a/asio/src/Makefile.am b/asio/src/Makefile.am index 587bb4935..e86a61ad2 100644 --- a/asio/src/Makefile.am +++ b/asio/src/Makefile.am @@ -14,20 +14,6 @@ if HAVE_CXX20 EXAMPLES_CPP20 = examples/cpp20 endif -SUBDIRS = \ - $(EXAMPLES_CPP11) \ - $(EXAMPLES_CPP14) \ - $(EXAMPLES_CPP17) \ - $(EXAMPLES_CPP20) \ - tests - -DIST_SUBDIRS = \ - examples/cpp11 \ - examples/cpp14 \ - examples/cpp17 \ - examples/cpp20 \ - tests - EXTRA_DIST = \ Makefile.mgw \ Makefile.msc \ diff --git a/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp b/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp index 229509f1c..6982507b0 100644 --- a/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp +++ b/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp @@ -23,6 +23,14 @@ #include #include +#if defined(__QNX__) + #undef CMSG_ALIGN + #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)) + + #undef CMSG_SPACE + #define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr))) +#endif //defined(__QNX__) + using asio::local::stream_protocol; constexpr std::size_t max_length = 1024; diff --git a/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp b/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp index 5082185e7..840646613 100644 --- a/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp +++ b/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp @@ -22,6 +22,14 @@ #if defined(ASIO_HAS_LOCAL_SOCKETS) +#if defined(__QNX__) + #undef CMSG_ALIGN + #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)) + + #undef CMSG_SPACE + #define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr))) +#endif //defined(__QNX__) + using asio::local::stream_protocol; class session diff --git a/asio/src/tests/unit/ip/multicast.cpp b/asio/src/tests/unit/ip/multicast.cpp index 4f0b3f45e..ced8d1e78 100644 --- a/asio/src/tests/unit/ip/multicast.cpp +++ b/asio/src/tests/unit/ip/multicast.cpp @@ -146,17 +146,20 @@ void test() #if (defined(__MACH__) && defined(__APPLE__)) \ || defined(__FreeBSD__) \ || defined(__NetBSD__) \ - || defined(__OpenBSD__) + || defined(__OpenBSD__) \ + || defined(__QNX__) const ip::address multicast_address_v6 = ip::make_address("ff02::1%lo0", ec); #else // (defined(__MACH__) && defined(__APPLE__)) // || defined(__FreeBSD__) // || defined(__NetBSD__) // || defined(__OpenBSD__) + // || defined(__QNX__) const ip::address multicast_address_v6 = ip::make_address("ff01::1", ec); #endif // (defined(__MACH__) && defined(__APPLE__)) // || defined(__FreeBSD__) // || defined(__NetBSD__) // || defined(__OpenBSD__) + // || defined(__QNX__) ASIO_CHECK(!have_v6 || !ec); // join_group class. @@ -207,11 +210,11 @@ void test() if (have_v6) { -#if defined(__hpux) +#if defined(__hpux) || defined(__QNX__) ip::multicast::outbound_interface outbound_interface(if_nametoindex("lo0")); #else ip::multicast::outbound_interface outbound_interface(1); -#endif +#endif // defined(__hpux) || defined(__QNX__) sock_v6.set_option(outbound_interface, ec); ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message()); }