Logging: use a TLS buffer and increase its size
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 23 Feb 2018 02:57:30 +0000 (21:57 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 03:32:03 +0000 (23:32 -0400)
commitdeaa6f85e512084aafa0ec0576ee31debb6ac75d
tree76242f3b0db5f503013cc65603cf6168d113a6bd
parent71fd6f526fb8958500f72b97ce675f25a4284923
Logging: use a TLS buffer and increase its size

The logging system's line buffer is on the stack, and its current size
is 512. This means any log line which is larger than 512 bytes (this can
happen with some warnings/errors with a lot of information) gets
truncated.

In order to make this buffer size arbitrarily large, use a TLS global
buffer instead.

Increase the logging system's line buffer to 16 kiB (per thread).

Drawback: the logging system had a static assertion which ensured that
the line buffer size was not greater than PIPE_BUF so that individual
write operations were atomic. With a line buffer size larger than
PIPE_BUF, different threads could write to the output stream at the same
time which could result in interlaced data. We need to add some locking
to support multithreaded logging.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
logging/log.c
This page took 0.025975 seconds and 4 git commands to generate.