[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


errlog Subroutine

Purpose

Logs an application error to the system error log.

Library

Run-Time Services Library (librts.a)

Syntax


#include <sys/errids.h>
int errlog ( ErrorStructure, Length)
void *ErrorStructure;
unsigned int Length;

Description

The errlog subroutine writes an error log entry to the /dev/error file. The errlog subroutine is used by application programs.

The transfer from the err_rec structure to the error log is by a write subroutine to the /dev/error special file.

The errdemon process reads from the /dev/error file and writes the error log entry to the system error log. The timestamp, machine ID, node ID, and Software Vital Product Data associated with the resource name (if any) are added to the entry before going to the log.

Parameters


ErrorStructure Points to an error record structure containing an error record. Valid error record structures are typed in the /usr/include/sys/err_rec.h file. The two error record structures available are err_rec and err_rec0. The err_rec structure is used when the detail_data field is required. When the detail_data field is not required, the err_rec0 structure is used.
struct err_rec0 {
unsigned int error_id;
char resource_name[ERR_NAMESIZE];
};
struct err_rec {
unsigned int error_id;
char resource_name[ERR_NAMESIZE];
char detail_data[1];
};

The fields of the structures err_rec and err_rec0 are:

error_id
Specifies an index for the system error template database, and is assigned by the errupdate command when adding an error template. Use the errupdate command with the -h flag to get a #define statement for this 8-digit hexadecimal index.

resource_name
Specifies the name of the resource that has detected the error. For software errors, this is the name of a software component or an executable program. For hardware errors, this is the name of a device or system component. It does not indicate that the component is faulty or needs replacement instead, it is used to determine the appropriate diagnostic modules to be used to analyze the error.

detail_data
Specifies an array from 0 to ERR_REC_MAX bytes of user-supplied data. This data may be displayed by the errpt command in hexadecimal, alphanumeric, or binary form, according to the data_encoding fields in the error log template for this error_id field.
Length Specifies the length in bytes of the err_rec structure, which is equal to the size of the error_id and resource_name fields plus the length in bytes of the detail_data field.

Return Values


0 The entry was logged successfully.
-1 The entry was not logged.

Implementation Specifics

The errlog subroutine is part of Base Operating System (BOS) Runtime.

Files


/dev/error Provides standard device driver interfaces required by the error log component.
/usr/include/sys/errids.h Contains definitions for error IDs.
/usr/include/sys/err_rec.h Contains structures defined as arguments to the errsave kernel service and the errlog subroutine.
/var/adm/ras/errlog Maintains the system error log.

Related Information

The errclear command, errdead command, errinstall command, errlogger command, errmsg command, errpt command, errstop command, errupdate command.

The /dev/error special file.

The errdemon daemon.

The errsave kernel service.

Error Logging Overview in Messages Guide and Reference.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]