[PATCH] libc: replace include/api/sys/eventfd.h with symlink to musl copy

11 views
Skip to first unread message

Waldemar Kozaczuk

unread,
Aug 29, 2020, 12:36:08 AM8/29/20
to osv...@googlegroups.com, Waldemar Kozaczuk
The eventfd.h only differs by presense of declaration
eventfd2() function which is not a Linux ABI function but syscall name
and was probably added to the header to accomodate implementing
eventfd2 as a syscall in linux.cc. So let us move that declaration
to linux.cc where it is used.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
include/api/sys/eventfd.h | 28 +---------------------------
linux.cc | 2 ++
3 files changed, 4 insertions(+), 27 deletions(-)
mode change 100644 => 120000 include/api/sys/eventfd.h

diff --git a/include/api/sys/eventfd.h b/include/api/sys/eventfd.h
deleted file mode 100644
index 1bcf0ecd..00000000
--- a/include/api/sys/eventfd.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _SYS_EVENTFD_H
-#define _SYS_EVENTFD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <fcntl.h>
-
-typedef uint64_t eventfd_t;
-
-#define EFD_SEMAPHORE 1
-#define EFD_CLOEXEC O_CLOEXEC
-#define EFD_NONBLOCK O_NONBLOCK
-
-int eventfd(unsigned int, int);
-int eventfd2(unsigned int, int);
-int eventfd_read(int, eventfd_t *);
-int eventfd_write(int, eventfd_t);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* sys/eventfd.h */
diff --git a/include/api/sys/eventfd.h b/include/api/sys/eventfd.h
new file mode 120000
index 00000000..323fa1cd
--- /dev/null
+++ b/include/api/sys/eventfd.h
@@ -0,0 +1 @@
+../../../musl/include/sys/eventfd.h
\ No newline at end of file
diff --git a/linux.cc b/linux.cc
index 9487af35..c2189799 100644
--- a/linux.cc
+++ b/linux.cc
@@ -42,6 +42,8 @@

#include <musl/src/internal/ksigaction.h>

+extern "C" int eventfd2(unsigned int, int);
+
extern "C" long gettid()
{
return sched::thread::current()->id();
--
2.26.2

Commit Bot

unread,
Aug 30, 2020, 11:06:53 AM8/30/20
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

libc: replace include/api/sys/eventfd.h with symlink to musl copy

The eventfd.h only differs by presense of declaration
eventfd2() function which is not a Linux ABI function but syscall name
and was probably added to the header to accomodate implementing
eventfd2 as a syscall in linux.cc. So let us move that declaration
to linux.cc where it is used.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
Message-Id: <20200829043601.57...@gmail.com>

---
diff --git a/include/api/sys/eventfd.h b/include/api/sys/eventfd.h
--- a/include/api/sys/eventfd.h
+++ b/include/api/sys/eventfd.h
--- a/include/api/sys/eventfd.h
+++ b/include/api/sys/eventfd.h
@@ -0,0 +1 @@
+../../../musl/include/sys/eventfd.h
\ No newline at end of file
diff --git a/linux.cc b/linux.cc
Reply all
Reply to author
Forward
0 new messages