summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2001-02-11 22:06:43 +0000
committerdeischen <deischen@FreeBSD.org>2001-02-11 22:06:43 +0000
commit1143b5e42a7816a7665798bcab7d5db4a37935b3 (patch)
tree3a588c82070b992d27ef67e1a69bcb90121e4ece /lib/libc/gen
parentd5657ce8b69e343a4dda07786bb158c464f9b4d6 (diff)
downloadFreeBSD-src-1143b5e42a7816a7665798bcab7d5db4a37935b3.zip
FreeBSD-src-1143b5e42a7816a7665798bcab7d5db4a37935b3.tar.gz
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
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/_pthread_stubs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libc/gen/_pthread_stubs.c b/lib/libc/gen/_pthread_stubs.c
index 87b0ad2..be6dab7 100644
--- a/lib/libc/gen/_pthread_stubs.c
+++ b/lib/libc/gen/_pthread_stubs.c
@@ -49,8 +49,14 @@
#pragma weak _pthread_mutexattr_destroy=_pthread_mutexattr_destroy_stub
#pragma weak _pthread_mutexattr_settype=_pthread_mutexattr_settype_stub
#pragma weak _pthread_once=_pthread_once_stub
+#pragma weak _pthread_self=_pthread_self_stub
#pragma weak _pthread_setspecific=_pthread_setspecific_stub
+struct pthread {
+};
+
+static struct pthread main_thread;
+
void *
_pthread_getspecific_stub(pthread_key_t key)
@@ -124,6 +130,12 @@ _pthread_once_stub(pthread_once_t *once_control, void (*init_routine) (void))
return (0);
}
+pthread_t
+_pthread_self_stub(void)
+{
+ return (&main_thread);
+}
+
int
_pthread_setspecific_stub(pthread_key_t key, const void *value)
{
OpenPOWER on IntegriCloud