[PATCH] Use capi for syscalls that break under musl's handling of 64-bit time_t
authorMarios Titas <redneb@gmx.com>
Sun, 2 Oct 2022 20:12:41 +0000 (23:12 +0300)
committerIlias Tsitsimpis <iliastsi@debian.org>
Wed, 10 Apr 2024 11:24:01 +0000 (14:24 +0300)
Closes #145.

Gbp-Pq: Name time_t-directory

libraries/directory/System/Directory/Internal/C_utimensat.hsc
libraries/directory/directory.cabal

index f10c65944bbe1c169396371997cef84870fa4161..3d9b1942abcbfb887e13d6e197e8cc3a4e15ef6b 100644 (file)
@@ -1,3 +1,5 @@
+{-# LANGUAGE CApiFFI #-}
+
 module System.Directory.Internal.C_utimensat where
 #include <HsDirectoryConfig.h>
 #ifdef HAVE_UTIMENSAT
@@ -41,7 +43,7 @@ toCTimeSpec t = CTimeSpec (CTime sec) (truncate $ 10 ^ (9 :: Int) * frac)
     (sec,  frac)  = if frac' < 0 then (sec' - 1, frac' + 1) else (sec', frac')
     (sec', frac') = properFraction (toRational t)
 
-foreign import ccall "utimensat" c_utimensat
+foreign import capi "sys/stat.h utimensat" c_utimensat
   :: CInt -> CString -> Ptr CTimeSpec -> CInt -> IO CInt
 
 #endif
index 09c4a550b8205b6041209ef86f46b1944220f593..a2953b74659bd02751b8bac9fa83f633d72ab000 100644 (file)
@@ -38,6 +38,7 @@ Library
     default-language: Haskell2010
     other-extensions:
         CPP
+        CApiFFI
         Trustworthy
 
     exposed-modules: