Add assfail() and assfail3() to the opensolaris module.

Remove obsoleted intermediate cddl/compat/opensolaris/sys/debug.h.

MFC after:	2 weeks
This commit is contained in:
Martin Matuska 2012-09-10 10:24:57 +00:00
parent 92a80a4cef
commit 6643637f67
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240303
3 changed files with 39 additions and 17 deletions

View File

@ -19,9 +19,13 @@
* CDDL HEADER END
*
* $FreeBSD$
*
*/
/*
* Copyright 2007 John Birrell <jb@FreeBSD.org>. All rights reserved.
* Copyright 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
#include <sys/assfail.h>
#include <sys/cmn_err.h>
void
@ -68,3 +72,19 @@ cmn_err(int type, const char *fmt, ...)
vcmn_err(type, fmt, ap);
va_end(ap);
}
int
assfail(const char *a, const char *f, int l) {
panic("solaris assert: %s, file: %s, line: %d", a, f, l);
return (0);
}
void
assfail3(const char *a, uintmax_t lv, const char *op, uintmax_t rv,
const char *f, int l) {
panic("solaris assert: %s (0x%jx %s 0x%jx), file: %s, line: %d",
a, lv, op, rv, f, l);
}

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,23 +26,21 @@
* $FreeBSD$
*/
#ifndef _OPENSOLARIS_SYS_DEBUG_H_
#define _OPENSOLARIS_SYS_DEBUG_H_
#ifndef _OPENSOLARIS_SYS_ASSFAIL_H_
#define _OPENSOLARIS_SYS_ASSFAIL_H_
#ifdef _KERNEL
#include <sys/types.h>
#include <sys/systm.h>
#include_next <sys/debug.h>
#define assfail(a, f, l) \
(panic("solaris assert: %s, file: %s, line: %d", (a), (f), (l)), 0)
#define assfail3(a, lv, op, rv, f, l) \
panic("solaris assert: %s (0x%jx %s 0x%jx), file: %s, line: %d", \
(a), (uintmax_t)(lv), (op), (uintmax_t)(rv), (f), (l))
#else /* !_KERNEL */
#include_next <sys/debug.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* _OPENSOLARIS_SYS_DEBUG_H_ */
int assfail(const char *, const char *, int);
void assfail3(const char *, uintmax_t, const char *, uintmax_t, const char *,
int);
#ifdef __cplusplus
}
#endif
#endif /* _OPENSOLARIS_SYS_ASSFAIL_H_ */

View File

@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@ -31,6 +32,9 @@
#include <sys/types.h>
#include <sys/note.h>
#ifdef _KERNEL
#include <sys/systm.h>
#endif
#ifdef __cplusplus
extern "C" {