From: Guillaume Chazarain <guichaz@yahoo.fr>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, tim.bird@am.sony.com
Subject: [-mm PATCH 1/2] printk return value: fix it
Date: Tue, 15 Nov 2005 13:17:59 +0100 [thread overview]
Message-ID: <4379D1F7.1000701@yahoo.fr> (raw)
In-Reply-To: <430CA2CE.4070403@am.sony.com>
[-- Attachment #1: Type: text/plain, Size: 759 bytes --]
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>
---
printk.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
--
Guillaume
[-- Attachment #2: printk.diff --]
[-- Type: text/x-patch, Size: 806 bytes --]
diff -r d18e06f9c571 kernel/printk.c
--- a/kernel/printk.c Mon Nov 14 10:22:49 2005 +0800
+++ b/kernel/printk.c Mon Nov 14 15:02:56 2005 +0100
@@ -569,7 +569,7 @@
p[1] <= '7' && p[2] == '>') {
loglev_char = p[1];
p += 3;
- printed_len += 3;
+ printed_len -= 3;
} else {
loglev_char = default_message_loglevel
+ '0';
@@ -584,7 +584,7 @@
for (tp = tbuf; tp < tbuf + tlen; tp++)
emit_log_char(*tp);
- printed_len += tlen - 3;
+ printed_len += tlen;
} else {
if (p[0] != '<' || p[1] < '0' ||
p[1] > '7' || p[2] != '>') {
@@ -592,8 +592,8 @@
emit_log_char(default_message_loglevel
+ '0');
emit_log_char('>');
+ printed_len += 3;
}
- printed_len += 3;
}
log_level_unknown = 0;
if (!*p)
next prev parent reply other threads:[~2005-11-15 12:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-03 9:35 [PATCH] Wrong printk return value Guillaume Chazarain
2005-08-24 16:39 ` Tim Bird
2005-11-15 12:17 ` Guillaume Chazarain [this message]
2005-11-15 23:23 ` [-mm PATCH 1/2] printk return value: fix it Tim Bird
2005-11-15 12:18 ` [PATCH 2/2] kmsg_write: don't return printk return value Guillaume Chazarain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4379D1F7.1000701@yahoo.fr \
--to=guichaz@yahoo.fr \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tim.bird@am.sony.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox