diff options
Diffstat (limited to 'ghc/runtime/io/closeFile.lc')
-rw-r--r-- | ghc/runtime/io/closeFile.lc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ghc/runtime/io/closeFile.lc b/ghc/runtime/io/closeFile.lc new file mode 100644 index 0000000000..f3efb3488d --- /dev/null +++ b/ghc/runtime/io/closeFile.lc @@ -0,0 +1,32 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[closeFile.lc]{hClose Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" + +StgInt +closeFile(fp) +StgAddr fp; +{ + int rc; + + unlockFile(fileno((FILE *) fp)); + + while ((rc = fclose((FILE *) fp)) != 0) { + if (errno != EINTR) { + cvtErrno(); + stdErrno(); + return rc; + } + } + return 0; +} + +\end{code} + + + |