From f52361396cb68af923ebf6f967d4e8c3fa184147 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 2 Dec 2003 20:32:12 +0000 Subject: [PATCH] Updated makefiles and a small fix in mbtask --- ChangeLog | 4 ++++ lib/client.c | 2 +- mbcico/Makefile | 4 ---- mbfido/Makefile | 7 ------- mbmon/Makefile | 1 - mbsebbs/Makefile | 9 +-------- mbsetup/Makefile | 1 - mbtask/Makefile | 10 ---------- mbtask/mbtask.c | 8 +++++--- mbtask/ping.c | 26 +++++++++++++------------- unix/Makefile | 3 --- 11 files changed, 24 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d6e11e8..81d82d81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ v0.39.3 26-Nov-2003 general: Since this version Posix threads are being used, please let 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: Dropped binkp CRC support because it will be incompatible with @@ -15,6 +18,7 @@ v0.39.3 26-Nov-2003 mbtask: The ping function now runs in a separate thread. + Changed some ping timer logic. v0.39.2 21-Nov-2003 - 26-Nov-2003 diff --git a/lib/client.c b/lib/client.c index 9e52987b..7aea371a 100644 --- a/lib/client.c +++ b/lib/client.c @@ -51,7 +51,7 @@ int socket_connect(char *user, char *prg, char *city) { int s; static char buf[SS_BUFSIZE]; - char tty[18]; + static char tty[18]; myname = prg; diff --git a/mbcico/Makefile b/mbcico/Makefile index 6e043da2..2d05ae1e 100644 --- a/mbcico/Makefile +++ b/mbcico/Makefile @@ -56,19 +56,15 @@ install: all mbcico: ${MBCICO_OBJS} ${LIBS} ${CC} -o mbcico ${MBCICO_OBJS} ${LIBS} - strip mbcico mbout: ${MBOUT_OBJS} ${LIBS} ${CC} -o mbout ${MBOUT_OBJS} ${LIBS} - strip mbout mbtelind: ${MBTELIND_OBJS} ${LIBS} ${CC} -o mbtelind ${MBTELIND_OBJS} ${LIBS} - strip mbtelind mbtelout: ${MBTELOUT_OBJS} ${LIBS} ${CC} -o mbtelout ${MBTELOUT_OBJS} ${LIBS} - strip mbtelout filelist: Makefile BASE=`pwd`; \ diff --git a/mbfido/Makefile b/mbfido/Makefile index 5741393a..27aed50c 100644 --- a/mbfido/Makefile +++ b/mbfido/Makefile @@ -62,31 +62,24 @@ all: ${TARGET} mbfido: ${MBFIDO_OBJS} ${MBFIDO_LIBS} ${CC} -o mbfido ${MBFIDO_OBJS} ${LIBS} ${MBFIDO_LIBS} - strip mbfido mbseq: ${MBSEQ_OBJS} ${MBSEQ_LIBS} ${CC} -o mbseq ${MBSEQ_OBJS} ${LIBS} ${MBSEQ_LIBS} - strip mbseq mbaff: ${MBAFF_OBJS} ${MBAFF_LIBS} ${CC} -o mbaff ${MBAFF_OBJS} ${LIBS} ${MBAFF_LIBS} - strip mbaff mbindex: ${MBINDEX_OBJS} ${MBINDEX_LIBS} ${CC} -o mbindex ${MBINDEX_OBJS} ${LIBS} ${MBINDEX_LIBS} - strip mbindex mbdiff: ${MBDIFF_OBJS} ${MBDIFF_LIBS} ${CC} -o mbdiff ${MBDIFF_OBJS} ${LIBS} ${MBDIFF_LIBS} - strip mbdiff mbfile: ${MBFILE_OBJS} ${MBFILE_LIBS} ${CC} -o mbfile ${MBFILE_OBJS} ${LIBS} ${MBFILE_LIBS} - strip mbfile mbmsg: ${MBMSG_OBJS} ${MBMSG_LIBS} ${CC} -o mbmsg ${MBMSG_OBJS} ${LIBS} ${MBMSG_LIBS} - strip mbmsg clean: rm -f ${TARGET} *.o *.h~ *.c~ core filelist Makefile.bak diff --git a/mbmon/Makefile b/mbmon/Makefile index 7500ef44..396db1c0 100644 --- a/mbmon/Makefile +++ b/mbmon/Makefile @@ -19,7 +19,6 @@ all: mbmon mbmon: ${OBJS} ${LIBS} ${CC} -o mbmon ${OBJS} ${LIBS} - strip mbmon clean: rm -f mbmon *.o *.h~ *.c~ core filelist Makefile.bak diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile index a0686ded..75809cad 100644 --- a/mbsebbs/Makefile +++ b/mbsebbs/Makefile @@ -59,31 +59,24 @@ clean: mbsebbs: ${MBSEBBS_OBJS} ${MBSEBBS_LIBS} ${CC} -o mbsebbs ${MBSEBBS_OBJS} ${LIBS} ${MBSEBBS_LIBS} - strip mbsebbs mbnewusr: ${MBNEWUSR_OBJS} ${MBNEWUSR_LIBS} ${CC} -o mbnewusr ${MBNEWUSR_OBJS} ${LIBS} ${MBNEWUSR_LIBS} - strip mbnewusr mball: ${MBALL_OBJS} ${MBALL_LIBS} ${CC} -o mball ${MBALL_OBJS} ${LIBS} ${MBALL_LIBS} - strip mball mblang: ${MBLANG_OBJS} ${MBLANG_LIBS} ${CC} -o mblang ${MBLANG_OBJS} ${LIBS} ${MBLANG_LIBS} - strip mblang mbstat: ${MBSTAT_OBJS} ${MBSTAT_LIBS} ${CC} -o mbstat ${MBSTAT_OBJS} ${LIBS} ${MBSTAT_LIBS} - strip mbstat mbtoberep: ${MBTOBE_OBJS} ${MBTOBE_LIBS} ${CC} -o mbtoberep ${MBTOBE_OBJS} ${LIBS} ${MBTOBE_LIBS} - strip mbtoberep mbuser: ${MBUSER_OBJS} ${MBUSER_LIBS} ${CC} -o mbuser ${MBUSER_OBJS} ${LIBS} ${MBUSER_LIBS} - strip mbuser install: all @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 mbtoberep ${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 BASE=`pwd`; \ diff --git a/mbsetup/Makefile b/mbsetup/Makefile index 048dc82f..e56705a8 100644 --- a/mbsetup/Makefile +++ b/mbsetup/Makefile @@ -35,7 +35,6 @@ all: mbsetup mbsetup: ${OBJS} ${LIBS} ${CC} -o mbsetup ${OBJS} ${LIBS} - strip mbsetup clean: rm -f mbsetup *.o *.h~ *.c~ core filelist Makefile.bak diff --git a/mbtask/Makefile b/mbtask/Makefile index 06219681..001462e8 100644 --- a/mbtask/Makefile +++ b/mbtask/Makefile @@ -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}"; \ diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index babe7ded..a313b516 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -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) { diff --git a/mbtask/ping.c b/mbtask/ping.c index 99641f95..974c9bfe 100644 --- a/mbtask/ping.c +++ b/mbtask/ping.c @@ -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); } diff --git a/unix/Makefile b/unix/Makefile index 7d760fdf..24d4bc93 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -33,15 +33,12 @@ clean: mbuseradd: ${MBUSERADD_OBJS} ${CC} -o mbuseradd ${MBUSERADD_OBJS} ${LIBS} - strip mbuseradd mbpasswd: ${MBPASSWD_OBJS} ${CC} -o mbpasswd ${MBPASSWD_OBJS} ${LIBS} - strip mbpasswd mblogin: ${MBLOGIN_OBJS} ${CC} -o mblogin ${MBLOGIN_OBJS} ${LIBS} - strip mblogin install: all @if [ "`id -un`" != "root" ] ; then \