Skip to content

Commit

Permalink
core: move pipe(2) channels to plugin instances
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Feb 15, 2016
1 parent b3bc596 commit 79984d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions include/fluent-bit/flb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ struct flb_config {

/* Kernel info */
struct flb_kernel *kernel;

/* Lib mode data */
struct flb_lib_ctx *lib_ctx;
};

int __flb_config_verbose;
Expand Down
3 changes: 3 additions & 0 deletions include/fluent-bit/flb_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct flb_input_plugin {
* and the variable one that is generated when the plugin is invoked.
*/
struct flb_input_instance {
int channel[2]; /* pipe(2) channel */
char name[16]; /* numbered name (cpu -> cpu.0) */
void *context; /* plugin configuration context */
struct flb_input_plugin *p; /* original plugin */
Expand Down Expand Up @@ -161,6 +162,8 @@ int flb_input_set_property(struct flb_input_instance *in, char *k, char *v);

int flb_input_check(struct flb_config *config);
void flb_input_set_context(struct flb_input_instance *in, void *context);
int flb_input_channel_init(struct flb_input_instance *in);

int flb_input_set_collector_time(struct flb_input_instance *in,
int (*cb_collect) (struct flb_config *, void *),
time_t seconds,
Expand Down
6 changes: 3 additions & 3 deletions src/flb_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ flb_ctx_t *flb_create()
return NULL;
}
ctx->config = config;
config->lib_ctx = ctx;

/* Initialize our pipe to send data to our worker */
ret = pipe(config->ch_data);
Expand Down Expand Up @@ -177,11 +176,12 @@ int flb_lib_config_file(struct flb_lib_ctx *ctx, char *path)
}

/* Push some data into the Engine */
int flb_lib_push(struct flb_lib_ctx *ctx, void *data, size_t len)
int flb_lib_push(flb_input_t *input, void *data, size_t len)
{
int ret;

ret = write(ctx->config->ch_data[1], data, len);
ret = write(input->channel[1], data, len);
printf("wrote: %lu/%lu\n", ret, len);
if (ret == -1) {
perror("write");
}
Expand Down

0 comments on commit 79984d3

Please sign in to comment.