summaryrefslogtreecommitdiff
path: root/chkspawn.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-06-01 18:58:45 -0700
committerJohn Denker <jsd@av8n.com>2012-06-01 18:58:45 -0700
commitb732a73bc773789894466b0e5320b2f1fe42c7e9 (patch)
tree385358983f064a1f10a5080b33a3ba13010886db /chkspawn.c
parent634d365a03cb0581a062cd3cf4db9ae69f1cde26 (diff)
original, as downloaded from http://www.qmail.org/netqmail-1.06.tar.gz
Diffstat (limited to 'chkspawn.c')
-rw-r--r--chkspawn.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/chkspawn.c b/chkspawn.c
new file mode 100644
index 0000000..d19259e
--- /dev/null
+++ b/chkspawn.c
@@ -0,0 +1,48 @@
+#include "substdio.h"
+#include "subfd.h"
+#include "fmt.h"
+#include "select.h"
+#include "exit.h"
+#include "auto_spawn.h"
+
+char num[FMT_ULONG];
+fd_set fds;
+
+void main()
+{
+ unsigned long hiddenlimit;
+ unsigned long maxnumd;
+
+ hiddenlimit = sizeof(fds) * 8;
+ maxnumd = (hiddenlimit - 5) / 2;
+
+ if (auto_spawn < 1) {
+ substdio_puts(subfderr,"Oops. You have set conf-spawn lower than 1.\n");
+ substdio_flush(subfderr);
+ _exit(1);
+ }
+
+ if (auto_spawn > 255) {
+ substdio_puts(subfderr,"Oops. You have set conf-spawn higher than 255.\n");
+ substdio_flush(subfderr);
+ _exit(1);
+ }
+
+ if (auto_spawn > maxnumd) {
+ substdio_puts(subfderr,"Oops. Your system's FD_SET() has a hidden limit of ");
+ substdio_put(subfderr,num,fmt_ulong(num,hiddenlimit));
+ substdio_puts(subfderr," descriptors.\n\
+This means that the qmail daemons could crash if you set the run-time\n\
+concurrency higher than ");
+ substdio_put(subfderr,num,fmt_ulong(num,maxnumd));
+ substdio_puts(subfderr,". So I'm going to insist that the concurrency\n\
+limit in conf-spawn be at most ");
+ substdio_put(subfderr,num,fmt_ulong(num,maxnumd));
+ substdio_puts(subfderr,". Right now it's ");
+ substdio_put(subfderr,num,fmt_ulong(num,(unsigned long) auto_spawn));
+ substdio_puts(subfderr,".\n");
+ substdio_flush(subfderr);
+ _exit(1);
+ }
+ _exit(0);
+}