Page MenuHomeFreeBSD

D60025.1796615588.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D60025.1796615588.diff

diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c
--- a/sys/kern/subr_uio.c
+++ b/sys/kern/subr_uio.c
@@ -468,6 +468,24 @@
return (0);
}
+/*
+ * Update the lengths of a userspace iovec to match those in a struct uio's
+ * iovec (previously created by copyinuio).
+ */
+int
+updateiov(const struct uio *uiop, void *uiovp)
+{
+ int i, error;
+ struct iovec *iovp = uiovp;
+
+ for (i = 0; i < uiop->uio_iovcnt; i++) {
+ error = suword(&iovp[i].iov_len, uiop->uio_iov[i].iov_len);
+ if (error != 0)
+ return (EFAULT);
+ }
+ return (0);
+}
+
struct uio *
allocuio(u_int iovcnt)
{
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -96,6 +96,13 @@
typedef int (copyinuio_t)(const void *iovp, unsigned int iovcnt,
struct uio **iov);
+/*
+ * A updateiov_t takes a pointer to a struct uio previously created with
+ * copyinuio_t and a pointer to the corresponding iovec in userspace.
+ * It updates all lengths in userspace to match those in the uio.
+ */
+typedef int(updateiov_t)(const struct uio *uiop, void *iovp);
+
uint64_t at2cnpflags(u_int at_flags, u_int mask);
int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg,
size_t buflen, size_t path_max);
diff --git a/sys/sys/uio.h b/sys/sys/uio.h
--- a/sys/sys/uio.h
+++ b/sys/sys/uio.h
@@ -99,6 +99,7 @@
int uiomove_nofault(void *cp, int n, struct uio *uio);
int uiomove_object(struct vm_object *obj, off_t obj_size, struct uio *uio);
int uiomove_step(void *cp, void *base, size_t cnt, struct uio *uio);
+int updateiov(const struct uio *uiop, void *iovp);
#else /* !_KERNEL */

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 7, 3:53 AM (13 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42270840
Default Alt Text
D60025.1796615588.diff (1 KB)

Event Timeline