From: Thibault Godouet Date: Sat, 30 Sep 2000 11:55:58 +0000 (+0000) Subject: struct exe now includes the pid of the job executed X-Git-Tag: ver2_9_4~549 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=156568cd893d23039e1a608fb0da74cac9399783;p=thirdparty%2Ffcron.git struct exe now includes the pid of the job executed in order to permit multiple executions of a job simultaneously --- diff --git a/fcron.c b/fcron.c index 9c07a81..b98afbf 100644 --- a/fcron.c +++ b/fcron.c @@ -21,11 +21,11 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcron.c,v 1.29 2000-09-15 20:17:07 thib Exp $ */ + /* $Id: fcron.c,v 1.30 2000-09-30 11:55:58 thib Exp $ */ #include "fcron.h" -char rcs_info[] = "$Id: fcron.c,v 1.29 2000-09-15 20:17:07 thib Exp $"; +char rcs_info[] = "$Id: fcron.c,v 1.30 2000-09-30 11:55:58 thib Exp $"; void main_loop(void); void check_signal(void); @@ -76,7 +76,7 @@ struct lavg *lavg_array; /* jobs waiting for a given system load value */ short int lavg_array_size; /* size of lavg_array */ short int lavg_num; /* number of job being queued */ -struct CL **exe_array; /* jobs which are executed */ +struct exe *exe_array; /* jobs which are executed */ short int exe_array_size; /* size of exe_array */ short int exe_num; /* number of job being executed */ @@ -427,7 +427,7 @@ main(int argc, char **argv) /* initialize exe_array */ exe_num = 0; exe_array_size = EXE_INITIAL_SIZE; - if ( (exe_array = calloc(exe_array_size, sizeof(CL *))) == NULL ) + if ( (exe_array = calloc(exe_array_size, sizeof(struct exe))) == NULL ) die_e("could not calloc exe_array"); /* initialize serial_array */ @@ -518,8 +518,8 @@ main_loop() debug("\n"); test_jobs(now); - if ( serial_running <= 0) - run_serial_job(); + if ( serial_running <= 0) + run_serial_job(); if ( save <= now ) { save = now + SAVE; diff --git a/fcron.h b/fcron.h index 0e1638d..e28f595 100644 --- a/fcron.h +++ b/fcron.h @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcron.h,v 1.11 2000-09-12 19:52:50 thib Exp $ */ + /* $Id: fcron.h,v 1.12 2000-09-30 11:56:59 thib Exp $ */ #ifndef __FCRONH__ #define __FCRONH__ @@ -54,7 +54,6 @@ #include "getloadavg.h" #endif - /* global variables */ extern time_t now; extern char debug_opt; @@ -71,7 +70,7 @@ extern short int serial_array_size; extern short int serial_array_index; extern short int serial_num; extern short int serial_running; -extern struct CL **exe_array; +extern struct exe *exe_array; extern short int exe_array_size; extern short int exe_num; extern struct lavg *lavg_array; @@ -126,7 +125,7 @@ extern void save_file(CF *file_name, char *path); /* end of conf.c */ /* job.c */ -extern void run_job(CL *line); +extern void run_job(struct exe *exeent); /* end of job.c */ diff --git a/job.c b/job.c index 1d3ce7c..afff2a0 100644 --- a/job.c +++ b/job.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: job.c,v 1.23 2000-09-13 15:38:48 thib Exp $ */ + /* $Id: job.c,v 1.24 2000-09-30 11:58:23 thib Exp $ */ #include "fcron.h" @@ -88,11 +88,12 @@ sig_dfl(void) } void -run_job(CL *line) +run_job(struct exe *exeent) /* fork(), redirect outputs to a temp file, and execl() the task */ { pid_t pid; + CL *line = exeent->e_line; /* // */ /* debug("run_job"); */ @@ -211,9 +212,9 @@ run_job(CL *line) default: /* parent */ - line->cl_pid = pid; + exeent->e_pid = pid; line->cl_file->cf_running += 1; - explain("Job `%s' started (pid %d)", line->cl_shell, line->cl_pid); + explain("Job `%s' started (pid %d)", line->cl_shell, pid); }