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
_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to