nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

chkspawn.c (1345B)


      1 #include "substdio.h"
      2 #include "subfd.h"
      3 #include "fmt.h"
      4 #include "select.h"
      5 #include "auto_spawn.h"
      6 
      7 char num[FMT_ULONG];
      8 fd_set fds;
      9 
     10 int main(void)
     11 {
     12   unsigned long hiddenlimit;
     13   unsigned long maxnumd;
     14  
     15   hiddenlimit = sizeof(fds) * 8;
     16   maxnumd = (hiddenlimit - 5) / 2;
     17  
     18   if (auto_spawn < 1) {
     19     substdio_puts(subfderr,"Oops. You have set conf-spawn lower than 1.\n");
     20     substdio_flush(subfderr);
     21     return 1;
     22   }
     23 
     24   if (auto_spawn > 255) {
     25     substdio_puts(subfderr,"Oops. You have set conf-spawn higher than 255.\n");
     26     substdio_flush(subfderr);
     27     return 1;
     28   }
     29 
     30   if (auto_spawn > maxnumd) {
     31     substdio_puts(subfderr,"Oops. Your system's FD_SET() has a hidden limit of ");
     32     substdio_put(subfderr,num,fmt_ulong(num,hiddenlimit));
     33     substdio_puts(subfderr," descriptors.\n\
     34 This means that the qmail daemons could crash if you set the run-time\n\
     35 concurrency higher than ");
     36     substdio_put(subfderr,num,fmt_ulong(num,maxnumd));
     37     substdio_puts(subfderr,". So I'm going to insist that the concurrency\n\
     38 limit in conf-spawn be at most ");
     39     substdio_put(subfderr,num,fmt_ulong(num,maxnumd));
     40     substdio_puts(subfderr,". Right now it's ");
     41     substdio_put(subfderr,num,fmt_ulong(num,(unsigned long) auto_spawn));
     42     substdio_puts(subfderr,".\n");
     43     substdio_flush(subfderr);
     44     return 1;
     45   }
     46   return 0;
     47 }