posix_trace_attr_setstreamfullpolicy Subroutine

Purpose

Sets the stream full policy.

Library

Posix Trace Library (libposixtrace.a)

Syntax

#include <trace.h>
int posix_trace_attr_setstreamfullpolicy(attr,streampolicy)
const trace_attr_t *attr;
int *streampolicy;

Description

The posix_trace_attr_setstreamfullpolicy subroutine sets the trace stream full policy stored in stream-full-policy attribute of the attr object.

The stream-full-policy attribute of the attr object is set to one of the following values defined by manifest constants in the trace.h header file:
Item Description
POSIX_TRACE_LOOP The trace stream loops until explicitly stopped by the posix_trace_stop subroutine. When the trace stream is full, the trace system reuses the resources allocated to the oldest trace events recorded. In this way, the trace stream always contains the most recent trace events that are recorded.
POSIX_TRACE_UNTIL_FULL The trace stream runs until the trace stream resources are exhausted. This condition can be deduced from the posix_stream_status and posix_stream_full_status (see the posix_trace_status_info structure defined in trace.h header file). When this trace stream is read, a POSIX_TRACE_STOP trace event is reported after the last recorded trace event. The trace system reuses the resources that are allocated to any reported trace events (see the posix_trace_getnext_event, posix_trace_trygetnext_event, and posix_trace_timedgetnext_event subroutines), or trace events that are flushed for an active trace stream with log (see the posix_trace_flush subroutine). The trace system restarts the trace stream when 50 per cent of the buffer size is read. A POSIX_TRACE_START trace event is reported before reporting the next recorded trace event.
POSIX_TRACE_FLUSH This policy is identical to the POSIX_TRACE_UNTIL_FULL trace stream full policy except that the trace stream is flushed regularly as if the posix_trace_flush subroutine is called. Defining this policy for an active trace stream without log is not valid.

For an active trace stream without log, the default value of the stream-full-policy attribute for the attr object is POSIX_TRACE_LOOP.

For an active trace stream with log, the default value of the stream-full-policy attribute for the attr object is POSIX_TRACE_FLUSH.

If the subroutine is called with a non-initialized attributes object as parameter, the result is not specified.

Parameters

Item Description
attr Specifies the trace attributes object.
streampolicy Specifies where the stream-full-policy attribute of the attr object is attained.

Return Values

Upon successful completion, the subroutine returns a value of zero. Otherwise, it returns the corresponding error number.

Errors

The subroutine fails if the following error number returns:
Item Description
EINVAL The attr parameter is null or the other parameter is not valid.

Files

The trace.h file in Files Reference