2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
4 \subsection[fileSize.lc]{hfileSize Runtime Support}
11 #ifdef HAVE_SYS_TYPES_H
12 #include <sys/types.h>
15 #ifdef HAVE_SYS_STAT_H
24 IOFileObject* fo = (IOFileObject*)ptr;
28 /* Flush buffer in order to get as an accurate size as poss. */
30 if (rc < 0) return rc;
32 while (fstat(fo->fd, &sb) < 0) {
40 if (S_ISREG(sb.st_mode)) {
41 /* result will be word aligned */
42 *(off_t *) result = sb.st_size;
45 ghc_errtype = ERR_INAPPROPRIATETYPE;
46 ghc_errstr = "not a regular file";