3 % (c) The GRASP/AQUA Project, Glasgow University, 1996
5 \subsection[readDescriptor.lc]{Suck some bytes from a descriptor}
10 #define NON_POSIX_SOURCE
12 #include "ghcSockets.h"
16 readDescriptor(I_ fd, A_ buf, I_ nbytes)
20 while ((sucked = read((int) fd, (char *) buf, (int) nbytes)) < 0) {
28 ghc_errtype = ERR_INVALIDARGUMENT;
29 ghc_errstr = "Not a valid write descriptor";
32 ghc_errtype = ERR_SYSTEMERROR;
33 ghc_errstr = "Message waiting to be read is not a data message";
36 ghc_errtype = ERR_INVALIDARGUMENT;
37 ghc_errstr = "Data buffer not in writeable part of user address space";
40 ghc_errtype = ERR_INVALIDARGUMENT;
41 ghc_errstr = "Seek pointer associated with descriptor negative";
44 ghc_errtype = ERR_SYSTEMERROR;
45 ghc_errstr = "I/O error occurred while writing to file system";
48 ghc_errtype = ERR_INAPPROPRIATETYPE;
49 ghc_errstr = "Descriptor refers to a directory";
53 ghc_errtype = ERR_OTHERERROR;
54 ghc_errstr = "No data could be written immediately";