From nobody Sun Feb 8 18:39:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604407350; cv=none; d=zohomail.com; s=zohoarc; b=ffsC4RlezlXuQtj1d2PUGXfJCpINqIZweihKH9+1zXi+NwiGhirbdEvt6/9J2QWEVQJKeH+jipnMQDuVU4qve8jA1lvShUb1ZgiWisPFPbkhG3opYhHaZgjWLDJKOvaoSC3RPLMX3PaB/UrCptDNsjp2jnOm9f4g6w+DvnZel3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604407350; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Gjy2ZLintx0NKU0mgI1teJBeUnJJnLkwo5qOIXxlFGs=; b=EfvCDNbTVeOZ9pTwdqXLVYY11M0FYfRgIcAMG/DExmCDf7WtNMFpER5lM7F2X/3YD9yVcicif5KblFpl6Sqg4BZ73/T/UcUkaGnpI1R1Vg9Dp6j7sHYZdt3izwd48jsFveLF4qG32uZIhdYB/mrgiqSRb3B1+KZlNXWeU4FEyRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604407350072204.37634471162607; Tue, 3 Nov 2020 04:42:30 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-WQ-5NrwGP8elyeqipdYmrA-1; Tue, 03 Nov 2020 07:42:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A1E8100963E; Tue, 3 Nov 2020 12:42:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AEA375129; Tue, 3 Nov 2020 12:42:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F412F181A884; Tue, 3 Nov 2020 12:42:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3Cg3tc016268 for ; Tue, 3 Nov 2020 07:42:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id D5F021C4; Tue, 3 Nov 2020 12:42:02 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.192.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50A5B7366C for ; Tue, 3 Nov 2020 12:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604407348; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Gjy2ZLintx0NKU0mgI1teJBeUnJJnLkwo5qOIXxlFGs=; b=g5ZyEv+E5cXACblQBQ6enQd5/WkyzkaX/hOgRcOEQd6OyD5JdkYf+SkcEMAVOo32MDmUgA Qso9EJ9YK407EUafxG5+ycaZ5MJTKJ/q6/IGwF1qyLxjPuI2iPxoqSSgng3opBlg4K0pgP bSE5kFcxc7LGsEaF7ukPMZAJVGkZPRk= X-MC-Unique: WQ-5NrwGP8elyeqipdYmrA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 19/25] vircgroup: drop @pid argument from virCgroupNew Date: Tue, 3 Nov 2020 13:41:31 +0100 Message-Id: <3e9d5d231c7888a1e3963a26cadcf2c76636d5dd.1604407065.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now it is always -1. Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 16 +++++++--------- src/util/vircgrouppriv.h | 3 +-- src/util/vircgroupv1.c | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 2c1d6f9f01..6a34eb4037 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -671,15 +671,14 @@ virCgroupMakeGroup(virCgroupPtr parent, * Returns 0 on success, -1 on error */ int -virCgroupNew(pid_t pid, - const char *path, +virCgroupNew(const char *path, int controllers, virCgroupPtr *group) { g_autoptr(virCgroup) newGroup =3D NULL; =20 - VIR_DEBUG("pid=3D%lld path=3D%s controllers=3D%d group=3D%p", - (long long) pid, path, controllers, group); + VIR_DEBUG("path=3D%s controllers=3D%d group=3D%p", + path, controllers, group); =20 *group =3D NULL; newGroup =3D g_new0(virCgroup, 1); @@ -694,11 +693,11 @@ virCgroupNew(pid_t pid, return -1; =20 /* ... but use /proc/cgroups to fill in the rest */ - if (virCgroupDetectPlacement(newGroup, pid, path) < 0) + if (virCgroupDetectPlacement(newGroup, -1, path) < 0) return -1; =20 /* Check that for every mounted controller, we found our placement */ - if (virCgroupValidatePlacement(newGroup, pid) < 0) + if (virCgroupValidatePlacement(newGroup, -1) < 0) return -1; =20 if (virCgroupDetectControllers(newGroup, controllers, NULL) < 0) @@ -905,7 +904,7 @@ virCgroupNewPartition(const char *path, tmp++; *tmp =3D '\0'; =20 - if (virCgroupNew(-1, parentPath, controllers, &parent) < 0) + if (virCgroupNew(parentPath, controllers, &parent) < 0) return -1; } =20 @@ -1118,8 +1117,7 @@ virCgroupEnableMissingControllers(char *path, g_autoptr(virCgroup) parent =3D NULL; char *offset =3D path; =20 - if (virCgroupNew(-1, - "/", + if (virCgroupNew("/", controllers, &parent) < 0) return -1; diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h index 0ac62882a5..7248bc1d35 100644 --- a/src/util/vircgrouppriv.h +++ b/src/util/vircgrouppriv.h @@ -110,8 +110,7 @@ int virCgroupGetValueForBlkDev(const char *str, const char *devPath, char **value); =20 -int virCgroupNew(pid_t pid, - const char *path, +int virCgroupNew(const char *path, int controllers, virCgroupPtr *group); =20 diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index b3e0f733b9..98b5aa047d 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1468,7 +1468,7 @@ virCgroupV1MemoryOnceInit(void) g_autoptr(virCgroup) group =3D NULL; unsigned long long int mem_unlimited =3D 0ULL; =20 - if (virCgroupNew(-1, "/", -1, &group) < 0) + if (virCgroupNew("/", -1, &group) < 0) return; =20 if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY)) --=20 2.26.2