[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] pipe2: document lack of thread-safety in replacement

From: Eric Blake
Subject: Re: [PATCH] pipe2: document lack of thread-safety in replacement
Date: Thu, 26 Jan 2012 13:26:56 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/26/2012 12:26 PM, Eric Wong wrote:
> I can't think of a safe way to implement
> SOCK_CLOEXEC/SOCK_NONBLOCK/O_CLOEXEC as-is in gnulib and have it be
> forward-compatible.  If we expose the flags in public headers, the OS
> authors can eventually add support for these things and the native OS
> flags may be incompatible with what gnulib uses.

The same as we've done for other flags (for example, we've implemented
O_NONBLOCK for mingw).  Basically, if we detect at configuration time
that the system didn't have a flag, then we define an unused bit for the
flag and also define a witness that gnulib owns the bit; then in our
rpl_accept4 function, that witness means that we must strip the bit
before calling the underlying function, as well as do the touch-up work.
 If the OS later defines the flags, we're still okay, whether or not the
OS flag matches our bit definition or not - either you
reconfigure/recompile the app (and pick up the OS definition), or you
continue to pick up the gnulib headers (and get the gnulib bit which
never gets propagated to the OS).

> Maybe new functions taking gnulib-specific flags will have to be
> created...

To some extent, that's what we're already doing - gnulib wires
everything through its own replacements, then makes the headers hide the
fact that replacements are in use so that the rest of the code can use
the normal signatures, as long as they are careful about the caveats
such as no atomic FD_CLOEXEC.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]