Use C wrappers for lseek() and open(). On Linux, these functions are
macro'd to different versions when large file support is on, so to
make the libraries compilable with the NCG we need to use C wrappers
for these functions.
foreign import ccall unsafe "HsBase.h isatty"
c_isatty :: CInt -> IO CInt
foreign import ccall unsafe "HsBase.h isatty"
c_isatty :: CInt -> IO CInt
-foreign import ccall unsafe "HsBase.h lseek"
+foreign import ccall unsafe "HsBase.h __hscore_lseek"
c_lseek :: CInt -> COff -> CInt -> IO COff
foreign import ccall unsafe "HsBase.h __hscore_lstat"
lstat :: CString -> Ptr CStat -> IO CInt
c_lseek :: CInt -> COff -> CInt -> IO COff
foreign import ccall unsafe "HsBase.h __hscore_lstat"
lstat :: CString -> Ptr CStat -> IO CInt
-foreign import ccall unsafe "HsBase.h open"
+foreign import ccall unsafe "HsBase.h __hscore_open"
c_open :: CString -> CInt -> CMode -> IO CInt
foreign import ccall unsafe "HsBase.h opendir"
c_open :: CString -> CInt -> CMode -> IO CInt
foreign import ccall unsafe "HsBase.h opendir"
foreign import ccall unsafe "HsBase.h read"
c_read :: CInt -> Ptr CChar -> CSize -> IO CSsize
foreign import ccall unsafe "HsBase.h read"
c_read :: CInt -> Ptr CChar -> CSize -> IO CSsize
-foreign import ccall unsafe "HsBase.h readdir"
- c_readdir :: Ptr CDir -> IO (Ptr CDirent)
-
foreign import ccall unsafe "dirUtils.h __hscore_renameFile"
c_rename :: CString -> CString -> IO CInt
foreign import ccall unsafe "dirUtils.h __hscore_renameFile"
c_rename :: CString -> CString -> IO CInt
INLINE int __hsposix_SIG_SETMASK() { return SIG_SETMASK; }
#endif /* mingw32_TARGET_OS */
INLINE int __hsposix_SIG_SETMASK() { return SIG_SETMASK; }
#endif /* mingw32_TARGET_OS */
+// These two 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.
+//
+INLINE int __hscore_open(char *file, int how, mode_t mode) {
+ return (open(file,how,mode));
+}
+
+INLINE off_t __hscore_lseek(int fd, off_t off, int whence) {
+ return (lseek(fd,off,whence));
+}
+
#endif /* __HSBASE_H__ */
#endif /* __HSBASE_H__ */