vircgroup: drop @pid argument from virCgroupNew

Now it is always -1.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Pavel Hrdina 2020-10-15 17:05:17 +02:00
parent c16da281e4
commit ca7b305631
3 changed files with 9 additions and 12 deletions

View File

@ -671,15 +671,14 @@ virCgroupMakeGroup(virCgroupPtr parent,
* Returns 0 on success, -1 on error * Returns 0 on success, -1 on error
*/ */
int int
virCgroupNew(pid_t pid, virCgroupNew(const char *path,
const char *path,
int controllers, int controllers,
virCgroupPtr *group) virCgroupPtr *group)
{ {
g_autoptr(virCgroup) newGroup = NULL; g_autoptr(virCgroup) newGroup = NULL;
VIR_DEBUG("pid=%lld path=%s controllers=%d group=%p", VIR_DEBUG("path=%s controllers=%d group=%p",
(long long) pid, path, controllers, group); path, controllers, group);
*group = NULL; *group = NULL;
newGroup = g_new0(virCgroup, 1); newGroup = g_new0(virCgroup, 1);
@ -694,11 +693,11 @@ virCgroupNew(pid_t pid,
return -1; return -1;
/* ... but use /proc/cgroups to fill in the rest */ /* ... but use /proc/cgroups to fill in the rest */
if (virCgroupDetectPlacement(newGroup, pid, path) < 0) if (virCgroupDetectPlacement(newGroup, -1, path) < 0)
return -1; return -1;
/* Check that for every mounted controller, we found our placement */ /* Check that for every mounted controller, we found our placement */
if (virCgroupValidatePlacement(newGroup, pid) < 0) if (virCgroupValidatePlacement(newGroup, -1) < 0)
return -1; return -1;
if (virCgroupDetectControllers(newGroup, controllers, NULL) < 0) if (virCgroupDetectControllers(newGroup, controllers, NULL) < 0)
@ -905,7 +904,7 @@ virCgroupNewPartition(const char *path,
tmp++; tmp++;
*tmp = '\0'; *tmp = '\0';
if (virCgroupNew(-1, parentPath, controllers, &parent) < 0) if (virCgroupNew(parentPath, controllers, &parent) < 0)
return -1; return -1;
} }
@ -1118,8 +1117,7 @@ virCgroupEnableMissingControllers(char *path,
g_autoptr(virCgroup) parent = NULL; g_autoptr(virCgroup) parent = NULL;
char *offset = path; char *offset = path;
if (virCgroupNew(-1, if (virCgroupNew("/",
"/",
controllers, controllers,
&parent) < 0) &parent) < 0)
return -1; return -1;

View File

@ -110,8 +110,7 @@ int virCgroupGetValueForBlkDev(const char *str,
const char *devPath, const char *devPath,
char **value); char **value);
int virCgroupNew(pid_t pid, int virCgroupNew(const char *path,
const char *path,
int controllers, int controllers,
virCgroupPtr *group); virCgroupPtr *group);

View File

@ -1468,7 +1468,7 @@ virCgroupV1MemoryOnceInit(void)
g_autoptr(virCgroup) group = NULL; g_autoptr(virCgroup) group = NULL;
unsigned long long int mem_unlimited = 0ULL; unsigned long long int mem_unlimited = 0ULL;
if (virCgroupNew(-1, "/", -1, &group) < 0) if (virCgroupNew("/", -1, &group) < 0)
return; return;
if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY)) if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY))