diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-23 07:27:41 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-23 07:28:25 +0100 |
commit | 2bedabbd6cec0fcd323a665992a91d340291fdd5 (patch) | |
tree | 0554208f21628cc080451b7cd449fa8c2a21b6df /LibC | |
parent | 8bb18fdc565f4fe133f80e64101fb0d663e27bf2 (diff) | |
download | serenity-2bedabbd6cec0fcd323a665992a91d340291fdd5.zip |
Stub out poll() syscall and LibC wrapper.
Diffstat (limited to 'LibC')
-rw-r--r-- | LibC/Makefile | 1 | ||||
-rw-r--r-- | LibC/poll.cpp | 14 | ||||
-rw-r--r-- | LibC/poll.h | 23 |
3 files changed, 38 insertions, 0 deletions
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 <poll.h> +#include <Kernel/Syscall.h> +#include <errno.h> + +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 <sys/cdefs.h> + +__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 + |