aboutsummaryrefslogtreecommitdiff
path: root/src/sysmon
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-12-12 13:28:06 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-12-12 13:28:06 +0000
commitae95d2cfa0d571bde89af7b6712c4f348e193232 (patch)
tree220d444020575597420f9e322e81e2e6c9458367 /src/sysmon
parent3d8ac9f662a774b08229e38fbe1e460e12aa584c (diff)
downloadgnunet-ae95d2cfa0d571bde89af7b6712c4f348e193232.tar.gz
gnunet-ae95d2cfa0d571bde89af7b6712c4f348e193232.zip
changes
Diffstat (limited to 'src/sysmon')
-rw-r--r--src/sysmon/Makefile.am8
-rw-r--r--src/sysmon/gnunet-service-sysmon.c (renamed from src/sysmon/gnunet-daemon-sysmon.c)55
-rw-r--r--src/sysmon/sysmon.conf.in2
3 files changed, 39 insertions, 26 deletions
diff --git a/src/sysmon/Makefile.am b/src/sysmon/Makefile.am
index dd9c24691..0e87a627f 100644
--- a/src/sysmon/Makefile.am
+++ b/src/sysmon/Makefile.am
@@ -16,16 +16,16 @@ if USE_COVERAGE
16endif 16endif
17 17
18libexec_PROGRAMS = \ 18libexec_PROGRAMS = \
19 gnunet_daemon_sysmon 19 gnunet_service_sysmon
20 20
21check_PROGRAMS = \ 21check_PROGRAMS = \
22 test_glibtop \ 22 test_glibtop \
23 test_glibtop_process \ 23 test_glibtop_process \
24 test_glibtop_network 24 test_glibtop_network
25 25
26gnunet_daemon_sysmon_SOURCES = \ 26gnunet_service_sysmon_SOURCES = \
27 gnunet-daemon-sysmon.c 27 gnunet-service-sysmon.c
28gnunet_daemon_sysmon_LDADD = \ 28gnunet_service_sysmon_LDADD = \
29 $(top_builddir)/src/util/libgnunetutil.la \ 29 $(top_builddir)/src/util/libgnunetutil.la \
30 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 30 $(top_builddir)/src/statistics/libgnunetstatistics.la \
31 $(GN_LIBINTL) 31 $(GN_LIBINTL)
diff --git a/src/sysmon/gnunet-daemon-sysmon.c b/src/sysmon/gnunet-service-sysmon.c
index 3fb0fdd5a..32b4ccbed 100644
--- a/src/sysmon/gnunet-daemon-sysmon.c
+++ b/src/sysmon/gnunet-service-sysmon.c
@@ -19,8 +19,8 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file sysmon/gnunet-daemon-sysmon.c 22 * @file sysmon/gnunet-service-sysmon.c
23 * @brief system monitoring daemon 23 * @brief system monitoring service
24 * @author Matthias Wachs 24 * @author Matthias Wachs
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
@@ -508,18 +508,40 @@ run_properties (void)
508 return GNUNET_OK; 508 return GNUNET_OK;
509} 509}
510 510
511
512/**
513 * Task run during shutdown.
514 *
515 * @param cls unused
516 * @param tc unused
517 */
518static void
519cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
520{
521 /* FIXME: do clean up here */
522}
523
524
511/** 525/**
512 * Main function that will be run by the scheduler. 526 * Process template requests.
513 * 527 *
514 * @param cls closure 528 * @param cls closure
515 * @param args remaining command-line arguments 529 * @param server the initialized server
516 * @param cfgfile name of the configuration file used (for saving, can be NULL!) 530 * @param cfg configuration to use
517 * @param cfg configuration
518 */ 531 */
519static void 532static void
520run (void *cls, char *const *args, const char *cfgfile, 533run (void *cls, struct GNUNET_SERVER_Handle *server,
521 const struct GNUNET_CONFIGURATION_Handle *mycfg) 534 const struct GNUNET_CONFIGURATION_Handle *mycfg)
522{ 535{
536 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
537 /* FIXME: add handlers here! */
538 {NULL, NULL, 0, 0}
539 };
540 /* FIXME: do setup here */
541 GNUNET_SERVER_add_handlers (server, handlers);
542 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task,
543 NULL);
544
523 struct GNUNET_CONFIGURATION_Handle *properties; 545 struct GNUNET_CONFIGURATION_Handle *properties;
524 char *file; 546 char *file;
525 547
@@ -590,7 +612,7 @@ run (void *cls, char *const *args, const char *cfgfile,
590 612
591 613
592/** 614/**
593 * The main function. 615 * The main function for the template service.
594 * 616 *
595 * @param argc number of arguments from the command line 617 * @param argc number of arguments from the command line
596 * @param argv command line arguments 618 * @param argv command line arguments
@@ -599,18 +621,9 @@ run (void *cls, char *const *args, const char *cfgfile,
599int 621int
600main (int argc, char *const *argv) 622main (int argc, char *const *argv)
601{ 623{
602 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 624 return (GNUNET_OK ==
603 GNUNET_GETOPT_OPTION_END 625 GNUNET_SERVICE_run (argc, argv, "sysmon",
604 }; 626 GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1;
605 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
606 return 2;
607
608 ret = (GNUNET_OK ==
609 GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-sysmon",
610 gettext_noop ("GNUnet system monitoring and information daemon"), options, &run,
611 NULL)) ? ret : 1;
612 GNUNET_free ((void*) argv);
613 return ret;
614} 627}
615 628
616/* end of gnunet-daemon-sysmon.c */ 629/* end of gnunet-service-sysmon.c */
diff --git a/src/sysmon/sysmon.conf.in b/src/sysmon/sysmon.conf.in
index b5c4c7355..238f4e2ae 100644
--- a/src/sysmon/sysmon.conf.in
+++ b/src/sysmon/sysmon.conf.in
@@ -5,4 +5,4 @@ HOSTNAME = localhost
5HOME = $SERVICEHOME 5HOME = $SERVICEHOME
6BINARY = gnunet-daemon-sysmon 6BINARY = gnunet-daemon-sysmon
7CFGFILE = sysmon-properties.conf 7CFGFILE = sysmon-properties.conf
8UNIXPATH = /tmp/gnunet-daemon-sysmon.sock 8UNIXPATH = /tmp/gnunet-service-sysmon.sock