Refactor putbuf() so that it can be used as a generic output sink. Add
sbuf_putbuf() to utilize this. This allows buffers to be written
atomically without bouncing through the buffer length limitations of
printf() and PRINTF_BUFR_SIZE.
Details
Details
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 7782 Build 7929: arc lint + arc unit
Event Timeline
Comment Actions
Looks reasonable, assuming the code cut and paste into prf_putbuf was correct to start with.
Comment Actions
I think this looks good, but we should also look at what it would take to put a drain mode in as well.
Comment Actions
Need input on naming. sbuf_putbuf() was named since it wraps putbuf(). Is this the best name, though? Also, should it be kernel only, and the userland be something else that suggests printing to stdout vs stderr vs some other file descriptor?
Comment Actions
dj_mc_sbuf_putbuff_iii_this_time_its_personal_esq is the obvious choice.
Please remember to bump .Dd, and credit me in the comments for the name.
Comment Actions
Committed
commit 388f3ce6c3fb0c2eeeeebe1e0af6d72f840de7fc Author: Scott Long <scottl@FreeBSD.org> Date: Tue Feb 28 18:25:06 2017 +0000 Implement sbuf_prf(), which takes an sbuf and outputs it to stdout in the non-kernel case and to the console+log in the kernel case. For the kernel case it hooks the putbuf() machinery underneath printf(9) so that the buffer is written completely atomically and without a copy into another temporary buffer. This is useful for fixing compound console/log messages that become broken and interleaved when multiple threads are competing for the console. Reviewed by: ken, imp Sponsored by: Netflix Notes: svn path=/head/; revision=314397