Ping Re: [PATCH] Make bindresvport() function to multithread-safe

Florian Weimer fweimer@redhat.com
Mon Oct 15 14:41:00 GMT 2012


On 10/10/2012 08:54 AM, Andreas Schwab wrote:
> Peng Haitao <penght@cn.fujitsu.com> writes:
>
>> Can you tell me where I find restriction for bindresvport is not used
>> in multithread circumstance?
>
> bindresvport is not specified by POSIX, so it cannot be assumed to be
> thread-safe, unless there is a document stating that.

On the other hand, bindresvport doesn't take any argument and has no 
notion of an object on which it works, so there is no obvious location 
where to put the lock protecting it, and it is unlikely that two 
different libraries which call bindresvport have a way to agree on the 
lock to use.  So if it is acceptable at all to use bindresvport in 
multi-threaded programs, it has to perform locking internally.  (But 
this is purely a quality-of-implementation issue.)

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Libc-alpha mailing list