96 lines
4.6 KiB
HTML
96 lines
4.6 KiB
HTML
<head>
|
|
<title>read(9P) - Plan 9 from User Space</title>
|
|
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
|
</head>
|
|
<body bgcolor=#ffffff>
|
|
<table border=0 cellpadding=0 cellspacing=0 width=100%>
|
|
<tr height=10><td>
|
|
<tr><td width=20><td>
|
|
<tr><td width=20><td><b>READ(9P)</b><td align=right><b>READ(9P)</b>
|
|
<tr><td width=20><td colspan=2>
|
|
<br>
|
|
<p><font size=+1><b>NAME </b></font><br>
|
|
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
|
|
|
read, write – transfer data from and to a file<br>
|
|
|
|
</table>
|
|
<p><font size=+1><b>SYNOPSIS </b></font><br>
|
|
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
|
|
|
<i>size</i>[4] <tt><font size=+1>Tread</font></tt> <i>tag</i>[2] <i>fid</i>[4] <i>offset</i>[8] <i>count</i>[4]<br>
|
|
<i>size</i>[4] <tt><font size=+1>Rread</font></tt> <i>tag</i>[2] <i>count</i>[4] <i>data</i>[<i>count</i>]
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
|
|
|
<i>size</i>[4] <tt><font size=+1>Twrite</font></tt> <i>tag</i>[2] <i>fid</i>[4] <i>offset</i>[8] <i>count</i>[4] <i>data</i>[<i>count</i>]<br>
|
|
<i>size</i>[4] <tt><font size=+1>Rwrite</font></tt> <i>tag</i>[2] <i>count</i>[4]<br>
|
|
|
|
</table>
|
|
<p><font size=+1><b>DESCRIPTION </b></font><br>
|
|
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
|
|
|
The <tt><font size=+1>read</font></tt> request asks for <i>count</i> bytes of data from the file identified
|
|
by <i>fid</i>, which must be opened for reading, starting <i>offset</i> bytes
|
|
after the beginning of the file. The bytes are returned with the
|
|
<tt><font size=+1>read</font></tt> reply message.
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
|
|
|
The <i>count</i> field in the reply indicates the number of bytes returned.
|
|
This may be less than the requested amount. If the <i>offset</i> field
|
|
is greater than or equal to the number of bytes in the file, a
|
|
count of zero will be returned.
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
|
|
|
For directories, <tt><font size=+1>read</font></tt> returns an integral number of directory
|
|
entries exactly as in <tt><font size=+1>stat</font></tt> (see <i>stat</i>(9P)), one for each member
|
|
of the directory. The <tt><font size=+1>read</font></tt> request message must have <tt><font size=+1>offset</font></tt> equal
|
|
to zero or the value of <tt><font size=+1>offset</font></tt> in the previous <tt><font size=+1>read</font></tt> on the directory,
|
|
plus the number of bytes returned in the previous
|
|
<tt><font size=+1>read</font></tt>. In other words, seeking other than to the beginning is illegal
|
|
in a directory.
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
|
|
|
The <tt><font size=+1>write</font></tt> request asks that <i>count</i> bytes of data be recorded in
|
|
the file identified by <i>fid</i>, which must be opened for writing,
|
|
starting <i>offset</i> bytes 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 <i>offset</i>. Directories may not be written.
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
|
|
|
The <tt><font size=+1>write</font></tt> reply records the number of bytes actually written.
|
|
It is usually an error if this is not the same as requested.
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
|
|
|
Because 9P implementations may limit the size of individual messages,
|
|
more than one message may be produced by a single <i>read</i> or <i>write</i>
|
|
call. The <i>iounit</i> field returned by <i>open</i>(9P), if non-zero, reports
|
|
the maximum size that is guaranteed to be transferred atomically.<br>
|
|
|
|
</table>
|
|
<p><font size=+1><b>ENTRY POINTS </b></font><br>
|
|
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
|
|
|
<i>Fsread</i> and <i>fswrite</i> (see <a href="../man3/9pclient.html"><i>9pclient</i>(3)</a>) generate the corresponding
|
|
messages. Because they take an offset parameter, the <i>fspread</i> and
|
|
<i>fspwrite</i> calls correspond more directly to the 9P messages. Although
|
|
<i>fsseek</i> affects the offset, it does not generate a message.<br>
|
|
|
|
</table>
|
|
|
|
<td width=20>
|
|
<tr height=20><td>
|
|
</table>
|
|
<!-- TRAILER -->
|
|
<table border=0 cellpadding=0 cellspacing=0 width=100%>
|
|
<tr height=15><td width=10><td><td width=10>
|
|
<tr><td><td>
|
|
<center>
|
|
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
|
|
</center>
|
|
</table>
|
|
<!-- TRAILER -->
|
|
</body></html>
|