From 2bedabbd6cec0fcd323a665992a91d340291fdd5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 23 Jan 2019 07:27:41 +0100 Subject: Stub out poll() syscall and LibC wrapper. --- LibC/Makefile | 1 + LibC/poll.cpp | 14 ++++++++++++++ LibC/poll.h | 23 +++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 LibC/poll.cpp create mode 100644 LibC/poll.h (limited to 'LibC') diff --git a/LibC/Makefile b/LibC/Makefile index 5a471c7c3b..90dbd15ed5 100644 --- a/LibC/Makefile +++ b/LibC/Makefile @@ -43,6 +43,7 @@ LIBC_OBJS = \ utime.o \ gui.o \ sys/select.o \ + poll.o \ entry.o OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) $(SHAREDGRAPHICS_OBJS) diff --git a/LibC/poll.cpp b/LibC/poll.cpp new file mode 100644 index 0000000000..2e3f939a80 --- /dev/null +++ b/LibC/poll.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +extern "C" { + +int poll(struct pollfd* fds, int nfds, int timeout) +{ + int rc = syscall(SC_poll, fds, nfds, timeout); + __RETURN_WITH_ERRNO(rc, rc, -1); +} + +} + diff --git a/LibC/poll.h b/LibC/poll.h new file mode 100644 index 0000000000..1a52049c82 --- /dev/null +++ b/LibC/poll.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +__BEGIN_DECLS + +#define POLLIN (1u << 0) +#define POLLPRI (1u << 2) +#define POLLOUT (1u << 3) +#define POLLERR (1u << 4) +#define POLLHUP (1u << 5) +#define POLLNVAL (1u << 6) + +struct pollfd { + int fd; + short events; + short revents; +}; + +int poll(struct pollfd* fds, int nfds, int timeout); + +__END_DECLS + -- cgit v1.2.3