From dbf1da160b041a99680c70b27ece79b3ca1a4107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 30 Oct 2002 02:33:16 +0000 Subject: [PATCH] Userland implementations for select(), pselect(), and poll(). Not yet added to the build because other stuff is missing, and there is a problem with jam I have to sort out before I add the missing things. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1781 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/poll.c | 16 +++++++++++++ src/kernel/libroot/posix/sys/select.c | 33 +++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/kernel/libroot/posix/poll.c create mode 100644 src/kernel/libroot/posix/sys/select.c diff --git a/src/kernel/libroot/posix/poll.c b/src/kernel/libroot/posix/poll.c new file mode 100644 index 0000000000..462ff2f5f7 --- /dev/null +++ b/src/kernel/libroot/posix/poll.c @@ -0,0 +1,16 @@ +/* +** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include +#include + + +int +poll(struct pollfd *fds, nfds_t numfds, int timeout) +{ + return sys_poll(fds, numfds, timeout * 1000LL); +} + diff --git a/src/kernel/libroot/posix/sys/select.c b/src/kernel/libroot/posix/sys/select.c new file mode 100644 index 0000000000..c584a7cfb4 --- /dev/null +++ b/src/kernel/libroot/posix/sys/select.c @@ -0,0 +1,33 @@ +/* +** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include +#include + + +int +pselect(int numBits, struct fd_set *readBits, struct fd_set *writeBits, + struct fd_set *errorBits, const struct timespec *tv, const sigset_t *sigMask) +{ + bigtime_t timeout = -1LL; + if (tv) + timeout = tv->tv_sec * 1000000LL + tv->tv_nsec / 1000LL; + + return sys_select(numBits, readBits, writeBits, errorBits, timeout, sigMask); +} + + +int +select(int numBits, struct fd_set *readBits, struct fd_set *writeBits, + struct fd_set *errorBits, struct timeval *tv) +{ + bigtime_t timeout = -1LL; + if (tv) + timeout = tv->tv_sec * 1000000LL + tv->tv_usec; + + return sys_select(numBits, readBits, writeBits, errorBits, timeout, NULL); +} +