OSDN Git Service

printk: silence healthd and batteryd logs
authorJulian Liu <wlootlxt123@gmail.com>
Tue, 1 Oct 2019 23:41:11 +0000 (07:41 +0800)
committer0ranko0P <ranko0p@outlook.com>
Tue, 24 Dec 2019 20:42:21 +0000 (04:42 +0800)
* <3>batteryd, <4>healthd

kernel/printk/printk.c

index fd63b4d..56b2415 100644 (file)
@@ -648,6 +648,10 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
         */
        line = buf;
        if (line[0] == '<') {
+               if (memcmp(line+3, "batteryd", sizeof("batteryd")-1) == 0 ||
+                          memcmp(line+3, "healthd", sizeof("healthd")-1) == 0)
+                       goto ignore;
+               {
                char *endp = NULL;
                unsigned int u;
 
@@ -660,9 +664,11 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
                        len -= endp - line;
                        line = endp;
                }
+               }
        }
 
        printk_emit(facility, level, NULL, 0, "%s", line);
+ignore:
        kfree(buf);
        return ret;
 }