Skip to content
Snippets Groups Projects
Commit 51215441 authored by Moe Jette's avatar Moe Jette
Browse files

Add executable name to shared memory for job step.

Remove FREE_NULL calls.
parent b45839fc
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,7 @@
#include "src/slurmd/shm.h"
#include "src/slurmd/io.h"
#include "src/slurmd/fname.h"
#include "src/slurmd/slurmd.h"
static char ** _array_copy(int n, char **src);
static void _array_free(int n, char ***array);
......@@ -389,7 +390,7 @@ job_update_shm(slurmd_job_t *job)
s.stepid = job->stepid;
s.ntasks = job->ntasks;
s.timelimit = job->timelimit;
strncpy(s.exec_name, job->argv[0], MAXPATHLEN);
s.sw_id = 0;
if (shm_insert_step(&s) < 0)
......
......@@ -264,7 +264,7 @@ mgr_launch_batch_job(batch_job_launch_msg_t *msg, slurm_addr *cli)
if ((batchdir = _make_batch_dir(job)) == NULL)
goto cleanup2;
FREE_NULL(job->argv[0]);
xfree(job->argv[0]);
if ((job->argv[0] = _make_batch_script(msg, batchdir)) == NULL)
goto cleanup3;
......
......@@ -38,6 +38,7 @@
#include "src/common/log.h"
#include "src/common/slurm_auth.h"
#include "src/common/slurm_protocol_api.h"
#include "src/common/xstring.h"
#include "src/common/xmalloc.h"
#include "src/slurmd/slurmd.h"
......@@ -470,6 +471,7 @@ _rpc_reattach_tasks(slurm_msg_t *msg, slurm_addr *cli)
resp.gids[t->id] = t->global_id;
resp.local_pids[t->id] = t->pid;
}
resp.executable_name = xstrdup(step->exec_name);
shm_free_step(step);
......@@ -480,12 +482,11 @@ _rpc_reattach_tasks(slurm_msg_t *msg, slurm_addr *cli)
resp.node_name = conf->hostname;
resp.srun_node_id = req->srun_node_id;
resp.return_code = rc;
resp.executable_name ="TBD"; /* job->argv[0]; */
slurm_send_only_node_msg(&resp_msg);
FREE_NULL(resp.gids);
FREE_NULL(resp.local_pids);
xfree(resp.gids);
xfree(resp.local_pids);
}
......
......@@ -63,6 +63,7 @@
#include "src/common/xmalloc.h"
#include "src/common/xassert.h"
#include "src/common/slurm_errno.h"
#include "src/common/xstring.h"
#include "src/slurmd/slurmd.h"
#include "src/slurmd/shm.h"
......@@ -575,7 +576,8 @@ shm_update_step_addrs(uint32_t jobid, uint32_t stepid,
memcpy(s->key.data, keydata, SLURM_KEY_SIZE);
s->io_update = true;
debug3("Going to send shm update signal to %ld", s->sid);
debug3("Going to send shm update signal to %ld",
s->sid);
if (kill(s->sid, SIGHUP) < 0) {
slurm_seterrno(EPERM);
retval = SLURM_FAILURE;
......@@ -770,7 +772,7 @@ _shm_task_copy(task_t *to, task_t *from)
static void
_shm_step_copy(job_step_t *to, job_step_t *from)
{
*to = *from;
memcpy(to, from, sizeof(job_step_t));
to->state = SLURMD_JOB_ALLOCATED;
/* addition of tasks is another step */
......@@ -780,14 +782,15 @@ _shm_step_copy(job_step_t *to, job_step_t *from)
static void
_shm_clear_task(task_t *t)
{
memset(t, 0, sizeof(*t));
memset(t, 0, sizeof(task_t));
}
static void
_shm_clear_step(job_step_t *s)
{
task_t *p, *t = _taskp(s->task_list);
memset(s, 0, sizeof(*s));
memset(s, 0, sizeof(job_step_t));
if (!t)
return;
do {
......
......@@ -47,6 +47,8 @@
# include <unistd.h>
#endif
#include <sys/param.h> /* MAXPATHLEN */
#include "src/common/slurm_protocol_api.h"
#include "src/common/list.h"
......@@ -84,6 +86,7 @@ struct job_step {
uint32_t sw_id; /* Switch/Interconnect specific id */
int ntasks; /* number of tasks in this job */
pid_t sid; /* Job session id */
char exec_name[MAXPATHLEN]; /* Executable's pathname */
int io_update; /* srun address has been updated */
slurm_addr respaddr; /* Addr to send messages to srun on */
......
......@@ -51,12 +51,6 @@
extern pid_t getsid(pid_t pid); /* missing from <unistd.h> */
#endif
#define FREE_NULL(_X) \
do { \
if (_X) xfree (_X); \
_X = NULL; \
} while (0)
/*
* Global config type
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment