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.Dd July 24, 1996 30.Dt VOP_RDWR 9 31.Os 32.Sh NAME 33.Nm VOP_READ , 34.Nm VOP_WRITE 35.Nd read or write a file 36.Sh SYNOPSIS 37.In sys/param.h 38.In sys/vnode.h 39.In sys/uio.h 40.Ft int 41.Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" 42.Ft int 43.Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" 44.Sh DESCRIPTION 45These entry points read or write the contents of a file. 46.Pp 47The arguments are: 48.Bl -tag -width ioflag 49.It Fa vp 50The vnode of the file. 51.It Fa uio 52The location of the data to be read or written. 53.It Fa ioflag 54Various flags. 55.It Fa cnp 56The credentials of the caller. 57.El 58.Pp 59The 60.Fa ioflag 61argument is used to give directives and hints to the file system. 62When attempting a read, the high 16 bits are used to provide a 63read-ahead hint (in units of file system blocks) that the file system 64should attempt. 65The low 16 bits are a bit mask which can contain 66the following flags: 67.Bl -tag -width "IO_NODELOCKED" 68.It Dv IO_UNIT 69Do I/O as atomic unit. 70.It Dv IO_APPEND 71Append write to end. 72.It Dv IO_SYNC 73Do I/O synchronously. 74.It Dv IO_NODELOCKED 75Underlying node already locked. 76.It Dv IO_NDELAY 77.Dv FNDELAY 78flag set in file table. 79.It Dv IO_VMIO 80Data already in VMIO space. 81.El 82.Sh LOCKS 83The file should be locked on entry and will still be locked on exit. 84Rangelock covering the whole i/o range should be owned around the call. 85.Sh RETURN VALUES 86Zero is returned on success, otherwise an error code is returned. 87.Sh ERRORS 88.Bl -tag -width Er 89.It Bq Er EFBIG 90An attempt was made to write a file that exceeds the process's file size 91limit or the maximum file size. 92.It Bq Er ENOSPC 93The file system is full. 94.It Bq Er EPERM 95An append-only flag is set on the file, but the caller is attempting to 96write before the current end of file. 97.El 98.Sh SEE ALSO 99.Xr uiomove 9 , 100.Xr vnode 9 101.Sh AUTHORS 102This manual page was written by 103.An Doug Rabson . 104