[lkml]   [2005]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [-mm PATCH 1/2] printk return value: fix it
    Guillaume Chazarain wrote:
    > 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
    This is clearly a bug, but due to (almost) no one
    ever checking the return value, it has gone unnoticed.

    > The returned length was "length of input string + 3", I made it "length
    > of string output to the log buffer".

    I agree with this change. I think it fits with how
    the size is returned from printf in user space,
    which can be greater than the length of the format
    string when values are replaced in the string. So
    at least for printf, there is a precedent for returning a
    number greater than the length of the submitted string.

    -- Tim

    Tim Bird
    Architecture Group Chair, CE Linux Forum
    Senior Staff Engineer, Sony Electronics

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-11-16 00:25    [W:0.044 / U:2.628 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site