1 /* uio.h */ 2 3 #ifndef _SYS_UIO_H 4 #define _SYS_UIO_H 5 6 #include <sys/types.h> 7 8 typedef struct iovec { 9 void *iov_base; 10 size_t iov_len; 11 } iovec; 12 13 14 #ifdef _KERNEL_MODE 15 enum uio_rw { UIO_READ, UIO_WRITE }; 16 17 /* Segment flag values. */ 18 enum uio_seg { 19 UIO_USERSPACE, /* from user data space */ 20 UIO_SYSSPACE /* from system space */ 21 }; 22 23 struct uio { 24 struct iovec *uio_iov; /* pointer to array of iovecs */ 25 int uio_iovcnt; /* number of iovecs in array */ 26 off_t uio_offset; /* offset into file this uio corresponds to */ 27 size_t uio_resid; /* residual i/o count */ 28 enum uio_seg uio_segflg; /* see above */ 29 enum uio_rw uio_rw; /* see above */ 30 // struct proc *uio_procp; /* process if UIO_USERSPACE */ 31 }; 32 33 int uiomove(char *cp, int n, struct uio *uio); 34 #endif 35 36 ssize_t readv(int fd, const struct iovec *vector, size_t count); 37 ssize_t readv_pos(int fd, off_t pos, const struct iovec *vec, size_t count); 38 ssize_t writev(int fd, const struct iovec *vector, size_t count); 39 ssize_t writev_pos(int fd, off_t pos, const struct iovec *vec, size_t count); 40 41 #endif /* _SYS_UIO_H */ 42