summaryrefslogtreecommitdiffstats
path: root/logd/main.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-04-07 17:58:36 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-04-07 17:58:36 +0000
commitffd721502e00e787ea0f89d6d537de52d4fc4542 (patch)
tree655e7d5ad5968dba80b8ef71a88ca1186d1b40de /logd/main.cpp
parent4336d13cb12a8e779d4c56c45dc6d7a47c0b7898 (diff)
parent3e73a99ff28a0fc0765ad3fc899cfb15f5c230f8 (diff)
downloadsystem_core-ffd721502e00e787ea0f89d6d537de52d4fc4542.zip
system_core-ffd721502e00e787ea0f89d6d537de52d4fc4542.tar.gz
system_core-ffd721502e00e787ea0f89d6d537de52d4fc4542.tar.bz2
am 3e73a99f: Merge "logd: auditd: add logd.auditd.dmesg property"
* commit '3e73a99ff28a0fc0765ad3fc899cfb15f5c230f8': logd: auditd: add logd.auditd.dmesg property
Diffstat (limited to 'logd/main.cpp')
-rw-r--r--logd/main.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/logd/main.cpp b/logd/main.cpp
index 83ec6c0..7346e2f 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -84,6 +84,13 @@ static int drop_privs() {
// space logger. Additional transitory per-client threads are created
// for each reader once they register.
int main() {
+ int fdDmesg = -1;
+ char dmesg[PROPERTY_VALUE_MAX];
+ property_get("logd.auditd.dmesg", dmesg, "1");
+ if (atol(dmesg)) {
+ fdDmesg = open("/dev/kmsg", O_WRONLY);
+ }
+
if (drop_privs() != 0) {
return -1;
}
@@ -136,9 +143,10 @@ int main() {
// and LogReader is notified to send updates to connected clients.
// failure is an option ... messages are in dmesg (required by standard)
- LogAudit *al = new LogAudit(logBuf, reader);
+ LogAudit *al = new LogAudit(logBuf, reader, fdDmesg);
if (al->startListener()) {
delete al;
+ close(fdDmesg);
}
pause();