Semaphores in libc
Petr Baudis
pasky@suse.cz
Tue Jan 5 00:00:00 GMT 2010
On Mon, Jan 04, 2010 at 11:57:35AM -0600, Mark Brown wrote:
> All-
>
> > Petr Baudis <pasky@suse.cz>
>
> > mkdir() should be atomic, so each process will always pick a different
> > name.
>
>
> POSIX does not guarantee an atomic mkdir(). Section 2.9.7 of the System
> Interfaces volume of 1003.1-2008 will give you the list of
> "guaranteed-atomic" interfaces.
Yes, as I said, it isn't described as atomic, which I found curious.
A possible workaround might be to change the loop to pseudo-do
mkdir(...) && open(..."/.used", O_CREAT|O_EXCL)
Petr "Pasky" Baudis
More information about the Libc-help
mailing list