return ret;
}
+/*
+ * Write a character on the metadata poll pipe to wake the metadata thread.
+ * Returns 0 on success, -1 on error.
+ */
+int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel)
+{
+ int ret = 0;
+ const char dummy = 'c';
+
+ if (channel->monitor && channel->metadata_stream) {
+ ssize_t write_ret;
+
+ write_ret = lttng_write(channel->metadata_stream->ust_metadata_poll_pipe[1],
+ &dummy, 1);
+ if (write_ret < 1) {
+ PERROR("Wake-up UST metadata pipe");
+ ret = -1;
+ goto end;
+ }
+ }
+
+end:
+ return ret;
+}
+
/*
* Write metadata to the cache, extend the cache if necessary. We support
* overlapping updates, but they need to be contiguous. Send the
char *data)
{
int ret = 0;
- int size_ret;
struct consumer_metadata_cache *cache;
assert(channel);
memcpy(cache->data + offset, data, len);
if (offset + len > cache->max_offset) {
- char dummy = 'c';
-
cache->max_offset = offset + len;
- if (channel->monitor && channel->metadata_stream) {
- size_ret = lttng_write(channel->metadata_stream->ust_metadata_poll_pipe[1],
- &dummy, 1);
- if (size_ret < 1) {
- ERR("Wakeup UST metadata pipe");
- ret = -1;
- goto end;
- }
- }
+ ret = consumer_metadata_wakeup_pipe(channel);
}
end:
void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel);
int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
uint64_t offset, int timer);
+int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel);
#endif /* CONSUMER_METADATA_CACHE_H */