Browse Source

Enable pread/pwrite

Eric Andersen 22 years ago
parent
commit
6793e73e90
2 changed files with 3 additions and 12 deletions
  1. 0 8
      libc/sysdeps/linux/common/syscalls.c
  2. 3 4
      libpthread/linuxthreads/wrapsyscall.c

+ 0 - 8
libc/sysdeps/linux/common/syscalls.c

@@ -1328,11 +1328,6 @@ int sigsuspend (const sigset_t *mask)
 #endif
 
 //#define __NR_pread                    180
-#if 0
-/* If you enable these, be sure to also enable the cancelable version
- * in uClibc/libpthread/linuxthreads/wrapsyscall.c so this can be
- * overriden.
- */
 #ifdef L___libc_pread
 #define _XOPEN_SOURCE 500
 #include <unistd.h>
@@ -1340,10 +1335,8 @@ int sigsuspend (const sigset_t *mask)
 _syscall4(ssize_t, __libc_pread, int, fd, void *, buf, size_t, count, off_t, offset);
 weak_alias (__libc_pread, pread)
 #endif
-#endif
 
 //#define __NR_pwrite                   181
-#if 0
 #ifdef L___libc_pwrite
 #define _XOPEN_SOURCE 500
 #include <unistd.h>
@@ -1351,7 +1344,6 @@ weak_alias (__libc_pread, pread)
 _syscall4(ssize_t, __libc_pwrite, int, fd, const void *, buf, size_t, count, off_t, offset);
 weak_alias (__libc_pwrite, pwrite)
 #endif
-#endif
 
 //#define __NR_chown                    182
 #ifdef L_chown

+ 3 - 4
libpthread/linuxthreads/wrapsyscall.c

@@ -31,6 +31,7 @@
 #include <sys/resource.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
+#include <sys/syscall.h>
 
 
 #ifndef PIC
@@ -126,7 +127,6 @@ strong_alias (open64, __open64)
 CANCELABLE_SYSCALL (int, pause, (void), ())
 
 
-#if 0
 /* Enable this if enabling these in syscalls.c */
 /* pread(3).  */
 CANCELABLE_SYSCALL (ssize_t, pread, (int fd, void *buf, size_t count,
@@ -134,7 +134,7 @@ CANCELABLE_SYSCALL (ssize_t, pread, (int fd, void *buf, size_t count,
 		    (fd, buf, count, offset))
 
 
-#ifdef __UCLIBC_HAVE_LFS__
+#if defined __UCLIBC_HAVE_LFS__ && defined __NR_pread64
 /* pread64(3).  */
 CANCELABLE_SYSCALL (ssize_t, pread64, (int fd, void *buf, size_t count,
 				       off64_t offset),
@@ -148,14 +148,13 @@ CANCELABLE_SYSCALL (ssize_t, pwrite, (int fd, const void *buf, size_t n,
 		    (fd, buf, n, offset))
 
 
-#ifdef __UCLIBC_HAVE_LFS__
+#if defined __UCLIBC_HAVE_LFS__ && defined __NR_pwrited64
 /* pwrite64(3).  */
 CANCELABLE_SYSCALL (ssize_t, pwrite64, (int fd, const void *buf, size_t n,
 					off64_t offset),
 		    (fd, buf, n, offset))
 strong_alias (pwrite64, __pwrite64)
 #endif
-#endif
 
 /* read(2).  */
 CANCELABLE_SYSCALL (ssize_t, read, (int fd, void *buf, size_t count),