diff --git a/src/plugins/jobacct/aix/jobacct_aix.c b/src/plugins/jobacct/aix/jobacct_aix.c index 0cc4df8944e47a44fbbc2597b83b9a5e2e2f0dbf..ef543410ad410a6b5a724c0c3b9bd75aa1f3e152 100644 --- a/src/plugins/jobacct/aix/jobacct_aix.c +++ b/src/plugins/jobacct/aix/jobacct_aix.c @@ -66,8 +66,7 @@ * minimum versions for their plugins as the job accounting API * matures. */ -const char plugin_name[] = -"Job accounting AIX plugin"; +const char plugin_name[] = "Job accounting AIX plugin"; const char plugin_type[] = "jobacct/aix"; const uint32_t plugin_version = 100; @@ -99,6 +98,22 @@ extern int getprocs(struct procsinfo *procinfo, int, struct fdsinfo *, /* sizproc: size of expected procinfo structure */ #endif + +/* + * init() is called when the plugin is loaded, before any other functions + * are called. Put global initialization here. + */ +extern int init ( void ) +{ + verbose("%s loaded", plugin_name); + return SLURM_SUCCESS; +} + +extern int fini ( void ) +{ + return SLURM_SUCCESS; +} + /* * The following routine is called by the slurmd mainline */ @@ -204,7 +219,7 @@ int jobacct_p_startpoll(int frequency) debug("jobacct: frequency = %d", frequency); - fini = false; + jobacct_shutdown = false; if (frequency == 0) { /* don't want dynamic monitoring? */ debug2("jobacct AIX dynamic logging disabled"); @@ -416,7 +431,7 @@ finished: static void *_watch_tasks(void *arg) { - while(!fini) { /* Do this until slurm_jobacct_task_exit() stops us */ + while(!jobacct_shutdown) { /* Do this until shutdown is requested */ if(!suspended) { _get_process_data(); /* Update the data */ } diff --git a/src/plugins/jobacct/common/common_slurmstepd.c b/src/plugins/jobacct/common/common_slurmstepd.c index 372e37567ecf3e94e67aed9a86ae5f6edf9cac11..8c332a12b8242238316afe92d840baf39c8d4a38 100644 --- a/src/plugins/jobacct/common/common_slurmstepd.c +++ b/src/plugins/jobacct/common/common_slurmstepd.c @@ -29,14 +29,14 @@ #include "jobacct_common.h" -bool fini = false; +bool jobacct_shutdown = false; bool suspended = false; List task_list = NULL; pthread_mutex_t jobacct_lock = PTHREAD_MUTEX_INITIALIZER; extern int common_endpoll() { - fini = true; + jobacct_shutdown = true; return SLURM_SUCCESS; } diff --git a/src/plugins/jobacct/common/jobacct_common.h b/src/plugins/jobacct/common/jobacct_common.h index 9d4ec9581fbb662fe16401599e674dd6b96e0225..d09b94e507ef39abce645e3d2e5cd1a48878f68f 100644 --- a/src/plugins/jobacct/common/jobacct_common.h +++ b/src/plugins/jobacct/common/jobacct_common.h @@ -112,7 +112,7 @@ extern struct jobacctinfo *common_stat_task(pid_t pid); extern struct jobacctinfo *common_remove_task(pid_t pid); extern void common_suspendpoll(); -extern bool fini; +extern bool jobacct_shutdown; extern bool suspended; extern List task_list; extern pthread_mutex_t jobacct_lock; diff --git a/src/plugins/jobacct/linux/jobacct_linux.c b/src/plugins/jobacct/linux/jobacct_linux.c index 09f444c9750760953c61e92d4d109674f32365d2..1de4f66cdcf4f32b986d994b6094f04140f570af 100644 --- a/src/plugins/jobacct/linux/jobacct_linux.c +++ b/src/plugins/jobacct/linux/jobacct_linux.c @@ -59,8 +59,7 @@ * minimum versions for their plugins as the job accounting API * matures. */ -const char plugin_name[] = -"Job accounting LINUX plugin"; +const char plugin_name[] = "Job accounting LINUX plugin"; const char plugin_type[] = "jobacct/linux"; const uint32_t plugin_version = 100; @@ -77,7 +76,7 @@ typedef struct prec { /* process record */ } prec_t; static int freq = 0; -/* Finally, pre-define all the routines. */ +/* Finally, pre-define all local routines. */ static void _get_offspring_data(List prec_list, prec_t *ancestor, pid_t pid); static void _get_process_data(); @@ -85,6 +84,21 @@ static int _get_process_data_line(FILE *in, prec_t *prec); static void *_watch_tasks(void *arg); static void _destroy_prec(void *object); +/* + * init() is called when the plugin is loaded, before any other functions + * are called. Put global initialization here. + */ +extern int init ( void ) +{ + verbose("%s loaded", plugin_name); + return SLURM_SUCCESS; +} + +extern int fini ( void ) +{ + return SLURM_SUCCESS; +} + /* * The following routine is called by the slurmd mainline */ @@ -193,7 +207,7 @@ int jobacct_p_startpoll(int frequency) debug("jobacct: frequency = %d", frequency); - fini = false; + jobacct_shutdown = false; if (frequency == 0) { /* don't want dynamic monitoring? */ debug2("jobacct LINUX dynamic logging disabled"); @@ -489,7 +503,7 @@ static int _get_process_data_line(FILE *in, prec_t *prec) { static void *_watch_tasks(void *arg) { - while(!fini) { /* Do this until slurm_jobacct_task_exit() stops us */ + while(!jobacct_shutdown) { /* Do this until shutdown is requested */ if(!suspended) { _get_process_data(); /* Update the data */ } diff --git a/src/plugins/jobacct/none/jobacct_none.c b/src/plugins/jobacct/none/jobacct_none.c index bcb8d5f46e6a5241cbcb8e9470f379e50d3617e5..fe511bccef258503171a13422a6dc7e1d723b6bb 100644 --- a/src/plugins/jobacct/none/jobacct_none.c +++ b/src/plugins/jobacct/none/jobacct_none.c @@ -75,11 +75,25 @@ * minimum versions for their plugins as the job accounting API * matures. */ -const char plugin_name[] = - "Job accounting NOT_INVOKED plugin"; +const char plugin_name[] = "Job accounting NOT_INVOKED plugin"; const char plugin_type[] = "jobacct/none"; const uint32_t plugin_version = 100; +/* + * init() is called when the plugin is loaded, before any other functions + * are called. Put global initialization here. + */ +extern int init ( void ) +{ + verbose("%s loaded", plugin_name); + return SLURM_SUCCESS; +} + +extern int fini ( void ) +{ + return SLURM_SUCCESS; +} + /* * The following routines are called by slurmctld */