1security_class_to_string(3)SE Linux API documentationsecurity_class_to_string(3)
2
3
4
6 security_class_to_string, security_av_perm_to_string, string_to_secu‐
7 rity_class, string_to_av_perm, security_av_string - convert between
8 SELinux class and permission values and string names.
9
10
12 #include <selinux/selinux.h>
13
14 #include <selinux/flask.h>
15
16 const char * security_class_to_string(security_class_t tclass);
17
18 const char * security_av_perm_to_string(security_class_t tclass,
19 access_vector_t av);
20
21 int security_av_string(security_class_t tclass, access_vector_t av,
22 char **result);
23
24 security_class_t string_to_security_class(const char *name);
25
26 access_vector_t string_to_av_perm(security_class_t tclass, const char
27 *name);
28
29
31 security_class_to_string returns a string name for class tclass, or
32 NULL if the class is invalid. The returned string must not be modified
33 or freed.
34
35 security_av_perm_to_string returns a string name for the access vector
36 bit av of class tclass, or NULL if either argument is invalid. The
37 returned string must not be modified or freed.
38
39 security_av_string computes a full access vector string representation
40 using tclass and av, which may have multiple bits set. The string is
41 returned in the memory pointed to by result, and should be freed by the
42 caller using free(3).
43
44 string_to_security_class returns the class value corresponding to the
45 string name name, or zero if no such class exists.
46
47 string_to_av_perm returns the access vector bit corresponding to the
48 string name name and security class tclass, or zero if no such value
49 exists.
50
51
53 security_av_string returns returns zero on success or -1 on error with
54 errno set appropriately. All other functions return zero or NULL on
55 error.
56
57
59 EINVAL A class or access vector argument is not recognized by the cur‐
60 rently loaded policy.
61
62
63 ENOMEM An attempt to allocate memory failed.
64
65
67 Eamon Walsh <ewalsh@tycho.nsa.gov>
68
69
71 selinux(8), getcon(3), getfilecon(3)
72
73
74
75 30 Mar 2007 security_class_to_string(3)