You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.7 KiB

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