views:

54

answers:

1

on Linux ext3 filesystem, what happens if mv() is called on the same file (file descriptor) while reading the file? It is actually an exam question and I can only say something like:

  1. CPU traps OS for interrupt handling
  2. etc, etc.

I would appreciate if OS guys out there can help me out, please :D

+2  A: 

Linux rename man page:

That explains most of the details of this.

If one or more processes have the file open when the last link is removed,
the link shall be removed before rename() returns, but the removal of the
file contents shall be postponed until all references to the file are closed. 
WhirlWind
Thanks WhirlWind!!!, my experiment seems to be consistent with this :D
K'