summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorMadhav Suresh <madhav.suresh@delphix.com>2012-09-07 07:19:55 -0700
committerMadhav Suresh <madhav.suresh@delphix.com>2012-09-07 07:19:55 -0700
commitfb09f5aad449c97fe309678f3f604982b563a96f (patch)
tree15d32fed4b2f5ee38e93c427ebbff211670e9899 /usr/src/lib
parent7894022e4e9cf70fb564b6c5c78c24ee1903e5fe (diff)
downloadillumos-joyent-fb09f5aad449c97fe309678f3f604982b563a96f.tar.gz
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero
Reviewed by Matt Ahrens <matthew.ahrens@delphix.com> Reviewed by George Wilson <george.wilson@delphix.com> Approved by Eric Schrock <eric.schrock@delphix.com>
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libc/port/threads/assfail.c4
-rw-r--r--usr/src/lib/libzpool/Makefile.com5
-rw-r--r--usr/src/lib/libzpool/common/sys/zfs_context.h56
3 files changed, 6 insertions, 59 deletions
diff --git a/usr/src/lib/libc/port/threads/assfail.c b/usr/src/lib/libc/port/threads/assfail.c
index 7cf0ea98e6..7a98884f4b 100644
--- a/usr/src/lib/libc/port/threads/assfail.c
+++ b/usr/src/lib/libc/port/threads/assfail.c
@@ -452,11 +452,11 @@ assfail3(const char *assertion, uintmax_t lv, const char *op, uintmax_t rv,
{
char buf[1000];
(void) strcpy(buf, assertion);
- (void) strcat(buf, " (0x");
+ (void) strcat(buf, " (");
ultos((uint64_t)lv, 16, buf + strlen(buf));
(void) strcat(buf, " ");
(void) strcat(buf, op);
- (void) strcat(buf, " 0x");
+ (void) strcat(buf, " ");
ultos((uint64_t)rv, 16, buf + strlen(buf));
(void) strcat(buf, ")");
__assfail(buf, filename, line_num);
diff --git a/usr/src/lib/libzpool/Makefile.com b/usr/src/lib/libzpool/Makefile.com
index 571881a47e..2485f7350f 100644
--- a/usr/src/lib/libzpool/Makefile.com
+++ b/usr/src/lib/libzpool/Makefile.com
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 by Delphix. All rights reserved.
#
LIBRARY= libzpool.a
@@ -57,9 +58,9 @@ C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CFLAGS += -g $(CCVERBOSE) $(CNOGLOBAL)
-CFLAGS64 += -g $(CCVERBOSE) $(CNOGLOBAL)
+CFLAGS64 += -g $(CCVERBOSE) $(CNOGLOBAL)
LDLIBS += -lcmdutils -lumem -lavl -lnvpair -lz -lc -lsysevent -lmd
-CPPFLAGS += $(INCS)
+CPPFLAGS += $(INCS) -DDEBUG
.KEEP_STATE:
diff --git a/usr/src/lib/libzpool/common/sys/zfs_context.h b/usr/src/lib/libzpool/common/sys/zfs_context.h
index 8ca60b7625..9e6fd4455c 100644
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h
+++ b/usr/src/lib/libzpool/common/sys/zfs_context.h
@@ -36,7 +36,6 @@ extern "C" {
#define _SYS_RWLOCK_H
#define _SYS_CONDVAR_H
#define _SYS_SYSTM_H
-#define _SYS_DEBUG_H
#define _SYS_T_LOCK_H
#define _SYS_VNODE_H
#define _SYS_VFS_H
@@ -79,6 +78,7 @@ extern "C" {
#include <sys/sysevent/eventdefs.h>
#include <sys/sysevent/dev.h>
#include <sys/sunddi.h>
+#include <sys/debug.h>
/*
* Debugging
@@ -111,60 +111,6 @@ extern void vpanic(const char *, __va_list);
extern int aok;
-/* This definition is copied from assert.h. */
-#if defined(__STDC__)
-#if __STDC_VERSION__ - 0 >= 199901L
-#define zverify(EX) (void)((EX) || (aok) || \
- (__assert_c99(#EX, __FILE__, __LINE__, __func__), 0))
-#else
-#define zverify(EX) (void)((EX) || (aok) || \
- (__assert(#EX, __FILE__, __LINE__), 0))
-#endif /* __STDC_VERSION__ - 0 >= 199901L */
-#else
-#define zverify(EX) (void)((EX) || (aok) || \
- (_assert("EX", __FILE__, __LINE__), 0))
-#endif /* __STDC__ */
-
-
-#define VERIFY zverify
-#define ASSERT zverify
-#undef assert
-#define assert zverify
-
-extern void __assert(const char *, const char *, int);
-
-#ifdef lint
-#define VERIFY3_IMPL(x, y, z, t) if (x == z) ((void)0)
-#else
-/* BEGIN CSTYLED */
-#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
- const TYPE __left = (TYPE)(LEFT); \
- const TYPE __right = (TYPE)(RIGHT); \
- if (!(__left OP __right) && (!aok)) { \
- char *__buf = alloca(256); \
- (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \
- #LEFT, #OP, #RIGHT, \
- (u_longlong_t)__left, #OP, (u_longlong_t)__right); \
- __assert(__buf, __FILE__, __LINE__); \
- } \
-_NOTE(CONSTCOND) } while (0)
-/* END CSTYLED */
-#endif /* lint */
-
-#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
-#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
-#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
-
-#ifdef NDEBUG
-#define ASSERT3S(x, y, z) ((void)0)
-#define ASSERT3U(x, y, z) ((void)0)
-#define ASSERT3P(x, y, z) ((void)0)
-#else
-#define ASSERT3S(x, y, z) VERIFY3S(x, y, z)
-#define ASSERT3U(x, y, z) VERIFY3U(x, y, z)
-#define ASSERT3P(x, y, z) VERIFY3P(x, y, z)
-#endif
-
/*
* DTrace SDT probes have different signatures in userland than they do in
* kernel. If they're being used in kernel code, re-define them out of