procmail
[Top] [All Lists]

Re: limits on formail

1995-12-13 19:28:07
Doug Hughes <Doug(_dot_)Hughes(_at_)Eng(_dot_)Auburn(_dot_)EDU> wrote:
The international students, when gone for a month, tally up about 1000 mail
messages each, and it takes a LONG time to formail then without the -n
flag. Of course, WITH the -n flag, the machine dies a horrible resource-drained
death.

Funny, since formail does try to auto-adapt (at least concerning
process table entries).

Try the following patch (it adds the optional argument to -n):
(time to update the docs, I guess :-)
Index: formail.c
===================================================================
RCS file: /var/lib/cvs/procmail/src/formail.c,v
retrieving revision 1.77
diff -u -r1.77 formail.c
--- formail.c   1995/10/30 02:09:19     1.77
+++ formail.c   1995/12/14 01:54:35
@@ -94,6 +94,7 @@
 char ffileno[LEN_FILENO_VAR+8*sizeof(initfileno)*4/10+1+1]=DEFfileno;
 int lexitcode;                                      /* dummy, for waitfor() */
 pid_t child= -1;
+int childlimit;
 unsigned long rhash;
 FILE*mystdout;
 int nrskip,nrtotal= -1,retval=EXIT_SUCCESS;
@@ -376,7 +377,7 @@
              case FM_BABYL:babyl=every=1;
              case FM_DIGEST:digest=1;
                 continue;
-             case FM_NOWAIT:nowait=1;
+             case 
FM_NOWAIT:nowait=1;Qnext_arg();childlimit=strtol(chp,&chp,10);
                 continue;
              case FM_KEEPB:keepb=1;
                 continue;
Index: formisc.c
===================================================================
RCS file: /var/lib/cvs/procmail/src/formisc.c,v
retrieving revision 1.35
diff -u -r1.35 formisc.c
--- formisc.c   1995/10/30 02:09:20     1.35
+++ formisc.c   1995/12/14 02:00:49
@@ -172,15 +172,16 @@
           *chp++='0';
       }
      pipe(poutfd);
-     ;{ int maxchild=(unsigned long)children*CHILD_FACTOR,excode;
+     ;{ int maxchild=childlimit?childlimit:
+        (unsigned long)children*CHILD_FACTOR,excode;
        while(children&&waitpid((pid_t)-1,&excode,WNOHANG)>0)
           if(!WIFSTOPPED(excode))                    /* collect any zombies */
            { children--;
              if((excode=WIFEXITED(excode)?
                  WEXITSTATUS(excode):-WTERMSIG(excode))!=EXIT_SUCCESS)
                 retval=excode;
-           }
-       while((child=fork())==-1&&children)            /* reap some children */
+           }                                          /* reap some children */
+       while(childlimit&&children>=childlimit||(child=fork())==-1&&children)
           for(--children;(excode=waitfor((pid_t)0))!=NO_PROCESS;)
            { if(excode!=EXIT_SUCCESS)
                 retval=excode;
Index: formail.h
===================================================================
RCS file: /var/lib/cvs/procmail/src/formail.h,v
retrieving revision 1.13
diff -u -r1.13 formail.h
--- formail.h   1994/09/29 18:43:44     1.13
+++ formail.h   1995/12/14 01:54:50
@@ -20,6 +20,7 @@
 extern int errout,oldstdout,quiet,zap,buflast,lenfileno;
 extern long initfileno;
 extern pid_t child;
+extern int childlimit;
 extern unsigned long rhash;
 extern FILE*mystdout;
 extern int nrskip,nrtotal,retval;
-- 
Sincerely,                                                          
srb(_at_)cuci(_dot_)nl
           Stephen R. van den Berg (AKA BuGless).

The eleventh commandment: Thou shalt not re-curse!

<Prev in Thread] Current Thread [Next in Thread>