mirror of https://github.com/voidlizard/hbs2
macos fsync issues
This commit is contained in:
parent
96726cf287
commit
783481af76
|
@ -3,9 +3,12 @@
|
||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
module HBS2.Storage.NCQ3.Internal.Fsync where
|
module HBS2.Storage.NCQ3.Internal.Fsync where
|
||||||
|
|
||||||
|
import HBS2.Storage.NCQ3.Internal.Prelude
|
||||||
|
|
||||||
import Foreign.C.Types
|
import Foreign.C.Types
|
||||||
import System.Posix.Types
|
import System.Posix.Types
|
||||||
import System.Posix.Unistd (fileSynchronise)
|
import System.Posix.Unistd (fileSynchronise)
|
||||||
|
import Foreign.C.Error (throwErrnoIfMinus1_)
|
||||||
|
|
||||||
#ifdef darwin_HOST_OS
|
#ifdef darwin_HOST_OS
|
||||||
|
|
||||||
|
@ -17,12 +20,12 @@ foreign import capi unsafe "fcntl.h value F_FULLFSYNC"
|
||||||
|
|
||||||
c_fcntl :: CInt -> CInt -> CInt -> IO ()
|
c_fcntl :: CInt -> CInt -> CInt -> IO ()
|
||||||
c_fcntl fd cmd arg = do
|
c_fcntl fd cmd arg = do
|
||||||
_ <- c_fcntl_raw fd cmd arg
|
debug $ "c_fcntl" <+> viaShow fd <+> viaShow cmd <+> viaShow arg
|
||||||
|
throwErrnoIfMinus1_ "fcntl(F_FULLFSYNC)" (c_fcntl_raw fd cmd arg)
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
fileSynchronisePortable :: Fd -> IO ()
|
fileSynchronisePortable :: Fd -> IO ()
|
||||||
fileSynchronisePortable fd@(Fd fdi) = do
|
fileSynchronisePortable fd@(Fd fdi) = do
|
||||||
#if defined(darwin_HOST_OS)
|
#if defined(darwin_HOST_OS)
|
||||||
|
@ -33,3 +36,4 @@ fileSynchronisePortable fd@(Fd fdi) = do
|
||||||
{-# INLINE fileSynchronisePortable #-}
|
{-# INLINE fileSynchronisePortable #-}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue