cmn_err(9F) Kernel Functions for Drivers cmn_err(9F)
NAME
cmn_err, vcmn_err, zcmn_err - display an error message or panic the system
SYNOPSIS
#include <sys/cmn_err.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
void cmn_err(int level, char *format...);
#include <sys/varargs.h>
void vcmn_err(int level, char *format, va_list ap);
#include <sys/types.h>
void zcmn_err(zoneid_t zoneid, int level, char *format...);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
cmn_err()
level A constant indicating the severity of the error condition.
format Message to be displayed.
vcmn_err()
vcmn_err() takes level and format as described for cmn_err(), but its third argument is different:
ap Variable argument list passed to the function.
zcmn_err()
zcmn_err() works exactly like cmn_err(), but includes an additional argument:
zoneid Zone to which log messages should be directed. See zones(5).
DESCRIPTION
cmn_err()
cmn_err() displays a specified message on the console. cmn_err() can also panic the system. When the system panics, it attempts to save
recent changes to data, display a "panic message" on the console, attempt to write a core file, and halt system processing. See the
CE_PANIC level below.
level is a constant indicating the severity of the error condition. The four severity levels are:
CE_CONT Used to continue another message or to display an informative message not associated with an error. Note that multiple
CE_CONT messages without a newline may or may not appear on the system console or in the system log as a single line mes-
sage. A single line message may be produced by constructing the message with sprintf(9F) or vsprintf(9F) before calling
cmn_err().
CE_NOTE Used to display a message preceded with NOTICE. This message is used to report system events that do not necessarily
require user action, but may interest the system administrator. For example, a message saying that a sector on a disk needs
to be accessed repeatedly before it can be accessed correctly might be noteworthy.
CE_WARN Used to display a message preceded with WARNING. This message is used to report system events that require immediate atten-
tion, such as those where if an action is not taken, the system may panic. For example, when a peripheral device does not
initialize correctly, this level should be used.
CE_PANIC Used to display a message preceded with "panic", and to panic the system. Drivers should specify this level only under the
most severe conditions or when debugging a driver. A valid use of this level is when the system cannot continue to func-
tion. If the error is recoverable, or not essential to continued system operation, do not panic the system.
format is the message to be displayed. It is a character string which may contain plain characters and conversion specifications. By
default, the message is sent both to the system console and to the system log.
Each conversion specification in format is introduced by the % character, after which the following appear in sequence:
An optional decimal digit specifying a minimum field width for numeric conversion. The converted value will be right-justified and padded
with leading zeroes if it has fewer characters than the minimum.
An optional l (ll) specifying that a following d, D, o, O, x, X, or u conversion character applies to a long (long long) integer argument.
An l (ll) before any other conversion character is ignored.
A character indicating the type of conversion to be applied:
d,D,o,O,x,X,u The integer argument is converted to signed decimal (d, D), unsigned octal (o, O), unsigned hexadecimal (x, X), or unsigned
decimal (u), respectively, and displayed. The letters abcdef are used for x and X conversion.
c The character value of the argument is displayed.
b The %b conversion specification allows bit values to be displayed meaningfully. Each %b takes an integer value and a format
string from the argument list. The first character of the format string should be the output base encoded as a control
character. This base is used to display the integer argument. The remaining groups of characters in the format string con-
sist of a bit number (between 1 and 32, also encoded as a control character) and the next characters (up to the next con-
trol character or '