xref: /freebsd/share/man/man9/VOP_RDWR.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1fab63cc4SDoug Rabson.\" -*- nroff -*-
2fab63cc4SDoug Rabson.\"
3fab63cc4SDoug Rabson.\" Copyright (c) 1996 Doug Rabson
4fab63cc4SDoug Rabson.\"
5fab63cc4SDoug Rabson.\" All rights reserved.
6fab63cc4SDoug Rabson.\"
7fab63cc4SDoug Rabson.\" This program is free software.
8fab63cc4SDoug Rabson.\"
9fab63cc4SDoug Rabson.\" Redistribution and use in source and binary forms, with or without
10fab63cc4SDoug Rabson.\" modification, are permitted provided that the following conditions
11fab63cc4SDoug Rabson.\" are met:
12fab63cc4SDoug Rabson.\" 1. Redistributions of source code must retain the above copyright
13fab63cc4SDoug Rabson.\"    notice, this list of conditions and the following disclaimer.
14fab63cc4SDoug Rabson.\" 2. Redistributions in binary form must reproduce the above copyright
15fab63cc4SDoug Rabson.\"    notice, this list of conditions and the following disclaimer in the
16fab63cc4SDoug Rabson.\"    documentation and/or other materials provided with the distribution.
17fab63cc4SDoug Rabson.\"
18fab63cc4SDoug Rabson.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
19fab63cc4SDoug Rabson.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20fab63cc4SDoug Rabson.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21fab63cc4SDoug Rabson.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22fab63cc4SDoug Rabson.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23fab63cc4SDoug Rabson.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24fab63cc4SDoug Rabson.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25fab63cc4SDoug Rabson.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26fab63cc4SDoug Rabson.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27fab63cc4SDoug Rabson.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28fab63cc4SDoug Rabson.\"
29fab63cc4SDoug Rabson.Dd July 24, 1996
30fab63cc4SDoug Rabson.Dt VOP_RDWR 9
31aa12cea2SUlrich Spörlein.Os
32fab63cc4SDoug Rabson.Sh NAME
33fab63cc4SDoug Rabson.Nm VOP_READ ,
34fab63cc4SDoug Rabson.Nm VOP_WRITE
35fab63cc4SDoug Rabson.Nd read or write a file
36fab63cc4SDoug Rabson.Sh SYNOPSIS
3732eef9aeSRuslan Ermilov.In sys/param.h
3832eef9aeSRuslan Ermilov.In sys/vnode.h
3932eef9aeSRuslan Ermilov.In sys/uio.h
40fab63cc4SDoug Rabson.Ft int
41fab63cc4SDoug Rabson.Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred"
42fab63cc4SDoug Rabson.Ft int
43fab63cc4SDoug Rabson.Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred"
44fab63cc4SDoug Rabson.Sh DESCRIPTION
452bbc7e74SMateusz PiotrowskiThese entry points read or write the contents of a file.
46fab63cc4SDoug Rabson.Pp
47fab63cc4SDoug RabsonThe arguments are:
48fab63cc4SDoug Rabson.Bl -tag -width ioflag
490640e9e0SHiten Pandya.It Fa vp
500a57ea7dSRuslan ErmilovThe vnode of the file.
510640e9e0SHiten Pandya.It Fa uio
520a57ea7dSRuslan ErmilovThe location of the data to be read or written.
530640e9e0SHiten Pandya.It Fa ioflag
540a57ea7dSRuslan ErmilovVarious flags.
550640e9e0SHiten Pandya.It Fa cnp
560a57ea7dSRuslan ErmilovThe credentials of the caller.
57fab63cc4SDoug Rabson.El
58fab63cc4SDoug Rabson.Pp
59fab63cc4SDoug RabsonThe
60fab63cc4SDoug Rabson.Fa ioflag
611e12157cSAlfred Perlsteinargument is used to give directives and hints to the file system.
621e12157cSAlfred PerlsteinWhen attempting a read, the high 16 bits are used to provide a
631e12157cSAlfred Perlsteinread-ahead hint (in units of file system blocks) that the file system
64c1c03d49SHiten Pandyashould attempt.
65c1c03d49SHiten PandyaThe low 16 bits are a bit mask which can contain
661e12157cSAlfred Perlsteinthe following flags:
672bbc7e74SMateusz Piotrowski.Bl -tag -width "IO_NODELOCKED"
68fab63cc4SDoug Rabson.It Dv IO_UNIT
690a57ea7dSRuslan ErmilovDo I/O as atomic unit.
70fab63cc4SDoug Rabson.It Dv IO_APPEND
710a57ea7dSRuslan ErmilovAppend write to end.
72fab63cc4SDoug Rabson.It Dv IO_SYNC
730a57ea7dSRuslan ErmilovDo I/O synchronously.
74fab63cc4SDoug Rabson.It Dv IO_NODELOCKED
750a57ea7dSRuslan ErmilovUnderlying node already locked.
76fab63cc4SDoug Rabson.It Dv IO_NDELAY
77fab63cc4SDoug Rabson.Dv FNDELAY
780a57ea7dSRuslan Ermilovflag set in file table.
79fab63cc4SDoug Rabson.It Dv IO_VMIO
800a57ea7dSRuslan ErmilovData already in VMIO space.
81fab63cc4SDoug Rabson.El
82fab63cc4SDoug Rabson.Sh LOCKS
83fab63cc4SDoug RabsonThe file should be locked on entry and will still be locked on exit.
84*55eb51abSKonstantin BelousovRangelock covering the whole i/o range should be owned around the call.
85fab63cc4SDoug Rabson.Sh RETURN VALUES
86fab63cc4SDoug RabsonZero is returned on success, otherwise an error code is returned.
87fab63cc4SDoug Rabson.Sh ERRORS
88eaa8b244SMike Pritchard.Bl -tag -width Er
890734b428SRobert Watson.It Bq Er EFBIG
900734b428SRobert WatsonAn attempt was made to write a file that exceeds the process's file size
910734b428SRobert Watsonlimit or the maximum file size.
92fab63cc4SDoug Rabson.It Bq Er ENOSPC
93fab63cc4SDoug RabsonThe file system is full.
940734b428SRobert Watson.It Bq Er EPERM
950734b428SRobert WatsonAn append-only flag is set on the file, but the caller is attempting to
960734b428SRobert Watsonwrite before the current end of file.
97fab63cc4SDoug Rabson.El
98fab63cc4SDoug Rabson.Sh SEE ALSO
99bceb8aedSWolfram Schneider.Xr uiomove 9 ,
100bceb8aedSWolfram Schneider.Xr vnode 9
101fab63cc4SDoug Rabson.Sh AUTHORS
102571dba6eSHiten PandyaThis manual page was written by
103aaf1f16eSPhilippe Charnier.An Doug Rabson .
104