Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit e9ade174 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

liblogcat: introduce getopt_long_r

Resolve one of the threading issues by creating a private C++ified
copy of getopt_long_r that started out its life as the bionic
getopt_long, but is reentrant.  Adds a new state context for the
stderr stream called optstderr.  Utilize this new function in logcat.
Control opterr and optstderr to match liblogcat expectations.  Correct
and fortify const.

Alternative would be to lock around _all_ getopt callers.  This has
the advantage of requiring _no_ locks that could get in the way of
using liblogcat in a signal handler.  The log reader interface does
run the risk of incurring locks and heap allocations though, so there
is more work to be done for that final goal.

Test: gTest logcat-unit-tests
Bug: 35326290
Change-Id: Ibb1b374c55d357d5d7fa5ad00bfaf07ae0bc4ba5
parent 07169227
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment