unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RFC: y2038: linux: Adjust __poll function implementation to use __ppoll64
@ 2019-11-13 13:47 Lukasz Majewski
  2019-11-14 21:03 ` Adhemerval Zanella
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Majewski @ 2019-11-13 13:47 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert
  Cc: Alistair Francis, Alistair Francis, GNU C Library,
	Adhemerval Zanella, Florian Weimer, Florian Weimer, Zack Weinberg,
	Carlos O'Donell, Lukasz Majewski

The __poll implementation (./sysdeps/unix/sysv/linux/poll.c) when the
__NR_poll is not defined uses ppoll syscall.
Adjust this code to use glibc's internal, Y2038 safe struct __timespec64
and __ppoll64 function.

The explicit __ppoll declaration is necessary to allow aliasing of __ppoll64
either via #define or using it directly.

By using __ppoll64 instead of __ppoll, systems with TIMESIZE == 32 gain support
for 64 bit time (as e.g. glibc's internal struct __timespec64 is used to pass
arguments).
---
 include/sys/poll.h             | 9 ++++++---
 sysdeps/unix/sysv/linux/poll.c | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/sys/poll.h b/include/sys/poll.h
index f904e21f89..a599426dc6 100644
--- a/include/sys/poll.h
+++ b/include/sys/poll.h
@@ -7,12 +7,15 @@ extern int __poll (struct pollfd *__fds, unsigned long int __nfds,
 libc_hidden_proto (__poll)
 libc_hidden_proto (ppoll)
 
-# if __TIMESIZE == 64
-#  define __ppoll64 __ppoll
-# else
 # include <time.h>
 # include <signal.h>
+extern int __ppoll (struct pollfd *fds, nfds_t nfds,
+                    const struct timespec *timeout,
+                    const sigset_t *sigmask);
 
+# if __TIMESIZE == 64
+#  define __ppoll64 __ppoll
+# else
 extern int __ppoll64 (struct pollfd *fds, nfds_t nfds,
                       const struct __timespec64 *timeout,
                       const sigset_t *sigmask);
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 8ea00563a4..588069c898 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -28,8 +28,8 @@ __poll (struct pollfd *fds, nfds_t nfds, int timeout)
 #ifdef __NR_poll
   return SYSCALL_CANCEL (poll, fds, nfds, timeout);
 #else
-  struct timespec timeout_ts;
-  struct timespec *timeout_ts_p = NULL;
+  struct __timespec64 timeout_ts;
+  struct __timespec64 *timeout_ts_p = NULL;
 
   if (timeout >= 0)
     {
@@ -38,7 +38,7 @@ __poll (struct pollfd *fds, nfds_t nfds, int timeout)
       timeout_ts_p = &timeout_ts;
     }
 
-  return SYSCALL_CANCEL (ppoll, fds, nfds, timeout_ts_p, NULL, 0);
+  return __ppoll64 (fds, nfds, timeout_ts_p, NULL);
 #endif
 }
 libc_hidden_def (__poll)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14 21:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 13:47 [PATCH] RFC: y2038: linux: Adjust __poll function implementation to use __ppoll64 Lukasz Majewski
2019-11-14 21:03 ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).