* Set index data from the control port to a given index object.
*/
static int set_index_control_data(struct relay_index *index,
- struct lttcomm_relayd_index *data)
+ struct lttcomm_relayd_index *data,
+ struct relay_connection *conn)
{
struct ctf_packet_index index_data;
index_data.timestamp_end = data->timestamp_end;
index_data.events_discarded = data->events_discarded;
index_data.stream_id = data->stream_id;
+
+ if (conn->minor >= 8) {
+ index->index_data.stream_instance_id = data->stream_instance_id;
+ index->index_data.packet_seq_num = data->packet_seq_num;
+ }
+
return relay_index_set_data(index, &index_data);
}
ERR("relay_index_get_by_id_or_create index NULL");
goto end_stream_put;
}
- if (set_index_control_data(index, &index_info)) {
+ if (set_index_control_data(index, &index_info, conn)) {
ERR("set_index_control_data error");
relay_index_put(index);
ret = -1;
#define CTF_INDEX_MAGIC 0xC1F1DCC1
#define CTF_INDEX_MAJOR 1
-#define CTF_INDEX_MINOR 0
+#define CTF_INDEX_MINOR 1
/*
* Header at the beginning of each index file.
uint64_t timestamp_begin;
uint64_t timestamp_end;
uint64_t events_discarded;
- uint64_t stream_id;
+ uint64_t stream_id; /* ID of the channel */
+ /* CTF_INDEX 1.0 limit */
+ uint64_t stream_instance_id; /* ID of the channel instance */
+ uint64_t packet_seq_num; /* packet sequence number */
} __attribute__((__packed__));
#endif /* LTTNG_INDEX_H */
}
index->stream_id = htobe64(index->stream_id);
+ ret = kernctl_get_instance_id(infd, &index->stream_instance_id);
+ if (ret < 0) {
+ PERROR("kernctl_get_instance_id");
+ goto error;
+ }
+ index->stream_instance_id = htobe64(index->stream_instance_id);
+
+ ret = kernctl_get_sequence_number(infd, &index->packet_seq_num);
+ if (ret < 0) {
+ PERROR("kernctl_get_sequence_number");
+ goto error;
+ }
+ index->packet_seq_num = htobe64(index->packet_seq_num);
+
error:
return ret;
}
msg.events_discarded = index->events_discarded;
msg.stream_id = index->stream_id;
+ if (rsock->minor >= 8) {
+ msg.stream_instance_id = index->stream_instance_id;
+ msg.packet_seq_num = index->packet_seq_num;
+ }
+
/* Send command */
ret = send_command(rsock, RELAYD_SEND_INDEX, &msg, sizeof(msg), 0);
if (ret < 0) {
uint64_t timestamp_end;
uint64_t events_discarded;
uint64_t stream_id;
+ uint64_t stream_instance_id;
+ uint64_t packet_seq_num;
} LTTNG_PACKED;
/*
}
index->stream_id = htobe64(index->stream_id);
+ ret = ustctl_get_instance_id(ustream, &index->stream_instance_id);
+ if (ret < 0) {
+ PERROR("ustctl_get_instance_id");
+ goto error;
+ }
+ index->stream_instance_id = htobe64(index->stream_instance_id);
+
+ ret = ustctl_get_sequence_number(ustream, &index->packet_seq_num);
+ if (ret < 0) {
+ PERROR("ustctl_get_sequence_number");
+ goto error;
+ }
+ index->packet_seq_num = htobe64(index->packet_seq_num);
+
error:
return ret;
}