xref: /freebsd/lib/libsys/getrlimitusage.2 (revision dab59af3bcc7cb7ba01569d3044894b3e860ad56)
1*dab59af3SLi-Wen Hsu.\" Copyright (c) 2024 The FreeBSD Foundation
23670421eSKonstantin Belousov.\"
33670421eSKonstantin Belousov.\" This documentation was written by
43670421eSKonstantin Belousov.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
53670421eSKonstantin Belousov.\" from the FreeBSD Foundation.
63670421eSKonstantin Belousov.\"
73670421eSKonstantin Belousov.\" Redistribution and use in source and binary forms, with or without
83670421eSKonstantin Belousov.\" modification, are permitted provided that the following conditions
93670421eSKonstantin Belousov.\" are met:
103670421eSKonstantin Belousov.\" 1. Redistributions of source code must retain the above copyright
113670421eSKonstantin Belousov.\"    notice, this list of conditions and the following disclaimer.
123670421eSKonstantin Belousov.\" 2. Redistributions in binary form must reproduce the above copyright
133670421eSKonstantin Belousov.\"    notice, this list of conditions and the following disclaimer in the
143670421eSKonstantin Belousov.\"    documentation and/or other materials provided with the distribution.
153670421eSKonstantin Belousov.\"
163670421eSKonstantin Belousov.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
173670421eSKonstantin Belousov.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
183670421eSKonstantin Belousov.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
193670421eSKonstantin Belousov.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
203670421eSKonstantin Belousov.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
213670421eSKonstantin Belousov.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
223670421eSKonstantin Belousov.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
233670421eSKonstantin Belousov.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
243670421eSKonstantin Belousov.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
253670421eSKonstantin Belousov.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
263670421eSKonstantin Belousov.\" SUCH DAMAGE.
273670421eSKonstantin Belousov.\"
283670421eSKonstantin Belousov.Dd September 27, 2024
293670421eSKonstantin Belousov.Dt GETRLIMITUSAGE 2
303670421eSKonstantin Belousov.Os
313670421eSKonstantin Belousov.Sh NAME
323670421eSKonstantin Belousov.Nm getrlimitusage
333670421eSKonstantin Belousov.Nd Query usage of the current process' limited resources
343670421eSKonstantin Belousov.Sh LIBRARY
353670421eSKonstantin Belousov.Lb libc
363670421eSKonstantin Belousov.Sh SYNOPSIS
373670421eSKonstantin Belousov.In sys/resource.h
383670421eSKonstantin Belousov.Ft int
393670421eSKonstantin Belousov.Fn getrlimitusage "unsigned which" "int flags" "rlim_t *res"
403670421eSKonstantin Belousov.Sh DESCRIPTION
413670421eSKonstantin BelousovThe
423670421eSKonstantin Belousov.Nm
433670421eSKonstantin Belousovsystem call allows the process to query current consumption of the resources
443670421eSKonstantin Belousovlimited by the
453670421eSKonstantin Belousov.Xr setrlimit 2
463670421eSKonstantin Belousovcall.
473670421eSKonstantin Belousov.Pp
483670421eSKonstantin BelousovThe
493670421eSKonstantin Belousov.Fa which
503670421eSKonstantin Belousovargument specifies the resource, same as for
513670421eSKonstantin Belousov.Xr getrlimit 2
523670421eSKonstantin Belousovand
533670421eSKonstantin Belousov.Xr setrlimit 2
543670421eSKonstantin Belousovcalls, see their man page for the list of enforced resource types.
553670421eSKonstantin Belousov.Pp
563670421eSKonstantin BelousovThe
573670421eSKonstantin Belousov.Fa flags
583670421eSKonstantin Belousovargument modifies the behavior of the call in the following ways:
593670421eSKonstantin Belousov.Bl -tag -width GETRLIMITUSAGE_XXXXXX
603670421eSKonstantin Belousov.It Va GETRLIMITUSAGE_EUID
613670421eSKonstantin BelousovQuery the resource usage for user identified by effective UID of the process,
623670421eSKonstantin Belousovinstead of the real UID (which is default for accounting).
633670421eSKonstantin Belousov.El
643670421eSKonstantin Belousov.Sh RETURN VALUES
653670421eSKonstantin Belousov.Rv -std
663670421eSKonstantin Belousov.Sh ERRORS
673670421eSKonstantin BelousovThe
683670421eSKonstantin Belousov.Fn getrlimitusage
693670421eSKonstantin Belousovsystem call will fail if:
703670421eSKonstantin Belousov.Bl -tag -width Er
713670421eSKonstantin Belousov.It Bq Er EFAULT
723670421eSKonstantin BelousovThe address specified for
733670421eSKonstantin Belousov.Fa res
743670421eSKonstantin Belousovis invalid.
753670421eSKonstantin Belousov.It Bq Er EINVAL
763670421eSKonstantin BelousovThe resource specified to
773670421eSKonstantin Belousov.Fn getrlimitusage
783670421eSKonstantin Belousovin the
793670421eSKonstantin Belousov.Fa which
803670421eSKonstantin Belousovargument is unknown.
813670421eSKonstantin Belousov.It Bq Er ENXIO
823670421eSKonstantin BelousovThe resource specified to
833670421eSKonstantin Belousov.Fn getrlimitusage
843670421eSKonstantin Belousovin the
853670421eSKonstantin Belousov.Fa which
863670421eSKonstantin Belousovargument is not accounted, but only enforced in specific situations.
873670421eSKonstantin BelousovExamples of such resources are
883670421eSKonstantin Belousov.Va RLIMIT_FSIZE
893670421eSKonstantin Belousovand
903670421eSKonstantin Belousov.Va RLIMIT_CORE .
913670421eSKonstantin Belousov.El
923670421eSKonstantin Belousov.Sh SEE ALSO
933670421eSKonstantin Belousov.Xr procstat 1 ,
943670421eSKonstantin Belousov.Xr getrlimit 2 ,
956e1fc011SGraham Percival.Xr setrlimit 2
963670421eSKonstantin Belousov.Sh HISTORY
973670421eSKonstantin BelousovThe
983670421eSKonstantin Belousov.Fn getrlimitusage
993670421eSKonstantin Belousovsystem call appeared in
1003670421eSKonstantin Belousov.Bx 15.0 .
101