[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / lib / std / cbits / fileSize.lc
diff --git a/ghc/lib/std/cbits/fileSize.lc b/ghc/lib/std/cbits/fileSize.lc
deleted file mode 100644 (file)
index d610fdb..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-%
-% (c) The GRASP/AQUA Project, Glasgow University, 1994
-%
-\subsection[fileSize.lc]{hfileSize Runtime Support}
-
-\begin{code}
-
-#include "rtsdefs.h"
-#include "stgio.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-  
-StgInt
-fileSize(ptr, result)
-StgForeignObj ptr;
-StgByteArray result;
-{
-    IOFileObject* fo = (IOFileObject*)ptr;
-    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) {
-       /* highly unlikely */
-       if (errno != EINTR) {
-           cvtErrno();
-           stdErrno();
-           return -1;
-       }
-    }
-    if (S_ISREG(sb.st_mode)) {
-       /* result will be word aligned */
-       *(off_t *) result = sb.st_size;
-       return 0;
-    } else {
-       ghc_errtype = ERR_INAPPROPRIATETYPE;
-       ghc_errstr = "not a regular file";
-       return -1;
-    }
-}
-
-\end{code}