From: Matthew Wilcox <willy@debian.org>
To: Erik Andersen <andersen@codepoet.org>,
Matthew Wilcox <willy@debian.org>,
Alexander Viro <viro@math.psu.edu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] work around duff ABIs
Date: Sun, 20 Oct 2002 13:51:09 +0100 [thread overview]
Message-ID: <20021020135109.D5285@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20021020045149.GA27887@codepoet.org>; from andersen@codepoet.org on Sat, Oct 19, 2002 at 10:51:49PM -0600
On Sat, Oct 19, 2002 at 10:51:49PM -0600, Erik Andersen wrote:
> Nonono. Please see __LONG_LONG_PAIR in /usr/include/endian.h.
> Your user space code should be doing something like this:
>
> static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
> size_t, count, off_t, offset_hi, off_t, offset_lo);
>
> ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
> {
> return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR((off_t)0,offset)));
> }
>
> ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
> {
> return(__syscall_pread(fd, buf, count,
> __LONG_LONG_PAIR((off_t)(offset>>32),
> (off_t)(offset&0xffffffff))));
> }
>
> Your patch is going to break GNU libc, uClibc, and anyone else in
> userspace that is doing pread and pread64 correctly....
Well... since you just proved that you don't understand the problem,
I'd hazard a guess that uClibc is also broken, as well as glibc.
Here's how the ABI specifies that pread() shall take its arguments:
asmlinkage ssize_t sys_pread64(unsigned int fd, char *buf, size_t count,
loff_t pos)
fd arg0
buf arg1
count arg2
pos arg4 & arg5
Here's what __LONG_LONG_PAIR does:
fd arg0
buf arg1
count arg2
pos(HI) arg3
pos(LO) arg4
--
Revolutions do not require corporate support.
next prev parent reply other threads:[~2002-10-20 12:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-20 4:31 [PATCH] work around duff ABIs Matthew Wilcox
2002-10-20 4:45 ` John Levon
2002-10-20 4:51 ` Erik Andersen
2002-10-20 12:51 ` Matthew Wilcox [this message]
2002-10-21 12:14 ` Alan Cox
2002-10-22 4:43 ` Erik Andersen
2002-10-22 13:04 ` Matthew Wilcox
2002-10-21 12:13 ` Alan Cox
2002-10-21 13:48 ` Matthew Wilcox
2002-10-21 16:26 ` Alan Cox
2002-11-04 5:10 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021020135109.D5285@parcelfarce.linux.theplanet.co.uk \
--to=willy@debian.org \
--cc=andersen@codepoet.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@math.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox