diff options
author | simonmar <unknown> | 1999-11-26 16:29:44 +0000 |
---|---|---|
committer | simonmar <unknown> | 1999-11-26 16:29:44 +0000 |
commit | 7700dda03d273676b274bc148491a4e02a7c5ae0 (patch) | |
tree | 09de9743e3b9f9c7a4108660230969ce893947df /ghc/lib/misc/cbits/createSocket.c | |
parent | ef33ed94129ee17b577add392e04619ec1f53800 (diff) | |
download | haskell-7700dda03d273676b274bc148491a4e02a7c5ae0.tar.gz |
[project @ 1999-11-26 16:29:09 by simonmar]
GHC bits for new library organisation.
Diffstat (limited to 'ghc/lib/misc/cbits/createSocket.c')
-rw-r--r-- | ghc/lib/misc/cbits/createSocket.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/ghc/lib/misc/cbits/createSocket.c b/ghc/lib/misc/cbits/createSocket.c deleted file mode 100644 index 9a8ccaa1cc..0000000000 --- a/ghc/lib/misc/cbits/createSocket.c +++ /dev/null @@ -1,60 +0,0 @@ -#if 0 -% -% (c) The GRASP/AQUA Project, Glasgow University, 1995 -% -\subsection[createSocket.lc]{Create a socket file descriptor} - -\begin{code} -#endif - -#define NON_POSIX_SOURCE -#include "Rts.h" -#include "ghcSockets.h" -#include "stgio.h" - -StgInt -createSocket(I_ family, I_ type, I_ protocol) -{ - int fd; - long flags; - - if ((fd = socket((int)family, (int)type, (int)protocol)) < 0) { - if (errno != EINTR) { - cvtErrno(); - switch (ghc_errno) { - default: - stdErrno(); - break; - case GHC_EACCES: - ghc_errtype = ERR_PERMISSIONDENIED; - ghc_errstr = "cannot create socket"; - break; - case GHC_EMFILE: - ghc_errtype = ERR_RESOURCEEXHAUSTED; - ghc_errstr = "Too many open files"; - break; - case GHC_ENFILE: - ghc_errtype = ERR_RESOURCEEXHAUSTED; - ghc_errstr = "System file table overflow"; - break; - case GHC_EPROTONOSUPPORT: - ghc_errtype = ERR_UNSUPPORTEDOPERATION; - ghc_errstr = "Protocol type not supported"; - break; - case GHC_EPROTOTYPE: - ghc_errtype = ERR_INAPPROPRIATETYPE; - ghc_errstr = "Protocol wrong type for socket"; - break; - } - return (StgInt)-1; - } - } - - /* set the non-blocking flag on this file descriptor */ -#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#endif - - return (StgInt)fd; -} |