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

@ -5,6 +5,9 @@ v0.39.3 26-Nov-2003
general: general:
Since this version Posix threads are being used, please let Since this version Posix threads are being used, please let
me know if this doesn't compile on you system. me know if this doesn't compile on you system.
All Makefiles do not strip the binaries anymore, the binaries
are stripped during make install only. This allows to run the
not yet installed binaries under debuggers.
mbcico: mbcico:
Dropped binkp CRC support because it will be incompatible with Dropped binkp CRC support because it will be incompatible with
@ -15,6 +18,7 @@ v0.39.3 26-Nov-2003
mbtask: mbtask:
The ping function now runs in a separate thread. The ping function now runs in a separate thread.
Changed some ping timer logic.
v0.39.2 21-Nov-2003 - 26-Nov-2003 v0.39.2 21-Nov-2003 - 26-Nov-2003

View File

@ -51,7 +51,7 @@ int socket_connect(char *user, char *prg, char *city)
{ {
int s; int s;
static char buf[SS_BUFSIZE]; static char buf[SS_BUFSIZE];
char tty[18]; static char tty[18];
myname = prg; myname = prg;

View File

@ -56,19 +56,15 @@ install: all
mbcico: ${MBCICO_OBJS} ${LIBS} mbcico: ${MBCICO_OBJS} ${LIBS}
${CC} -o mbcico ${MBCICO_OBJS} ${LIBS} ${CC} -o mbcico ${MBCICO_OBJS} ${LIBS}
strip mbcico
mbout: ${MBOUT_OBJS} ${LIBS} mbout: ${MBOUT_OBJS} ${LIBS}
${CC} -o mbout ${MBOUT_OBJS} ${LIBS} ${CC} -o mbout ${MBOUT_OBJS} ${LIBS}
strip mbout
mbtelind: ${MBTELIND_OBJS} ${LIBS} mbtelind: ${MBTELIND_OBJS} ${LIBS}
${CC} -o mbtelind ${MBTELIND_OBJS} ${LIBS} ${CC} -o mbtelind ${MBTELIND_OBJS} ${LIBS}
strip mbtelind
mbtelout: ${MBTELOUT_OBJS} ${LIBS} mbtelout: ${MBTELOUT_OBJS} ${LIBS}
${CC} -o mbtelout ${MBTELOUT_OBJS} ${LIBS} ${CC} -o mbtelout ${MBTELOUT_OBJS} ${LIBS}
strip mbtelout
filelist: Makefile filelist: Makefile
BASE=`pwd`; \ BASE=`pwd`; \

View File

@ -62,31 +62,24 @@ all: ${TARGET}
mbfido: ${MBFIDO_OBJS} ${MBFIDO_LIBS} mbfido: ${MBFIDO_OBJS} ${MBFIDO_LIBS}
${CC} -o mbfido ${MBFIDO_OBJS} ${LIBS} ${MBFIDO_LIBS} ${CC} -o mbfido ${MBFIDO_OBJS} ${LIBS} ${MBFIDO_LIBS}
strip mbfido
mbseq: ${MBSEQ_OBJS} ${MBSEQ_LIBS} mbseq: ${MBSEQ_OBJS} ${MBSEQ_LIBS}
${CC} -o mbseq ${MBSEQ_OBJS} ${LIBS} ${MBSEQ_LIBS} ${CC} -o mbseq ${MBSEQ_OBJS} ${LIBS} ${MBSEQ_LIBS}
strip mbseq
mbaff: ${MBAFF_OBJS} ${MBAFF_LIBS} mbaff: ${MBAFF_OBJS} ${MBAFF_LIBS}
${CC} -o mbaff ${MBAFF_OBJS} ${LIBS} ${MBAFF_LIBS} ${CC} -o mbaff ${MBAFF_OBJS} ${LIBS} ${MBAFF_LIBS}
strip mbaff
mbindex: ${MBINDEX_OBJS} ${MBINDEX_LIBS} mbindex: ${MBINDEX_OBJS} ${MBINDEX_LIBS}
${CC} -o mbindex ${MBINDEX_OBJS} ${LIBS} ${MBINDEX_LIBS} ${CC} -o mbindex ${MBINDEX_OBJS} ${LIBS} ${MBINDEX_LIBS}
strip mbindex
mbdiff: ${MBDIFF_OBJS} ${MBDIFF_LIBS} mbdiff: ${MBDIFF_OBJS} ${MBDIFF_LIBS}
${CC} -o mbdiff ${MBDIFF_OBJS} ${LIBS} ${MBDIFF_LIBS} ${CC} -o mbdiff ${MBDIFF_OBJS} ${LIBS} ${MBDIFF_LIBS}
strip mbdiff
mbfile: ${MBFILE_OBJS} ${MBFILE_LIBS} mbfile: ${MBFILE_OBJS} ${MBFILE_LIBS}
${CC} -o mbfile ${MBFILE_OBJS} ${LIBS} ${MBFILE_LIBS} ${CC} -o mbfile ${MBFILE_OBJS} ${LIBS} ${MBFILE_LIBS}
strip mbfile
mbmsg: ${MBMSG_OBJS} ${MBMSG_LIBS} mbmsg: ${MBMSG_OBJS} ${MBMSG_LIBS}
${CC} -o mbmsg ${MBMSG_OBJS} ${LIBS} ${MBMSG_LIBS} ${CC} -o mbmsg ${MBMSG_OBJS} ${LIBS} ${MBMSG_LIBS}
strip mbmsg
clean: clean:
rm -f ${TARGET} *.o *.h~ *.c~ core filelist Makefile.bak rm -f ${TARGET} *.o *.h~ *.c~ core filelist Makefile.bak

View File

@ -19,7 +19,6 @@ all: mbmon
mbmon: ${OBJS} ${LIBS} mbmon: ${OBJS} ${LIBS}
${CC} -o mbmon ${OBJS} ${LIBS} ${CC} -o mbmon ${OBJS} ${LIBS}
strip mbmon
clean: clean:
rm -f mbmon *.o *.h~ *.c~ core filelist Makefile.bak rm -f mbmon *.o *.h~ *.c~ core filelist Makefile.bak

View File

@ -59,31 +59,24 @@ clean:
mbsebbs: ${MBSEBBS_OBJS} ${MBSEBBS_LIBS} mbsebbs: ${MBSEBBS_OBJS} ${MBSEBBS_LIBS}
${CC} -o mbsebbs ${MBSEBBS_OBJS} ${LIBS} ${MBSEBBS_LIBS} ${CC} -o mbsebbs ${MBSEBBS_OBJS} ${LIBS} ${MBSEBBS_LIBS}
strip mbsebbs
mbnewusr: ${MBNEWUSR_OBJS} ${MBNEWUSR_LIBS} mbnewusr: ${MBNEWUSR_OBJS} ${MBNEWUSR_LIBS}
${CC} -o mbnewusr ${MBNEWUSR_OBJS} ${LIBS} ${MBNEWUSR_LIBS} ${CC} -o mbnewusr ${MBNEWUSR_OBJS} ${LIBS} ${MBNEWUSR_LIBS}
strip mbnewusr
mball: ${MBALL_OBJS} ${MBALL_LIBS} mball: ${MBALL_OBJS} ${MBALL_LIBS}
${CC} -o mball ${MBALL_OBJS} ${LIBS} ${MBALL_LIBS} ${CC} -o mball ${MBALL_OBJS} ${LIBS} ${MBALL_LIBS}
strip mball
mblang: ${MBLANG_OBJS} ${MBLANG_LIBS} mblang: ${MBLANG_OBJS} ${MBLANG_LIBS}
${CC} -o mblang ${MBLANG_OBJS} ${LIBS} ${MBLANG_LIBS} ${CC} -o mblang ${MBLANG_OBJS} ${LIBS} ${MBLANG_LIBS}
strip mblang
mbstat: ${MBSTAT_OBJS} ${MBSTAT_LIBS} mbstat: ${MBSTAT_OBJS} ${MBSTAT_LIBS}
${CC} -o mbstat ${MBSTAT_OBJS} ${LIBS} ${MBSTAT_LIBS} ${CC} -o mbstat ${MBSTAT_OBJS} ${LIBS} ${MBSTAT_LIBS}
strip mbstat
mbtoberep: ${MBTOBE_OBJS} ${MBTOBE_LIBS} mbtoberep: ${MBTOBE_OBJS} ${MBTOBE_LIBS}
${CC} -o mbtoberep ${MBTOBE_OBJS} ${LIBS} ${MBTOBE_LIBS} ${CC} -o mbtoberep ${MBTOBE_OBJS} ${LIBS} ${MBTOBE_LIBS}
strip mbtoberep
mbuser: ${MBUSER_OBJS} ${MBUSER_LIBS} mbuser: ${MBUSER_OBJS} ${MBUSER_LIBS}
${CC} -o mbuser ${MBUSER_OBJS} ${LIBS} ${MBUSER_LIBS} ${CC} -o mbuser ${MBUSER_OBJS} ${LIBS} ${MBUSER_LIBS}
strip mbuser
install: all install: all
@if [ "`id -un`" != "root" ] ; then \ @if [ "`id -un`" != "root" ] ; then \
@ -96,7 +89,7 @@ install: all
${INSTALL} -c -s -o ${OWNER} -g ${GROUP} -m 0711 mbstat ${BINDIR} ${INSTALL} -c -s -o ${OWNER} -g ${GROUP} -m 0711 mbstat ${BINDIR}
${INSTALL} -c -s -o ${OWNER} -g ${GROUP} -m 0711 mbtoberep ${BINDIR} ${INSTALL} -c -s -o ${OWNER} -g ${GROUP} -m 0711 mbtoberep ${BINDIR}
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbuser ${BINDIR} ${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbuser ${BINDIR}
@rm -f mbuseradd mbpasswd mblogin mbchat @rm -f mbchat
filelist: Makefile filelist: Makefile
BASE=`pwd`; \ BASE=`pwd`; \

View File

@ -35,7 +35,6 @@ all: mbsetup
mbsetup: ${OBJS} ${LIBS} mbsetup: ${OBJS} ${LIBS}
${CC} -o mbsetup ${OBJS} ${LIBS} ${CC} -o mbsetup ${OBJS} ${LIBS}
strip mbsetup
clean: clean:
rm -f mbsetup *.o *.h~ *.c~ core filelist Makefile.bak rm -f mbsetup *.o *.h~ *.c~ core filelist Makefile.bak

View File

@ -25,7 +25,6 @@ all: mbtask
mbtask: ${OBJS} ${LIBS} mbtask: ${OBJS} ${LIBS}
${CC} -o mbtask ${OBJS} ${LIBS} ${CC} -o mbtask ${OBJS} ${LIBS}
strip mbtask
clean: clean:
rm -f mbtask *.o *.h~ *.c~ version.* core filelist Makefile.bak 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; \ echo; echo " Must be root to install!"; echo; exit 3; \
fi fi
${INSTALL} -c -s -o `id -un` -g `id -gn` -m 6711 mbtask ${BINDIR} ${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 \ @if [ ! -f ${ETCDIR}/issue ]; then \
${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 issue ${ETCDIR} ; \ ${INSTALL} -c -o ${OWNER} -g ${GROUP} -m 0644 issue ${ETCDIR} ; \
echo "${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 ipmailers; /* TCP/IP mail sessions */
extern int tosswait; /* Toss wait timer */ extern int tosswait; /* Toss wait timer */
extern pid_t mypid; /* Pid of daemon */ extern pid_t mypid; /* Pid of daemon */
int T_Shutdown = FALSE; /* Shutdown threads */
@ -651,10 +652,12 @@ void die(int onsig)
int i, count; int i, count;
signal(onsig, SIG_IGN); signal(onsig, SIG_IGN);
if (onsig == SIGTERM) if (onsig == SIGTERM) {
Syslog('+', "Starting normal shutdown"); Syslog('+', "Starting normal shutdown");
else T_Shutdown = TRUE;
} else {
Syslog('+', "Abnormal shutdown on signal %s", SigName[onsig]); Syslog('+', "Abnormal shutdown on signal %s", SigName[onsig]);
}
/* /*
* First check if there are tasks running, if so try to stop them * First check if there are tasks running, if so try to stop them
@ -1110,7 +1113,6 @@ void scheduler(void)
oldsec = tm->tm_sec; oldsec = tm->tm_sec;
if (ptimer) if (ptimer)
ptimer--; ptimer--;
// check_ping();
} }
if (Processing) { if (Processing) {

View File

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

View File

@ -33,15 +33,12 @@ clean:
mbuseradd: ${MBUSERADD_OBJS} mbuseradd: ${MBUSERADD_OBJS}
${CC} -o mbuseradd ${MBUSERADD_OBJS} ${LIBS} ${CC} -o mbuseradd ${MBUSERADD_OBJS} ${LIBS}
strip mbuseradd
mbpasswd: ${MBPASSWD_OBJS} mbpasswd: ${MBPASSWD_OBJS}
${CC} -o mbpasswd ${MBPASSWD_OBJS} ${LIBS} ${CC} -o mbpasswd ${MBPASSWD_OBJS} ${LIBS}
strip mbpasswd
mblogin: ${MBLOGIN_OBJS} mblogin: ${MBLOGIN_OBJS}
${CC} -o mblogin ${MBLOGIN_OBJS} ${LIBS} ${CC} -o mblogin ${MBLOGIN_OBJS} ${LIBS}
strip mblogin
install: all install: all
@if [ "`id -un`" != "root" ] ; then \ @if [ "`id -un`" != "root" ] ; then \