From e3051bf4696207e60e77fdebd8489b4ce120a9ea Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 27 Feb 2008 08:33:48 +0100 Subject: [PATCH] src/plugin.[ch]: Implemented `plugin_flush_one' which flushes only one specific plugin. --- src/plugin.c | 22 +++++++++++++++++++++- src/plugin.h | 5 ++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index ca6193be..eaf1a410 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1,6 +1,6 @@ /** * collectd - src/plugin.c - * Copyright (C) 2005,2006 Florian octo Forster + * Copyright (C) 2005-2008 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -17,6 +17,7 @@ * * Authors: * Florian octo Forster + * Sebastian Harl **/ #include "collectd.h" @@ -650,6 +651,25 @@ void plugin_read_all (void) pthread_mutex_unlock (&read_lock); } /* void plugin_read_all */ +int plugin_flush_one (int timeout, const char *name) +{ + int (*callback) (int); + llentry_t *le; + int status; + + if (list_flush == NULL) + return (-1); + + le = llist_search (list_flush, name); + if (le == NULL) + return (-1); + callback = (int (*) (int)) le->value; + + status = (*callback) (timeout); + + return (status); +} /* int plugin_flush_ont */ + void plugin_flush_all (int timeout) { int (*callback) (int); diff --git a/src/plugin.h b/src/plugin.h index aea0e4df..7b59930d 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -2,7 +2,7 @@ #define PLUGIN_H /** * collectd - src/plugin.h - * Copyright (C) 2005-2007 Florian octo Forster + * Copyright (C) 2005-2008 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -19,6 +19,7 @@ * * Authors: * Florian octo Forster + * Sebastian Harl **/ #include "collectd.h" @@ -152,6 +153,8 @@ void plugin_read_all (void); void plugin_flush_all (int timeout); void plugin_shutdown_all (void); +int plugin_flush_one (int timeout, const char *name); + /* * The `plugin_register_*' functions are used to make `config', `init', * `read', `write' and `shutdown' functions known to the plugin -- 2.11.0