CAPNG_SETPID(3)
π CAPNG_SETPID(3) π
okay bestie, welcome to the libcap-ng API manual, page CAPNG_SETPID(3) β this one's short, sweet, and lowkey essential if you ever need to peek at somebody else's capabilities. let's get into it π«Ά
β¨ NAME β¨
capng_setpid β set working pid π
πΈ SYNOPSIS πΈ
#include <cap-ng.h>
void capng_setpid(int pid);
π DESCRIPTION π
so capng_setpid sets the working pid for capabilities operations. it's giving "point libcap-ng at a different process" energy β¨
this is useful if you want to get the capabilities of a different process. that's the whole vibe, no cap π
π¦ NOTES π¦
okay this part matters, pay attention bestie π
if your process calls fork, then the child process will still have the pid of the parent process stored in libcap-ng's internal data. and like β it is disallowed to do any kind of setcap operations because you would be crossing process boundaries. not me warning you about boundary violations π
to correct this: if your program links against pthreads, then libcap-ng will use the pthread_atfork function (as a weak symbol) to reset the pid information to the new process automatically. slay, it just handles it for you π
but fr fr, you are not required to link against pthreads. you can just call capng_setpid and adjust the stored pid manually. your call, main character π
β RETURN VALUE β
None. that's it, that's the whole return value. nothing. void. the void is voiding π
π SEE ALSO π
πΈ AUTHOR πΈ
Steve Grubb π
okay that's the whole page bestie!! this one's from Red Hat, dated March 2026, and it lives in the libcap-ng API family β mwah, go forth and set your working pid responsibly πβ¨π¦
π¦ 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