aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_file.c
diff options
context:
space:
mode:
authorMahdi Mokhtari <mmokhi@FreeBSD.org>2017-02-24 19:22:17 +0000
committerMahdi Mokhtari <mmokhi@FreeBSD.org>2017-02-24 19:22:17 +0000
commit21d23e32493a253f101713b6fcde5aaa41cf57e8 (patch)
tree284a2e41199fbc9bd7981d52b64b6137aeb37e87 /sys/compat/linux/linux_file.c
parenta81ce6e9d52585a5e891bb4832a8532097659b04 (diff)
downloadsrc-21d23e32493a253f101713b6fcde5aaa41cf57e8.tar.gz
src-21d23e32493a253f101713b6fcde5aaa41cf57e8.zip
Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.
Reviewed by: dchagin Approved by: dchagin, trasz (src committers) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9722
Notes
Notes: svn path=/head/; revision=314217
Diffstat (limited to 'sys/compat/linux/linux_file.c')
-rw-r--r--sys/compat/linux/linux_file.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index a7695f010cee..4a430676899b 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1027,6 +1027,52 @@ linux_pwrite(struct thread *td, struct linux_pwrite_args *uap)
return (kern_pwrite(td, uap->fd, uap->buf, uap->nbyte, uap->offset));
}
+#if !(defined(__amd64__) && defined(COMPAT_LINUX32))
+int
+linux_preadv(struct thread *td, struct linux_preadv_args *uap)
+{
+ struct uio *auio;
+ int error;
+ off_t offset;
+
+ error = copyinuio(uap->vec, uap->vlen, &auio);
+ if (error)
+ return (error);
+ /*
+ * According http://man7.org/linux/man-pages/man2/preadv.2.html#NOTES
+ * pos_l and pos_h, respectively, contain the
+ * low order and high order 32 bits of offset.
+ */
+ offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) <<
+ (sizeof(offset) * 4)) | uap->pos_l;
+ error = kern_preadv(td, uap->fd, auio, offset);
+ free(auio, M_IOV);
+ return (error);
+}
+
+int
+linux_pwritev(struct thread *td, struct linux_pwritev_args *uap)
+{
+ struct uio *auio;
+ int error;
+ off_t offset;
+
+ error = copyinuio(uap->vec, uap->vlen, &auio);
+ if (error)
+ return (error);
+ /*
+ * According http://man7.org/linux/man-pages/man2/pwritev.2.html#NOTES
+ * pos_l and pos_h, respectively, contain the
+ * low order and high order 32 bits of offset.
+ */
+ offset = (((off_t)uap->pos_h << (sizeof(offset) * 4)) <<
+ (sizeof(offset) * 4)) | uap->pos_l;
+ error = kern_pwritev(td, uap->fd, auio, offset);
+ free(auio, M_IOV);
+ return (error);
+}
+#endif /* !(__amd64__ && COMPAT_LINUX32) */
+
int
linux_mount(struct thread *td, struct linux_mount_args *args)
{