Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Oct 2005 18:33:48 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 84737 for review
Message-ID:  <200510031833.j93IXmOj006755@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=84737

Change 84737 by jhb@jhb_slimer on 2005/10/03 18:33:14

	Pullup the refcount test from jhb_proc.

Affected files ...

.. //depot/projects/smpng/sys/modules/crash/crash.c#20 integrate

Differences ...

==== //depot/projects/smpng/sys/modules/crash/crash.c#20 (text+ko) ====

@@ -48,6 +48,7 @@
 #include <sys/module.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
+#include <sys/refcount.h>
 #include <sys/sched.h>
 #include <sys/unistd.h>
 #include <sys/sx.h>
@@ -82,6 +83,28 @@
 
 /* Events. */
 
+static void
+refcount_test(void)
+{
+	int count;
+
+	printf("Creating and bumping refcount\n");
+	refcount_init(&count, 1);
+	refcount_acquire(&count);
+	printf("Dropping refcount first time: ");
+	if (refcount_release(&count))
+		printf("true, (uh oh!)\n");
+	else
+		printf("false\n");
+	printf("Dropping refcount second time: ");
+	if (refcount_release(&count))
+		printf("true\n");
+	else
+		printf("false, (uh oh!)\n");
+	printf("Ending count: %d\n", count);
+}
+CRASH_EVENT("refcount", refcount_test);
+
 #ifdef WITNESS
 static void
 foo_then_bar(void)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510031833.j93IXmOj006755>