[PATCH v2 01/18] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64
Maciej W. Rozycki
macro@wdc.com
Tue Jul 7 22:06:52 GMT 2020
On Wed, 3 Jun 2020, Alistair Francis via Libc-alpha wrote:
> Using the original glibc headers under bits/ let's make small
> modifications to use 64-bit time_t and off_t for both RV32 and RV64.
>
> For the typesizes.h, here are justifications for the changes from the
> generic version (based on Arnd's very helpful feedback):
> - All the !__USE_FILE_OFFSET64 types (__off_t, __ino_t, __rlim_t, ...) are
^^ ^^
Please remove extraneous spaces above.
> changed to match the 64-bit replacements.
>
> - __time_t is defined to 64 bit, but no __time64_t is added. This makes sense
> as we don't have the time64 support for other 32-bit architectures yet, and
> it will be easy to change when that happens.
>
> - __suseconds_t is 64-bit. This matches what we use the kernel ABI for the
> few drivers that are relying on 'struct timeval' input arguments in
> ioctl, as well as the adjtimex system call. It means that timeval has to
> be defined without the padding, unlike timespec, which needs padding.
^^^
Likewise.
The commit description will be indented by 4 when presented by `git log',
etc., so please reformat so as to stay within 74-75 columns to avoid line
wrapping. Also use two spaces after the end of a sentence throughout.
Please apply these guidelines across the whole series.
> diff --git a/sysdeps/unix/sysv/linux/riscv/bits/environments.h b/sysdeps/unix/sysv/linux/riscv/bits/environments.h
> new file mode 100644
> index 0000000000..c1768af17b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/riscv/bits/environments.h
> @@ -0,0 +1,85 @@
> +/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
We've switched to HTTPS, so: <https://www.gnu.org/licenses/>.
> +/* This header should define the following symbols under the described
> + situations. A value `1' means that the model is always supported,
> + `-1' means it is never supported. Undefined means it cannot be
> + statically decided.
> +
> + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type
> + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type
> +
> + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type
> + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type
Stray tab after _POSIX_V7_LP64_OFF32?
> +#else /* __WORDSIZE == 32 */
> +
> +/* RISC-V requires 64-bit off_t
> + # undef _POSIX_V7_ILP32_OFF32
> + # undef _POSIX_V6_ILP32_OFF32
> + # undef _XBS5_ILP32_OFF32
> + */
If 64-bit `off_t' is required, then shouldn't these be #define'd to -1
instead? Otherwise under what circumstances support for these models will
have to be determined at run time?
+# define _POSIX_V7_ILP32_OFFBIG 1
+# define _POSIX_V6_ILP32_OFFBIG 1
+# define _XBS5_ILP32_OFFBIG 1
Please use tabs here like with the rest of the macros.
> +/* CFLAGS. */
> +#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
Likewise if 64-bit `off_t' is required, then why do we have to define
these macros in CFLAGS and what happens if they aren't defined?
Please use a tab here as well (assuming this macro does have to exist).
> diff --git a/sysdeps/unix/sysv/linux/riscv/bits/time64.h b/sysdeps/unix/sysv/linux/riscv/bits/time64.h
> new file mode 100644
> index 0000000000..7ba0dd1cfd
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/riscv/bits/time64.h
> @@ -0,0 +1,36 @@
> +/* bits/time64.h -- underlying types for __time64_t. Generic version.
"RISC-V version." presumably?
> + Copyright (C) 2019-2020 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>
> diff --git a/sysdeps/unix/sysv/linux/riscv/bits/timesize.h b/sysdeps/unix/sysv/linux/riscv/bits/timesize.h
> new file mode 100644
> index 0000000000..78394b7489
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/riscv/bits/timesize.h
> @@ -0,0 +1,22 @@
> +/* Bit size of the time_t type at glibc build time, general case.
"RISC-V case."?
> + Copyright (C) 2019-2020 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>
> diff --git a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h b/sysdeps/unix/sysv/linux/riscv/kernel_stat.h
> new file mode 100644
> index 0000000000..25e698b9bf
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/riscv/kernel_stat.h
> @@ -0,0 +1,23 @@
> +/* Copyright (C) 2019-2020 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library. If not, see
> + <http://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>
Maciej
More information about the Libc-alpha
mailing list