Attaching to a stream hung up before providing any trace packet
causes ctf_open_mmap_stream_read() to return an error.
This kind of scenario can happen with the upcoming "lttng clear"
feature.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
}
ret = prepare_mmap_stream_definition(td, file_stream, packet_seek);
- if (ret)
+ if (ret) {
+ /* We need to check for EOF here for empty files. */
+ if (unlikely(file_stream->pos.offset == EOF)) {
+ ret = 0;
+ }
goto error_index;
+ }
/*
* For now, only a single clock per trace is supported.