0
0
mirror of https://github.com/termux-pacman/glibc-packages.git synced 2024-11-13 15:09:21 +00:00
glibc-packages/gpkg/glibc/epoll_pwait2.c.patch
Ivan Max f7734d14f3
glibc fixes
- adding `__shmctl64`
- disabling the `epoll_pwait2` system call
2024-04-10 22:53:17 +03:00

33 lines
1.1 KiB
Diff

--- glibc-2.39/sysdeps/unix/sysv/linux/epoll_pwait2.c 2024-01-31 03:34:58.000000000 +0300
+++ glibc-2.39/sysdeps/unix/sysv/linux/epoll_pwait2.c.patch 2024-04-10 22:25:45.538639010 +0300
@@ -16,15 +16,26 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
#include <sys/epoll.h>
-#include <sysdep.h>
+#include <sysdep-cancel.h>
+
+#define MSEC_PER_SEC 1000L
+#define NSEC_PER_MSEC 1000000L
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);
+ long timeout = tmo->tv_sec * MSEC_PER_SEC;
+ if (tmo->tv_nsec > 0) {
+ timeout += tmo->tv_nsec / NSEC_PER_MSEC;
+ if (tmo->tv_nsec % NSEC_PER_MSEC > 0)
+ timeout += 1;
+ }
+ return epoll_pwait (fd, ev, maxev, timeout, s);
}
#if __TIMESIZE != 64
libc_hidden_def (__epoll_pwait2_time64)