hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From f3b6cdadf19269be25645a102fef89baaf289769 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Sat, 30 Nov 2019 12:18:51 -0800
Subject: [PATCH] fix uclibc eventfd
 
Use eventfd() function with uClibc
 
The Boost eventfd code either directly makes the eventfd system call
using __NR_eventfd (when __GLIBC_MINOR is less than 8), or otherwise
uses the eventfd() function provided by the C library.
 
However, since uClibc pretends to be glibc 2.2, the Boost eventfd code
directly uses the system call. While it works fine on most
architectures, it doesn't on ARC since __NR_eventfd is not defined on
this architecture. However, eventfd() is properly implemented.
 
So, this patch adjusts the logic used by Boost to consider uClibc as a
C library providing the eventfd() function.
 
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[Aduskett@gmail.com: Modified to work with the standalone package.]
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
 asio/include/asio/detail/impl/eventfd_select_interrupter.ipp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 
diff --git a/asio/include/asio/detail/impl/eventfd_select_interrupter.ipp b/asio/include/asio/detail/impl/eventfd_select_interrupter.ipp
index 9ff9bc8..04e3477 100644
--- a/asio/include/asio/detail/impl/eventfd_select_interrupter.ipp
+++ b/asio/include/asio/detail/impl/eventfd_select_interrupter.ipp
@@ -23,7 +23,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
 # include <asm/unistd.h>
 #else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
 # include <sys/eventfd.h>
@@ -45,7 +45,7 @@ eventfd_select_interrupter::eventfd_select_interrupter()
 
 void eventfd_select_interrupter::open_descriptors()
 {
-#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
+#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 && !defined(__UCLIBC__)
   write_descriptor_ = read_descriptor_ = syscall(__NR_eventfd, 0);
   if (read_descriptor_ != -1)
   {
-- 
2.23.0