Updated makefiles and a small fix in mbtask

This commit is contained in:
Michiel Broek
2003-12-02 20:32:12 +00:00
parent bc9701f005
commit f52361396c
11 changed files with 24 additions and 51 deletions

View File

@@ -25,7 +25,6 @@ all: mbtask
mbtask: ${OBJS} ${LIBS}
${CC} -o mbtask ${OBJS} ${LIBS}
strip mbtask
clean:
rm -f mbtask *.o *.h~ *.c~ version.* core filelist Makefile.bak
@@ -35,15 +34,6 @@ install: all
echo; echo " Must be root to install!"; echo; exit 3; \
fi
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbtask ${BINDIR}
@if [ -f ${ETCDIR}/mbsed.conf ]; then \
rm ${ETCDIR}/mbsed.conf ; \
fi
@if [ -f ${ETCDIR}/client.conf ]; then \
rm ${ETCDIR}/client.conf ; \
fi
@if [ -f ${BINDIR}/mbsed ]; then \
rm ${BINDIR}/mbsed ; \
fi
@if [ ! -f ${ETCDIR}/issue ]; then \
${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 issue ${ETCDIR} ; \
echo "${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 issue ${ETCDIR}"; \

View File

@@ -109,6 +109,7 @@ extern pp_list *pl; /* List of tty ports */
extern int ipmailers; /* TCP/IP mail sessions */
extern int tosswait; /* Toss wait timer */
extern pid_t mypid; /* Pid of daemon */
int T_Shutdown = FALSE; /* Shutdown threads */
@@ -651,10 +652,12 @@ void die(int onsig)
int i, count;
signal(onsig, SIG_IGN);
if (onsig == SIGTERM)
if (onsig == SIGTERM) {
Syslog('+', "Starting normal shutdown");
else
T_Shutdown = TRUE;
} else {
Syslog('+', "Abnormal shutdown on signal %s", SigName[onsig]);
}
/*
* First check if there are tasks running, if so try to stop them
@@ -1110,7 +1113,6 @@ void scheduler(void)
oldsec = tm->tm_sec;
if (ptimer)
ptimer--;
// check_ping();
}
if (Processing) {

View File

@@ -47,6 +47,7 @@ int icmp_errs = 0; /* ICMP error counter */
extern int internet; /* Internet is down */
extern int rescan; /* Master rescan flag */
struct in_addr paddr; /* Current ping address */
extern int T_Shutdown; /* Program shutdown */
@@ -332,14 +333,14 @@ void *ping_thread(void)
int rc = 0;
static int pingnr, pingresult[2];
static char pingaddress[41];
static time_t pingtime;
static time_t pingsend;
Syslog('p', "ping_thread: Start");
Syslog('+', "Starting ping thread with pid %d", (int)getpid());
pingresult[1] = pingresult[2] = FALSE;
pingnr = 2;
internet = FALSE;
while (TRUE) {
while (! T_Shutdown) {
/*
* Select new address to ping
@@ -367,13 +368,13 @@ void *ping_thread(void)
Syslog('?', "ping: to %s rc=%d", pingaddress, rc);
pingresult[pingnr] = FALSE;
} else {
if (internet)
pingtime = time(NULL) + 20;
else
pingtime = time(NULL) + 10;
pingsend = time(NULL);
while (TRUE) {
if (time(NULL) >= pingtime) {
if (T_Shutdown)
break;
if (time(NULL) >= (pingsend + 20)) {
pingresult[pingnr] = FALSE;
if (icmp_errs < ICMP_MAX_ERRS)
Syslog('?', "ping: to %s timeout", pingaddress);
@@ -388,12 +389,12 @@ void *ping_thread(void)
/*
* Reply received.
*/
rc = time(NULL) - (pingtime - 20);
rc = time(NULL) - pingsend;
if (rc > 5)
Syslog('+', "Ping: slow reply after %d seconds", rc);
pingresult[pingnr] = TRUE;
if (rc < 10)
sleep(10 - rc);
if (rc < 20)
sleep(20 - rc);
else
sleep(1);
break;
@@ -436,8 +437,7 @@ void *ping_thread(void)
}
}
/* Never reached */
Syslog('p', "ping_thread: End");
Syslog('+', "Ping thread stopped");
pthread_exit(NULL);
}