[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / runtime / io / closeFile.lc
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
3 %
4 \subsection[closeFile.lc]{hClose Runtime Support}
5
6 \begin{code}
7
8 #include "rtsdefs.h"
9 #include "stgio.h"
10
11 StgInt
12 closeFile(fp)
13 StgAddr fp;
14 {
15     int rc;
16
17     unlockFile(fileno((FILE *) fp));
18
19     while ((rc = fclose((FILE *) fp)) != 0) {
20         if (errno != EINTR) {
21             cvtErrno();
22             stdErrno();
23             return rc;
24         }
25     }
26     return 0;
27 }
28
29 \end{code}
30
31
32