Use kernel log-level 6 by default

This commit is contained in:
Michal Moskal 2017-07-27 12:49:19 +01:00
parent 14783eadc2
commit 8f9b9a5e4e
2 changed files with 13 additions and 6 deletions

View File

@ -29,23 +29,30 @@ uint64_t ntohll(uint64_t a) {
void mylog(const char *fmt, ...) { void mylog(const char *fmt, ...) {
va_list args; va_list args;
char *p; char *p, *p2;
va_start(args, fmt); va_start(args, fmt);
vasprintf(&p, fmt, args); vasprintf(&p, fmt, args);
vprintf(fmt, args); vprintf(fmt, args);
va_end(args); va_end(args);
int len = strlen(p) + 1; if (p[0] != '<')
p[len - 1] = '\n'; asprintf(&p2, "<6>%s\n", p);
else
asprintf(&p2, "%s\n", p);
int len = strlen(p2);
#ifdef X86 #ifdef X86
write(2, p, len); write(2, p2, len);
#else #else
int fd = open("/dev/kmsg", O_WRONLY); int fd = open("/dev/kmsg", O_WRONLY);
write(fd, p, len); write(fd, p2, len);
close(fd); close(fd);
#endif #endif
free(p);
free(p2);
} }
void readAll(int fd, void *dst, uint32_t length) { void readAll(int fd, void *dst, uint32_t length) {

View File

@ -37,7 +37,7 @@ void mylog(const char *fmt, ...);
#define FAIL(args...) \ #define FAIL(args...) \
do { \ do { \
mylog(args); \ mylog("<4>" args); \
exit(1); \ exit(1); \
} while (0) } while (0)