From nobody Mon Feb 9 12:43:33 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=1614971729; cv=none; d=zohomail.com; s=zohoarc; b=ZmBoxbZkxtHqT/xvIJHj/IOOoiz8rQDpPiHsbGcaydzo61stLA487V7nGLazwUIU92YpVbHObnVzET9opaSqSTGo8fmDIHHOV5bCF5ovqs/jN20bRU2C2MsVj4n2TivqtP6GuntSc7AW0K2GJD1i8kBhQMIWAhuJHrwzcHXKSFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614971729; 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=3hJerjYwj/ouv3ZP2KFimG5T4Kasj8ImyOHNufWmlSA=; b=mpv3uHMCCZhketEHswlG6JKgqNg0T24NlRdn1F4M5j0zTAHjls6Bppv6UhO/N5YAtzVdUFMfk1twn70y3UrrBaiv//a/ccqHmzTKUsISpkps4F0xjZIBbCJ2pWMblEWZzRuryJ32jq14Xs30Dv9TX+zKy8kbKsFR47vrJl3qNdM= 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 1614971729422575.5129654765889; Fri, 5 Mar 2021 11:15:29 -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-467-egTqiRH2OuyGkeT0NwbCSw-1; Fri, 05 Mar 2021 14:15:24 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3033814315; Fri, 5 Mar 2021 19:15:17 +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 A349C5D9CC; Fri, 5 Mar 2021 19:15:17 +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 671B31809C8E; Fri, 5 Mar 2021 19:15:17 +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 125JECDG001697 for ; Fri, 5 Mar 2021 14:14:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA8475D6DC; Fri, 5 Mar 2021 19:14:12 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1FE845D6B1 for ; Fri, 5 Mar 2021 19:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614971726; 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=3hJerjYwj/ouv3ZP2KFimG5T4Kasj8ImyOHNufWmlSA=; b=CDX6CKDa1uxcKdz7qVtRH0QyLklZczrJkaa8SUr3H51zDlRo1ko3/y9i4Dzw1KZhtbfy2e urCieYWTDrxUGedJAjwDBKzRrEhZasJb6hOzIxrYJSz/rnonyKvXy81+wQ47nu5byeSv0l aA0oBn5cIIJobyNPbClac2zSxusvrzw= X-MC-Unique: egTqiRH2OuyGkeT0NwbCSw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 01/17] util: Document limit-related functions Date: Fri, 5 Mar 2021 20:13:48 +0100 Message-Id: <20210305191404.529903-2-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.14 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" We're going to change their behavior, so it's good to have the current one documented to serve as baseline. Signed-off-by: Andrea Bolognani --- src/util/virprocess.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 69d64e9466..9fe75d54d6 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -739,6 +739,15 @@ virProcessPrLimit(pid_t pid G_GNUC_UNUSED, #endif =20 #if WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK) +/** + * virProcessSetMaxMemLock: + * @pid: process to be changed (0 for the current process) + * @bytes: new limit (0 for no change) + * + * Sets a new limit on the amount of locked memory for a process. + * + * Returns: 0 on success, <0 on failure. + */ int virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes) { @@ -791,6 +800,15 @@ virProcessSetMaxMemLock(pid_t pid G_GNUC_UNUSED, unsig= ned long long bytes) #endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */ =20 #if WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK) +/** + * virProcessGetMaxMemLock: + * @pid: process to be queried (0 for the current process) + * @bytes: return location for the limit + * + * Obtain the current limit on the amount of locked memory for a process. + * + * Returns: 0 on success, <0 on failure. + */ int virProcessGetMaxMemLock(pid_t pid, unsigned long long *bytes) @@ -843,6 +861,16 @@ virProcessGetMaxMemLock(pid_t pid G_GNUC_UNUSED, #endif /* ! (WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */ =20 #if WITH_SETRLIMIT && defined(RLIMIT_NPROC) +/** + * virProcessSetMaxProcesses: + * @pid: process to be changed (0 for the current process) + * @procs: new limit (0 for no change) + * + * Sets a new limit on the amount of processes for the user the + * process is running as. + * + * Returns: 0 on success, <0 on failure. + */ int virProcessSetMaxProcesses(pid_t pid, unsigned int procs) { @@ -883,6 +911,15 @@ virProcessSetMaxProcesses(pid_t pid G_GNUC_UNUSED, uns= igned int procs) #endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NPROC)) */ =20 #if WITH_SETRLIMIT && defined(RLIMIT_NOFILE) +/** + * virProcessSetMaxFiles: + * @pid: process to be changed (0 for the current process) + * @files: new limit (0 for no change) + * + * Sets a new limit on the number of opened files for a process. + * + * Returns: 0 on success, <0 on failure. + */ int virProcessSetMaxFiles(pid_t pid, unsigned int files) { @@ -931,6 +968,15 @@ virProcessSetMaxFiles(pid_t pid G_GNUC_UNUSED, unsigne= d int files) #endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */ =20 #if WITH_SETRLIMIT && defined(RLIMIT_CORE) +/** + * virProcessSetMaxCoreSize: + * @pid: process to be changed (0 for the current process) + * @bytes: new limit (0 to disable core dumps) + * + * Sets a new limit on the size of core dumps for a process. + * + * Returns: 0 on success, <0 on failure. + */ int virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes) { --=20 2.26.2