PatchworkOS
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/io.h>
5
6#include "common/print.h"
8
10{
11 pollfd_t pollfd = {.fd = fd, .events = events};
12 if (poll(&pollfd, 1, timeout) == ERR)
13 {
14 return POLLERR;
15 }
16 return pollfd.revents;
17}
poll_events_t poll1(fd_t fd, poll_events_t events, clock_t timeout)
Wrapper for polling one file.
Definition poll1.c:9
uint64_t poll(pollfd_t *fds, uint64_t amount, clock_t timeout)
System call for polling files.
Definition poll.c:9
poll_events_t
Poll events type.
Definition io.h:288
@ POLLERR
File descriptor caused an error.
Definition io.h:292
#define ERR
Integer error value.
Definition ERR.h:17
__UINT64_TYPE__ fd_t
A file descriptor.
Definition fd_t.h:12
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition clock_t.h:13
Poll file descriptor structure.
Definition io.h:307
poll_events_t revents
The events that occurred.
Definition io.h:310
fd_t fd
The file descriptor to poll.
Definition io.h:308