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. Use getrlimit(2), setrlimit(2), and sysconf(3) instead. And if you want the shell command ulimit, go see bash(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 segment
  • 4 โ€” (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-2001
  • POSIX.1-2008 marks 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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms