break;
}
if (ret < 0) {
- cgroup_warn("Warning: cannot change owner of file %s: %s\n",
- filename, strerror(errno));
+ cgroup_warn("cannot change owner of file %s: %s\n", filename,
+ strerror(errno));
last_errno = errno;
ret = ECGOTHER;
}
fts = fts_open(path, FTS_PHYSICAL | FTS_NOCHDIR |
FTS_NOSTAT, NULL);
if (fts == NULL) {
- cgroup_warn("Warning: cannot open directory %s: %s\n",
- path, strerror(errno));
+ cgroup_warn("cannot open directory %s: %s\n", path,
+ strerror(errno));
last_errno = errno;
return ECGOTHER;
}
ent = fts_read(fts);
if (!ent) {
- cgroup_warn("Warning: fts_read failed\n");
+ cgroup_warn("fts_read failed\n");
break;
}
ret = cg_chown_file(fts, ent, owner, group);
return 0;
fail:
- cgroup_warn("Warning: cannot change permissions of file %s: %s\n", path,
+ cgroup_warn("cannot change permissions of file %s: %s\n", path,
strerror(errno));
last_errno = errno;
return ECGOTHER;
fts = fts_open(fts_path, FTS_PHYSICAL | FTS_NOCHDIR |
FTS_NOSTAT, NULL);
if (fts == NULL) {
- cgroup_warn("Warning: cannot open directory %s: %s\n",
- fts_path, strerror(errno));
+ cgroup_warn("cannot open directory %s: %s\n", fts_path,
+ strerror(errno));
last_errno = errno;
return ECGOTHER;
}
file_mode, filem_change,
owner_is_umask);
if (ret) {
- cgroup_warn("Warning: cannot change file mode %s: %s\n",
+ cgroup_warn("cannot change file mode %s: %s\n",
fts_path, strerror(errno));
last_errno = errno;
final_ret = ECGOTHER;
/* Make sure our rule is not NULL, first. */
if (!r) {
- cgroup_warn("Warning: attempted to free NULL rule\n");
+ cgroup_warn("attempted to free NULL rule\n");
return;
}
if (r->procname) {
/* Make sure we're not freeing NULL memory! */
if (!(cg_rl->head)) {
- cgroup_warn("Warning: attempted to free NULL list\n");
+ cgroup_warn("attempted to free NULL list\n");
return;
}
stok_buff = strtok(options, ",");
if (!stok_buff) {
- cgroup_err("Error: failed to parse options: %s\n",
- options);
+ cgroup_err("failed to parse options: %s\n", options);
return -EINVAL;
}
* "ignore" is the only currently supported option. raise
* an error if we get here
*/
- cgroup_err("Error: Unsupported option: %s\n", stok_buff);
+ cgroup_err("Unsupported option: %s\n", stok_buff);
ret = -EINVAL;
break;
} while ((stok_buff = strtok(NULL, ",")));
/* Open the configuration file. */
fp = fopen(filename, "re");
if (!fp) {
- cgroup_warn("Warning: failed to open configuration file %s: %s\n",
+ cgroup_warn("failed to open configuration file %s: %s\n",
filename, strerror(errno));
ret = ECGRULESPARSEFAIL; /* originally ret = 0, but */
* of it (begins with %), then we should skip this rule too.
*/
if (skipped && *itr == '%') {
- cgroup_warn("Warning: skipped child of invalid rule, ");
- cgroup_warn("line %d.\n", linenum);
+ cgroup_warn("skipped child of invalid rule, line %d.\n",
+ linenum);
continue;
}
i = sscanf(itr, "%s%s%s%s", key, controllers, destination,
options);
if (i < 3) {
- cgroup_err("Error: failed to parse configuration file");
+ cgroup_err("failed to parse configuration file");
cgroup_err(" on line %d\n", linenum);
goto parsefail;
} else if (i == 3) {
len_username = procname - key - 1;
len_procname = strlen(procname);
if (len_procname < 0) {
- cgroup_err("Error: failed to parse ");
- cgroup_err("configuration file on line %d\n",
- linenum);
+ cgroup_err("failed to parse configuration ");
+ cgroup_err("file on line %d\n", linenum);
goto parsefail;
}
} else {
uid = CGRULE_INVALID;
gid = grp->gr_gid;
} else {
- cgroup_warn("Warning: Entry for %s not found.");
- cgroup_warn(" Skipping rule on line %d.\n",
- itr, linenum);
+ cgroup_warn("Entry for %s not found.");
+ cgroup_warn(" Skipping rule on line %d.\n", itr,
+ linenum);
skipped = true;
continue;
}
uid = pwd->pw_uid;
gid = CGRULE_INVALID;
} else {
- cgroup_warn("Warning: Entry for %s not found.");
- cgroup_warn("Skipping rule on line %d.\n",
+ cgroup_warn("Entry for %s not found.");
+ cgroup_warn(" Skipping rule on line %d.\n",
user, linenum);
skipped = true;
continue;
*/
newrule = calloc(1, sizeof(struct cgroup_rule));
if (!newrule) {
- cgroup_err("Error: out of memory? Error was: %s\n",
+ cgroup_err("out of memory? Error was: %s\n",
strerror(errno));
last_errno = errno;
ret = ECGOTHER;
if (len_procname) {
newrule->procname = strdup(procname);
if (!newrule->procname) {
- cgroup_err("Error: strdup failed to allocate");
- cgroup_err(" memory %s\n", strerror(errno));
+ cgroup_err("strdup failed to allocate ");
+ cgroup_err("memory %s\n", strerror(errno));
free(newrule);
last_errno = errno;
ret = ECGOTHER;
/* Parse the controller list, and add that to newrule too. */
stok_buff = strtok(controllers, ",");
if (!stok_buff) {
- cgroup_err("Error: failed to parse controllers on ");
- cgroup_err("line %d\n", linenum);
+ cgroup_err("failed to parse controllers on line %d\n",
+ linenum);
goto destroyrule;
}
i = 0;
do {
if (i >= MAX_MNT_ELEMENTS) {
- cgroup_err("Error: too many controllers ");
- cgroup_err("listed on line %d\n", linenum);
+ cgroup_err("too many controllers listed on ");
+ cgroup_err("line %d\n", linenum);
goto destroyrule;
}
newrule->controllers[i] =
strndup(stok_buff, strlen(stok_buff) + 1);
if (!(newrule->controllers[i])) {
- cgroup_err("Error: out of memory? Error was:");
- cgroup_err(" %s\n", strerror(errno));
+ cgroup_err("out of memory? Error was: %s\n",
+ strerror(errno));
goto destroyrule;
}
i++;
/* Continue parsing */
d = opendir(dirname);
if (!d) {
- cgroup_warn("Warning: Failed to open directory %s: %s\n",
- dirname, strerror(errno));
+ cgroup_warn("Failed to open directory %s: %s\n", dirname,
+ strerror(errno));
/*
* Cannot read directory. However, CGRULES_CONF_FILE is
goto unlock_list;
}
if (!item && errno) {
- cgroup_warn("Warning: cannot read %s: %s\n",
- dirname, strerror(errno));
+ cgroup_warn("cannot read %s: %s\n", dirname,
+ strerror(errno));
/*
* Cannot read an item. But continue for
* back compatibility as a success.
proc_cgroup = fopen("/proc/cgroups", "re");
if (!proc_cgroup) {
- cgroup_err("Error: cannot open /proc/cgroups: %s\n",
- strerror(errno));
+ cgroup_err("cannot open /proc/cgroups: %s\n", strerror(errno));
last_errno = errno;
ret = ECGOTHER;
goto unlock_exit;
}
if (!fgets(buf, LL_MAX, proc_cgroup)) {
free(buf);
- cgroup_err("Error: cannot read /proc/cgroups: %s\n",
- strerror(errno));
+ cgroup_err("cannot read /proc/cgroups: %s\n", strerror(errno));
last_errno = errno;
ret = ECGOTHER;
goto unlock_exit;
proc_mount = fopen("/proc/mounts", "re");
if (proc_mount == NULL) {
- cgroup_err("Error: cannot open /proc/mounts: %s\n",
- strerror(errno));
+ cgroup_err("cannot open /proc/mounts: %s\n", strerror(errno));
last_errno = errno;
ret = ECGOTHER;
goto unlock_exit;
ret = snprintf(path, FILENAME_MAX, "%s/",
cg_cgroup_v2_mount_path);
if (ret >= FILENAME_MAX)
- cgroup_dbg("Warning: filename too long: %s/",
+ cgroup_dbg("filename too long: %s/",
cg_cgroup_v2_mount_path);
if (name) {
cg_mount_table[i].mount.path,
cg_namespace_table[i]);
if (ret >= FILENAME_MAX) {
- cgroup_dbg("Warning: filename too long");
+ cgroup_dbg("filename too long");
cgroup_dbg(":%s/%s/",
cg_mount_table[i].mount.path,
cg_namespace_table[i]);
ret = snprintf(path, FILENAME_MAX, "%s/",
cg_mount_table[i].mount.path);
if (ret >= FILENAME_MAX) {
- cgroup_dbg("Warning: filename too long");
+ cgroup_dbg("filename too long");
cgroup_dbg(":%s/",
cg_mount_table[i].mount.path);
}
snprintf(type, type_sz, "cgroup.procs");
goto out;
} else {
- cgroup_warn("Warning: failed to open file %s: %s\n",
+ cgroup_warn("failed to open file %s: %s\n",
cg_type_path, strerror(errno));
err = ECGOTHER;
goto out;
}
if (fgets(cg_type, LL_MAX, fp) == NULL) {
- cgroup_warn("Warning: failed to read file %s: %s\n",
- cg_type_path, strerror(errno));
+ cgroup_warn("failed to read file %s: %s\n", cg_type_path,
+ strerror(errno));
err = ECGOTHER;
goto out;
}
} else if (strncmp(cg_type, "threaded", len) == 0) {
snprintf(type, type_sz, "cgroup.threads");
} else {
- cgroup_warn("Warning: invalid %scgroup.type: %s\n",
- path, cg_type);
+ cgroup_warn("invalid %scgroup.type: %s\n", path, cg_type);
err = ECGOTHER;
}
fclose(tasks);
return 0;
err:
- cgroup_warn("Warning: cannot write tid %d to %s:%s\n",
- tid, path, strerror(errno));
+ cgroup_warn("cannot write tid %d to %s:%s\n", tid, path,
+ strerror(errno));
if (tasks)
fclose(tasks);
return ret;
int i, ret = 0;
if (!cgroup_initialized) {
- cgroup_warn("Warning: libcgroup is not initialized\n");
+ cgroup_warn("libcgroup is not initialized\n");
return ECGROUPNOTINITIALIZED;
}
if (!cgroup) {
for (i = 0; i < cgroup->index; i++) {
if (!cgroup_test_subsys_mounted(
cgroup->controller[i]->name)) {
- cgroup_warn("Warning: subsystem %s is not");
- cgroup_warn(" mounted\n",
+ cgroup_warn("subsystem %s is not mounted\n",
cgroup->controller[i]->name);
return ECGROUPSUBSYSNOTMOUNTED;
}
return ECGOTHER;
}
} else
- cgroup_warn("Warning: skipping empty line for %s\n",
- path);
+ cgroup_warn("skipping empty line for %s\n", path);
} while (pos);
if (close(ctl_file)) {
fp = fopen(path_copy, "re");
if (!fp) {
- cgroup_warn("Warning: fopen failed\n");
+ cgroup_warn("fopen failed\n");
last_errno = errno;
goto out;
}
for (i = 0; i < cgroup->index; i++) {
if (!cgroup_test_subsys_mounted(cgroup->controller[i]->name)) {
- cgroup_warn("Warning: subsystem %s is not mounted\n",
+ cgroup_warn("subsystem %s is not mounted\n",
cgroup->controller[i]->name);
return ECGROUPSUBSYSNOTMOUNTED;
}
if (delete_tasks) {
ret = cg_move_task_files(delete_tasks, target_tasks);
if (ret != 0) {
- cgroup_warn("Warning: removing tasks from %s ");
- cgroup_warn("failed: %s\n",
- path, cgroup_strerror(ret));
+ cgroup_warn("removing tasks from %s ");
+ cgroup_warn("failed: %s\n", path,
+ cgroup_strerror(ret));
}
fclose(delete_tasks);
} else {
* removed.
*/
if (errno != ENOENT) {
- cgroup_err("Error: cannot open %s: %s\n",
- path, strerror(errno));
+ cgroup_err("cannot open %s: %s\n", path,
+ strerror(errno));
last_errno = errno;
ret = ECGOTHER;
}
if ((flags & CGFLAG_DELETE_EMPTY_ONLY) && (errno == EBUSY))
return ECGNONEMPTY;
- cgroup_warn("Warning: cannot remove directory %s: %s\n",
- path, strerror(errno));
+ cgroup_warn("cannot remove directory %s: %s\n", path, strerror(errno));
last_errno = errno;
return ECGOTHER;
}
parent_tasks = fopen(parent_path, "we");
if (!parent_tasks) {
if (first_error == 0) {
- cgroup_warn("Warning: cannot open ");
- cgroup_warn("tasks file %s: %s\n",
+ cgroup_warn("cannot open tasks ");
+ cgroup_warn("file %s: %s\n",
parent_path, strerror(errno));
first_errno = errno;
first_error = ECGOTHER;
cptr = cgroup_add_controller(cgroup,
cg_mount_table[j].name);
if (!cptr) {
- cgroup_warn("Warning: adding controller");
- cgroup_warn("'%s' failed\n",
+ cgroup_warn("adding controller '%s' ");
+ cgroup_warn("failed\n",
cg_mount_table[j].name);
pthread_rwlock_unlock(&cg_mount_table_lock);
cgroup_free_controllers(cgroup);
cgroup_dbg("Adding controller %s\n", controller);
cptr = cgroup_add_controller(cgroup, controller);
if (!cptr) {
- cgroup_warn("Warning: adding controller '%s' failed\n",
+ cgroup_warn("adding controller '%s' failed\n",
controller);
cgroup_free_controllers(cgroup);
return ECGROUPNOTALLOWED;
/* We need to check this before doing anything else! */
if (!cgroup_initialized) {
- cgroup_warn("Warning: libcgroup is not initialized\n");
+ cgroup_warn("libcgroup is not initialized\n");
ret = ECGROUPNOTINITIALIZED;
goto finished;
}
* by reloading the rules from the configuration file.
*/
if ((flags & CGFLAG_USECACHE) && (rl.head == NULL)) {
- cgroup_warn("Warning: no cached rules found, trying to ");
- cgroup_warn("reload from %s.\n", CGRULES_CONF_FILE);
+ cgroup_warn("no cached rules found, trying to reload ");
+ cgroup_warn("from %s.\n", CGRULES_CONF_FILE);
ret = cgroup_reload_cached_rules();
if (ret != 0)
/* The configuration file has an error! We must exit now. */
if (ret != -1 && ret != 0) {
- cgroup_err("Error: failed to parse the configuration ");
+ cgroup_err("failed to parse the configuration ");
cgroup_err("rules\n");
goto finished;
}
ret = cgroup_change_cgroup_path(newdest,
pid, (const char * const *)tmp->controllers);
if (ret) {
- cgroup_warn("Warning: failed to apply the rule. ");
- cgroup_warn("Error was: %d\n", ret);
+ cgroup_warn("failed to apply the rule. Error ");
+ cgroup_warn("was: %d\n", ret);
goto finished;
}
cgroup_dbg("OK!\n");
DIR *dir;
if (!cgroup_initialized) {
- cgroup_warn("Warning: libcgroup is not initialized\n");
+ cgroup_warn("libcgroup is not initialized\n");
return ECGROUPNOTINITIALIZED;
}
memset(&cgroup, 0, sizeof(struct cgroup));
/* Add process to cgroup */
ret = cgroup_attach_task_pid(&cgroup, pid);
if (ret) {
- cgroup_warn("Warning: cgroup_attach_task_pid failed: %d\n",
- ret);
+ cgroup_warn("cgroup_attach_task_pid failed: %d\n", ret);
goto finished;
}
ret = cgroup_attach_task_pid(&cgroup, tid);
if (ret) {
- cgroup_warn("Warning: cgroup_attach_task_pid ");
- cgroup_warn("failed: %d\n", ret);
+ cgroup_warn("cgroup_attach_task_pid failed: %d\n", ret);
break;
}
}
cgroup_dbg("Reloading cached rules from %s.\n", CGRULES_CONF_FILE);
ret = cgroup_parse_rules(true, CGRULE_INVALID, CGRULE_INVALID, NULL);
if (ret) {
- cgroup_warn("Warning: error parsing configuration file ");
- cgroup_warn("'%s': %d\n", CGRULES_CONF_FILE, ret);
+ cgroup_warn("error parsing configuration file '%s': %d\n",
+ CGRULES_CONF_FILE, ret);
ret = ECGRULESPARSEFAIL;
goto finished;
}
return ECGOTHER;
if (!cgroup_initialized) {
- cgroup_warn("Warning: libcgroup is not initialized\n");
+ cgroup_warn("libcgroup is not initialized\n");
return ECGROUPNOTINITIALIZED;
}
ret = asprintf(&path, "/proc/%d/cgroup", pid);
if (ret <= 0) {
- cgroup_warn("Warning: cannot allocate memory ");
- cgroup_warn("(/proc/pid/cgroup) ret %d\n", ret);
+ cgroup_warn("cannot allocate memory (/proc/pid/cgroup) ");
+ cgroup_warn("ret %d\n", ret);
return ret;
}
* disappear :)
*/
if (ret != 3) {
- cgroup_warn("Warning: read failed for pid_cgroup_fd ");
- cgroup_warn("ret %d\n", ret);
+ cgroup_warn("read failed for pid_cgroup_fd ret %d\n",
+ ret);
last_errno = errno;
ret = ECGOTHER;
goto done;
}
ent = fts_read(entry->fts);
if (!ent) {
- cgroup_warn("Warning: fts_read failed\n");
+ cgroup_warn("fts_read failed\n");
fts_close(entry->fts);
free(entry);
*handle = NULL;
name);
fp = fopen(stat_file, "re");
if (!fp) {
- cgroup_warn("Warning: fopen failed\n");
+ cgroup_warn("fopen failed\n");
last_errno = errno;
*handle = NULL;
return ECGOTHER;
fp = fopen(stat_file, "re");
if (!fp) {
- cgroup_warn("Warning: fopen failed\n");
+ cgroup_warn("fopen failed\n");
return ECGINVAL;
}
* /proc/<pid>/status. The format has been changed
* and we should catch up the change.
*/
- cgroup_warn("Warning: invalid file format of /proc/%d/status\n",
- pid);
+ cgroup_warn("invalid file format of /proc/%d/status\n", pid);
return ECGFAIL;
}
return 0;