summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/stpd/ChangeLog11
-rw-r--r--runtime/stpd/Makefile4
-rw-r--r--runtime/stpd/librelay.c6
-rw-r--r--runtime/stpd/librelay.h2
4 files changed, 20 insertions, 3 deletions
diff --git a/runtime/stpd/ChangeLog b/runtime/stpd/ChangeLog
index c4b5ac35..cf17d5e1 100644
--- a/runtime/stpd/ChangeLog
+++ b/runtime/stpd/ChangeLog
@@ -1,3 +1,14 @@
+2005-08-24 Martin Hunt <hunt@redhat.com>
+
+ * librelay.c (sigproc): Reestablish signal handler so
+ impatient people don't hit ^C twice and terminate the
+ program before it saves the data and removes the module.
+ Also print a message to stderr that it is exiting.
+ (stp_main_loop): Write OOB data (warnings, errors, etc)
+ to stderr instead of stdout.
+ * librelay.h: Write debug info to stderr.
+ * Makefile: add librelay.h to dependencies.
+
2005-08-23 Martin Hunt <hunt@redhat.com>
* librelay.c (merge_output): Don't add an extra \n.
diff --git a/runtime/stpd/Makefile b/runtime/stpd/Makefile
index ecced7a4..604e363a 100644
--- a/runtime/stpd/Makefile
+++ b/runtime/stpd/Makefile
@@ -1,6 +1,6 @@
all: stpd stp_merge stp_dump
-stpd: stpd.c librelay.c ../transport/transport_msgs.h
+stpd: stpd.c librelay.c ../transport/transport_msgs.h librelay.h
gcc -Wall -O3 -o stpd stpd.c librelay.c -lpthread
stp_merge: stp_merge.c
@@ -9,7 +9,7 @@ stp_merge: stp_merge.c
stp_dump: stp_dump.c
gcc -Wall -O3 -o stp_dump stp_dump.c
-debug: stpd.c librelay.c ../transport/transport_msgs.h
+debug: stpd.c librelay.c ../transport/transport_msgs.h librelay.h
gcc -Wall -g -D DEBUG -o stpd stpd.c librelay.c -lpthread
clean:
diff --git a/runtime/stpd/librelay.c b/runtime/stpd/librelay.c
index f3bf2a9f..7191c0a5 100644
--- a/runtime/stpd/librelay.c
+++ b/runtime/stpd/librelay.c
@@ -590,6 +590,9 @@ static void cleanup_and_exit (int closed)
static void sigproc(int signum __attribute__((unused)))
{
+ signal(SIGINT, sigproc);
+ signal(SIGTERM, sigproc);
+ fprintf(stderr, "Exiting...\n");
send_request(STP_EXIT, NULL, 0);
}
@@ -656,6 +659,9 @@ int stp_main_loop(void)
case STP_REALTIME_DATA:
fputs ((char *)data, stdout);
break;
+ case STP_OOB_DATA:
+ fputs ((char *)data, stderr);
+ break;
case STP_EXIT:
{
/* module asks us to unload it and exit */
diff --git a/runtime/stpd/librelay.h b/runtime/stpd/librelay.h
index 71150858..289952d7 100644
--- a/runtime/stpd/librelay.h
+++ b/runtime/stpd/librelay.h
@@ -1,7 +1,7 @@
#include "../transport/transport_msgs.h"
#ifdef DEBUG
-#define dbug(args...) {printf("%s:%d ",__FUNCTION__, __LINE__); printf(args); }
+#define dbug(args...) {fprintf(stderr,"%s:%d ",__FUNCTION__, __LINE__); fprintf(stderr,args); }
#else
#define dbug(args...) ;
#endif /* DEBUG */