diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-12-19 18:56:55 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-12-19 18:56:55 +0100 |
commit | 8ece45e4f586abd212d1c02d74d38ef681a45600 (patch) | |
tree | 2289618f579787fd06e2235806575705e7601b29 /include | |
parent | af7f4165512ea242b5f711ee03a04f6afe22232d (diff) | |
download | glibc-8ece45e4f586abd212d1c02d74d38ef681a45600.tar glibc-8ece45e4f586abd212d1c02d74d38ef681a45600.tar.gz glibc-8ece45e4f586abd212d1c02d74d38ef681a45600.tar.bz2 glibc-8ece45e4f586abd212d1c02d74d38ef681a45600.zip |
libio: Convert __vdprintf_internal to buffers
The internal buffer size is set to 2048 bytes. This is less than
the original BUFSIZ value used by buffered_vfprintf before
the conversion, but it hopefully covers all cases where write
boundaries matter.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/printf_buffer.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/printf_buffer.h b/include/printf_buffer.h index c8e22e1e90..e2ca2d72d5 100644 --- a/include/printf_buffer.h +++ b/include/printf_buffer.h @@ -50,6 +50,7 @@ enum __printf_buffer_mode __printf_buffer_mode_sprintf_chk, __printf_buffer_mode_to_file, __printf_buffer_mode_asprintf, + __printf_buffer_mode_dprintf, __printf_buffer_mode_strfmon, __printf_buffer_mode_fp, /* For __printf_fp_l_buffer. */ __printf_buffer_mode_fp_to_wide, /* For __wprintf_fp_l_buffer. */ @@ -308,6 +309,9 @@ void __printf_buffer_flush_to_file (struct __printf_buffer_to_file *) struct __printf_buffer_asprintf; void __printf_buffer_flush_asprintf (struct __printf_buffer_asprintf *) attribute_hidden; +struct __printf_buffer_dprintf; +void __printf_buffer_flush_dprintf (struct __printf_buffer_dprintf *) + attribute_hidden; struct __printf_buffer_fp; void __printf_buffer_flush_fp (struct __printf_buffer_fp *) attribute_hidden; @@ -341,4 +345,9 @@ void __wprintf_buffer_flush_to_file (struct __wprintf_buffer_to_file *) (final, correctly sized) heap allocation. */ #define PRINTF_BUFFER_SIZE_ASPRINTF 200 +/* This should cover most of the packet-oriented file descriptors, + where boundaries between writes could be visible to readers. But + it is still small enough not to cause too many stack overflow issues. */ +#define PRINTF_BUFFER_SIZE_DPRINTF 2048 + #endif /* PRINTF_BUFFER_H */ |