Changing the filename of a memory mapped file
Is it possible to cha开发者_如何学JAVAnge the name of an already open memory mapped file, or, do I need to close it, rename it and then mmap it again?
Renaming a file while it is open is fine, regardless of whether it is mmaped or not.
In UNIX-like systems, the concept of the file itself is distinct from the name (which is called a "link"). A file may have zero, one, or many separate names. When you have a file open, it is the file itself that you have a reference to - it's OK to change or remove the name (and the file will remain open).
精彩评论