http://bugs.winehq.org/show_bug.cgi?id=12401
--- Comment #37 from Erich Hoover ehoover@mines.edu 2012-07-17 10:31:31 CDT --- (In reply to comment #36)
I'm not sure if it's the right way to get a new function into linux. What about the other systems? What about older systems?
Maybe a wine internal lock should be enough, every other case seems not that likely to happen.
Ok, so I've been thinking about this a bit (a poorly thought idea is unlikely to make it into the kernel) and I have a thought that I'd like everyone's feedback on.
My thought is to make a "fileswap()" routine that is similar to rename() but is intended to atomically swap out two files. This way the feature can be useful to a large class of applications and still provide us with the functionality that we need. I'm thinking that from a user-space perspective it would operate like so: --- int fileswap(const char *patha, const char *pathb, int flags); --- where "flags" would have some options to allow requiring both paths to be files, both paths to be directories, or one path to be a directory and one to be a symlink to a directory. Another couple of flags would be for deleting either "patha" or "pathb" after the swap has been completed.
I think this approach should also lend itself toward the creation of libs/port/fileswap.c, allowing us to kludge together a solution for other systems (suggested by Dan). What do you guys think?