read, readn, write, pread, pwrite – read or write file
long read(int fd, void *buf, long nbytes)
long readn(int fd, void *buf, long nbytes)
long write(int fd, void *buf, long nbytes)
long pread(int fd, void *buf, long nbytes, vlong offset)
long pwrite(int fd, void *buf, long nbytes, vlong offset)
bytes of data
from the offset in the file associated with
into memory at
The offset is advanced by the number of bytes read.
It is not guaranteed
bytes will be read; for example
if the file refers to the console, at most one line
will be returned.
In any event the number of bytes read is returned.
A return value of
0 is conventionally interpreted as end of file.
is just like read, but does successive
have been read, or a read system call
returns a non-positive count.
bytes of data starting at
to the file associated with
at the file offset.
The offset is advanced by the number of bytes written.
The number of characters actually written is returned.
It should be regarded as an error
if this is not the same as requested.
are equivalent to a
followed by a
By combining the operations in a single atomic call, they more closely
match the 9P protocol
and, more important,
permit multiprocess programs to execute multiple concurrent
read and write operations on the same file descriptor
These functions set