[uClibc]pread/pwrite broken w/o large file support
Ronald Wahl
rwa at peppercon.com
Mon Jul 15 12:48:54 UTC 2002
On Mon, 15 Jul 2002 06:39:24 -0600, Erik Andersen wrote:
> 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?
This works better but not entirely. The problem is that syscall5 copies not
all necessary registers. AFAIK glibc uses the unified syscall function
(./sysdeps/unix/sysv/linux/powerpc/syscall.S) and so do not have this
problem.
> 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?
This depends. If the alignment is right then it works. But I think
ftruncate64 needs to be fixed since the first argument is only 32-Bit and
the second is 64-Bit so we have a hole.
ron
--
\\ Dipl.-Inf. Ronald Wahl | Peppercon AG //
\\\ rwa at peppercon.com ||| http://www.peppercon.com/ ///
\OO ----------------------- OOO ------------------------- OO/
OO GnuPG/PGP key available OOO Keep Systems running OO
More information about the uClibc
mailing list