delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/17/07:25:01

From: "Tim Van Holder" <tim DOT van DOT holder AT pandora DOT be>
To: <djgpp-workers AT delorie DOT com>
Subject: Re: Our unlink() isn't POSIX
Date: Sun, 17 Jun 2001 13:25:49 +0200
Message-ID: <CAEGKOHJKAAFPKOCLHDIGEFNCEAA.tim.van.holder@pandora.be>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
In-Reply-To: <Pine.SUN.3.91.1010617130917.12677A-100000@is>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> The results of deleting an open file depend on the underlying OS: Windows
> NT actually supports the Posix behavior; Windows 9X refuses to remove the
Does that mean that our unlink/rename follow Posix on NT/2000, or is it
simply that NT/2000 supports the behaviour?

In any case, I'll have to stick to the very ugly

  for (i = 3; i < 256; ++i)
    close (i);

before the cleanup function (on Win32, _fcloseall() is used, which I assume
does mainly the same thing).

Patch for the docs follows.

Index: src/libc/posix/unistd/unlink.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/unlink.txh,v
retrieving revision 1.2
diff -u -r1.2 unlink.txh
--- src/libc/posix/unistd/unlink.txh    1998/09/27 15:22:28     1.2
+++ src/libc/posix/unistd/unlink.txh    2001/06/17 11:23:29
@@ -10,6 +10,11 @@
 @subheading Description

 This function removes a file from the file system.
+The @sc{posix} specification requires this removal to be delayed until the
+file is no longer open.  Because this is not feasible on most systems
+supported by DJGPP (Windows NT and 2000 being the exceptions), this
+implementation of @code{unlink} does not fully comply with the specs; if
+the file you want to unlink is open, @code{unlink} will fail.

 @subheading Return Value

@@ -18,6 +23,7 @@
 @subheading Portability

 @portability !ansi, posix
+@port-note Not fully compliant with the POSIX specification (cfr. supra).

 @subheading Example

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019