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

Erik Andersen andersen at codepoet.org
Mon Jul 15 12:39:24 UTC 2002


On Mon Jul 15, 2002 at 02:28:25PM +0200, Ronald Wahl wrote:
> On Mon, 15 Jul 2002 06:16:36 -0600, Erik Andersen wrote:
> 
> >> work. It cannot work since you still use the syscall macros. We _need_
> >> the unified syscall!
> 
> > Refresh my memory again as to why this can only work
> > with the unified syscall support?
> 
> The problem is that if syscalls take 64-Bit arguments than the registers
> that hold the syscall parameters need to be aligned. David Blythe wrote
> in this thread: "The powerpc must put an ll parameter in an odd,even
> register pair, so it leaves a hole to get to the next pair if
> necessary." This can only be done if you have a real -- the unified --
> syscall function. Then the compiler does the alignment by itself.

Hmm.  Glibc (./sysdeps/unix/sysv/linux/powerpc/pread.c) seems to 
be managing the same thing by tricking thing compiler into doing
the right thing.  The define the __syscall_pread prototype as

    extern ssize_t __syscall_pread (int fd, void *buf, 
	size_t count, off64_t offset);

and call it like this:

      result = __syscall_pread (fd, buf, count, (off64_t) offset);

when in fact the actual prototype is 

    extern ssize_t __syscall_pread (int fd, void *buf, 
	size_t count, off_t offset_hi, off_t offset_lo);

Could you check if moving __syscall_pread and __syscall_pwrite
back into syscalls.c, and then changing the function prototypes
to pretend they take a single off64_t does the job for you?

Which I presume does the job.  Hmm.  Interesting.  So on powerpc,
so you see this same problem for all functions currently using
the __LONG_LONG_PAIR macro?

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list