about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-07-06 23:42:33 +0000
committerGreg McGary <greg@mcgary.org>2000-07-06 23:42:33 +0000
commitca1cde9e3eeffca1fab21102cb5c4b56257dcf83 (patch)
tree6486088a4704f004d747068cd63d882118b255c4 /sysdeps/unix
parentcf90163d418e0cf83166e85735ba81a3cd28ed32 (diff)
downloadglibc-ca1cde9e3eeffca1fab21102cb5c4b56257dcf83.tar.gz
glibc-ca1cde9e3eeffca1fab21102cb5c4b56257dcf83.tar.xz
glibc-ca1cde9e3eeffca1fab21102cb5c4b56257dcf83.zip
* string/endian.h (__LONG_LONG_PAIR): New macro.
* sysdeps/unix/sysv/linux/ftruncate64.c: Use it. 
* sysdeps/unix/sysv/linux/pread.c: Likewise. 
* sysdeps/unix/sysv/linux/pread64.c: Likewise. 
* sysdeps/unix/sysv/linux/pwrite.c: Likewise. 
* sysdeps/unix/sysv/linux/pwrite64.c: Likewise. 
* sysdeps/unix/sysv/linux/truncate64.c: Likewise. 
* sysdeps/unix/sysv/linux/mips/ftruncate64.c: Likewise. 
* sysdeps/unix/sysv/linux/mips/pread.c: Likewise. 
* sysdeps/unix/sysv/linux/mips/pread64.c: Likewise. 
* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise. 
* sysdeps/unix/sysv/linux/mips/pwrite64.c: Likewise. 
* sysdeps/unix/sysv/linux/mips/truncate64.c: Likewise.
	* string/endian.h (__LONG_LONG_PAIR): New macro.
	* sysdeps/unix/sysv/linux/ftruncate64.c: Use it.
	* sysdeps/unix/sysv/linux/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/truncate64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/ftruncate64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/truncate64.c: Likewise.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/ftruncate64.c7
-rw-r--r--sysdeps/unix/sysv/linux/mips/ftruncate64.c9
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread.c8
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread64.c10
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite.c8
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite64.c11
-rw-r--r--sysdeps/unix/sysv/linux/mips/truncate64.c10
-rw-r--r--sysdeps/unix/sysv/linux/pread.c7
-rw-r--r--sysdeps/unix/sysv/linux/pread64.c10
-rw-r--r--sysdeps/unix/sysv/linux/pwrite.c7
-rw-r--r--sysdeps/unix/sysv/linux/pwrite64.c10
-rw-r--r--sysdeps/unix/sysv/linux/truncate64.c7
12 files changed, 28 insertions, 76 deletions
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index 40e28790eb..f3f99c4ca2 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -49,11 +49,8 @@ ftruncate64 (int fd, off64_t length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-      int result = INLINE_SYSCALL (ftruncate64, 3, fd, low, high);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-      int result = INLINE_SYSCALL (ftruncate64, 3, fd, high, low);
-#endif
+      int result = INLINE_SYSCALL (ftruncate64, 3, fd,
+				   __LONG_LONG_PAIR (high, low));
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/ftruncate64.c
index 768946e9fa..e45afbad7d 100644
--- a/sysdeps/unix/sysv/linux/mips/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/mips/ftruncate64.c
@@ -50,13 +50,8 @@ ftruncate64 (int fd, off64_t length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-      /* Use a fill argument to pass low, high in an aligned pair of
-         arguments (here 2/3).  */
-      int result = INLINE_SYSCALL (ftruncate64, 3, fd, 0, low, high);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-      int result = INLINE_SYSCALL (ftruncate64, 3, fd, 0, high, low);
-#endif
+      int result = INLINE_SYSCALL (ftruncate64, 3, fd, 0,
+				   __LONG_LONG_PAIR (high, low));
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c
index d926a06508..dd1e5d8a05 100644
--- a/sysdeps/unix/sysv/linux/mips/pread.c
+++ b/sysdeps/unix/sysv/linux/mips/pread.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <unistd.h>
+#include <endian.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
@@ -46,11 +47,8 @@ __libc_pread (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if defined(__MIPSEB__)
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, 0, offset);
-# elif defined(__MIPSEL__)
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, offset, 0);
-# endif
+  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
+			   __LONG_LONG_PAIR (0, offset));
 # if __ASSUME_PREAD_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c
index d17dbeb396..06a992e1cb 100644
--- a/sysdeps/unix/sysv/linux/mips/pread64.c
+++ b/sysdeps/unix/sysv/linux/mips/pread64.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <unistd.h>
+#include <endian.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
@@ -47,14 +48,9 @@ __libc_pread64 (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if defined(__MIPSEB__)
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0, (off_t) (offset >> 32),
-			   (off_t) (offset & 0xffffffff));
-# elif defined(__MIPSEL__)
   result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			   (off_t) (offset & 0xffffffff),
-			   (off_t) (offset >> 32));
-# endif
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
 # if __ASSUME_PREAD_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c
