b32ad939980686ee0b0acd632fb14fd4f81e8658
[feed/packages.git] / libs / boost / patches / 001-uclibc-asio.patch
1 From 95d82acc57bb7d8bae431f7a6ce0707aac3ef33f Mon Sep 17 00:00:00 2001
2 From: Rosen Penev <rosenp@gmail.com>
3 Date: Thu, 5 Sep 2019 19:41:13 -0700
4 Subject: [PATCH] Use eventfd() function with uClibc
5
6 The Boost eventfd code either directly makes the eventfd system call
7 using __NR_eventfd (when __GLIBC_MINOR is less than 8), or otherwise
8 uses the eventfd() function provided by the C library.
9
10 However, since uClibc pretends to be glibc 2.2, the Boost eventfd code
11 directly uses the system call. While it works fine on most
12 architectures, it doesn't on ARC since __NR_eventfd is not defined on
13 this architecture. However, eventfd() is properly implemented.
14
15 So, this patch adjusts the logic used by Boost to consider uClibc as a
16 C library providing the eventfd() function.
17
18 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
19 Signed-off-by: Rosen Penev <rosenp@gmail.com>
20 ---
21 a/boost/asio/detail/impl/eventfd_select_interrupter.ipp | 12 ++++++------
22 1 file changed, 6 insertions(+), 6 deletions(-)
23
24 diff --git a/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/boost/asio/detail/impl/eventfd_select_interrupter.ipp
25 index 38d4b2a61..e16cc8b00 100644
26 --- a/boost/asio/detail/impl/eventfd_select_interrupter.ipp
27 +++ b/boost/asio/detail/impl/eventfd_select_interrupter.ipp
28 @@ -23,11 +23,11 @@
29 #include <sys/stat.h>
30 #include <sys/types.h>
31 #include <fcntl.h>
32 -#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
33 +#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 && !defined(__UCLIBC__)
34 # include <asm/unistd.h>
35 -#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
36 +#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 && !defined(__UCLIBC__)
37 # include <sys/eventfd.h>
38 -#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
39 +#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 && !defined(__UCLIBC__)
40 #include <boost/asio/detail/cstdint.hpp>
41 #include <boost/asio/detail/eventfd_select_interrupter.hpp>
42 #include <boost/asio/detail/throw_error.hpp>
43 @@ -46,14 +46,14 @@ eventfd_select_interrupter::eventfd_select_interrupter()
44
45 void eventfd_select_interrupter::open_descriptors()
46 {
47 -#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
48 +#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 && !defined(__UCLIBC__)
49 write_descriptor_ = read_descriptor_ = syscall(__NR_eventfd, 0);
50 if (read_descriptor_ != -1)
51 {
52 ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
53 ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
54 }
55 -#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
56 +#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 && !defined(__UCLIBC__)
57 # if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
58 write_descriptor_ = read_descriptor_ =
59 ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
60 @@ -70,7 +70,7 @@ void eventfd_select_interrupter::open_descriptors()
61 ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
62 }
63 }
64 -#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
65 +#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 && !defined(__UCLIBC__)
66
67 if (read_descriptor_ == -1)
68 {