Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a
- eventfd.cpp and eventfd.s will output to the same file when building libc.a
out/target/product/*/obj/STATIC_LIBRARIES/libc_intermediates/WHOLE/libc_common_objs/eventfd.o
- And then `eventfd` will undefined when statically linked to libc.
Also add a unit test.
(cherry-pick of 8baa929d5d3bcf63381cf78ba76168c80c303f5e.)
Change-Id: Icd0eb0f4ce0511fb9ec00a504d491afd47d744d3
diff --git a/libc/include/sys/eventfd.h b/libc/include/sys/eventfd.h
index 19244a5..ec84e27 100644
--- a/libc/include/sys/eventfd.h
+++ b/libc/include/sys/eventfd.h
@@ -33,17 +33,16 @@
__BEGIN_DECLS
-#define EFD_CLOEXEC O_CLOEXEC
-#define EFD_NONBLOCK O_NONBLOCK
+#define EFD_CLOEXEC O_CLOEXEC
+#define EFD_NONBLOCK O_NONBLOCK
/* type of event counter */
-typedef uint64_t eventfd_t;
+typedef uint64_t eventfd_t;
-extern int eventfd(unsigned int initval, int flags);
+extern int eventfd(unsigned int initial_value, int flags);
-/* Compatibility with GLibc */
-extern int eventfd_read(int fd, eventfd_t *counter);
-extern int eventfd_write(int fd, const eventfd_t counter);
+extern int eventfd_read(int fd, eventfd_t* value);
+extern int eventfd_write(int fd, eventfd_t value);
__END_DECLS