aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--System/Posix/Directory.hsc1
-rw-r--r--System/Posix/Directory/ByteString.hsc1
-rw-r--r--System/Posix/Directory/Common.hsc3
-rw-r--r--System/Posix/Files.hsc6
-rw-r--r--System/Posix/Files/Common.hsc12
-rw-r--r--System/Posix/IO.hsc1
-rw-r--r--System/Posix/IO/ByteString.hsc9
-rw-r--r--System/Posix/IO/Common.hsc4
-rw-r--r--System/Posix/Resource.hsc18
-rw-r--r--System/Posix/SharedMem.hsc6
-rw-r--r--System/Posix/Terminal.hsc5
-rw-r--r--System/Posix/Terminal/ByteString.hsc11
-rw-r--r--System/Posix/Terminal/Common.hsc14
-rw-r--r--System/Posix/Unistd.hsc2
-rw-r--r--unix.cabal2
15 files changed, 34 insertions, 61 deletions
diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc
index d2f30de..a615f6f 100644
--- a/System/Posix/Directory.hsc
+++ b/System/Posix/Directory.hsc
@@ -1,5 +1,4 @@
{-# LANGUAGE NondecreasingIndentation #-}
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc
index 4ac043a..28edd35 100644
--- a/System/Posix/Directory/ByteString.hsc
+++ b/System/Posix/Directory/ByteString.hsc
@@ -1,5 +1,4 @@
{-# LANGUAGE NondecreasingIndentation #-}
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc
index 29a5a59..86d87ca 100644
--- a/System/Posix/Directory/Common.hsc
+++ b/System/Posix/Directory/Common.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -32,8 +31,6 @@ module System.Posix.Directory.Common (
changeWorkingDirectoryFd,
) where
-import System.IO.Error
-import System.Posix.Error
import System.Posix.Types
import Foreign
import Foreign.C
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc
index 8268492..57f771e 100644
--- a/System/Posix/Files.hsc
+++ b/System/Posix/Files.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -95,12 +94,9 @@ module System.Posix.Files (
import Foreign
import Foreign.C
-import System.Posix.Error
import System.Posix.Types
-import System.Posix.Internals
import System.Posix.Files.Common
-
-import System.Posix.Internals (withFilePath, peekFilePath)
+import System.Posix.Internals
import Data.Time.Clock.POSIX
diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc
index 75c7fde..22899de 100644
--- a/System/Posix/Files/Common.hsc
+++ b/System/Posix/Files/Common.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -81,17 +80,22 @@ module System.Posix.Files.Common (
#endif
) where
-import System.Posix.Error
import System.Posix.Types
import System.IO.Unsafe
import Data.Bits
+#if defined(HAVE_STRUCT_STAT_ST_CTIM) || \
+ defined(HAVE_STRUCT_STAT_ST_MTIM) || \
+ defined(HAVE_STRUCT_STAT_ST_ATIM)
import Data.Int
-import Data.Time.Clock.POSIX
import Data.Ratio
+#endif
+import Data.Time.Clock.POSIX
import System.Posix.Internals
import Foreign.C
import Foreign.ForeignPtr
-import Foreign.Marshal
+#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMENS)
+import Foreign.Marshal (withArray)
+#endif
import Foreign.Ptr
import Foreign.Storable
diff --git a/System/Posix/IO.hsc b/System/Posix/IO.hsc
index 6bea369..eeabb24 100644
--- a/System/Posix/IO.hsc
+++ b/System/Posix/IO.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
diff --git a/System/Posix/IO/ByteString.hsc b/System/Posix/IO/ByteString.hsc
index bf6e6bf..87dfad6 100644
--- a/System/Posix/IO/ByteString.hsc
+++ b/System/Posix/IO/ByteString.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -68,17 +67,9 @@ module System.Posix.IO.ByteString (
import System.Posix.Types
import System.Posix.IO.Common
-import Foreign.C hiding (
- throwErrnoPath,
- throwErrnoPathIf,
- throwErrnoPathIf_,
- throwErrnoPathIfNull,
- throwErrnoPathIfMinus1,
- throwErrnoPathIfMinus1_ )
import System.Posix.ByteString.FilePath
-
-- |Open and optionally create this file. See 'System.Posix.Files'
-- for information on how to use the 'FileMode' type.
openFd :: RawFilePath
diff --git a/System/Posix/IO/Common.hsc b/System/Posix/IO/Common.hsc
index 784f1a1..a781093 100644
--- a/System/Posix/IO/Common.hsc
+++ b/System/Posix/IO/Common.hsc
@@ -1,5 +1,4 @@
{-# LANGUAGE NondecreasingIndentation, RecordWildCards #-}
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -63,15 +62,12 @@ module System.Posix.IO.Common (
import System.IO
import System.IO.Error
import System.Posix.Types
-import System.Posix.Error
import qualified System.Posix.Internals as Base
import Foreign
import Foreign.C
-import Data.Bits
#ifdef __GLASGOW_HASKELL__
-import GHC.IO.Handle
import GHC.IO.Handle.Internals
import GHC.IO.Handle.Types
import qualified GHC.IO.FD as FD
diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc
index fa4d3b3..165bed4 100644
--- a/System/Posix/Resource.hsc
+++ b/System/Posix/Resource.hsc
@@ -1,12 +1,6 @@
-{-# OPTIONS_GHC -w #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and fix
--- any warnings in the module. See
--- http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
--- for details
-----------------------------------------------------------------------------
-- |
-- Module : System.Posix.Resource
@@ -70,7 +64,7 @@ foreign import ccall unsafe "HsUnix.h __hscore_setrlimit"
getResourceLimit :: Resource -> IO ResourceLimits
getResourceLimit res = do
allocaBytes (#const sizeof(struct rlimit)) $ \p_rlimit -> do
- throwErrnoIfMinus1 "getResourceLimit" $
+ throwErrnoIfMinus1_ "getResourceLimit" $
c_getrlimit (packResource res) p_rlimit
soft <- (#peek struct rlimit, rlim_cur) p_rlimit
hard <- (#peek struct rlimit, rlim_max) p_rlimit
@@ -84,7 +78,7 @@ setResourceLimit res ResourceLimits{softLimit=soft,hardLimit=hard} = do
allocaBytes (#const sizeof(struct rlimit)) $ \p_rlimit -> do
(#poke struct rlimit, rlim_cur) p_rlimit (packRLimit soft True)
(#poke struct rlimit, rlim_max) p_rlimit (packRLimit hard False)
- throwErrnoIfMinus1 "setResourceLimit" $
+ throwErrnoIfMinus1_ "setResourceLimit" $
c_setrlimit (packResource res) p_rlimit
return ()
@@ -101,16 +95,20 @@ packResource ResourceTotalMemory = (#const RLIMIT_AS)
unpackRLimit :: CRLim -> ResourceLimit
unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity
-#ifdef RLIM_SAVED_MAX
+#if defined(RLIM_SAVED_MAX) && (RLIM_SAVED_MAX != RLIM_INFINITY)
unpackRLimit (#const RLIM_SAVED_MAX) = ResourceLimitUnknown
+#endif
+#if defined(RLIM_SAVED_CUR) && (RLIM_SAVED_CUR != RLIM_INFINITY)
unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown
#endif
unpackRLimit other = ResourceLimit (fromIntegral other)
packRLimit :: ResourceLimit -> Bool -> CRLim
packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY)
-#ifdef RLIM_SAVED_MAX
+#ifdef RLIM_SAVED_CUR
packRLimit ResourceLimitUnknown True = (#const RLIM_SAVED_CUR)
+#endif
+#ifdef RLIM_SAVED_MAX
packRLimit ResourceLimitUnknown False = (#const RLIM_SAVED_MAX)
#endif
packRLimit (ResourceLimit other) _ = fromIntegral other
diff --git a/System/Posix/SharedMem.hsc b/System/Posix/SharedMem.hsc
index 8884a3f..1d7a80a 100644
--- a/System/Posix/SharedMem.hsc
+++ b/System/Posix/SharedMem.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -27,9 +26,12 @@ module System.Posix.SharedMem
#include "HsUnix.h"
import System.Posix.Types
-import System.Posix.Error
+#if defined(HAVE_SHM_OPEN) || defined(HAVE_SHM_UNLINK)
import Foreign.C
+#endif
+#ifdef HAVE_SHM_OPEN
import Data.Bits
+#endif
data ShmOpenFlags = ShmOpenFlags
{ shmReadWrite :: Bool,
diff --git a/System/Posix/Terminal.hsc b/System/Posix/Terminal.hsc
index 6c41bdc..a7ede2b 100644
--- a/System/Posix/Terminal.hsc
+++ b/System/Posix/Terminal.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -76,9 +75,11 @@ import Foreign
import Foreign.C
import System.Posix.Terminal.Common
import System.Posix.Types
+#ifndef HAVE_OPENPTY
import System.Posix.IO
+#endif
-import System.Posix.Internals (withFilePath, peekFilePath)
+import System.Posix.Internals (peekFilePath)
-- | @getTerminalName fd@ calls @ttyname@ to obtain a name associated
-- with the terminal for @Fd@ @fd@. If @fd@ is associated
diff --git a/System/Posix/Terminal/ByteString.hsc b/System/Posix/Terminal/ByteString.hsc
index a667c8a..ad2dd26 100644
--- a/System/Posix/Terminal/ByteString.hsc
+++ b/System/Posix/Terminal/ByteString.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -75,8 +74,10 @@ module System.Posix.Terminal.ByteString (
import Foreign
import System.Posix.Types
import System.Posix.Terminal.Common
-import System.Posix.IO.ByteString
-import Data.ByteString.Char8 as B
+#ifndef HAVE_OPENPTY
+import System.Posix.IO.ByteString (defaultFileFlags, openFd, noctty, OpenMode(ReadWrite))
+import Data.ByteString.Char8 as B ( pack, )
+#endif
import Foreign.C hiding (
throwErrnoPath,
@@ -185,9 +186,9 @@ foreign import ccall unsafe "__hsunix_unlockpt"
c_unlockpt :: CInt -> IO CInt
#else
c_grantpt :: CInt -> IO CInt
-c_grantpt _ = return (fromIntegral 0)
+c_grantpt _ = return (fromIntegral (0::Int))
c_unlockpt :: CInt -> IO CInt
-c_unlockpt _ = return (fromIntegral 0)
+c_unlockpt _ = return (fromIntegral (0::Int))
#endif /* HAVE_PTSNAME */
#endif /* !HAVE_OPENPTY */
diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc
index 2a07e28..4075ba3 100644
--- a/System/Posix/Terminal/Common.hsc
+++ b/System/Posix/Terminal/Common.hsc
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -69,22 +68,13 @@ module System.Posix.Terminal.Common (
import Data.Bits
import Data.Char
-import Foreign.C.Error ( errnoToIOError, throwErrnoIfMinus1,
- throwErrnoIfMinus1_, throwErrnoIfNull )
-#ifndef HAVE_PTSNAME
-import Foreign.C.Error ( eNOSYS )
-#endif
-import Foreign.C.String ( CString, peekCString, withCString )
+import Foreign.C.Error ( throwErrnoIfMinus1, throwErrnoIfMinus1_ )
import Foreign.C.Types
import Foreign.ForeignPtr ( ForeignPtr, withForeignPtr, mallocForeignPtrBytes )
-import Foreign.Marshal.Alloc ( alloca )
import Foreign.Marshal.Utils ( copyBytes )
-import Foreign.Ptr ( Ptr, nullPtr, plusPtr )
+import Foreign.Ptr ( Ptr, plusPtr )
import Foreign.Storable ( Storable(..) )
-import System.IO.Error ( ioError )
import System.IO.Unsafe ( unsafePerformIO )
-import System.Posix.IO ( OpenFileFlags(..), OpenMode(..), defaultFileFlags,
- openFd )
import System.Posix.Types
-- -----------------------------------------------------------------------------
diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc
index 266b250..db69bc2 100644
--- a/System/Posix/Unistd.hsc
+++ b/System/Posix/Unistd.hsc
@@ -1,5 +1,4 @@
{-# LANGUAGE NondecreasingIndentation #-}
-{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-binds #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -56,7 +55,6 @@ import Foreign.C.Error
import Foreign.C.String ( peekCString )
import Foreign.C.Types
import Foreign
-import System.Posix.Types
import System.Posix.Internals
-- -----------------------------------------------------------------------------
diff --git a/unix.cabal b/unix.cabal
index f39d46f..835bf1c 100644
--- a/unix.cabal
+++ b/unix.cabal
@@ -117,6 +117,8 @@ library
System.Posix.Process.Common
System.Posix.Terminal.Common
+ ghc-options: -Wall
+
include-dirs: include
includes: HsUnix.h execvpe.h
install-includes: