public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Cancellation entrypoint refactor
@ 2016-02-24 20:48 Adhemerval Zanella
  2016-02-24 20:48 ` [PATCH 1/5] Define __ASSUME_ALIGNED_REGISTER_PAIRS for missing ports Adhemerval Zanella
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2016-02-24 20:48 UTC (permalink / raw)
  To: libc-alpha

Hi all,

This is a respin on previous patch.  Changes from previous version:

 * Split the second patch in two: one for inclusion of generic Linux
   sysdep header in all ports and another to add the SYSCALL_LL{64}
   definition.

 * Rework the mips64-n32 definition by adding a definition
   (__ASSUME_OFF_DIFF_OFF64) which says the sizeof of __off_t is the
   same __off64_t.  So we will have basically 3 scenarios:

   1. __WORDSIZE == 32
     pread   with off_t
     pread64 with off64_t

   2. __WORDSIZE == 64 and __ASSUME_OFF_DIFF_OFF64
     pread   with off_t
     pread64 with off64_t

   3. __WORDSIZE == 64
     pread being and alias to pread64
     pread64

  So for mip64-n32 it will define __ASSUME_OFF_DIFF_OFF64 and thus we can
  remove the mips specific implementations.

--

These patches are a subset of a larger patchset I am working with the
aim to both simplify both syscall cancellation entrypoints and its
definition.

The main aim is to remove the requirement of assembly macros definition
on syscall-cancel.h and instead use C code through SYSCALL_CANCEL
macro.  This both simplify a new port creation by removing arch-specific
code requirements and also make easier to adjust current ports to the
new cancellation mechanism.

To accomplish it the idea is remove all the syscall cancellation auto
generation through syscalls.list and remove all the multiple syscall
definition across multiple ports.  So for all the cancellation
entrypoints for linux will ending have a single C implementation on
sysdep/unix/sysv/linux.

The first patch add the __ASSUME_ALIGNED_REGISTER_PAIRS on the missing
architectures that have the ABI constraint but does not define it.  
Second patch adds a new macro to use along long long syscalls arguments
for 32-bits to currect split it 2 arguments.  The third and last patch
use these new macros to consolidate the pread and pwrite syscall
definition in only one implementation.

Adhemerval Zanella (5):
  Define __ASSUME_ALIGNED_REGISTER_PAIRS for missing ports
  Include generic Linux sysdep.h for all architectures
  Consolidate off_t/off64_t syscall argument passing
  Consolidate pread/pread64 implementations
  Consolidate pwrite/pwrite64 implementations

 ChangeLog                                          | 86 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/sysdep.h             |  1 +
 sysdeps/unix/sysv/linux/arm/kernel-features.h      |  4 +
 sysdeps/unix/sysv/linux/arm/pread.c                | 36 ---------
 sysdeps/unix/sysv/linux/arm/pread64.c              | 37 ----------
 sysdeps/unix/sysv/linux/arm/pwrite.c               | 36 ---------
 sysdeps/unix/sysv/linux/arm/pwrite64.c             | 38 ----------
 sysdeps/unix/sysv/linux/arm/sysdep.h               |  2 +
 sysdeps/unix/sysv/linux/generic/sysdep.h           | 13 ++++
 .../unix/sysv/linux/generic/wordsize-32/pread.c    | 37 ----------
 .../unix/sysv/linux/generic/wordsize-32/pread64.c  | 34 ---------
 .../unix/sysv/linux/generic/wordsize-32/pwrite.c   | 36 ---------
 .../unix/sysv/linux/generic/wordsize-32/pwrite64.c | 35 ---------
 sysdeps/unix/sysv/linux/hppa/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/i386/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/ia64/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/m68k/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/microblaze/sysdep.h        |  1 +
 sysdeps/unix/sysv/linux/mips/kernel-features.h     | 13 ++++
 sysdeps/unix/sysv/linux/mips/mips32/sysdep.h       |  1 +
 sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h   |  1 +
 sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h   |  1 +
 sysdeps/unix/sysv/linux/mips/pread.c               | 54 --------------
 sysdeps/unix/sysv/linux/mips/pread64.c             | 50 -------------
 sysdeps/unix/sysv/linux/mips/pwrite.c              | 54 --------------
 sysdeps/unix/sysv/linux/mips/pwrite64.c            | 51 -------------
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h  |  6 ++
 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c  | 34 ---------
 .../unix/sysv/linux/powerpc/powerpc32/pread64.c    | 35 ---------
 sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c | 35 ---------
 .../unix/sysv/linux/powerpc/powerpc32/pwrite64.c   | 36 ---------
 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 19 +----
 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 19 +----
 sysdeps/unix/sysv/linux/pread.c                    | 25 ++-----
 sysdeps/unix/sysv/linux/pread64.c                  | 23 +++---
 sysdeps/unix/sysv/linux/pwrite.c                   | 25 ++-----
 sysdeps/unix/sysv/linux/pwrite64.c                 | 23 +++---
 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h      |  1 +
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h      |  1 +
 sysdeps/unix/sysv/linux/sh/pread.c                 | 30 ++------
 sysdeps/unix/sysv/linux/sh/pread64.c               | 30 ++------
 sysdeps/unix/sysv/linux/sh/pwrite.c                | 30 ++------
 sysdeps/unix/sysv/linux/sh/pwrite64.c              | 31 ++------
 sysdeps/unix/sysv/linux/sh/sysdep.h                |  1 +
 sysdeps/unix/sysv/linux/sparc/sysdep.h             |  1 +
 sysdeps/unix/sysv/linux/wordsize-64/pread64.c      |  1 -
 sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c     |  1 -
 sysdeps/unix/sysv/linux/wordsize-64/syscalls.list  |  2 -
 sysdeps/unix/sysv/linux/x86_64/kernel-features.h   |  6 ++
 sysdeps/unix/sysv/linux/x86_64/sysdep.h            |  1 +
 50 files changed, 200 insertions(+), 841 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c

-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] Define __ASSUME_ALIGNED_REGISTER_PAIRS for missing ports
  2016-02-24 20:48 [PATCH 0/5] Cancellation entrypoint refactor Adhemerval Zanella
@ 2016-02-24 20:48 ` Adhemerval Zanella
  2016-02-24 20:48 ` [PATCH 2/5] Include generic Linux sysdep.h for all architectures Adhemerval Zanella
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2016-02-24 20:48 UTC (permalink / raw)
  To: libc-alpha

This patch defines __ASSUME_ALIGNED_REGISTER_PAIRS for the missing
ports that require 64-bit value (e.g., long long) to be aligned to
an even register pair in argument passing.

No code change is expected, tested with builds for powerpc32,
mips-o32, and armhf.

	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_ALIGNED_REGISTER_PAIRS): Define.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[_MIPS_SIM == _ABIO32] (__ASSUME_ALIGNED_REGISTER_PAIRS): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	[!__powerpc64__] (__ASSUME_ALIGNED_REGISTER_PAIRS): Likewise.
---
 sysdeps/unix/sysv/linux/arm/kernel-features.h     | 4 ++++
 sysdeps/unix/sysv/linux/mips/kernel-features.h    | 6 ++++++
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 6 ++++++
 4 files changed, 25 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 6f1606c..1bcc34d 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -42,3 +42,7 @@
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
+
+/* Define this if your 32-bit syscall API requires 64-bit register
+   pairs to start with an even-number register.  */
+#define __ASSUME_ALIGNED_REGISTER_PAIRS	1
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index 83f7a47..ea6a914 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -47,3 +47,9 @@
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
 #endif
+
+/* Define this if your 32-bit syscall API requires 64-bit register
+   pairs to start with an even-number register.  */
+#if _MIPS_SIM == _ABIO32
+# define __ASSUME_ALIGNED_REGISTER_PAIRS	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 14807ad..6dcd77d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -57,4 +57,10 @@
 #endif
 #define __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL	1
 
+/* Define this if your 32-bit syscall API requires 64-bit register
+   pairs to start with an even-number register.  */
+#ifndef __powerpc64__
+# define __ASSUME_ALIGNED_REGISTER_PAIRS	1
+#endif
+
 #include_next <kernel-features.h>
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/5] Consolidate pread/pread64 implementations
  2016-02-24 20:48 [PATCH 0/5] Cancellation entrypoint refactor Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2016-02-24 20:48 ` [PATCH 3/5] Consolidate off_t/off64_t syscall argument passing Adhemerval Zanella
