PR_SET_KEEPCAPS(2const)

πŸ’– PR_SET_KEEPCAPS πŸ’–

okay bestie, so this is a <pink>2const</pink> page β€” aka a little slice of the prctl(2) universe, not a whole syscall of its own. It lives under the manual name PR_SET_KEEPCAPS, and honestly? It's giving "one job, does it well." πŸŽ€


✨ NAME ✨

PR_SET_KEEPCAPS β€” set the state of the "keep capabilities" flag πŸ’…


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) 🫢


🌸 SYNOPSIS 🌸

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(PR_SET_KEEPCAPS, long state);

πŸ¦‹ DESCRIPTION πŸ¦‹

So what are we actually doing here? You're setting the state of the calling thread's "keep capabilities" flag. That's the flag, yes, that specific one. πŸ™ˆ

The whole effect of this flag? That's not explained here, bestie β€” it lives over in capabilities(7), so go read that if you want the lore. πŸ“–βœ¨

And state? It has to be exactly one of these two, no in-between, no vibes-based middle ground:

  • 0L β€” clear the flag 🚫
  • 1L β€” set the flag βœ…
Heads up fr fr: the "keep capabilities" value gets reset to 0 on subsequent calls to execve(2). Every single time. No cap. So don't expect it to just linger around like a situationship. πŸ’€

πŸ”₯ RETURN VALUE πŸ”₯

  • On success, 0 is returned. slay. πŸ‘‘
  • On error, -1 is returned, and errno is set to indicate the error. 😭

πŸ’€ ERRORS πŸ’€

  • EINVAL β€” state is not a valid value. Like, it wasn't 0L and it wasn't 1L. Pick a lane, bestie. πŸ™ˆ
  • EPERM β€” The caller's SECBIT_KEEP_CAPS_LOCKED flag is set (see capabilities(7)). You're locked out, the door is bolted, respectfully, no. πŸšͺπŸ”’

⭐ STANDARDS ⭐

Linux. Just Linux. That's the whole vibe. 🐧


πŸ•°οΈ HISTORY πŸ•°οΈ

Linux 2.2.18 β€” a true elder, been iconic since day one. πŸ’œ


🌈 SEE ALSO 🌈

(yes, the getter exists. they're a matching set. iykyk 🫢)


okay that's the whole page!! mwah πŸ’‹ this one came from Linux man-pages 6.20, dated 2026-02-08, and it was PR_SET_KEEPCAPS(2const) the entire time. go keep some capabilities (or don't!) β€” either way, you ate. βœ¨πŸ’…πŸŽ€

πŸ“¦ 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