Creates an active trace stream and associates it with a trace log.
Posix Trace Library (libposixtrace.a)
The posix_trace_create_withlog subroutine creates an active trace stream, as the posix_trace_create subroutine does, and associates the stream with a trace log.
The file_desc parameter must be the file descriptor designating the trace log destination. The subroutine fails if this file descriptor refers to a file opened with the O_APPEND flag or if this file descriptor refers to a file that is not regular.
For an active trace stream with log, when the posix_trace_shutdown subroutine is called, all trace events that have not been flushed to the trace log are flushed, as in the posix_trace_flush subroutine, and the trace log is closed.
When a trace log is closed, all the information that can be retrieved later from the trace log through the trace interface are written to the trace log. This information includes the trace attributes, the list of trace event types (with the mapping between trace event names and trace event type identifiers), and the trace status.
If the posix_trace_create_withlog subroutine is called with a non-initialized attributes object as parameter, the result is not specified.
Item | Description |
---|---|
pid | Specifies the process ID of the traced process. |
attr | Specifies the trace attributes object. |
file_desc | Specifies the open file descriptor of the trace log. |
trid | Specifies the trace stream identifier. |
Upon successful completion, this subroutine returns a value of zero and stores the trace stream identifier value in the object pointed to by the trid parameter. Otherwise, it returns the corresponding error number.
Item | Description |
---|---|
EAGAIN | No more trace streams can be started now. The value of the TRACE_SYS_MAX has been exceeded. |
EBADF | The file_desc parameter is not a valid file descriptor open for writing. |
EINVAL | The attr parameter is null or the other parameters are invalid. The file_desc parameter refers to a file with a file type that does not support the log policy associated with the trace log. |
ENOMEM | No sufficient memory to create the trace stream with the specified parameters. |
ENOSPC | No space left on device. The device corresponding to the file_desc parameter does not contain the space required to create this trace log. |
EPERM | Does not have appropriate privilege to trace the process specified by the pid parameter. |
ESRCH | The pid parameter does not refer to an existing process. |