PERFORCE change 84737 for review
John Baldwin
jhb at FreeBSD.org
Mon Oct 3 11:33:49 PDT 2005
http://perforce.freebsd.org/chv.cgi?CH=84737
Change 84737 by jhb at 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)
More information about the p4-projects
mailing list