R_READ(3)

FUNCTION
r_read - Read bytes from a file descriptor.

SYNOPSIS
#include <karma_r.h>

iaddr r_read

(int fd, char *buf, uaddr nbytes)

DESCRIPTION
This routine is similar to the system <<read(2)>> call, except that the number of bytes requested is always returned (except on error or closure). Hence, if the descriptor references a socket, the routine will read as much data as was requested, rather than a lesser amount due to packetisation or interrupted system calls.

fd  The file descriptor to read from. This descriptor must NOT be set to non-blocking IO.

buf The buffer in which to write the data.

nbytes
    The number of bytes to read.

RETURN VALUE
The number of bytes requested on success, the number of bytes read on end of file (or closure) and -1 on error.

Multi-threading Level
Unsafe.

AUTHOR
Richard Gooch (rgooch@atnf.csiro.au)

AVAILABLITY
The Karma Distribution is available for anonymous ftp from: ftp://ftp.atnf.csiro.au/pub/software/karma/ ftp://wuarchive.wustl.edu/graphics/graphics/packages/karma/ ftp://ftp.pwr.wroc.pl/pub/karma/ The Karma Home Page is: http://www.atnf.csiro.au/karma/