diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
| commit | 69aec538b456402170dc723af417ba5c05389c32 (patch) | |
| tree | e6f34c543f17c6392447ea337b2e2868212424d1 /chkspawn.c | |
| download | qmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2 qmail-69aec538b456402170dc723af417ba5c05389c32.zip | |
qmail 1.03 import
Diffstat (limited to 'chkspawn.c')
| -rw-r--r-- | chkspawn.c | 48 |
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 @@ | |||
| 1 | #include "substdio.h" | ||
| 2 | #include "subfd.h" | ||
| 3 | #include "fmt.h" | ||
| 4 | #include "select.h" | ||
| 5 | #include "exit.h" | ||
| 6 | #include "auto_spawn.h" | ||
| 7 | |||
| 8 | char num[FMT_ULONG]; | ||
| 9 | fd_set fds; | ||
| 10 | |||
| 11 | void main() | ||
| 12 | { | ||
| 13 | unsigned long hiddenlimit; | ||
| 14 | unsigned long maxnumd; | ||
| 15 | |||
| 16 | hiddenlimit = sizeof(fds) * 8; | ||
| 17 | maxnumd = (hiddenlimit - 5) / 2; | ||
| 18 | |||
| 19 | if (auto_spawn < 1) { | ||
| 20 | substdio_puts(subfderr,"Oops. You have set conf-spawn lower than 1.\n"); | ||
| 21 | substdio_flush(subfderr); | ||
| 22 | _exit(1); | ||
| 23 | } | ||
| 24 | |||
| 25 | if (auto_spawn > 255) { | ||
| 26 | substdio_puts(subfderr,"Oops. You have set conf-spawn higher than 255.\n"); | ||
| 27 | substdio_flush(subfderr); | ||
| 28 | _exit(1); | ||
| 29 | } | ||
| 30 | |||
| 31 | if (auto_spawn > maxnumd) { | ||
| 32 | substdio_puts(subfderr,"Oops. Your system's FD_SET() has a hidden limit of "); | ||
| 33 | substdio_put(subfderr,num,fmt_ulong(num,hiddenlimit)); | ||
| 34 | substdio_puts(subfderr," descriptors.\n\ | ||
| 35 | This means that the qmail daemons could crash if you set the run-time\n\ | ||
| 36 | concurrency higher than "); | ||
| 37 | substdio_put(subfderr,num,fmt_ulong(num,maxnumd)); | ||
| 38 | substdio_puts(subfderr,". So I'm going to insist that the concurrency\n\ | ||
| 39 | limit in conf-spawn be at most "); | ||
| 40 | substdio_put(subfderr,num,fmt_ulong(num,maxnumd)); | ||
| 41 | substdio_puts(subfderr,". Right now it's "); | ||
| 42 | substdio_put(subfderr,num,fmt_ulong(num,(unsigned long) auto_spawn)); | ||
| 43 | substdio_puts(subfderr,".\n"); | ||
| 44 | substdio_flush(subfderr); | ||
| 45 | _exit(1); | ||
| 46 | } | ||
| 47 | _exit(0); | ||
| 48 | } | ||
