2010-05-14 54 views
1

on Linux ext3 filesystem,如果在读取文件时在同一文件(文件描述符)上调用mv()会发生什么?它实际上是一个考试问题,我只能这样说:mv()while reading

  1. CPU陷阱OS中断处理
  2. 等,等

我希望如果OS的球员,有可以帮助我出,请:d

+2

这是'mv()'应该是一个标准的库函数或shell命令或什么? – 2010-05-14 19:54:52

+0

给我一个codez – Jason 2010-05-14 19:56:48

+3

当你尝试它时发生了什么? – 2010-05-14 19:57:46

回答

3

Linux rename man page:

这就解释了大部分的这一细节。

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. 
+0

感谢WhirlWind !!!,我的实验似乎与此一致:D – Khiet 2010-05-16 17:51:38