Andrew G. Morgan | a44d411 | 2008-07-29 22:20:12 -0700 | [diff] [blame] | 1 | .TH LIBCAP 3 "2008-07-29" "" "Linux Programmer's Manual" |
| 2 | .SH NAME |
| 3 | cap_clear, cap_clear_flag, cap_compare, cap_copy_ext, cap_copy_int, \ |
| 4 | cap_free, cap_from_name, cap_from_text, cap_get_fd, cap_get_file, \ |
| 5 | cap_get_flag, cap_get_pid, cap_get_proc, cap_set_fd, cap_set_file, \ |
| 6 | cap_set_flag, cap_set_proc, cap_size, cap_to_name, cap_to_text, \ |
| 7 | cap_get_pid, cap_dup \- capability data object manipulation |
| 8 | .SH SYNOPSIS |
| 9 | .nf |
| 10 | .B #include <sys/capability.h> |
| 11 | .sp |
| 12 | .BI "int cap_clear(cap_t " cap_p ); |
| 13 | .sp |
| 14 | .BI "int cap_clear_flag(cap_t " cap_p ", cap_flag_t " flag ");" |
| 15 | .sp |
| 16 | .BI "int cap_compare(cap_t " cap_a ", cap_t " cap_b ");" |
| 17 | .sp |
| 18 | .BI "ssize_t cap_copy_ext(void *" ext_p ", cap_t " cap_p ", ssize_t " size ); |
| 19 | .sp |
| 20 | .BI "cap_t cap_copy_int(const void *" ext_p ); |
| 21 | .sp |
| 22 | .BI "int cap_free(void *" obj_d ); |
| 23 | .sp |
| 24 | .BI "int cap_from_name(const char *" name ", cap_value_t *" cap_p ); |
| 25 | .sp |
| 26 | .BI "cap_t cap_from_text(const char *" buf_p ); |
| 27 | .sp |
| 28 | .BI "cap_t cap_get_fd(int " fd ); |
| 29 | .sp |
| 30 | .BI "cap_t cap_get_file(const char *" path_p ); |
| 31 | .sp |
| 32 | .BI "int cap_get_flag(cap_t " cap_p ", cap_value_t " cap , |
| 33 | .BI " cap_flag_t " flag ", cap_flag_value_t *" value_p ");" |
| 34 | .sp |
| 35 | .B #include <sys/types.h> |
| 36 | .BI "cap_t cap_get_pid(pid_t " pid ); |
| 37 | .sp |
| 38 | .B "cap_t cap_get_proc(void);" |
| 39 | .sp |
| 40 | .BI "int cap_set_fd(int " fd ", cap_t " caps ); |
| 41 | .sp |
| 42 | .BI "int cap_set_file(const char *" path_p ", cap_t " cap_p ); |
| 43 | .sp |
| 44 | .sp |
| 45 | .BI "int cap_set_flag(cap_t " cap_p ", cap_flag_t " flag ", int " ncap , |
| 46 | .BI " const cap_value_t *" caps ", cap_flag_value_t " value ");" |
| 47 | .BI "int cap_set_proc(cap_t " cap_p ); |
| 48 | .sp |
| 49 | .BI "ssize_t cap_size(cap_t " cap_p ); |
| 50 | .sp |
| 51 | .BI "char *cap_to_name(cap_value_t " cap ); |
| 52 | .sp |
| 53 | .BI "char *cap_to_text(cap_t " caps ", ssize_t *" length_p ); |
| 54 | .sp |
| 55 | .BI "cap_t cap_get_pid(pid_t " pid ); |
| 56 | .sp |
| 57 | .BI "cap_t cap_dup(cap_t " cap_p ); |
| 58 | .sp |
| 59 | Link with \fI-lcap\fP. |
| 60 | .fi |
| 61 | .SH DESCRIPTION |
| 62 | These functions work on a capability state held in working storage. |
| 63 | A |
| 64 | .I cap_t |
| 65 | holds information about the capabilities in each of the three sets, |
| 66 | Permitted, Inheritable, and Effective. |
| 67 | Each capability in a set may be clear (disabled, 0) or set (enabled, 1). |
| 68 | .PP |
| 69 | These functions work with the following data types: |
| 70 | .TP 18 |
| 71 | .I cap_value_t |
| 72 | identifies a capability, such as |
| 73 | .BR CAP_CHOWN . |
| 74 | .TP |
| 75 | .I cap_flag_t |
| 76 | identifies one of the three flags associated with a capability |
| 77 | (i.e., it identifies one of the three capability sets). |
| 78 | Valid values for this type are |
| 79 | .BR CAP_EFFECTIVE , |
| 80 | .B CAP_INHERITABLE |
| 81 | or |
| 82 | .BR CAP_PERMITTED . |
| 83 | .TP |
| 84 | .I cap_flag_value_t |
| 85 | identifies the setting of a particular capability flag |
| 86 | (i.e, the value of a capability in a set). |
| 87 | Valid values for this type are |
| 88 | .BR CAP_CLEAR (0) |
| 89 | or |
| 90 | .BR CAP_SET (1). |
| 91 | .SH "RETURN VALUE" |
| 92 | The return value is generally specific to the individual function called. |
| 93 | On failure, |
| 94 | .I errno |
| 95 | is set appropriately. |
| 96 | .SH "CONFORMING TO" |
| 97 | These functions are as per the withdrawn POSIX.1e draft specification. |
| 98 | The following functions are Linux extensions: |
| 99 | .BR cap_clear_flag (), |
| 100 | .BR cap_compare (), |
| 101 | .BR cap_from_name (), |
| 102 | .BR cap_to_name (), |
| 103 | and |
| 104 | .BR cap_compare (). |
| 105 | .SH "SEE ALSO" |
| 106 | .BR cap_clear (3), |
| 107 | .BR cap_copy_ext (3), |
| 108 | .BR cap_from_text (3), |
| 109 | .BR cap_get_file (3), |
| 110 | .BR cap_get_proc (3), |
| 111 | .BR cap_init (3), |
| 112 | .BR capabilities (7), |
| 113 | .BR getpid (2) |
Andrew G. Morgan | 92246ba | 2011-04-25 21:41:09 -0700 | [diff] [blame] | 114 | .BR capsh (1) |