about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/sys/epoll.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-01-12 11:31:53 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-01-17 14:34:54 -0300
commit5f3a7ebc358fdcbafcab4f1bf4067120fb519dfc (patch)
tree2596ef70bf10c88ab3e82c35c878ba8ca189aa49 /sysdeps/unix/sysv/linux/sys/epoll.h
parentded3aeb2025c6686956eb10125aacb9a6e7c298e (diff)
downloadglibc-5f3a7ebc358fdcbafcab4f1bf4067120fb519dfc.tar.gz
glibc-5f3a7ebc358fdcbafcab4f1bf4067120fb519dfc.tar.xz
glibc-5f3a7ebc358fdcbafcab4f1bf4067120fb519dfc.zip
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 <fweimer@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/sys/epoll.h')
-rw-r--r--sysdeps/unix/sysv/linux/sys/epoll.h21
1 files changed, 21 insertions, 0 deletions
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 <sys/types.h>
 
 #include <bits/types/sigset_t.h>
+#include <bits/types/struct_timespec.h>
 
 /* Get the platform-dependent flags.  */
 #include <bits/epoll.h>
@@ -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 */