diff options
author | Rich Felker <dalias@aerifal.cx> | 2019-07-27 12:39:29 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-07-27 13:43:13 -0400 |
commit | 40aa18d55ab763e69ad16d0cf1cebea708ffde47 (patch) | |
tree | f1f4536ac0f023184b4bcbeff17be9c18e53833a /src/internal/syscall.h | |
parent | b93183e399b5e468932f27a61c885ba78d9587cd (diff) | |
download | musl-40aa18d55ab763e69ad16d0cf1cebea708ffde47.tar.gz musl-40aa18d55ab763e69ad16d0cf1cebea708ffde47.tar.bz2 musl-40aa18d55ab763e69ad16d0cf1cebea708ffde47.tar.xz musl-40aa18d55ab763e69ad16d0cf1cebea708ffde47.zip |
internally, define time64 syscalls on x32 as the existing syscalls
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.
Diffstat (limited to 'src/internal/syscall.h')
0 files changed, 0 insertions, 0 deletions