00001 /*- 00002 * Copyright (c) 1982, 1986, 1993, 1994 00003 * The Regents of the University of California. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 4. Neither the name of the University nor the names of its contributors 00014 * may be used to endorse or promote products derived from this software 00015 * without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00018 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00021 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00023 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00024 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00025 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00026 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00027 * SUCH DAMAGE. 00028 * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved. 00029 * @(#)uio.h 8.5 (Berkeley) 2/22/94 00030 * $FreeBSD: src/sys/sys/uio.h,v 1.39 2005/07/07 18:17:55 jhb Exp $ 00031 */ 00032 00033 #ifndef _SYS_UIO_H_ 00034 #define _SYS_UIO_H_ 00035 00036 #include <sys/cdefs.h> 00037 #include <sys/_types.h> 00038 #include <sys/_iovec.h> 00039 00040 #ifndef _SSIZE_T_DECLARED 00041 typedef __ssize_t ssize_t; 00042 #define _SSIZE_T_DECLARED 00043 #endif 00044 00045 #ifndef _OFF_T_DECLARED 00046 typedef __off_t off_t; 00047 #define _OFF_T_DECLARED 00048 #endif 00049 00050 #if __BSD_VISIBLE 00051 enum uio_rw { UIO_READ, UIO_WRITE }; 00052 00053 /* Segment flag values. */ 00054 enum uio_seg { 00055 UIO_USERSPACE, /* from user data space */ 00056 UIO_SYSSPACE, /* from system space */ 00057 UIO_NOCOPY /* don't copy, already in object */ 00058 }; 00059 #endif 00060 00061 #ifdef _KERNEL 00062 00063 struct uio { 00064 struct iovec *uio_iov; 00065 int uio_iovcnt; 00066 off_t uio_offset; 00067 int uio_resid; 00068 enum uio_seg uio_segflg; 00069 enum uio_rw uio_rw; 00070 struct thread *uio_td; 00071 }; 00072 00073 /* 00074 * Limits 00075 * 00076 * N.B.: UIO_MAXIOV must be no less than IOV_MAX from <sys/syslimits.h> 00077 * which in turn must be no less than _XOPEN_IOV_MAX from <limits.h>. If 00078 * we ever make this tunable (probably pointless), then IOV_MAX should be 00079 * removed from <sys/syslimits.h> and applications would be expected to use 00080 * sysconf(3) to find out the correct value, or else assume the worst 00081 * (_XOPEN_IOV_MAX). Perhaps UIO_MAXIOV should be simply defined as 00082 * IOV_MAX. 00083 */ 00084 #define UIO_MAXIOV 1024 /* max 1K of iov's */ 00085 00086 struct vm_object; 00087 struct vm_page; 00088 00089 #else /* !_KERNEL */ 00090 00091 __BEGIN_DECLS 00092 IMPORT_C 00093 ssize_t readv(int, const struct iovec *, int); 00094 IMPORT_C 00095 ssize_t writev(int, const struct iovec *, int); 00096 __END_DECLS 00097 00098 #endif /* _KERNEL */ 00099 00100 #endif /* !_SYS_UIO_H_ */