diff options
| author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-08-09 05:50:49 +0000 |
|---|---|---|
| committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-08-09 05:50:49 +0000 |
| commit | 75f9a2b1874f3c50727c6b91fd5b5735a2a5deb3 (patch) | |
| tree | 04a04dac7fd6a10c123dea261b22e7e331d33dd2 /libc/stdio | |
| parent | 7eca0902fd7bbdb04ea83f967b0a198335c8d5db (diff) | |
| download | uClibc-alpine-75f9a2b1874f3c50727c6b91fd5b5735a2a5deb3.tar.bz2 uClibc-alpine-75f9a2b1874f3c50727c6b91fd5b5735a2a5deb3.tar.xz | |
In reality, the futex support that was originally added was only for STDIO operations internal to libc. The futexes should not be visible to anything other than libc. These changes clean up futex and STDIO.
Diffstat (limited to 'libc/stdio')
| -rw-r--r-- | libc/stdio/Makefile | 4 | ||||
| -rw-r--r-- | libc/stdio/_fopen.c | 4 | ||||
| -rw-r--r-- | libc/stdio/_stdio.c | 12 | ||||
| -rw-r--r-- | libc/stdio/_stdio.h | 2 | ||||
| -rw-r--r-- | libc/stdio/scanf.c | 6 | ||||
| -rw-r--r-- | libc/stdio/vdprintf.c | 2 | ||||
| -rw-r--r-- | libc/stdio/vsnprintf.c | 6 | ||||
| -rw-r--r-- | libc/stdio/vswprintf.c | 2 |
8 files changed, 21 insertions, 17 deletions
diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index e17d9faa5..684380ef0 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -121,6 +121,10 @@ ifeq ($(strip $(UCLIBC_HAS_LFS)),y) OBJS += $(CLOBJS) endif +ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) +CFLAGS += -D__USE_STDIO_FUTEXES__ +endif + OBJ_LIST=../obj.stdio all: $(OBJ_LIST) diff --git a/libc/stdio/_fopen.c b/libc/stdio/_fopen.c index b1722fef2..bba8cfdfd 100644 --- a/libc/stdio/_fopen.c +++ b/libc/stdio/_fopen.c @@ -98,7 +98,7 @@ FILE *_stdio_fopen(intptr_t fname_or_mode, #ifdef __UCLIBC_HAS_THREADS__ /* We only initialize the mutex in the non-freopen case. */ /* stream->__user_locking = _stdio_user_locking; */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (stream->_lock); #else __stdio_init_mutex(&stream->__lock); @@ -194,7 +194,7 @@ FILE *_stdio_fopen(intptr_t fname_or_mode, #ifdef __UCLIBC_HAS_THREADS__ /* Even in the freopen case, we reset the user locking flag. */ stream->__user_locking = _stdio_user_locking; -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ /* _IO_lock_init (stream->_lock); */ #else /* __stdio_init_mutex(&stream->__lock); */ diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c index 671f1e14c..b21beb728 100644 --- a/libc/stdio/_stdio.c +++ b/libc/stdio/_stdio.c @@ -73,7 +73,7 @@ #endif #ifdef __UCLIBC_HAS_THREADS__ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ #define __STDIO_FILE_INIT_THREADSAFE \ 2, _LIBC_LOCK_RECURSIVE_INITIALIZER, #else @@ -156,8 +156,8 @@ FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */ FILE *_stdio_openlist = _stdio_streams; # ifdef __UCLIBC_HAS_THREADS__ -# ifdef __UCLIBC_HAS_FUTEXES__ -# include <bits/stdio-lock.h> +# ifdef __USE_STDIO_FUTEXES__ +# include <bits/stdio-lock.h> _IO_lock_t _stdio_openlist_lock = _IO_lock_initializer; # else pthread_mutex_t _stdio_openlist_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; @@ -172,7 +172,7 @@ int _stdio_openlist_delflag = 0; /* 2 if threading not initialized and 0 otherwise; */ int _stdio_user_locking = 2; -#ifndef __UCLIBC_HAS_FUTEXES__ +#ifndef __USE_STDIO_FUTEXES__ void __stdio_init_mutex(pthread_mutex_t *m) { static const pthread_mutex_t __stdio_mutex_initializer @@ -196,7 +196,7 @@ void _stdio_term(void) * locked, then I suppose there is a chance that a pointer in the * chain might be corrupt due to a partial store. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (_stdio_openlist_lock); #else __stdio_init_mutex(&_stdio_openlist_lock); @@ -221,7 +221,7 @@ void _stdio_term(void) } ptr->__user_locking = 1; /* Set locking mode to "by caller". */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (ptr->_lock); #else __stdio_init_mutex(&ptr->__lock); /* Shouldn't be necessary, but... */ diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index 2b956daa3..c167b177e 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -25,7 +25,7 @@ #ifdef __UCLIBC_HAS_THREADS__ #include <pthread.h> -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES___ #define __STDIO_THREADLOCK_OPENLIST \ _IO_lock_lock(_stdio_openlist_lock) diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index 13254a50b..feaec3b44 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -235,7 +235,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f._lock); #else __stdio_init_mutex(&f.__lock); @@ -286,7 +286,7 @@ int vsscanf(__const char *sp, __const char *fmt, va_list ap) #ifdef __UCLIBC_HAS_THREADS__ f.f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f.f._lock); #else __stdio_init_mutex(&f.f.__lock); @@ -421,7 +421,7 @@ int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict format, #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f._lock); #else __stdio_init_mutex(&f.__lock); diff --git a/libc/stdio/vdprintf.c b/libc/stdio/vdprintf.c index 6449d37ca..6d8c91e90 100644 --- a/libc/stdio/vdprintf.c +++ b/libc/stdio/vdprintf.c @@ -43,7 +43,7 @@ int vdprintf(int filedes, const char * __restrict format, va_list arg) #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f._lock); #else __stdio_init_mutex(&f.__lock); diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c index 2f4f8e0a4..b8bdbaaa1 100644 --- a/libc/stdio/vsnprintf.c +++ b/libc/stdio/vsnprintf.c @@ -41,7 +41,7 @@ int vsnprintf(char *__restrict buf, size_t size, #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f._lock); #else __stdio_init_mutex(&f.__lock); @@ -113,7 +113,7 @@ int vsnprintf(char *__restrict buf, size_t size, #ifdef __UCLIBC_HAS_THREADS__ f.f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f.f._lock); #else __stdio_init_mutex(&f.f.__lock); @@ -201,7 +201,7 @@ int vsnprintf(char *__restrict buf, size_t size, #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f._lock); #else __stdio_init_mutex(&f.__lock); diff --git a/libc/stdio/vswprintf.c b/libc/stdio/vswprintf.c index ea99836e2..aab847dfd 100644 --- a/libc/stdio/vswprintf.c +++ b/libc/stdio/vswprintf.c @@ -38,7 +38,7 @@ int vswprintf(wchar_t *__restrict buf, size_t size, #ifdef __UCLIBC_HAS_THREADS__ f.__user_locking = 1; /* Set user locking. */ -#ifdef __UCLIBC_HAS_FUTEXES__ +#ifdef __USE_STDIO_FUTEXES__ _IO_lock_init (f._lock); #else __stdio_init_mutex(&f.__lock); |
