Skip to content

Commit

Permalink
orch .. unified use of exit/fatal and err_exit
Browse files Browse the repository at this point in the history
  • Loading branch information
flhofer committed Jun 20, 2024
1 parent c269d38 commit aac3baa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/lib/parse_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void parse_dockerfileprefix(prgset_t *set)
{
set->cpusetdfileprefix = malloc(strlen(set->cgroupfileprefix) + strlen(CGRP_CSET) + strlen(set->cont_cgrp)+1);
if (!set->cpusetdfileprefix)
err_exit_n(errno, "Could not allocate memory");
err_exit("Could not allocate memory");

set->cpusetdfileprefix = strcat(strcat (strcpy(set->cpusetdfileprefix, set->cgroupfileprefix), CGRP_CSET), set->cont_cgrp);
}
Expand Down
6 changes: 2 additions & 4 deletions src/orchestrator/orchestrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,8 @@ static void process_options (prgset_t *set, int argc, char *argv[], int max_cpus
// flag -a with no range = all
} else {
set->affinity = malloc(14);
if (!set->affinity){
err_msg("could not allocate memory!");
exit(EXIT_FAILURE);
}
if (!set->affinity)
err_exit("could not allocate memory!");
(void)sprintf(set->affinity, "0-%d", max_cpus-1);
set->setaffinity = AFFINITY_USEALL;
}
Expand Down
6 changes: 3 additions & 3 deletions src/orchestrator/resmgnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ updatePidCmdline(node_t * node){
free(cmdline);
}
else // FATAL, exit and execute atExit
err_msg("Could not allocate memory!");
err_exit("Could not allocate memory!");
}

/*
Expand Down Expand Up @@ -721,8 +721,8 @@ resetRTthrottle (prgset_t *set, int percent){
*/
void
createResTracer(){
if (rHead || !(prgset->affinity_mask)) // does it exist? is the mast set?
fatal("Memory management inconsistency: resTracer already present!");
if (rHead || !(prgset->affinity_mask)) // does it exist? is the mask set?
err_exit("Memory management inconsistency: resTracer already present!");

// backwards, cpu0 on top, we assume affinity_mask ok
for (int i=(prgset->affinity_mask->size); i >= 0;i--)
Expand Down
6 changes: 3 additions & 3 deletions src/orchestrator/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ getContPids (node_t **pidlst)
char * hex = dir->d_name;
#endif
if (!(( (*pidlst)->contid = strdup(hex) )))
fatal("Could not allocate memory!");
err_exit("Could not allocate memory!");
#ifdef CGROUP2
free(name);
#endif
Expand All @@ -137,7 +137,7 @@ getContPids (node_t **pidlst)

}
else // FATAL, exit and execute atExit
fatal("Could not allocate memory!");
err_exit("Could not allocate memory!");
}
}
closedir(d);
Expand Down Expand Up @@ -211,7 +211,7 @@ getPids (node_t **pidlst, char * tag, char * ppid)
// add command string to pidlist
if (!((*pidlst)->psig = strdup(pid))) // alloc memory for string
// FATAL, exit and execute atExit
fatal("Could not allocate memory!");
err_exit("Could not allocate memory!");
(*pidlst)->contid = NULL;
count++;
}
Expand Down

0 comments on commit aac3baa

Please sign in to comment.