Jaco Carlson wrote:
Can you safely delete all files in /tmp?


Yes.

Any files which are still in use will be in an OPEN status.
The process which has the file open will have a handle to
the file, and accesses the file through the handle (not
the pathname).

When you remove files, what actually happens is that the
file is unlinked from the directory it is in (its directory
entry is removed)....however, since it still has an open
reference, its disk blocks will not be re-allocated until
all processes which have an open file handle close their
handles to the file.

This functionality is actually used by some programmers --
they will open() a new file in /tmp (which creates a pathname
/tmp/somefilename), then they remove the file (while still
having the open file handle).  This effectively hides the
file from practically everything on the system -- it's a
way of preventing a tmp file from accidentally being
corrupted by ANY other processs (other than a super-user
process writing out in kernal memory).


All other files, which do NOT currently have an open
file handle will be removed and re-allocated to the
free list just as you would expect.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to