summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2013-04-10 13:17:42 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2013-04-10 13:17:42 +0000
commit6616cf1df8310e22c763c4a12226be8ab9135f21 (patch)
tree8ea90f332ab64db85ece05504b7925ccf314456d
parent0c158f2277bfba386edcd7e799892e4fd2bb36ab (diff)
futex: Prevent multiple futex pool initializations.
This is a temporary (ugly) fix, the pool init call should be moved from linux_elf_probe into a better place.
-rw-r--r--sys/compat/linux/linux_futex.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index 0ee34735b3e..31fabdadba4 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_futex.c,v 1.13 2013/04/10 13:11:24 pirofti Exp $ */
+/* $OpenBSD: linux_futex.c,v 1.14 2013/04/10 13:17:41 pirofti Exp $ */
/* $NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $ */
/*-
@@ -69,6 +69,7 @@
struct pool futex_pool;
struct pool futex_wp_pool;
+int futex_pool_initialized;
struct futex;
@@ -411,10 +412,14 @@ void
futex_pool_init(void)
{
DPRINTF(("Inside futex_pool_init()\n"));
- pool_init(&futex_pool, sizeof(struct futex), 0, 0, PR_DEBUGCHK,
- "futexpl", &pool_allocator_nointr);
- pool_init(&futex_wp_pool, sizeof(struct waiting_proc), 0, 0,
- PR_DEBUGCHK, "futexwppl", &pool_allocator_nointr);
+
+ if (!futex_pool_initialized) {
+ pool_init(&futex_pool, sizeof(struct futex), 0, 0, PR_DEBUGCHK,
+ "futexpl", &pool_allocator_nointr);
+ pool_init(&futex_wp_pool, sizeof(struct waiting_proc), 0, 0,
+ PR_DEBUGCHK, "futexwppl", &pool_allocator_nointr);
+ futex_pool_initialized = 1;
+ }
}
/*