Opens a trace log object.
libtrace.a
#include <sys/libtrace.h>
int trc_open (log_object_name, template_file_name, type, handlep)
char *log_object_name, template_file_name;
int type;
trc_log_handle_t *handlep;
The trc_open subroutine opens a trace log object. A log object may only be opened for reading.
Two object types are supported, raw and processed. As their names imply, a raw object consists of the raw trace data as it was traced. A processed object consists of data as processed by a trace formatting template file such as the /etc/trcfmt file.
Item | Description |
---|---|
log_object_name | Specifies the log object to be opened. If this
is NULL or an empty string, the default log object, /var/adm/ras/trcfile,
is opened. If it is a dash, the input is read from standard input.
In this case, the file must be a sequential trace file such as one
produced by the trcrpt -r command, the -o trace option,
or the trcdead command.
If the file is the base file for a multi-CPU trace, the trace events are merged by the trcrpt command, unless the TRC_NOTEMPLATES option was specified. Also, if the file is a single CPU's trace file, it is treated as a single log file. If multiple files are specified for merging, the TRC_MULTI_MERGE option must be specified. Each file must be separated from the previous one by a colon. For example, merging 3 files (f1, f2 and f3) is accomplished by setting the log_object_name parameter to f1:f2:f3. |
template_file_name | This names the template file. The template file is used if the TRC_LOGPROC type is specified. If NULL, /etc/trcfmt (the default template file) is used. The template file specification is ignored if the TRC_NOTEMPLATES option is specified. |
type | Consists of flag bits OR'd together. One open
type and one object type flag must be specified.
The following is the open type flag:
The following are the object type flags:
The following are the modifier type flags:
|
handlep | Points to the handle returned from a successful call to the trc_open subroutine. |
Upon successful completion, the trc_open subroutine returns a 0 and puts the trace log object handle into the memory pointed to by the handlep parameter.
Item | Description |
---|---|
EINVAL | Invalid parameter. |
ENOMEM | Cannot allocate memory. |
TRCE_BADFORMAT | The file is not a valid trace file, and errno is set to EINVAL. |
TRCE_WARN | The template file contains errors. The errno global variable is set to EINVAL if TRCE_TMPLTFORMAT is returned. If TRCE_WARN is returned, the open succeeded. |
TRCE_TMPLTFORMAT | The template file contains errors. The errno global variable is set to EINVAL if TRCE_TMPLTFORMAT is returned. If TRCE_WARN is returned, the open succeeded. |
TRCE_TOOMANY | An internal limit is exceeded. The errno global variable is set to ENOMEM in this case. |