/* * mcs_p_set_mcs_label() is called to obtain mcs_label. */ extern int mcs_p_set_mcs_label (struct job_record *job_ptr, char *label) { char *user = NULL; int rc = SLURM_SUCCESS; user = uid_to_string((uid_t) job_ptr->user_id); xfree(job_ptr->mcs_label); if (label != NULL) { /* test label param */ if (xstrcmp(label, user) == 0) job_ptr->mcs_label = xstrdup(user); else rc = SLURM_ERROR; } else { if ((slurm_mcs_get_enforced() == 0) && job_ptr->details && (job_ptr->details->whole_node != WHOLE_NODE_MCS)) ; else job_ptr->mcs_label = xstrdup(user); } xfree(user); return rc; }
/* * mcs_p_set_mcs_label() is called to obtain/check mcs_label. * Return job_ptr->mcs_label value must be xfreed */ extern int mcs_p_set_mcs_label (struct job_record *job_ptr, char *label) { char *result = NULL; gid_t groups[MAX_GROUPS]; int ngroups = -1; int rc; if (label == NULL) { if ((slurm_mcs_get_enforced() == 0) && job_ptr->details && (job_ptr->details->whole_node != WHOLE_NODE_MCS)) return SLURM_SUCCESS; rc = _get_user_groups(job_ptr->user_id,job_ptr->group_id, groups, MAX_GROUPS, &ngroups); if (rc) { /* Failed to get groups */ if (slurm_mcs_get_enforced() == 0) return SLURM_SUCCESS; else return SLURM_ERROR; } rc = _find_mcs_label(groups, ngroups, &result); if (rc) { return SLURM_ERROR; } else { xfree(job_ptr->mcs_label); job_ptr->mcs_label = xstrdup(result); return SLURM_SUCCESS; } } else { if (_check_mcs_label(job_ptr, label) == 0 ) return SLURM_SUCCESS; else return SLURM_ERROR; } }
/* * mcs_p_set_mcs_label() is called to obtain/check mcs_label. * Return job_ptr->mcs_label value must be xfreed */ extern int mcs_p_set_mcs_label(struct job_record *job_ptr, char *label) { int rc = SLURM_SUCCESS; xfree(job_ptr->mcs_label); if (label != NULL) { /* test label param */ if (!xstrcmp(label, job_ptr->account)) { job_ptr->mcs_label = xstrdup(job_ptr->account); } else { rc = SLURM_ERROR; } } else { if ((slurm_mcs_get_enforced() == 0) && job_ptr->details && (job_ptr->details->whole_node != WHOLE_NODE_MCS)) { ; } else { job_ptr->mcs_label = xstrdup(job_ptr->account); } } return rc; }