[lkml]   [2002]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: rm-ing files with open file descriptors
In article <>,
Richard B. Johnson <> wrote:
>This is a characteristic of a VFS (Virtual File System) on any
>Unix system. The file doesn't go away until it is closed by
>everybody that accesses it. However, you can remove or rename it
>even when it's open for write by other tasks. If a task has an
>open file-descriptor and keeps it open, it could 'fix' a possibly
>deleted file, by opening it again with
> new_fd = open("filename", O_CREAT|O_RDWR, 0644);
>(without O_TRUNC) and it will remain in existance after all
>file descriptors are closed, because it was "created" again
>after it was deleted by another task.

Well no. new_fd will refer to a completely new, empty file
which has no relation to the old file at all.

There is no way to recreate a file with a nlink count of 0,
well that is until someone adds flink(fd, newpath) to the kernel.

You're a regular on this list, frankly I'm amazed that you
don't know this ?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:15    [W:0.222 / U:5.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site