about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/epoll_pwait2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/epoll_pwait2.c')
-rw-r--r--sysdeps/unix/sysv/linux/epoll_pwait2.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/epoll_pwait2.c b/sysdeps/unix/sysv/linux/epoll_pwait2.c
new file mode 100644
index 0000000000..e38a1b2349
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/epoll_pwait2.c
@@ -0,0 +1,44 @@
+/* Implementation of epoll_pwait2 syscall wrapper.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sys/epoll.h>
+#include <sysdep.h>
+
+int
+__epoll_pwait2_time64 (int fd, struct epoll_event *ev, int maxev,
+		       const struct __timespec64 *tmo, const sigset_t *s)
+{
+  /* The syscall only supports 64-bit time_t.  */
+  return SYSCALL_CANCEL (epoll_pwait2, fd, ev, maxev, tmo, s, __NSIG_BYTES);
+}
+#if __TIMESIZE != 64
+libc_hidden_def (__epoll_pwait2_time64)
+
+int
+epoll_pwait2 (int fd, struct epoll_event *ev, int maxev,
+	      const struct timespec *tmo, const sigset_t *s)
+{
+  struct __timespec64 tmo64, *ptmo64 = NULL;
+  if (tmo != NULL)
+    {
+      tmo64 = valid_timespec_to_timespec64 (*tmo);
+      ptmo64 = &tmo64;
+    }
+  return __epoll_pwait2_time64 (fd, ev, maxev, ptmo64, s);
+}
+#endif