]> granicus.if.org Git - fcron/commitdiff
added option -q ver1564
authorthib <thib>
Mon, 28 Oct 2002 17:52:03 +0000 (17:52 +0000)
committerthib <thib>
Mon, 28 Oct 2002 17:52:03 +0000 (17:52 +0000)
fcron.c
fcron.h

diff --git a/fcron.c b/fcron.c
index 4fa6828bde89884e1df377973aad55605265424c..afef13ec3f4ef55bf90dc7e4e3d520f25ba8f59c 100644 (file)
--- a/fcron.c
+++ b/fcron.c
@@ -21,7 +21,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: fcron.c,v 1.67 2002-10-06 16:56:04 thib Exp $ */
+ /* $Id: fcron.c,v 1.68 2002-10-28 17:52:03 thib Exp $ */
 
 #include "fcron.h"
 
@@ -33,7 +33,7 @@
 #include "socket.h"
 #endif
 
-char rcs_info[] = "$Id: fcron.c,v 1.67 2002-10-06 16:56:04 thib Exp $";
+char rcs_info[] = "$Id: fcron.c,v 1.68 2002-10-28 17:52:03 thib Exp $";
 
 void main_loop(void);
 void check_signal(void);
@@ -96,6 +96,8 @@ short int serial_running;     /* number of running serial jobs */
 
 /* do not run more than this number of serial job simultaneously */
 short int serial_max_running = SERIAL_MAX_RUNNING; 
+short int serial_queue_max   = SERIAL_QUEUE_MAX;
+short int lavg_queue_max     = LAVG_QUEUE_MAX;
 
 struct lavg_t *lavg_array;      /* jobs waiting for a given system load value */
 short int lavg_array_size;    /* size of lavg_array */
@@ -286,6 +288,7 @@ parseopt(int argc, char *argv[])
        {"maxserial", 1, NULL, 'm'},
        {"configfile", 1, NULL, 'c'},
        {"newspooldir", 1, NULL, 'n'},
+       {"queuelen", 1, NULL, 'q'},
        {0,0,0,0}
     };
 #endif /* HAVE_GETOPT_LONG */
@@ -297,12 +300,12 @@ parseopt(int argc, char *argv[])
 
     while(1) {
 #ifdef HAVE_GETOPT_LONG
-       c = getopt_long(argc, argv, "dfbyhVos:l:m:c:n:", opt, NULL);
+       c = getopt_long(argc, argv, "dfbyhVos:l:m:c:n:q:", opt, NULL);
 #else
-       c = getopt(argc, argv, "dfbyhVos:l:m:c:n:");
+       c = getopt(argc, argv, "dfbyhVos:l:m:c:n:q:");
 #endif /* HAVE_GETOPT_LONG */
        if ( c == EOF ) break;
-       switch (c) {
+       switch ( (char)c ) {
 
        case 'V':
            info(); break;
@@ -349,6 +352,12 @@ parseopt(int argc, char *argv[])
            create_spooldir(optarg);
            break;
 
+       case 'q':
+           if ( (lavg_queue_max = serial_queue_max = strtol(optarg, NULL, 10)) < 5 
+               || serial_queue_max >= SHRT_MAX )
+               die("Queue length can only be set between 5 and %d.", SHRT_MAX);
+           break;
+
        case ':':
            error("(parseopt) Missing parameter");
            usage();
diff --git a/fcron.h b/fcron.h
index 66f7e7ee67599a01c53bb18df775c16b8e0750bb..8e57c215254d650ab9180b91bdf4a2785da4e61b 100644 (file)
--- a/fcron.h
+++ b/fcron.h
@@ -21,7 +21,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: fcron.h,v 1.28 2002-10-06 16:56:15 thib Exp $ */
+ /* $Id: fcron.h,v 1.29 2002-10-28 17:53:21 thib Exp $ */
 
 #ifndef __FCRON_H__
 #define __FCRON_H__
@@ -82,6 +82,8 @@ extern short int serial_array_index;
 extern short int serial_num;
 extern short int serial_running;
 extern short int serial_max_running; 
+extern short int serial_queue_max;
+extern short int lavg_queue_max;
 extern struct exe_t *exe_array;
 extern short int exe_array_size;
 extern short int exe_num;