Bug 8896 - Enabling UCLIBC_HAS_STDIO_FUTEXES not properly exposed to clients
Summary: Enabling UCLIBC_HAS_STDIO_FUTEXES not properly exposed to clients
Status: NEW
Alias: None
Product: uClibc
Classification: Unclassified
Component: Threads (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-27 22:55 UTC by Michael Tautschnig
Modified: 2016-04-27 22:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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