Seeks into a trace object and returns the current position that will be used with a future seek.
libtrace.a
#include <sys/libtrace.h>
int trc_seek (handle, log_positionp, r)
trc_loghandle_t handle;
trc_logpos_t log_positionp;
trc_read_t *r;
int trc_tell (handle, log_positionp)
trc_loghandle_t handle;
trc_logpos_t *log_positionp;
The trc_seek subroutine seeks into the log object identified by the handle parameter. The log_positionp parameter must have been obtained from a previous call to the trc_tell subroutine. If the trc_read_t pointer, r, is not NULL, the trc_seek subroutine returns the trace data at the seek point.
The trc_tell subroutine creates a trc_logpos_t object using the current log position and state.
The trc_free subroutine should be used to free a trc_logpos_t object that's no longer needed. However, trc_free is not necessary if the trc_logpos_t object is passed to another trc_tell.
Item | Description |
---|---|
handle | Contains the handle returned from a successful call to the trc_open subroutine. |
log_positionp | A trc_logpos_t returned by a previous call to the trc_tell subroutine. |
r | If not NULL, points to a trc_read_t data item where the data at the new position is returned. |
Upon successful return, the trc_seek and trc_tell subroutines return 0.
If unsuccessful, the trc_seek subroutine returns an i/o error, or EINVAL if either the handle or log_positionp parameter is in error.
Upon error, the trc_tell subroutine returns EINVAL if the handle is invalid, or ENOMEM if storage can't be obtained for the trc_logpos_t object.