---
name: "getrlimitusage"
section: "2"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/getrlimitusage"
---

# getrlimitusage(2)

Query usage of the current process' limited resources

## NAME

**getrlimitusage** – Query usage of the current process' limited resources

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/resource.h\>**

*int*\

**getrlimitusage**(*unsigned which*, *int flags*, *rlim\_t \*res*);

## DESCRIPTION

The **getrlimitusage** system call allows the process to query current consumption of the resources limited by the [setrlimit(2)](/setrlimit/2.md) call.

The *which* argument specifies the resource, same as for [getrlimit(2)](/getrlimit/2.md) and [setrlimit(2)](/setrlimit/2.md) calls, see their man page for the list of enforced resource types.

The *flags* argument modifies the behavior of the call in the following ways:

- *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).

## RETURN VALUES

The **getrlimitusage()** function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

## ERRORS

The **getrlimitusage**() system call will fail if:

- \[EFAULT\]

  The address specified for *res* is invalid.

- \[EINVAL\]

  The resource specified to **getrlimitusage**() in the *which* argument is unknown.

- \[ENXIO\]

  The resource specified to **getrlimitusage**() in the *which* argument is not accounted, but only enforced in specific situations. Examples of such resources are *RLIMIT\_FSIZE* and *RLIMIT\_CORE*.

## SEE ALSO

[procstat(1)](/procstat/1.md), [getrlimit(2)](/getrlimit/2.md), [setrlimit(2)](/setrlimit/2.md)

## HISTORY

The **getrlimitusage**() system call appeared in FreeBSD 14.2.
