summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-07-07 18:17:55 +0000
committerjhb <jhb@FreeBSD.org>2005-07-07 18:17:55 +0000
commitcf15cbb1b695b3bfb61d396be49bbf6ea3e889c1 (patch)
treec30d76b42af5454db3e0f1a3a40342b16e62fe4e /sys/compat
parent909e7ff886fb519c878c02fa47955048637cc7e7 (diff)
downloadFreeBSD-src-cf15cbb1b695b3bfb61d396be49bbf6ea3e889c1.zip
FreeBSD-src-cf15cbb1b695b3bfb61d396be49bbf6ea3e889c1.tar.gz
- Add two new system calls: preadv() and pwritev() which are like readv()
and writev() except that they take an additional offset argument and do not change the current file position. In SAT speak: preadv:readv::pread:read and pwritev:writev::pwrite:write. - Try to reduce code duplication some by merging most of the old kern_foov() and dofilefoo() functions into new dofilefoo() functions that are called by kern_foov() and kern_pfoov(). The non-v functions now all generate a simple uio on the stack from the passed in arguments and then call kern_foov(). For example, read() now just builds a uio and calls kern_readv() and pwrite() just builds a uio and calls kern_pwritev(). PR: kern/80362 Submitted by: Marc Olzheim marcolz at stack dot nl (1) Approved by: re (scottl) MFC after: 1 week
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c28
-rw-r--r--sys/compat/freebsd32/syscalls.master11
2 files changed, 37 insertions, 2 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index d21ced6..de4881e 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -764,6 +764,34 @@ freebsd32_writev(struct thread *td, struct freebsd32_writev_args *uap)
}
int
+freebsd32_preadv(struct thread *td, struct freebsd32_preadv_args *uap)
+{
+ struct uio *auio;
+ int error;
+
+ error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+ if (error)
+ return (error);
+ error = kern_preadv(td, uap->fd, auio, uap->offset);
+ free(auio, M_IOV);
+ return (error);
+}
+
+int
+freebsd32_pwritev(struct thread *td, struct freebsd32_pwritev_args *uap)
+{
+ struct uio *auio;
+ int error;
+
+ error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+ if (error)
+ return (error);
+ error = kern_pwritev(td, uap->fd, auio, uap->offset);
+ free(auio, M_IOV);
+ return (error);
+}
+
+int
freebsd32_settimeofday(struct thread *td,
struct freebsd32_settimeofday_args *uap)
{
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index c7fa7af..d861445 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -482,8 +482,15 @@
286 AUE_NULL UNIMPL nosys
287 AUE_NULL UNIMPL nosys
288 AUE_NULL UNIMPL nosys
-289 AUE_NULL UNIMPL nosys
-290 AUE_NULL UNIMPL nosys
+; 289 and 290 from NetBSD (OpenBSD: 267 and 268)
+289 AUE_NULL MSTD { ssize_t freebsd32_preadv(int fd, \
+ struct iovec32 *iovp, \
+ u_int iovcnt, off_t offset); }
+; XXX note - bigendian is different
+290 AUE_NULL MSTD { ssize_t freebsd32_pwritev(int fd, \
+ struct iovec32 *iovp, \
+ u_int iovcnt, off_t offset); }
+; XXX note - bigendian is different
291 AUE_NULL UNIMPL nosys
292 AUE_NULL UNIMPL nosys
293 AUE_NULL UNIMPL nosys
OpenPOWER on IntegriCloud