Commit 6ea0b1d6 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

bug #1639: Implement a pselect() wrapper around select() for OpenBSD

parent 4de96e9a
......@@ -930,6 +930,9 @@ EV_SET(&kevent, 0, 0, 0, 0, 0, udata);],
# Check for pselect() for use in perfdhcp
# perfdhcp: If the clock_gettime() function does not exist on the system,
# use an alternative supplied in the code based on gettimeofday().
......@@ -66,6 +66,35 @@ main(const int argc, char* const argv[])
#include <time.h>
#include <unistd.h>
#include <assert.h>
/* Platforms such as OpenBSD don't provide a pselect(), so we use our
own implementation for this testcase, which wraps around select() and
hence doesn't implement the high precision timer. This implementation
is fine for our purpose. */
static int
pselect (int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, const struct timespec *timeout,
const sigset_t *sigmask)
struct timeval my_timeout;
/* Our particular usage of pselect() doesn't use these fields. */
assert(writefds == NULL);
assert(exceptfds == NULL);
assert(sigmask == NULL);
my_timeout.tv_sec = timeout->tv_sec;
my_timeout.tv_usec = timeout->tv_nsec / 1000;
return select(nfds, readfds, writefds, exceptfds, &my_timeout);
/* DHCPv4 defines (to be moved/shared) */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment