From 8fbf8deb34d0bd1efc22d2b67d660ad32ecc4c5c Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 6 Nov 2013 13:10:37 -0800 Subject: [PATCH] Fix pread/pwrite for LP64. Unlike on 32-bit systems where off_t is 32-bit, we don't want to throw away the top 32 bits of an LP64 system's 64-bit off_t. Change-Id: Ib2e0daeb4fc0b8ab3d1b983d0b371d8f81033b50 --- libc/Android.mk | 4 ++-- libc/SYSCALLS.TXT | 6 ++++-- libc/arch-aarch64/syscalls/pread64.S | 3 +++ libc/arch-aarch64/syscalls/pwrite64.S | 3 +++ libc/arch-x86_64/syscalls/pread64.S | 3 +++ libc/arch-x86_64/syscalls/pwrite64.S | 3 +++ 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libc/Android.mk b/libc/Android.mk index 1496d1f06..190272e2d 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -106,11 +106,9 @@ libc_common_src_files := \ bionic/memswap.c \ bionic/pathconf.c \ bionic/perror.c \ - bionic/pread.c \ bionic/ptsname.c \ bionic/ptsname_r.c \ bionic/pututline.c \ - bionic/pwrite.c \ bionic/reboot.c \ bionic/recv.c \ bionic/sched_cpualloc.c \ @@ -180,6 +178,8 @@ libc_common_src_files += \ bionic/__get_tls.cpp \ bionic/lseek64.c \ bionic/ndk_cruft.cpp \ + bionic/pread.c \ + bionic/pwrite.c \ bionic/statfs.c \ endif diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index f31073f88..ce79e9ccc 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -88,8 +88,10 @@ int acct(const char* filepath) all # file descriptors ssize_t read(int, void*, size_t) all ssize_t write(int, const void*, size_t) all -ssize_t pread64(int, void*, size_t, off64_t) all -ssize_t pwrite64(int, void*, size_t, off64_t) all +ssize_t pread64(int, void*, size_t, off64_t) arm,mips,x86 +ssize_t pread64|pread(int, void*, size_t, off_t) aarch64,x86_64 +ssize_t pwrite64(int, void*, size_t, off64_t) arm,mips,x86 +ssize_t pwrite64|pwrite(int, void*, size_t, off_t) aarch64,x86_64 int close(int) all pid_t getpid() all void* mmap(void*, size_t, int, int, int, long) aarch64,x86_64 diff --git a/libc/arch-aarch64/syscalls/pread64.S b/libc/arch-aarch64/syscalls/pread64.S index 82a2fb213..941e55ff6 100644 --- a/libc/arch-aarch64/syscalls/pread64.S +++ b/libc/arch-aarch64/syscalls/pread64.S @@ -21,3 +21,6 @@ ENTRY(pread64) ret END(pread64) + + .globl _C_LABEL(pread) + .equ _C_LABEL(pread), _C_LABEL(pread64) diff --git a/libc/arch-aarch64/syscalls/pwrite64.S b/libc/arch-aarch64/syscalls/pwrite64.S index ab4b502dc..9700aa3f9 100644 --- a/libc/arch-aarch64/syscalls/pwrite64.S +++ b/libc/arch-aarch64/syscalls/pwrite64.S @@ -21,3 +21,6 @@ ENTRY(pwrite64) ret END(pwrite64) + + .globl _C_LABEL(pwrite) + .equ _C_LABEL(pwrite), _C_LABEL(pwrite64) diff --git a/libc/arch-x86_64/syscalls/pread64.S b/libc/arch-x86_64/syscalls/pread64.S index 25378c81d..05dc02142 100644 --- a/libc/arch-x86_64/syscalls/pread64.S +++ b/libc/arch-x86_64/syscalls/pread64.S @@ -17,3 +17,6 @@ ENTRY(pread64) 1: ret END(pread64) + + .globl _C_LABEL(pread) + .equ _C_LABEL(pread), _C_LABEL(pread64) diff --git a/libc/arch-x86_64/syscalls/pwrite64.S b/libc/arch-x86_64/syscalls/pwrite64.S index c3692e978..a1e0ea121 100644 --- a/libc/arch-x86_64/syscalls/pwrite64.S +++ b/libc/arch-x86_64/syscalls/pwrite64.S @@ -17,3 +17,6 @@ ENTRY(pwrite64) 1: ret END(pwrite64) + + .globl _C_LABEL(pwrite) + .equ _C_LABEL(pwrite), _C_LABEL(pwrite64)