iovec_copyin() helper function
David P. Reese, Jr.
daver at gomerbud.com
Mon Oct 6 17:43:41 PDT 2003
I'd like to create an iovec_copyin() function to cut the length of the
socket syscall code. This could be used in the emulation code and
other syscall code (eg. writev(), readv()).
int iovec_copyin(struct iovec *uiov, struct iovec **kiov, struct iovec *siov,
size_t iov_cnt, size_t *iov_len);
Where:
o uiov is a pointer to the userspace iovec structure.
o kiov returns a pointer to the populated kernel space iovec structure.
o siov is a pointer to a kernel space iovec structure of length
UIO_SMALLIOV.
o iov_cnt is the length of the desired iovec structure array.
o iov_len is a pointer used to return the lenght of the data in bytes,
useful for populating the uio_resid field in uio structures.
In the parent function, one must remember to check the address of kiov
against siov and FREE(kiov, M_IOV) if they differ.
Would something like this belong in kern/kern_subr.c with the uio*()
functions?
--
David P. Reese, Jr. daver at xxxxxxxxxxxx
http://www.gomerbud.com/daver/
More information about the Kernel
mailing list