git-annex/standalone/android/haskell-patches/unix-2.6.0.1_0001-remove-stuff-not-available-on-Android.patch
Joey Hess 1bc5734037 add patches porting necessary Haskell libraries to Android
This goes all the way up to Yesod, but everything above Wai is a real hack
job, removing TH left and right.
2013-02-28 23:43:26 -04:00

91 lines
3.3 KiB
Diff

From abca378462337ca0eb13a7e4d3073cb96a50d36c Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Thu, 28 Feb 2013 23:37:23 -0400
Subject: [PATCH] remove stuff not available on Android
---
System/Posix/Resource.hsc | 4 ++++
System/Posix/Terminal/Common.hsc | 29 +++--------------------------
2 files changed, 7 insertions(+), 26 deletions(-)
diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc
index 6651998..2615b1e 100644
--- a/System/Posix/Resource.hsc
+++ b/System/Posix/Resource.hsc
@@ -101,7 +101,9 @@ packResource ResourceTotalMemory = (#const RLIMIT_AS)
#endif
unpackRLimit :: CRLim -> ResourceLimit
+#if 0
unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity
+#endif
#ifdef RLIM_SAVED_MAX
unpackRLimit (#const RLIM_SAVED_MAX) = ResourceLimitUnknown
unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown
@@ -109,7 +111,9 @@ unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown
unpackRLimit other = ResourceLimit (fromIntegral other)
packRLimit :: ResourceLimit -> Bool -> CRLim
+#if 0
packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY)
+#endif
#ifdef RLIM_SAVED_MAX
packRLimit ResourceLimitUnknown True = (#const RLIM_SAVED_CUR)
packRLimit ResourceLimitUnknown False = (#const RLIM_SAVED_MAX)
diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc
index 3a6254d..32a22f2 100644
--- a/System/Posix/Terminal/Common.hsc
+++ b/System/Posix/Terminal/Common.hsc
@@ -419,11 +419,7 @@ foreign import ccall unsafe "tcsendbreak"
-- | @drainOutput fd@ calls @tcdrain@ to block until all output
-- written to @Fd@ @fd@ has been transmitted.
drainOutput :: Fd -> IO ()
-drainOutput (Fd fd) = throwErrnoIfMinus1_ "drainOutput" (c_tcdrain fd)
-
-foreign import ccall unsafe "tcdrain"
- c_tcdrain :: CInt -> IO CInt
-
+drainOutput (Fd fd) = error "drainOutput not implemented"
data QueueSelector
= InputQueue -- TCIFLUSH
@@ -434,16 +430,7 @@ data QueueSelector
-- pending input and\/or output for @Fd@ @fd@,
-- as indicated by the @QueueSelector@ @queues@.
discardData :: Fd -> QueueSelector -> IO ()
-discardData (Fd fd) queue =
- throwErrnoIfMinus1_ "discardData" (c_tcflush fd (queue2Int queue))
- where
- queue2Int :: QueueSelector -> CInt
- queue2Int InputQueue = (#const TCIFLUSH)
- queue2Int OutputQueue = (#const TCOFLUSH)
- queue2Int BothQueues = (#const TCIOFLUSH)
-
-foreign import ccall unsafe "tcflush"
- c_tcflush :: CInt -> CInt -> IO CInt
+discardData (Fd fd) queue = error "discardData not implemented"
data FlowAction
= SuspendOutput -- ^ TCOOFF
@@ -455,17 +442,7 @@ data FlowAction
-- flow of data on @Fd@ @fd@, as indicated by
-- @action@.
controlFlow :: Fd -> FlowAction -> IO ()
-controlFlow (Fd fd) action =
- throwErrnoIfMinus1_ "controlFlow" (c_tcflow fd (action2Int action))
- where
- action2Int :: FlowAction -> CInt
- action2Int SuspendOutput = (#const TCOOFF)
- action2Int RestartOutput = (#const TCOON)
- action2Int TransmitStop = (#const TCIOFF)
- action2Int TransmitStart = (#const TCION)
-
-foreign import ccall unsafe "tcflow"
- c_tcflow :: CInt -> CInt -> IO CInt
+controlFlow (Fd fd) action = error "controlFlow not implemented"
-- | @getTerminalProcessGroupID fd@ calls @tcgetpgrp@ to
-- obtain the @ProcessGroupID@ of the foreground process group
--
1.7.10.4