goto error;
return put_u64(seq, arg);
}
+ case LTTNG_RING_BUFFER_INSTANCE_ID:
+ {
+ uint64_t id;
+
+ ret = ops->instance_id(config, buf, &id);
+ if (ret < 0)
+ goto error;
+ return put_u64(id, arg);
+ }
default:
return lib_ring_buffer_file_operations.unlocked_ioctl(filp,
cmd, arg);
goto error;
return put_u64(seq, arg);
}
+ case LTTNG_RING_BUFFER_COMPAT_INSTANCE_ID:
+ {
+ uint64_t id;
+
+ ret = ops->instance_id(config, buf, &id);
+ if (ret < 0)
+ goto error;
+ return put_u64(id, arg);
+ }
default:
return lib_ring_buffer_file_operations.compat_ioctl(filp,
cmd, arg);
#define LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP _IOR(0xF6, 0x26, uint64_t)
/* returns the packet sequence number */
#define LTTNG_RING_BUFFER_GET_SEQ_NUM _IOR(0xF6, 0x27, uint64_t)
+/* returns the stream instance id */
+#define LTTNG_RING_BUFFER_INSTANCE_ID _IOR(0xF6, 0x28, uint64_t)
#ifdef CONFIG_COMPAT
/* returns the timestamp begin of the current sub-buffer */
/* returns the packet sequence number */
#define LTTNG_RING_BUFFER_COMPAT_GET_SEQ_NUM \
LTTNG_RING_BUFFER_GET_SEQ_NUM
+/* returns the stream instance id */
+#define LTTNG_RING_BUFFER_COMPAT_INSTANCE_ID \
+ LTTNG_RING_BUFFER_INSTANCE_ID
#endif /* CONFIG_COMPAT */
#endif /* _LTTNG_ABI_H */
" uint32_t magic;\n"
" uint8_t uuid[16];\n"
" uint32_t stream_id;\n"
+ " uint64_t stream_instance_id;\n"
" };\n"
"};\n\n",
lttng_alignof(uint8_t) * CHAR_BIT,
int (*sequence_number) (const struct lib_ring_buffer_config *config,
struct lib_ring_buffer *bufb,
uint64_t *seq);
+ int (*instance_id) (const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *id);
};
struct lttng_transport {
*/
uint8_t uuid[16];
uint32_t stream_id;
+ uint64_t stream_instance_id;
struct {
/* Stream packet context */
header->magic = CTF_MAGIC_NUMBER;
memcpy(header->uuid, session->uuid.b, sizeof(session->uuid));
header->stream_id = lttng_chan->id;
+ header->stream_instance_id = buf->backend.cpu;
header->ctx.timestamp_begin = tsc;
header->ctx.timestamp_end = 0;
header->ctx.content_size = ~0ULL; /* for debugging */
return 0;
}
+static
+int client_instance_id(const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *buf,
+ uint64_t *id)
+{
+ struct packet_header *header = client_packet_header(config, buf);
+ *id = header->stream_instance_id;
+
+ return 0;
+}
+
static const struct lib_ring_buffer_config client_config = {
.cb.ring_buffer_clock_read = client_ring_buffer_clock_read,
.cb.record_header_size = client_record_header_size,
.stream_id = client_stream_id,
.current_timestamp = client_current_timestamp,
.sequence_number = client_sequence_number,
+ .instance_id = client_instance_id,
},
};
return -ENOSYS;
}
+static
+int client_instance_id(const struct lib_ring_buffer_config *config,
+ struct lib_ring_buffer *bufb,
+ uint64_t *id)
+{
+ return -ENOSYS;
+}
+
static const struct lib_ring_buffer_config client_config = {
.cb.ring_buffer_clock_read = client_ring_buffer_clock_read,
.cb.record_header_size = client_record_header_size,
.stream_id = client_stream_id,
.current_timestamp = client_current_timestamp,
.sequence_number = client_sequence_number,
+ .instance_id = client_instance_id,
},
};