2010-05-14 66 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