All of lore.kernel.org
 help / color / mirror / Atom feed
From: Erik Andersen <andersen@codepoet.org>
To: Matthew Wilcox <willy@debian.org>
Cc: Alexander Viro <viro@math.psu.edu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] work around duff ABIs
Date: Sat, 19 Oct 2002 22:51:49 -0600	[thread overview]
Message-ID: <20021020045149.GA27887@codepoet.org> (raw)
In-Reply-To: <20021020053147.C5285@parcelfarce.linux.theplanet.co.uk>

On Sun Oct 20, 2002 at 05:31:47AM +0100, Matthew Wilcox wrote:
> 
> *sigh*.  i hate this kind of bullshit.  please, don't anyone ever try
> to pass 64-bit args through the syscall interface again.

I agree it can be a pain.

[-----------snip-------------]
> -asmlinkage ssize_t sys_pread64(unsigned int fd, char *buf,
> -			     size_t count, loff_t pos)
> +#ifdef __BIG_ENDIAN
> +asmlinkage ssize_t sys_pread64(unsigned int fd, char *buf, size_t count,
> +				unsigned int high, unsigned int low)
> +#else
> +asmlinkage ssize_t sys_pread64(unsigned int fd, char *buf, size_t count,
> +				unsigned int low, unsigned int high)
> +#endif

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....

 -Erik

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

  parent reply	other threads:[~2002-10-20  4: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 [this message]
2002-10-20 12:51   ` Matthew Wilcox
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=20021020045149.GA27887@codepoet.org \
    --to=andersen@codepoet.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    --cc=willy@debian.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.