From nobody Mon Oct 07 10:51:35 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 4XMbYh00lqz5Xhyf; Mon, 07 Oct 2024 10:51:36 +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 4XMbYg5TDYz4D7H; Mon, 7 Oct 2024 10:51:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728298295; 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=NrGapBFVtBn3PL0dx3aTKlkcUYaVc5ighxyLe3UJpgw=; b=MttrdoZ2WyTvRIoStF8Yd1p0/dtZc7bnpQbif5lzFJVC5NLTbFTXIlcxji5wIxtjXICAq8 bCNx+ujFiXwNvfs8rQbeXLwxpCq6kgTp0snrg+siGQx5QIAI3N+9rmbw4uocUrSwPBFbg4 f8NXH/Xiu1Stq/DsOCcGtL3CB2TvKF55+Ts/QGPQdlka3KOFlU65g1jJOE1cMG5Z+sz+gj Hy2pJJTLNFdAVckpOoT16ni5Y1CGFNDvBz269VgdPbfkNW/QYt210OhYEPc2H5htGjC/sq JzJe1f1Jy21rO+C4vrXzpCx/8NZoHsZI4V5m+tqL6ufufYqOQDAU10QifqIJEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728298295; 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=NrGapBFVtBn3PL0dx3aTKlkcUYaVc5ighxyLe3UJpgw=; b=ksnm3d7lnKVUDQWmo0iTEKJsCtOR5sAH+wqtpTkP4AsQV/H8s8nfgywrNENYVJYWLEtmbj BCQk9JHPb17nUNDU6wkeWarXSZs0JtuJj52yv400hpiZ1xF+I2yXf/ayxTxAectuMQIr1g RvwujTreOR7VmpJJn3+zeE6Gc8qF6jH6Wq3MNK99lQQDeFwuAg0Lzh5NKeZjxoGGY8ndWh 69fFpkWhWABj3JBYdRja2AwTV4KS6Vy9yKAnbajIsdocQOyvEs3KjlZiHsMreuT5y1V9oX 3ch6G7sG4MXYzaitnzECzToXVq0UX0harg5ssnw9F1uqw8lhvdq4cdsJv8ofeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728298295; a=rsa-sha256; cv=none; b=l1MPHbOfsPzouRT+GDvdGxzntNLtcPdZrnLC2nb08Ueoq4TFkXIe1w2dvEZQbeyZeBNa5b tmmpRTV85Qa5THVOy8WZfM0cCEHoYipFjXEqQ8dmF/CXqKEUuiDnkOpNRUC6F58FcCsmdO cnDwNYXbD9MLzB4GTR8zs91wIxWTg0kSCYtYWjMnCFqThoGrtzBoO0cwCtFtfYkaqfZ4Fn ymVKmc6Y3vczHNuwoqo528zHPTSO+hiokV2R3yTcZuyDccyPZESt8cB0YeaG+RSOgvAf+a KGfCsB2MMwaQyA/i7KZ+MEDr+op+qSBWza0GECrW11DM9K1j8to0dCINFtpWrg== 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 4XMbYg53D6zjfP; Mon, 7 Oct 2024 10:51:35 +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 497ApZ3V064466; Mon, 7 Oct 2024 10:51:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 497ApZK7064463; Mon, 7 Oct 2024 10:51:35 GMT (envelope-from git) Date: Mon, 7 Oct 2024 10:51:35 GMT Message-Id: <202410071051.497ApZK7064463@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3670421e2193 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3670421e21932c44225b9457c50dd67da3abcd84 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3670421e21932c44225b9457c50dd67da3abcd84 commit 3670421e21932c44225b9457c50dd67da3abcd84 Author: Konstantin Belousov AuthorDate: 2024-09-27 19:12:21 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-07 10:50:08 +0000 getrlimitusage.2: add the man page Reviewed by: olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46823 --- lib/libsys/Makefile.sys | 1 + lib/libsys/getrlimitusage.2 | 100 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index 7454f5a47720..aa7fd811d2f8 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -218,6 +218,7 @@ MAN+= abort2.2 \ getpriority.2 \ getrandom.2 \ getrlimit.2 \ + getrlimitusage.2 \ getrusage.2 \ getsid.2 \ getsockname.2 \ diff --git a/lib/libsys/getrlimitusage.2 b/lib/libsys/getrlimitusage.2 new file mode 100644 index 000000000000..2e3dc744ab23 --- /dev/null +++ b/lib/libsys/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 .