Skip to content
Snippets Groups Projects
Commit efc2273e authored by Tim Wickberg's avatar Tim Wickberg
Browse files

Remove now-unused xcgroup_set_params().

xgroup_set_param() avoids the string parsing overhead and
should be used instead.
parent 82d810a0
No related branches found
No related tags found
No related merge requests found
...@@ -554,57 +554,6 @@ int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids) ...@@ -554,57 +554,6 @@ int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids)
return fstatus; return fstatus;
} }
int xcgroup_set_params(xcgroup_t* cg, char* parameters)
{
int fstatus = XCGROUP_ERROR;
char file_path[PATH_MAX];
char* cpath = cg->path;
char* params;
char* value;
char* p;
char* next;
params = (char*) xstrdup(parameters);
p = params;
while (p != NULL && *p != '\0') {
next = xstrchr(p, ' ');
if (next) {
*next='\0';
next++;
while (*next == ' ')
next++;
}
value = xstrchr(p, '=');
if (value != NULL) {
*value='\0';
value++;
if (snprintf(file_path, PATH_MAX, "%s/%s", cpath, p)
>= PATH_MAX) {
debug2("unable to build filepath for '%s' and"
" parameter '%s' : %m", cpath, p);
goto next_loop;
}
fstatus = _file_write_content(file_path, value,
strlen(value));
if (fstatus != XCGROUP_SUCCESS)
debug2("%s: unable to set parameter '%s' to "
"'%s' for '%s'", __func__, p, value,
cpath);
else
debug3("%s: parameter '%s' set to '%s' for '%s'",
__func__, p, value, cpath);
} else
debug2("%s: bad parameters format for entry '%s'",
__func__, p);
next_loop:
p = next;
}
xfree(params);
return fstatus;
}
int xcgroup_set_param(xcgroup_t* cg, char* param, char* content) int xcgroup_set_param(xcgroup_t* cg, char* param, char* content)
{ {
int fstatus = XCGROUP_ERROR; int fstatus = XCGROUP_ERROR;
......
...@@ -216,21 +216,6 @@ int xcgroup_add_pids(xcgroup_t* cg, pid_t* pids, int npids); ...@@ -216,21 +216,6 @@ int xcgroup_add_pids(xcgroup_t* cg, pid_t* pids, int npids);
*/ */
int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids); int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids);
/*
* set cgroup parameters using string of the form :
* parameteres="param=value[ param=value]*"
*
* param must correspond to a file of the cgroup that
* will be written with the value content
*
* i.e. xcgroup_set_params(&cg,"memory.swappiness=10");
*
* returned values:
* - XCGROUP_ERROR
* - XCGROUP_SUCCESS
*/
int xcgroup_set_params(xcgroup_t* cg, char* parameters);
/* /*
* set a cgroup parameter * set a cgroup parameter
* *
......
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