index a83df31ca4..b45bb84f4d 100644
--- a/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ b/sysdeps/unix/sysv/linux/mips/pwrite.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <unistd.h>
+#include <endian.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
@@ -45,11 +46,8 @@ __libc_pwrite (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if defined(__MIPSEB__)
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, 0, offset);
-# elif defined(__MIPSEL__)
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, offset, 0);
-# endif
+  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
+			   __LONG_LONG_PAIR (0, offset));
 # if __ASSUME_PWRITE_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c
index 295a1754b6..0481064500 100644
--- a/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/mips/pwrite64.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <unistd.h>
+#include <endian.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
@@ -45,15 +46,9 @@ __libc_pwrite64 (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if defined(__MIPSEB__)
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0, (off_t) (offset >> 32),
-			   (off_t) (offset & 0xffffffff));
-# elif defined(__MIPSEL__)
   result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			   (off_t) (offset & 0xffffffff),
-			   (off_t) (offset >> 32));
-# endif
-
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
 # if __ASSUME_PWRITE_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
diff --git a/sysdeps/unix/sysv/linux/mips/truncate64.c b/sysdeps/unix/sysv/linux/mips/truncate64.c
index bcdb9ddf98..7a446194d3 100644
--- a/sysdeps/unix/sysv/linux/mips/truncate64.c
+++ b/sysdeps/unix/sysv/linux/mips/truncate64.c
@@ -50,14 +50,8 @@ truncate64 (const char *path, off64_t length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-      /* Use a fill argument to pass low, high in an aligned pair of
-         arguments (here 2/3).  */
-      int result = INLINE_SYSCALL (truncate64, 3, path, 0, low, high);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-      int result = INLINE_SYSCALL (truncate64, 3, path, 0, high, low);
-#endif
-
+      int result = INLINE_SYSCALL (truncate64, 3, path, 0,
+				   __LONG_LONG_PAIR (high, low));
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)
 #endif
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
index 9c2f8f24e1..08faa28a1e 100644
--- a/sysdeps/unix/sysv/linux/pread.c
+++ b/sysdeps/unix/sysv/linux/pread.c
@@ -48,11 +48,8 @@ __libc_pread (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-  result = INLINE_SYSCALL (pread, 5, fd, buf, count, offset, 0);
-# elif __BYTE_ORDER == __BIG_ENDIAN
-  result = INLINE_SYSCALL (pread, 5, fd, buf, count, 0, offset);
-# endif
+  result = INLINE_SYSCALL (pread, 5, fd, buf, count,
+			   __LONG_LONG_PAIR (0, offset));
 
 # if __ASSUME_PREAD_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
index 1bf08dc878..479f4833de 100644
--- a/sysdeps/unix/sysv/linux/pread64.c
+++ b/sysdeps/unix/sysv/linux/pread64.c
@@ -47,15 +47,9 @@ __libc_pread64 (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if __BYTE_ORDER == __LITTLE_ENDIAN
   result = INLINE_SYSCALL (pread, 5, fd, buf, count,
-			   (off_t) (offset & 0xffffffff),
-			   (off_t) (offset >> 32));
-# elif __BYTE_ORDER == __BIG_ENDIAN
-  result = INLINE_SYSCALL (pread, 5, fd, buf, count,
-			   (off_t) (offset >> 32),
-			   (off_t) (offset & 0xffffffff));
-# endif
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
 
 # if __ASSUME_PREAD_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index c69403c5bd..dab46dc035 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -48,11 +48,8 @@ __libc_pwrite (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-  result = INLINE_SYSCALL (pwrite, 5, fd, buf, count, offset, 0);
-# elif __BYTE_ORDER == __BIG_ENDIAN
-  result = INLINE_SYSCALL (pwrite, 5, fd, buf, count, 0, offset);
-# endif
+  result = INLINE_SYSCALL (pwrite, 5, fd, buf, count,
+			   __LONG_LONG_PAIR (0, offset));
 # if __ASSUME_PWRITE_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index 71eac41a48..b1039f097a 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -47,15 +47,9 @@ __libc_pwrite64 (fd, buf, count, offset)
   ssize_t result;
 
   /* First try the syscall.  */
-# if __BYTE_ORDER == __LITTLE_ENDIAN
   result = INLINE_SYSCALL (pwrite, 5, fd, buf, count,
-			   (off_t) (offset & 0xffffffff),
-			   (off_t) (offset >> 32));
-# elif __BYTE_ORDER == __BIG_ENDIAN
-  result = INLINE_SYSCALL (pwrite, 5, fd, buf, count,
-			   (off_t) (offset >> 32),
-			   (off_t) (offset & 0xffffffff));
-# endif
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
 # if __ASSUME_PWRITE_SYSCALL == 0
   if (result == -1 && errno == ENOSYS)
     /* No system call available.  Use the emulation.  */
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index e921442021..f0f49e1dee 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -49,11 +49,8 @@ truncate64 (const char *path, off64_t length)
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       int saved_errno = errno;
 #endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-      int result = INLINE_SYSCALL (truncate64, 3, path, low, high);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-      int result = INLINE_SYSCALL (truncate64, 3, path, high, low);
-#endif
+      int result = INLINE_SYSCALL (truncate64, 3, path,
+				   __LONG_LONG_PAIR (high, low));
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       if (result != -1 || errno != ENOSYS)