Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139748
b: refs/heads/master
c: dac1213
h: refs/heads/master
v: v3
  • Loading branch information
Gerd Hoffmann authored and Linus Torvalds committed Apr 3, 2009
1 parent b027741 commit c14b65e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98310e581e098514867573031b2bfa4ba89c0d93
refs/heads/master: dac1213842f5caf081804a11d87d2a39a21d6f55
26 changes: 18 additions & 8 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,29 +1195,39 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
return ret;
}

asmlinkage ssize_t
compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen)
static size_t compat_readv(struct file *file,
const struct compat_iovec __user *vec,
unsigned long vlen, loff_t *pos)
{
struct file *file;
ssize_t ret = -EBADF;

file = fget(fd);
if (!file)
return -EBADF;

if (!(file->f_mode & FMODE_READ))
goto out;

ret = -EINVAL;
if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read))
goto out;

ret = compat_do_readv_writev(READ, file, vec, vlen, &file->f_pos);
ret = compat_do_readv_writev(READ, file, vec, vlen, pos);

out:
if (ret > 0)
add_rchar(current, ret);
inc_syscr(current);
return ret;
}

asmlinkage ssize_t
compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
unsigned long vlen)
{
struct file *file;
ssize_t ret;

file = fget(fd);
if (!file)
return -EBADF;
ret = compat_readv(file, vec, vlen, &file->f_pos);
fput(file);
return ret;
}
Expand Down

0 comments on commit c14b65e

Please sign in to comment.