The trace facility can be started from a program, through a subroutine call. The subroutine is trcstart() and is in the librts.a library. The syntax of the trcstart() subroutine is as follows:
int trcstart(char *args)
where args is the options list that you would have entered for the trace command. By default, the system trace (channel 0) is started. If you want to start a generic trace, include a -g option in the args string. On successful completion, the trcstart() subroutine returns the channel ID. For generic tracing, this channel ID can be used to record to the private generic channel.
When compiling a program using this subroutine, the link to the librts.a library must be specifically requested (use -l rts as a compile option).
The controls for the trace routine are available as subroutines from the librts.a library. The subroutines return zero on successful completion. The subroutines are: