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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:33 +0000 (18:19 -0400)
commit16062dfd1cda2d1950b7c897c6fa821f92d4ce24
treecc2d63f73f71c88cc3f0e7c09e777cfe43888d9e
parent8ae92ae27bb77cd51a014eae28ade8f18ed10fed
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.025576 seconds and 4 git commands to generate.