X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Flib%2Fmisc%2Fcbits%2FrecvFrom.c;h=c12c1b0c49463c63bc856374255a1b0bd7e907db;hb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;hp=c1e10df6d7611d3fd19bb77c240edb66e7c764c4;hpb=b62b44e66c71b6cc602d3fff153c3001d8e4a91b;p=ghc-hetmet.git diff --git a/ghc/lib/misc/cbits/recvFrom.c b/ghc/lib/misc/cbits/recvFrom.c index c1e10df..c12c1b0 100644 --- a/ghc/lib/misc/cbits/recvFrom.c +++ b/ghc/lib/misc/cbits/recvFrom.c @@ -1,22 +1,18 @@ -#if 0 -% -% (c) The GRASP/AQUA Project, Glasgow University, 1998 -% -\subsection[recvFrom.lc]{recvFrom run-time support} - -\begin{code} -#endif +/* ----------------------------------------------------------------------------- + * $Id: recvFrom.c,v 1.3 1998/12/02 13:26:46 simonm Exp $ + * + * recvFrom run-time support + * + * (c) The GHC Team 1998 + * -------------------------------------------------------------------------- */ #define NON_POSIX_SOURCE -#include "rtsdefs.h" +#include "Rts.h" #include "ghcSockets.h" +#include "stgio.h" StgInt -recvFrom__(fd, buf, nbytes, from) -StgInt fd; -StgAddr buf; -StgInt nbytes; -StgAddr from; +recvFrom__(StgInt fd, StgAddr buf, StgInt nbytes, StgAddr from) { StgInt count; int sz; @@ -27,42 +23,9 @@ StgAddr from; while ( (count = recvfrom((int)fd, (void*)buf, (int)nbytes, flags, (struct sockaddr*)from, &sz)) < 0) { if (errno != EINTR) { cvtErrno(); - switch (ghc_errno) { - case GHC_EBADF: - ghc_errtype = ERR_INVALIDARGUMENT; - ghc_errstr = "Not a valid read descriptor"; - break; - case GHC_EBADMSG: - ghc_errtype = ERR_SYSTEMERROR; - ghc_errstr = "Message waiting to be read is not a data message"; - break; - case GHC_EFAULT: - ghc_errtype = ERR_INVALIDARGUMENT; - ghc_errstr = "Data buffer not in readable part of user address space"; - break; - case GHC_EINVAL: - ghc_errtype = ERR_INVALIDARGUMENT; - ghc_errstr = "Seek pointer associated with descriptor negative"; - break; - case GHC_EIO: - ghc_errtype = ERR_SYSTEMERROR; - ghc_errstr = "I/O error occurred while reading"; - break; - case GHC_EISDIR: - ghc_errtype = ERR_INAPPROPRIATETYPE; - ghc_errstr = "Descriptor refers to a directory"; - break; - case GHC_EAGAIN: - case GHC_EWOULDBLOCK: - ghc_errtype = ERR_OTHERERROR; - ghc_errstr = "No data could be read immediately"; - break; - default: - stdErrno(); - break; - } + stdErrno(); return -1; } - } - return count; + } + return count; }