4 * Stubs to help implement Select module.
7 /* we're outside the realms of POSIX here... */
8 #define NON_POSIX_SOURCE
11 #include "selectFrom.h"
14 # if defined(HAVE_SYS_TYPES_H)
15 # include <sys/types.h>
18 # ifdef HAVE_SYS_TIME_H
19 # include <sys/time.h>
23 /* Helpers for the Haskell-side unmarshalling */
28 return (sizeof(fd_set));
32 fd_zero__(StgByteArray a)
38 fd_set__(StgByteArray a, StgInt fd)
40 FD_SET(fd,(fd_set*)a);
44 is_fd_set__(StgByteArray a, StgInt fd)
46 return FD_ISSET(fd,(fd_set*)a);
50 selectFrom__( StgByteArray rfd
61 tv.tv_sec = tout / 1000000;
62 tv.tv_usec = tout % 1000000;
65 while ((rc = select(mFd, (fd_set*)rfd, (fd_set*)wfd, (fd_set*)efd, (tout == -1 ? NULL : &tv))) < 0) {