1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
.\"
.\" $Id: cap_get_proc.3,v 1.1.1.1.4.2 2001/01/15 00:37:49 agmorgan Exp $
.\"
.TH CAP_GET_PROC 3 "14th Jan 2001" "" "Linux Programmer's Manual"
.SH NAME
cap_get_proc, cap_set_proc \- POSIX capability manipulation on
processes
.sp
capgetp \- Linux specific capability prob of arbitrary process
.SH SYNOPSIS
.B #include <sys/capability.h>
.sp
.B cap_t cap_get_proc(void);
.br
.BI "int cap_set_proc(cap_t " cap_p );
.sp
.B #undef _POSIX_SOURCE
.br
.B #include <sys/capability.h>
.sp
.BI "cap_t capgetp(pid_t " pid ", cap_t " cap_d );
.SH USAGE
.br
.B cc ... -lcap
.SH DESCRIPTION
.B 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
.B cap_free
with the
.I cap_t
as an argument.
.PP
.B cap_set_proc
sets the values for all capability flags for all capabilities with the
capability state identified by
.IR cap_p .
The new capability state of the process will be completely determined by
the contents of
.I cap_p
upon successful return from this function. If any flag in
.I 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.
.PP
.B capgetp
fills an existing
.BR cap_d ,
see
.BR cap_init (3),
with the process capabilities of the process indicated by
.IR pid .
This information can also be obtained from the
.B /proc/<pid>/status
file.
.PP
.SH "RETURN VALUE"
.B cap_get_proc
returns a non-NULL value on success, and NULL on failure.
.PP
.BR cap_set_proc " and " capgetp
return zero for success, and \-1 on failure.
.PP
On failure,
.BR errno (3)
is set to
.BR EINVAL ,
.BR EPERM,
or
.BR ENOMEM .
.SH "CONFORMING TO"
.B cap_set_proc
and
.B cap_get_proc
are functions specified in the draft for POSIX.1e.
.SH "SEE ALSO"
.IR cap_clear (3),
.IR cap_copy_ext (3),
.IR cap_from_text (3),
.IR cap_get_file (3),
.IR cap_get_bound (3),
.IR cap_init (3)
|