posix_trace_attr_init Subroutine

Purpose

Initializes a trace stream attributes object.

Library

Posix Trace Library (libposixtrace.a)

Syntax

#include <trace.h>

int posix_trace_attr_init(attr)
trace_attr_t * attr;

Description

The posix_trace_attr_init subroutine initializes a trace attributes object, the attr object, with the following default values :
Attribute field Default value
stream_minsize 8192 bytes
stream_fullpolicy For a stream without LOG, the default value is POSIX_TRACE_LOOP

For a stream with LOG, the default value is POSIX_TRACE_FLUSH

max_datasize 16 bytes
inheritance POSIX_TRACE_CLOSE_FOR_CHILD
log_maxsize 1 MB
log_fullpolicy POSIX_TRACE_LOOP
The version and clock-resolution attributes that are generated by the initialized trace attributes object are set to the following values:
Attribute field Value
version 0.1
clock-resolution Clock resolution of the clock used to generate timestamps.

When the stream is created by the posix_trace_create or posix_trace_create_withlog subroutines, the creation_time attribute is set.

When the posix_trace_attr_init subroutine is called specifying an already initialized attr attributes object, this object is initialized with default values, the same as the values in the first initialization. If it is not saved, the already initialized attr attributes object is not accessible any more.

When used by the posix_trace_create subroutine, the resulting attributes object defines the attributes of the trace stream created. A single attributes object can be used in multiple calls to the posix_trace_create subroutine. After one or more trace streams have been created using an attributes object, any subroutine affecting that attributes object, including destruction, will not affect any trace stream previously created. An initialized attributes object also serves to receive the attributes of an existing trace stream or trace log when calling the posix_trace_get_attr subroutine.

The posix_trace_attr_init subroutine initializes again a destroyed attr attributes object.

Parameters

Item Description
attr Specifies the trace attributes object to initialize.

Return Values

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

Errors

The following error codes return when the posix_trace_attr_init subroutine fails:
Item Description
EINVAL The value of the attr parameter is null.
ENOMEM Insufficient memory to initialize the trace attribute object .

Files

The trace.h file in AIX® Version 7.1 Files Reference