[project @ 2004-12-21 16:42:06 by ross]
[ghc-base.git] / System / Posix / Internals.hs
index 5a1df90..4976e9d 100644 (file)
@@ -21,7 +21,8 @@
 -- #hide
 module System.Posix.Internals where
 
-#include "config.h"
+#include "ghcconfig.h"
+#include "HsBaseConfig.h"
 
 import Control.Monad
 import System.Posix.Types
@@ -44,7 +45,7 @@ import System.IO
 #ifdef __HUGS__
 import Hugs.Prelude (IOException(..), IOErrorType(..))
 
-{-# CBITS PrelIOUtils.c dirUtils.c consUtils.c #-}
+{-# CFILES cbits/PrelIOUtils.c cbits/dirUtils.c cbits/consUtils.c #-}
 ioException = ioError
 #endif
 
@@ -143,6 +144,7 @@ foreign import stdcall unsafe "HsBase.h closesocket"
 fdGetMode :: Int -> IO IOMode
 fdGetMode fd = do
 #if defined(mingw32_TARGET_OS) || defined(__MINGW32__)
+    -- XXX: this code is *BROKEN*, _setmode only deals with O_TEXT/O_BINARY
     flags1 <- throwErrnoIfMinus1Retry "fdGetMode" 
                 (c__setmode (fromIntegral fd) (fromIntegral o_WRONLY))
     flags  <- throwErrnoIfMinus1Retry "fdGetMode" 
@@ -341,7 +343,7 @@ foreign import ccall unsafe "HsBase.h dup"
 foreign import ccall unsafe "HsBase.h dup2"
    c_dup2 :: CInt -> CInt -> IO CInt
 
-foreign import ccall unsafe "HsBase.h fstat"
+foreign import ccall unsafe "HsBase.h __hscore_fstat"
    c_fstat :: CInt -> Ptr CStat -> IO CInt
 
 foreign import ccall unsafe "HsBase.h getcwd"
@@ -350,13 +352,13 @@ foreign import ccall unsafe "HsBase.h getcwd"
 foreign import ccall unsafe "HsBase.h isatty"
    c_isatty :: CInt -> IO CInt
 
-foreign import ccall unsafe "HsBase.h lseek"
+foreign import ccall unsafe "HsBase.h __hscore_lseek"
    c_lseek :: CInt -> COff -> CInt -> IO COff
 
 foreign import ccall unsafe "HsBase.h __hscore_lstat"
    lstat :: CString -> Ptr CStat -> IO CInt
 
-foreign import ccall unsafe "HsBase.h open"
+foreign import ccall unsafe "HsBase.h __hscore_open"
    c_open :: CString -> CInt -> CMode -> IO CInt
 
 foreign import ccall unsafe "HsBase.h opendir" 
@@ -368,9 +370,6 @@ foreign import ccall unsafe "HsBase.h __hscore_mkdir"
 foreign import ccall unsafe "HsBase.h read" 
    c_read :: CInt -> Ptr CChar -> CSize -> IO CSsize
 
-foreign import ccall unsafe "HsBase.h readdir" 
-   c_readdir :: Ptr CDir -> IO (Ptr CDirent)
-
 foreign import ccall unsafe "dirUtils.h __hscore_renameFile"
    c_rename :: CString -> CString -> IO CInt
                     
@@ -380,7 +379,7 @@ foreign import ccall unsafe "HsBase.h rewinddir"
 foreign import ccall unsafe "HsBase.h rmdir"
    c_rmdir :: CString -> IO CInt
 
-foreign import ccall unsafe "HsBase.h stat"
+foreign import ccall unsafe "HsBase.h __hscore_stat"
    c_stat :: CString -> Ptr CStat -> IO CInt
 
 foreign import ccall unsafe "HsBase.h umask"