在Linux 2.6内核和NFSv3中,
open("fname", O_CREAT|O_EXCL)
何时变得有效?当前的规范open(2)
系统调用文档(http://www.kernel.org/doc/man-pages/online/pages/man2/open.2.html)表示一切正常。 - O_EXCL
- ...
On NFS, O_EXCL is only supported when using NFSv3 or later on kernel
2.6 or later. In NFS environments where O_EXCL support is not
provided, programs that rely on it for performing locking tasks will
contain a race condition. Portable programs that want to perform
atomic file locking using a lockfile, and need to avoid reliance on NFS
support for O_EXCL, can ...
这篇文章表明所有2.6内核都是可以使用的,但是changelog(晚于内核2.6.23版本)中显示了该内核的有效性是在2.6.0发布四年后才开始的,并且网络上充斥着用户在过去一两年中对此使用的谴责。我想在RHEL 5(2.6.18)系统上使用这个设置,但是我无法确定何时它真正变得安全。有人有一个明确的答案吗?
std::fstream::fstream(char const *, ios_base::openmode)
的问题提问,我希望 C 标准库也是公开的,甚至是关于非 POSIX 选项的。 - Jeff