STREAMS-UX Programmer's Guide (February 2007)

STREAMS Utilities Supported by HP-UX
Appendix B
161
NAME
cmn_err () – Display a message on the console and optionally panic the system.
SYNOPSIS
#include <sys/cmn_err.h>
void cmn_err(int level, char *format...);/* args */
PARAMETERS
level
Severity of the error condition. Takes one of the following values:
CE_CONT Used to continue a previous message or to display an informative message
not connected with an error.
CE_NOTE To display the message preceded with NOTICE:. This is used to report the
system events that do not necessarily require action, but may interest to
system administrator.
CE_WARN To display the message preceded with WARNING:. This message is used to
report the system events that require action.
CE_PANIC To display a message preceded with panic: and panic the system. The
production code should never panic the system.
format
The message to be displayed. The message is always sent to both the system console and
kernel buffer. If the first character specified in the message is an exclamation point (“!”) or
circumflex (“^), cmn_err() ignores it.
The functionality of cmn_err() is similar to fprintf() and the valid conversion
specifications are: %c, %d, %o, %x, %s and %u.
DESCRIPTION
The cmn_err always sends the message to both the system console and circular kernel buffer. The circular
buffer is called msgbuf. The HP-UX msgbuf is a fixed size and can be viewed using the dmesg command or the
kwdb debugger tool.
RETURN VALUES
None
CONSTRAINTS
cmn_err() can be called from thread or interrupt context. Spinlocks can be held across this call. If level is
CE_PANIC the system will panic.