git: 27af5dad16cb - stable/14 - getrlimitusage.2: add the man page
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Oct 2024 09:11:32 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=27af5dad16cbce2b081c01a410a1449288444394 commit 27af5dad16cbce2b081c01a410a1449288444394 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-09-27 19:12:21 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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 <kib@FreeBSD.org> 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 .