[uClibc]Re: pread/pwrite broken w/o large file support

David McCullough davidm at snapgear.com
Wed Jul 10 11:43:22 UTC 2002


Jivin David Blythe lays it down ...
> Good point.  I was still hoping someone was going to suggest an 
> alternative for the "what to do about the ppc syscall macros not working 
> with long long args" problem. since it would imply other routines moving 
> too.  Its unclear to me whether the hi-lo pair code is particularly 
> generic, or just happens to work on the x86 and no one else has run into 
> it on another architecture?

I knew this thread sounded familiar.

Had the same problem on the SH platform.  The HI/LO args was the fix.

Attached is the patch as we implemented it. It worked for us,  no claims to
prettiness etc etc.

There is also a change in the patch to always include llseek even if LFS is
disabled (same behaviour as glibc).

Cheers,
Davidm

-- 
David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
davidm at snapgear.com  Fx: +61 7 3891 3630  825 Stanley St., W'gabba QLD 4102, Oz
-------------- next part --------------
Index: uClibc/libc/sysdeps/linux/common/syscalls.c
===================================================================
RCS file: /cvs/sw/uClibc/libc/sysdeps/linux/common/syscalls.c,v
retrieving revision 1.1.1.6
retrieving revision 1.3
diff -c -r1.1.1.6 -r1.3
*** uClibc/libc/sysdeps/linux/common/syscalls.c	11 Apr 2002 04:48:09 -0000	1.1.1.6
--- uClibc/libc/sysdeps/linux/common/syscalls.c	17 Jun 2002 06:11:36 -0000	1.3
***************
*** 26,31 ****
--- 26,32 ----
  #include <errno.h>
  #include <sys/types.h>
  #include <sys/syscall.h>
+ #include <endian.h>
  
  //#define __NR_exit             1
  #ifdef L__exit
***************
*** 1081,1087 ****
  
  //#define __NR__llseek          140
  #ifdef L__llseek
- #ifdef __UCLIBC_HAVE_LFS__
  extern int _llseek(int fd, __off_t offset_hi, __off_t offset_lo, 
  		__loff_t *result, int whence);
  
--- 1082,1087 ----
***************
*** 1099,1104 ****
--- 1099,1105 ----
  	return ret ? (__loff_t) ret : result;
  }
  weak_alias(__libc_lseek64, llseek);
+ #ifdef __UCLIBC_HAVE_LFS__
  weak_alias(__libc_lseek64, lseek64);
  #endif
  #endif
***************
*** 1374,1381 ****
  #define _XOPEN_SOURCE 500
  #include <unistd.h>
  #define __NR___libc_pread __NR_pread
! _syscall4(ssize_t, __libc_pread, int, fd, void *, buf, size_t, count, __off_t, offset);
! weak_alias (__libc_pread, pread)
  #endif
  
  //#define __NR_pwrite                   181
--- 1375,1388 ----
  #define _XOPEN_SOURCE 500
  #include <unistd.h>
  #define __NR___libc_pread __NR_pread
! 
! _syscall5(ssize_t, __libc_pread, int, fd, void *, buf, size_t, count, long, offset1, long, offset2);
! 
! ssize_t pread(int fd, void *buf, size_t count, __off_t offset)
! {
! 	return(__libc_pread(fd, buf, count, __LONG_LONG_PAIR(0, offset)));
! }
! 
  #endif
  
  //#define __NR_pwrite                   181
***************
*** 1383,1390 ****
  #define _XOPEN_SOURCE 500
  #include <unistd.h>
  #define __NR___libc_pwrite __NR_pwrite
! _syscall4(ssize_t, __libc_pwrite, int, fd, const void *, buf, size_t, count, __off_t, offset);
! weak_alias (__libc_pwrite, pwrite)
  #endif
  
  //#define __NR_chown                    182
--- 1390,1403 ----
  #define _XOPEN_SOURCE 500
  #include <unistd.h>
  #define __NR___libc_pwrite __NR_pwrite
! 
! _syscall5(ssize_t, __libc_pwrite, int, fd, const void *, buf, size_t, count, long, offset1, long, offset2);
! 
! ssize_t pwrite(int fd, __const void *buf, size_t count, __off_t offset)
! {
! 	return(__libc_pwrite(fd, buf, count, __LONG_LONG_PAIR(0, offset)));
! }
! 
  #endif
  
  //#define __NR_chown                    182


More information about the uClibc mailing list