+\f/*
+** HOLDSIGS -- arrange to hold all signals
+**
+** Parameters:
+** none.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** Arranges that signals are held.
+*/
+
+holdsigs()
+{
+}
+\f/*
+** RLSESIGS -- arrange to release all signals
+**
+** This undoes the effect of holdsigs.
+**
+** Parameters:
+** none.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** Arranges that signals are released.
+*/
+
+rlsesigs()
+{
+}
+\f/*
+** GETLA -- get the current load average
+**
+** This code stolen from la.c.
+**
+** Parameters:
+** none.
+**
+** Returns:
+** The current load average as an integer.
+**
+** Side Effects:
+** none.
+*/
+
+#ifndef sun
+
+getla()
+{
+ double avenrun[3];
+
+ if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) < 0)
+ return (0);
+ return ((int) (avenrun[0] + 0.5));
+}
+
+#else /* sun */
+
+#include <nlist.h>
+
+struct nlist Nl[] =
+{
+ { "_avenrun" },
+#define X_AVENRUN 0
+ { 0 },
+};
+
+
+extern int la;
+
+getla()
+{
+ static int kmem = -1;
+ long avenrun[3];
+ extern off_t lseek();
+
+ if (kmem < 0)
+ {
+ kmem = open("/dev/kmem", 0, 0);
+ if (kmem < 0)
+ return (-1);
+ (void) ioctl(kmem, (int) FIOCLEX, (char *) 0);
+ nlist("/vmunix", Nl);
+ if (Nl[0].n_type == 0)
+ return (-1);
+ }
+ if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 ||
+ read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
+ {
+ /* thank you Ian */
+ return (-1);
+ }
+ return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
+}
+
+#endif /* sun */
+\f/*
+** SHOULDQUEUE -- should this message be queued or sent?
+**
+** Compares the message cost to the load average to decide.
+**
+** Parameters:
+** pri -- the priority of the message in question.
+**
+** Returns:
+** TRUE -- if this message should be queued up for the
+** time being.
+** FALSE -- if the load is low enough to send this message.
+**
+** Side Effects:
+** none.
+*/
+
+bool
+shouldqueue(pri)
+ long pri;
+{
+ if (la < QueueLA)
+ return (FALSE);
+ return (pri > (QueueFactor / (la - QueueLA + 1)));
+}
+\f/*
+** SETPROCTITLE -- set process title for ps
+**
+** Parameters:
+** fmt -- a printf style format string.
+** a, b, c -- possible parameters to fmt.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** Clobbers argv of our main procedure so ps(1) will
+** display the title.
+*/
+
+/*VARARGS1*/
+setproctitle(fmt, a, b, c)
+ char *fmt;
+{
+# ifdef SETPROCTITLE
+ register char *p;
+ register int i;
+ extern char **Argv;
+ extern char *LastArgv;
+ char buf[MAXLINE];
+
+ (void) sprintf(buf, fmt, a, b, c);
+
+ /* make ps print "(sendmail)" */
+ p = Argv[0];
+ *p++ = '-';
+
+ i = strlen(buf);
+ if (i > LastArgv - p - 2)
+ {
+ i = LastArgv - p - 2;
+ buf[i] = '\0';
+ }
+ (void) strcpy(p, buf);
+ p += i;
+ while (p < LastArgv)
+ *p++ = ' ';
+# endif SETPROCTITLE
+}
+\f/*
+** REAPCHILD -- pick up the body of my child, lest it become a zombie
+**
+** Parameters:
+** none.
+**
+** Returns:
+** none.
+**
+** Side Effects:
+** Picks up extant zombies.
+*/
+
+# ifdef VMUNIX
+# include <sys/wait.h>
+# endif VMUNIX
+
+void
+reapchild()
+{
+# ifdef WNOHANG
+ union wait status;
+
+ while (wait3((int *)&status, WNOHANG, (struct rusage *) NULL) > 0)
+ continue;
+# else WNOHANG
+ auto int status;
+
+ while (wait((int *)&status) > 0)
+ continue;
+# endif WNOHANG
+}