[project @ 2001-04-02 16:10:32 by rrt]
authorrrt <unknown>
Mon, 2 Apr 2001 16:10:33 +0000 (16:10 +0000)
committerrrt <unknown>
Mon, 2 Apr 2001 16:10:33 +0000 (16:10 +0000)
Remove old mingwin kludgery; using the latest version of mingwin from CVS,
things now work.

ghc/lib/std/Directory.hsc
ghc/lib/std/cbits/fileSize.c
ghc/lib/std/cbits/getBufferMode.c
ghc/lib/std/cbits/getLock.c
ghc/lib/std/cbits/openFile.c
ghc/lib/std/cbits/seekFile.c
ghc/lib/std/cbits/setBuffering.c
ghc/lib/std/cbits/stgio.h

index 8ae71b8..7bae8e2 100644 (file)
@@ -1,5 +1,5 @@
 -- -----------------------------------------------------------------------------
--- $Id: Directory.hsc,v 1.9 2001/03/23 13:00:39 rrt Exp $
+-- $Id: Directory.hsc,v 1.10 2001/04/02 16:10:32 rrt Exp $
 --
 -- (c) The University of Glasgow, 1994-2000
 --
@@ -500,40 +500,24 @@ setPermissions name (Permissions r w e s) = do
 
 withFileStatus :: FilePath -> (Ptr CStat -> IO a) -> IO a
 withFileStatus name f = do
