avc_get_initial_context (3) - Linux Man Pages
avc_get_initial_context: obtain and manipulate SELinux security ID's
avc_context_to_sid, avc_sid_to_context, avc_get_initial_sid - obtain and manipulate SELinux security ID's
int avc_context_to_sid(char *ctx, security_id_t *sid);
int avc_sid_to_context(security_id_t sid, char **ctx);
DESCRIPTIONSecurity ID's (SID's) are opaque representations of security contexts, managed by the userspace AVC.
avc_context_to_sid() returns a SID for the given context in the memory referenced by sid.
avc_sid_to_context() returns a copy of the context represented by sid in the memory referenced by ctx. The user must free the copy with freecon(3).
RETURN VALUEavc_context_to_sid() and avc_sid_to_context() return zero on success. On error, -1 is returned and errno is set appropriately.
- An attempt to allocate memory failed.