CAP_INIT(3)

NAME
cap_init, cap_free, cap_dup - manipulate capability sets

SYNOPSIS
#include <sys/capability.h>

cap_t cap_init(void);

int cap_free(cap_t *caps_p);

cap_t cap_dup(cap_t caps);

USAGE
cc ... -lcap

DESCRIPTION
POSIX.1e capability sets are manipulated abstractly via these interfaces. A cap_t is a pointer to allocated memory, containing data maintained by the capability library, that should not be modified directly. The object represents a group of three sets of capability bits; the three sets are the Effective, Inheritable and Permitted sets.

cap_init returns a newly-allocated empty capability set. It is the caller's responsibility to eventually dispose of the capability set with cap_free, as it is with all the other functions that return a cap_t.

cap_free frees the resources associated with the capability set *caps_p, and sets *caps_p to NULL.

cap_dup returns a newly-allocated duplicate of the provided capability set.

RETURN VALUE
cap_init and cap_dup return a non-NULL value on success, and NULL on failure.

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

On failure, errno(3) is set to EINVAL, 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_get_proc(3)