cap_get_proc, cap_set_proc - POSIX capability manipulation on processescapgetp, capsetp - Linux specific capability manipulation on arbitrary processes
cap_t cap_get_proc(void);
int cap_set_proc(cap_t cap_p);
#undef _POSIX_SOURCE
#include <sys/capability.h>
cap_t capgetp(pid_t pid, cap_t cap_d);
cap_t capsetp(pid_t pid, cap_t cap_d);
cap_set_proc sets the values for all capability flags for all capabilities with the capability state identified by cap_p. The new capability state of the process will be completely determined by the contents of cap_p upon successful return from this function. If any flag in cap_p is set for any capability not currently permitted for the calling process, the function will fail, and the capability state of the process will remain unchanged.
capgetp fills an existing cap_d, see cap_init(3), with the process capabilities of the process indicated by pid. This information can also be obtained from the /proc/<pid>/status file.
capsetp attempts to set the capabilities of some other process(es), pid. If pid is positive it refers to a specific process; if it is zero, it refers to the current process; -1 refers to all processes other than the current process and process '1' (typically init(8)); other negative values refer to the -pid process-group. In order to use this function, the current process must have CAP_SETPCAP raised in its Effective capability set. The capabilities set in the target process(es) are those contained in cap_d.
cap_set_proc, capgetp and capsetp return zero for success, and -1 on failure.
On failure, errno(3) is set to EINVAL, EPERM, or ENOMEM.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |