errlog_open Subroutine

Purpose

Opens an error log and returns a handle for use with other liberrlog.a functions.

Syntax

library liberrlog.a

#include <fcntl.h>
#include <sys/errlog.h>

int errlog_open(path, mode, magic, handle)
char            *path;
int              mode;
unsigned int     magic;
errlog_handle_t *handle;

Description

The error log specified by the path argument will be opened using mode. The handle pointed to by the handle parameter must be used with subsequent operations.

Parameters

The path parameter specifies the path to the log file to be opened. If path is NULL, the default errlog file will be opened. The valid values for mode are the same as they are for the open system subroutine. They can be found in the fcntl.h files.

The magic argument takes the LE_MAGIC value, indicating which version of the errlog_entry_t structure this application was compiled with.

Return Values

Upon successful completion, the errlog_open subroutine returns a 0 and sets the memory pointed to by handle to a handle used by subsequent liberrlog operations.

Upon error, the errlog_open subroutine returns one of the following:

Item Description
LE_ERR_INVARG A parameter error was detected.
LE_ERR_NOFILE The log file does not exist.
LE_ERR_NOMEM Memory could not be allocated.
LE_ERR_IO An i/o error occurred.
LE_ERR_INVFILE The file is not a valid error log.