projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-4.2' into collectd-4.3
[collectd.git]
/
src
/
unixsock.c
diff --git
a/src/unixsock.c
b/src/unixsock.c
index
f8dcc5b
..
45ed9c6
100644
(file)
--- a/
src/unixsock.c
+++ b/
src/unixsock.c
@@
-1,6
+1,6
@@
/**
* collectd - src/unixsock.c
/**
* collectd - src/unixsock.c
- * Copyright (C) 2007 Florian octo Forster
+ * Copyright (C) 2007
,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
*
* 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
@@
-23,7
+23,9
@@
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
+
#include "utils_cmd_putval.h"
#include "utils_cmd_putval.h"
+#include "utils_cmd_putnotif.h"
/* Folks without pthread will need to disable this plugin. */
#include <pthread.h>
/* Folks without pthread will need to disable this plugin. */
#include <pthread.h>
@@
-81,7
+83,7
@@
static pthread_t listen_thread = (pthread_t) 0;
/* Linked list and auxilliary variables for saving values */
static value_cache_t *cache_head = NULL;
static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
/* Linked list and auxilliary variables for saving values */
static value_cache_t *cache_head = NULL;
static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
-static
unsigned int cache_oldest = UINT_MAX
;
+static
time_t cache_oldest = -1
;
/*
* Functions
/*
* Functions
@@
-188,7
+190,7
@@
static int cache_insert (const data_set_t *ds, const value_list_t *vl)
cache_head = vc;
vc->time = vl->time;
cache_head = vc;
vc->time = vl->time;
- if (
vc->time < cache_oldest
)
+ if (
(vc->time < cache_oldest) || (-1 == cache_oldest)
)
cache_oldest = vc->time;
pthread_mutex_unlock (&cache_lock);
cache_oldest = vc->time;
pthread_mutex_unlock (&cache_lock);
@@
-275,7
+277,7
@@
static int cache_update (const data_set_t *ds, const value_list_t *vl)
vc->ds = ds;
vc->time = vl->time;
vc->ds = ds;
vc->time = vl->time;
- if (
vc->time < cache_oldest
)
+ if (
(vc->time < cache_oldest) || (-1 == cache_oldest)
)
cache_oldest = vc->time;
pthread_mutex_unlock (&cache_lock);
cache_oldest = vc->time;
pthread_mutex_unlock (&cache_lock);
@@
-611,6
+613,10
@@
static void *us_handle_client (void *arg)
{
us_handle_listval (fhout, fields, fields_num);
}
{
us_handle_listval (fhout, fields, fields_num);
}
+ else if (strcasecmp (fields[0], "putnotif") == 0)
+ {
+ handle_putnotif (fhout, fields, fields_num);
+ }
else
{
fprintf (fhout, "-1 Unknown command: %s\n", fields[0]);
else
{
fprintf (fhout, "-1 Unknown command: %s\n", fields[0]);
@@
-623,6
+629,7
@@
static void *us_handle_client (void *arg)
fclose (fhout);
pthread_exit ((void *) 0);
fclose (fhout);
pthread_exit ((void *) 0);
+ return ((void *) 0);
} /* void *us_handle_client */
static void *us_server_thread (void *arg)
} /* void *us_handle_client */
static void *us_server_thread (void *arg)
@@
-752,7
+759,6
@@
static int us_shutdown (void)
}
plugin_unregister_init ("unixsock");
}
plugin_unregister_init ("unixsock");
- plugin_unregister_write ("unixsock");
plugin_unregister_shutdown ("unixsock");
return (0);
plugin_unregister_shutdown ("unixsock");
return (0);