This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Thread-safe creation of UNIX domain sockets
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: "Florian Weimer" <fw at deneb dot enyo dot de>
- Cc: libc-help at sourceware dot org
- Date: Tue, 30 Dec 2008 11:23:43 -0500
- Subject: Re: Thread-safe creation of UNIX domain sockets
- References: <87y6y1afih.fsf@mid.deneb.enyo.de>
On Sat, Dec 27, 2008 at 8:56 AM, Florian Weimer <fw@deneb.enyo.de> wrote:
> Is it possible to create UNIX domain sockets with specific file system
> permissions in a thread-safe way?
>
> In a single-threaded program, it's possible to set the umask to 0777,
> create the socket, restore the umask, and chmod the path to the
> intended permission set. In a multi-threaded program, this is
> obviously racy.
Please explain the race condition, and why the obvious synchronization
primitives don't help.
Cheers,
Carlos.