Better mbtask logging

This commit is contained in:
Michiel Broek 2003-08-03 15:58:26 +00:00
parent 893f84ebc5
commit a14e540cd4
4 changed files with 68 additions and 60 deletions

View File

@ -33,6 +33,7 @@ v0.37.5 12-Jul-2003
Now uses standard locking in ~/var/run
When idle, it now reports the time to the next event to be
seen in mbmon menu 1.
Remove some semafore debug messages.
mbmon:
Added program locking, only one mbmon can run at the same time

View File

@ -600,10 +600,11 @@ int checktasks(int onsig)
Syslog('+', "Task %s is ready", task[i].name);
} else if (WIFSIGNALED(task[i].status)) {
rc = WTERMSIG(task[i].status);
if (rc <= 31)
Syslog('+', "Task %s terminated on signal %s (%d)", task[i].name, SigName[rc], rc);
else
Syslog('+', "Task %s terminated with error nr %d", task[i].name, rc);
/*
* Here we don't report an error number, on FreeBSD WIFSIGNALED
* seems true while there's nothing wrong.
*/
Syslog('+', "Task %s terminated", task[i].name);
} else if (WIFSTOPPED(task[i].status)) {
rc = WSTOPSIG(task[i].status);
Syslog('+', "Task %s stopped on signal %s (%d)", task[i].name, SigName[rc], rc);

View File

@ -113,7 +113,7 @@ void load_ports()
FILE *fp;
pp_list new;
int stdflag;
char *p, *q;
char *p, *q, *capflags;
nodelist_modem **tmpm;
tidy_portlist(&pl);
@ -136,6 +136,7 @@ void load_ports()
memset(&new, 0, sizeof(new));
strncpy(new.tty, ttyinfo.tty, 6);
capflags = xstrcpy((char *)"flags:");
stdflag = TRUE;
q = xstrcpy(ttyinfo.flags);
for (p = q; p; p = q) {
@ -145,16 +146,24 @@ void load_ports()
stdflag = FALSE;
} else {
for (tmpm = &nl_pots; *tmpm; tmpm=&((*tmpm)->next))
if (strcasecmp(p, (*tmpm)->name) == 0)
if (strcasecmp(p, (*tmpm)->name) == 0) {
new.mflags |= (*tmpm)->value;
capflags = xstrcat(capflags, (char *)" ");
capflags = xstrcat(capflags, (*tmpm)->name);
}
for (tmpm = &nl_isdn; *tmpm; tmpm=&((*tmpm)->next))
if (strcasecmp(p, (*tmpm)->name) == 0)
if (strcasecmp(p, (*tmpm)->name) == 0) {
new.dflags |= (*tmpm)->value;
capflags = xstrcat(capflags, (char *)" ");
capflags = xstrcat(capflags, (*tmpm)->name);
}
}
}
Syslog('p', "port %s modem %08lx ISDN %08lx", new.tty, new.mflags, new.dflags);
Syslog('+', "Found line %s, %s", new.tty, capflags);
fill_portlist(&pl, &new);
if (capflags)
free(capflags);
}
}

View File

@ -340,8 +340,6 @@ char *getseq(void)
int sem_set(char *sem, int value)
{
Syslog('s', "%s semafore \"%s\"", value?"Set":"Clear", sem);
if (!strcmp(sem, "scanout")) {
s_scanout = value;
if (value)
@ -373,77 +371,76 @@ int sem_set(char *sem, int value)
char *sem_status(char *data)
{
char *cnt, *sem;
static char buf[40];
int value;
char *cnt, *sem;
static char buf[40];
int value;
buf[0] = '\0';
sprintf(buf, "200:1,16;");
cnt = strtok(data, ",");
sem = strtok(NULL, ";");
buf[0] = '\0';
sprintf(buf, "200:1,16;");
cnt = strtok(data, ",");
sem = strtok(NULL, ";");
if (!strcmp(sem, "scanout")) {
value = s_scanout;
} else if (!strcmp(sem, "mailout")) {
value = s_mailout;
} else if (!strcmp(sem, "mailin")) {
value = s_mailin;
} else if (!strcmp(sem, "mbindex")) {
value = s_index;
} else if (!strcmp(sem, "newnews")) {
value = s_newnews;
} else if (!strcmp(sem, "msglink")) {
value = s_msglink;
} else if (!strcmp(sem, "reqindex")) {
value = s_reqindex;
} else if (!strcmp(sem, "upsalarm")) {
value = UPSalarm;
} else if (!strcmp(sem, "do_inet")) {
value = s_do_inet;
} else {
Syslog('s', "sem_status(%s) buf=%s", sem, buf);
return buf;
}
sprintf(buf, "100:1,%s;", value ? "1":"0");
Syslog('s', "Check semafore \"%s\": %s present", sem, value?"is":"not");
if (!strcmp(sem, "scanout")) {
value = s_scanout;
} else if (!strcmp(sem, "mailout")) {
value = s_mailout;
} else if (!strcmp(sem, "mailin")) {
value = s_mailin;
} else if (!strcmp(sem, "mbindex")) {
value = s_index;
} else if (!strcmp(sem, "newnews")) {
value = s_newnews;
} else if (!strcmp(sem, "msglink")) {
value = s_msglink;
} else if (!strcmp(sem, "reqindex")) {
value = s_reqindex;
} else if (!strcmp(sem, "upsalarm")) {
value = UPSalarm;
} else if (!strcmp(sem, "do_inet")) {
value = s_do_inet;
} else {
Syslog('s', "sem_status(%s) buf=%s", sem, buf);
return buf;
}
sprintf(buf, "100:1,%s;", value ? "1":"0");
return buf;
}
char *sem_create(char *data)
{
static char buf[40];
char *cnt, *sem;
static char buf[40];
char *cnt, *sem;
cnt = strtok(data, ",");
sem = strtok(NULL, ";");
buf[0] = '\0';
sprintf(buf, "200:1,16;");
cnt = strtok(data, ",");
sem = strtok(NULL, ";");
buf[0] = '\0';
sprintf(buf, "200:1,16;");
if (sem_set(sem, TRUE))
sprintf(buf, "100:0;");
if (sem_set(sem, TRUE))
sprintf(buf, "100:0;");
return buf;
return buf;
}
char *sem_remove(char *data)
{
static char buf[40];
char *cnt, *sem;
static char buf[40];
char *cnt, *sem;
cnt = strtok(data, ",");
sem = strtok(NULL, ";");
buf[0] = '\0';
sprintf(buf, "200:1,16;");
cnt = strtok(data, ",");
sem = strtok(NULL, ";");
buf[0] = '\0';
sprintf(buf, "200:1,16;");
if (sem_set(sem, FALSE))
sprintf(buf, "100:0;");
if (sem_set(sem, FALSE))
sprintf(buf, "100:0;");
return buf;
return buf;
}