PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
poll1.c
Go to the documentation of this file.
1#include <stdarg.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include <sys/fs.h>
5
7
9{
10 pollfd_t pollfd = {.fd = fd, .events = events};
11 if (poll(&pollfd, 1, timeout) == ERR)
12 {
13 return POLLERR;
14 }
15 return pollfd.revents;
16}
poll_events_t poll1(fd_t fd, poll_events_t events, clock_t timeout)
Wrapper for polling one file.
Definition poll1.c:8
uint64_t poll(pollfd_t *fds, uint64_t amount, clock_t timeout)
System call for polling files.
Definition poll.c:8
poll_events_t
Poll events type.
Definition fs.h:286
@ POLLERR
File descriptor caused an error.
Definition fs.h:290
#define ERR
Integer error value.
Definition ERR.h:17
__UINT64_TYPE__ fd_t
File descriptor type.
Definition fd_t.h:10
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition clock_t.h:13
Poll file descriptor structure.
Definition fs.h:305
poll_events_t revents
The events that occurred.
Definition fs.h:308
fd_t fd
The file descriptor to poll.
Definition fs.h:306