2 * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
4 * $Id: fileSize.c,v 1.1 1998/04/10 10:54:27 simonm Exp $
6 * hClose Runtime Support
12 #ifdef HAVE_SYS_TYPES_H
13 #include <sys/types.h>
16 #ifdef HAVE_SYS_STAT_H
21 fileSize(StgAddr fp, StgByteArray result)
25 while (fstat(fileno((FILE *) fp), &sb) < 0) {
33 if (S_ISREG(sb.st_mode)) {
34 /* result will be word aligned */
35 *(off_t *) result = sb.st_size;
38 ghc_errtype = ERR_INAPPROPRIATETYPE;
39 ghc_errstr = "not a regular file";