From nobody Thu Oct 10 09:11:32 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XPPBr5hnjz5YjHc; Thu, 10 Oct 2024 09:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XPPBr4mqgz4mV5; Thu, 10 Oct 2024 09:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728551492; h=from:from: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; bh=pGsuLxWwVqM2q7wc1N3u5cCvlmfzV3UJNNdAYrMCgmo=; b=SMZp8k6FtYYVBdckpQeKaD3Rxgt5HkXqr5cGRWzznw4EQFxXYzaqz/m4ORtOwBHOthLcYe So5U8mIjx8b6tKUf/AY1oG7aBtQL/mplirJcegIOW1JJYPjI2VhZDPjoNCgBNJIPIISZqg kZBLj8tvjByaek4ncuqVIcu5LO8KPC/FpodVps6atXmnQzCeey+CAl+lYgFjSflhYBaFHs G9NCnKwse/kpdkoo/752H+Si0ldmYJQZszpcWdiU2+6NXrs1B9uj3HLMsSbsr+9gyYx/qK /qnG4aVbUjnYKS6B0phHvUi2khW5Oxvk6VVhJh6Q3VjTFCeR7gmPjKuSFB98xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728551492; h=from:from: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; bh=pGsuLxWwVqM2q7wc1N3u5cCvlmfzV3UJNNdAYrMCgmo=; b=h8INrlrtS/dCznTAMEoXvB4g9AJD1PlylqJFWh6EEvWdb7fH347LP4AQTXgGqooavdjSSz tYgjx4giehLShH1jWbM5WXgFSpUayYAEV5d4CtryIovp9ZhyCws/aFWHyN7EGwQ+MsMLYT dPbaJzlwrA5AUd0cl1Act0f9Bal8CyiSn+Zmube1MOukDyj5oIYkR7Zd+Dh75DeCSu23o7 lR2kkV7BgHV4QZDcrfeZk160i23C3wNKLWZZd3dYF8iMbHbW3au3/jdtN8QzA5uLPvRmjC J+gfmIBaHVFjwIFqqWVPA55/Ebs/VjffCYWV8v6Rv8Ksmg9OEKYTEtMoToUKZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728551492; a=rsa-sha256; cv=none; b=BSIoSUc00+4+FByK+VKX03Sm970TyDLE93gRGZRMDZ9/h29SilkXo9kJkwsQPy2LrdxJH3 t+JxCmVMlDQFhVWj+sgGvhoMR3H0oQaDxOvzvgu0GDwN0jvIUACB7TLvGHVtfqk0YhPpqh j2Dc+fmmAuVgO7ts8Zp6kzLb1lkwFJfcJCbAuCVsm4xs9ZSmrIlfVid1y8css1+FKW1me8 dXEudG4xfKUTXHfR6CeuVrXYfgDSzx/uomdRSGoyBllrJ8RW+Sv4cpISBAK1W8hpXqWnG2 hB5BR4wEIvNH+T9fhodlMvQgEqCS9p1U+w2GTrPQs7aRrKShFIZSUCkE0E7a1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XPPBr4McLzrYd; Thu, 10 Oct 2024 09:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49A9BWqO064071; Thu, 10 Oct 2024 09:11:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49A9BWYW064068; Thu, 10 Oct 2024 09:11:32 GMT (envelope-from git) Date: Thu, 10 Oct 2024 09:11:32 GMT Message-Id: <202410100911.49A9BWYW064068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 27af5dad16cb - stable/14 - getrlimitusage.2: add the man page List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 27af5dad16cbce2b081c01a410a1449288444394 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=27af5dad16cbce2b081c01a410a1449288444394 commit 27af5dad16cbce2b081c01a410a1449288444394 Author: Konstantin Belousov AuthorDate: 2024-09-27 19:12:21 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-10 09:10:33 +0000 getrlimitusage.2: add the man page (cherry picked from commit 3670421e21932c44225b9457c50dd67da3abcd84) --- lib/libc/sys/Makefile.inc | 1 + lib/libc/sys/getrlimitusage.2 | 100 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 4e3ac43b2b80..33c0b9711d46 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -216,6 +216,7 @@ MAN+= abort2.2 \ getpriority.2 \ getrandom.2 \ getrlimit.2 \ + getrlimitusage.2 \ getrusage.2 \ getsid.2 \ getsockname.2 \ diff --git a/lib/libc/sys/getrlimitusage.2 b/lib/libc/sys/getrlimitusage.2 new file mode 100644 index 000000000000..2e3dc744ab23 --- /dev/null +++ b/lib/libc/sys/getrlimitusage.2 @@ -0,0 +1,100 @@ +.\" Copyright (c) 2024 The FreeBSD Foundation, Inc. +.\" +.\" This documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 27, 2024 +.Dt GETRLIMITUSAGE 2 +.Os +.Sh NAME +.Nm getrlimitusage +.Nd Query usage of the current process' limited resources +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/resource.h +.Ft int +.Fn getrlimitusage "unsigned which" "int flags" "rlim_t *res" +.Sh DESCRIPTION +The +.Nm +system call allows the process to query current consumption of the resources +limited by the +.Xr setrlimit 2 +call. +.Pp +The +.Fa which +argument specifies the resource, same as for +.Xr getrlimit 2 +and +.Xr setrlimit 2 +calls, see their man page for the list of enforced resource types. +.Pp +The +.Fa flags +argument modifies the behavior of the call in the following ways: +.Bl -tag -width GETRLIMITUSAGE_XXXXXX +.It Va GETRLIMITUSAGE_EUID +Query the resource usage for user identified by effective UID of the process, +instead of the real UID (which is default for accounting). +.El +.Sh RETURN VALUES +.Rv -std +.Sh ERRORS +The +.Fn getrlimitusage +system call will fail if: +.Bl -tag -width Er +.It Bq Er EFAULT +The address specified for +.Fa res +is invalid. +.It Bq Er EINVAL +The resource specified to +.Fn getrlimitusage +in the +.Fa which +argument is unknown. +.It Bq Er ENXIO +The resource specified to +.Fn getrlimitusage +in the +.Fa which +argument is not accounted, but only enforced in specific situations. +Examples of such resources are +.Va RLIMIT_FSIZE +and +.Va RLIMIT_CORE . +.El +.Sh SEE ALSO +.Xr procstat 1 , +.Xr getrlimit 2 , +.Xr setrlimit 2 . +.Sh HISTORY +The +.Fn getrlimitusage +system call appeared in +.Bx 15.0 .