This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
p{read,write}{,64} mips n64 changes
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: 14 Mar 2003 11:46:15 -0300
- Subject: p{read,write}{,64} mips n64 changes
- Organization: GCC Team, Red Hat
mips n64 pread and pwrite syscalls take the offset as a single 64-bit
argument, instead of as a pair of 32-bit values. This patch fixes
it. Ok?
Index: ChangeLog
2003-03-14 Alexandre Oliva <aoliva at redhat dot com>
* sysdeps/unix/sysv/linux/mips/pread.c: Don't break up offset
into high and low halves on n64.
* sysdeps/unix/sysv/linux/mips/pread64.c: Likewise.
* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise.
* sysdeps/unix/sysv/linux/mips/pwrite64.c: Likewise.
Index: sysdeps/unix/sysv/linux/mips/pread.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pread.c,v
retrieving revision 1.9
diff -u -p -r1.9 pread.c
--- sysdeps/unix/sysv/linux/mips/pread.c 27 Jan 2003 19:00:40 -0000 1.9
+++ sysdeps/unix/sysv/linux/mips/pread.c 14 Mar 2003 14:42:33 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at cygnus dot com>, 1997.
@@ -42,7 +42,13 @@ static ssize_t __emulate_pread (int fd,
off_t offset) internal_function;
# endif
extern ssize_t __syscall_pread (int fd, void *__unbounded buf, size_t count,
- int dummy, off_t offset_hi, off_t offset_lo);
+ int dummy,
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ off_t offset
+#else
+ off_t offset_hi, off_t offset_lo
+#endif
+ );
@@ -59,8 +65,13 @@ __libc_pread (fd, buf, count, offset)
{
/* First try the syscall. */
assert (sizeof (offset) == 4);
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ offset);
+#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
+#endif
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
@@ -73,8 +84,13 @@ __libc_pread (fd, buf, count, offset)
/* First try the syscall. */
assert (sizeof (offset) == 4);
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ offset);
+#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
+#endif
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
Index: sysdeps/unix/sysv/linux/mips/pread64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pread64.c,v
retrieving revision 1.9
diff -u -p -r1.9 pread64.c
--- sysdeps/unix/sysv/linux/mips/pread64.c 27 Jan 2003 19:00:40 -0000 1.9
+++ sysdeps/unix/sysv/linux/mips/pread64.c 14 Mar 2003 14:42:33 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at cygnus dot com>, 1997.
@@ -42,7 +42,13 @@ static ssize_t __emulate_pread64 (int fd
# endif
extern ssize_t __syscall_pread (int fd, void *__unbounded buf, size_t count,
- int dummy, off_t offset_hi, off_t offset_lo);
+ int dummy,
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ off_t offset
+#else
+ off_t offset_hi, off_t offset_lo
+#endif
+ );
@@ -59,9 +65,14 @@ __libc_pread64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ offset);
+#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
+#endif
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
@@ -73,9 +84,14 @@ __libc_pread64 (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+ offset);
+#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
+#endif
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
Index: sysdeps/unix/sysv/linux/mips/pwrite.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pwrite.c,v
retrieving revision 1.9
diff -u -p -r1.9 pwrite.c
--- sysdeps/unix/sysv/linux/mips/pwrite.c 27 Jan 2003 19:01:03 -0000 1.9
+++ sysdeps/unix/sysv/linux/mips/pwrite.c 14 Mar 2003 14:42:33 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at cygnus dot com>, 1997.
@@ -38,7 +38,13 @@
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
extern ssize_t __syscall_pwrite (int fd, const void *__unbounded buf, size_t count,
- int dummy, off_t offset_hi, off_t offset_lo);
+ int dummy,
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ off_t offset
+#else
+ off_t offset_hi, off_t offset_lo
+#endif
+ );
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
@@ -58,8 +64,13 @@ __libc_pwrite (fd, buf, count, offset)
{
/* First try the syscall. */
assert (sizeof (offset) == 4);
+#if defined _ABI64 && _MIPS_SIM == _ABI64
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
- __LONG_LONG_PAIR (offset >> 31, offset));
+ offset);
+#else
+ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ __LONG_LONG_PAIR (offset >> 31, offset));
+#endif
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
@@ -73,8 +84,13 @@ __libc_pwrite (fd, buf, count, offset)
/* First try the syscall. */
assert (sizeof (offset) == 4);
+#if defined _ABI64 && _MIPS_SIM == _ABI64
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
- __LONG_LONG_PAIR (offset >> 31, offset));
+ offset);
+#else
+ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ __LONG_LONG_PAIR (offset >> 31, offset));
+#endif
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
Index: sysdeps/unix/sysv/linux/mips/pwrite64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pwrite64.c,v
retrieving revision 1.10
diff -u -p -r1.10 pwrite64.c
--- sysdeps/unix/sysv/linux/mips/pwrite64.c 27 Jan 2003 19:01:03 -0000 1.10
+++ sysdeps/unix/sysv/linux/mips/pwrite64.c 14 Mar 2003 14:42:33 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf at gnu dot org>, 1998.
@@ -37,7 +37,13 @@
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
extern ssize_t __syscall_pwrite (int fd, const void *__unbounded buf, size_t count,
- int dummy, off_t offset_hi, off_t offset_lo);
+ int dummy,
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ off_t offset
+#else
+ off_t offset_hi, off_t offset_lo
+#endif
+ );
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
@@ -56,9 +62,14 @@ __libc_pwrite64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ offset);
+#else
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
+#endif
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
@@ -71,9 +82,14 @@ __libc_pwrite64 (fd, buf, count, offset)
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
+#if defined _ABI64 && _MIPS_SIM == _ABI64
+ result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+ offset);
+#else
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
+#endif
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer