summaryrefslogtreecommitdiffstats
path: root/libc/stdio
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-19 15:16:51 -0800
committerElliott Hughes <enh@google.com>2014-11-19 15:16:51 -0800
commitc48c3e4bb3d1665f3e9fa2785daafa72dfe59399 (patch)
tree9a77515a49315acd7b7441349d5157597f2f76d8 /libc/stdio
parent27aa9c5b50cc3e979fc67c1bf5296dfd725c8540 (diff)
downloadbionic-c48c3e4bb3d1665f3e9fa2785daafa72dfe59399.tar.gz
bionic-c48c3e4bb3d1665f3e9fa2785daafa72dfe59399.tar.bz2
bionic-c48c3e4bb3d1665f3e9fa2785daafa72dfe59399.zip
Fix flockfile(3) and friends for stdin/stdout/stderr too.
stdin/stdout/stderr are special; their mutexes are initialized by __sinit. There's no unit test for this, because __sinit has already been called by the time the first unit test runs, but you could reproduce this failure with a trivial main() that calls flockfile or ftrylockfile on one of the standard streams before otherwise using stdio. Bug: 18208568 Change-Id: I28d232cf05a9f198a2bed61854d8047b23d2091d
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/fileext.h4
-rw-r--r--libc/stdio/glue.h6
-rw-r--r--libc/stdio/local.h4
-rw-r--r--libc/stdio/wcio.h6
4 files changed, 20 insertions, 0 deletions
diff --git a/libc/stdio/fileext.h b/libc/stdio/fileext.h
index dc89fff71..25b7bda24 100644
--- a/libc/stdio/fileext.h
+++ b/libc/stdio/fileext.h
@@ -34,6 +34,8 @@
#include <pthread.h>
+__BEGIN_DECLS
+
/*
* file extension
*/
@@ -61,4 +63,6 @@ do { \
_FILEEXT_INIT(f); \
} while (0)
+__END_DECLS
+
#endif /* _FILEEXT_H_ */
diff --git a/libc/stdio/glue.h b/libc/stdio/glue.h
index 4ead20a81..a9e5d1030 100644
--- a/libc/stdio/glue.h
+++ b/libc/stdio/glue.h
@@ -32,6 +32,10 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
/*
* The first few FILEs are statically allocated; others are dynamically
* allocated and linked in via this glue structure.
@@ -44,3 +48,5 @@ struct glue {
/* This was referenced by a couple of different pieces of middleware and the Crystax NDK. */
__LIBC64_HIDDEN__ extern struct glue __sglue;
+
+__END_DECLS
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index 13188ee1b..46b11f13a 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -41,6 +41,8 @@
#include "wcio.h"
#include "fileext.h"
+__BEGIN_DECLS
+
/*
* Android <= KitKat had getc/putc macros in <stdio.h> that referred
* to __srget/__swbuf, so those symbols need to be public for LP32
@@ -137,3 +139,5 @@ extern int __sfvwrite(FILE *, struct __suio *);
wint_t __fputwc_unlock(wchar_t wc, FILE *fp);
#pragma GCC visibility pop
+
+__END_DECLS
diff --git a/libc/stdio/wcio.h b/libc/stdio/wcio.h
index 584a3f209..2c1fa3c17 100644
--- a/libc/stdio/wcio.h
+++ b/libc/stdio/wcio.h
@@ -32,6 +32,10 @@
#ifndef _WCIO_H_
#define _WCIO_H_
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
/* minimal requirement of SUSv2 */
#define WCIO_UNGETWC_BUFSIZE 1
@@ -78,4 +82,6 @@ do {\
#define WCIO_INIT(fp) \
memset(&(_EXT(fp)->_wcio), 0, sizeof(struct wchar_io_data))
+__END_DECLS
+
#endif /*_WCIO_H_*/