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
This commit is contained in:
parent
7ed765a7f9
commit
dbf1da160b
16
src/kernel/libroot/posix/poll.c
Normal file
16
src/kernel/libroot/posix/poll.c
Normal file
@ -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 <poll.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
int
|
||||
poll(struct pollfd *fds, nfds_t numfds, int timeout)
|
||||
{
|
||||
return sys_poll(fds, numfds, timeout * 1000LL);
|
||||
}
|
||||
|
33
src/kernel/libroot/posix/sys/select.c
Normal file
33
src/kernel/libroot/posix/sys/select.c
Normal file
@ -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 <sys/select.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user