1CAP_INIT(3)                Linux Programmer's Manual               CAP_INIT(3)
2
3
4

NAME

6       cap_init, cap_free, cap_dup - capability data object storage management
7

SYNOPSIS

9       #include <sys/capability.h>
10
11       cap_t cap_init(void);
12
13       int cap_free(void *obj_d);
14
15       cap_t cap_dup(cap_t cap_p);
16

USAGE

18       cc ... -lcap
19

DESCRIPTION

21       The  capabilities  associated  with  a file or process are never edited
22       directly.  Instead, working storage is allocated to contain a represen‐
23       tation  of  the  capability state.  Capabilities are edited and manipu‐
24       lated only within this working storage area.  Once editing of the capa‐
25       bility  state  is  complete,  the  updated  capability state is used to
26       replace the capability state associated with the file or process.
27
28       cap_init creates a capability state in working  storage  and  return  a
29       pointer  to  the  capability state.  The initial value of all flags are
30       cleared.  The caller should free any releasable memory, when the  capa‐
31       bility  state  in  working  storage  is  no longer required, by calling
32       cap_free with the cap_t as an argument.
33
34       cap_free liberates any releasable memory that has been allocated to the
35       capability  state identified by obj_d.  The obj_d argument may identify
36       either a cap_t entity, or a char * entity allocated by the  cap_to_text
37       function.
38
39       cap_dup  returns  a duplicate capability state in working storage given
40       by the source  object  cap_p,  allocating  any  memory  necessary,  and
41       returning a pointer to the newly created capability state.  Once dupli‐
42       cated, no operation on either capability state affects the other in any
43       way.
44

RETURN VALUE

46       cap_init  and  cap_dup  return a non-NULL value on success, and NULL on
47       failure.
48
49       cap_free returns zero on success, and -1 on failure.
50
51       On failure, errno(3) is set to EINVAL, or ENOMEM.
52

CONFORMING TO

54       These functions are specified by POSIX.1e.
55

SEE ALSO

57       cap_clear(3),   cap_copy_ext(3),   cap_from_text(3),   cap_get_file(3),
58       cap_get_proc(3)
59
60
61
62                                 26th May 1997                     CAP_INIT(3)
Impressum