[patch] fix mips linux n32/n64 pread/pwrite
cgd@broadcom.com
cgd@broadcom.com
Wed Sep 10 22:59:00 GMT 2003
Roland was kind enough to point out that my patch didn't apply cleanly
to today's sources.
The only changes in the master sources since my previous version
deleted some unused prototypes, but it's on me to merge and test
latest. 8-)
Here's a patch that should apply cleanly. It's been tested by
dropping the modified source files into my old glibc sources
(2003-08-16), and building & testing them for n32.
chris
--
2003-09-10 Chris Demetriou <cgd@broadcom.com>
* sysdeps/unix/sysv/linux/mips/pread64.c (__libc_pread64): Fix
syscall invocation.
* sysdeps/unix/sysv/linux/mips/pwrite64.c (__libc_pwrite64): Likewise.
* sysdeps/unix/sysv/linux/mips/pread.c (__libc_pread): Likewise.
Also, only assert off_t size is 4 for N32 and O32, and clean up
white space.
* sysdeps/unix/sysv/linux/mips/pwrite.c (__libc_pwrite): 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.12
diff -u -p -r1.12 pread.c
--- sysdeps/unix/sysv/linux/mips/pread.c 3 Sep 2003 03:21:27 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips/pread.c 10 Sep 2003 19:04:32 -0000
@@ -51,32 +51,33 @@ __libc_pread (fd, buf, count, offset)
{
ssize_t result;
+#if (defined _ABI64 && _MIPS_SIM != _ABI64)
+ assert (sizeof (offset) == 4);
+#endif
+
if (SINGLE_THREAD_P)
{
- /* First try the syscall. */
- assert (sizeof (offset) == 4);
-#if defined _ABI64 && _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count, 0,
- offset);
+ /* First try the syscall. */
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
+ offset);
#else
- result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
- __LONG_LONG_PAIR (offset >> 31, offset));
+ 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. */
- result = __emulate_pread (fd, buf, count, offset);
+ if (result == -1 && errno == ENOSYS)
+ /* No system call available. Use the emulation. */
+ result = __emulate_pread (fd, buf, count, offset);
# endif
- return result;
+ return result;
}
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
- assert (sizeof (offset) == 4);
-#if defined _ABI64 && _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count, 0,
- offset);
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
Index: sysdeps/unix/sysv/linux/mips/pread64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pread64.c,v
retrieving revision 1.12
diff -u -p -r1.12 pread64.c
--- sysdeps/unix/sysv/linux/mips/pread64.c 3 Sep 2003 03:21:27 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips/pread64.c 10 Sep 2003 19:04:32 -0000
@@ -54,8 +54,8 @@ __libc_pread64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
-#if defined _ABI64 && _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count, 0,
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
offset);
#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
@@ -73,9 +73,8 @@ __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, 5, fd, CHECK_N (buf, count), count, 0,
- offset);
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
#else
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
Index: sysdeps/unix/sysv/linux/mips/pwrite.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pwrite.c,v
retrieving revision 1.12
diff -u -p -r1.12 pwrite.c
--- sysdeps/unix/sysv/linux/mips/pwrite.c 3 Sep 2003 03:21:27 -0000 1.12
+++ sysdeps/unix/sysv/linux/mips/pwrite.c 10 Sep 2003 19:04:32 -0000
@@ -51,33 +51,33 @@ __libc_pwrite (fd, buf, count, offset)
{
ssize_t result;
+#if (defined _ABI64 && _MIPS_SIM != _ABI64)
+ assert (sizeof (offset) == 4);
+#endif
+
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
- assert (sizeof (offset) == 4);
-#if defined _ABI64 && _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count, 0,
- offset);
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
+ offset);
#else
- result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
- __LONG_LONG_PAIR (offset >> 31, offset));
+ 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. */
- result = __emulate_pwrite (fd, buf, count, offset);
+ if (result == -1 && errno == ENOSYS)
+ /* No system call available. Use the emulation. */
+ result = __emulate_pwrite (fd, buf, count, offset);
# endif
-
return result;
}
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
- assert (sizeof (offset) == 4);
-#if defined _ABI64 && _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count, 0,
- offset);
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
#else
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
Index: sysdeps/unix/sysv/linux/mips/pwrite64.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/pwrite64.c,v
retrieving revision 1.13
diff -u -p -r1.13 pwrite64.c
--- sysdeps/unix/sysv/linux/mips/pwrite64.c 3 Sep 2003 03:21:27 -0000 1.13
+++ sysdeps/unix/sysv/linux/mips/pwrite64.c 10 Sep 2003 19:04:32 -0000
@@ -53,8 +53,8 @@ __libc_pwrite64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
-#if defined _ABI64 && _MIPS_SIM == _ABI64
- result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count, 0,
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
offset);
#else
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
@@ -73,9 +73,8 @@ __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, 5, fd, CHECK_N (buf, count), count, 0,
- offset);
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32) || (defined _ABI64 && _MIPS_SIM == _ABI64)
+ result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
#else
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
More information about the Libc-alpha
mailing list