From nobody Mon Feb 9 19:04:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1614971712; cv=none; d=zohomail.com; s=zohoarc; b=Dcu8H5im/6wCEAoORshhzIDcRDTrT5IH9INV8SoZdO23fdP81vHbr8HH9z0wZQtqnNy6mvUjNHa6gAdE3WP3FY5xph0Z0FA1faeCOC2gJ9oJQiAoXf2o//ddsJ53k7Hjb9QTirzE60xY1Bq4cbIUoWLJd5B3p3GdU/Bn9YMLn8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614971712; 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=sES2kbtjTpbius6hnt7uyr1VsAR9ge4hWirWR3CSGLE=; b=mqGWI4ZXqg7wrMfn19xYvxApm8f+5K0n2w8xX8gpiynKVI2eLzVmChNOdgTJRkzoryq2sxyihqnpYU/nmFWlO/PBx6UyIo9VR7aS+BzZegQM3eJje3Ak7sqcEjRc0JvZeO/Ya97CRLeoPnXopGRn5BOQ3TSWMNN3Y2VxRClXxD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614971712966936.698953007985; Fri, 5 Mar 2021 11:15:12 -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-383-M_6IiyosMeeoQu4gf338NQ-1; Fri, 05 Mar 2021 14:15:09 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AD911084D6B; Fri, 5 Mar 2021 19:15:03 +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 0560560843; Fri, 5 Mar 2021 19:15:00 +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 8744E18095C9; Fri, 5 Mar 2021 19:14:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 125JEJpS001777 for ; Fri, 5 Mar 2021 14:14:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 694765D6DC; Fri, 5 Mar 2021 19:14:19 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C1B405D6B1 for ; Fri, 5 Mar 2021 19:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614971711; 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=sES2kbtjTpbius6hnt7uyr1VsAR9ge4hWirWR3CSGLE=; b=dsutazLUMpKOyn2ZfHxH5LlHZHBkCj5nI0H+tC0SKmGyyqfqkDRSuVoaATFWqKeicMDfF3 oULBTZmfwkSp7/mY+p97x10Kf8+XlFf0lSkMwDxf0VSRxci852CTDrc8btZauOJMqtdh8L u+eh1L5nz5Z9REYhIpJBAy5ZIcsxY/M= X-MC-Unique: M_6IiyosMeeoQu4gf338NQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 07/17] util: Have virCommand remember whether limits are set Date: Fri, 5 Mar 2021 20:13:54 +0100 Message-Id: <20210305191404.529903-8-abologna@redhat.com> In-Reply-To: <20210305191404.529903-1-abologna@redhat.com> References: <20210305191404.529903-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 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" Currently this only happens for the core size, but we want the behavior to be consistent for other limits as well. Signed-off-by: Andrea Bolognani --- src/util/vircommand.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 3eef0767bb..044c5e0500 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -132,8 +132,11 @@ struct _virCommand { bool reap; bool rawStatus; =20 + bool setMaxMemLock; unsigned long long maxMemLock; + bool setMaxProcesses; unsigned int maxProcesses; + bool setMaxFiles; unsigned int maxFiles; bool setMaxCore; unsigned long long maxCore; @@ -806,11 +809,14 @@ virExec(virCommandPtr cmd) /* pidfilefd is intentionally leaked. */ } =20 - if (virProcessSetMaxMemLock(pid, cmd->maxMemLock) < 0) + if (cmd->setMaxMemLock && + virProcessSetMaxMemLock(pid, cmd->maxMemLock) < 0) goto fork_error; - if (virProcessSetMaxProcesses(pid, cmd->maxProcesses) < 0) + if (cmd->setMaxProcesses && + virProcessSetMaxProcesses(pid, cmd->maxProcesses) < 0) goto fork_error; - if (virProcessSetMaxFiles(pid, cmd->maxFiles) < 0) + if (cmd->setMaxFiles && + virProcessSetMaxFiles(pid, cmd->maxFiles) < 0) goto fork_error; if (cmd->setMaxCore && virProcessSetMaxCoreSize(pid, cmd->maxCore) < 0) @@ -1149,6 +1155,7 @@ virCommandSetMaxMemLock(virCommandPtr cmd, unsigned l= ong long bytes) return; =20 cmd->maxMemLock =3D bytes; + cmd->setMaxMemLock =3D true; } =20 void @@ -1158,6 +1165,7 @@ virCommandSetMaxProcesses(virCommandPtr cmd, unsigned= int procs) return; =20 cmd->maxProcesses =3D procs; + cmd->setMaxProcesses =3D true; } =20 void @@ -1167,6 +1175,7 @@ virCommandSetMaxFiles(virCommandPtr cmd, unsigned int= files) return; =20 cmd->maxFiles =3D files; + cmd->setMaxFiles =3D true; } =20 void virCommandSetMaxCoreSize(virCommandPtr cmd, unsigned long long bytes) --=20 2.26.2