summaryrefslogtreecommitdiff
path: root/libc/system_properties/context_node.h
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2017-11-17 17:14:05 -0800
committerTom Cherry <tomcherry@google.com>2017-12-12 00:36:20 -0800
commit79b724ca5a33e5dff7c2530b2649648021c1258d (patch)
tree703e81d1d3c41fe093f4747d4d7d4324427dde2c /libc/system_properties/context_node.h
parent78b40e8fe1f37de319344c92d8e6e1eb595c1067 (diff)
Add support for serialized property contexts
This adds support for reading a serialized /dev/__properties__/property_info file, which contains a serialized trie that maps property names to the SELinux context to which they belong. Performance wise on walleye, this change reduces the start up cost in libc from ~3000us to ~430us. On a benchmark that calls __system_property_find() for each property set on the system, it reduces the time per iteration from ~650us to ~292us. Bug: 36001741 Test: Boot bullhead, walleye, run unit tests Test: Benchmark initialization and lookup performance Change-Id: I0887a3a7da88eb51b6d1bd494fa5bce593423599
Diffstat (limited to 'libc/system_properties/context_node.h')
-rw-r--r--libc/system_properties/context_node.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/libc/system_properties/context_node.h b/libc/system_properties/context_node.h
index 1c6cbbb8e..769b85332 100644
--- a/libc/system_properties/context_node.h
+++ b/libc/system_properties/context_node.h
@@ -41,9 +41,16 @@ class ContextNode {
~ContextNode() {
Unmap();
}
+
+ ContextNode(const ContextNode&) = delete;
+ ContextNode(ContextNode&&) = delete;
+ void operator=(const ContextNode&) = delete;
+ void operator=(const ContextNode&&) = delete;
+
bool Open(bool access_rw, bool* fsetxattr_failed);
bool CheckAccessAndOpen();
void ResetAccess();
+ void Unmap();
const char* context() const {
return context_;
@@ -54,7 +61,6 @@ class ContextNode {
private:
bool CheckAccess();
- void Unmap();
Lock lock_;
const char* context_;