Extended Load Average (XLA) hooks
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 19 Apr 1993 01:07:27 +0000 (17:07 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 19 Apr 1993 01:07:27 +0000 (17:07 -0800)
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.57
SCCS-vsn: usr.sbin/sendmail/src/err.c 6.13
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 6.40
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 6.26
SCCS-vsn: usr.sbin/sendmail/src/conf.c 6.45
SCCS-vsn: usr.sbin/sendmail/src/mci.c 6.9

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/daemon.c
usr/src/usr.sbin/sendmail/src/err.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/mci.c
usr/src/usr.sbin/sendmail/src/readcf.c

index 8286d09..e4871bf 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     6.44 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     6.45 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/ioctl.h>
 #endif /* not lint */
 
 # include <sys/ioctl.h>
@@ -795,6 +795,11 @@ shouldqueue(pri, ctime)
 bool
 refuseconnections()
 {
 bool
 refuseconnections()
 {
+#ifdef XLA
+       if (!xla_smtp_ok())
+               return TRUE;
+#endif
+
        /* this is probably too simplistic */
        return (CurrentLA >= RefuseLA);
 }
        /* this is probably too simplistic */
        return (CurrentLA >= RefuseLA);
 }
index ae31b33..ecb7776 100644 (file)
@@ -13,9 +13,9 @@
 
 #ifndef lint
 #ifdef DAEMON
 
 #ifndef lint
 #ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c   6.39 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c   6.40 (Berkeley) %G% (with daemon mode)";
 #else
 #else
-static char sccsid[] = "@(#)daemon.c   6.39 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c   6.40 (Berkeley) %G% (without daemon mode)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -340,6 +340,12 @@ gothostent:
        **  Try to actually open the connection.
        */
 
        **  Try to actually open the connection.
        */
 
+#ifdef XLA
+       /* if too many connections, don't bother trying */
+       if (!xla_noqueue_ok(host))
+               return EX_TEMPFAIL;
+#endif
+
        for (;;)
        {
                if (tTd(16, 1))
        for (;;)
        {
                if (tTd(16, 1))
@@ -420,6 +426,9 @@ gothostent:
                        extern char *errstring();
 
                        message("%s", errstring(sav_errno));
                        extern char *errstring();
 
                        message("%s", errstring(sav_errno));
+#ifdef XLA
+                       xla_host_end(host);
+#endif
                        return (EX_UNAVAILABLE);
                }
        }
                        return (EX_UNAVAILABLE);
                }
        }
index a9580e7..c1d252c 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)err.c      6.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)err.c      6.13 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -91,7 +91,12 @@ syserr(fmt, va_alist)
                        &MsgBuf[4]);
 # endif /* LOG */
        if (panic)
                        &MsgBuf[4]);
 # endif /* LOG */
        if (panic)
+       {
+#ifdef XLA
+               xla_all_end();
+#endif
                exit(EX_OSERR);
                exit(EX_OSERR);
+       }
        errno = 0;
        if (QuickAbort)
                longjmp(TopFrame, 2);
        errno = 0;
        if (QuickAbort)
                longjmp(TopFrame, 2);
index 3724fdf..04fef14 100644 (file)
@@ -13,7 +13,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     6.56 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     6.57 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -887,6 +887,9 @@ main(argc, argv, envp)
                        strcat(dtype, "+debugging");
 
                syslog(LOG_INFO, "starting daemon: %s", dtype + 1);
                        strcat(dtype, "+debugging");
 
                syslog(LOG_INFO, "starting daemon: %s", dtype + 1);
+#ifdef XLA
+               xla_create_file();
+#endif
 
 # ifdef QUEUE
                if (queuemode)
 
 # ifdef QUEUE
                if (queuemode)
@@ -903,7 +906,6 @@ main(argc, argv, envp)
                getrequests();
 
                /* at this point we are in a child: reset state */
                getrequests();
 
                /* at this point we are in a child: reset state */
-               OpMode = MD_SMTP;
                (void) newenvelope(CurEnv, CurEnv);
 
                /*
                (void) newenvelope(CurEnv, CurEnv);
 
                /*
@@ -1030,6 +1032,11 @@ finis()
        /* post statistics */
        poststats(StatFile);
 
        /* post statistics */
        poststats(StatFile);
 
+# ifdef XLA
+       /* clean up extended load average stuff */
+       xla_all_end();
+# endif
+
        /* and exit */
 # ifdef LOG
        if (LogLevel > 78)
        /* and exit */
 # ifdef LOG
        if (LogLevel > 78)
@@ -1060,6 +1067,9 @@ intsig()
 {
        FileName = NULL;
        unlockqueue(CurEnv);
 {
        FileName = NULL;
        unlockqueue(CurEnv);
+#ifdef XLA
+       xla_all_end();
+#endif
        exit(EX_OK);
 }
 \f/*
        exit(EX_OK);
 }
 \f/*
index bbb9b36..42af5c6 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)mci.c      6.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)mci.c      6.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -168,6 +168,9 @@ mci_uncache(mcislot, doquit)
                /* only uses the envelope to flush the transcript file */
                if (mci->mci_state != MCIS_CLOSED)
                        smtpquit(mci->mci_mailer, mci, &BlankEnvelope);
                /* only uses the envelope to flush the transcript file */
                if (mci->mci_state != MCIS_CLOSED)
                        smtpquit(mci->mci_mailer, mci, &BlankEnvelope);
+#ifdef XLA
+               xla_host_end(mci->mci_host);
+#endif
        }
        else
        {
        }
        else
        {
index 7eef393..6cd468e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)readcf.c   6.25 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c   6.26 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -419,6 +419,12 @@ readcf(cfname)
                        }
                        break;
 
                        }
                        break;
 
+#ifdef XLA
+                 case 'L':             /* extended load average description */
+                       xla_init(&bp[1]);
+                       break;
+#endif
+
                  case 'M':             /* define mailer */
                        makemailer(&buf[1]);
                        break;
                  case 'M':             /* define mailer */
                        makemailer(&buf[1]);
                        break;