/* newline */
fprintf(pos->fp, "\n");
pos->field_nr = 0;
- stream->consumed = 1;
return 0;
/* save the current position as a restore point */
pos->last_offset = pos->offset;
- /* we just read the event, it is consumed when used by the caller */
- stream->consumed = 0;
/*
* This is the EOF check after we've advanced the position in
int ret = 0;
metadata_stream = g_new0(struct ctf_file_stream, 1);
+ metadata_stream->pos.last_offset = LAST_OFFSET_POISON;
if (packet_seek) {
metadata_stream->pos.packet_seek = packet_seek;
}
file_stream = g_new0(struct ctf_file_stream, 1);
+ file_stream->pos.last_offset = LAST_OFFSET_POISON;
if (packet_seek) {
file_stream->pos.packet_seek = packet_seek;
struct ctf_file_stream *file_stream;
file_stream = g_new0(struct ctf_file_stream, 1);
+ file_stream->pos.last_offset = LAST_OFFSET_POISON;
ctf_init_mmap_pos(&file_stream->pos, mmap_info);
file_stream->pos.packet_seek = packet_seek;
uint64_t event_id; /* Current event ID */
int has_timestamp;
uint64_t stream_id;
- int consumed; /* Last packet used by caller */
struct definition_struct *trace_packet_header;
struct definition_struct *stream_packet_context;
#include <stdio.h>
#include <babeltrace/mmap-align.h>
+#define LAST_OFFSET_POISON ((ssize_t) -1L)
+
struct bt_stream_callbacks;
struct packet_index {
*/
stream->timestamp = saved_pos->current_timestamp;
stream_pos->offset = saved_pos->offset;
- stream_pos->last_offset = saved_pos->offset;
+ stream_pos->last_offset = LAST_OFFSET_POISON;
stream->prev_timestamp = 0;
stream->prev_timestamp_end = 0;
- stream->consumed = 0;
printf_debug("restored to cur_index = %zd and "
"offset = %zd, timestamp = %" PRIu64 "\n",
saved_pos.file_stream = cfs;
saved_pos.cur_index = cfs->pos.cur_index;
-
- /*
- * It is possible that an event was read during
- * the last restore, never consumed and its
- * position saved again. For this case, we
- * need to check if the event really was
- * consumed by the caller otherwise it is lost.
- */
- if (stream->consumed)
- saved_pos.offset = cfs->pos.offset;
- else
- saved_pos.offset = cfs->pos.last_offset;
-
+ saved_pos.offset = cfs->pos.last_offset;
saved_pos.current_timestamp = stream->timestamp;
g_array_append_val(