From nobody Mon Feb 9 18:18:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1614971735; cv=none; d=zohomail.com; s=zohoarc; b=YuePuJE/a8upkMdfvtWMoPSYAkrKHYyUsU0sfXSXmF5BMmFuaKYNVIHx5fJehRu89IWnuakjLPBPpyzcdsk+AOzpJDFqbvHIImaUoT+/Q2foLJij/gTgZzynlGWSVbYHdb7hJbgLX5S3Tj0R6+GanSttj7g67erVuwI9L7tku7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614971735; 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=kl9zme2xMWg5QXfzPH5l5t1Hw7ZAVmPM1eSoWaUa/kI=; b=C0oU5Z0j2wsvEiu/pUmo9RtJKbcR5SdWHBxHmgbabq6wR8uhn1Ps8nzQ03n0sFP2VcHDjk0lCqXVS5vQaxbmLrp0vsVVdtjzAmH+r00JZ3okKqJxxkUVnaClYefpu7t3U8wyC0OlRCwOCB6NMnexvFSIUu+46c+u7jP7GOseS9s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1614971735411407.8528305771516; Fri, 5 Mar 2021 11:15:35 -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-24-9-GlHNzeMgqKFkvoQ8RqoA-1; Fri, 05 Mar 2021 14:15:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94AB61084D72; Fri, 5 Mar 2021 19:15:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 707DF5C1C2; Fri, 5 Mar 2021 19:15:23 +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 355D457DC7; Fri, 5 Mar 2021 19:15:23 +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 125JELKv001808 for ; Fri, 5 Mar 2021 14:14:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7EEF85D6DC; Fri, 5 Mar 2021 19:14:21 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4D8A5D6B1 for ; Fri, 5 Mar 2021 19:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614971734; 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=kl9zme2xMWg5QXfzPH5l5t1Hw7ZAVmPM1eSoWaUa/kI=; b=J+UKkol39thaG7+ANIpsjRTsL5tQAt2oCPTfK6QFZljFYyQpwEoBp9Rm6G2XZta3qsixeA Ejx4+LF0GHuPOQqgf2WwW63G7+ZpmHlDQaYhVfGUDIMI+1LM5yrbvCPkePSJL7Anuh/5x8 jqxAhaisWY1tRDP00/RW5RzZYab17tQ= X-MC-Unique: 9-GlHNzeMgqKFkvoQ8RqoA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 09/17] util: Don't special-case setting a limit to zero Date: Fri, 5 Mar 2021 20:13:56 +0100 Message-Id: <20210305191404.529903-10-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.16 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" This behavior reflects the needs of the QEMU driver and has no place in a generic module such as virProcess. Thanks to the changes made with the previous commit, it is now safe to remove these checks and make all virProcessSetMax*() functions finally behave the same way. Signed-off-by: Andrea Bolognani --- src/util/virprocess.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 38b248217e..abce522bf3 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -798,7 +798,7 @@ virProcessSetLimit(pid_t pid, /** * virProcessSetMaxMemLock: * @pid: process to be changed - * @bytes: new limit (0 for no change) + * @bytes: new limit * * Sets a new limit on the amount of locked memory for a process. * @@ -809,9 +809,6 @@ virProcessSetMaxMemLock(pid_t pid, unsigned long long b= ytes) { struct rlimit rlim; =20 - if (bytes =3D=3D 0) - return 0; - /* We use VIR_DOMAIN_MEMORY_PARAM_UNLIMITED internally to represent * unlimited memory amounts, but setrlimit() and prlimit() use * RLIM_INFINITY for the same purpose, so we need to translate between @@ -898,7 +895,7 @@ virProcessGetMaxMemLock(pid_t pid G_GNUC_UNUSED, /** * virProcessSetMaxProcesses: * @pid: process to be changed - * @procs: new limit (0 for no change) + * @procs: new limit * * Sets a new limit on the amount of processes for the user the * process is running as. @@ -910,9 +907,6 @@ virProcessSetMaxProcesses(pid_t pid, unsigned int procs) { struct rlimit rlim; =20 - if (procs =3D=3D 0) - return 0; - rlim.rlim_cur =3D rlim.rlim_max =3D procs; =20 if (virProcessSetLimit(pid, RLIMIT_NPROC, &rlim) < 0) { @@ -938,7 +932,7 @@ virProcessSetMaxProcesses(pid_t pid G_GNUC_UNUSED, /** * virProcessSetMaxFiles: * @pid: process to be changed - * @files: new limit (0 for no change) + * @files: new limit * * Sets a new limit on the number of opened files for a process. * @@ -949,9 +943,6 @@ virProcessSetMaxFiles(pid_t pid, unsigned int files) { struct rlimit rlim; =20 - if (files =3D=3D 0) - return 0; - /* Max number of opened files is one greater than actual limit. See * man setrlimit. * --=20 2.26.2