COMPAT_SYSCALL_DEFINE3(writev, unsigned long, fd, const struct compat_iovec __user *, vec, unsigned long, vlen) { struct fd f = fdget(fd); ssize_t ret; loff_t pos; if (!f.file) return -EBADF; pos = f.file->f_pos; ret = compat_writev(f.file, vec, vlen, &pos); f.file->f_pos = pos; fdput(f); return ret; }
static size_t do_compat_writev(compat_ulong_t fd, const struct compat_iovec __user* vec, compat_ulong_t vlen, int flags) { struct fd f = fdget_pos(fd); ssize_t ret; loff_t pos; if (!f.file) return -EBADF; pos = f.file->f_pos; ret = compat_writev(f.file, vec, vlen, &pos, flags); if (ret >= 0) f.file->f_pos = pos; fdput_pos(f); return ret; }
COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd, const struct compat_iovec __user *,vec, unsigned long, vlen, loff_t, pos) { struct fd f; ssize_t ret; if (pos < 0) return -EINVAL; f = fdget(fd); if (!f.file) return -EBADF; ret = -ESPIPE; if (f.file->f_mode & FMODE_PWRITE) ret = compat_writev(f.file, vec, vlen, &pos); fdput(f); return ret; }
static long __compat_sys_pwritev64(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen, loff_t pos) { struct fd f; ssize_t ret; if (pos < 0) return -EINVAL; f = fdget(fd); if (!f.file) return -EBADF; ret = -ESPIPE; if (f.file->f_mode & FMODE_PWRITE) ret = compat_writev(f.file, vec, vlen, &pos); fdput(f); return ret; }