999-eventfd_use_bits_scheme.patch 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. From fd355bc1dbcb794ae1abf0fad1459e28d8567ba0 Mon Sep 17 00:00:00 2001
  2. From: Hiroaki KAWAI <kawai@stratosphere.co.jp>
  3. Date: Fri, 19 Apr 2013 01:09:35 +0000
  4. Subject: eventfd.h: Use new "bits/" scheme for arch-specific flags
  5. As in timerfd.h, eventfd.h needs arch-specific definition files.
  6. alpha, mips and sparc needs separate file, all the other arch
  7. will use common definition.
  8. This problem is already fixed in glibc.
  9. Also sanitize and provide bits for hppa.
  10. Make sure not to install the new bits/eventfd unless eventfd support is
  11. enabled.
  12. Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
  13. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
  14. ---
  15. --- a/Makefile.in
  16. +++ b/Makefile.in
  17. @@ -272,6 +272,7 @@ HEADERS_RM-$(UCLIBC_HAS_XATTR)
  18. HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h
  19. HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/eventfd.h sys/fsuid.h \
  20. bits/inotify.h \
  21. + bits/eventfd.h \
  22. sys/inotify.h \
  23. sys/kdaemon.h \
  24. sys/perm.h \
  25. --- /dev/null
  26. +++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
  27. @@ -0,0 +1,31 @@
  28. +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
  29. + This file is part of the GNU C Library.
  30. +
  31. + The GNU C Library is free software; you can redistribute it and/or
  32. + modify it under the terms of the GNU Lesser General Public
  33. + License as published by the Free Software Foundation; either
  34. + version 2.1 of the License, or (at your option) any later version.
  35. +
  36. + The GNU C Library is distributed in the hope that it will be useful,
  37. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  39. + Lesser General Public License for more details.
  40. +
  41. + You should have received a copy of the GNU Lesser General Public
  42. + License along with the GNU C Library; if not, see
  43. + <http://www.gnu.org/licenses/>. */
  44. +
  45. +#ifndef _SYS_EVENTFD_H
  46. +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
  47. +#endif
  48. +
  49. +/* Flags for eventfd. */
  50. +enum
  51. + {
  52. + EFD_SEMAPHORE = 000000001,
  53. +#define EFD_SEMAPHORE EFD_SEMAPHORE
  54. + EFD_CLOEXEC = 010000000,
  55. +#define EFD_CLOEXEC EFD_CLOEXEC
  56. + EFD_NONBLOCK = 000000004
  57. +#define EFD_NONBLOCK EFD_NONBLOCK
  58. + };
  59. --- /dev/null
  60. +++ b/libc/sysdeps/linux/common/bits/eventfd.h
  61. @@ -0,0 +1,31 @@
  62. +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
  63. + This file is part of the GNU C Library.
  64. +
  65. + The GNU C Library is free software; you can redistribute it and/or
  66. + modify it under the terms of the GNU Lesser General Public
  67. + License as published by the Free Software Foundation; either
  68. + version 2.1 of the License, or (at your option) any later version.
  69. +
  70. + The GNU C Library is distributed in the hope that it will be useful,
  71. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  72. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  73. + Lesser General Public License for more details.
  74. +
  75. + You should have received a copy of the GNU Lesser General Public
  76. + License along with the GNU C Library; if not, see
  77. + <http://www.gnu.org/licenses/>. */
  78. +
  79. +#ifndef _SYS_EVENTFD_H
  80. +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
  81. +#endif
  82. +
  83. +/* Flags for eventfd. */
  84. +enum
  85. + {
  86. + EFD_SEMAPHORE = 00000001,
  87. +#define EFD_SEMAPHORE EFD_SEMAPHORE
  88. + EFD_CLOEXEC = 02000000,
  89. +#define EFD_CLOEXEC EFD_CLOEXEC
  90. + EFD_NONBLOCK = 00004000
  91. +#define EFD_NONBLOCK EFD_NONBLOCK
  92. + };
  93. --- a/libc/sysdeps/linux/common/sys/eventfd.h
  94. +++ b/libc/sysdeps/linux/common/sys/eventfd.h
  95. @@ -1,4 +1,4 @@
  96. -/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
  97. +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
  98. This file is part of the GNU C Library.
  99. The GNU C Library is free software; you can redistribute it and/or
  100. @@ -21,21 +21,12 @@
  101. #include <stdint.h>
  102. +/* Get the platform-dependent flags. */
  103. +#include <bits/eventfd.h>
  104. /* Type for event counter. */
  105. typedef uint64_t eventfd_t;
  106. -/* Flags for signalfd. */
  107. -enum
  108. - {
  109. - EFD_SEMAPHORE = 1,
  110. -#define EFD_SEMAPHORE EFD_SEMAPHORE
  111. - EFD_CLOEXEC = 02000000,
  112. -#define EFD_CLOEXEC EFD_CLOEXEC
  113. - EFD_NONBLOCK = 04000
  114. -#define EFD_NONBLOCK EFD_NONBLOCK
  115. - };
  116. -
  117. __BEGIN_DECLS
  118. @@ -43,6 +34,16 @@ __BEGIN_DECLS
  119. value to COUNT. */
  120. extern int eventfd (int __count, int __flags) __THROW;
  121. +#if 0 /* not (yet) implemented in uClibc */
  122. +
  123. +/* Read event counter and possibly wait for events. */
  124. +extern int eventfd_read (int __fd, eventfd_t *__value);
  125. +
  126. +/* Increment event counter. */
  127. +extern int eventfd_write (int __fd, eventfd_t __value);
  128. +
  129. +#endif
  130. +
  131. __END_DECLS
  132. #endif /* sys/eventfd.h */
  133. --- /dev/null
  134. +++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
  135. @@ -0,0 +1,32 @@
  136. +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
  137. + This file is part of the GNU C Library.
  138. +
  139. + The GNU C Library is free software; you can redistribute it and/or
  140. + modify it under the terms of the GNU Lesser General Public
  141. + License as published by the Free Software Foundation; either
  142. + version 2.1 of the License, or (at your option) any later version.
  143. +
  144. + The GNU C Library is distributed in the hope that it will be useful,
  145. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  146. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  147. + Lesser General Public License for more details.
  148. +
  149. + You should have received a copy of the GNU Lesser General Public
  150. + License along with the GNU C Library. If not, see
  151. + <http://www.gnu.org/licenses/>. */
  152. +
  153. +#ifndef _SYS_EVENTFD_H
  154. +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
  155. +#endif
  156. +
  157. +/* Flags for signalfd. */
  158. +enum
  159. + {
  160. + EFD_SEMAPHORE = 000000001,
  161. +#define EFD_SEMAPHORE EFD_SEMAPHORE
  162. + EFD_CLOEXEC = 010000000,
  163. +#define EFD_CLOEXEC EFD_CLOEXEC
  164. +/* the below value looks suspicious, should be 000200004 for consistency */
  165. + EFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */
  166. +#define EFD_NONBLOCK EFD_NONBLOCK
  167. + };
  168. --- /dev/null
  169. +++ b/libc/sysdeps/linux/mips/bits/eventfd.h
  170. @@ -0,0 +1,31 @@
  171. +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
  172. + This file is part of the GNU C Library.
  173. +
  174. + The GNU C Library is free software; you can redistribute it and/or
  175. + modify it under the terms of the GNU Lesser General Public
  176. + License as published by the Free Software Foundation; either
  177. + version 2.1 of the License, or (at your option) any later version.
  178. +
  179. + The GNU C Library is distributed in the hope that it will be useful,
  180. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  181. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  182. + Lesser General Public License for more details.
  183. +
  184. + You should have received a copy of the GNU Lesser General Public
  185. + License along with the GNU C Library; if not, see
  186. + <http://www.gnu.org/licenses/>. */
  187. +
  188. +#ifndef _SYS_EVENTFD_H
  189. +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
  190. +#endif
  191. +
  192. +/* Flags for eventfd. */
  193. +enum
  194. + {
  195. + EFD_SEMAPHORE = 00000001,
  196. +#define EFD_SEMAPHORE EFD_SEMAPHORE
  197. + EFD_CLOEXEC = 02000000,
  198. +#define EFD_CLOEXEC EFD_CLOEXEC
  199. + EFD_NONBLOCK = 00000200
  200. +#define EFD_NONBLOCK EFD_NONBLOCK
  201. + };
  202. --- /dev/null
  203. +++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
  204. @@ -0,0 +1,31 @@
  205. +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
  206. + This file is part of the GNU C Library.
  207. +
  208. + The GNU C Library is free software; you can redistribute it and/or
  209. + modify it under the terms of the GNU Lesser General Public
  210. + License as published by the Free Software Foundation; either
  211. + version 2.1 of the License, or (at your option) any later version.
  212. +
  213. + The GNU C Library is distributed in the hope that it will be useful,
  214. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  215. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  216. + Lesser General Public License for more details.
  217. +
  218. + You should have received a copy of the GNU Lesser General Public
  219. + License along with the GNU C Library; if not, see
  220. + <http://www.gnu.org/licenses/>. */
  221. +
  222. +#ifndef _SYS_EVENTFD_H
  223. +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
  224. +#endif
  225. +
  226. +/* Flags for eventfd. */
  227. +enum
  228. + {
  229. + EFD_SEMAPHORE = 1,
  230. +#define EFD_SEMAPHORE EFD_SEMAPHORE
  231. + EFD_CLOEXEC = 0x400000,
  232. +#define EFD_CLOEXEC EFD_CLOEXEC
  233. + EFD_NONBLOCK = 0x004000
  234. +#define EFD_NONBLOCK EFD_NONBLOCK
  235. + };