summaryrefslogtreecommitdiff
path: root/sqmail-4.3.07/src/chkspawn.c
diff options
context:
space:
mode:
authorErwin Hoffmann <feh@fehcom.de>2024-01-14 17:55:54 +0100
committerErwin Hoffmann <feh@fehcom.de>2024-01-14 17:55:54 +0100
commita293489ee83c8b05d845a162dc2a4de026f3775d (patch)
treed50ab15afde698ad2d32bfc251753e5e89204f25 /sqmail-4.3.07/src/chkspawn.c
s/qmail 4.3.07
Diffstat (limited to 'sqmail-4.3.07/src/chkspawn.c')
-rw-r--r--sqmail-4.3.07/src/chkspawn.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/sqmail-4.3.07/src/chkspawn.c b/sqmail-4.3.07/src/chkspawn.c
new file mode 100644
index 0000000..511489a
--- /dev/null
+++ b/sqmail-4.3.07/src/chkspawn.c
@@ -0,0 +1,48 @@
+#include "buffer.h"
+#include "fmt.h"
+#include "select.h"
+#include "exit.h"
+#include "auto_spawn.h"
+#define MAXSPAWN 1000 /* Silent spawn limit increased to 1000 */
+
+char num[FMT_ULONG];
+fd_set fds;
+
+int main()
+{
+ unsigned long hiddenlimit;
+ unsigned long maxnumd;
+
+ hiddenlimit = sizeof(fds) * 8;
+ maxnumd = (hiddenlimit - 5) / 2;
+
+ if (auto_spawn < 1) {
+ buffer_puts(buffer_2,"Oops. You have set conf-spawn lower than 1.\n");
+ buffer_flush(buffer_2);
+ _exit(1);
+ }
+
+ if (auto_spawn > MAXSPAWN) {
+ buffer_puts(buffer_2,"Oops. You have set conf-spawn higher than MAXSPAWN.\n");
+ buffer_flush(buffer_2);
+ _exit(1);
+ }
+
+ if (auto_spawn > maxnumd) {
+ buffer_puts(buffer_2,"Oops. Your system's FD_SET() has a hidden limit of ");
+ buffer_put(buffer_2,num,fmt_ulong(num,hiddenlimit));
+ buffer_puts(buffer_2," descriptors.\n\
+This means that the qmail daemons could crash if you set the run-time\n\
+concurrency higher than ");
+ buffer_put(buffer_2,num,fmt_ulong(num,maxnumd));
+ buffer_puts(buffer_2,". So I'm going to insist that the concurrency\n\
+limit in conf-spawn be at most ");
+ buffer_put(buffer_2,num,fmt_ulong(num,maxnumd));
+ buffer_puts(buffer_2,". Right now it's ");
+ buffer_put(buffer_2,num,fmt_ulong(num,(unsigned long) auto_spawn));
+ buffer_puts(buffer_2,".\n");
+ buffer_flush(buffer_2);
+ _exit(1);
+ }
+ _exit(0);
+}