-#ifndef mingw32_TARGET_OS
     allocaBytes (#const sizeof(struct stat)) $ \p ->
-#else
-    allocaBytes (#const sizeof(struct _stati64)) $ \p ->
-#endif
       withUnsafeCString name $ \s -> do
         throwErrnoIfMinus1Retry_ "withFileStatus" (stat s p)
        f p
 
 modificationTime :: Ptr CStat -> IO ClockTime
 modificationTime stat = do
-#ifndef mingw32_TARGET_OS
     mtime <- (#peek struct stat, st_mtime) stat
-#else
-    mtime <- (#peek struct _stati64, st_mtime) stat
-#endif
     return (TOD (toInteger (mtime :: CTime)) 0)
 
 isDirectory :: Ptr CStat -> IO Bool
 isDirectory stat = do
-#ifndef mingw32_TARGET_OS
   mode <- (#peek struct stat, st_mode) stat
-#else
-  mode <- (#peek struct _stati64, st_mode) stat
-#endif
   return (s_ISDIR mode /= 0)
 
 isRegularFile :: Ptr CStat -> IO Bool
 isRegularFile stat = do
-#ifndef mingw32_TARGET_OS
   mode <- (#peek struct stat, st_mode) stat
-#else
-  mode <- (#peek struct _stati64, st_mode) stat
-#endif
   return (s_ISREG mode /= 0)
 
 foreign import ccall unsafe s_ISDIR :: CMode -> Int
index 86c55d9..02ad1d4 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: fileSize.c,v 1.6 2001/03/01 12:25:33 rrt Exp $
+ * $Id: fileSize.c,v 1.7 2001/04/02 16:10:32 rrt Exp $
  *
  * hClose Runtime Support
  */
@@ -21,14 +21,14 @@ StgInt
 fileSize(StgForeignPtr ptr, StgByteArray result)
 {
     IOFileObject* fo = (IOFileObject*)ptr;
-    struct Stat sb;
+    struct stat sb;
     int rc = 0;
 
     /* Flush buffer in order to get as an accurate size as poss. */
     rc = flushFile(ptr);
     if (rc < 0) return rc;
 
-   while (Fstat(fo->fd, &sb) < 0) {
+   while (fstat(fo->fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
@@ -55,14 +55,14 @@ StgInt
 fileSize_int64(StgForeignPtr ptr, StgByteArray result)
 {
     IOFileObject* fo = (IOFileObject*)ptr;
-    struct Stat sb;
+    struct stat sb;
     int rc = 0;
 
     /* Flush buffer in order to get as an accurate size as poss. */
     rc = flushFile(ptr);
     if (rc < 0) return rc;
 
-   while (Fstat(fo->fd, &sb) < 0) {
+   while (fstat(fo->fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
index c802909..8ce42f9 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: getBufferMode.c,v 1.4 2001/03/01 12:25:33 rrt Exp $
+ * $Id: getBufferMode.c,v 1.5 2001/04/02 16:10:32 rrt Exp $
  *
  * hIs...Buffered Runtime Support
  */
@@ -32,11 +32,11 @@ getBufferMode(ptr)
 StgForeignPtr ptr;
 {
     IOFileObject* fo = (IOFileObject*)ptr;
-    struct Stat sb;
+    struct stat sb;
     int fd = fo->fd;
 
     /* Try to find out the file type */
-    while (Fstat(fd, &sb) < 0) {
+    while (fstat(fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
index 143da77..7a82fbe 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: getLock.c,v 1.8 2001/03/01 12:25:33 rrt Exp $
+ * $Id: getLock.c,v 1.9 2001/04/02 16:10:32 rrt Exp $
  *
  * stdin/stout/stderr Runtime Support
  */
@@ -48,9 +48,9 @@ int for_writing;
 int exclusive;
 {
     int i;
-    struct Stat sb;
+    struct stat sb;
 
-    while (Fstat(fd, &sb) < 0) {
+    while (fstat(fd, &sb) < 0) {
        if (errno != EINTR) {
 #ifndef _WIN32
            return -1;
index 5ce3340..e2829ff 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: openFile.c,v 1.19 2001/03/01 12:25:33 rrt Exp $
+ * $Id: openFile.c,v 1.20 2001/04/02 16:10:33 rrt Exp $
  *
  * openFile Runtime Support
  */
@@ -79,7 +79,7 @@ openFile(StgByteArray file, StgInt how, StgInt binary)
     int oflags;
     int for_writing;
     int created = 0;
-    struct Stat sb;
+    struct stat sb;
     IOFileObject* fo;
     int flags = 0;
 
@@ -136,7 +136,7 @@ openFile(StgByteArray file, StgInt how, StgInt binary)
            } else {
                /* If it is a dangling symlink, break off now, too. */
 #ifndef mingw32_TARGET_OS
-               struct Stat st;
+               struct stat st;
                if ( lstat(file,&st) == 0) {
                   ghc_errtype = ERR_NOSUCHTHING;
                   ghc_errstr = "dangling symlink";
@@ -193,7 +193,7 @@ openFile(StgByteArray file, StgInt how, StgInt binary)
 
     /* Make sure that we aren't looking at a directory */
 
-    while (Fstat(fd, &sb) < 0) {
+    while (fstat(fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
index 16f7618..954152f 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: seekFile.c,v 1.6 2001/03/01 12:25:33 rrt Exp $
+ * $Id: seekFile.c,v 1.7 2001/04/02 16:10:33 rrt Exp $
  *
  * hSeek and hIsSeekable Runtime Support
  */
@@ -22,7 +22,7 @@ StgInt
 seekFile(StgForeignPtr ptr, StgInt whence, StgInt size, StgByteArray d)
 {
     IOFileObject* fo = (IOFileObject*)ptr;
-    struct Stat sb;
+    struct stat sb;
     off_t offset;
     int posn_delta =0;
     int rc = 0;
@@ -84,7 +84,7 @@ seekFile(StgForeignPtr ptr, StgInt whence, StgInt size, StgByteArray d)
     if (rc < 0) return rc;
 
     /* Try to find out the file type */
-    while (Fstat(fo->fd, &sb) < 0) {
+    while (fstat(fo->fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
@@ -114,7 +114,7 @@ StgInt
 seekFile_int64(StgForeignPtr ptr, StgInt whence, StgInt64 d)
 {
     IOFileObject* fo = (IOFileObject*)ptr;
-    struct Stat sb;
+    struct stat sb;
     off_t offset = d;
     int posn_delta =0;
     int rc = 0;
@@ -154,7 +154,7 @@ seekFile_int64(StgForeignPtr ptr, StgInt whence, StgInt64 d)
     if (rc < 0) return rc;
 
     /* Try to find out the file type & size for a physical file */
-    while (Fstat(fo->fd, &sb) < 0) {
+    while (fstat(fo->fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
@@ -183,10 +183,10 @@ StgInt
 seekFileP(StgForeignPtr ptr)
 {
     IOFileObject* fo = (IOFileObject*)ptr;
-    struct Stat sb;
+    struct stat sb;
 
     /* Try to find out the file type */
-    while (Fstat(fo->fd, &sb) < 0) {
+    while (fstat(fo->fd, &sb) < 0) {
        /* highly unlikely */
        if (errno != EINTR) {
            cvtErrno();
index 6bc943a..14f73d4 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
  *
- * $Id: setBuffering.c,v 1.11 2001/03/01 12:25:33 rrt Exp $
+ * $Id: setBuffering.c,v 1.12 2001/04/02 16:10:33 rrt Exp $
  *
  * hSetBuffering Runtime Support
  */
@@ -38,7 +38,7 @@ setBuffering(StgForeignPtr ptr, StgInt size)
 #ifndef mingw32_TARGET_OS
     struct termios tio;
 #endif
-    struct Stat sb;
+    struct stat sb;
 
     /* First off, flush old buffer.. */
     if ( (fo->flags & FILEOBJ_WRITE) ) {
@@ -100,7 +100,7 @@ setBuffering(StgForeignPtr ptr, StgInt size)
     case SB_BB:
 
 #ifdef HAVE_ST_BLKSIZE
-       while (Fstat(fo->fd, &sb) < 0) {
+       while (fstat(fo->fd, &sb) < 0) {
           /* not very likely.. */
           if ( errno != EINTR ) {
              cvtErrno();
index 64cf6a2..9734281 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: stgio.h,v 1.27 2001/03/01 12:25:33 rrt Exp $
+ * $Id: stgio.h,v 1.28 2001/04/02 16:10:33 rrt Exp $
  *
  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1999
  *
 #include "stgerror.h"
 #include "fileObject.h"
 
-/* Fix for mingwin stat */
-#ifdef mingw32_TARGET_OS
-/* Need to #define __MSVCRT__ to get these versions, but in order to do this
-   early enough it's done in Stg.h (included by Rts.h) */
-#define Stat _stati64
-#define Fstat _fstati64
-#else
-#define Stat stat
-#define Fstat fstat
-#endif
-
-/* Function prototypes for the I/O subsytem...
- */
+/* Function prototypes for the I/O subsytem... */
 
 /* closeFile.c */
 StgAddr allocMemory__ (StgInt);