* like we can do anything about it either */
}
- reader_flush(reader, now.mono, logger->buf_params.time);
+ // Ditto, can't do much about it
+ (void) reader_flush(reader, now.mono, logger->buf_params.time);
return false;
}
free(sub->sub_userdata);
}
-void subreader_apply_log(void *_sub, void *userdata)
+int subreader_apply_log(void *_sub, void *userdata)
{
struct subreader_common *const sub = (struct subreader_common *) _sub;
assert(sub);
assert(due);
if (!log_should_print_line(sub->filter, due))
- return;
+ return 0;
- sub->sub_apply_log(sub, due);
+ return sub->sub_apply_log(sub, due);
}
-void subreader_flush(void *_sub, void *userdata)
+int subreader_flush(void *_sub, void *userdata)
{
struct subreader_common *const sub = (struct subreader_common *) _sub;
assert(sub);
struct subreader_flush_args *const args = (struct subreader_flush_args *) userdata;
- sub->sub_flush(sub->sub_userdata, args->ts, args->flush_time);
+ return sub->sub_flush(sub->sub_userdata, args->ts, args->flush_time);
}
-void reader_flush(struct reader_common *reader, struct timespec now_mono, int flush)
+int reader_flush(struct reader_common *reader, struct timespec now_mono, int flush)
{
- list_foreach(reader->subs, &(struct subreader_flush_args) {
+ return list_foreach_ret(reader->subs, &(struct subreader_flush_args) {
.ts = now_mono,
.flush_time = flush,
}, subreader_flush);
};
struct subreader_common {
- void (*sub_apply_log)(const struct subreader_common *sub, const struct dlogutil_entry *due);
- void (*sub_flush)(void *sub_userdata, struct timespec ts, int flush_time);
+ int (*sub_apply_log)(const struct subreader_common *sub, const struct dlogutil_entry *due);
+ int (*sub_flush)(void *sub_userdata, struct timespec ts, int flush_time);
void (*sub_destroy)(void *sub_userdata);
void *sub_userdata;
struct log_filter *filter;
};
void reader_deinit_common(struct reader_common *reader);
-void reader_flush(struct reader_common *reader, struct timespec now_mono, int flush);
+int reader_flush(struct reader_common *reader, struct timespec now_mono, int flush);
void reader_free(struct reader_common *reader);
void reader_free_ptr(void *reader);
void subreader_free(void *sub, void *userdata);
-void subreader_apply_log(void *sub, void *userdata);
-void subreader_flush(void *sub, void *userdata);
+int subreader_apply_log(void *sub, void *userdata);
+int subreader_flush(void *sub, void *userdata);
// TODO: Consider calling this in a more robust way (and not having pipe in the name)
fixup_pipe_msg(&entry, r - sizeof(*ale));
- list_foreach(reader->common.subs, &entry.header, subreader_apply_log);
+ // Ignore intermittent write failures. Not a reason to remove the reader.
+ (void) list_foreach_ret(reader->common.subs, &entry.header, subreader_apply_log);
}
}
if (!log_should_print_line(reader->filter, dlogutil_entry))
return 0;
- if (reader->common.subs != NULL) {
- list_foreach(reader->common.subs, (dlogutil_entry_s *) dlogutil_entry, subreader_apply_log);
- return 0;
- }
+ if (reader->common.subs != NULL)
+ return list_foreach_ret(reader->common.subs, (dlogutil_entry_s *) dlogutil_entry, subreader_apply_log);
const char *tag = dlogutil_entry->msg + 1;
if (!strlen(tag))
#include "subreader_file.h"
#include "logger_internal.h"
-static void subreader_file_apply_log(const struct subreader_common *sub, const struct dlogutil_entry *due)
+static int subreader_file_apply_log(const struct subreader_common *sub, const struct dlogutil_entry *due)
{
assert(sub);
assert(due);
if (logfile_write_with_rotation(due, &srf->file, srf->sort_by)) {
// ignore errors, can't do anything about them
}
+
+ return 0;
}
static void subreader_file_free(void *userdata)
logfile_free(&srf->file);
}
-static void subreader_file_flush(void *userdata, struct timespec ts, int flush_time)
+static int subreader_file_flush(void *userdata, struct timespec ts, int flush_time)
{
struct subreader_file *const srf = (struct subreader_file *) userdata;
assert(srf);
flush_logfile_timely(&srf->file, ts, flush_time);
+ return 0;
}
int reader_add_subreader_file(struct reader_common *reader, struct log_filter *filter, struct log_file *file, dlogutil_sorting_order_e sort_by)
#include "subreader_metrics.h"
#include "qos.h"
-static void subreader_metrics_apply_log(const struct subreader_common *sub, const struct dlogutil_entry *due)
+static int subreader_metrics_apply_log(const struct subreader_common *sub, const struct dlogutil_entry *due)
{
assert(sub);
assert(due);
assert(srm);
qos_add_log(srm->qos, due);
+
+ return 0;
}
static void subreader_metrics_free(void *userdata)
// nothing to do; we're just a wrapper over a weak (shared) pointer
}
-static void subreader_metrics_flush(void *userdata, struct timespec ts, int flush_time)
+static int subreader_metrics_flush(void *userdata, struct timespec ts, int flush_time)
{
// nothing to do either; no such concept as flushing metrics
+ return 0;
}