Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/a01e94d8ee25e6c5fdc2a466f650a0aa3a61c412

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

commit a01e94d8ee25e6c5fdc2a466f650a0aa3a61c412
Author: Ian Lynagh <[email protected]>
Date:   Sun Feb 26 16:07:03 2012 +0000

    Use CAPI for lseek

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

 System/Posix/Internals.hs |    7 +++++--
 include/HsBase.h          |   14 --------------
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs
index de02e72..d2bd0e6 100644
--- a/System/Posix/Internals.hs
+++ b/System/Posix/Internals.hs
@@ -416,10 +416,13 @@ foreign import ccall unsafe "HsBase.h isatty"
    c_isatty :: CInt -> IO CInt
 
 #if defined(mingw32_HOST_OS) || defined(__MINGW32__)
-foreign import ccall unsafe "HsBase.h __hscore_lseek"
+foreign import ccall unsafe "io.h _lseeki64"
    c_lseek :: CInt -> Int64 -> CInt -> IO Int64
 #else
-foreign import ccall unsafe "HsBase.h __hscore_lseek"
+-- We use CAPI as on some OSs (eg. Linux) this is wrapped by a macro
+-- which redirects to the 64-bit-off_t versions when large file
+-- support is enabled.
+foreign import capi unsafe "unistd.h lseek"
    c_lseek :: CInt -> COff -> CInt -> IO COff
 #endif
 
diff --git a/include/HsBase.h b/include/HsBase.h
index 1d669fd..ed99692 100644
--- a/include/HsBase.h
+++ b/include/HsBase.h
@@ -534,20 +534,6 @@ INLINE int __hscore_open(char *file, int how, mode_t mode) 
{
 }
 #endif
 
-// These are wrapped because on some OSs (eg. Linux) they are
-// macros which redirect to the 64-bit-off_t versions when large file
-// support is enabled.
-//
-#if defined(__MINGW32__)
-INLINE off64_t __hscore_lseek(int fd, off64_t off, int whence) {
-       return (_lseeki64(fd,off,whence));
-}
-#else
-INLINE off_t __hscore_lseek(int fd, off_t off, int whence) {
-       return (lseek(fd,off,whence));
-}
-#endif
-
 #if darwin_HOST_OS
 // You should not access _environ directly on Darwin in a bundle/shared 
library.
 // See #2458 and 
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to