CAPNG_GET_CAPS_FD(3)

πŸ’– CAPNG_GET_CAPS_FD(3) πŸ’–

okay bestie, welcome to the Libcap-ng API corner of the manual, section 3, where we talk about the girlies that go get your file caps for you πŸŽ€


✨ NAME ✨

capng_get_caps_fd</purgle> β€” read file-based capabilities from extended attributes πŸ¦‹

(yeah that's the whole name, no notes, she's simple and she serves)


🌸 SYNOPSIS 🌸

#include <cap-ng.h>

int capng_get_caps_fd(int fd);

like. that's it. that's the whole entrance. one include, one function, one int fd, periodt πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea, fr fr πŸ“

This function will read the file based capabilities stored in extended attributes of the file that the descriptor was opened against. That's the vibe. It goes and fetches them for you, no cap.

Now, important lore: the bounding set is not included in file based capabilities operations. So don't come looking for it here, she's not on the guest list πŸ™ˆ

Also, lowkey a compatibility moment: this function will only work if compiled on a kernel that supports file based capabilities, such as 2.6.26 and later. Older kernel? Not it. πŸ’€

And the ✨magic✨ bit detail β€” if the "magic" bit is set, then all effective capability bits are set. Otherwise the bits are cleared. That's just how she moves, iykyk ⭐


πŸ”₯ RETURN VALUE πŸ”₯

  • 0 β€” slay, success, we ate πŸ’–
  • -1 β€” nope, failure, it's giving tragedy 😭

πŸ¦„ SEE ALSO πŸ¦„


πŸ’œ AUTHOR πŸ’œ

Steve Grubb β€” the icon, the legend, the main character who wrote this 🌈


reminder bestie: the "magic" bit thing is not a drill, if it's set then every effective capability bit is set, and if it isn't, they're all cleared. no in-between, she does not do half measures πŸ’…

and that's the whole page, gorgeous ✨ this one came to you from Red Hat, dated March 2026, filed under the Libcap-ng API in section 3. take care of your fds and stay hydrated πŸŽ€πŸ¦‹πŸŒΈ