1 .\" $NetBSD: dofileread.9,v 1.7 2008/04/30 13:10:58 martin Exp $
3 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Gregory McGarry.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
38 .Nd high-level file operations
42 .Fn dofileread "struct lwp *l" "int fd" "struct file *fp" "void *buf" \
43 "size_t nbyte" "off_t *offset" "int flags" "register_t *retval"
45 .Fn dofilewrite "struct lwp *l" "int fd" "struct file *fp" \
46 "const void *buf" "size_t nbyte" "off_t *offset" "int flags" \
49 .Fn dofilereadv "struct lwp *l" "int fd" "struct file *fp" \
50 "const struct iovec *iovp" "int iovcnt" "off_t *offset" "int flags" \
53 .Fn dofilewritev "struct lwp *l" "int fd" "struct file *fp" \
54 "const struct iovec *iovp" "int iovcnt" "off_t *offset" "int flags" \
57 The functions implement the underlying functionality of the
64 They are also used throughout the kernel as high-level access routines
69 function attempts to read
71 of data from the object referenced by file entry
73 into the buffer pointed to by
77 function attempts to write
79 of data to the object referenced by file entry
81 from the buffer pointed to by
88 functions perform the same operations, but scatter the data with the
90 buffers specified by the members of the
94 The offset of the file operations is explicitly specified by
96 The new file offset after the file operation is returned in
98 If the FOF_UPDATE_OFFSET flag is specified in the
100 argument, the file offset in the file entry
102 is updated to reflect the new file offset, otherwise it remains
103 unchanged after the operation.
107 is largely unused except for use by the ktrace framework for reporting
108 to userlevel the process's file descriptor.
110 Upon successful completion the number of bytes which were transferred
114 Upon successful completion zero is returned, otherwise an appropriate
117 This section describes places within the
119 source tree where actual code implementing or using these file
120 operations can be found.
121 All pathnames are relative to
124 The framework for these file operations is implemented within the file
125 .Pa sys/kern/sys_generic.c .