epoll, eventfd, timerfd, signalfd

The set libwayland's event loop is made of, in kernel/sys/sys_event.c:
four kinds of descriptor with no inode, FD_EVENT, that read() drains
and poll() reports on. They were table entries returning ENOSYS that
read as done.

epoll registers (descriptor, file) pairs, so a closed descriptor
leaves the set; level- and edge-triggered, EPOLLONESHOT. Waiting is
poll()'s, a tick at a time. The old eventfd and signalfd numbers (284,
282) were aliased to the new calls and read flags from a garbage
register; they are their own entries now, with epoll_create and
epoll_pwait.

cmd/evtest checks each, then all four in one set. The plans are
brought up to date: everything Wayland was waiting on is built except
setsockopt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-24 10:59:52 +02:00
commit a4fbdb7437
12 changed files with 974 additions and 37 deletions

View file

@ -108,6 +108,13 @@ int exec(char*, char**, char**);
// file.c
struct file* filealloc(void);
int fdalloc(struct file*);
// sys_event.c: eventfd, timerfd, signalfd and epoll, as files
struct evobj;
void ev_close(struct evobj *);
int ev_poll(struct file *, int events);
int ev_read(struct file *, char *addr, int n);
int ev_write(struct file *, char *addr, int n);
void fileclose(struct file*);
struct file* filedup(struct file*);
void fileinit(void);