All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] rt_printf truncates large strings at end of buffer
@ 2010-06-03  9:16 Erik Schuitema
  0 siblings, 0 replies; only message in thread
From: Erik Schuitema @ 2010-06-03  9:16 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]

Hi all,

I experienced some undesired behavior when printing large strings (>239 
chars) with rt_printf or one of its variants.

Due to the exact implementation of rt_vfprintf, one has a problem when 
trying to print large strings when the writing position is close to the 
end of the ring buffer, no matter its size or space left.
If the space left at the end of the buffer is larger than 238 chars (= 
RT_PRINT_LINE_BREAK - 2*sizeof(struct entry_head))  (the buffer's write 
pos hasn't automatically wrapped yet) but smaller than the desired 
string length, the string is truncated without any form of feedback to 
the user.

It would be useful to return the actual number of printed characters in 
that case (now rt_vfprintf returns the result of vsnprintf(), which 
returns the number of bytes that would have been printed if there had 
been enough space).

If that conflicts with any specification, it would be nice if there 
could be at least one retry. If the string could not be printed 
completely, the incomplete entry can be modified into an empty entry, 
the writepos can be wrapped, and there can be one retry.

Right now, I have to manually cut my strings in chunks of 239 bytes 
before printing them.

Best regards,
Erik

[-- Attachment #2: Type: text/html, Size: 1617 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-03  9:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03  9:16 [Xenomai-core] rt_printf truncates large strings at end of buffer Erik Schuitema

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.