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 π¦
capng_apply_caps_fd(3)β the sister function, go say hi π«Άcapabilities(7)β the deep lore, mandatory reading honestly π
π 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 ππ¦πΈ
π¦ where this page comes from
- arch rolling: libcap-ng 0.9.6-1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: libcap-ng-devel 0.9.3-2.el10 Β· LGPL-2.0-or-later
- fedora 43: libcap-ng-devel 0.9.6-1.fc43 Β· LGPL-2.0-or-later
- fedora 43: libcap-ng-devel 0.9.6-1.fc43 Β· LGPL-2.0-or-later
- fedora 44: libcap-ng-devel 0.9.2-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: libcap-ng-devel 0.9.2-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: libcap-ng-devel 0.9.6-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: libcap-ng-devel 0.9.6-1.fc44 Β· LGPL-2.0-or-later
- nixos 26.05: libcap-ng 0.9.3
- nixpkgs unstable: libcap-ng 0.9.6
- ubuntu stonking: libcap-ng-dev 0.9.6-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms