[PATCH v4] Make bindresvport() function to multithread-safe

Peng Haitao penght@cn.fujitsu.com
Tue Oct 16 09:05:00 GMT 2012


On 09/29/2012 01:01 AM, Carlos O'Donell wrote:
> Could you please answer Roland's question here:
> http://sourceware.org/ml/libc-alpha/2012-09/msg00465.html
> "I don't see the rationale for requiring bindresvport to be thread-safe now."
> 

I do not find any rationale for requiring bindresvport to be thread-safe,
but I also can not find any restriction for bindresvport is not used
in multithread circumstance.

> More specifically can you explain *why* you need bindresvport to be
> thread-safe?
> 

When doing multithreaded programming, if misuse an unsafe function,
multithreaded programs may cause serious bug. In order to ensure the 
correctness of multithreaded programs, we want to make unsafe function to
multithread-safe,especially a function is not specified by POSIX or does
not comply with POSIX.


I will send v5 patch:
  - get_port() is replaced with __get_unique_id().
  - Add new file sysdeps/unix/sysv/linux/bindrsvprt.c and sysdeps/unix/sysv/linux/bindrsvprt.h

Please review, thanks.

-- 
Best Regards,
Peng



More information about the Libc-alpha mailing list