]>
Commit | Line | Data |
---|---|---|
56cdcad9 JR |
1 | diff -urNp linux-860/arch/i386/kernel/entry.S linux-880/arch/i386/kernel/entry.S |
2 | --- linux-860/arch/i386/kernel/entry.S | |
3 | +++ linux-880/arch/i386/kernel/entry.S | |
4 | @@ -651,7 +651,7 @@ ENTRY(sys_call_table) | |
5 | .long SYMBOL_NAME(sys_lremovexattr) | |
6 | .long SYMBOL_NAME(sys_fremovexattr) | |
7 | .long SYMBOL_NAME(sys_tkill) | |
8 | - .long SYMBOL_NAME(sys_ni_syscall) /* reserved for sendfile64 */ | |
9 | + .long SYMBOL_NAME(sys_sendfile64) /* reserved for sendfile64 */ | |
10 | .long SYMBOL_NAME(sys_ni_syscall) /* 240 reserved for futex */ | |
11 | .long SYMBOL_NAME(sys_ni_syscall) /* reserved for sched_setaffinity */ | |
12 | .long SYMBOL_NAME(sys_ni_syscall) /* reserved for sched_getaffinity */ | |
13 | diff -urNp linux-860/mm/filemap.c linux-880/mm/filemap.c | |
14 | --- linux-860/mm/filemap.c | |
15 | +++ linux-880/mm/filemap.c | |
16 | @@ -1755,7 +1755,7 @@ int file_send_actor(read_descriptor_t * | |
17 | return written; | |
18 | } | |
19 | ||
20 | -asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) | |
21 | +static ssize_t common_sendfile(int out_fd, int in_fd, loff_t *offset, size_t count) | |
22 | { | |
23 | ssize_t retval; | |
24 | struct file * in_file, * out_file; | |
25 | @@ -1800,27 +1800,19 @@ asmlinkage ssize_t sys_sendfile(int out_ | |
26 | retval = 0; | |
27 | if (count) { | |
28 | read_descriptor_t desc; | |
29 | - loff_t pos = 0, *ppos; | |
30 | - | |
31 | - retval = -EFAULT; | |
32 | - ppos = &in_file->f_pos; | |
33 | - if (offset) { | |
34 | - if (get_user(pos, offset)) | |
35 | - goto fput_out; | |
36 | - ppos = &pos; | |
37 | - } | |
38 | + | |
39 | + if (!offset) | |
40 | + offset = &in_file->f_pos; | |
41 | ||
42 | desc.written = 0; | |
43 | desc.count = count; | |
44 | desc.buf = (char *) out_file; | |
45 | desc.error = 0; | |
46 | - do_generic_file_read(in_file, ppos, &desc, file_send_actor); | |
47 | + do_generic_file_read(in_file, offset, &desc, file_send_actor); | |
48 | ||
49 | retval = desc.written; | |
50 | if (!retval) | |
51 | retval = desc.error; | |
52 | - if (offset) | |
53 | - put_user(pos, offset); | |
54 | } | |
55 | ||
56 | fput_out: | |
57 | @@ -1831,6 +1823,38 @@ out: | |
58 | return retval; | |
59 | } | |
60 | ||
61 | +asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) | |
62 | +{ | |
63 | + loff_t pos, *ppos = NULL; | |
64 | + ssize_t ret; | |
65 | + if (offset) { | |
66 | + off_t off; | |
67 | + if (unlikely(get_user(off, offset))) | |
68 | + return -EFAULT; | |
69 | + pos = off; | |
70 | + ppos = &pos; | |
71 | + } | |
72 | + ret = common_sendfile(out_fd, in_fd, ppos, count); | |
73 | + if (offset) | |
74 | + put_user((off_t)pos, offset); | |
75 | + return ret; | |
76 | +} | |
77 | + | |
78 | +asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count) | |
79 | +{ | |
80 | + loff_t pos, *ppos = NULL; | |
81 | + ssize_t ret; | |
82 | + if (offset) { | |
83 | + if (unlikely(copy_from_user(&pos, offset, sizeof(loff_t)))) | |
84 | + return -EFAULT; | |
85 | + ppos = &pos; | |
86 | + } | |
87 | + ret = common_sendfile(out_fd, in_fd, ppos, count); | |
88 | + if (offset) | |
89 | + put_user(pos, offset); | |
90 | + return ret; | |
91 | +} | |
92 | + | |
93 | static ssize_t do_readahead(struct file *file, unsigned long index, unsigned long nr) | |
94 | { | |
95 | struct address_space *mapping = file->f_dentry->d_inode->i_mapping; |