1avc_context_to_sid(3) SELinux API documentation avc_context_to_sid(3)
2
3
4
6 avc_context_to_sid, avc_sid_to_context, avc_get_initial_sid - obtain
7 and manipulate SELinux security ID's.
8
10 #include <selinux/selinux.h>
11
12 #include <selinux/avc.h>
13
14 int avc_context_to_sid(security_context_t ctx, security_id_t *sid);
15
16 int avc_sid_to_context(security_id_t sid, security_context_t *ctx);
17
18 int avc_get_initial_sid(const char *name, security_id_t *sid);
19
20
22 Security ID's (SID's) are opaque representations of security contexts,
23 managed by the userspace AVC.
24
25 avc_context_to_sid returns a SID for the given context in the memory
26 referenced by sid.
27
28 avc_sid_to_context returns a copy of the context represented by sid in
29 the memory referenced by ctx. The user must free the copy with
30 freecon(3).
31
32 avc_get_initial_sid returns a SID for the kernel initial security iden‐
33 tifier specified by name.
34
35
37 avc_context_to_sid and avc_sid_to_context return zero on success. On
38 error, -1 is returned and errno is set appropriately.
39
40
42 ENOMEM An attempt to allocate memory failed.
43
44
46 As of libselinux version 2.0.86, SID's are no longer reference counted.
47 A SID will be valid from the time it is first obtained until the next
48 call to avc_destroy(3). The sidget and sidput functions, formerly used
49 to adjust the reference count, are no-ops and are deprecated.
50
51
53 Eamon Walsh <ewalsh@tycho.nsa.gov>
54
55
57 avc_init(3), avc_has_perm(3), avc_cache_stats(3), avc_add_callback(3),
58 getcon(3), freecon(3) selinux(8)
59
60
61
62 27 May 2004 avc_context_to_sid(3)