Debian Codegraph @

build_qnx/qnx_patches/asio_qnx.patch

raw
1 diff --git a/asio/include/asio/detail/impl/posix_thread.ipp b/asio/include/asio/detail/impl/posix_thread.ipp
2 index 760237733..71077b33c 100644
3 --- a/asio/include/asio/detail/impl/posix_thread.ipp
4 +++ b/asio/include/asio/detail/impl/posix_thread.ipp
5 @@ -47,6 +47,11 @@ std::size_t posix_thread::hardware_concurrency()
6 {
7 #if defined(_SC_NPROCESSORS_ONLN)
8 long result = sysconf(_SC_NPROCESSORS_ONLN);
9 +
10 +#if defined(__QNX__)
11 + result &= 0xFFFFFFFF;
12 +#endif //defined(__QNX__)
13 +
14 if (result > 0)
15 return result;
16 #endif // defined(_SC_NPROCESSORS_ONLN)
17 diff --git a/asio/include/asio/detail/socket_types.hpp b/asio/include/asio/detail/socket_types.hpp
18 index cf4f746a4..634591534 100644
19 --- a/asio/include/asio/detail/socket_types.hpp
20 +++ b/asio/include/asio/detail/socket_types.hpp
21 @@ -411,7 +411,13 @@ const int max_iov_len = IOV_MAX;
22 // POSIX platforms are not required to define IOV_MAX.
23 const int max_iov_len = 16;
24 # endif
25 -# define ASIO_OS_DEF_SA_RESTART SA_RESTART
26 +// Note: QNX does not support SA_RESTART
27 +// Therefore they are specifically excluded here.
28 +# if defined(__QNX__)
29 +# define ASIO_OS_DEF_SA_RESTART 0
30 +# else
31 +# define ASIO_OS_DEF_SA_RESTART SA_RESTART
32 +# endif
33 # define ASIO_OS_DEF_SA_NOCLDSTOP SA_NOCLDSTOP
34 # define ASIO_OS_DEF_SA_NOCLDWAIT SA_NOCLDWAIT
35 #endif
36 diff --git a/asio/src/Makefile.am b/asio/src/Makefile.am
37 index 587bb4935..e86a61ad2 100644
38 --- a/asio/src/Makefile.am
39 +++ b/asio/src/Makefile.am
40 @@ -14,20 +14,6 @@ if HAVE_CXX20
41 EXAMPLES_CPP20 = examples/cpp20
42 endif
43
44 -SUBDIRS = \
45 - $(EXAMPLES_CPP11) \
46 - $(EXAMPLES_CPP14) \
47 - $(EXAMPLES_CPP17) \
48 - $(EXAMPLES_CPP20) \
49 - tests
50 -
51 -DIST_SUBDIRS = \
52 - examples/cpp11 \
53 - examples/cpp14 \
54 - examples/cpp17 \
55 - examples/cpp20 \
56 - tests
57 -
58 EXTRA_DIST = \
59 Makefile.mgw \
60 Makefile.msc \
61 diff --git a/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp b/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp
62 index 229509f1c..6982507b0 100644
63 --- a/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp
64 +++ b/asio/src/examples/cpp11/local/fd_passing_stream_client.cpp
65 @@ -23,6 +23,14 @@
66 #include <sys/types.h>
67 #include <sys/socket.h>
68
69 +#if defined(__QNX__)
70 + #undef CMSG_ALIGN
71 + #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
72 +
73 + #undef CMSG_SPACE
74 + #define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
75 +#endif //defined(__QNX__)
76 +
77 using asio::local::stream_protocol;
78
79 constexpr std::size_t max_length = 1024;
80 diff --git a/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp b/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp
81 index 5082185e7..840646613 100644
82 --- a/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp
83 +++ b/asio/src/examples/cpp11/local/fd_passing_stream_server.cpp
84 @@ -22,6 +22,14 @@
85
86 #if defined(ASIO_HAS_LOCAL_SOCKETS)
87
88 +#if defined(__QNX__)
89 + #undef CMSG_ALIGN
90 + #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
91 +
92 + #undef CMSG_SPACE
93 + #define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
94 +#endif //defined(__QNX__)
95 +
96 using asio::local::stream_protocol;
97
98 class session
99 diff --git a/asio/src/tests/unit/ip/multicast.cpp b/asio/src/tests/unit/ip/multicast.cpp
100 index 4f0b3f45e..ced8d1e78 100644
101 --- a/asio/src/tests/unit/ip/multicast.cpp
102 +++ b/asio/src/tests/unit/ip/multicast.cpp
103 @@ -146,17 +146,20 @@ void test()
104 #if (defined(__MACH__) && defined(__APPLE__)) \
105 || defined(__FreeBSD__) \
106 || defined(__NetBSD__) \
107 - || defined(__OpenBSD__)
108 + || defined(__OpenBSD__) \
109 + || defined(__QNX__)
110 const ip::address multicast_address_v6 = ip::make_address("ff02::1%lo0", ec);
111 #else // (defined(__MACH__) && defined(__APPLE__))
112 // || defined(__FreeBSD__)
113 // || defined(__NetBSD__)
114 // || defined(__OpenBSD__)
115 + // || defined(__QNX__)
116 const ip::address multicast_address_v6 = ip::make_address("ff01::1", ec);
117 #endif // (defined(__MACH__) && defined(__APPLE__))
118 // || defined(__FreeBSD__)
119 // || defined(__NetBSD__)
120 // || defined(__OpenBSD__)
121 + // || defined(__QNX__)
122 ASIO_CHECK(!have_v6 || !ec);
123
124 // join_group class.
125 @@ -207,11 +210,11 @@ void test()
126
127 if (have_v6)
128 {
129 -#if defined(__hpux)
130 +#if defined(__hpux) || defined(__QNX__)
131 ip::multicast::outbound_interface outbound_interface(if_nametoindex("lo0"));
132 #else
133 ip::multicast::outbound_interface outbound_interface(1);
134 -#endif
135 +#endif // defined(__hpux) || defined(__QNX__)
136 sock_v6.set_option(outbound_interface, ec);
137 ASIO_CHECK_MESSAGE(!ec, ec.value() << ", " << ec.message());
138 }