Skip to content

Commit 24f981a

Browse files
committed
FIXUP: compilation failures
1 parent b648df3 commit 24f981a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

System/Posix/Fcntl.hsc

+7-6
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,19 @@ module System.Posix.Fcntl (
3030
import Foreign.C
3131
import System.Posix.Types
3232

33-
#if !HAVE_POSIX_FALLOCATE
33+
#if !HAVE_POSIX_FALLOCATE || !HAVE_O_DIRECT
3434
import System.IO.Error ( ioeSetLocation )
3535
import GHC.IO.Exception ( unsupportedOperation )
3636
#endif
3737

38-
#ifndef darwin_HOST_OS
38+
#if HAVE_O_DIRECT
3939
import Data.Bits (complement, (.&.), (.|.))
4040
import System.Posix.Internals (c_fcntl_read)
4141
#endif
4242

43+
#if HAVE_O_DIRECT || HAVE_F_NOCACHE
4344
import System.Posix.Internals (c_fcntl_write)
44-
45+
#endif
4546

4647
-- -----------------------------------------------------------------------------
4748
-- File control
@@ -140,7 +141,7 @@ fileGetCaching (Fd fd) = do
140141
#else
141142
{-# WARNING fileGetCaching
142143
"operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_O_DIRECT@)" #-}
143-
fileGetCaching _ _ = ioError (ioeSetLocation unsupportedOperation "fileGetCaching")
144+
fileGetCaching _ = ioError (ioeSetLocation unsupportedOperation "fileGetCaching")
144145
#endif
145146

146147
-- | Performs the @fcntl(2)@ operation on a file-desciptor to set the cache
@@ -172,7 +173,7 @@ fileSetCaching (Fd fd) val = do
172173
fileSetCaching (Fd fd) val = do
173174
throwErrnoIfMinus1_ "fileSetCaching" (c_fcntl_write fd #{const F_NOCACHE} (if val then 1 else 0))
174175
#else
175-
{-# WARNING fileGetCaching
176+
{-# WARNING fileSetCaching
176177
"operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_O_DIRECT || HAVE_F_NOCACHE @)" #-}
177-
fileGetCaching _ _ = ioError (ioeSetLocation unsupportedOperation "fileGetCaching")
178+
fileSetCaching _ _ = ioError (ioeSetLocation unsupportedOperation "fileSetCaching")
178179
#endif

0 commit comments

Comments
 (0)