@ 2016-02-24 20:48 ` Adhemerval Zanella
  2016-02-24 21:39 ` [PATCH 5/5] Consolidate pwrite/pwrite64 implementations Adhemerval Zanella
  4 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2016-02-24 20:48 UTC (permalink / raw)
  To: libc-alpha; +Cc: Adhemerval Zanella

From: Adhemerval Zanella <adhemerval.zanella@linaro.com>

This patch consolidates all the pread/pread64 implementation for Linux
in only one (sysdeps/unix/sysv/linux/pread.c).  It also removes the
syscall from the auto-generation using assembly macros.

For pread{64} offset argument placement the new SYSCALL_LL{64} macro
is used.  For pread ports that do not define __NR_pread will use
__NR_pread64 and for pread64 ports that dot define __NR_pread64 will
use __NR_pread for the syscall.

Checked on x86_64, x32, i386, aarch64, and ppc64le.

	* sysdeps/unix/sysv/linux/arm/pread.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c: Likewise,
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (pread): Remove
	syscall generation.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
	[__NR_pread64] (__NR_pread): Remove define.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
	[__NR_pread64] (__NR_pread): Likewise.
	* sysdeps/unix/sysv/linux/pread.c [__NR_pread64] (__NR_pread): Remove
	define.
	(__libc_pread): Use SYSCALL_LL macro on offset argument.
	* sysdeps/unix/sysv/linux/pread64.c [__NR_pread64] (__NR_pread):
	Remove define.
	(__libc_pread64): Use SYSCALL_LL64 macro on offset argument.
	* sysdeps/unix/sysv/linux/sh/pread.c: Rewrite using default
	Linux implementation as base.
	* sysdeps/unix/sysv/linux/sh/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pread64.c: Likewise.
