Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Sep 2015 08:50:43 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287703 - head/sys/cddl/contrib/opensolaris/common/avl
Message-ID:  <201509120850.t8C8ohb0041812@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sat Sep 12 08:50:43 2015
New Revision: 287703
URL: https://svnweb.freebsd.org/changeset/base/287703

Log:
  MFV r287684: 6091 avl_add doesn't assert on non-debug builds
  
  Use assfail() from libuutil instead of ASSERT() in userland
  AVL avl_add.
  
  illumos/illumos-gate@faa2b6be2fc102adf9ed584fc1a667b4ddf50d78
  
  Illumos issues:
  
      6091 avl_add doesn't assert on non-debug builds
      https://www.illumos.org/issues/6091

Modified:
  head/sys/cddl/contrib/opensolaris/common/avl/avl.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/common/avl/avl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/common/avl/avl.c	Sat Sep 12 08:35:51 2015	(r287702)
+++ head/sys/cddl/contrib/opensolaris/common/avl/avl.c	Sat Sep 12 08:50:43 2015	(r287703)
@@ -25,6 +25,7 @@
 
 /*
  * Copyright (c) 2014 by Delphix. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /*
@@ -635,14 +636,17 @@ avl_add(avl_tree_t *tree, void *new_node
 	/*
 	 * This is unfortunate.  We want to call panic() here, even for
 	 * non-DEBUG kernels.  In userland, however, we can't depend on anything
-	 * in libc or else the rtld build process gets confused.  So, all we can
-	 * do in userland is resort to a normal ASSERT().
+	 * in libc or else the rtld build process gets confused.
+	 * Thankfully, rtld provides us with its own assfail() so we can use
+	 * that here.  We use assfail() directly to get a nice error message
+	 * in the core - much like what panic() does for crashdumps.
 	 */
 	if (avl_find(tree, new_node, &where) != NULL)
 #ifdef _KERNEL
 		panic("avl_find() succeeded inside avl_add()");
 #else
-		ASSERT(0);
+		(void) assfail("avl_find() succeeded inside avl_add()",
+		    __FILE__, __LINE__);
 #endif
 	avl_insert(tree, new_node, where);
 }



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