HP-UX Reference (11i v1 00/12) - 5 Miscellaneous Topics, 7 Device (Special) Files, 9 General Information, Index (vol 9)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man7/!!!intro.7
________________________________________________________________
___ ___
s
strlog(7) strlog(7)
else
all messages ====> INFORMATIVE
As a default, only DISASTER and ERROR messages are logged. This setting can be altered by the nettl
command or the nettlconf command (see nettl(1M) and nettlconf(1M)).
The STREAMS subsystem ID used by NetTL is STREAMS.
The messages logged by NetTL facility can be formatted to a readable form by the netfmt command (see
netfmt(1M)). The netfmt accepts a filter configuration file, which can be used to lter on STREAMS
module ID and sub-ID. The filter configuration file syntax for STREAMS is the following:
STREAMS module_id sub_id
module_id and sub_id can be a decimal number or ‘‘*’’ as a wild card.
RETURN VALUE
Unless specified otherwise, upon successful completion, the strlog ioctl() commands return a value
of 0 (zero). Otherwise, a value of -1 is returned.
ERRORS
If any of the following conditions occurs, strlog driver’s
ioctl() command sets errno to the
corresponding value:
[ENXIO] The
I_TRCLOG ioctl() call did not contain any trace_ids structures.
[ENXIO] The I_STR ioctl() call could not be recognized.
The driver does not return any errors for incorrectly formatted messages that user processes send.
EXAMPLES
The following examples illustrate some basic uses for the strlog interface.
This code example segment shows how a STREAMS module causes a message to be printed to the console:
strlog(TMUX,minor(mydev),0,SL_CONSOLE|SL_FATAL,
"TMUX driver (minor:%d) suffers resource shortage.",
minor(mydev));
This code example shows how a user process registers itself with the STREAMS log driver using the
ioctl() command, I_ERRLOG.
struct strioctl iocerr:
int logfd;
if ((logfd = open("/dev/strlog", O_RDWR)) == -1) {
printf("Cannot open /dev/strlog\n");
exit(1);
}
iocerr.ic_cmd = I_ERRLOG;
iocerr.ic_timout = 0;
iocerr.ic_len = 0;
iocerr.ic_dp = NULL;
ioctl(logfd, I_STR, &iocerr);
This code example shows a user-level process sending a message to the strlog driver.
struct strbuf control, data;
struct log_ctl log;
char *warning = "Fatal error for user level process";
int logfd;
if ((logfd = open("/dev/strlog", O_RDWR)) == -1) {
printf("Cannot open /dev/strlog\n");
exit(1);
}
control.len = control.maxlen = sizeof(log);
HP-UX Release 11i: December 2000 3 Section 7151
___
___