diff --git a/src/slurmd/common/stepd_api.c b/src/slurmd/common/stepd_api.c index cf6859fa2ee47882f51e231c4e89d138932acd8a..26880005804266eace948628b53e98107ef3b64d 100644 --- a/src/slurmd/common/stepd_api.c +++ b/src/slurmd/common/stepd_api.c @@ -181,6 +181,7 @@ stepd_signal_container(step_loc_t step, void *auth_cred, int signal) Buf buf; int buf_len; int rc; + int errnum = 0; fd = step_connect(step); if (fd == -1) @@ -197,11 +198,13 @@ stepd_signal_container(step_loc_t step, void *auth_cred, int signal) safe_write(fd, &buf_len, sizeof(int)); safe_write(fd, get_buf_data(buf), buf_len); - /* Receive the return code */ + /* Receive the return code and errno */ safe_read(fd, &rc, sizeof(int)); + safe_read(fd, &errnum, sizeof(int)); free_buf(buf); close(fd); + errno = errnum; return rc; rwfail: close(fd); diff --git a/src/slurmd/common/stepd_api.h b/src/slurmd/common/stepd_api.h index 3e1e5f748d24c5ea31d45327cfe9f203b93a32f1..d4946e3ac4b0e1173e4f925e9e68c184ed71b2dc 100644 --- a/src/slurmd/common/stepd_api.h +++ b/src/slurmd/common/stepd_api.h @@ -121,7 +121,7 @@ pid_t stepd_daemon_pid(step_loc_t step); #define safe_read(fd, ptr, size) do { \ if (read(fd, ptr, size) != size) { \ - error("%s:%d: %s: read (%d bytes) failed: %m", \ + debug("%s:%d: %s: read (%d bytes) failed: %m", \ __FILE__, __LINE__, __CURRENT_FUNC__, \ (int)size); \ goto rwfail; \ @@ -130,7 +130,7 @@ pid_t stepd_daemon_pid(step_loc_t step); #define safe_write(fd, ptr, size) do { \ if (write(fd, ptr, size) != size) { \ - error("%s:%d: %s: write (%d bytes) failed: %m", \ + debug("%s:%d: %s: write (%d bytes) failed: %m", \ __FILE__, __LINE__, __CURRENT_FUNC__, \ (int)size); \ goto rwfail; \ diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c index b59a13172398be249b0fdcb92525bda5e9bcd97f..7b0cd3a1178d3fcdd979d8521337c21f7ab0edb4 100644 --- a/src/slurmd/slurmd/req.c +++ b/src/slurmd/slurmd/req.c @@ -1068,7 +1068,7 @@ _kill_all_active_steps(void *auth_cred, uint32_t jobid, int sig, bool batch) debug2("container signal %d to job %u.%u", sig, jobid, stepd->stepid); if (stepd_signal_container(*stepd, auth_cred, sig) < 0) - error("kill jid %d: %m", jobid); + debug("kill jid %d: %m", jobid); } list_iterator_destroy(i); list_destroy(steps); diff --git a/src/slurmd/slurmstepd/req.c b/src/slurmd/slurmstepd/req.c index 533461507a22dee0dc9c6524eed21e59c656973b..32cc1fb6761bf71dcf6eabb46398dd29f6736043 100644 --- a/src/slurmd/slurmstepd/req.c +++ b/src/slurmd/slurmstepd/req.c @@ -509,7 +509,8 @@ _handle_signal_container(int fd, slurmd_job_t *job) debug("kill container req from uid %ld for job %u.%u " "owned by uid %ld", (long)uid, job->jobid, job->stepid, (long)job->uid); - rc = EPERM; + rc = -1; + errno = EPERM; goto done; } @@ -519,7 +520,8 @@ _handle_signal_container(int fd, slurmd_job_t *job) if (job->cont_id == 0) { debug ("step %u.%u invalid container [cont_id:%u]", job->jobid, job->stepid, job->cont_id); - rc = ESLURMD_JOB_NOTRUNNING; + rc = -1; + errno = ESLURMD_JOB_NOTRUNNING; goto done; } @@ -534,8 +536,9 @@ _handle_signal_container(int fd, slurmd_job_t *job) } done: - /* Send the return code */ + /* Send the return code and errno */ safe_write(fd, &rc, sizeof(int)); + safe_write(fd, &errno, sizeof(int)); rwfail: return; }