[29/34] Linux: Define TIMER_T_WAS_INT_COMPAT in kernel-posix-timers.h

Message ID 2f9bd5a3dabea786c943c4a000ac6a1022685e84.1623956058.git.fweimer@redhat.com
State Superseded
Delegated to: Adhemerval Zanella Netto
Headers
Series Move librt into libc |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer June 17, 2021, 6:59 p.m. UTC
  This is almost equivalent to __WORDSIZE == 64
&& OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_3_3), except
that this expression is true for mips64/n64 targets as well,
even though those did not undergo the timer_t transition.

For the architecture-specific override to work, it is necessary
to switch from "..." includes to <...> includes.
---
 .../sysv/linux/alpha/kernel-posix-timers.h    | 22 +++++++++++++++++++
 .../sysv/linux/ia64/kernel-posix-timers.h     | 22 +++++++++++++++++++
 sysdeps/unix/sysv/linux/kernel-posix-timers.h |  4 ++++
 .../powerpc/powerpc64/kernel-posix-timers.h   | 22 +++++++++++++++++++
 .../linux/s390/s390-64/kernel-posix-timers.h  | 22 +++++++++++++++++++
 .../linux/sparc/sparc64/kernel-posix-timers.h | 22 +++++++++++++++++++
 sysdeps/unix/sysv/linux/timer_create.c        |  2 +-
 sysdeps/unix/sysv/linux/timer_delete.c        |  2 +-
 sysdeps/unix/sysv/linux/timer_getoverr.c      |  2 +-
 sysdeps/unix/sysv/linux/timer_gettime.c       |  2 +-
 sysdeps/unix/sysv/linux/timer_routines.c      |  2 +-
 sysdeps/unix/sysv/linux/timer_settime.c       |  2 +-
 .../linux/x86_64/64/kernel-posix-timers.h     | 22 +++++++++++++++++++
 .../unix/sysv/linux/x86_64/timer_gettime.c    |  2 +-
 .../unix/sysv/linux/x86_64/timer_settime.c    |  2 +-
 15 files changed, 144 insertions(+), 8 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/kernel-posix-timers.h
 create mode 100644 sysdeps/unix/sysv/linux/ia64/kernel-posix-timers.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel-posix-timers.h
 create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/kernel-posix-timers.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/kernel-posix-timers.h
 create mode 100644 sysdeps/unix/sysv/linux/x86_64/64/kernel-posix-timers.h
  

Comments

Adhemerval Zanella June 24, 2021, 4:21 p.m. UTC | #1
On 17/06/2021 15:59, Florian Weimer via Libc-alpha wrote:
> diff --git a/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/kernel-posix-timers.h
> index 17fc32d48f..874b809eba 100644
> --- a/sysdeps/unix/sysv/linux/kernel-posix-timers.h
> +++ b/sysdeps/unix/sysv/linux/kernel-posix-timers.h
> @@ -103,3 +103,7 @@ timerid_to_kernel_timer (timer_t timerid)
>    else
>      return (kernel_timer_t) ((uintptr_t) timerid);
>  }
> +
> +/* New targets use int instead of timer_t.  The difference only
> +   matters on 64-bit targets.  */
> +#define TIMER_T_WAS_INT_COMPAT 0

