x32 is odd in that it's the only ILP32 arch/ABI we have where time_t
is 64-bit rather than (32-bit) long, and this has always been
problematic in that it results in struct timespec having unused
padding space, since tv_nsec has type long, which the kernel insists
be zero- or sign-extended (due to negative tv_nsec being invalid, it
doesn't matter which) to match the x86_64 type.
up til now, we've had really ugly hacks in x32/syscall_arch.h to patch
up the timespecs passed to the kernel. but the same requirement to
zero- or sign-extend tv_nsec also applies to all the new time64
syscalls on true 32-bit archs. so let's take advantage of this to
clean things up.
this patch defines all of the time64 syscalls for x32 as aliases for
the existing syscalls by the same name. this establishes the following
invariants:
- if the time64 form is defined, it takes time arguments as 64-bit
objects, and tv_nsec inputs must be zero-/sign-extended to 64-bit.
- if the time64 form is not defined, or if the time64 form is defined
and is not equal to the "plain" form, the plain form takes time
arguments as longs.
this will avoid the need for protocols for archs to define appropriate
types for each family of syscalls, and for the reader of the code to
have to be aware of such type definitions.
in some sense it might be simpler if the plain syscall form were
undefined for x32, so that it would always take longs if defined.
however, a number of these syscalls are used in contexts with a null
time argument, or (e.g. futex) for commands that don't involve time at
all, and having to introduce time64-specific logic to all those call
points does not make sense. thus, while the "plain" forms are kept now
just because they're needed until the affected code is converted over,
they'll also almost surely be kept in the future as well.
}
#undef SYS_futimesat
+
+#define SYS_clock_gettime64 SYS_clock_gettime
+#define SYS_clock_settime64 SYS_clock_settime
+#define SYS_clock_adjtime64 SYS_clock_adjtime
+#define SYS_clock_nanosleep_time64 SYS_clock_nanosleep
+#define SYS_timer_gettime64 SYS_timer_gettime
+#define SYS_timer_settime64 SYS_timer_settime
+#define SYS_timerfd_gettime64 SYS_timerfd_gettime
+#define SYS_timerfd_settime64 SYS_timerfd_settime
+#define SYS_utimensat_time64 SYS_utimensat
+#define SYS_pselect6_time64 SYS_pselect6
+#define SYS_ppoll_time64 SYS_ppoll
+#define SYS_recvmmsg_time64 SYS_recvmmsg
+#define SYS_mq_timedsend_time64 SYS_mq_timedsend
+#define SYS_mq_timedreceive_time64 SYS_mq_timedreceive
+#define SYS_semtimedop_time64 SYS_semtimedop
+#define SYS_rt_sigtimedwait_time64 SYS_rt_sigtimedwait
+#define SYS_futex_time64 SYS_futex
+#define SYS_sched_rr_get_interval_time64 SYS_sched_rr_get_interval