[PATCH v2 18/46] epoll: Use epoll_create1 if arch does not have the epoll_create syscall
Markos Chandras
markos.chandras at gmail.com
Mon Nov 26 14:24:00 UTC 2012
From: Markos Chandras <markos.chandras at imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
libc/sysdeps/linux/common/epoll.c | 20 ++++++++++++++------
libc/sysdeps/linux/common/stubs.c | 2 +-
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c
index ab3e73b..f07ab94 100644
--- a/libc/sysdeps/linux/common/epoll.c
+++ b/libc/sysdeps/linux/common/epoll.c
@@ -16,17 +16,25 @@
#endif
/*
- * epoll_create()
+ * epoll_create1()
*/
-#ifdef __NR_epoll_create
-_syscall1(int, epoll_create, int, size)
+#if defined(__NR_epoll_create1)
+_syscall1(int, epoll_create1, int, flags)
#endif
+#if defined(__NR_epoll_create1) && !defined(__NR_epoll_create)
+int epoll_create(int size)
+{
+ return INLINE_SYSCALL(epoll_create1, 1, 0);
+}
+
/*
- * epoll_create1()
+ * epoll_create()
*/
-#ifdef __NR_epoll_create1
-_syscall1(int, epoll_create1, int, flags)
+
+/* For systems that have both, prefer the old one */
+#elif defined(__NR_epoll_create)
+_syscall1(int, epoll_create, int, size)
#endif
/*
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 7af14c1..3b6df48 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -81,7 +81,7 @@ make_stub(create_module)
make_stub(delete_module)
#endif
-#ifndef __NR_epoll_create
+#if !defined(__NR_epoll_create) && !defined(__NR_epoll_create1)
make_stub(epoll_create)
#endif
--
1.8.0
More information about the uClibc
mailing list