From: thib Date: Mon, 4 Sep 2000 13:08:15 +0000 (+0000) Subject: added PROC_LOADAVG compilation option X-Git-Tag: ver1564~531 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d64d88025dfdc664e22a0e2f61c9e1d81babab5;p=fcron added PROC_LOADAVG compilation option --- diff --git a/config.h.in b/config.h.in index c9e8351..b958d9b 100644 --- a/config.h.in +++ b/config.h.in @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: config.h.in,v 1.14 2000-08-29 18:01:39 thib Exp $ */ + /* $Id: config.h.in,v 1.15 2000-09-04 13:08:15 thib Exp $ */ /* *********************************************************** */ @@ -37,7 +37,11 @@ /* (they are overridden by Makefile's value ) */ #ifndef VERSION -#define VERSION "1.0.0" /* default version if not defined in Makefile */ +#define VERSION "1.0.0" /* default version if not defined in Makefile */ +#endif + +#ifndef SENDMAIL /* mail command location */ +#define SENDMAIL "/usr/lib/sendmail" #endif #ifndef FCRONTABS /* directory where is stored users' fcrontabs */ @@ -48,6 +52,11 @@ #define ETC "/etc/" #endif +#ifndef PROC_LOADAVG /* do we have a mounted procfs with loadavg file on + * this system ? */ +#define PROC_LOADAVG 1 +#endif + #ifndef PROC /* directory where is mounted the procfs */ #define PROC "/proc/" #endif @@ -78,8 +87,6 @@ #define FCRON_DENY "fcron.deny" -#define SENDMAIL "/usr/lib/sendmail" /* mail command */ - #define SENDMAIL_ARGS "-Ffcron", "-odi" /* args of mail command */ #define EDITOR "/usr/bin/vi" /* default editor */ diff --git a/database.c b/database.c index a5d99c4..dedf8e4 100644 --- a/database.c +++ b/database.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: database.c,v 1.22 2000-09-03 19:03:10 thib Exp $ */ + /* $Id: database.c,v 1.23 2000-09-04 13:10:13 thib Exp $ */ #include "fcron.h" @@ -747,6 +747,13 @@ check_lavg(time_t lim) * and return the time to sleep */ { time_t tts = time_to_sleep(lim); + +#if PROC_LOADAVG == 0 + while ( lavg_num > 0 ) + run_lavg_job(0); + return tts; +#endif /* PROC_LOADAVG = 0 */ + register int i = 0; short int l_avg[3]; diff --git a/fileconf.c b/fileconf.c index f04fa38..eaeb4d0 100644 --- a/fileconf.c +++ b/fileconf.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fileconf.c,v 1.15 2000-08-29 18:03:03 thib Exp $ */ + /* $Id: fileconf.c,v 1.16 2000-09-04 13:09:21 thib Exp $ */ #include "fcrontab.h" @@ -537,6 +537,10 @@ read_opt(char *ptr, CL *cl) Handle_err; cl->cl_lavg[2] = i; set_lavg(cl->cl_option); +#if PROC_LOADAVG == 0 + warn("As fcron has been compiled with no procfs support,\n" + "you will not be able to use the lavg* options"); +#endif /* PROC_LOADAVG = 0 */ if (debug_opt) fprintf(stderr, " Opt : 'lavg15' %d\n", i); } @@ -546,6 +550,10 @@ read_opt(char *ptr, CL *cl) Handle_err; cl->cl_lavg[0] = i; set_lavg(cl->cl_option); +#if PROC_LOADAVG == 0 + warn("As fcron has been compiled with no procfs support,\n" + "you will not be able to use the lavg* options"); +#endif /* PROC_LOADAVG = 0 */ if (debug_opt) fprintf(stderr, " Opt : 'lavg1' %d\n", i); } @@ -555,6 +563,10 @@ read_opt(char *ptr, CL *cl) Handle_err; cl->cl_lavg[1] = i; set_lavg(cl->cl_option); +#if PROC_LOADAVG == 0 + warn("As fcron has been compiled with no procfs support,\n" + "you will not be able to use the lavg* options"); +#endif /* PROC_LOADAVG = 0 */ if (debug_opt) fprintf(stderr, " Opt : 'lavg5' %d\n", i); } @@ -564,6 +576,10 @@ read_opt(char *ptr, CL *cl) Handle_err; cl->cl_lavg[2] = i; set_lavg(cl->cl_option); +#if PROC_LOADAVG == 0 + warn("As fcron has been compiled with no procfs support,\n" + "you will not be able to use the lavg* options"); +#endif /* PROC_LOADAVG = 0 */ if (debug_opt) fprintf(stderr, " Opt : 'lavg15' %d\n", i); }