Added debug code for Hans

This commit is contained in:
Michiel Broek 2003-12-13 21:12:48 +00:00
parent 20e40b3da3
commit fe72a65a37
4 changed files with 24 additions and 1 deletions

View File

@ -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.

View File

@ -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);
/*

View File

@ -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.

View File

@ -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);