---
 sysdeps/unix/sysv/linux/arm/pread.c                | 36 ---------------
 sysdeps/unix/sysv/linux/arm/pread64.c              | 37 ---------------
 .../unix/sysv/linux/generic/wordsize-32/pread.c    | 37 ---------------
 .../unix/sysv/linux/generic/wordsize-32/pread64.c  | 34 --------------
 sysdeps/unix/sysv/linux/mips/kernel-features.h     |  1 +
 sysdeps/unix/sysv/linux/mips/pread.c               | 54 ----------------------
 sysdeps/unix/sysv/linux/mips/pread64.c             | 50 --------------------
 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c  | 34 --------------
 .../unix/sysv/linux/powerpc/powerpc32/pread64.c    | 35 --------------
 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h |  7 ---
 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h |  7 ---
 sysdeps/unix/sysv/linux/pread.c                    | 25 +++-------
 sysdeps/unix/sysv/linux/pread64.c                  | 23 ++++-----
 sysdeps/unix/sysv/linux/sh/pread.c                 | 30 ++----------
 sysdeps/unix/sysv/linux/sh/pread64.c               | 30 ++----------
 sysdeps/unix/sysv/linux/wordsize-64/pread64.c      |  1 -
 sysdeps/unix/sysv/linux/wordsize-64/syscalls.list  |  1 -
 18 files changed, 53 insertions(+), 414 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
 delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/pread64.c

diff --git a/sysdeps/unix/sysv/linux/arm/pread.c b/sysdeps/unix/sysv/linux/arm/pread.c
deleted file mode 100644
index 8c9b878..0000000
--- a/sysdeps/unix/sysv/linux/arm/pread.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-  /* In the ARM EABI, 64-bit values are aligned to even/odd register
-     pairs for syscalls.  */
-  return SYSCALL_CANCEL (pread64, fd, buf, count, 0,
-			 __LONG_LONG_PAIR (offset >> 31, offset));
-}
-
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
diff --git a/sysdeps/unix/sysv/linux/arm/pread64.c b/sysdeps/unix/sysv/linux/arm/pread64.c
deleted file mode 100644
index 3364b6a..0000000
--- a/sysdeps/unix/sysv/linux/arm/pread64.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-  /* In the ARM EABI, 64-bit values are aligned to even/odd register
-     pairs for syscalls.  */
-  return SYSCALL_CANCEL (pread64, fd, buf, count, 0,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
-}
-
-weak_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
deleted file mode 100644
index 0dff648..0000000
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-   Based on work contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-  assert (sizeof (offset) == 4);
-  return SYSCALL_CANCEL (pread64, fd,
-                         buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR (offset >> 31, offset));
-}
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
deleted file mode 100644
index 8931900..0000000
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-   Based on work contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-  return SYSCALL_CANCEL (pread64, fd, buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
-                                           (off_t) (offset & 0xffffffff)));
-}
-weak_alias (__libc_pread64, __pread64) weak_alias (__libc_pread64, pread64)
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index 17ab696..7cb32cd 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -58,4 +58,5 @@
    pass 64-bits values through syscalls.  */
 #if _MIPS_SIM == _ABIN32
 # define __ASSUME_WORDSIZE64_ILP32	1
+# define __ASSUME_OFF_DIFF_OFF64        1
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c
deleted file mode 100644
index 02755cb..0000000
--- a/sysdeps/unix/sysv/linux/mips/pread.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-#if _MIPS_SIM != _ABI64
-  assert (sizeof (offset) == 4);
-#endif
-
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  return SYSCALL_CANCEL (pread, fd, buf, count, offset);
-#else
-  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
-			 __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-}
-
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c
deleted file mode 100644
index ed0e91c..0000000
--- a/sysdeps/unix/sysv/linux/mips/pread64.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-
-ssize_t
-__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  return SYSCALL_CANCEL (pread, fd, buf, count, offset);
-#else
-  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
-#endif
-}
-
-weak_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
deleted file mode 100644
index 2d67013..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-  /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  return SYSCALL_CANCEL (pread, fd, buf, count, 0, offset >> 31, offset);
-}
-
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
deleted file mode 100644
index 712ab72..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-
-ssize_t
-__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-  /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  return SYSCALL_CANCEL (pread, fd, buf, count, 0, (long) (offset >> 32),
-			 (long) offset);
-}
-
-weak_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 390ce24..c12fd7f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -27,13 +27,6 @@
    Handle them here so they can be catched by both C and assembler stubs in
    glibc.  */
 
-#ifdef __NR_pread64
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
 #ifdef __NR_pwrite64
 # ifdef __NR_pwrite
 #  error "__NR_pwrite and __NR_pwrite64 both defined???"
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 761f3ea..c39a0f2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -34,13 +34,6 @@
    Handle them here so they can be catched by both C and assembler stubs in
    glibc.  */
 
-#ifdef __NR_pread64
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
 #ifdef __NR_pwrite64
 # ifdef __NR_pwrite
 #  error "__NR_pwrite and __NR_pwrite64 both defined???"
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
index 4aa3c67..5663092 100644
--- a/sysdeps/unix/sysv/linux/pread.c
+++ b/sysdeps/unix/sysv/linux/pread.c
@@ -16,33 +16,22 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <assert.h>
-#include <errno.h>
-#include <endian.h>
 #include <unistd.h>
