.TH READ 5 .SH NAME read, write \- transfer data from and to a file .SH SYNOPSIS .ta \w'\fLTwrite 'u .B Tread .IR tag [2] .IR fid [2] .IR offset [8] .IR count [2] .br .B Rread .IR tag [2] .IR fid [2] .IR count [2] .IR pad [1] .IR data [ count ] .PP .B Twrite .IR tag [2] .IR fid [2] .IR offset [8] .IR count [2] .IR pad [1] .IR data [ count ] .br .B Rwrite .IR tag [2] .IR fid [2] .IR count [2] .SH DESCRIPTION The .B read request asks for .I count bytes of data from the file identified by .IR fid , which must be opened for reading, starting .I offset bytes after the beginning of the file. .I Count must be less than or equal to .B MAXFDATA (8192, defined in .BR ). The bytes are returned with the .B read reply message. .PP The .I count field in the reply indicates the number of bytes returned. This may be less than the requested amount. If the .I offset field is greater than the number of bytes in the file, a count of zero will be returned. For directories, .B read returns an integral number of directory entries exactly as in .B stat (see .IR stat (5)), one for each member of the directory. The read request message must have .B offset and .B count zero modulo .BR DIRLEN . .PP The .B write request asks that .I count bytes of data be recorded in the file identified by .IR fid , which must be opened for writing, starting .I offset bytes after the beginning of the file. If the file has been opened append only, the data will be placed at the end of the file regardless of .IR offset . Directories may not be written. .PP The .B write reply records the number of bytes actually written. It is usually an error if this is not the same as requested. .SH ENTRY POINTS .B Read and .B write messages are generated by the corresponding calls. Because of the .B MAXFDATA limit, more than one message may be produced by a single call.