Kernel: Implement linux's eventfd

This commit is contained in:
2026-03-17 20:24:06 +02:00
parent a49588dbc7
commit c1a424a635
7 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#ifndef _SYS_EVENTFD_H
#define _SYS_EVENTFD_H 1
#include <sys/cdefs.h>
__BEGIN_DECLS
#define EFD_CLOEXEC 0x1
#define EFD_NONBLOCK 0x2
#define EFD_SEMAPHORE 0x4
int eventfd(unsigned int initval, int flags);
__END_DECLS
#endif

View File

@@ -119,6 +119,7 @@ __BEGIN_DECLS
O(SYS_GETGROUPS, getgroups) \
O(SYS_SETGROUPS, setgroups) \
O(SYS_CHROOT, chroot) \
O(SYS_EVENTFD, eventfd) \
enum Syscall
{

View File

@@ -0,0 +1,8 @@
#include <sys/eventfd.h>
#include <sys/syscall.h>
#include <unistd.h>
int eventfd(unsigned int initval, int flags)
{
return syscall(SYS_EVENTFD, initval, flags);
}