HP-UX Reference (11i v2 07/12) - 7 Device (Special) Files, 9 General Information, Index (vol 10)
s
strlog(7) strlog(7)
or trace logger. It does this by issuing an
I_STR ioctl() system call with the appropriate value in the
ic_cmd field of the strioctl structure, and the appropriate data and control information in a
trace_ids structure:
struct trace_ids {
short ti_mid;
short ti_sid;
char ti_level;
short ti_flags;
};
The values for ic_cmd are:
I_ERRLOG Indicates an error logger. No trace_ids data is needed.
I_TRCLOG Indicates a trace logger. A data buffer consisting of an array of one or more
trace_ids
structures must be included.
If any of the fields of the
trace_ids structure contain a value of -1, /dev/strlog will accept what-
ever value it receives in that field. Otherwise,
strlog only accepts messages only if the values of mid
and sid are the same as their counterparts in the
trace_ids structure, and if the message’s level is
equal to or less than the level value in the trace_ids structure.
Once the logger process has sent the I_STR ioctl() call, the STREAMS log driver begins to send log
messages matching the restrictions to the logger process. The logger process obtains the log messages via
the getmsg() system call. The control part of the messages passed in this call includes a log_ctl
structure:
struct log_ctl {
short mid;
short sid;
char level;
short flags;
long ltime;
long ttime;
int seq_no;
};
The log_ctl structure indicates the mid, sid, and level time in ticks since the boot time that the mes-
sage was submitted, the corresponding time in seconds since January 1, 1970, and a sequence number. The
time in seconds since January 1, 1970 is provided so that the date and time of the message can be easily
computed. The time in ticks since boot time is provided so that the relative timing of log messages can be
determined.
A user process, other than an error or trace logger, can send a log message to
strlog. The driver will
accept only the
flags and level fields of the log_ctl structure in the control part of the message,
and a properly formatted data part of the message. The data part of the message is properly formatted if it
contains a null-terminated format string, followed by up to three arguments packed one word each after the
end of the string.
A different series of sequence numbers is provided for error and trace logging streams. These sequence
numbers are intended to help track the delivery of the messages. A gap in a sequence of numbers indicates
that the logger process did not successfully deliver them. This can happen if the logger process stops send-
ing messages for one reason or another (see strace(1M) and strerr(1M) command reference pages for more
information). The data part of messages contains text of the format string (null terminated), followed by up
to three arguments.
STREAMS-NetTL Link
Both STREAMS error logging and event tracing messages are mapped to NetTL logging messages, and are
delivered to NetTL. NetTL classifies messages into four log classes: DISASTER, ERROR, WARNING, and
INFORMATIVE. The NetTL log class is determined by the flags according to the following rule:
If (flags & SL_ERROR) NetTL log class
then
if (flags & SL_FATAL) ====> DISASTER
if (flags & SL_WARN) ====> WARNING
if (flags & SL_NOTE) ====> INFORMATIVE
otherwise ====> ERROR
182 Hewlett-Packard Company − 2 − HP-UX 11i Version 2: December 2007 Update