RTEMS Logo

RTEMS 4.6.2 On-Line Library


Event Logging Manager log_open - Open a log file

PREV UP NEXT Bookshelf New Chapters

1.4.4: log_open - Open a log file

CALLING SEQUENCE:

#include <evlog.h>

int log_open(
  logd_t               *logdes,
  const char           *path,
  const log_query_t    *query
);

STATUS CODES:

A successful call to log_open() returns a value of zero and an unsuccessful call returns the errno.

EACCES
Search permission is denied on a component of the path prefix, or the log file exists and read permission is denied.
EINTR
A signal interrupted the call to log_open().
EINVAL
The log_severity field of the query argument exceeds LOG_SEVERITY_MAX.
EINVAL
The path argument referred to a file that was not a log file.
EMFILE
Too many log file descriptors are currently in use by this process.
ENAMETOOLONG
The length of the path string exceeds PATH_MAX, or a pathname component is longer than NAME_MAX while _POSIX_NO_TRUNC is in effect.
ENFILE
Too many files are currently open in the system.
ENOENT
The file specified by the path argument does not exist.
ENOTDIR
A component of the path prefix is not a directory.

DESCRIPTION:

The log_open() function establishes the connection between a log file and a log file descriptor. It creates an open log file descriptor that refers to this query stream on the specified log file The log file descriptor is used by the other log functions to refer to that log query stream. The path argument points to a pathname for a log file. A path argument of NULL specifies the current system log file.

The query argument is not NULL, then it points to a log query specification that is used to filter the records in the log file on subsequent log_read() operations. This restricts the set of event records read using the returned log file descriptor to those which match the query. A query match occurs for a given record when that record's facility is a member of the query's facility set and the record's severity is greater than or equal to the severity specified in the query.

If the value of the query argument is NULL, no query filter shall be applied.

NOTES:

The _POSIX_LOGGING feature flag is defined to indicate this service is available.

POSIX specifies that EINVAL will be returned if the log_facilities field of the query argument is not a valid facility set. In this implementation, this condition can never occur.

Many error codes that POSIX specifies to be returned by log_open() should actually be detected by open() and passed back by the log_open() implementation. In this implementation, EACCESS, EMFILE, ENAMETOOLONG, ENFILE, ENOENT, and ENOTDIR are detected in this manner.


PREV UP NEXT Bookshelf New Chapters

Copyright © 1988-2004 OAR Corporation