35759fa84c
The strerror_buf is way too large, so instead of using a separate buffer for just this string, reuse the already existing buffer. Increase the buffer size to cover the maximum errno string. Add a unit test to verify that none of the errno values are cut off in the async_safe_format_buffer function when passing %m. Bug: 274474681 Test: New unit test passes. Test: Changing the buffer to a small value and verify that the test fails. Change-Id: I4cb4652709582a8a6b958e12de5d923ec950e6b6 |
||
---|---|---|
.. | ||
include/async_safe | ||
Android.bp | ||
async_safe_log.cpp | ||
README.md |
async_safe logging
This library provides an async_safe implementation for formatting and writing log messages to logd.
Note that the liblog implementation connects a single socket to logd and uses a RWLock to manage it among threads, whereas these functions connect to liblog for each log message. While it's beneficial to have this lock-free and therefore async_safe mechanism to write to logd, connecting a socket for each message does not scale well under load. It was also determined to be too costly to connect a socket for each thread as some processes, such as system_server, have over 100 threads. Therefore, we maintain these two separate mechanisms.