summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-10-21 15:32:02 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-10-21 15:32:02 +0000
commit21bc8e908e6dc1a5596d029f7182e0cf35a7218c (patch)
tree4f4330d416094347693b5b6f3a9b58fc8b1ca05d
parentcfb5dd86c91018cd15533a9370b2d6fec08084af (diff)
After forking, the child is single threaded, so tell libc that. This
is needed to avoid deadlocks in popen() on FILE locking. ok kurt@
-rw-r--r--lib/libpthread/uthread/uthread_fork.c5
-rw-r--r--lib/librthread/rthread_fork.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/libpthread/uthread/uthread_fork.c b/lib/libpthread/uthread/uthread_fork.c
index 4eceda4c86c..726b578e3af 100644
--- a/lib/libpthread/uthread/uthread_fork.c
+++ b/lib/libpthread/uthread/uthread_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_fork.c,v 1.19 2008/04/04 19:30:41 kurt Exp $ */
+/* $OpenBSD: uthread_fork.c,v 1.20 2009/10/21 15:32:01 guenther Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -184,6 +184,9 @@ _dofork(int vfork)
/* Re-init the threads mutex queue: */
TAILQ_INIT(&curthread->mutexq);
+ /* single threaded now */
+ __isthreaded = 0;
+
/* No spinlocks yet: */
_spinblock_count = 0;
diff --git a/lib/librthread/rthread_fork.c b/lib/librthread/rthread_fork.c
index 530d9ad5b6e..fe51c5de31e 100644
--- a/lib/librthread/rthread_fork.c
+++ b/lib/librthread/rthread_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_fork.c,v 1.1 2008/06/05 21:06:11 kurt Exp $ */
+/* $OpenBSD: rthread_fork.c,v 1.2 2009/10/21 15:32:01 guenther Exp $ */
/*
* Copyright (c) 2008 Kurt Miller <kurt@openbsd.org>
@@ -124,6 +124,9 @@ _dofork(int is_vfork)
LIST_INIT(&_thread_list);
LIST_INSERT_HEAD(&_thread_list, &_initial_thread, threads);
_thread_lock = _SPINLOCK_UNLOCKED;
+
+ /* single threaded now */
+ __isthreaded = 0;
}
return newid;
}