From 6643637f676ce97da1fbb810d41db31d3f97e373 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Mon, 10 Sep 2012 10:24:57 +0000 Subject: [PATCH] Add assfail() and assfail3() to the opensolaris module. Remove obsoleted intermediate cddl/compat/opensolaris/sys/debug.h. MFC after: 2 weeks --- .../opensolaris/kern/opensolaris_cmn_err.c | 22 +++++++++++++- .../opensolaris/sys/{debug.h => assfail.h} | 30 +++++++++---------- .../opensolaris/uts/common/sys/debug.h | 4 +++ 3 files changed, 39 insertions(+), 17 deletions(-) rename sys/cddl/compat/opensolaris/sys/{debug.h => assfail.h} (71%) diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c b/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c index abde30d6ac28..1e065eae085c 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c @@ -19,9 +19,13 @@ * CDDL HEADER END * * $FreeBSD$ - * + */ +/* + * Copyright 2007 John Birrell . All rights reserved. + * Copyright 2012 Martin Matuska . All rights reserved. */ +#include #include 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); +} diff --git a/sys/cddl/compat/opensolaris/sys/debug.h b/sys/cddl/compat/opensolaris/sys/assfail.h similarity index 71% rename from sys/cddl/compat/opensolaris/sys/debug.h rename to sys/cddl/compat/opensolaris/sys/assfail.h index 34804624eeb1..23978803ab2f 100644 --- a/sys/cddl/compat/opensolaris/sys/debug.h +++ b/sys/cddl/compat/opensolaris/sys/assfail.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Pawel Jakub Dawidek + * Copyright (c) 2012 Martin Matuska * 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 -#include -#include_next - -#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 +#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_ */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h b/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h index 6467781ce806..ee17e5f360e8 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h @@ -21,6 +21,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2012 Martin Matuska . All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -31,6 +32,9 @@ #include #include +#ifdef _KERNEL +#include +#endif #ifdef __cplusplus extern "C" {