return 0;
// Initialize the source
- r = self->impl->init(self->ctx);
+ r = self->impl->init(self->ctx, self);
if (r < 0) {
ERROR(self->ctx, "Failed to initialize %s: %s\n",
td_source_name(self), strerror(-r));
td_rrd_rra rrd_rras[MAX_RRA];
// Init
- int (*init)(td_ctx* ctx);
+ int (*init)(td_ctx* ctx, td_source* source);
// Free
int (*free)(td_ctx* ctx);
static unsigned int num_cpus = 0;
static int* perf_eventfds = NULL;
-static int contextswitches_init(td_ctx* ctx) {
+static int contextswitches_init(td_ctx* ctx, td_source* source) {
struct perf_event_attr event = {
.type = PERF_TYPE_SOFTWARE,
.config = PERF_COUNT_SW_CONTEXT_SWITCHES,
rtnl_link_stat_id_t id;
} interfaces_stats;
-static int interfaces_init(td_ctx* ctx) {
+static int interfaces_init(td_ctx* ctx, td_source* source) {
int r;
// Don't open the socket again
unsigned int num_comments;
} nftables_comments;
-static int nftables_init(td_ctx* ctx) {
+static int nftables_init(td_ctx* ctx, td_source* source) {
int r;
// Don't create another socket if one is already open