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 to0on subsequent calls toexecve(2). Every single time. No cap. So don't expect it to just linger around like a situationship. π
π₯ RETURN VALUE π₯
- On success,
0is returned. slay. π - On error,
-1is returned, anderrnois set to indicate the error. π
π ERRORS π
EINVALβstateis not a valid value. Like, it wasn't0Land it wasn't1L. Pick a lane, bestie. πEPERMβ The caller'sSECBIT_KEEP_CAPS_LOCKEDflag is set (seecapabilities(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
- Copyright 2002-2015, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms