summaryrefslogtreecommitdiff
path: root/src/libstddjb/iopause_poll.c
blob: 396122be21ebae0b492476c04cddffc6fb1433df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <errno.h>
#include <poll.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>

int iopause_poll (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t const *stamp)
{
  int millisecs = 0 ;
  if (!deadline) millisecs = -1 ;
  else if (tain_less(stamp, deadline))
  {
    tain_t t ;
    tain_sub(&t, deadline, stamp) ;
    millisecs = tain_to_millisecs(&t) ;
  }
  return poll(x, len, millisecs) ;
}