xref: /freebsd/share/man/man9/VOP_RDWR.9 (revision c6ec7d31830ab1c80edae95ad5e4b9dba10c47ac)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 1996 Doug Rabson
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
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.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $FreeBSD$
30.\"
31.Dd July 24, 1996
32.Dt VOP_RDWR 9
33.Os
34.Sh NAME
35.Nm VOP_READ ,
36.Nm VOP_WRITE
37.Nd read or write a file
38.Sh SYNOPSIS
39.In sys/param.h
40.In sys/vnode.h
41.In sys/uio.h
42.Ft int
43.Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred"
44.Ft int
45.Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred"
46.Sh DESCRIPTION
47These entry points read or write the contents of a file
48.Pp
49The arguments are:
50.Bl -tag -width ioflag
51.It Fa vp
52The vnode of the file.
53.It Fa uio
54The location of the data to be read or written.
55.It Fa ioflag
56Various flags.
57.It Fa cnp
58The credentials of the caller.
59.El
60.Pp
61The
62.Fa ioflag
63argument is used to give directives and hints to the file system.
64When attempting a read, the high 16 bits are used to provide a
65read-ahead hint (in units of file system blocks) that the file system
66should attempt.
67The low 16 bits are a bit mask which can contain
68the following flags:
69.Bl -tag -width ".Dv IO_NODELOCKED"
70.It Dv IO_UNIT
71Do I/O as atomic unit.
72.It Dv IO_APPEND
73Append write to end.
74.It Dv IO_SYNC
75Do I/O synchronously.
76.It Dv IO_NODELOCKED
77Underlying node already locked.
78.It Dv IO_NDELAY
79.Dv FNDELAY
80flag set in file table.
81.It Dv IO_VMIO
82Data already in VMIO space.
83.El
84.Sh LOCKS
85The file should be locked on entry and will still be locked on exit.
86.Sh RETURN VALUES
87Zero is returned on success, otherwise an error code is returned.
88.Sh ERRORS
89.Bl -tag -width Er
90.It Bq Er EFBIG
91An attempt was made to write a file that exceeds the process's file size
92limit or the maximum file size.
93.It Bq Er ENOSPC
94The file system is full.
95.It Bq Er EPERM
96An append-only flag is set on the file, but the caller is attempting to
97write before the current end of file.
98.El
99.Sh SEE ALSO
100.Xr uiomove 9 ,
101.Xr vnode 9
102.Sh AUTHORS
103This manual page was written by
104.An Doug Rabson .
105