skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

iopause_poll.c (436B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <poll.h>
      5 
      6 #include <skalibs/tai.h>
      7 #include <skalibs/iopause.h>
      8 
      9 int iopause_poll (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp)
     10 {
     11   int millisecs = 0 ;
     12   if (!deadline) millisecs = -1 ;
     13   else if (tain_less(stamp, deadline))
     14   {
     15     tain t ;
     16     tain_sub(&t, deadline, stamp) ;
     17     millisecs = tain_to_millisecs(&t) ;
     18   }
     19   return poll(x, len, millisecs) ;
     20 }