Skip to content

Commit

Permalink
Implement -A (ignore ASSERTs) for zdb
Browse files Browse the repository at this point in the history
The command line switch -A (ignore ASSERTs) has always been available 
in zdb but was never connected up to the correct global variable.

There are times when you need zdb to ignore asserts and keep dumping 
out whatever information it can get despite the ASSERT(s) failing. 
It was always intended to be part of zdb but was incomplete.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Zuchowski <[email protected]>
Closes #9610
  • Loading branch information
PaulZ-98 authored and behlendorf committed Nov 27, 2019
1 parent 9e17e6f commit 7c1bf0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/libspl/include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@
#include <stdlib.h>
#include <stdarg.h>

#ifndef _KERNEL
int aok;
#endif

static inline int
libspl_assert(const char *buf, const char *file, const char *func, int line)
{
fprintf(stderr, "%s\n", buf);
fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func);
if (aok) {
return (0);
}
abort();
}

Expand All @@ -52,6 +59,9 @@ libspl_assertf(const char *file, const char *func, int line, char *format, ...)
fprintf(stderr, "\n");
fprintf(stderr, "ASSERT at %s:%d:%s()", file, line, func);
va_end(args);
if (aok) {
return;
}
abort();
}

Expand Down
1 change: 0 additions & 1 deletion lib/libzpool/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
* Emulation of kernel services in userland.
*/

int aok;
uint64_t physmem;
char hw_serial[HW_HOSTID_LEN];
struct utsname hw_utsname;
Expand Down

0 comments on commit 7c1bf0c

Please sign in to comment.