aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Env.hsc11
-rw-r--r--System/Posix/Files/Common.hsc6
-rw-r--r--System/Posix/Process/Common.hsc5
-rw-r--r--System/Posix/Signals.hsc6
4 files changed, 21 insertions, 7 deletions
diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc
index c53929f..fbe5c79 100644
--- a/System/Posix/Env.hsc
+++ b/System/Posix/Env.hsc
@@ -39,6 +39,12 @@ import Control.Monad
import Data.Maybe (fromMaybe)
import System.Posix.Internals
+#if !MIN_VERSION_base(4,7,0)
+-- needed for backported local 'newFilePath' binding in 'putEnv'
+import GHC.IO.Encoding (getFileSystemEncoding)
+import qualified GHC.Foreign as GHC (newCString)
+#endif
+
-- |'getEnv' looks up a variable in the environment.
getEnv :: String -> IO (Maybe String)
@@ -128,6 +134,11 @@ putEnv keyvalue = do s <- newFilePath keyvalue
-- According to SUSv2, the string passed to putenv
-- becomes part of the enviroment. #7342
throwErrnoIfMinus1_ "putenv" (c_putenv s)
+#if !MIN_VERSION_base(4,7,0)
+ where
+ newFilePath :: FilePath -> IO CString
+ newFilePath fp = getFileSystemEncoding >>= \enc -> GHC.newCString enc fp
+#endif
foreign import ccall unsafe "putenv"
c_putenv :: CString -> IO CInt
diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc
index 9ce2f1d..75c7fde 100644
--- a/System/Posix/Files/Common.hsc
+++ b/System/Posix/Files/Common.hsc
@@ -85,11 +85,15 @@ import System.Posix.Error
import System.Posix.Types
import System.IO.Unsafe
import Data.Bits
+import Data.Int
import Data.Time.Clock.POSIX
import Data.Ratio
import System.Posix.Internals
-import Foreign
import Foreign.C
+import Foreign.ForeignPtr
+import Foreign.Marshal
+import Foreign.Ptr
+import Foreign.Storable
-- -----------------------------------------------------------------------------
-- POSIX file modes
diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc
index 3bcc505..51c75b3 100644
--- a/System/Posix/Process/Common.hsc
+++ b/System/Posix/Process/Common.hsc
@@ -313,11 +313,6 @@ getProcessStatus block stopped pid =
_ -> do ps <- readWaitStatus wstatp
return (Just ps)
-#if __GLASGOW_HASKELL__ < 701
--- not available prior to 7.1
-#define interruptible safe
-#endif
-
-- safe/interruptible, because this call might block
foreign import ccall interruptible "waitpid"
c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid
diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc
index 39de76b..eb46ba4 100644
--- a/System/Posix/Signals.hsc
+++ b/System/Posix/Signals.hsc
@@ -103,8 +103,12 @@ module System.Posix.Signals (
-- siginterrupt
) where
-import Foreign
+import Data.Word
import Foreign.C
+import Foreign.ForeignPtr
+import Foreign.Marshal
+import Foreign.Ptr
+import Foreign.Storable
import System.IO.Unsafe (unsafePerformIO)
import System.Posix.Types
import System.Posix.Internals