From 1143b5e42a7816a7665798bcab7d5db4a37935b3 Mon Sep 17 00:00:00 2001 From: deischen Date: Sun, 11 Feb 2001 22:06:43 +0000 Subject: libc MT-safety, part 2. Add a lock to FILE. flockfile and friends are now implemented (for the most part) in libc. flockfile_debug is implemented in libc_r; I suppose it's about time to kill it but will do it in a future commit. Fix a potential deadlock in _fwalk in a threaded environment. A file flag (__SIGN) was added to stdio.h that, when set, tells _fwalk to ignore it in its walk. This seemed to be needed in refill.c because each file needs to be locked when flushing. Add a stub for pthread_self in libc. This is needed by flockfile which is allowed by POSIX to be recursive. Make fgetpos() error return value (-1) match man page. Remove recursive calls to locked functions (stdio); I think I've got them all, but I may have missed a couple. A few K&R -> ANSI conversions along with removal of a few instances of "register". $Id$ -> $FreeBSD$ in libc/stdio/rget.c Not objected to: -arch, a few months ago --- lib/libc/stdio/findfp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libc/stdio/findfp.c') diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c index 30e8f90..f307e3e 100644 --- a/lib/libc/stdio/findfp.c +++ b/lib/libc/stdio/findfp.c @@ -82,7 +82,7 @@ static spinlock_t thread_lock = _SPINLOCK_INITIALIZER; #define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&thread_lock) #if NOT_YET -#define SET_GLUE_PTR(ptr, val) atomic_set_ptr(&(ptr), (uintptr_t)(val)) +#define SET_GLUE_PTR(ptr, val) atomic_set_rel_ptr(&(ptr), (uintptr_t)(val)) #else #define SET_GLUE_PTR(ptr, val) ptr = val #endif @@ -150,7 +150,7 @@ found: fp->_ub._size = 0; fp->_lb._base = NULL; /* no line buffer */ fp->_lb._size = 0; - /* fp->_lock = NULL; */ +/* fp->_lock = NULL; */ /* once set always set (reused) */ return (fp); } @@ -203,7 +203,7 @@ _cleanup() void __sinit() { - /* make sure we clean up on exit */ + /* Make sure we clean up on exit. */ __cleanup = _cleanup; /* conservative */ __sdidinit = 1; } -- cgit v1.1