Re: printk and \n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sri,

On Thu, Sep 23, 2010 at 11:12 PM, sri <bskmohan@xxxxxxxxx> wrote:
> Hi
>
> printk("device opened\n");
> printk("device file opened by %d", current->pid);
>
> Here the second printk output is not displayed.
> Without \n printk is not flushing out its buffer.  If I give, \n in the
> second printk it is working.
>
> Is there any reason for that?

I think that the only reason is to try and ensure that as much of the
message stays together as possible.

This is especially true when the printk's are going to a serial
console. The code has to parse for the \n's anyways since it looks for
the <x> tags (where x is a number - see KERN_ERR etc) at the beginning
of each line (i.e. immediately after the \n)

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux