aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Simon Marlow <marlowsd@gmail.com>2013-01-30 09:20:47 +0000
committerGravatar Simon Marlow <marlowsd@gmail.com>2013-01-30 09:20:47 +0000
commitb8fb0a0a96de36ab088e29f816f89b4e9b52916f (patch)
tree48a757d2da4a5a5c349a6fd9996ccdeedd584ba0 /System
parent625b9f86ff3ef8b9e0f7b58982268e5351b2eda2 (diff)
cope with missing telldir/seekdir (for Android)
Submitted by: Nathan Hüsken <nathan.huesken@posteo.de>
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Directory.hsc4
-rw-r--r--System/Posix/Directory/ByteString.hsc4
-rw-r--r--System/Posix/Directory/Common.hsc8
3 files changed, 16 insertions, 0 deletions
diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc
index 71a70ce..d0ef4c0 100644
--- a/System/Posix/Directory.hsc
+++ b/System/Posix/Directory.hsc
@@ -29,8 +29,12 @@ module System.Posix.Directory (
rewindDirStream,
closeDirStream,
DirStreamOffset,
+#ifdef HAVE_TELLDIR
tellDirStream,
+#endif
+#ifdef HAVE_SEEKDIR
seekDirStream,
+#endif
-- * The working dirctory
getWorkingDirectory,
diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc
index 3ac642b..bb9100c 100644
--- a/System/Posix/Directory/ByteString.hsc
+++ b/System/Posix/Directory/ByteString.hsc
@@ -29,8 +29,12 @@ module System.Posix.Directory.ByteString (
rewindDirStream,
closeDirStream,
DirStreamOffset,
+#ifdef HAVE_TELLDIR
tellDirStream,
+#endif
+#ifdef HAVE_SEEKDIR
seekDirStream,
+#endif
-- * The working dirctory
getWorkingDirectory,
diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc
index a608be3..7e2dfc6 100644
--- a/System/Posix/Directory/Common.hsc
+++ b/System/Posix/Directory/Common.hsc
@@ -22,8 +22,12 @@ module System.Posix.Directory.Common (
DirStream(..), CDir, CDirent, DirStreamOffset(..),
rewindDirStream,
closeDirStream,
+#ifdef HAVE_SEEKDIR
seekDirStream,
+#endif
+#ifdef HAVE_TELLDIR
tellDirStream,
+#endif
changeWorkingDirectoryFd,
) where
@@ -57,13 +61,16 @@ foreign import ccall unsafe "closedir"
newtype DirStreamOffset = DirStreamOffset COff
+#ifdef HAVE_SEEKDIR
seekDirStream :: DirStream -> DirStreamOffset -> IO ()
seekDirStream (DirStream dirp) (DirStreamOffset off) =
c_seekdir dirp off
foreign import ccall unsafe "seekdir"
c_seekdir :: Ptr CDir -> COff -> IO ()
+#endif
+#ifdef HAVE_TELLDIR
tellDirStream :: DirStream -> IO DirStreamOffset
tellDirStream (DirStream dirp) = do
off <- c_telldir dirp
@@ -71,6 +78,7 @@ tellDirStream (DirStream dirp) = do
foreign import ccall unsafe "telldir"
c_telldir :: Ptr CDir -> IO COff
+#endif
changeWorkingDirectoryFd :: Fd -> IO ()
changeWorkingDirectoryFd (Fd fd) =