Setup logging infra in the Rust side

This commit is contained in:
topjohnwu
2022-07-01 04:53:41 -07:00
parent 3817167ba1
commit b4863eb51b
20 changed files with 194 additions and 48 deletions
+3 -3
View File
@@ -119,9 +119,9 @@ static bool check_key_combo() {
static FILE *kmsg;
static char kmsg_buf[4096];
static int vprintk(const char *fmt, va_list ap) {
static void vprintk(const char *fmt, va_list ap) {
vsnprintf(kmsg_buf + 12, sizeof(kmsg_buf) - 12, fmt, ap);
return fprintf(kmsg, "%s", kmsg_buf);
fprintf(kmsg, "%s", kmsg_buf);
}
void setup_klog() {
// Shut down first 3 fds
@@ -150,7 +150,7 @@ void setup_klog() {
kmsg = fdopen(fd, "w");
setbuf(kmsg, nullptr);
log_cb.d = log_cb.i = log_cb.w = log_cb.e = vprintk;
log_cb.ex = nop_ex;
exit_on_error(false);
strcpy(kmsg_buf, "magiskinit: ");
// Disable kmsg rate limiting