CAP_GET_PROC(3)

NAME
cap_get_proc, cap_set_proc - capability manipulation on processes

SYNOPSIS
#include <sys/capability.h>

cap_t cap_get_proc(void);

int cap_set_proc(cap_t cap_p);

USAGE
cc ... -lcap

DESCRIPTION
cap_get_proc allocates a capability state in working storage, sets its state to that of the calling process, and returns a pointer to this newly created capability state. The caller should free any releasable memory, when the capability state in working storage is no longer required, by calling cap_free with the cap_t as an argument.

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.

RETURN VALUE
cap_get_proc returns a non-NULL value on success, and NULL on failure.

cap_set_proc returns zero on success, and -1 on failure.

On failure, errno(3) is set to EINVAL, EPERM, or ENOMEM.

CONFORMING TO
These functions are specified by POSIX.1e.

SEE ALSO
cap_clear(3), cap_copy_ext(3), cap_from_text(3), cap_get_file(3), cap_init(3)