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"
15 readDescriptor(I_ fd, A_ buf, I_ nbytes)
19 while ((sucked = read((int) fd, (char *) buf, (int) nbytes)) < 0) {
27 ghc_errtype = ERR_INVALIDARGUMENT;
28 ghc_errstr = "Not a valid write descriptor";
31 ghc_errtype = ERR_SYSTEMERROR;
32 ghc_errstr = "Message waiting to be read is not a data message";
35 ghc_errtype = ERR_INVALIDARGUMENT;
36 ghc_errstr = "Data buffer not in writeable part of user address space";
39 ghc_errtype = ERR_INVALIDARGUMENT;
40 ghc_errstr = "Seek pointer associated with descriptor negative";
43 ghc_errtype = ERR_SYSTEMERROR;
44 ghc_errstr = "I/O error occurred while writing to file system";
47 ghc_errtype = ERR_INAPPROPRIATETYPE;
48 ghc_errstr = "Descriptor refers to a directory";
52 ghc_errtype = ERR_OTHERERROR;
53 ghc_errstr = "No data could be written immediately";