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
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>
19 diff --git a/Makefile.in b/Makefile.in
20 index 3d3ba3d..da865db 100644
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 \
31 diff --git a/libc/sysdeps/linux/alpha/bits/eventfd.h b/libc/sysdeps/linux/alpha/bits/eventfd.h
33 index 0000000..b5a7e41
35 +++ b/libc/sysdeps/linux/alpha/bits/eventfd.h
37 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
38 + This file is part of the GNU C Library.
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.
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.
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/>. */
54 +#ifndef _SYS_EVENTFD_H
55 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
58 +/* Flags for eventfd. */
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
68 diff --git a/libc/sysdeps/linux/common/bits/eventfd.h b/libc/sysdeps/linux/common/bits/eventfd.h
70 index 0000000..ef49c61
72 +++ b/libc/sysdeps/linux/common/bits/eventfd.h
74 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
75 + This file is part of the GNU C Library.
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.
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.
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/>. */
91 +#ifndef _SYS_EVENTFD_H
92 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
95 +/* Flags for eventfd. */
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
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
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.
114 The GNU C Library is free software; you can redistribute it and/or
119 +/* Get the platform-dependent flags. */
120 +#include <bits/eventfd.h>
122 /* Type for event counter. */
123 typedef uint64_t eventfd_t;
125 -/* Flags for signalfd. */
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
139 @@ -43,6 +34,16 @@ __BEGIN_DECLS
141 extern int eventfd (int __count, int __flags) __THROW;
143 +#if 0 /* not (yet) implemented in uClibc */
145 +/* Read event counter and possibly wait for events. */
146 +extern int eventfd_read (int __fd, eventfd_t *__value);
148 +/* Increment event counter. */
149 +extern int eventfd_write (int __fd, eventfd_t __value);
155 #endif /* sys/eventfd.h */
156 diff --git a/libc/sysdeps/linux/hppa/bits/eventfd.h b/libc/sysdeps/linux/hppa/bits/eventfd.h
158 index 0000000..6182c07
160 +++ b/libc/sysdeps/linux/hppa/bits/eventfd.h
162 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
163 + This file is part of the GNU C Library.
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.
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.
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/>. */
179 +#ifndef _SYS_EVENTFD_H
180 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
183 +/* Flags for signalfd. */
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
194 diff --git a/libc/sysdeps/linux/mips/bits/eventfd.h b/libc/sysdeps/linux/mips/bits/eventfd.h
196 index 0000000..17b2f46
198 +++ b/libc/sysdeps/linux/mips/bits/eventfd.h
200 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
201 + This file is part of the GNU C Library.
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.
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.
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/>. */
217 +#ifndef _SYS_EVENTFD_H
218 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
221 +/* Flags for eventfd. */
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
231 diff --git a/libc/sysdeps/linux/sparc/bits/eventfd.h b/libc/sysdeps/linux/sparc/bits/eventfd.h
233 index 0000000..bed9f09
235 +++ b/libc/sysdeps/linux/sparc/bits/eventfd.h
237 +/* Copyright (C) 2007-2013 Free Software Foundation, Inc.
238 + This file is part of the GNU C Library.
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.
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.
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/>. */
254 +#ifndef _SYS_EVENTFD_H
255 +# error "Never use <bits/eventfd.h> directly; include <sys/eventfd.h> instead."
258 +/* Flags for eventfd. */
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