ACC Utilities Reference Guide

ZMLOG - Diagnostic Message Logging
ZCOM Diagnostic Message Logging Mechanism
Chapter 6166
User Error Logging Application
The following code shows sections from a program intended to read from
the ZCOM message log device file /dev/zmlog. Note the header file
/opt/acc/include/zcom/zcomsys.h contains the binary error message
data structures:
/*-- Message log buffer --*/
typedef struct {
int32 blen; /* length of buffer data */
int32 nerr; /* number of message overrun errors */
uint8 mbuf[ZCOM_MLSIZE]; /* message buffer */
} zmlog_type;
/*-- Message log record --*/
typedef struct {
uint32 ltime; /* timestamp (must be 1st field) */
char pname[6]; /* originator program name */
int8 scode; /* priority severity code */
uint8 narg; /* number of arguments to follow */
uint32 ecode; /* error code */
int32 mcode; /* message code */
uint8 buf[236]; /* argument buffer - total to 256 bytes */
} zlrec_type;
A partial sample of a user written error logging application is shown
below:
#include ”../h/zcomsys.h”
#include ”../h/zcomcall.h”
/* user data structure declarations */
int fd;
uint8 rlen;
int8 sev;
int32 len;
char *mp;
zlrec_type *zp;
zmlog_type mlog;
/* user needs to add other data structures here */
fd = open (”/dev/zmlog”,O_RDONLY); /* open device file. Note: file
initialized at boot time, and not
cleared, except on a read */
for (;;) { /* looping */