mirror of
https://github.com/systemd/systemd.git
synced 2024-12-28 11:21:59 +03:00
cgroup-util: use string_hash_ops_free
This commit is contained in:
parent
dccdbf9b35
commit
594c383554
@ -2001,7 +2001,7 @@ int cg_mask_supported(CGroupMask *ret) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cg_kernel_controllers(Set **ret) {
|
int cg_kernel_controllers(Set **ret) {
|
||||||
_cleanup_set_free_free_ Set *controllers = NULL;
|
_cleanup_set_free_ Set *controllers = NULL;
|
||||||
_cleanup_fclose_ FILE *f = NULL;
|
_cleanup_fclose_ FILE *f = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -2011,10 +2011,6 @@ int cg_kernel_controllers(Set **ret) {
|
|||||||
* and controllers that aren't currently accessible (because not mounted). This does not include "name="
|
* and controllers that aren't currently accessible (because not mounted). This does not include "name="
|
||||||
* pseudo-controllers. */
|
* pseudo-controllers. */
|
||||||
|
|
||||||
controllers = set_new(&string_hash_ops);
|
|
||||||
if (!controllers)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
r = fopen_unlocked("/proc/cgroups", "re", &f);
|
r = fopen_unlocked("/proc/cgroups", "re", &f);
|
||||||
if (r == -ENOENT) {
|
if (r == -ENOENT) {
|
||||||
*ret = NULL;
|
*ret = NULL;
|
||||||
@ -2048,7 +2044,7 @@ int cg_kernel_controllers(Set **ret) {
|
|||||||
if (!cg_controller_is_valid(controller))
|
if (!cg_controller_is_valid(controller))
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
|
|
||||||
r = set_consume(controllers, TAKE_PTR(controller));
|
r = set_ensure_consume(&controllers, &string_hash_ops_free, TAKE_PTR(controller));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ static int mount_legacy_cgns_unsupported(
|
|||||||
uid_t uid_range,
|
uid_t uid_range,
|
||||||
const char *selinux_apifs_context) {
|
const char *selinux_apifs_context) {
|
||||||
|
|
||||||
_cleanup_set_free_free_ Set *controllers = NULL;
|
_cleanup_set_free_ Set *controllers = NULL;
|
||||||
const char *cgroup_root;
|
const char *cgroup_root;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ static int symlink_controller(const char *target, const char *alias) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int mount_cgroup_controllers(void) {
|
int mount_cgroup_controllers(void) {
|
||||||
_cleanup_set_free_free_ Set *controllers = NULL;
|
_cleanup_set_free_ Set *controllers = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!cg_is_legacy_wanted())
|
if (!cg_is_legacy_wanted())
|
||||||
|
Loading…
Reference in New Issue
Block a user