ulimit(3)
๐ ulimit(3) โ the library call, not the shell thing, bestie
okay so real talk: this is ulimit(3), a library function from the Library Functions Manual, living in the Standard C library (libc, link it with -lc). It gets and sets user limits. And um. She's โจobsoleteโจ. But we're still gonna learn her, because history is iconic and also she shows up in old code like a ghost at the function party ๐ซถ
โจ NAME โจ
ulimit โ get and set user limits ๐
๐ LIBRARY ๐
Standard C library, aka libc, aka link with -lc.
๐ SYNOPSIS ๐
#include <ulimit.h>
[[deprecated]] long ulimit(int cmd, long newlimit);
she is literally marked [[deprecated]] in the header, the compiler is gonna side-eye you ๐ญ
๐ฆ DESCRIPTION ๐ฆ
โ ๏ธ Warning: this routine is obsolete. Usegetrlimit(2),setrlimit(2), andsysconf(3)instead. And if you want the shell commandulimit, go seebash(1)โ totally different girl, same name.
So the ulimit() call gets or sets some limit for the calling process. Which limit? Depends on cmd, bestie. Here are the values:
UL_GETFSIZEโ returns the limit on the size of a file, measured in units of 512 bytes ๐๏ธUL_SETFSIZEโ sets the limit on the size of a file โ๏ธ3โ (not implemented for Linux, sorry!! ๐) returns the maximum possible address of the data segment4โ (implemented, but no symbolic constant was provided, the disrespect ๐) returns the maximum number of files that the calling process can open
๐ฅ RETURN VALUE ๐ฅ
On success, ulimit() returns a nonnegative value โจ
On error, it returns -1, and errno gets set to tell you what went wrong. main character error reporting, honestly.
๐ญ ERRORS ๐ญ
EPERMโ an unprivileged process tried to increase a limit. babe you do not have the clearance for that ๐ซ
๐ ATTRIBUTES ๐
For an explanation of the terms used in this section, see attributes(7).
- Interface:
ulimit() - Attribute: Thread safety
- Value:
MT-Safe๐งตโ
(She's thread-safe, at least. Obsessed.)
โญ STANDARDS โญ
POSIX.1-2008.
๐ธ HISTORY ๐ธ
SVr4,POSIX.1-2001POSIX.1-2008marks it as obsolete ๐ชฆ
so yeah, she's a legacy legend. we stan a retired icon but we do not call her in new code, periodt.
๐ SEE ALSO ๐
and that's the whole vibe check ๐ slay, go use getrlimit(2) instead, ily, bye ๐ซถโจ
This page is from Linux man-pages 6.20, dated 2026-02-08 โ mwah, kiss the maintainers, they're doing the lord's work ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1996, Andries E. Brouwer <aeb@cwi.nl>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms