[v5,03/17] RISC-V: Use 64-bit-time syscall numbers with the 32-bit port

Message ID 1a107e4065f6d0e56dd8ae1bf9613a86ba8dbec5.1597851293.git.alistair.francis@wdc.com
State Committed
Headers
Series glibc port for 32-bit RISC-V (RV32) |

Commit Message

Alistair Francis Aug. 19, 2020, 3:38 p.m. UTC
  sysdep.h redefines only the syscall where the generic implementation
still does not have actual 64-bit time_t support:

   /* Workarounds for generic code needing to handle 64-bit time_t.  */

   /* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
   #define __NR_clock_getres    __NR_clock_getres_time64
   /* Fix sysdeps/nptl/lowlevellock-futex.h.  */
   #define __NR_futex           __NR_futex_time64
   [...]

This patch also adds a comment that it is a workaround to handle 64-bit
time_t and on each #define comment for which implementation it intends
to.
---
 sysdeps/unix/sysv/linux/riscv/sysdep.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
  

Comments

Maciej W. Rozycki Aug. 20, 2020, 9:39 p.m. UTC | #1
On Wed, 19 Aug 2020, Alistair Francis via Libc-alpha wrote:

> sysdep.h redefines only the syscall where the generic implementation
> still does not have actual 64-bit time_t support:
> 
>    /* Workarounds for generic code needing to handle 64-bit time_t.  */
> 
>    /* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
>    #define __NR_clock_getres    __NR_clock_getres_time64
>    /* Fix sysdeps/nptl/lowlevellock-futex.h.  */
>    #define __NR_futex           __NR_futex_time64
>    [...]
> 
> This patch also adds a comment that it is a workaround to handle 64-bit
> time_t and on each #define comment for which implementation it intends
> to.

 LGTM.

Reviewed-by: Maciej W. Rozycki <macro@wdc.com>

  Maciej
  

Patch

diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index fbb3a02bbd..430fa23a58 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -25,6 +25,29 @@ 
 #undef SYS_ify
 #define SYS_ify(syscall_name)	__NR_##syscall_name
 
+#if __WORDSIZE == 32
+
+/* Workarounds for generic code needing to handle 64-bit time_t.  */
+
+/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c.  */
+#define __NR_clock_getres	__NR_clock_getres_time64
+/* Fix sysdeps/nptl/lowlevellock-futex.h.  */
+#define __NR_futex		__NR_futex_time64
+/* Fix sysdeps/unix/sysv/linux/pause.c.  */
+#define __NR_ppoll		__NR_ppoll_time64
+/* Fix sysdeps/unix/sysv/linux/select.c.  */
+#define __NR_pselect6		__NR_pselect6_time64
+/* Fix sysdeps/unix/sysv/linux/recvmmsg.c.  */
+#define __NR_recvmmsg		__NR_recvmmsg_time64
+/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c.  */
+#define __NR_rt_sigtimedwait	__NR_rt_sigtimedwait_time64
+/* Fix sysdeps/unix/sysv/linux/semtimedop.c.  */
+#define __NR_semtimedop		__NR_semtimedop_time64
+/* Hack sysdeps/unix/sysv/linux/generic/utimes.c.  */
+#define __NR_utimensat		__NR_utimensat_time64
+
+#endif /* __WORDSIZE == 32 */
+
 #ifdef __ASSEMBLER__
 
 # include <sys/asm.h>