Non-blocking I/O isn't supported on 'pure' Win32 platforms.
}
/* 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 fd;
}
}
/* 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;
}
case (rc::Int) of
0 -> newHandle (mkClosedHandle__)
1 -> do
-#ifndef __CONCURRENT_HASKELL__
+#if !defined(__CONCURRENT_HASKELL__) || defined(mingw32_TARGET_OS)
fo <- CCALL(openStdFile) (1::Int)
(1::Int){-flush on close-}
(0::Int){-writeable-} -- ConcHask: SAFE, won't block
case (rc::Int) of
0 -> newHandle (mkClosedHandle__)
1 -> do
-#ifndef __CONCURRENT_HASKELL__
+#if !defined(__CONCURRENT_HASKELL__) || defined(mingw32_TARGET_OS)
fo <- CCALL(openStdFile) (0::Int)
(0::Int){-don't flush on close -}
(1::Int){-readable-} -- ConcHask: SAFE, won't block
case (rc::Int) of
0 -> newHandle (mkClosedHandle__)
1 -> do
-#ifndef __CONCURRENT_HASKELL__
+#if !defined(__CONCURRENT_HASKELL__) || defined(mingw32_TARGET_OS)
fo <- CCALL(openStdFile) (2::Int)
(1::Int){-flush on close-}
(0::Int){-writeable-} -- ConcHask: SAFE, won't block
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
- * $Id: openFile.c,v 1.7 1999/09/16 13:14:43 simonmar Exp $
+ * $Id: openFile.c,v 1.8 1999/09/17 09:38:35 sof Exp $
*
* openFile Runtime Support
*/
fo->flags = flags | FILEOBJ_STD | ( rd ? FILEOBJ_READ : FILEOBJ_WRITE);
fo->connectedTo = NULL;
+ /* MS Win32 CRT doesn't support fcntl() -- the workaround is to
+ start using 'completion ports', but I'm punting on implementing
+ support for using those.
+ */
+#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__)
/* set the non-blocking flag on this file descriptor */
fd_flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK);
+#endif
return fo;
}
struct stat sb;
IOFileObject* fo;
+#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__CYGWIN32__))
+#define O_NONBLOCK 0
+#endif
+
/*
* Since we aren't supposed to succeed when we're opening for writing and
* there's another writer, we can't just do an open() with O_WRONLY.