I think it would be better to move this to its own file, so there is no need to
include, undef, define on each arch-specific files.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/alpha/kernel-posix-timers.h
new file mode 100644
index 0000000000..e84dfb97e5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-posix-timers.h
@@ -0,0 +1,22 @@ 
+/* POSIX timers support functionality.  alpha version.
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysv/linux/kernel-posix-timers.h>
+
+#undef TIMER_T_WAS_INT_COMPAT
+#define TIMER_T_WAS_INT_COMPAT 1
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/ia64/kernel-posix-timers.h
new file mode 100644
index 0000000000..fb00698cf7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/kernel-posix-timers.h
@@ -0,0 +1,22 @@ 
+/* POSIX timers support functionality.  ia64 version.
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysv/linux/kernel-posix-timers.h>
+
+#undef TIMER_T_WAS_INT_COMPAT
+#define TIMER_T_WAS_INT_COMPAT 1
diff --git a/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/kernel-posix-timers.h
index 17fc32d48f..874b809eba 100644
--- a/sysdeps/unix/sysv/linux/kernel-posix-timers.h
+++ b/sysdeps/unix/sysv/linux/kernel-posix-timers.h
@@ -103,3 +103,7 @@  timerid_to_kernel_timer (timer_t timerid)
   else
     return (kernel_timer_t) ((uintptr_t) timerid);
 }
+
+/* New targets use int instead of timer_t.  The difference only
+   matters on 64-bit targets.  */
+#define TIMER_T_WAS_INT_COMPAT 0
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel-posix-timers.h
new file mode 100644
index 0000000000..718750db92
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel-posix-timers.h
@@ -0,0 +1,22 @@ 
+/* POSIX timers support functionality.  powerpc64 version.
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysv/linux/kernel-posix-timers.h>
+
+#undef TIMER_T_WAS_INT_COMPAT
+#define TIMER_T_WAS_INT_COMPAT 1
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel-posix-timers.h
new file mode 100644
index 0000000000..c8870c2dc1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/kernel-posix-timers.h
@@ -0,0 +1,22 @@ 
+/* POSIX timers support functionality.  s390x version.
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysv/linux/kernel-posix-timers.h>
+
+#undef TIMER_T_WAS_INT_COMPAT
+#define TIMER_T_WAS_INT_COMPAT 1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel-posix-timers.h
new file mode 100644
index 0000000000..b8485379ca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel-posix-timers.h
@@ -0,0 +1,22 @@ 
+/* POSIX timers support functionality.  sparc64 version.
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysv/linux/kernel-posix-timers.h>
+
+#undef TIMER_T_WAS_INT_COMPAT
+#define TIMER_T_WAS_INT_COMPAT 1
diff --git a/sysdeps/unix/sysv/linux/timer_create.c b/sysdeps/unix/sysv/linux/timer_create.c
index b21b0ca949..3dcd5455fc 100644
--- a/sysdeps/unix/sysv/linux/timer_create.c
+++ b/sysdeps/unix/sysv/linux/timer_create.c
@@ -25,7 +25,7 @@ 
 #include <sysdep.h>
 #include <internaltypes.h>
 #include <pthreadP.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 #include "kernel-posix-cpu-timers.h"
 
 
diff --git a/sysdeps/unix/sysv/linux/timer_delete.c b/sysdeps/unix/sysv/linux/timer_delete.c
index a7a183591e..ee8c364d95 100644
--- a/sysdeps/unix/sysv/linux/timer_delete.c
+++ b/sysdeps/unix/sysv/linux/timer_delete.c
@@ -20,7 +20,7 @@ 
 #include <stdlib.h>
 #include <time.h>
 #include <sysdep.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 
 
 #ifdef timer_delete_alias
diff --git a/sysdeps/unix/sysv/linux/timer_getoverr.c b/sysdeps/unix/sysv/linux/timer_getoverr.c
index 9c7ba3acad..b997290768 100644
--- a/sysdeps/unix/sysv/linux/timer_getoverr.c
+++ b/sysdeps/unix/sysv/linux/timer_getoverr.c
@@ -19,7 +19,7 @@ 
 #include <errno.h>
 #include <time.h>
 #include <sysdep.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 
 
 #ifdef timer_getoverrun_alias
diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index 193fe3b140..0b31324da7 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -21,7 +21,7 @@ 
 #include <time.h>
 #include <sysdep.h>
 #include <kernel-features.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 
 int
 __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
diff --git a/sysdeps/unix/sysv/linux/timer_routines.c b/sysdeps/unix/sysv/linux/timer_routines.c
index 8d8c1a1e76..fc3aa894ab 100644
--- a/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/sysdeps/unix/sysv/linux/timer_routines.c
@@ -22,7 +22,7 @@ 
 #include <stdbool.h>
 #include <sysdep-cancel.h>
 #include <pthreadP.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 
 
 /* List of active SIGEV_THREAD timers.  */
diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
index f8bb16a4c2..b8326e36a4 100644
--- a/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/timer_settime.c
@@ -21,7 +21,7 @@ 
 #include <time.h>
 #include <sysdep.h>
 #include <kernel-features.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 
 int
 __timer_settime64 (timer_t timerid, int flags,
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/x86_64/64/kernel-posix-timers.h
new file mode 100644
index 0000000000..db0beb5920
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/64/kernel-posix-timers.h
@@ -0,0 +1,22 @@ 
+/* POSIX timers support functionality.  x86_64 version.
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+#include <sysdeps/unix/sysv/linux/kernel-posix-timers.h>
+
+#undef TIMER_T_WAS_INT_COMPAT
+#define TIMER_T_WAS_INT_COMPAT 1
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
index 3f3ae12d6b..107b1f97c7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c
@@ -18,7 +18,7 @@ 
 
 #include <shlib-compat.h>
 #include <sysdep.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 #include "compat-timer.h"
 
 int
diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
index 14a05965a3..f987cd16d3 100644
--- a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c
@@ -18,7 +18,7 @@ 
 
 #include <shlib-compat.h>
 #include <sysdep.h>
-#include "kernel-posix-timers.h"
+#include <kernel-posix-timers.h>
 #include "compat-timer.h"
 
 int