[project @ 2001-11-26 19:43:23 by sof]
authorsof <unknown>
Mon, 26 Nov 2001 19:43:23 +0000 (19:43 +0000)
committersof <unknown>
Mon, 26 Nov 2001 19:43:23 +0000 (19:43 +0000)
win32 only - provide closeFd, which closes a file descriptor, be it of
file or socket ilk.

ghc/lib/std/PrelPosix.hsc

index 5d85f61..35dacc6 100644 (file)
@@ -269,6 +269,16 @@ foreign import "isatty" unsafe
 foreign import "close" unsafe
    c_close :: CInt -> IO CInt
 
+#ifdef mingw32_TARGET_OS
+closeFd :: Bool -> CInt -> IO CInt
+closeFd isStream fd 
+  | isStream  = c_closesocket fd
+  | otherwise = c_close fd
+
+foreign import "closesocket" unsafe
+   c_closesocket :: CInt -> IO CInt
+#endif
+
 foreign import "lseek" unsafe
    c_lseek :: CInt -> COff -> CInt -> IO COff