From 5f3a7ebc358fdcbafcab4f1bf4067120fb519dfc Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 12 Jan 2022 11:31:53 -0300 Subject: Linux: Add epoll_pwait2 (BZ #27359) It is similar to epoll_wait, with the difference the timeout has nanosecond resoluting by using struct timespec instead of int. Although Linux interface only provides 64 bit time_t support, old 32 bit interface is also provided (so keep in sync with current practice and to no force opt-in on 64 bit time_t). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Florian Weimer --- sysdeps/unix/sysv/linux/sys/epoll.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'sysdeps/unix/sysv/linux/sys') diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h index 0d013c3e20..b95ca68749 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sys/epoll.h @@ -22,6 +22,7 @@ #include #include +#include /* Get the platform-dependent flags. */ #include @@ -133,6 +134,26 @@ extern int epoll_pwait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout, const __sigset_t *__ss); +/* Same as epoll_pwait, but the timeout as a timespec. + + This function is a cancellation point and therefore not marked with + __THROW. */ +#ifndef __USE_TIME_BITS64 +extern int epoll_pwait2 (int __epfd, struct epoll_event *__events, + int __maxevents, const struct timespec *__timeout, + const __sigset_t *__ss); +#else +# ifdef __REDIRECT +extern int __REDIRECT (epoll_pwait2, (int __epfd, struct epoll_event *__ev, + int __maxevs, + const struct timespec *__timeout, + const __sigset_t *__ss), + __epoll_pwait2_time64); +# else +# define epoll_pwait2 __epoll_pwait2_time64 +# endif +#endif + __END_DECLS #endif /* sys/epoll.h */ -- cgit v1.2.3-70-g09d2