diff options
Diffstat (limited to 'libc/stdio')
-rw-r--r-- | libc/stdio/__fsetlocking.c | 3 | ||||
-rw-r--r-- | libc/stdio/_fopen.c | 4 | ||||
-rw-r--r-- | libc/stdio/_stdio.c | 10 | ||||
-rw-r--r-- | libc/stdio/_stdio.h | 3 | ||||
-rw-r--r-- | libc/stdio/fflush.c | 1 |
5 files changed, 18 insertions, 3 deletions
diff --git a/libc/stdio/__fsetlocking.c b/libc/stdio/__fsetlocking.c index 2e8710076..746a098f9 100644 --- a/libc/stdio/__fsetlocking.c +++ b/libc/stdio/__fsetlocking.c @@ -9,6 +9,9 @@ #include <stdio_ext.h> libc_hidden_proto(__fsetlocking) +#ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_proto(_stdio_user_locking) +#endif /* Not threadsafe. */ diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index 02051eff9..4ca028275 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -11,6 +11,10 @@ libc_hidden_proto(isatty) libc_hidden_proto(open) libc_hidden_proto(fcntl) +#ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_proto(_stdio_user_locking) +#endif + /* * Cases: * fopen64 : filename != NULL, stream == NULL, filedes == -2 diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 5c8b72086..dc8bd07ad 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -129,15 +129,15 @@ static FILE _stdio_streams[] = { FILE *stdin = _stdio_streams; libc_hidden_def(stdin) FILE *stdout = _stdio_streams + 1; -libc_hidden_def(stdout) +libc_hidden_data_def(stdout) libc_hidden_proto(stderr) FILE *stderr = _stdio_streams + 2; -libc_hidden_def(stderr) +libc_hidden_data_def(stderr) #ifdef __STDIO_GETC_MACRO libc_hidden_proto(__stdin) FILE *__stdin = _stdio_streams; /* For getchar() macro. */ -libc_hidden_def(__stdin) +libc_hidden_data_def(__stdin) #endif #ifdef __STDIO_PUTC_MACRO FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */ @@ -159,9 +159,11 @@ FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */ */ FILE *_stdio_openlist = _stdio_streams; +libc_hidden_data_def(_stdio_openlist) # ifdef __UCLIBC_HAS_THREADS__ pthread_mutex_t _stdio_openlist_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +libc_hidden_data_def(_stdio_openlist_lock) int _stdio_openlist_delflag = 0; # endif @@ -170,7 +172,9 @@ int _stdio_openlist_delflag = 0; #ifdef __UCLIBC_HAS_THREADS__ /* 2 if threading not initialized and 0 otherwise; */ +libc_hidden_proto(_stdio_user_locking) int _stdio_user_locking = 2; +libc_hidden_data_def(_stdio_user_locking) void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m) { diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 1c31647cc..81942f060 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -23,8 +23,11 @@ libc_hidden_proto(stdin) libc_hidden_proto(stdout) +libc_hidden_proto(_stdio_openlist) + #ifdef __UCLIBC_HAS_THREADS__ #include <pthread.h> +libc_hidden_proto(_stdio_openlist_lock) #define __STDIO_THREADLOCK_OPENLIST \ __pthread_mutex_lock(&_stdio_openlist_lock) diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c index c0f58d8af..a2e1cf916 100644 --- a/libc/stdio/fflush.c +++ b/libc/stdio/fflush.c @@ -16,6 +16,7 @@ libc_hidden_proto(fflush_unlocked) #endif /* __UCLIBC_MJN3_ONLY__ */ #ifdef __UCLIBC_HAS_THREADS__ +libc_hidden_proto(_stdio_user_locking) /* Even if the stream is set to user-locking, we still need to lock * when all (lbf) writing streams are flushed. */ #define MY_STDIO_THREADLOCK(STREAM) \ |