Bug 8896

Summary: Enabling UCLIBC_HAS_STDIO_FUTEXES not properly exposed to clients
Product: uClibc Reporter: Michael Tautschnig <mt>
Component: ThreadsAssignee: unassigned
Status: NEW ---    
Severity: normal CC: uclibc-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Host: Target:
Build:

Description Michael Tautschnig 2016-04-27 22:55:42 UTC
Compiling with futexes enabled will cause inconsistencies as clients will not and cannot use them:

bits/uClibc_config.h:#define __UCLIBC_HAS_STDIO_FUTEXES__ 1

but

bits/uClibc_stdio.h uses the following:

#if defined __UCLIBC_HAS_THREADS__ && !defined __UCLIBC_IO_MUTEX
/* keep this in sync with uClibc_mutex.h */
# ifdef __USE_STDIO_FUTEXES__
#  include <bits/stdio-lock.h>
#  define __UCLIBC_IO_MUTEX(M) _IO_lock_t M
# else
#  include <bits/pthreadtypes.h>
#  define __UCLIBC_IO_MUTEX(M) pthread_mutex_t M
# endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
#endif

with

1. __USE_STDIO_FUTEXES__ is never defined
2. bits/stdio-lock.h is not installed

Consequently the definitions of __UCLIBC_IO_MUTEX vary, and therefore struct __STDIO_FILE_STRUCT's __lock member is completely different, also causing a difference in the size of the struct. Arrays of FILEs will be misaligned.

Best,
Michael