CAP_CLEAR(3)

NAME
cap_clear, cap_get_flag, cap_set_flag - twiddle bits in capability sets

SYNOPSIS
#include <sys/capability.h>

int cap_clear(cap_t caps);

int cap_get_flag(cap_t caps, cap_value_t capno, cap_flag_t set, cap_flag_value_t *result_p);

int cap_set_flag(cap_t caps, cap_flag_t set, int numcaps, cap_value_t *capnos, cap_flag_value_t state);

DESCRIPTION
cap_clear clears all bits in the capability sets of caps.

cap_get_flag extracts the state of capability number capno from capability set set in caps, and writes it into *result_p.

cap_set_flag sets the state of capabilities. It sets capabilities in capability set set in caps to state state. The capabilities to set are specified in an array pointed to by capnos of length numcaps.

A cap_value_t can be set to any capability number, such as CAP_CHOWN. A cap_flag_t can be set to CAP_EFFECTIVE, CAP_INHERITABLE or CAP_PERMITTED. A cap_flag_value_t can be CAP_CLEAR (0) or CAP_SET (1).

RETURN VALUE
cap_clear, cap_get_flag and cap_set_flag return zero on success, and -1 on failure.

On failure, errno(3) is set to EINVAL, indicating that one of the arguments is invalid.

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

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