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