iopause_ppoll.c (912B)
1 /* ISC license. */ 2 3 #include <skalibs/sysdeps.h> 4 5 #ifdef SKALIBS_HASPPOLL 6 7 #include <skalibs/nonposix.h> 8 #include <errno.h> 9 #include <time.h> 10 #include <poll.h> 11 #include <skalibs/tai.h> 12 #include <skalibs/iopause.h> 13 14 int iopause_ppoll (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp) 15 { 16 struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 } ; 17 if (deadline && tain_less(stamp, deadline)) 18 { 19 tain delta ; 20 tain_sub(&delta, deadline, stamp) ; 21 if (!timespec_from_tain_relative(&ts, &delta)) 22 { 23 if (errno != EOVERFLOW) return -1 ; 24 else deadline = 0 ; 25 } 26 } 27 return ppoll(x, len, deadline ? &ts : 0, 0) ; 28 } 29 30 #else 31 32 #include <errno.h> 33 #include <skalibs/iopause.h> 34 35 int iopause_ppoll (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp) 36 { 37 (void)x ; 38 (void)len ; 39 (void)deadline ; 40 (void)stamp ; 41 return (errno = ENOSYS, -1) ; 42 } 43 44 #endif