Home GnuPG
Diffusion nPth 575573b5b63e

Limit exposing rwlock API on GNU/Linux.

Description

Limit exposing rwlock API on GNU/Linux.

* configure.ac (INSERT_EXPOSE_RWLOCK_API): New.
* src/npth.h.in: Use INSERT_EXPOSE_RWLOCK_API.
* tests/Makefile.am (AM_CPPFLAGS): Remove _POSIX_C_SOURCE.

Npth has rwlock implementation and offers its API. It uses Pthread's
rwlock API if available.

On GNU/Linux, Pthread's rwlock API is only exposed when using newer
POSIX API. Because of this, we had -D_POSIX_C_SOURCE=200112L for our
test programs (for the case using c99 executable, where the API is not
exposed).

This suggests that using Npth requires newer POSIX API. It's not the
case, actually.

The right solution here is to limit exposing nPth's rwlock API, when
older API is selected, just like Pthread's rwlock API. Then, Npth can
be used for building program with older API.

Also, by removing -D_POSIX_C_SOURCE=200112L, it fixes build breakage
on Solaris 11.

  • GnuPG-bug-id: T4491
  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>