mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] printk return value: fix it
What's the true meaning of the printk return value? Should it include the priority prefix length of 3? and what about the timing information? In both cases it was broken: strace -e write echo 1 > /dev/kmsg => write(1, "1\n", 2) = 5 strace -e write echo "<1>1" > /dev/kmsg => write(1, "<1>1\n", 5) = 8 The returned length was "length of input string + 3", I made it "length of string output to the log buffer". Note that I couldn't find any printk caller in the kernel interested by its return value besides kmsg_write. Signed-off-by: Guillaume Chazarain <guichaz@yahoo.fr> Acked-By: Tim Bird <tim.bird@am.sony.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
2520f14ca8
commit
025510cd20
1 changed files with 3 additions and 3 deletions
|
@ -569,7 +569,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
|
||||||
p[1] <= '7' && p[2] == '>') {
|
p[1] <= '7' && p[2] == '>') {
|
||||||
loglev_char = p[1];
|
loglev_char = p[1];
|
||||||
p += 3;
|
p += 3;
|
||||||
printed_len += 3;
|
printed_len -= 3;
|
||||||
} else {
|
} else {
|
||||||
loglev_char = default_message_loglevel
|
loglev_char = default_message_loglevel
|
||||||
+ '0';
|
+ '0';
|
||||||
|
@ -584,7 +584,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
|
||||||
|
|
||||||
for (tp = tbuf; tp < tbuf + tlen; tp++)
|
for (tp = tbuf; tp < tbuf + tlen; tp++)
|
||||||
emit_log_char(*tp);
|
emit_log_char(*tp);
|
||||||
printed_len += tlen - 3;
|
printed_len += tlen;
|
||||||
} else {
|
} else {
|
||||||
if (p[0] != '<' || p[1] < '0' ||
|
if (p[0] != '<' || p[1] < '0' ||
|
||||||
p[1] > '7' || p[2] != '>') {
|
p[1] > '7' || p[2] != '>') {
|
||||||
|
@ -592,8 +592,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
|
||||||
emit_log_char(default_message_loglevel
|
emit_log_char(default_message_loglevel
|
||||||
+ '0');
|
+ '0');
|
||||||
emit_log_char('>');
|
emit_log_char('>');
|
||||||
|
printed_len += 3;
|
||||||
}
|
}
|
||||||
printed_len += 3;
|
|
||||||
}
|
}
|
||||||
log_level_unknown = 0;
|
log_level_unknown = 0;
|
||||||
if (!*p)
|
if (!*p)
|
||||||
|
|
Loading…
Reference in a new issue