read_write.c (6673e0c3fbeaed2cd08e2fd4a4aa97382d6fedb0) | read_write.c (002c8976ee537724b20a5e179d9b349309438836) |
---|---|
1/* 2 * linux/fs/read_write.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 */ 6 7#include <linux/slab.h> 8#include <linux/stat.h> --- 814 unchanged lines hidden (view full) --- 823fput_out: 824 fput_light(out_file, fput_needed_out); 825fput_in: 826 fput_light(in_file, fput_needed_in); 827out: 828 return retval; 829} 830 | 1/* 2 * linux/fs/read_write.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 */ 6 7#include <linux/slab.h> 8#include <linux/stat.h> --- 814 unchanged lines hidden (view full) --- 823fput_out: 824 fput_light(out_file, fput_needed_out); 825fput_in: 826 fput_light(in_file, fput_needed_in); 827out: 828 return retval; 829} 830 |
831asmlinkage long sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count) | 831SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count) |
832{ 833 loff_t pos; 834 off_t off; 835 ssize_t ret; 836 837 if (offset) { 838 if (unlikely(get_user(off, offset))) 839 return -EFAULT; 840 pos = off; 841 ret = do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS); 842 if (unlikely(put_user(pos, offset))) 843 return -EFAULT; 844 return ret; 845 } 846 847 return do_sendfile(out_fd, in_fd, NULL, count, 0); 848} 849 | 832{ 833 loff_t pos; 834 off_t off; 835 ssize_t ret; 836 837 if (offset) { 838 if (unlikely(get_user(off, offset))) 839 return -EFAULT; 840 pos = off; 841 ret = do_sendfile(out_fd, in_fd, &pos, count, MAX_NON_LFS); 842 if (unlikely(put_user(pos, offset))) 843 return -EFAULT; 844 return ret; 845 } 846 847 return do_sendfile(out_fd, in_fd, NULL, count, 0); 848} 849 |
850asmlinkage long sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count) | 850SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count) |
851{ 852 loff_t pos; 853 ssize_t ret; 854 855 if (offset) { 856 if (unlikely(copy_from_user(&pos, offset, sizeof(loff_t)))) 857 return -EFAULT; 858 ret = do_sendfile(out_fd, in_fd, &pos, count, 0); 859 if (unlikely(put_user(pos, offset))) 860 return -EFAULT; 861 return ret; 862 } 863 864 return do_sendfile(out_fd, in_fd, NULL, count, 0); 865} | 851{ 852 loff_t pos; 853 ssize_t ret; 854 855 if (offset) { 856 if (unlikely(copy_from_user(&pos, offset, sizeof(loff_t)))) 857 return -EFAULT; 858 ret = do_sendfile(out_fd, in_fd, &pos, count, 0); 859 if (unlikely(put_user(pos, offset))) 860 return -EFAULT; 861 return ret; 862 } 863 864 return do_sendfile(out_fd, in_fd, NULL, count, 0); 865} |