src/plugin.[ch]: Implemented `plugin_flush_one' which flushes only one specific plugin.
authorFlorian Forster <octo@huhu.verplant.org>
Wed, 27 Feb 2008 07:33:48 +0000 (08:33 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 27 Feb 2008 07:33:48 +0000 (08:33 +0100)
src/plugin.c
src/plugin.h

index ca6193b..eaf1a41 100644 (file)
@@ -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 <octo at verplant.org>
+ *   Sebastian Harl <sh at tokkee.org>
  **/
 
 #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);
index aea0e4d..7b59930 100644 (file)
@@ -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 <octo at verplant.org>
+ *   Sebastian Harl <sh at tokkee.org>
  **/
 
 #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