From 77a4fbd53611720cd6ae845de560df5dd332b28e Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 21 Oct 2015 10:03:31 -0200 Subject: Consolidate pread/pread64 implementations 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/powerpc/powerpc32/pread.c | 34 --------------------- .../unix/sysv/linux/powerpc/powerpc32/pread64.c | 35 ---------------------- sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 7 ----- 3 files changed, 76 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c (limited to 'sysdeps/unix/sysv/linux/powerpc/powerpc32') 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 2d67013ab3..0000000000 --- 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 , 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 - . */ - -#include -#include -#include - -#include -#include - -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 712ab72934..0000000000 --- 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 , 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 - . */ - -#include -#include - -#include -#include - - -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 6d8990c5de..0dc18dac83 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -26,13 +26,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???" -- cgit 1.4.1