-
 #include <sysdep-cancel.h>
-#include <sys/syscall.h>
 
-#ifdef __NR_pread64		/* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
+#if __WORDSIZE != 64 || defined (__ASSUME_OFF_DIFF_OFF64)
 
+# ifndef __NR_pread
+#  define __NR_pread __NR_pread64
+# endif
 
 ssize_t
 __libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  assert (sizeof (offset) == 4);
-  result = SYSCALL_CANCEL (pread, fd, buf, count,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-
-  return result;
+  return SYSCALL_CANCEL (pread, fd, buf, count,
+			 __ALIGNMENT_ARG SYSCALL_LL (offset));
 }
 
 strong_alias (__libc_pread, __pread)
 weak_alias (__libc_pread, pread)
+#endif
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
index 7b5019a..c599f76 100644
--- a/sysdeps/unix/sysv/linux/pread64.c
+++ b/sysdeps/unix/sysv/linux/pread64.c
@@ -16,28 +16,25 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <endian.h>
 #include <unistd.h>
-
 #include <sysdep-cancel.h>
-#include <sys/syscall.h>
 
-#ifdef __NR_pread64		/* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
+#ifndef __NR_pread64
+# define __NR_pread64 __NR_pread
 #endif
 
-
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  return SYSCALL_CANCEL (pread, fd, buf, count,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
+  return SYSCALL_CANCEL (pread64, fd, buf, count,
+			 __ALIGNMENT_ARG SYSCALL_LL64 (offset));
 }
 
 weak_alias (__libc_pread64, __pread64)
 weak_alias (__libc_pread64, pread64)
+
+#if __WORDSIZE == 64 && !defined (__ASSUME_OFF_DIFF_OFF64)
+strong_alias (__libc_pread64, __libc_pread)
+weak_alias (__libc_pread64, __pread)
+weak_alias (__libc_pread64, pread)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/sysdeps/unix/sysv/linux/sh/pread.c
index 8afada5..d3f99f3 100644
--- a/sysdeps/unix/sysv/linux/sh/pread.c
+++ b/sysdeps/unix/sysv/linux/sh/pread.c
@@ -16,28 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <assert.h>
-#include <errno.h>
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
-			 __LONG_LONG_PAIR (offset >> 31, offset));
-}
-
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
+/* SH4 ABI does not really require argument alignment for 64-bits, but
+   the kernel interface for pread adds a dummy long argument before the
+   offset.  */
+#define __ALIGNMENT_ARG
+#include <sysdeps/unix/sysv/linux/pread.c>
diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/sysdeps/unix/sysv/linux/sh/pread64.c
index cfc751d..b2e8a25 100644
--- a/sysdeps/unix/sysv/linux/sh/pread64.c
+++ b/sysdeps/unix/sysv/linux/sh/pread64.c
@@ -16,28 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-
-ssize_t
-__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
-}
-
-weak_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
+/* SH4 ABI does not really require argument alignment for 64-bits, but
+   the kernel interface for pread adds a dummy long argument before the
+   offset.  */
+#define __ALIGNMENT_ARG
+#include <sysdeps/unix/sysv/linux/pread64.c>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/pread64.c b/sysdeps/unix/sysv/linux/wordsize-64/pread64.c
deleted file mode 100644
index b7f298d..0000000
--- a/sysdeps/unix/sysv/linux/wordsize-64/pread64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty since the pread syscall is equivalent.  */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 19cc6d9..7d5f6a5 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -3,7 +3,6 @@
 # Whee! 64-bit systems naturally implement llseek.
 llseek		EXTRA	lseek		i:iii	__libc_lseek	__lseek lseek __libc_lseek64 __llseek llseek __lseek64 lseek64
 lseek		llseek	-
-pread		-	pread		Ci:ibni	__libc_pread	__libc_pread64 __pread pread __pread64 pread64
 pwrite		-	pwrite		Ci:ibni	__libc_pwrite	__libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
 fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/5] Consolidate off_t/off64_t syscall argument passing
  2016-02-24 20:48 [PATCH 0/5] Cancellation entrypoint refactor Adhemerval Zanella
  2016-02-24 20:48 ` [PATCH 1/5] Define __ASSUME_ALIGNED_REGISTER_PAIRS for missing ports Adhemerval Zanella
  2016-02-24 20:48 ` [PATCH 2/5] Include generic Linux sysdep.h for all architectures Adhemerval Zanella
@ 2016-02-24 20:48 ` Adhemerval Zanella
  2016-02-24 21:41   ` Mike Frysinger
  2016-02-24 20:48 ` [PATCH 4/5] Consolidate pread/pread64 implementations Adhemerval Zanella
  2016-02-24 21:39 ` [PATCH 5/5] Consolidate pwrite/pwrite64 implementations Adhemerval Zanella
  4 siblings, 1 reply; 7+ messages in thread
From: Adhemerval Zanella @ 2016-02-24 20:48 UTC (permalink / raw)
  To: libc-alpha; +Cc: Adhemerval Zanella

