This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v4] Make bindresvport() function to multithread-safe
- From: Peng Haitao <penght at cn dot fujitsu dot com>
- To: "Carlos O'Donell" <carlos at systemhalted dot org>
- Cc: Roland McGrath <roland at hack dot frob dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 16 Oct 2012 17:04:31 +0800
- Subject: Re: [PATCH v4] Make bindresvport() function to multithread-safe
- References: <1348823725-18793-1-git-send-email-penght@cn.fujitsu.com> <CAE2sS1hJLkePJXMw8wCXQ48einUnvjPSbjX11LMzCVvT3i3zZg@mail.gmail.com> <5065B74C.8090704@redhat.com> <5065B818.2020908@systemhalted.org> <5065C207.2020709@redhat.com> <CAE2sS1jK77AOr9dUP+1ri_aNxHQxajruxOTF3yydZ7hOJ2wW4A@mail.gmail.com> <5065C886.6020909@redhat.com> <CAE2sS1jL=3PgZJogO1rvL5LQBgt37RWEcYs9hQ-MRSak3JZN1w@mail.gmail.com> <20120928162506.8A2572C074@topped-with-meat.com> <CAE2sS1hkkUBxssFOGc0oghKLc+Syc6KG8-T9o8TOEwaL9dGjoA@mail.gmail.com> <20120928163408.874942C091@topped-with-meat.com> <CAE2sS1iwLkNYRVu8S+shHNdvaX-mND6zYQxtipkXnxTk4OK8bw@mail.gmail.com>
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