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/selectFrom.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/selectFrom.c')
-rw-r--r-- | ghc/lib/misc/cbits/selectFrom.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/ghc/lib/misc/cbits/selectFrom.c b/ghc/lib/misc/cbits/selectFrom.c deleted file mode 100644 index 55e6516ef3..0000000000 --- a/ghc/lib/misc/cbits/selectFrom.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) sof, 1999 - * - * Stubs to help implement Select module. - */ - -/* we're outside the realms of POSIX here... */ -#define NON_POSIX_SOURCE - -#include "Rts.h" -#include "selectFrom.h" -#include "stgio.h" - -# if defined(HAVE_SYS_TYPES_H) -# include <sys/types.h> -# endif - -# ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -# endif - - -/* Helpers for the Haskell-side unmarshalling */ - -int -sizeof_fd_set__() -{ - return (sizeof(fd_set)); -} - -void -fd_zero__(StgByteArray a) -{ - FD_ZERO((fd_set*)a); -} - -void -fd_set__(StgByteArray a, StgInt fd) -{ - FD_SET(fd,(fd_set*)a); -} - -int -is_fd_set__(StgByteArray a, StgInt fd) -{ - return FD_ISSET(fd,(fd_set*)a); -} - -StgInt -selectFrom__( StgByteArray rfd - , StgByteArray wfd - , StgByteArray efd - , StgInt mFd - , StgInt tout - ) -{ - int rc, i; - struct timeval tv; - - if (tout != (-1)) { - tv.tv_sec = tout / 1000000; - tv.tv_usec = tout % 1000000; - } - - while ((rc = select(mFd, (fd_set*)rfd, (fd_set*)wfd, (fd_set*)efd, (tout == -1 ? NULL : &tv))) < 0) { - if (errno != EINTR) { - break; - } - } - return 0; -} - |