diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/pread64.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/pread64.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c index b7b5f019c8..628fd430fb 100644 --- a/sysdeps/unix/sysv/linux/pread64.c +++ b/sysdeps/unix/sysv/linux/pread64.c @@ -18,6 +18,7 @@ Boston, MA 02111-1307, USA. */ #include <errno.h> +#include <endian.h> #include <unistd.h> #include <sysdep.h> @@ -46,8 +47,16 @@ __libc_pread64 (fd, buf, count, offset) ssize_t result; /* First try the syscall. */ - result = INLINE_SYSCALL (pread, 5, fd, buf, count, (off_t) (offset >> 32), +# if __BYTE_ORDER == __LITTLE_ENDIAN + result = INLINE_SYSCALL (pread, 5, fd, buf, count, + (off_t) (offset >> 32), (off_t) (offset & 0xffffffff)); +# elif __BYTE_ORDER == __BIG_ENDIAN + result = INLINE_SYSCALL (pread, 5, fd, buf, count, + (off_t) (offset & 0xffffffff), + (off_t) (offset >> 32)); +# endif + # if __ASSUME_PREAD_SYSCALL == 0 if (result == -1 && errno == ENOSYS) /* No system call available. Use the emulation. */ |