IBM® Carrier Grade Server X3650 T
Revision 3.0
77
17. APPENDIX E – POSIX Logging API and Query
Specification for SysCon
17.1 Logging Functions
17.1.1 Write to the Log
Function: syscon_log_write()
17.1.1.1 Synopsis
#include <syscon.h>
int syscon_log_write(syscon_log_event_type_t event_type, int event_type,
syscon_log_severity_t severity, const void *buf, size_t len,
int format);
17.1.1.2 Description
The syscon_log_write() function writes an event record to the syscon event log. The syscon_log_write()
succeeds in writing a complete log record or it leaves the system log unchanged. The event record
consists of a syscon_log_entry structure (or an implementation-defined object that includes the members
of struct syscon_log_entry) and a copy of the data (if any) referenced by the buf argument.
The event record’s log_size member shall be set to the value of the len argument, or to zero if buf is
NULL. The len argument specifies the length in bytes of the data referenced by buf. If buf is NULL, or
the len argument is zero, then only the syscon_log_entry structure is included in the event record.
If the value of len is greater than {SYSCONLOG_ENTRY_MAXLEN} and buf is not NULL, the result of
the syscon_log_write() shall be as follows:
• If {SYSCONLOG_TRUNCATE} is not defined by the implementation, syscon_log_write() shall fail.
• Otherwise, syscon_log_write() will set the {SYSCONLOG_TRUNCATE} flag in the event record’s
log_flags member, the event record’s log_size member will be set to
{SYSCONLOG_ENTRY_MAXLEN}, and only the first {SYSCONLOG_ENTRY_MAXLEN} bytes of the
data pointed to by buf will be included in the data portion of the event record. If the value of the
format argument is {SYSCONLOG_STRING}, a null character will be stored at the end of the data
portion of the record, so that the truncated string is null-terminated.
1
If buf is NULL, or the len argument is zero, the event record's log_format member will be set to
{SYSCONLOG_NODATA}; otherwise, the event record's log_format member will be set to the value of
the format argument. The interpretation of this value will be implementation-defined, with the following
exception:
A format of {SYSCONLOG_STRING} shall indicate that buf points to a null-terminated character string
whose length in bytes (including the terminating null character) is len.
The event_type argument identifies the type of event record being written. Its value and interpretation are
left to the application or the implementation. The event record’s log_event_type member shall be set to
the value of the event_type argument.
1
Note, however, that the implementation is not permitted to accomplish this by setting
buf[SYSCONLOG_ENTRY_MAXLEN-1] to the null character, since buf points to a const buffer.