4 ms·
One more: mkdir(2)
by samuel 17y ago
One more: mkdir(2)
- jrockway 17y agoHow would mkdir not be atomic? It is a logical operation that only encapsulates a single physical operation. Rename is an interesting case, because it encapsulates two operations - a copy and a delete. Doing two operations in one step is interesting atomicity. Doing one operation in one step (mkdir) is not as interesting.
- geocar 17y agoSee Phrack 25: http://www.phrack.com/issues.html?issue=25&id=5 http://www.phrack.com/issues.html?issue=25&id=5 for what it was like when mkdir was not atomic.
- skorgu 17y agomkdir can fail atomicity if non-local storage is involved: http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg20436.html http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg2... I still use it for the quick-and-dirty lockfile case despite this.