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