Commit | Line | Data |
---|---|---|
2117e02e MW |
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 | } |