[commit: packages/unix] master: Replace `__hsunix_lstat` wrapper with CApiFFI (7a2f3f4)

git at git.haskell.org git at git.haskell.org
Tue Apr 19 21:37:41 UTC 2016


Repository : ssh://git@git.haskell.org/unix

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7a2f3f41b4492c9d2e846ebd832ba7ddbaf063ac/unix

>---------------------------------------------------------------

commit 7a2f3f41b4492c9d2e846ebd832ba7ddbaf063ac
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 18:13:39 2016 +0100

    Replace `__hsunix_lstat` wrapper with CApiFFI


>---------------------------------------------------------------

7a2f3f41b4492c9d2e846ebd832ba7ddbaf063ac
 System/Posix/Files.hsc            | 2 +-
 System/Posix/Files/ByteString.hsc | 2 +-
 cbits/HsUnix.c                    | 6 ------
 include/HsUnix.h                  | 5 +----
 4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc
index b18a8df..2df973d 100644
--- a/System/Posix/Files.hsc
+++ b/System/Posix/Files.hsc
@@ -187,7 +187,7 @@ getSymbolicLinkStatus path = do
       throwErrnoPathIfMinus1_ "getSymbolicLinkStatus" path (c_lstat s p)
   return (FileStatus fp)
 
-foreign import ccall unsafe "__hsunix_lstat"
+foreign import capi unsafe "HsUnix.h lstat"
   c_lstat :: CString -> Ptr CStat -> IO CInt
 
 -- | @createNamedPipe fifo mode@
diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc
index 3f26f73..e560500 100644
--- a/System/Posix/Files/ByteString.hsc
+++ b/System/Posix/Files/ByteString.hsc
@@ -193,7 +193,7 @@ getSymbolicLinkStatus path = do
       throwErrnoPathIfMinus1_ "getSymbolicLinkStatus" path (c_lstat s p)
   return (FileStatus fp)
 
-foreign import ccall unsafe "__hsunix_lstat"
+foreign import capi unsafe "HsUnix.h lstat"
   c_lstat :: CString -> Ptr CStat -> IO CInt
 
 -- | @createNamedPipe fifo mode@
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index a0b15e9..74112c0 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -16,12 +16,6 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;}
 void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;}
 #endif
 
-// lstat is a macro on some platforms, so we need a wrapper:
-int __hsunix_lstat(const char *path, struct stat *buf) 
-{ 
-    return lstat(path,buf);
-}
-
 // mknod is a macro on some platforms, so we need a wrapper:
 int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev)
 { 
diff --git a/include/HsUnix.h b/include/HsUnix.h
index a6bba9a..def34ca 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -113,10 +113,7 @@ fall back to O_FSYNC, which should be the same */
 # define WCOREDUMP(s) 0
 #endif
 
-// lstat is a macro on some platforms, so we need a wrapper:
-int __hsunix_lstat(const char *path, struct stat *buf);
-
-// lstat is a macro on some platforms, so we need a wrapper:
+// mknod is a macro on some platforms, so we need a wrapper:
 int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev);
 
 #ifdef HAVE_GETPWENT



More information about the ghc-commits mailing list