Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src implement mutex_owner()



details:   https://anonhg.NetBSD.org/src/rev/610fdaa0d727
branches:  trunk
changeset: 759200:610fdaa0d727
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Dec 01 17:22:51 2010 +0000

description:
implement mutex_owner()

diffstat:

 lib/librumpuser/rumpuser_pth.c       |  10 +++++-----
 sys/rump/include/rump/rumpuser.h     |   4 ++--
 sys/rump/librump/rumpkern/locks.c    |  13 ++++++++++---
 sys/rump/librump/rumpkern/locks_up.c |  11 +++++++++--
 4 files changed, 26 insertions(+), 12 deletions(-)

diffs (122 lines):

diff -r 71b494c72cf9 -r 610fdaa0d727 lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c    Wed Dec 01 15:13:24 2010 +0000
+++ b/lib/librumpuser/rumpuser_pth.c    Wed Dec 01 17:22:51 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_pth.c,v 1.5 2010/12/01 15:01:52 pooka Exp $   */
+/*     $NetBSD: rumpuser_pth.c,v 1.6 2010/12/01 17:22:51 pooka Exp $   */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.5 2010/12/01 15:01:52 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.6 2010/12/01 17:22:51 pooka Exp $");
 #endif /* !lint */
 
 #ifdef __linux__
@@ -354,8 +354,8 @@
        free(mtx);
 }
 
-int
-rumpuser_mutex_held(struct rumpuser_mtx *mtx)
+struct lwp *
+rumpuser_mutex_owner(struct rumpuser_mtx *mtx)
 {
 
        if (__predict_false(!mtx->iskmutex)) {
@@ -363,7 +363,7 @@
                abort();
        }
 
-       return mtx->owner == rumpuser_get_curlwp();
+       return mtx->owner;
 }
 
 void
diff -r 71b494c72cf9 -r 610fdaa0d727 sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h  Wed Dec 01 15:13:24 2010 +0000
+++ b/sys/rump/include/rump/rumpuser.h  Wed Dec 01 17:22:51 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.h,v 1.56 2010/12/01 15:02:04 pooka Exp $      */
+/*     $NetBSD: rumpuser.h,v 1.57 2010/12/01 17:22:51 pooka Exp $      */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -132,7 +132,7 @@
 int  rumpuser_mutex_tryenter(struct rumpuser_mtx *);
 void rumpuser_mutex_exit(struct rumpuser_mtx *);
 void rumpuser_mutex_destroy(struct rumpuser_mtx *);
-int  rumpuser_mutex_held(struct rumpuser_mtx *);
+struct lwp *rumpuser_mutex_owner(struct rumpuser_mtx *);
 
 struct rumpuser_rw;
 
diff -r 71b494c72cf9 -r 610fdaa0d727 sys/rump/librump/rumpkern/locks.c
--- a/sys/rump/librump/rumpkern/locks.c Wed Dec 01 15:13:24 2010 +0000
+++ b/sys/rump/librump/rumpkern/locks.c Wed Dec 01 17:22:51 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locks.c,v 1.43 2010/12/01 14:59:38 pooka Exp $ */
+/*     $NetBSD: locks.c,v 1.44 2010/12/01 17:22:51 pooka Exp $ */
 
 /*
  * Copyright (c) 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.43 2010/12/01 14:59:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.44 2010/12/01 17:22:51 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -109,7 +109,14 @@
 mutex_owned(kmutex_t *mtx)
 {
 
-       return rumpuser_mutex_held(RUMPMTX(mtx));
+       return mutex_owner(mtx) == curlwp;
+}
+
+struct lwp *
+mutex_owner(kmutex_t *mtx)
+{
+
+       return rumpuser_mutex_owner(RUMPMTX(mtx));
 }
 
 #define RUMPRW(rw) (*(struct rumpuser_rw **)(rw))
diff -r 71b494c72cf9 -r 610fdaa0d727 sys/rump/librump/rumpkern/locks_up.c
--- a/sys/rump/librump/rumpkern/locks_up.c      Wed Dec 01 15:13:24 2010 +0000
+++ b/sys/rump/librump/rumpkern/locks_up.c      Wed Dec 01 17:22:51 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locks_up.c,v 1.4 2010/06/14 21:04:56 pooka Exp $       */
+/*     $NetBSD: locks_up.c,v 1.5 2010/12/01 17:22:51 pooka Exp $       */
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.4 2010/06/14 21:04:56 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.5 2010/12/01 17:22:51 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -157,6 +157,13 @@
        return upm->upm_owner == curlwp;
 }
 
+struct lwp *
+mutex_owner(kmutex_t *mtx)
+{
+
+       return upm->upm_owner;
+}
+
 struct uprw {
        struct lwp *uprw_owner;
        int uprw_readers;



Home | Main Index | Thread Index | Old Index