console: Report an error when output buffer is exhausted

If the console output buffer is exhausted, characters are silently dropped
from the end. Detect this condition and report an error when reading back
the characters.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2021-05-08 06:59:56 -06:00 committed by Tom Rini
parent 24e1e8841c
commit c1a2bb4f83
4 changed files with 58 additions and 16 deletions

View file

@ -72,7 +72,8 @@ int console_record_reset_enable(void);
*
* @str: Place to put string
* @maxlen: Maximum length of @str including nul terminator
* @return length of string returned
* @return length of string returned, or -ENOSPC if the console buffer was
* overflowed by the output
*/
int console_record_readline(char *str, int maxlen);