>>>>> Victor Wagner <[email protected]> writes:
[…]
> Кроме уже рассмотренного системного вызова unlink(2) есть еще вызов
> rename(2). Он отличается тем, что работает атомарно. Поэтому если
> записать файл на диск под именем something.tmp а потом удалить старый
> something и переименовать something.tmp в something, время когда на
> диске не существует корректного файла c именем something (либо
> старого, либо нового) будет минимальным.
Нулевым, если говорить об ФС. (Состояние /диска/ может и не
быть целостным.) С поправкой на то, что явный unlink на новое
имя перед вызовом rename не требуется.
--cut: http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html --
[…] If the link named by the new argument exists, it shall be
removed and old renamed to new. In this case, a link named new shall
remain visible to other processes throughout the renaming operation
and refer either to the file referred to by new or old before the
operation began.
--cut: http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html --
--
FSF associate member #7257
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]