mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-17 10:41:58 +00:00
Connect to magiskd log daemon
This commit is contained in:
@@ -10,6 +10,7 @@ void unlock_blocks();
|
||||
void reboot();
|
||||
void start_log_daemon();
|
||||
void setup_logfile(bool reset);
|
||||
void magisk_logging();
|
||||
|
||||
// Module stuffs
|
||||
void handle_modules();
|
||||
|
@@ -17,7 +17,7 @@ struct log_meta {
|
||||
int tid;
|
||||
};
|
||||
|
||||
static atomic<int> logd_fd = -1;
|
||||
atomic<int> logd_fd = -1;
|
||||
|
||||
void setup_logfile(bool reset) {
|
||||
if (logd_fd < 0)
|
||||
@@ -121,7 +121,7 @@ static void logfile_writer(int pipefd) {
|
||||
}
|
||||
}
|
||||
|
||||
static int magisk_log(int prio, const char *fmt, va_list ap) {
|
||||
int magisk_log(int prio, const char *fmt, va_list ap) {
|
||||
char buf[MAX_MSG_LEN + 1];
|
||||
int len = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
|
||||
@@ -172,6 +172,15 @@ void magisk_logging() {
|
||||
log_cb.ex = nop_ex;
|
||||
}
|
||||
|
||||
#define alog(prio) [](auto fmt, auto ap){ return __android_log_vprint(ANDROID_LOG_##prio, "Magisk", fmt, ap); }
|
||||
void android_logging() {
|
||||
log_cb.d = alog(DEBUG);
|
||||
log_cb.i = alog(INFO);
|
||||
log_cb.w = alog(WARN);
|
||||
log_cb.e = alog(ERROR);
|
||||
log_cb.ex = nop_ex;
|
||||
}
|
||||
|
||||
void start_log_daemon() {
|
||||
int fds[2];
|
||||
if (pipe2(fds, O_CLOEXEC) == 0) {
|
||||
|
Reference in New Issue
Block a user