diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index bb1df0b10bd9508e71aa12e3b200dd174047e96d..2ee03743d85936a1186772cd422e35d55859de00 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -97,8 +97,6 @@ BEGIN_C_DECLS /* eg. the maximum count of nodes any job may use in some partition */ #define INFINITE (0xffffffff) #define NO_VAL (0xfffffffe) -#define DEFAULT_KILL_WAIT 30 -#define DEFAULT_WAIT_TIME 0 #define MAX_TASKS_PER_NODE 64 /* last entry must be JOB_END, keep in sync with job_state_string and diff --git a/src/common/read_config.c b/src/common/read_config.c index 8eecf61aa447782ccadc9c87fa78c5f1cf7b6eb7..76f2b7c1e6823ee2b3ce4d550eb422fb9d5dc7b3 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -778,6 +778,13 @@ validate_config (slurm_ctl_conf_t *ctl_conf_ptr) if (ctl_conf_ptr->kill_wait == (uint16_t) NO_VAL) ctl_conf_ptr->kill_wait = DEFAULT_KILL_WAIT; + if (ctl_conf_ptr->slurmctld_pidfile == NULL) + ctl_conf_ptr->slurmctld_pidfile = + xstrdup(DEFAULT_SLURMCTLD_PIDFILE); + + if (ctl_conf_ptr->slurmd_pidfile == NULL) + ctl_conf_ptr->slurmd_pidfile = xstrdup(DEFAULT_SLURMD_PIDFILE); + if (ctl_conf_ptr->wait_time == (uint16_t) NO_VAL) ctl_conf_ptr->wait_time = DEFAULT_WAIT_TIME; } diff --git a/src/common/read_config.h b/src/common/read_config.h index 3dd48143241e383e511b322eabe3391c6241ac8e..06e10c62e140448d45a46f07111672cf3d52fdad 100644 --- a/src/common/read_config.h +++ b/src/common/read_config.h @@ -30,6 +30,11 @@ #include "src/common/slurm_protocol_defs.h" +#define DEFAULT_KILL_WAIT 30 +#define DEFAULT_SLURMCTLD_PIDFILE "/var/run/slurmctld.pid" +#define DEFAULT_SLURMD_PIDFILE "/var/run/slurmd.pid" +#define DEFAULT_WAIT_TIME 0 + /* * init_slurm_conf - initialize or re-initialize the slurm configuration * values. diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index af60c2649883481cdb6a74a6a7d570190c5f257d..2dc8598e3fd7f906c6c0ebb1de049c1cbac9a63d 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -75,7 +75,6 @@ * check-in before we ping them */ #define MAX_SERVER_THREADS 20 /* Max threads to service RPCs */ #define MEM_LEAK_TEST 0 /* Running memory leak test if set */ -#define DEFAULT_PIDFILE "/var/run/slurmctld.pid" #ifndef MAX # define MAX(x,y) (((x) >= (y)) ? (x) : (y)) @@ -335,7 +334,6 @@ static void *_slurmctld_signal_hand(void *no_data) int sig; int error_code; sigset_t set; - char *pidfile = DEFAULT_PIDFILE; /* Locks: Write configuration, job, node, and partition */ slurmctld_lock_t config_write_lock = { WRITE_LOCK, WRITE_LOCK, WRITE_LOCK, WRITE_LOCK @@ -344,9 +342,7 @@ static void *_slurmctld_signal_hand(void *no_data) (void) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); (void) pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - if (slurmctld_conf.slurmctld_pidfile) - pidfile = slurmctld_conf.slurmctld_pidfile; - create_pidfile(pidfile); + create_pidfile(slurmctld_conf.slurmctld_pidfile); if (sigemptyset(&set)) error("sigemptyset error: %m"); @@ -2488,11 +2484,8 @@ _init_pidfile(void) { int fd = -1; uid_t uid = slurmctld_conf.slurm_user_id; - char *pidfile = slurmctld_conf.slurmctld_pidfile; - pidfile = pidfile ? pidfile : DEFAULT_PIDFILE; - - if ((fd = create_pidfile(pidfile)) < 0) + if ((fd = create_pidfile(slurmctld_conf.slurmctld_pidfile)) < 0) return; if (uid && (fchown(fd, uid, -1) < 0)) diff --git a/src/slurmd/slurmd.c b/src/slurmd/slurmd.c index 520d9694ef0eaa68e81010700693174cceaca335..51769c7eb52a21ad47845096b2bbb8c3bff5bf26 100644 --- a/src/slurmd/slurmd.c +++ b/src/slurmd/slurmd.c @@ -71,7 +71,6 @@ #define MAX_THREADS 64 #define DEFAULT_SPOOLDIR "/var/spool/slurmd" -#define DEFAULT_PIDFILE "/var/run/slurmd.pid" typedef struct connection { slurm_fd fd; @@ -510,7 +509,7 @@ _init_conf() conf->shm_cleanup = 0; conf->log_opts = lopts; conf->debug_level = LOG_LEVEL_INFO; - conf->pidfile = xstrdup(DEFAULT_PIDFILE); + conf->pidfile = xstrdup(DEFAULT_SLURMD_PIDFILE); conf->spooldir = xstrdup(DEFAULT_SPOOLDIR); slurm_mutex_init(&conf->config_mutex);