svn commit: branches/uClibc-nptl/libc/stdio
sjhill at uclibc.org
sjhill at uclibc.org
Wed Aug 23 03:19:33 UTC 2006
Author: sjhill
Date: 2006-08-22 20:19:32 -0700 (Tue, 22 Aug 2006)
New Revision: 15910
Log:
Bring in remaining futex support for stdio.
Modified:
branches/uClibc-nptl/libc/stdio/Makefile.in
branches/uClibc-nptl/libc/stdio/_fopen.c
branches/uClibc-nptl/libc/stdio/_scanf.c
branches/uClibc-nptl/libc/stdio/_stdio.c
branches/uClibc-nptl/libc/stdio/_stdio.h
branches/uClibc-nptl/libc/stdio/tmpfile.c
Changeset:
Modified: branches/uClibc-nptl/libc/stdio/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/stdio/Makefile.in 2006-08-23 03:18:04 UTC (rev 15909)
+++ branches/uClibc-nptl/libc/stdio/Makefile.in 2006-08-23 03:19:32 UTC (rev 15910)
@@ -1,6 +1,5 @@
# Makefile for uClibc
#
-# Copyright (C) 2000 by Lineo, inc.
# Copyright (C) 2004 Manuel Novoa III <mjn3 at uclibc.org>
# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
#
@@ -93,6 +92,8 @@
STDIO_OBJ := $(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
libc-y += $(STDIO_OBJ)
+libc-a-y += $(STDIO_OBJ)
+libc-so-y += $(STDIO_OBJ:.o=.os)
ifneq ($(USE_OLD_VFPRINTF),y)
libc-nomulti-y += $(patsubst %.c,$(STDIO_OUT)/%.o,$(VF_CSRC))
Modified: branches/uClibc-nptl/libc/stdio/_fopen.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_fopen.c 2006-08-23 03:18:04 UTC (rev 15909)
+++ branches/uClibc-nptl/libc/stdio/_fopen.c 2006-08-23 03:19:32 UTC (rev 15910)
@@ -11,10 +11,6 @@
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
@@ -80,13 +76,13 @@
while (*++mode) {
# ifdef __UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE__
- if (*mode == 'x') { /* Open exclusive (a glibc extension). */
+ if (*mode == 'x') { /* Open exclusive (a glibc extension). */
open_mode |= O_EXCL;
continue;
}
# endif
# ifdef __UCLIBC_HAS_FOPEN_LARGEFILE_MODE__
- if (*mode == 'F') { /* Open as large file (uClibc extension). */
+ if (*mode == 'F') { /* Open as large file (uClibc extension). */
open_mode |= O_LARGEFILE;
continue;
}
@@ -106,8 +102,12 @@
#ifdef __UCLIBC_HAS_THREADS__
/* We only initialize the mutex in the non-freopen case. */
/* stream->__user_locking = _stdio_user_locking; */
+#ifdef __USE_STDIO_FUTEXES__
+ _IO_lock_init (stream->_lock);
+#else
__stdio_init_mutex(&stream->__lock);
#endif
+#endif
}
#ifdef __UCLIBC_MJN3_ONLY__
@@ -198,8 +198,12 @@
#ifdef __UCLIBC_HAS_THREADS__
/* Even in the freopen case, we reset the user locking flag. */
stream->__user_locking = _stdio_user_locking;
+#ifdef __USE_STDIO_FUTEXES__
+ /* _IO_lock_init (stream->_lock); */
+#else
/* __stdio_init_mutex(&stream->__lock); */
#endif
+#endif
#ifdef __STDIO_HAS_OPENLIST
__STDIO_THREADLOCK_OPENLIST;
Modified: branches/uClibc-nptl/libc/stdio/_scanf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_scanf.c 2006-08-23 03:18:04 UTC (rev 15909)
+++ branches/uClibc-nptl/libc/stdio/_scanf.c 2006-08-23 03:19:32 UTC (rev 15910)
@@ -100,10 +100,7 @@
#endif
#ifdef __UCLIBC_HAS_XLOCALE__
libc_hidden_proto(__ctype_b_loc)
-#else
-#ifdef __UCLIBC_HAS_LOCALE__
-libc_hidden_proto(__global_locale)
-#endif
+#elif __UCLIBC_HAS_CTYPE_TABLES__
libc_hidden_proto(__ctype_b)
#endif
Modified: branches/uClibc-nptl/libc/stdio/_stdio.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_stdio.c 2006-08-23 03:18:04 UTC (rev 15909)
+++ branches/uClibc-nptl/libc/stdio/_stdio.c 2006-08-23 03:19:32 UTC (rev 15910)
@@ -130,19 +130,12 @@
0 )
};
-/* psm: moved to _stdio.h: libc_hidden_proto(stdin/stdout) */
FILE *stdin = _stdio_streams;
-libc_hidden_data_def(stdin)
FILE *stdout = _stdio_streams + 1;
-libc_hidden_data_def(stdout)
-libc_hidden_proto(stderr)
FILE *stderr = _stdio_streams + 2;
-libc_hidden_data_def(stderr)
#ifdef __STDIO_GETC_MACRO
-libc_hidden_proto(__stdin)
FILE *__stdin = _stdio_streams; /* For getchar() macro. */
-libc_hidden_data_def(__stdin)
#endif
#ifdef __STDIO_PUTC_MACRO
FILE *__stdout = _stdio_streams + 1; /* For putchar() macro. */
@@ -164,7 +157,6 @@
*/
FILE *_stdio_openlist = _stdio_streams;
-libc_hidden_data_def(_stdio_openlist)
# ifdef __UCLIBC_HAS_THREADS__
# ifdef __USE_STDIO_FUTEXES__
@@ -173,7 +165,6 @@
# else
pthread_mutex_t _stdio_openlist_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
# endif
-libc_hidden_data_def(_stdio_openlist_lock)
int _stdio_openlist_delflag = 0;
# endif
@@ -182,9 +173,7 @@
#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)
#ifndef __USE_STDIO_FUTEXES__
void attribute_hidden __stdio_init_mutex(pthread_mutex_t *m)
Modified: branches/uClibc-nptl/libc/stdio/_stdio.h
===================================================================
--- branches/uClibc-nptl/libc/stdio/_stdio.h 2006-08-23 03:18:04 UTC (rev 15909)
+++ branches/uClibc-nptl/libc/stdio/_stdio.h 2006-08-23 03:19:32 UTC (rev 15910)
@@ -20,16 +20,20 @@
#include <wchar.h>
#endif
-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)
+#ifdef __USE_STDIO_FUTEXES___
#define __STDIO_THREADLOCK_OPENLIST \
+ _IO_lock_lock(_stdio_openlist_lock)
+
+#define __STDIO_THREADUNLOCK_OPENLIST \
+ _IO_lock_unlock(_stdio_openlist_lock)
+
+#define __STDIO_THREADTRYLOCK_OPENLIST \
+ _IO_lock_trylock(_stdio_openlist_lock)
+#else
+#define __STDIO_THREADLOCK_OPENLIST \
__pthread_mutex_lock(&_stdio_openlist_lock)
#define __STDIO_THREADUNLOCK_OPENLIST \
@@ -37,6 +41,7 @@
#define __STDIO_THREADTRYLOCK_OPENLIST \
__pthread_mutex_trylock(&_stdio_openlist_lock)
+#endif
#else
@@ -86,10 +91,10 @@
(read((STREAMPTR)->__filedes,(BUF),(SIZE)))
#define __WRITE(STREAMPTR,BUF,SIZE) \
(write((STREAMPTR)->__filedes,(BUF),(SIZE)))
+#define __CLOSE(STREAMPTR) \
+ (close((STREAMPTR)->__filedes))
#define __SEEK(STREAMPTR,PPOS,WHENCE) \
(__stdio_seek((STREAMPTR),(PPOS),(WHENCE)))
-#define __CLOSE(STREAMPTR) \
- (close((STREAMPTR)->__filedes))
#endif /* __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ */
Modified: branches/uClibc-nptl/libc/stdio/tmpfile.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/tmpfile.c 2006-08-23 03:18:04 UTC (rev 15909)
+++ branches/uClibc-nptl/libc/stdio/tmpfile.c 2006-08-23 03:19:32 UTC (rev 15910)
@@ -20,10 +20,16 @@
#include <stdio.h>
#include <unistd.h>
#include "../misc/internals/tempname.h"
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <errno.h>
+#include <not-cancel.h>
+#endif
libc_hidden_proto(fdopen)
libc_hidden_proto(remove)
+#ifndef __UCLIBC_HAS_THREADS_NATIVE__
libc_hidden_proto(close)
+#endif
/* This returns a new stream opened on a temporary file (generated
by tmpnam). The file is opened with mode "w+b" (binary read/write).
@@ -46,7 +52,11 @@
(void) remove (buf);
if ((f = fdopen (fd, "w+b")) == NULL)
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+ close_not_cancel (fd);
+#else
close (fd);
+#endif
return f;
}
More information about the uClibc-cvs
mailing list