From: Adhemerval Zanella <adhemerval.zanella@linaro.com>

This patch add two new macros to use along with off_t and off64_t argument
syscalls.  The rationale for this change is:

1. Remove multiple implementations for the same syscall for different
   architectures (for instance, pread have 6 different implementations).

2. Also remove the requirement to use syscall wrappers for cancellable
   entrypoints.

The macro usage should be used along __ALIGNMENT_ARG to follow ABI constrains
for architecture where it applies.  For instance, pread can be rewritten as:

  return SYSCALL_CANCEL (pread, fd, buf, count,
                         __ALIGNMENT_ARG SYSCALL_LL (offset));

Another macro, SYSCALL_LL64, is provided for off64_t.

The changes itself are not currently used in any implementation, so no
code change is expected.

	* sysdeps/unix/sysv/linux/generic/sysdep.h (__NR__llseek): Define only
	if it is not already defined.
	(SYSCALL_LL): Define.
	(SYSCALL_LL64): Likewise.
---
 sysdeps/unix/sysv/linux/generic/sysdep.h | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h
index 4f2c65d..22bfe59 100644
--- a/sysdeps/unix/sysv/linux/generic/sysdep.h
+++ b/sysdeps/unix/sysv/linux/generic/sysdep.h
@@ -22,7 +22,9 @@
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 
 /* Provide the common name to allow more code reuse.  */
+#ifndef __NR__llseek
 #define __NR__llseek __NR_llseek
