mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
stdio: Implement simple buffered out stream for vdprintf
Improve performance for raw fd based printf like operation. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
e4d219ca06
commit
b96035885a
@@ -217,6 +217,14 @@ struct lib_rawsostream_s
|
||||
int fd;
|
||||
};
|
||||
|
||||
struct lib_bufferedoutstream_s
|
||||
{
|
||||
struct lib_outstream_s public;
|
||||
FAR struct lib_outstream_s *backend;
|
||||
int pending;
|
||||
char buffer[CONFIG_STREAM_OUT_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
/* This is a special stream that does buffered character I/O. NOTE that is
|
||||
* CONFIG_SYSLOG_BUFFER is not defined, it is the same as struct
|
||||
* lib_outstream_s
|
||||
@@ -372,6 +380,26 @@ void lib_rawoutstream(FAR struct lib_rawoutstream_s *outstream, int fd);
|
||||
void lib_rawsistream(FAR struct lib_rawsistream_s *instream, int fd);
|
||||
void lib_rawsostream(FAR struct lib_rawsostream_s *outstream, int fd);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_bufferedoutstream
|
||||
*
|
||||
* Description:
|
||||
* Wrap a raw output stream to a buffered output stream.
|
||||
*
|
||||
* Input Parameters:
|
||||
* outstream - User allocated, uninitialized instance of struct
|
||||
* lib_bufferedoutstream_s to be initialized.
|
||||
* backend - User allocated, initialized instance of struct
|
||||
* lib_outstream_s to be buffered.
|
||||
*
|
||||
* Returned Value:
|
||||
* None (User allocated instance initialized).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lib_bufferedoutstream(FAR struct lib_bufferedoutstream_s *outstream,
|
||||
FAR struct lib_outstream_s *backend);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_lowoutstream
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user