[Top] [Prev] [Next]

read

read, write - transfer data from and to a file

Synopsis

Tread  tag [2] fid [2] offset [8] count [2]
Rread  tag [2] fid [2] count  [2] pad   [1] data [count]
Twrite tag [2] fid [2] offset [8] count [2] pad [1] data [count]
Rwrite tag [2] fid [2] count  [2]

Description

The read Transaction

The read request asks for count bytes of data from the file identified by fid starting offset bytes after the beginning of the file. The fid which must have been previously opened for reading. The count field must be less than or equal to MAXFDATA (8192, defined in <styx.h>). The bytes are returned with the read reply message.

The count field in the reply indicates the number of bytes returned. This may be less than the requested amount. If the offset field is greater than the number of bytes in the file, a count of zero will be returned.

For directories, read returns an integral number of directory entries exactly as in stat (see stat). one for each member of the directory. The read request message must have offset and count zero modulo DIRLEN (116, defined in <lib9.h>).

The write Transaction

The write request asks that count bytes of data be recorded in the file identified by fid starting offset bytes after the beginning of the file. The fid must have been previously opened for writing.

Directories may not be written by this mechanism. Directories are modified by create and remove requests. See open for a description of the create request and remove.

The write reply reports the number of bytes actually written. It is usually an error if this is not the same as requested.

Entry Points

The read and write messages are generated by the corresponding calls (see read). Because of the MAXFDATA limit, more than one message may be produced by a single call.

See Also

read and stat



[Top] [Prev] [Next]

infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights reserved.