xref: /haiku/headers/posix/sys/uio.h (revision 51978af14a173e7fae0563b562be5603bc652aeb)
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 enum    uio_rw { UIO_READ, UIO_WRITE };
15 
16 /* Segment flag values. */
17 enum uio_seg {
18 	UIO_USERSPACE,		/* from user data space */
19 	UIO_SYSSPACE		/* from system space */
20 };
21 
22 struct uio {
23 	struct  iovec *uio_iov;		/* pointer to array of iovecs */
24 	int     uio_iovcnt;			/* number of iovecs in array */
25 	off_t   uio_offset;			/* offset into file this uio corresponds to */
26 	size_t  uio_resid;			/* residual i/o count */
27 	enum    uio_seg uio_segflg;	/* see above */
28 	enum    uio_rw uio_rw;		/* see above */
29 //	struct  proc *uio_procp;	/* process if UIO_USERSPACE */
30 };
31 
32 int uiomove(char *cp, int n, struct uio *uio);
33 
34 ssize_t readv(int fd, const struct iovec *vector, size_t count);
35 ssize_t readv_pos(int fd, off_t pos, const struct iovec *vec, size_t count);
36 ssize_t writev(int fd, const struct iovec *vector, size_t count);
37 ssize_t writev_pos(int fd, off_t pos, const struct iovec *vec, size_t count);
38 
39 #endif /* _SYS_UIO_H */
40