summaryrefslogtreecommitdiff
path: root/src/label.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-25 21:22:57 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-25 21:22:57 +0200
commit871e580949b1417058da7f7e9fa0380d308ef708 (patch)
treecd8d308e7ab3c81c42259b3ed2a636334be9b367 /src/label.c
parent41e4d6e9ace4f3b717af3c0419b69a2ac7935116 (diff)
selinux: log how much time it takes to load the SELinux policy and database
Diffstat (limited to 'src/label.c')
-rw-r--r--src/label.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/label.c b/src/label.c
index 43f6e89fa5..5157b790d2 100644
--- a/src/label.c
+++ b/src/label.c
@@ -47,6 +47,7 @@ int label_init(void) {
int r = 0;
#ifdef HAVE_SELINUX
+ usec_t n;
if (!use_selinux())
return 0;
@@ -54,12 +55,20 @@ int label_init(void) {
if (label_hnd)
return 0;
+ n = now(CLOCK_MONOTONIC);
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
if (!label_hnd) {
log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
"Failed to initialize SELinux context: %m");
r = security_getenforce() == 1 ? -errno : 0;
+ } else {
+ char buf[FORMAT_TIMESPAN_MAX];
+
+ n = now(CLOCK_MONOTONIC) - n;
+ log_info("Successfully loaded SELinux database in %s.",
+ format_timespan(buf, sizeof(buf), n));
}
+
#endif
return r;