Mail Archives: djgpp-workers/2001/06/17/14:20:09
> We pass the call to the OS. What happens next is entirely up to the
> OS. NT behaves like a Unix filesystem. I'd expect W2K to do the
> same, but I think we had better test this first, since we already have
> quite a few aspects where W2K behaves differently from NT (to the
> worse :-().
Ah - ok. Updated docs patch below.
> > so I went with a loop (seemed safe enough).
> Not for buffered stdio streams: you could lose the buffered
> characters.
Oops.
> (I assume that _fcloseall, given its name, does an
> `fclose' on every FILE object that is still open.)
That's what its docs say - it closes all files, except for stdin, stdout
and stderr (and on DOS stdaux and stdprn).
> _fwalk walks all
> the FILE objects and fflushes them before closing, not just closes the
> handle.
Will look into it. This would not catch files opened with regular open()
though, would it? And are stdin/stdout/stderr part of the list of
FILE*s walked by _fwalk?
Index: unlink.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/unlink.txh,v
retrieving revision 1.2
diff -u -u -r1.2 unlink.txh
--- unlink.txh 1998/09/27 15:22:28 1.2
+++ unlink.txh 2001/06/17 18:09:55
@@ -11,6 +11,19 @@
This function removes a file from the file system.
+@subheading Caveat
+
+The @sc{posix} specification requires this removal to be delayed until the
+file is no longer open. Due to problems with the underlying operating
+systems, this implementation of @code{unlink} does not fully comply with
+the specs; if the file you want to unlink is open, you're asking for
+trouble - how much trouble depends on the underlying OS. On NT (and
+possibly on 2000 as well), you get the behaviour @sc{posix} expects.
+On Win9x and WinME (and possibly WinXP as well), the removal will simply
+fail (@code{errno} gets set to @code{EACCES}). On DOS, removing an
+open file could lead to filesystem corruption if the removed file is
+written to before it's closed.
+
@subheading Return Value
Zero on success, nonzero on failure.
@@ -18,6 +31,7 @@
@subheading Portability
@portability !ansi, posix
+@port-note Not fully compliant with the POSIX specification (cfr. supra).
@subheading Example
- Raw text -