From fe72a65a37119fc3264c2e46c31391fba02222b6 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 13 Dec 2003 21:12:48 +0000 Subject: [PATCH] Added debug code for Hans --- ChangeLog | 2 ++ mbtask/mbtask.c | 7 +++++++ mbtask/ping.c | 9 +++++++++ mbtask/taskcomm.c | 7 ++++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bbb3c973..79b71924 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ $Id$ v0.39.4 08-Dec-2003 + Added --enable-experiment mbtask debugging code for Hans. + general: Added French language file created by Francois Thunus. This translation is not yet complete. diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index 02ef23eb..6c45cc5f 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -979,12 +979,19 @@ void scheduler(void) * Install threads */ thr_id[0] = pthread_create(&p_thread[0], NULL, (void (*))ping_thread, NULL); + Syslog('l', "pthread_create ping_thread rc=%d", thr_id[0]); thr_id[1] = pthread_create(&p_thread[1], NULL, (void (*))cmd_thread, NULL); + Syslog('l', "pthread_create cmd_thread rc=%d", thr_id[1]); + + Syslog('l', "Entering scheduler loop"); /* * Enter the mainloop (forever) */ do { +#ifdef USE_EXPERIMENT + Syslog('l', "Starting scheduler loop"); +#endif sleep(1); /* diff --git a/mbtask/ping.c b/mbtask/ping.c index 54b5eb82..a54e3c3a 100644 --- a/mbtask/ping.c +++ b/mbtask/ping.c @@ -347,6 +347,9 @@ void *ping_thread(void) while (! T_Shutdown) { +#ifdef USE_EXPERMIMENT + Syslog('p', "ping_thread loop start"); +#endif /* * Select new address to ping */ @@ -368,6 +371,9 @@ void *ping_thread(void) if (inet_aton(pingaddress, &paddr)) { rc = ping_send(paddr); +#ifdef USE_EXPERIMENT + Syslog('p', "ping_send(%s) rc=%d", pingaddress, rc); +#endif if (rc) { if (icmp_errs++ < ICMP_MAX_ERRS) Syslog('?', "ping: to %s rc=%d", pingaddress, rc); @@ -397,6 +403,9 @@ void *ping_thread(void) * packets and empty results (packet still underway). */ while ((rc = ping_receive(paddr)) == -1); +#ifdef USE_EXPERIMENT + Syslog('p', "ping_receive() rc=%d", rc); +#endif if (!rc) { /* * Reply received. diff --git a/mbtask/taskcomm.c b/mbtask/taskcomm.c index a3c6ebb2..1fcf992e 100644 --- a/mbtask/taskcomm.c +++ b/mbtask/taskcomm.c @@ -597,7 +597,9 @@ void *cmd_thread(void) pfd.events = POLLIN; pfd.revents = 0; rc = poll(&pfd, 1, 1000); -// Syslog('c', "cmd_thread: poll interrupted rc=%d events=%04x", rc, pfd.revents); +#ifdef USE_EXPERIMENT + Syslog('c', "cmd_thread: poll interrupted rc=%d events=%04x", rc, pfd.revents); +#endif if (rc == -1) { /* * Poll can be interrupted by a finished child so that's not a real error. @@ -613,6 +615,9 @@ void *cmd_thread(void) memset(&buf, 0, sizeof(buf)); fromlen = sizeof(from); rlen = recvfrom(sock, buf, sizeof(buf) -1, 0, (struct sockaddr *)&from, &fromlen); +#ifdef USE_EXPERIMENT + Syslog('c', "rcvd: \"%s\"", printable(buf, 0)); +#endif do_cmd(buf); } else { Syslog('-', "Return poll rc=%d, events=%04x", rc, pfd.revents);