From 783481af7654572b0f9d555ecdb1fa2edc30f2ad Mon Sep 17 00:00:00 2001 From: voidlizard Date: Fri, 22 Aug 2025 16:14:21 +0300 Subject: [PATCH] macos fsync issues --- hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Fsync.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Fsync.hs b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Fsync.hs index a6a3ac35..2cdda6cd 100644 --- a/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Fsync.hs +++ b/hbs2-storage-ncq/lib/HBS2/Storage/NCQ3/Internal/Fsync.hs @@ -3,9 +3,12 @@ {-# LANGUAGE CPP #-} module HBS2.Storage.NCQ3.Internal.Fsync where +import HBS2.Storage.NCQ3.Internal.Prelude + import Foreign.C.Types import System.Posix.Types import System.Posix.Unistd (fileSynchronise) +import Foreign.C.Error (throwErrnoIfMinus1_) #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 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 () #endif - fileSynchronisePortable :: Fd -> IO () fileSynchronisePortable fd@(Fd fdi) = do #if defined(darwin_HOST_OS) @@ -33,3 +36,4 @@ fileSynchronisePortable fd@(Fd fdi) = do {-# INLINE fileSynchronisePortable #-} +