From: Christoph Hellwig <hch@infradead.org>
To: Marc-Christian Petersen <m.c.p@wolk-project.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
John Fremlin <vii@users.sourceforge.net>,
Marcelo Tosatti <marcelo@conectiva.com.br>,
lkml <linux-kernel@vger.kernel.org>,
cw@f00f.org, bcrl@redhat.com
Subject: Re: sys_sendfile64 not in Linux 2.4.21-pre4
Date: Thu, 30 Jan 2003 11:16:34 +0000 [thread overview]
Message-ID: <20030130111634.A24454@infradead.org> (raw)
In-Reply-To: <200301301202.01897.m.c.p@wolk-project.de>; from m.c.p@wolk-project.de on Thu, Jan 30, 2003 at 12:02:01PM +0100
On Thu, Jan 30, 2003 at 12:02:01PM +0100, Marc-Christian Petersen wrote:
> > > > Why isn't sendfile64 included in 2.4.21-pre4? glibc 2.3 already
> > > > expects it, so programs with 64-bit off_t will not be able to use
> > > > sendfile otherwise. And the patch is IIUC very small . . .
> > >
> > > I sent patches to Marcelo a few times, but they got silently ignored..
> >
> > Can you forward me a copy ?
> to me too please :)
--- linux-2.4.18/arch/i386/kernel/entry.S~ Sun Jun 9 13:39:14 2002
+++ linux-2.4.18/arch/i386/kernel/entry.S Sun Jun 9 13:44:45 2002
@@ -645,7 +645,7 @@
.long SYMBOL_NAME(sys_ni_syscall) /* reserved for lremovexattr */
.long SYMBOL_NAME(sys_ni_syscall) /* reserved for fremovexattr */
.long SYMBOL_NAME(sys_tkill)
- .long SYMBOL_NAME(sys_ni_syscall) /* reserved for sendfile64 */
+ .long SYMBOL_NAME(sys_sendfile64)
.long SYMBOL_NAME(sys_ni_syscall) /* 240 reserved for futex */
.long SYMBOL_NAME(sys_ni_syscall) /* reserved for sched_setaffinity */
.long SYMBOL_NAME(sys_ni_syscall) /* reserved for sched_getaffinity */
--- linux-2.4.18/mm/filemap.c~ Sun Jun 9 13:39:21 2002
+++ linux-2.4.18/mm/filemap.c Sun Jun 9 13:48:38 2002
@@ -1889,7 +1889,7 @@
return written;
}
-asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count)
+static ssize_t common_sendfile(int out_fd, int in_fd, loff_t *offset, size_t count)
{
ssize_t retval;
struct file * in_file, * out_file;
@@ -1934,27 +1934,19 @@
retval = 0;
if (count) {
read_descriptor_t desc;
- loff_t pos = 0, *ppos;
-
- retval = -EFAULT;
- ppos = &in_file->f_pos;
- if (offset) {
- if (get_user(pos, offset))
- goto fput_out;
- ppos = &pos;
- }
+
+ if (!offset)
+ offset = &in_file->f_pos;
desc.written = 0;
desc.count = count;
desc.buf = (char *) out_file;
desc.error = 0;
- do_generic_file_read(in_file, ppos, &desc, file_send_actor);
+ do_generic_file_read(in_file, offset, &desc, file_send_actor);
retval = desc.written;
if (!retval)
retval = desc.error;
- if (offset)
- put_user(pos, offset);
}
fput_out:
@@ -1965,6 +1957,42 @@
return retval;
}
+asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count)
+{
+ loff_t pos, *ppos = NULL;
+ ssize_t ret;
+
+ if (offset) {
+ off_t off;
+ if (unlikely(get_user(off, offset)))
+ return -EFAULT;
+ pos = off;
+ ppos = &pos;
+ }
+
+ ret = common_sendfile(out_fd, in_fd, ppos, count);
+ if (offset)
+ put_user((off_t)pos, offset);
+ return ret;
+}
+
+asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count)
+{
+ loff_t pos, *ppos = NULL;
+ ssize_t ret;
+
+ if (offset) {
+ if (unlikely(copy_from_user(&pos, offset, sizeof(loff_t))))
+ return -EFAULT;
+ ppos = &pos;
+ }
+
+ ret = common_sendfile(out_fd, in_fd, ppos, count);
+ if (offset)
+ put_user(pos, offset);
+ return ret;
+}
+
static ssize_t do_readahead(struct file *file, unsigned long index, unsigned long nr)
{
struct address_space *mapping = file->f_dentry->d_inode->i_mapping;
next prev parent reply other threads:[~2003-01-30 11:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-29 3:44 Linux 2.4.21-pre4 Marcelo Tosatti
2003-01-29 6:29 ` John Kim
2003-01-29 8:03 ` Denis Vlasenko
2003-01-29 9:36 ` Alan Cox
2003-01-29 12:49 ` Eyal Lebedinsky
2003-01-29 13:04 ` Maciej Soltysiak
2003-01-29 21:53 ` Thomas Davis
2003-01-30 11:43 ` Alan Cox
2003-01-30 17:09 ` Thomas Davis
2003-01-30 18:17 ` Alan Cox
2003-01-30 17:26 ` Thomas Davis
2003-01-30 18:28 ` Alan Cox
2003-01-30 0:47 ` sys_sendfile64 not in " John Fremlin
2003-01-30 8:29 ` Christoph Hellwig
2003-01-30 11:33 ` Alan Cox
2003-01-30 11:02 ` Marc-Christian Petersen
2003-01-30 11:16 ` Christoph Hellwig [this message]
2003-01-30 17:53 ` Thomas Davis
2003-01-30 19:35 ` Alan Cox
2003-01-30 18:46 ` Thomas Davis
2003-01-30 23:13 ` Martin K. Petersen
2003-01-31 3:14 ` Thomas Davis
2003-01-31 4:09 ` Martin K. Petersen
2003-01-31 4:13 ` Thomas Davis
2003-01-31 4:31 ` Martin K. Petersen
2003-01-31 4:48 ` Thomas Davis
2003-01-31 6:16 ` Thomas Davis
2003-01-30 23:30 ` Thomas Davis
2003-02-01 23:24 ` Adrian Bunk
2003-02-02 11:06 ` Adrian Bunk
2003-02-02 13:38 ` Alan Cox
2003-02-10 16:08 ` Jörn Engel
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=20030130111634.A24454@infradead.org \
--to=hch@infradead.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bcrl@redhat.com \
--cc=cw@f00f.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.c.p@wolk-project.de \
--cc=marcelo@conectiva.com.br \
--cc=vii@users.sourceforge.net \
/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