GETRLIMITUSAGE(2)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

✨ getrlimitusage(2) β€” from the System Calls Manual, with main character energy πŸ’…

🌸 NAME 🌸

getrlimitusage β€” query usage of the current process' limited resources

πŸŽ€ LIBRARY πŸŽ€

Standard C Library (libc, -lc) β€” your fave, no cap πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <sys/resource.h>

int
getrlimitusage(unsigned which, int flags, rlim_t *res);

🌈 DESCRIPTION 🌈

The getrlimitusage system call lets the process query current consumption of the resources limited by the setrlimit(2) call. It's literally giving resource vibe check, fr fr ✨

The which argument specifies the resource, same as for getrlimit(2) and setrlimit(2) calls, see their man page for the list of enforced resource types. So yeah bestie, which picks the resource, and those man pages have the full roster πŸ‘‘

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 πŸ’–

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error. So like, 0 is the slay outcome; -1 means go check errno, bestie 😭

😭 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 🫢

πŸ‘‘ HISTORY πŸ‘‘

The getrlimitusage() system call appeared in FreeBSD 14.2. Periodt πŸ’…


Source/version tea: Debian πŸŽ€ β€” dated October 24, 2025. That's the whole GETRLIMITUSAGE(2) moment, bestie; go query those limits responsibly βœ¨πŸ¦‹πŸ’–

πŸ“¦ where this page comes from