Charles.Forsyth20060303-partialeea662d19 years agoHistory
124 lines · 2.3 KB · Text
RawDownload
.TH READ 5 .SH NAMEread, write \- transfer data from and to a file.SH SYNOPSIS.ta \w'\fLTwrite 'u.IR size [4].B Tread.IR tag [2].IR fid [4].IR offset [8].IR count [4].br.IR size [4].B Rread.IR tag [2].IR count [4].IR data [ count ].PP.IR size [4].B Twrite.IR tag [2].IR fid [4].IR offset [8].IR count [4].IR data [ count ].br.IR size [4].B Rwrite.IR tag [2].IR count [4].SH DESCRIPTIONThe.B readrequestasks for.I countbytes of datafrom the file identified by .IR fid ,which must be opened for reading,starting .I offsetbytes after the beginning of the file.The bytes are returned with the.B readreply message..PPThe.I countfield in the reply indicates the number of bytes returned.This may be less than the requested amount.If the.I offsetfield is greater than or equal to the number of bytes in the file,a count of zero will be returned..PPFor directories,.B readreturns an integral number ofdirectory entries exactly as in.B stat(see.IR stat (5)),one for each member of the directory.The.B readrequest message must have.B offsetequal to zero or the value of.B offsetin the previous.B readon the directory, plus the number of bytesreturned in the previous.BR read .In other words, seeking other than to the beginningis illegal in a directory (see.IR seek (2))..PPThe.B writerequest asks that.I countbytes of data be recorded in the file identified by.IR fid ,which must be opened for writing, starting.I offsetbytes after the beginning of the file.If the file is append-only,the data will be placed at the end of the file regardless of.IR offset .Directories may not be written..PPThe .B writereply records the number of bytes actually written.It is usually an errorif this is not the same as requested..PPBecause Styx implementations may limit the size of individualmessages,more than one message may be produced by a single.I reador.I writecall.The.I iounitfield returned by.IR open (5),if non-zero, reports the maximum size that is guaranteedto be transferred atomically..SH ENTRY POINTS.B Readand.B writemessages are generated by the corresponding calls in.IR sys-read (2).Although.IR sys-seek (2)affects the offset, it does not generate a message..SH SEE ALSO.IR sys-read (2),.IR stat (5)