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 v0.39.4 08-Dec-2003
Added --enable-experiment mbtask debugging code for Hans.
general: general:
Added French language file created by Francois Thunus. This Added French language file created by Francois Thunus. This
translation is not yet complete. translation is not yet complete.

View File

@ -979,12 +979,19 @@ void scheduler(void)
* Install threads * Install threads
*/ */
thr_id[0] = pthread_create(&p_thread[0], NULL, (void (*))ping_thread, NULL); 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); 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) * Enter the mainloop (forever)
*/ */
do { do {
#ifdef USE_EXPERIMENT
Syslog('l', "Starting scheduler loop");
#endif
sleep(1); sleep(1);
/* /*

View File

@ -347,6 +347,9 @@ void *ping_thread(void)
while (! T_Shutdown) { while (! T_Shutdown) {
#ifdef USE_EXPERMIMENT
Syslog('p', "ping_thread loop start");
#endif
/* /*
* Select new address to ping * Select new address to ping
*/ */
@ -368,6 +371,9 @@ void *ping_thread(void)
if (inet_aton(pingaddress, &paddr)) { if (inet_aton(pingaddress, &paddr)) {
rc = ping_send(paddr); rc = ping_send(paddr);
#ifdef USE_EXPERIMENT
Syslog('p', "ping_send(%s) rc=%d", pingaddress, rc);
#endif
if (rc) { if (rc) {
if (icmp_errs++ < ICMP_MAX_ERRS) if (icmp_errs++ < ICMP_MAX_ERRS)
Syslog('?', "ping: to %s rc=%d", pingaddress, rc); Syslog('?', "ping: to %s rc=%d", pingaddress, rc);
@ -397,6 +403,9 @@ void *ping_thread(void)
* packets and empty results (packet still underway). * packets and empty results (packet still underway).
*/ */
while ((rc = ping_receive(paddr)) == -1); while ((rc = ping_receive(paddr)) == -1);
#ifdef USE_EXPERIMENT
Syslog('p', "ping_receive() rc=%d", rc);
#endif
if (!rc) { if (!rc) {
/* /*
* Reply received. * Reply received.

View File

@ -597,7 +597,9 @@ void *cmd_thread(void)
pfd.events = POLLIN; pfd.events = POLLIN;
pfd.revents = 0; pfd.revents = 0;
rc = poll(&pfd, 1, 1000); 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) { if (rc == -1) {
/* /*
* Poll can be interrupted by a finished child so that's not a real error. * 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)); memset(&buf, 0, sizeof(buf));
fromlen = sizeof(from); fromlen = sizeof(from);
rlen = recvfrom(sock, buf, sizeof(buf) -1, 0, (struct sockaddr *)&from, &fromlen); 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); do_cmd(buf);
} else { } else {
Syslog('-', "Return poll rc=%d, events=%04x", rc, pfd.revents); Syslog('-', "Return poll rc=%d, events=%04x", rc, pfd.revents);