Merge branch 'collectd-4.3' into collectd-4.4
authorFlorian Forster <octo@huhu.verplant.org>
Thu, 21 Aug 2008 15:24:32 +0000 (17:24 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Thu, 21 Aug 2008 15:24:32 +0000 (17:24 +0200)
1  2 
src/collectd-exec.pod
src/plugin.c

diff --combined src/collectd-exec.pod
@@@ -88,7 -88,7 +88,7 @@@ key-value-pair. A list of currently und
  other options will be ignored.
  
  I<Valuelist> is a colon-separated list of the time and the values, each either
- an integer if the data-source is a counter, of a double if the data-source if
+ an integer if the data-source is a counter, or a double if the data-source is
  of type "gauge". You can submit an undefined gauge-value by using B<U>. When
  submitting B<U> to a counter the behavior is undefined. The time is given as
  epoch (i.E<nbsp>e. standard UNIX time).
@@@ -171,13 -171,11 +171,13 @@@ table. All the options are optional, bu
  or B<type_instance> without B<type> doesn't make much sense and should be
  avoided.
  
 -Please note that this is the same format as used in the B<unixsock plugin>, see
 -L<collectd-unixsock(5)>.
 +=back
  
  =back
  
 +Please note that this is the same format as used in the B<unixsock plugin>, see
 +L<collectd-unixsock(5)>.
 +
  When collectd exits it sends a B<SIGTERM> to all still running
  child-processes upon which they have to quit.
  
diff --combined src/plugin.c
@@@ -1,6 -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,7 -17,6 +17,7 @@@
   *
   * Authors:
   *   Florian octo Forster <octo at verplant.org>
 + *   Sebastian Harl <sh at tokkee.org>
   **/
  
  #include "collectd.h"
@@@ -54,7 -53,6 +54,7 @@@ typedef struct read_func_s read_func_t
  static llist_t *list_init;
  static llist_t *list_read;
  static llist_t *list_write;
 +static llist_t *list_flush;
  static llist_t *list_shutdown;
  static llist_t *list_log;
  static llist_t *list_notification;
@@@ -148,14 -146,14 +148,14 @@@ static int plugin_load_file (char *file
        {
                const char *error = lt_dlerror ();
  
-               ERROR ("lt_dlopen failed: %s", error);
-               fprintf (stderr, "lt_dlopen failed: %s\n", error);
+               ERROR ("lt_dlopen (%s) failed: %s", file, error);
+               fprintf (stderr, "lt_dlopen (%s) failed: %s\n", file, error);
                return (1);
        }
  
        if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
        {
-               WARNING ("Couldn't find symbol ``module_register'' in ``%s'': %s\n",
+               WARNING ("Couldn't find symbol `module_register' in `%s': %s\n",
                                file, lt_dlerror ());
                lt_dlclose (dlh);
                return (-1);
@@@ -439,11 -437,6 +439,11 @@@ int plugin_register_write (const char *
        return (register_callback (&list_write, name, (void *) callback));
  } /* int plugin_register_write */
  
 +int plugin_register_flush (const char *name, int (*callback) (const int))
 +{
 +      return (register_callback (&list_flush, name, (void *) callback));
 +} /* int plugin_register_flush */
 +
  int plugin_register_shutdown (char *name,
                int (*callback) (void))
  {
@@@ -538,11 -531,6 +538,11 @@@ int plugin_unregister_write (const cha
        return (plugin_unregister (list_write, name));
  }
  
 +int plugin_unregister_flush (const char *name)
 +{
 +      return (plugin_unregister (list_flush, name));
 +}
 +
  int plugin_unregister_shutdown (const char *name)
  {
        return (plugin_unregister (list_shutdown, name));
@@@ -661,43 -649,6 +661,43 @@@ 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);
 +      llentry_t *le;
 +
 +      if (list_flush == NULL)
 +              return;
 +
 +      le = llist_head (list_flush);
 +      while (le != NULL)
 +      {
 +              callback = (int (*) (int)) le->value;
 +              le = le->next;
 +
 +              (*callback) (timeout);
 +      }
 +} /* void plugin_flush_all */
 +
  void plugin_shutdown_all (void)
  {
        int (*callback) (void);