[Oberon] Oakwood Files.Delete

Claudio Nieder private at claudio.ch
Tue Jul 23 19:54:58 CEST 2019


Hi,

I do not know how it is in Windows, but this is actually how Unix (and thus Linux) has always treated files. And indeed one can write in Unix a program which opens a file and immediately performs an unlink and the file is sort of invisible in the sense, that there is no directory entry for it anymore. But as long as the process which created the file still has it open it can write and read from it.

No it is not copied to tmp or RAM or so. It sill occupies blocks on the disk on which it was created. But only the process that opened it can read and write to it or child processes to which the filehandle was passed on when fork was called.

Now at this point I am unsure if it is enough that one of the processes performs a close on the file or if all (in case of inheritance to child processes) need to close it (termination of the process will close it implicetly). Anyway once the condition is reached, that the filehandle is regarded as not valid anymore, only then the disk space occupied by the file is freed.

To make it clear: the unlink method in Linux and as I read your description the same is true for the Oberon Delete method, they do not remove the file content itself nor do they even mark the blocks occupied by the file as free. They only remove from the directory the entry for the file. That is done by the / some sort of garbage collector who marks the file blocks as free once it has detected that there is no reference to it anymore.

claudio

> On 23. Jul. 2019, at 18:50, Arthur Yefimov <artur.efimov at gmail.com> wrote:
> 
> In the Oakwood guidelines for Oberon-2 (1995),
> in section 1.2.5.2 Operations on files and the file
> directory, one can read the following:
> 
> "Delete(fn, res) removes the directory entry for the file fn
> without deleting the file. If res=0
> the file has been successfully deleted. If there
> are variables referring to the file while
> Delete is called, they can still be used."
> 
> How can I delete a file from a file system directory on
> Windows or Linux without deleting it on the actual disk?
> How can a file then be deleted from the disk?
> Does this mean that if I open a file with Old, and then
> call Delete, the file should be copied to /tmp, or does
> it mean it should be loaded into RAM?
> 
> Kind regards,
> Arthur Yefimov
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list