1 From c1a78badec59b1ebd303ace8257ca86fa1e14acb Mon Sep 17 00:00:00 2001
2 From: Hiroaki KAWAI <kawai@stratosphere.co.jp>
3 Date: Fri, 19 Apr 2013 10:09:35 +0900
4 Subject: [PATCH-0.9.33] eventfd.h: Use new "bits/" scheme for arch-specific flags
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.
10 This problem is already fixed in glibc.
12 Also sanitize and provide bits for hppa.
13 Make sure not to install the new bits/eventfd unless eventfd support is
16 Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
17 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
20 libc/sysdeps/linux/alpha/bits/eventfd.h | 31 +++++++++++++++++++++++++++++++
21 libc/sysdeps/linux/common/bits/eventfd.h | 31 +++++++++++++++++++++++++++++++
22 libc/sysdeps/linux/common/sys/eventfd.h | 25 +++++++++++++------------
23 libc/sysdeps/linux/hppa/bits/eventfd.h | 32 ++++++++++++++++++++++++++++++++
24 libc/sysdeps/linux/mips/bits/eventfd.h | 31 +++++++++++++++++++++++++++++++
25 libc/sysdeps/linux/sparc/bits/eventfd.h | 31 +++++++++++++++++++++++++++++++
26 7 files changed, 170 insertions(+), 12 deletions(-)
27 create mode 100644 libc/sysdeps/linux/alpha/bits/eventfd.h
28 create mode 100644 libc/sysdeps/linux/common/bits/eventfd.h
29 create mode 100644 libc/sysdeps/linux/hppa/bits/eventfd.h
30 create mode 100644 libc/sysdeps/linux/mips/bits/eventfd.h
31 create mode 100644 libc/sysdeps/linux/sparc/bits/eventfd.h
33 diff --git a/Makefile.in b/Makefile.in
34 index 9ba590d..633358f 100644
37 @@ -271,6 +271,7 @@ HEADERS_RM-$(UCLIBC_HAS_WORDEXP) += wordexp.h
38 HEADERS_RM-$(UCLIBC_HAS_XATTR) += sys/xattr.h
39 HEADERS_RM-$(UCLIBC_HAS_XLOCALE) += xlocale.h
40 HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/eventfd.h sys/fsuid.h \
45 diff --git a/libc/sysdeps/linux/alpha/bits/eventfd.h b/libc/sysdeps/linux/alpha/bits/eventfd.h
47 index 0000000..b5a7e41
49 +++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
51 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
52 + This file is part of the GNU C Library.
54 + The GNU C Library is free software; you can redistribute it and/or
55 + modify it under the terms of the GNU Lesser General Public
56 + License as published by the Free Software Foundation; either
57 + version 2.1 of the License, or (at your option) any later version.
59 + The GNU C Library is distributed in the hope that it will be useful,
60 + but WITHOUT ANY WARRANTY; without even the implied warranty of
61 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
62 + Lesser General Public License for more details.
64 + You should have received a copy of the GNU Lesser General Public
65 + License along with the GNU C Library; if not, see
66 + <http://www.gnu.org/licenses/>. */
68 +#ifndef _SYS_EVENTFD_H
69 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
72 +/* Flags for eventfd. */
75 + EFD_SEMAPHORE = 000000001,
76 +#define EFD_SEMAPHORE EFD_SEMAPHORE
77 + EFD_CLOEXEC = 010000000,
78 +#define EFD_CLOEXEC EFD_CLOEXEC
79 + EFD_NONBLOCK = 000000004
80 +#define EFD_NONBLOCK EFD_NONBLOCK
82 diff --git a/libc/sysdeps/linux/common/bits/eventfd.h b/libc/sysdeps/linux/common/bits/eventfd.h
84 index 0000000..ef49c61
86 +++ b/libc/sysdeps/linux/common/bits/eventfd.h
88 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
89 + This file is part of the GNU C Library.
91 + The GNU C Library is free software; you can redistribute it and/or
92 + modify it under the terms of the GNU Lesser General Public
93 + License as published by the Free Software Foundation; either
94 + version 2.1 of the License, or (at your option) any later version.
96 + The GNU C Library is distributed in the hope that it will be useful,
97 + but WITHOUT ANY WARRANTY; without even the implied warranty of
98 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99 + Lesser General Public License for more details.
101 + You should have received a copy of the GNU Lesser General Public
102 + License along with the GNU C Library; if not, see
103 + <http://www.gnu.org/licenses/>. */
105 +#ifndef _SYS_EVENTFD_H
106 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
109 +/* Flags for eventfd. */
112 + EFD_SEMAPHORE = 00000001,
113 +#define EFD_SEMAPHORE EFD_SEMAPHORE
114 + EFD_CLOEXEC = 02000000,
115 +#define EFD_CLOEXEC EFD_CLOEXEC
116 + EFD_NONBLOCK = 00004000
117 +#define EFD_NONBLOCK EFD_NONBLOCK
119 diff --git a/libc/sysdeps/linux/common/sys/eventfd.h b/libc/sysdeps/linux/common/sys/eventfd.h
120 index 311f803..8686355 100644
121 --- a/libc/sysdeps/linux/common/sys/eventfd.h
122 +++ b/libc/sysdeps/linux/common/sys/eventfd.h
124 -/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
125 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
126 This file is part of the GNU C Library.
128 The GNU C Library is free software; you can redistribute it and/or
133 +/* Get the platform-dependent flags. */
134 +#include <bits/eventfd.h>
136 /* Type for event counter. */
137 typedef uint64_t eventfd_t;
139 -/* Flags for signalfd. */
143 -#define EFD_SEMAPHORE EFD_SEMAPHORE
144 - EFD_CLOEXEC = 02000000,
145 -#define EFD_CLOEXEC EFD_CLOEXEC
146 - EFD_NONBLOCK = 04000
147 -#define EFD_NONBLOCK EFD_NONBLOCK
153 @@ -43,6 +34,16 @@ __BEGIN_DECLS
155 extern int eventfd (int __count, int __flags) __THROW;
157 +#if 0 /* not (yet) implemented in uClibc */
159 +/* Read event counter and possibly wait for events. */
160 +extern int eventfd_read (int __fd, eventfd_t *__value);
162 +/* Increment event counter. */
163 +extern int eventfd_write (int __fd, eventfd_t __value);
169 #endif /* sys/eventfd.h */
170 diff --git a/libc/sysdeps/linux/hppa/bits/eventfd.h b/libc/sysdeps/linux/hppa/bits/eventfd.h
172 index 0000000..6182c07
174 +++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
176 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
177 + This file is part of the GNU C Library.
179 + The GNU C Library is free software; you can redistribute it and/or
180 + modify it under the terms of the GNU Lesser General Public
181 + License as published by the Free Software Foundation; either
182 + version 2.1 of the License, or (at your option) any later version.
184 + The GNU C Library is distributed in the hope that it will be useful,
185 + but WITHOUT ANY WARRANTY; without even the implied warranty of
186 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
187 + Lesser General Public License for more details.
189 + You should have received a copy of the GNU Lesser General Public
190 + License along with the GNU C Library. If not, see
191 + <http://www.gnu.org/licenses/>. */
193 +#ifndef _SYS_EVENTFD_H
194 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
197 +/* Flags for signalfd. */
200 + EFD_SEMAPHORE = 000000001,
201 +#define EFD_SEMAPHORE EFD_SEMAPHORE
202 + EFD_CLOEXEC = 010000000,
203 +#define EFD_CLOEXEC EFD_CLOEXEC
204 +/* the below value looks suspicious, should be 000200004 for consistency */
205 + EFD_NONBLOCK = 00200004 /* HPUX has separate NDELAY & NONBLOCK */
206 +#define EFD_NONBLOCK EFD_NONBLOCK
208 diff --git a/libc/sysdeps/linux/mips/bits/eventfd.h b/libc/sysdeps/linux/mips/bits/eventfd.h
210 index 0000000..17b2f46
212 +++ b/libc/sysdeps/linux/mips/bits/eventfd.h
214 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
215 + This file is part of the GNU C Library.
217 + The GNU C Library is free software; you can redistribute it and/or
218 + modify it under the terms of the GNU Lesser General Public
219 + License as published by the Free Software Foundation; either
220 + version 2.1 of the License, or (at your option) any later version.
222 + The GNU C Library is distributed in the hope that it will be useful,
223 + but WITHOUT ANY WARRANTY; without even the implied warranty of
224 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
225 + Lesser General Public License for more details.
227 + You should have received a copy of the GNU Lesser General Public
228 + License along with the GNU C Library; if not, see
229 + <http://www.gnu.org/licenses/>. */
231 +#ifndef _SYS_EVENTFD_H
232 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
235 +/* Flags for eventfd. */
238 + EFD_SEMAPHORE = 00000001,
239 +#define EFD_SEMAPHORE EFD_SEMAPHORE
240 + EFD_CLOEXEC = 02000000,
241 +#define EFD_CLOEXEC EFD_CLOEXEC
242 + EFD_NONBLOCK = 00000200
243 +#define EFD_NONBLOCK EFD_NONBLOCK
245 diff --git a/libc/sysdeps/linux/sparc/bits/eventfd.h b/libc/sysdeps/linux/sparc/bits/eventfd.h
247 index 0000000..bed9f09
249 +++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
251 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
252 + This file is part of the GNU C Library.
254 + The GNU C Library is free software; you can redistribute it and/or
255 + modify it under the terms of the GNU Lesser General Public
256 + License as published by the Free Software Foundation; either
257 + version 2.1 of the License, or (at your option) any later version.
259 + The GNU C Library is distributed in the hope that it will be useful,
260 + but WITHOUT ANY WARRANTY; without even the implied warranty of
261 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
262 + Lesser General Public License for more details.
264 + You should have received a copy of the GNU Lesser General Public
265 + License along with the GNU C Library; if not, see
266 + <http://www.gnu.org/licenses/>. */
268 +#ifndef _SYS_EVENTFD_H
269 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
272 +/* Flags for eventfd. */
276 +#define EFD_SEMAPHORE EFD_SEMAPHORE
277 + EFD_CLOEXEC = 0x400000,
278 +#define EFD_CLOEXEC EFD_CLOEXEC
279 + EFD_NONBLOCK = 0x004000
280 +#define EFD_NONBLOCK EFD_NONBLOCK