Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Ts'o: Delayed allocation and the zero-length file problem
Posted Mar 13, 2009 20:25 UTC (Fri) by alexl (subscriber, #19068)
fd2=openat(fd1, NULL, O_CREAT) // Creates an unlinked file
flinkat(fd1, fd2, basename(file)) // Should guarantee fd2 is written to disk before linking.
This seems race free:
doesn't break if the directory is moved during write
doesn't let other apps see or modify the temp file while writing
doesn't leave a broken tempfile around on app crash
doesn't end up with an empty file on system crash
Posted Mar 14, 2009 1:41 UTC (Sat) by dcoutts (guest, #5387)
Posted Mar 15, 2009 23:25 UTC (Sun) by halfline (guest, #31920)
Posted Mar 21, 2009 0:34 UTC (Sat) by spitzak (guest, #4593)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds