PR_CAPBSET_READ(2const)

โœจ PR_CAPBSET_READ(2const) โœจ

okay bestie, pull up a chair (or like, a terminal tab) because we're talking about PR_CAPBSET_READ, a <pink>prctl(2)</pink> operation that lives in the <hotpink>2const</hotpink> pages (that (2const) is just the man-pages way of saying "this is one of the prctl constants, it's not its own syscall, don't come for me"). It's giving very niche, very powerful, very ๐Ÿ’… "I know what a capability bounding set is" energy. Let's go. ๐Ÿฆ‹


๐ŸŒธ NAME ๐ŸŒธ

PR_CAPBSET_READ โ€” read the calling thread's capability bounding set. like, literally just peek at it. no touching. reading only. ๐Ÿ‘‘


๐Ÿ“š LIBRARY ๐Ÿ“š

Standard C library (libc, -lc). the classic. the moment. nothing sketchy, nothing exotic. ๐ŸŽ€


โœจ SYNOPSIS โœจ

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

int prctl(PR_CAPBSET_READ, long cap);

yes, you call prctl() โ€” the one function, the icon โ€” and you hand it PR_CAPBSET_READ plus a long cap and it's gonna tell you things. ๐Ÿ”ฎ


๐Ÿ’– DESCRIPTION ๐Ÿ’–

so here's the tea. PR_CAPBSET_READ returns 1 if the capability you named in cap is in the calling thread's capability bounding set, or 0 if it is not. that's it. that's the whole plot. boolean moment. true or false. ate. โœ…โŒ

the capability constants you'd pass as cap are defined in <linux/capability.h> โ€” that's where you go to find the actual names, bestie, don't be out here guessing numbers. ๐Ÿ“–

and now the part that actually matters, the lore: the capability bounding set dictates whether the process can receive the capability through a file's permitted capability set on a subsequent call to execve(2). so likeโ€ฆ this set is the bouncer ๐Ÿง and execve(2) is the party. if your capability isn't on the list, it is NOT getting in through that file's permitted capability set. no cap. ๐Ÿšซ๐ŸŽŸ๏ธ


๐Ÿซถ RETURN VALUE ๐Ÿซถ

  • On success, this call returns the boolean value described above โ€” so 1 or 0, depending on whether cap is chillin' in the bounding set.
  • On error, -1 is returned, and errno is set to indicate the error. ๐Ÿ˜ญ (classic, honestly)

๐Ÿ’€ ERRORS ๐Ÿ’€

  • EINVAL โ€” cap does not specify a valid capability. you passed it something fake, babe. it's not a vibe check it can pass. ๐Ÿšฉ

๐ŸŒˆ VERSIONS ๐ŸŒˆ

there's a higher-level interface layered on top of this operation, and it's provided in the libcap(3) library in the form of cap_get_bound(3). so if you want the fancy wrapper instead of rawdogging prctl(), that's your girl. โœจ


โญ STANDARDS โญ

Linux. obviously. it's giving penguin. ๐Ÿง


๐ŸŽ€ HISTORY ๐ŸŽ€

Linux 2.6.25. an elder. a legend. still serving. ๐Ÿ‘‘


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€


fr fr reminder: this page is read-only behavior โ€” the "READ" is right there in the name. if you wanna change the bounding set instead of just looking at it, go see PR_CAPBSET_DROP(2const). ๐Ÿ’…

okay that's the whole thing, go forth and check your bounding set, you main character. ๐Ÿฆ‹๐Ÿ’–

this iconic little page came to you courtesy of Linux man-pages 6.20, dated 2026-02-08 โ€” mwah, no notes. ๐ŸŽ€โœจ

๐Ÿ“ฆ 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