Expose renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, RENAME_EXCHANGE) to atomically
exchange two files.
Assuming you have the autotools and gcc installed:
$ ./autogen.sh && ./configure && make$ xchg /path/to/file1 /path/to/file2