[lxc-devel] [PATCH] Use pthread_atfork() to unlock mutexes after fork()

Andrey Mazo mazo at telum.ru
Mon Jan 13 14:32:04 UTC 2014


Hmm, it looks quite strange.
pthread_atfork() seems to be implemented in bionic since 2010 [1] and according to [2] is available starting Android 2.3.

[1] https://android.googlesource.com/platform/bionic.git/+/4f086aeb4aa06e13079b7fec71a8178ceeacf318
[2] https://android.googlesource.com/platform/bionic.git/+/ead7819f51493eb67bfeef318caff7e2a8eb7259%5E/libc/docs/CHANGES.TXT

On Thu, 02 Jan 2014 01:11:20 +0400, Stéphane Graber <stgraber at ubuntu.com> wrote:

> This patch caused a build failure on Android:
>
> arm-linux-androideabi-gcc --sysroot=/tmp/android-build-scripts/android-ndk-r9b/platforms/android-9/arch-arm/ -DHAVE_CONFIG_H -I. -I../../src    -fPIC -DPIC -I../../src -DLXCROOTFSMOUNT=\"/data/lxc/lxc/lib/lxc/rootfs\" -DLXCPATH=\"/data/lxc/lxc/var/lib/lxc\" -DLXC_GLOBAL_CONF=\"/data/lxc/lxc/etc/lxc/lxc.conf\" -DLXCINITDIR=\"/data/lxc/lxc/libexec\" -DLXCTEMPLATEDIR=\"/data/lxc/lxc/share/lxc/templates\" -DLOGPATH=\"/data/lxc/lxc/var/log/lxc\" -DLXC_DEFAULT_CONFIG=\"/data/lxc/lxc/etc/lxc/default.conf\" -DLXClxclock.c: In function 'process_lock_setup_atfork':
> lxclock.c:332:2: error: implicit declaration of function 'pthread_atfork' [-Werror=implicit-function-declaration]
>   pthread_atfork(process_lock, process_unlock, process_unlock);
>   ^
> cc1: all warnings being treated as errors
> make[3]: *** [liblxc_so-lxclock.o] Error 1
> make[3]: Leaving directory `/tmp/android-build-scripts/lxc/src/lxc'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `/tmp/android-build-scripts/lxc/src'
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/tmp/android-build-scripts/lxc/src'
> make: *** [all-recursive] Error 1
>
> It looks like pthread_atfork doesn't exist in bionic.
>
> On Wed, Jan 01, 2014 at 01:52:33PM -0600, Serge Hallyn wrote:
>> Quoting Andrey Mazo (mazo at telum.ru):
>> > Signed-off-by: Andrey Mazo <mazo at telum.ru>
>> > ---
>> >  src/lxc/Makefile.am    |  3 ++-
>> >  src/lxc/attach.c       |  2 --
>> >  src/lxc/bdev.c         | 13 -------------
>> >  src/lxc/lxccontainer.c |  4 ----
>> >  src/lxc/lxclock.c      | 23 ++++++++++++++++++++++-
>> >  src/lxc/monitor.c      |  1 -
>> >  6 files changed, 24 insertions(+), 22 deletions(-)
>> >
[snip]

-- 
Andrey Mazo.


More information about the lxc-devel mailing list