+#endif
 
 #if __WORDSIZE == 64
 /* By defining the older names, glibc will build syscall wrappers for
@@ -41,3 +43,14 @@
 #define __ALIGNMENT_ARG
 #define __ALIGNMENT_COUNT(a,b) a
 #endif
+
+/* Provide a common macro to pass 64-bit value on syscalls.  */
+#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
+# define SYSCALL_LL(__val)   (__val)
+# define SYSCALL_LL64(__val) (__val)
+#else
+#define SYSCALL_LL(__val)   \
+  __LONG_LONG_PAIR (__val >> 31, __val)
+#define SYSCALL_LL64(__val) \
+  __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))
+#endif
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/5] Include generic Linux sysdep.h for all architectures
  2016-02-24 20:48 [PATCH 0/5] Cancellation entrypoint refactor Adhemerval Zanella
  2016-02-24 20:48 ` [PATCH 1/5] Define __ASSUME_ALIGNED_REGISTER_PAIRS for missing ports Adhemerval Zanella
@ 2016-02-24 20:48 ` Adhemerval Zanella
  2016-02-24 20:48 ` [PATCH 3/5] Consolidate off_t/off64_t syscall argument passing Adhemerval Zanella
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2016-02-24 20:48 UTC (permalink / raw)
  To: libc-alpha

This adds the Linux generic sysdep.h for all architectures.  The generic
sysdep.h defines basically two things:

  1. Define __NR_pread and __NR_write to __NR_pread64 and __NR_write64
     respectively for 64-bits architectures

  2. Define the __ALIGNMENT_ARG and __ALIGNMENT_COUNT macros to use
     for 64-bit argument passing on syscalls.

The p{read,write} definition is safe since for 64-bits the p{read,write}
will aliased to p{read,write}64.  The __ALIGNMENT_{ARG,COUNT} should be
safe if all the ABI correctly defines __ASSUME_ALIGNED_REGISTER_PAIRS.
This lead to the correct definition on the missing ABIs, mips64-n32
and x32.

Checked on x86_64, i386, aarch64, armhf, and ppc64le.

	* sysdeps/unix/sysv/linux/alpha/sysdep.h: Include generic sysdep.h.
	* sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/kernel-features.h
	[__ILP32] (__ASSUME_WORDSIZE64_ILP32): Define.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[_MIPS_SIM == _ABIN32] (__ASSUME_WORDSIZE64_ILP32): Likewise.
---
 sysdeps/unix/sysv/linux/alpha/sysdep.h             |  1 +
 sysdeps/unix/sysv/linux/arm/sysdep.h               |  2 ++
 sysdeps/unix/sysv/linux/hppa/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/i386/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/ia64/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/m68k/sysdep.h              |  1 +
 sysdeps/unix/sysv/linux/microblaze/sysdep.h        |  1 +
 sysdeps/unix/sysv/linux/mips/kernel-features.h     |  6 ++++++
 sysdeps/unix/sysv/linux/mips/mips32/sysdep.h       |  1 +
 sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h   |  1 +
 sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h   |  1 +
 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h |  1 +
 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h |  1 +
 sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h      |  1 +
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h      |  1 +
 sysdeps/unix/sysv/linux/sh/sysdep.h                |  1 +
 sysdeps/unix/sysv/linux/sparc/sysdep.h             |  1 +
 sysdeps/unix/sysv/linux/x86_64/kernel-features.h   |  6 ++++++
 sysdeps/unix/sysv/linux/x86_64/sysdep.h            |  1 +
 20 files changed, 52 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h
index b6efc66..d6a1ac9 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysdep.h
+++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -27,6 +27,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/alpha/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 #include <tls.h>
 
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h
index 3986547..a71b418 100644
--- a/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -21,8 +21,10 @@
 #define _LINUX_ARM_SYSDEP_H 1
 
 /* There is some commonality.  */
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/arm/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
 #include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h
index b459f0a..7b43695 100644
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.h
+++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h
@@ -24,6 +24,7 @@
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/hppa/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 /* Defines RTLD_PRIVATE_ERRNO.  */
 #include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 5fcb175..8776d8e 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -22,6 +22,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/i386/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
 #include <dl-sysdep.h>
 #include <tls.h>
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index 8dfc582..9b95454 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -22,6 +22,7 @@
 
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <sysdeps/ia64/sysdep.h>
 #include <dl-sysdep.h>
 #include <tls.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h
index ce48496..ff4dea0 100644
--- a/sysdeps/unix/sysv/linux/m68k/sysdep.h
+++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h
@@ -18,6 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <tls.h>
 
 /* Defines RTLD_PRIVATE_ERRNO.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
index abc13c2..f06aa1b 100644
--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
+++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
@@ -22,6 +22,7 @@
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/microblaze/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 /* Defines RTLD_PRIVATE_ERRNO.  */
 #include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index ea6a914..17ab696 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -53,3 +53,9 @@
 #if _MIPS_SIM == _ABIO32
 # define __ASSUME_ALIGNED_REGISTER_PAIRS	1
 #endif
+
+/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
+   pass 64-bits values through syscalls.  */
+#if _MIPS_SIM == _ABIN32
+# define __ASSUME_WORDSIZE64_ILP32	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
index 2160df7..6551794 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -21,6 +21,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/mips/mips32/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 #include <tls.h>
 
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
index 466dcde..88efe74 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
@@ -21,6 +21,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/mips/mips64/n32/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 #include <tls.h>
 
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
index db8b237..09ea9fa 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
@@ -21,6 +21,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/mips/mips64/n64/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 #include <tls.h>
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 6d8990c..390ce24 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -20,6 +20,7 @@
 
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/powerpc/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <tls.h>
 
 /* Some systen calls got renamed over time, but retained the same semantics.
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 91fd096..761f3ea 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -22,6 +22,7 @@
 
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/powerpc/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <tls.h>
 
 /* Define __set_errno() for INLINE_SYSCALL macro below.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 3540416..672b326 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -22,6 +22,7 @@
 #include <sysdeps/s390/s390-32/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO.  */
 #include <tls.h>
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 6f390ff..980f202 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -23,6 +23,7 @@
 #include <sysdeps/s390/s390-64/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO.  */
 #include <tls.h>
 
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index 8618d12..b8cafcc 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -23,6 +23,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/sh/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <tls.h>
 
 /* For Linux we can use the system call table in the header file
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h
index cb197b6..615a0cb 100644
--- a/sysdeps/unix/sysv/linux/sparc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h
@@ -22,6 +22,7 @@
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/sparc/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 #ifdef __ASSEMBLER__
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel-features.h b/sysdeps/unix/sysv/linux/x86_64/kernel-features.h
index 0b84f11..569e8f8 100644
--- a/sysdeps/unix/sysv/linux/x86_64/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/x86_64/kernel-features.h
@@ -35,4 +35,10 @@
 # define __ASSUME_GETCPU_SYSCALL	1
 #endif
 
+/* Define that x32 is a ILP32 ABI to set the correct interface to pass
+   64-bits values through syscalls.  */
+#ifdef __ILP32__
+# define __ASSUME_WORDSIZE64_ILP32	1
+#endif
+
 #include_next <kernel-features.h>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index d023d68..723ebf2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -21,6 +21,7 @@
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/x86_64/sysdep.h>
+#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <tls.h>
 
 #if IS_IN (rtld)
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/5] Consolidate pwrite/pwrite64 implementations
  2016-02-24 20:48 [PATCH 0/5] Cancellation entrypoint refactor Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2016-02-24 20:48 ` [PATCH 4/5] Consolidate pread/pread64 implementations Adhemerval Zanella
