From: Thibault Godouet Date: Mon, 28 Oct 2002 17:52:03 +0000 (+0000) Subject: added option -q X-Git-Tag: ver2_9_4~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b03b3963530bd874cdd8be818342a87a8fedf6a5;p=thirdparty%2Ffcron.git added option -q --- diff --git a/fcron.c b/fcron.c index 4fa6828..afef13e 100644 --- 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 66f7e7e..8e57c21 100644 --- 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;