Loading logd/LogAudit.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ #define KMSG_PRIORITY(PRI) \ '<', \ '0' + (LOG_AUTH | (PRI)) / 10, \ '0' + (LOG_AUTH | (PRI)) % 10, \ '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) / 10, \ '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) % 10, \ '>' LogAudit::LogAudit(LogBuffer *buf, LogReader *reader, int fdDmesg) Loading logd/main.cpp +19 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <sys/prctl.h> #include <sys/stat.h> #include <sys/types.h> #include <syslog.h> #include <unistd.h> #include <cutils/properties.h> Loading @@ -41,6 +42,12 @@ #include "LogListener.h" #include "LogAudit.h" #define KMSG_PRIORITY(PRI) \ '<', \ '0' + LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(PRI)) / 10, \ '0' + LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(PRI)) % 10, \ '>' // // The service is designed to be run by init, it does not respond well // to starting up manually. When starting up manually the sockets will Loading Loading @@ -131,6 +138,11 @@ static bool property_get_bool(const char *key, bool def) { return def; } // Remove the static, and use this variable // globally for debugging if necessary. eg: // write(fdDmesg, "I am here\n", 10); static int fdDmesg = -1; static sem_t reinit; static bool reinit_running = false; static LogBuffer *logBuf = NULL; Loading @@ -143,6 +155,13 @@ static void *reinit_thread_start(void * /*obj*/) { setuid(AID_LOGD); while (reinit_running && !sem_wait(&reinit) && reinit_running) { if (fdDmesg >= 0) { static const char reinit_message[] = { KMSG_PRIORITY(LOG_INFO), 'l', 'o', 'g', 'd', '.', 'd', 'a', 'e', 'm', 'o', 'n', ':', ' ', 'r', 'e', 'i', 'n', 'i', 't', '\n' }; write(fdDmesg, reinit_message, sizeof(reinit_message)); } // Anything that reads persist.<property> if (logBuf) { logBuf->init(); Loading @@ -158,11 +177,6 @@ void reinit_signal_handler(int /*signal*/) { sem_post(&reinit); } // Remove the static, and use this variable // globally for debugging if necessary. eg: // write(fdDmesg, "I am here\n", 10); static int fdDmesg = -1; // Foreground waits for exit of the main persistent threads // that are started here. The threads are created to manage // UNIX domain client sockets for writing, reading and Loading Loading
logd/LogAudit.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ #define KMSG_PRIORITY(PRI) \ '<', \ '0' + (LOG_AUTH | (PRI)) / 10, \ '0' + (LOG_AUTH | (PRI)) % 10, \ '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) / 10, \ '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) % 10, \ '>' LogAudit::LogAudit(LogBuffer *buf, LogReader *reader, int fdDmesg) Loading
logd/main.cpp +19 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <sys/prctl.h> #include <sys/stat.h> #include <sys/types.h> #include <syslog.h> #include <unistd.h> #include <cutils/properties.h> Loading @@ -41,6 +42,12 @@ #include "LogListener.h" #include "LogAudit.h" #define KMSG_PRIORITY(PRI) \ '<', \ '0' + LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(PRI)) / 10, \ '0' + LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(PRI)) % 10, \ '>' // // The service is designed to be run by init, it does not respond well // to starting up manually. When starting up manually the sockets will Loading Loading @@ -131,6 +138,11 @@ static bool property_get_bool(const char *key, bool def) { return def; } // Remove the static, and use this variable // globally for debugging if necessary. eg: // write(fdDmesg, "I am here\n", 10); static int fdDmesg = -1; static sem_t reinit; static bool reinit_running = false; static LogBuffer *logBuf = NULL; Loading @@ -143,6 +155,13 @@ static void *reinit_thread_start(void * /*obj*/) { setuid(AID_LOGD); while (reinit_running && !sem_wait(&reinit) && reinit_running) { if (fdDmesg >= 0) { static const char reinit_message[] = { KMSG_PRIORITY(LOG_INFO), 'l', 'o', 'g', 'd', '.', 'd', 'a', 'e', 'm', 'o', 'n', ':', ' ', 'r', 'e', 'i', 'n', 'i', 't', '\n' }; write(fdDmesg, reinit_message, sizeof(reinit_message)); } // Anything that reads persist.<property> if (logBuf) { logBuf->init(); Loading @@ -158,11 +177,6 @@ void reinit_signal_handler(int /*signal*/) { sem_post(&reinit); } // Remove the static, and use this variable // globally for debugging if necessary. eg: // write(fdDmesg, "I am here\n", 10); static int fdDmesg = -1; // Foreground waits for exit of the main persistent threads // that are started here. The threads are created to manage // UNIX domain client sockets for writing, reading and Loading