]> granicus.if.org Git - fcron/commitdiff
struct exe now includes the pid of the job executed
authorthib <thib>
Sat, 30 Sep 2000 11:55:58 +0000 (11:55 +0000)
committerthib <thib>
Sat, 30 Sep 2000 11:55:58 +0000 (11:55 +0000)
in order to permit multiple executions of a job simultaneously

fcron.c
fcron.h
job.c

diff --git a/fcron.c b/fcron.c
index 9c07a81f73fed4eb0821e22fca714939e0d37652..b98afbf0b00e90d8b34b83076018498f37c02277 100644 (file)
--- a/fcron.c
+++ b/fcron.c
  *  `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 0e1638d9a80e3870ee94c1cef0fdbe5d1ecc0d3c..e28f5951af55bd35bf8b6e788a1bb4e3d8cd73d4 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.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 1d3ce7cf7f6706f135d21a7c4e89f8f86da83efd..afff2a0f0fd0ec4d96e18efd14a6aa3ef74b23f4 100644 (file)
--- 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);
 
     }