locking files

Erno Kuusela erno-news at erno.iki.fi
Thu Feb 22 23:18:24 EST 2001


In article <mailman.982900205.13479.python-list at python.org>, "Chris
Gonnerman" <chris.gonnerman at usa.net> writes:

| on Unix/Linux/BSD etc.  it is the combination of link() and unlink()
| system calls, so that for a moment the file has two names.

at least on linux rename is a syscall, and the man page seems
to say that the operation will be atomic if the destination
path doesn't exist.

| Also, on Unixoid OS's, if process A
| has a file open and process B renames it, process A still has the same file
| (inode) open and doesn't know about the rename... EXCEPT if the
| file is on a remote NFS file system, in which case process A will either
| start getting errors or have "undefined behavior" when it tries to use the
| "open" file.  On Windoze, you may be prevented from renaming the file
| if it is open in another process, or you may succeed and cause the other
| process to have errors.

well, nfs doesn't pretend to offer unix filesystem semantics anyway,
usually it's not necessary to worry about how things work with it.

  -- erno



More information about the Python-list mailing list