string_to_security_class(3) — Linux manual page


security_class_to_string(3)ELinux API documentationcurity_class_to_string(3)

NAME         top

       security_class_to_string, security_av_perm_to_string, string_to_secu‐
       rity_class,  string_to_av_perm,   security_av_string,   mode_to_secu‐
       rity_class  - convert between SELinux class and permission values and
       string names.  print_access_vector -  display  an  access  vector  in
       human-readable form.

SYNOPSIS         top

       #include <selinux/selinux.h>

       const char *security_class_to_string(security_class_t tclass);

       const char *security_av_perm_to_string(security_class_t tclass,
       access_vector_t av);

       int security_av_string(security_class_t tclass, access_vector_t av,
       char **result);

       security_class_t string_to_security_class(const char *name);

       security_class_t mode_to_security_class(mode_t mode);

       access_vector_t string_to_av_perm(security_class_t tclass, const char

       void print_access_vector(security_class_t tclass, access_vector_t

DESCRIPTION         top

       security_class_to_string() returns a string name for class tclass, or
       NULL if the class is invalid.  The returned string must not be
       modified or freed.

       security_av_perm_to_string() returns a string name for the access
       vector bit av of class tclass, or NULL if either argument is invalid.
       The returned string must not be modified or freed.

       security_av_string() computes a full access vector string
       representation using tclass and av, which may have multiple bits set.
       The string is returned in the memory pointed to by result, and should
       be freed by the caller using free(3).

       string_to_security_class() returns the class value corresponding to
       the string name name, or zero if no such class exists.

       mode_to_security_class() returns the class value corresponding to the
       specified mode, or zero if no such class exists.

       string_to_av_perm() returns the access vector bit corresponding to
       the string name name and security class tclass, or zero if no such
       value exists.

       print_access_vector() displays an access vector in human-readable
       form on the standard output stream.

RETURN VALUE         top

       security_av_string() returns zero on success or -1 on error with
       errno set appropriately.  print_access_vector() does not return a
       value. All other functions return zero or NULL on error.

ERRORS         top

       EINVAL A class or access vector argument is not recognized by the
              currently loaded policy.

       ENOMEM An attempt to allocate memory failed.

AUTHOR         top

       Eamon Walsh <>

SEE ALSO         top

       selinux(8), getcon(3), getfilecon(3) stat(3)

COLOPHON         top

       This page is part of the selinux (Security-Enhanced Linux user-space
       libraries and tools) project.  Information about the project can be
       found at ⟨⟩.  If you
       have a bug report for this manual page, see
       ⟨⟩.  This
       page was obtained from the project's upstream Git repository
       ⟨⟩ on 2020-09-18.  (At that
       time, the date of the most recent commit that was found in the repos‐
       itory was 2020-09-17.)  If you discover any rendering problems in
       this HTML version of the page, or you believe there is a better or
       more up-to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not part
       of the original manual page), send a mail to

                                 30 Mar 2007     security_class_to_string(3)

Pages that refer to this page: avc_audit(3)avc_entry_ref_init(3)avc_has_perm(3)avc_has_perm_noaudit(3)checkpasswdaccess(3)checkPasswdAccess(3)security_compute_av(3)security_compute_av_flags(3)security_compute_av_flags_raw(3)security_compute_av_raw(3)security_compute_create(3)security_compute_create_name(3)security_compute_create_name_raw(3)security_compute_create_raw(3)security_compute_member(3)security_compute_member_raw(3)security_compute_relabel(3)security_compute_relabel_raw(3)security_compute_user(3)security_compute_user_raw(3)security_get_initial_context(3)security_get_initial_context_raw(3)security_validatetrans(3)selinux_check_access(3)selinux_check_passwd_access(3)