summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Irofti <pirofti@cvs.openbsd.org>2013-04-10 13:11:25 +0000
committerPaul Irofti <pirofti@cvs.openbsd.org>2013-04-10 13:11:25 +0000
commit0c158f2277bfba386edcd7e799892e4fd2bb36ab (patch)
tree4e13d094623c4822013a0c5bc40559107fb8675e
parentba306cd6345b4a1b1901745ccec9a63764c59b6d (diff)
futex: Sprinkle a few debug printfs that helped me in the past.
-rw-r--r--sys/compat/linux/linux_futex.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index 8442c6b63ef..0ee34735b3e 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.12 2013/04/10 12:58:52 pirofti Exp $ */
+/* $OpenBSD: linux_futex.c,v 1.13 2013/04/10 13:11:24 pirofti Exp $ */
/* $NetBSD: linux_futex.c,v 1.26 2010/07/07 01:30:35 chs Exp $ */
/*-
@@ -172,6 +172,7 @@ linux_do_futex(struct proc *p, const struct linux_sys_futex_args *uap,
switch (SCARG(uap, op) & ~LINUX_FUTEX_PRIVATE_FLAG) {
case LINUX_FUTEX_WAIT:
+ DPRINTF(("FUTEX_WAIT\n"));
mtx_enter(&futex_lock);
if ((error = copyin(SCARG(uap, uaddr),
&uaddr_val, sizeof(uaddr_val))) != 0) {
@@ -221,12 +222,14 @@ linux_do_futex(struct proc *p, const struct linux_sys_futex_args *uap,
mtx_leave(&futex_lock);
return EAGAIN;
}
+ DPRINTF(("FUTEX_WAIT: get wp %p\n", wp));
f = futex_get(SCARG(uap, uaddr));
ret = futex_sleep(&f, p, timeout_hz, wp);
futex_put(f);
mtx_leave(&futex_lock);
+ DPRINTF(("FUTEX_WAIT: put wp %p\n", wp));
pool_put(&futex_wp_pool, wp);
DPRINTF(("FUTEX_WAIT %d: Woke up from uaddr %8.8X with "
@@ -275,6 +278,7 @@ linux_do_futex(struct proc *p, const struct linux_sys_futex_args *uap,
case LINUX_FUTEX_CMP_REQUEUE:
+ DPRINTF(("FUTEX_CMP_REQUEUE\n"));
if (args_val < 0)
return EINVAL;
@@ -436,12 +440,14 @@ futex_get(void *uaddr)
/* Not found, create it */
newf = pool_get(&futex_pool, PR_WAITOK|PR_ZERO);
+ DPRINTF(("futex_get: get %p\n", newf));
mtx_enter(&futex_lock);
/* Did someone else create it in the meantime? */
LIST_FOREACH(f, &futex_list, f_list) {
if (f->f_uaddr == uaddr) {
f->f_refcount++;
+ DPRINTF(("futex_get: put %p (found %p)\n", newf, f));
pool_put(&futex_pool, newf);
return f;
}
@@ -473,6 +479,7 @@ futex_ref(struct futex *f)
void
futex_put(struct futex *f)
{
+ DPRINTF(("futex_put: put %p ref %d\n", f, f->f_refcount));
MUTEX_ASSERT_LOCKED(&futex_lock);
KASSERT(f->f_refcount > 0);
f->f_refcount--;