CAPNG_GET_CAPS_PROCESS(3)
π CAPNG_GET_CAPS_PROCESS(3) β the Libcap-ng API girlies know π
okay bestie, so this is a page from the Libcap-ng API (section 3 of the manual, the library-call section, iykyk) and it's literally just one tiny little function that's about to become your new obsession. sit down, grab a strawberry drink, let's go π
β¨ NAME β¨
capng_get_caps_process β get the capabilities from a process π«Ά
πΈ SYNOPSIS πΈ
#include <cap-ng.h>
int capng_get_caps_process(void);
π¦ DESCRIPTION π¦
so here's the vibe: capng_get_caps_process will get the capabilities and bounding set of the pid that's stored inside libcap-ng's state table. that's it, that's the whole job, and honestly? iconic for it π
and the default pid in that state table? it's the pid of the running process. yes girl, you β main character energy π. but lowkey if you wanna snoop on a different pid, you can totally change that by using the capng_setpid function. flexible fr fr.
β RETURN VALUE β
she keeps it simple:
0β success, we ate β¨-1β failure, and we're not talking about it π
π NOTES π
okay this is the part where you need to actually listen, bestie, because there are two whole situations that will absolutely humble you:
- if you're doing multi-threaded programming, calling this function will only get capabilities on the calling thread. that's it. just that one thread. no cap. if you want the overall capabilities for a multi-threaded process, the way that you can only do that is before creating any threads. after that point, threads may be able to independently set capabilities β so like, do it early or don't do it at all, periodt π
capng_get_caps_processneeds a mounted/procto read the current bounding set. no/proc, no bounding set, and she will just straight-up fail. sorry girl π
π¨ real talk: no mounted /proc = this function fails. not a vibe check you want to fail.
π SEE ALSO π
π AUTHOR π
Steve Grubb β we stan a legend, fr fr π«Ά
and that's the whole page, bestie!! this one comes to you from the Libcap-ng API, dropped by Red Hat back in June 2009 (yes, she's been serving since 2009 and she's still relevant, we love a timeless queen π). now go get those capabilities, you got this πβ¨
π¦ where this page comes from
- alpine 3.22: libcap-ng-doc 0.8.5-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.23: libcap-ng-doc 0.8.5-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.24: libcap-ng-doc 0.8.5-r2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- 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
- debian bookworm: libcap-ng-dev 0.8.3-1+b3 Β· LGPL-2.1-or-later
- debian trixie: libcap-ng-dev 0.8.5-4+b1 Β· LGPL-2.1-or-later
- fedora 43: libcap-ng-devel 0.8.5-8.fc43 Β· LGPL-2.0-or-later
- fedora 43: libcap-ng-devel 0.8.5-8.fc43 Β· 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
- opensuse-leap 16.0: libcap-ng-devel 0.8.5-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libcap-ng-devel 0.8.5-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libcap-ng-devel 0.8.5-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libcap-ng-devel 0.8.5-160000.3.2 Β· LGPL-2.1-or-later
- ubuntu noble: libcap-ng-dev 0.8.4-2build2 Β· LGPL-2.1-or-later
- ubuntu questing: libcap-ng-dev 0.8.5-4build2
- ubuntu resolute: libcap-ng-dev 0.8.5-4build5 Β· LGPL-2.1-or-later
- 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