@ 2016-02-24 21:39 ` Adhemerval Zanella
  4 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2016-02-24 21:39 UTC (permalink / raw)
  To: libc-alpha; +Cc: Adhemerval Zanella

From: Adhemerval Zanella <adhemerval.zanella@linaro.com>

This patch consolidates all the pwrite/pwrite64 implementation for Linux
in only one (sysdeps/unix/sysv/linux/pwrite{64}.c).  It also removes the
syscall from the auto-generation using assembly macros.

For pwrite{64} offset argument placement the new SYSCALL_LL{64} macro
is used.  For pwrite ports that do not define __NR_pwrite will use
__NR_pwrite64 and for pwrite64 ports that dot define __NR_pwrite64 will
use __NR_pwrite for the syscall.

Checked on x86_64, x32, i386, aarch64, and ppc64le.

	* sysdeps/unix/sysv/linux/arm/pwrite.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (prite): Remove
	syscalls generation.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
	[__NR_pwrite64] (__NR_write): Remove define.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
	[__NR_pwrite64] (__NR_write): Remove define.
	* sysdeps/unix/sysv/linux/pwrite.c [__NR_pwrite64] (__NR_pwrite):
	Remove define.
	(__libc_pwrite): Use SYSCALL_LL macro on offset argument.
	* sysdeps/unix/sysv/linux/pwrite64.c [__NR_pwrite64] (__NR_pwrite):
	Remove define.
	(__libc_pwrite64): Use SYSCALL_LL64 macro on offset argument.
	* sysdeps/unix/sysv/linux/sh/pwrite.c: Rewrite using default
	Linux implementation as base.
	* sysdeps/unix/sysv/linux/sh/pwrite64.c: Likewise.
---
 sysdeps/unix/sysv/linux/arm/pwrite.c               | 36 ---------------
 sysdeps/unix/sysv/linux/arm/pwrite64.c             | 38 ---------------
 .../unix/sysv/linux/generic/wordsize-32/pwrite.c   | 36 ---------------
 .../unix/sysv/linux/generic/wordsize-32/pwrite64.c | 35 --------------
 sysdeps/unix/sysv/linux/mips/pwrite.c              | 54 ----------------------
 sysdeps/unix/sysv/linux/mips/pwrite64.c            | 51 --------------------
 sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c | 35 --------------
 .../unix/sysv/linux/powerpc/powerpc32/pwrite64.c   | 36 ---------------
 sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 11 -----
 sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 11 -----
 sysdeps/unix/sysv/linux/pwrite.c                   | 25 +++-------
 sysdeps/unix/sysv/linux/pwrite64.c                 | 23 ++++-----
 sysdeps/unix/sysv/linux/sh/pwrite.c                | 30 ++----------
 sysdeps/unix/sysv/linux/sh/pwrite64.c              | 31 ++-----------
 sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c     |  1 -
 sysdeps/unix/sysv/linux/wordsize-64/syscalls.list  |  1 -
 17 files changed, 52 insertions(+), 427 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/arm/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
 delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c

diff --git a/sysdeps/unix/sysv/linux/arm/pwrite.c b/sysdeps/unix/sysv/linux/arm/pwrite.c
deleted file mode 100644
index d4132f1..0000000
--- a/sysdeps/unix/sysv/linux/arm/pwrite.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-  /* In the ARM EABI, 64-bit values are aligned to even/odd register
-     pairs for syscalls.  */
-  return SYSCALL_CANCEL (pwrite64, fd, buf, count, 0,
-			 __LONG_LONG_PAIR (offset >> 31, offset));
-}
-
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
diff --git a/sysdeps/unix/sysv/linux/arm/pwrite64.c b/sysdeps/unix/sysv/linux/arm/pwrite64.c
deleted file mode 100644
index 1b70560..0000000
--- a/sysdeps/unix/sysv/linux/arm/pwrite64.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-  /* In the ARM EABI, 64-bit values are aligned to even/odd register
-     pairs for syscalls.  */
-  return SYSCALL_CANCEL (pwrite64, fd, buf, count, 0,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
-}
-
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
deleted file mode 100644
index f9f1e0d..0000000
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-   Based on work contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-  assert (sizeof (offset) == 4);
-  return SYSCALL_CANCEL (pwrite64, fd, buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR (offset >> 31, offset));
-}
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
deleted file mode 100644
index 53aaa47..0000000
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-   Based on work contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-  return SYSCALL_CANCEL (pwrite64, fd, buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
-                                           (off_t) (offset & 0xffffffff)));
-}
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64)
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c
deleted file mode 100644
index 31dea3a..0000000
--- a/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-#if _MIPS_SIM != _ABI64
-  assert (sizeof (offset) == 4);
-#endif
-
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, offset);
-#else
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
-			 __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-}
-
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c
deleted file mode 100644
index 1905c57..0000000
--- a/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>, 1998.
-
-   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/>.  */
-
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-
-ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, offset);
-#else
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
-#endif
-}
-
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
deleted file mode 100644
index 4001b47..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-  /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0, offset >> 31, offset);
-}
-
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
deleted file mode 100644
index 8a513fa..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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/>.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-
-ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-  /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0, (long) (offset >> 32),
-			 (long) offset);
-}
-
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index c12fd7f..9dff4d0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -23,17 +23,6 @@
 #include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <tls.h>
 
-/* Some systen calls got renamed over time, but retained the same semantics.
-   Handle them here so they can be catched by both C and assembler stubs in
-   glibc.  */
-
-#ifdef __NR_pwrite64
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
    of the kernel.  But these symbols do not follow the SYS_* syntax
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index c39a0f2..a9c5413 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -30,17 +30,6 @@
 #include <errno.h>
 #endif
 
-/* Some systen calls got renamed over time, but retained the same semantics.
-   Handle them here so they can be catched by both C and assembler stubs in
-   glibc.  */
-
-#ifdef __NR_pwrite64
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
    of the kernel.  But these symbols do not follow the SYS_* syntax
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index d02862a..ca3014f 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -16,33 +16,22 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <assert.h>
-#include <errno.h>
-#include <endian.h>
 #include <unistd.h>
-
 #include <sysdep-cancel.h>
-#include <sys/syscall.h>
 
-#ifdef __NR_pwrite64		/* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
+#if __WORDSIZE != 64 || defined (__ASSUME_OFF_DIFF_OFF64)
 
+# ifndef __NR_pwrite
+#  define __NR_pwrite __NR_pwrite64
+# endif
 
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  assert (sizeof (offset) == 4);
-  result = SYSCALL_CANCEL (pwrite, fd, buf, count,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-
-  return result;
+  return SYSCALL_CANCEL (pwrite, fd, buf, count,
+			 __ALIGNMENT_ARG SYSCALL_LL (offset));
 }
 
 strong_alias (__libc_pwrite, __pwrite)
 weak_alias (__libc_pwrite, pwrite)
+#endif
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index d28e9b9..5a37701 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -16,28 +16,25 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <endian.h>
 #include <unistd.h>
-
 #include <sysdep-cancel.h>
-#include <sys/syscall.h>
 
-#ifdef __NR_pwrite64		/* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
+#ifndef __NR_pwrite64
+# define __NR_pwrite64 __NR_pwrite
 #endif
 
-
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  return SYSCALL_CANCEL (pwrite, fd, buf, count,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
+  return SYSCALL_CANCEL (pwrite64, fd, buf, count,
+			 __ALIGNMENT_ARG SYSCALL_LL64 (offset));
 }
 weak_alias (__libc_pwrite64, __pwrite64)
 libc_hidden_weak (__pwrite64)
 weak_alias (__libc_pwrite64, pwrite64)
+
+#if __WORDSIZE == 64 && !defined (__ASSUME_OFF_DIFF_OFF64)
+strong_alias (__libc_pwrite64, __libc_pwrite)
+weak_alias (__libc_pwrite64, __pwrite)
+weak_alias (__libc_pwrite64, pwrite)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c
index c27d356..391ed5e 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite.c
@@ -16,28 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <assert.h>
-#include <errno.h>
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
-			 __LONG_LONG_PAIR (offset >> 31, offset));
-}
-
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
+/* SH4 ABI does not really require argument alignment for 64-bits, but
+   the kernel interface for pwrite adds a dummy long argument before the
+   offset.  */
+#define __ALIGNMENT_ARG
+#include <sysdeps/unix/sysv/linux/pwrite.c>
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/sysdeps/unix/sysv/linux/sh/pwrite64.c
index 7948cef..683a5d9 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite64.c
@@ -16,29 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-
-ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
-			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					   (off_t) (offset & 0xffffffff)));
-}
-
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
+/* SH4 ABI does not really require argument alignment for 64-bits, but
+   the kernel interface for pread adds a dummy long argument before the
+   offset.  */
+#define __ALIGNMENT_ARG
+#include <sysdeps/unix/sysv/linux/pwrite64.c>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c b/sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c
deleted file mode 100644
index b7f298d..0000000
--- a/sysdeps/unix/sysv/linux/wordsize-64/pwrite64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty since the pread syscall is equivalent.  */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 7d5f6a5..2eb9419 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -3,7 +3,6 @@
 # Whee! 64-bit systems naturally implement llseek.
 llseek		EXTRA	lseek		i:iii	__libc_lseek	__lseek lseek __libc_lseek64 __llseek llseek __lseek64 lseek64
 lseek		llseek	-
-pwrite		-	pwrite		Ci:ibni	__libc_pwrite	__libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
 fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64
 mmap		-	mmap		b:aniiii __mmap		mmap __mmap64 mmap64
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/5] Consolidate off_t/off64_t syscall argument passing
  2016-02-24 20:48 ` [PATCH 3/5] Consolidate off_t/off64_t syscall argument passing Adhemerval Zanella
@ 2016-02-24 21:41   ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2016-02-24 21:41 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha, Adhemerval Zanella

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

On 24 Feb 2016 17:48, Adhemerval Zanella wrote:
> +#define SYSCALL_LL(__val)   \
> +  __LONG_LONG_PAIR (__val >> 31, __val)
> +#define SYSCALL_LL64(__val) \
> +  __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff))

shouldn't __val be parenthesized ?

#define SYSCALL_LL(__val) __LONG_LONG_PAIR ((__val) >> 31, (__val))

also, does this really need to be __val ?  it's a macro so it's not
like someone using a var or define named __val would affect this.
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-24 21:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-24 20:48 [PATCH 0/5] Cancellation entrypoint refactor Adhemerval Zanella
2016-02-24 20:48 ` [PATCH 1/5] Define __ASSUME_ALIGNED_REGISTER_PAIRS for missing ports Adhemerval Zanella
2016-02-24 20:48 ` [PATCH 2/5] Include generic Linux sysdep.h for all architectures Adhemerval Zanella
2016-02-24 20:48 ` [PATCH 3/5] Consolidate off_t/off64_t syscall argument passing Adhemerval Zanella
2016-02-24 21:41   ` Mike Frysinger
2016-02-24 20:48 ` [PATCH 4/5] Consolidate pread/pread64 implementations Adhemerval Zanella
2016-02-24 21:39 ` [PATCH 5/5] Consolidate pwrite/pwrite64 implementations Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).