summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/printf.c
diff options
context:
space:
mode:
authorAlexey Zaytsev <alexey.zaytsev@nexenta.com>2012-06-18 21:47:56 -0400
committerAlexey Zaytsev <alexey.zaytsev@nexenta.com>2012-06-18 21:47:56 -0400
commitb3a7691da42408392718e2d2dbae9efa7fed49d3 (patch)
tree918f203bcd4b79ad0d06f5b1e37d2246f1d715a1 /usr/src/uts/common/os/printf.c
parent9d75dfda4910937c194437c3e1e45ca07c889ee5 (diff)
downloadillumos-joyent-b3a7691da42408392718e2d2dbae9efa7fed49d3.tar.gz
1910 Implement a generic dev_err
Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Dan McDonald <danmcd@nexenta.com>
Diffstat (limited to 'usr/src/uts/common/os/printf.c')
-rw-r--r--usr/src/uts/common/os/printf.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr/src/uts/common/os/printf.c b/usr/src/uts/common/os/printf.c
index 1caedb33b6..c9e1524de0 100644
--- a/usr/src/uts/common/os/printf.c
+++ b/usr/src/uts/common/os/printf.c
@@ -21,6 +21,8 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/param.h>
@@ -48,6 +50,7 @@
#include <sys/panic.h>
#include <sys/spl.h>
#include <sys/zone.h>
+#include <sys/sunddi.h>
/*
* In some debugging situations it's useful to log all messages to panicbuf,
@@ -287,6 +290,21 @@ zcmn_err(zoneid_t zoneid, int ce, const char *fmt, ...)
va_end(adx);
}
+/*PRINTFLIKE3*/
+void
+dev_err(dev_info_t *dip, int ce, char *fmt, ...)
+{
+ va_list ap;
+ char buf[LOG_MSGSIZE];
+
+ (void) snprintf(buf, sizeof (buf), "%s%d: %s",
+ ddi_driver_name(dip), ddi_get_instance(dip), fmt);
+
+ va_start(ap, fmt);
+ vcmn_err(ce, buf, ap);
+ va_end(ap);
+}
+
int
assfail(const char *a, const char *f, int l)
{