]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /* $NetBSD: uio.h,v 1.34 2006/03/01 12:38:32 yamt Exp $ */\r |
2 | \r | |
3 | /*\r | |
4 | * Copyright (c) 1982, 1986, 1993, 1994\r | |
5 | * The Regents of the University of California. All rights reserved.\r | |
6 | *\r | |
7 | * Redistribution and use in source and binary forms, with or without\r | |
8 | * modification, are permitted provided that the following conditions\r | |
9 | * are met:\r | |
10 | * 1. Redistributions of source code must retain the above copyright\r | |
11 | * notice, this list of conditions and the following disclaimer.\r | |
12 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
13 | * notice, this list of conditions and the following disclaimer in the\r | |
14 | * documentation and/or other materials provided with the distribution.\r | |
15 | * 3. Neither the name of the University nor the names of its contributors\r | |
16 | * may be used to endorse or promote products derived from this software\r | |
17 | * without specific prior written permission.\r | |
18 | *\r | |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r | |
29 | * SUCH DAMAGE.\r | |
30 | *\r | |
31 | * @(#)uio.h 8.5 (Berkeley) 2/22/94\r | |
32 | */\r | |
33 | \r | |
34 | #ifndef _SYS_UIO_H_\r | |
35 | #define _SYS_UIO_H_\r | |
36 | \r | |
37 | #ifdef _KERNEL\r | |
38 | #ifndef __UIO_EXPOSE\r | |
39 | #define __UIO_EXPOSE\r | |
40 | #endif\r | |
41 | #endif\r | |
42 | \r | |
43 | #include <machine/ansi.h>\r | |
44 | #include <sys/featuretest.h>\r | |
45 | \r | |
53e1e5c6 | 46 | #ifdef _EFI_SIZE_T_\r |
47 | typedef _EFI_SIZE_T_ size_t;\r | |
48 | #undef _EFI_SIZE_T_\r | |
2aa62f2b | 49 | #undef _BSD_SIZE_T_\r |
50 | #endif\r | |
51 | \r | |
52 | #ifdef _BSD_SSIZE_T_\r | |
53 | typedef _BSD_SSIZE_T_ ssize_t;\r | |
54 | #undef _BSD_SSIZE_T_\r | |
55 | #endif\r | |
56 | \r | |
57 | struct iovec {\r | |
58 | void *iov_base; /* Base address. */\r | |
59 | size_t iov_len; /* Length. */\r | |
60 | };\r | |
61 | \r | |
62 | #if defined(_NETBSD_SOURCE)\r | |
63 | #include <sys/ansi.h>\r | |
64 | \r | |
65 | #ifndef off_t\r | |
66 | typedef __off_t off_t; /* file offset */\r | |
67 | #define off_t __off_t\r | |
68 | #endif\r | |
69 | \r | |
70 | enum uio_rw { UIO_READ, UIO_WRITE };\r | |
71 | \r | |
72 | /* Segment flag values. */\r | |
73 | enum uio_seg {\r | |
74 | UIO_USERSPACE, /* from user data space */\r | |
75 | UIO_SYSSPACE /* from system space */\r | |
76 | };\r | |
77 | \r | |
78 | #ifdef __UIO_EXPOSE\r | |
79 | \r | |
80 | struct uio {\r | |
81 | struct iovec *uio_iov; /* pointer to array of iovecs */\r | |
82 | int uio_iovcnt; /* number of iovecs in array */\r | |
83 | off_t uio_offset; /* offset into file this uio corresponds to */\r | |
84 | size_t uio_resid; /* residual i/o count */\r | |
85 | enum uio_rw uio_rw; /* see above */\r | |
86 | struct vmspace *uio_vmspace;\r | |
87 | };\r | |
88 | #define UIO_SETUP_SYSSPACE(uio) uio_setup_sysspace(uio)\r | |
89 | \r | |
90 | #endif /* __UIO_EXPOSE */\r | |
91 | \r | |
92 | /*\r | |
93 | * Limits\r | |
94 | */\r | |
95 | /* Deprecated: use IOV_MAX from <limits.h> instead. */\r | |
96 | #define UIO_MAXIOV 1024 /* max 1K of iov's */\r | |
97 | #endif /* _NETBSD_SOURCE */\r | |
98 | \r | |
99 | #ifdef _KERNEL\r | |
100 | #include <sys/mallocvar.h>\r | |
101 | \r | |
102 | MALLOC_DECLARE(M_IOV);\r | |
103 | \r | |
104 | #define UIO_SMALLIOV 8 /* 8 on stack, else malloc */\r | |
105 | \r | |
106 | void uio_setup_sysspace(struct uio *);\r | |
107 | #endif\r | |
108 | \r | |
109 | #ifndef _KERNEL\r | |
110 | #include <sys/EfiCdefs.h>\r | |
111 | \r | |
112 | __BEGIN_DECLS\r | |
113 | #if defined(_NETBSD_SOURCE)\r | |
114 | ssize_t preadv(int, const struct iovec *, int, off_t);\r | |
115 | ssize_t pwritev(int, const struct iovec *, int, off_t);\r | |
116 | #endif /* _NETBSD_SOURCE */\r | |
117 | ssize_t readv(int, const struct iovec *, int);\r | |
118 | ssize_t writev(int, const struct iovec *, int);\r | |
119 | __END_DECLS\r | |
120 | #else\r | |
121 | int ureadc(int, struct uio *);\r | |
122 | #endif /* !_KERNEL */\r | |
123 | \r | |
124 | #endif /* !_SYS_UIO_H_ */\r |