DragonFly BSD
DragonFly kernel List (threaded) for 2003-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

iovec_copyin() helper function


From: "David P. Reese, Jr." <daver@xxxxxxxxxxxx>
Date: 07 Oct 2003 00:43:41 GMT

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@xxxxxxxxxxxx
                                               http://www.gomerbud.com/daver/



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]