linux: add eventfd and eventfd2 syscalls
This commit is contained in:
parent
78bc0d6134
commit
3b417d10bc
@ -49,6 +49,26 @@
|
||||
# endif
|
||||
#endif /* __NR_accept4 */
|
||||
|
||||
#ifndef __NR_eventfd
|
||||
# if __x86_64__
|
||||
# define __NR_eventfd 284
|
||||
# elif __i386__
|
||||
# define __NR_eventfd 323
|
||||
# elif __arm__
|
||||
# define __NR_eventfd (UV_SYSCALL_BASE + 351)
|
||||
# endif
|
||||
#endif /* __NR_eventfd */
|
||||
|
||||
#ifndef __NR_eventfd2
|
||||
# if __x86_64__
|
||||
# define __NR_eventfd2 290
|
||||
# elif __i386__
|
||||
# define __NR_eventfd2 328
|
||||
# elif __arm__
|
||||
# define __NR_eventfd2 (UV_SYSCALL_BASE + 356)
|
||||
# endif
|
||||
#endif /* __NR_eventfd2 */
|
||||
|
||||
#ifndef __NR_inotify_init
|
||||
# if __x86_64__
|
||||
# define __NR_inotify_init 253
|
||||
@ -147,6 +167,24 @@ int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) {
|
||||
}
|
||||
|
||||
|
||||
int uv__eventfd(unsigned int count) {
|
||||
#if __NR_eventfd
|
||||
return syscall(__NR_eventfd, count);
|
||||
#else
|
||||
return errno = ENOSYS, -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int uv__eventfd2(unsigned int count, int flags) {
|
||||
#if __NR_eventfd2
|
||||
return syscall(__NR_eventfd2, count, flags);
|
||||
#else
|
||||
return errno = ENOSYS, -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int uv__inotify_init(void) {
|
||||
#if __NR_inotify_init
|
||||
return syscall(__NR_inotify_init);
|
||||
|
||||
@ -32,12 +32,16 @@
|
||||
#define UV__O_NONBLOCK 0x800
|
||||
#define UV__O_CLOEXEC 0x80000
|
||||
|
||||
#define UV__SOCK_CLOEXEC UV__O_CLOEXEC
|
||||
#define UV__SOCK_NONBLOCK UV__O_NONBLOCK
|
||||
#define UV__EFD_CLOEXEC UV__O_CLOEXEC
|
||||
#define UV__EFD_NONBLOCK UV__O_NONBLOCK
|
||||
|
||||
#define UV__IN_CLOEXEC UV__O_CLOEXEC
|
||||
#define UV__IN_NONBLOCK UV__O_NONBLOCK
|
||||
|
||||
#define UV__SOCK_CLOEXEC UV__O_CLOEXEC
|
||||
#define UV__SOCK_NONBLOCK UV__O_NONBLOCK
|
||||
|
||||
/* inotify flags */
|
||||
#define UV__IN_ACCESS 0x001
|
||||
#define UV__IN_MODIFY 0x002
|
||||
#define UV__IN_ATTRIB 0x004
|
||||
@ -65,6 +69,8 @@ struct uv__mmsghdr {
|
||||
};
|
||||
|
||||
int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags);
|
||||
int uv__eventfd(unsigned int count);
|
||||
int uv__eventfd2(unsigned int count, int flags);
|
||||
int uv__inotify_init(void);
|
||||
int uv__inotify_init1(int flags);
|
||||
int uv__inotify_add_watch(int fd, const char* path, __u32 mask);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user