Kernel: Implement linux's eventfd
This commit is contained in:
16
userspace/libraries/LibC/include/sys/eventfd.h
Normal file
16
userspace/libraries/LibC/include/sys/eventfd.h
Normal 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
|
||||
@@ -119,6 +119,7 @@ __BEGIN_DECLS
|
||||
O(SYS_GETGROUPS, getgroups) \
|
||||
O(SYS_SETGROUPS, setgroups) \
|
||||
O(SYS_CHROOT, chroot) \
|
||||
O(SYS_EVENTFD, eventfd) \
|
||||
|
||||
enum Syscall
|
||||
{
|
||||
|
||||
8
userspace/libraries/LibC/sys/eventfd.cpp
Normal file
8
userspace/libraries/LibC/sys/eventfd.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user