- Zero initialize log_time instances by default
- Disable implicit conversions by making constructors explicit
- Explicitly initialize to EPOCH in most places
- Change sniffTime() to avoid in-place modification of a log_time
I stopped here, but we could consider following up with a more invasive
change to make log_time instances immutable and perhaps also remove the
default constructor to force explicit initialization to EPOCH.
Test: atest libbase_test netd_unit_test
Change-Id: I67e716ef74adaaf40ab2c6e2e0dddb8d309bc7ca
After a few years of being available, there only ended up being one
user of this, so it is clear that logd's duplicate message mechanism
is the favored solution.
The one user of this rate limiting is questionable as is, since due to
the nature of storaged, the mainloop only runs once per minute by
default as is, so there is essentially nothing to be gained by rate
limiting any further.
Test: build
Change-Id: I0610d11efda1ce8b581b939bad11ff295cb2daa6
These headers are platforms headers, so by definition they'll never be
compiled for a platform less than the current one.
Test: build
Change-Id: Ic1c1535b935929d713806faf17fbf9cd82275329
Some liblog tests test symbols that aren't otherwise used on the
platform. Statically link the tests such that we can add version
scripts that expose only the symbols used by the platform, and still
allow the tests to test the rest.
Test: build + unit tests
Change-Id: I898280fa52d31a2c7ad4eafdaa85e8b5f2e87971
No users ever signed up to use this, so remove it to ease the
refactoring of liblog/libbase.
Bug: 119867234
Test: liblog unit tests
Change-Id: I37b99644112bae7b4a2e3f4d06749db08de4ea14
If realloc returns NULL, the memory passed to it will remain allocated.
That doesn't appear to be intended here.
Caught by our static analyzer.
Bug: None
Test: Ran the static analyzer.
Change-Id: I579bee6827146d404fc6f6b86074366aefbda63f
* Need a body and return value for this function
so the constexpr check can inline it.
* C mode can just use an extern function declaration, but not constexpr.
Bug: 116854606
Bug: 111614304
Test: build with WITH_TIDY=1 and enable static analyzer checks
Change-Id: Ie3f4efbcabed99416d196b6c361a772b8c6a4035
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: I40f8bbf94e207c9dd90921e9b762ba51abab5777
With replaced AOSP system.img, adb can be root by other test.
The fail is caused by the reason that logdw is still active after
__android_log_close().
This test has a potential bug.
proc/net/unix may contain '\0', then "grep" command will treat this file
as a bianry file.
Using "grep -a" instead of "grep" could be a safer way to get the right
results from bianry file.
bug: 112250722
Test: Build CTS
Test: Pixel 2 XL PPP5.180610.010 passed the following tests
Test: run cts-on-gsi -m CtsLiblogTestCases --skip-preconditions
Change-Id: I9bfca1522e90ebb68e6cecbdb63e3b67248e47c4
Signed-off-by: Xinghua Yang <xinghua.yang@mediatek.com>
Add android_log_parser_reset and android_log_reset to reset reader/writer
log context. This allows to generate multiple log messages of the same
format without context reallocation.
Change-Id: Icb0f15855378aa4e66fc671ffefd15d9df6fee1e
* New clang compiler requires variadic function to have
at least one named parameter type.
* Use ##__VA_ARGS__ to work with empty __VA_ARGS__.
* Fix one ALOG_ASSERT parameter bug in lmkd/lmkd.c.
Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I90f35aa88527a6897954f69a35b256a157a725c5
This avoids 2 static analysis warnings:
* assigned but unused variables in __VA_ARGS__
* unused expression result in __VA_ARGS__
Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I4faae8787f6cc76de7ff4b6d08d25d0cb47324ea
Clang static analyzer can optimize out if (false) ...
and report unused variables in __VA_ARGS__.
Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I214ced736230fda847031fd4eee23015fd988ffc
* changes:
Do not customize __format__ for Windows/MinGW to gnu_printf
Adapt to switch to Clang for Windows host builds
Update cflags for building Windows modules with Clang
Bug: http://b/69933090
Bug: http://b/69933068
MinGW uses gnu_printf to force C99 printf analysis with GCC, but clang
does not support gnu_printf. So just use the default that's used for
other platforms. This also mirrors upstream commit
015e637b4b/.
Test: m native-host-cross with Clang.
Change-Id: I3deb266d70e25296c4ae1d58637afbabc3d949c1
On svelte devices, CTS test liblog#android_logger_get_ fails on the
missing kernel buffer because it is not enabled to save space.
Test: gTest liblog_unit_tests
Bug: 109669791
Change-Id: Iaf46fe9713d3462a56885515a67db640544345ab
Global flag --pack-dyn-relocs=android is used with clang lld.
For b/24465209, we need to override that with pack_relocations:false.
Bug: 24465209
Bug: 80093890
Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables
Change-Id: I4edcdf49e184fa45ea2b6b6417654d81bcd09e1d
See longer explanation in b/80093890.
Clang lld does not generate expected DT_REL and DT_RELA tags
with --hash-style=both and --pack-dyn-relocs=android.
I am not sure about the extent of b/24465209, so
I would rather not to use lld for these .so files for now.
Bug: 80093890
Bug: 24465209
Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables
Change-Id: I645dbe25c5b9975605e3af5e717ed36c276f14d4
The static analyzer is concerned about the strcpys below this, since it
apparently doesn't try to model snprintf's potential behaviors. (In
particular, it was concerned that suffixLen might be >=
sizeof(suffixBuf)). While that's clearly suboptimal, this code can also
be simplified to make it more obvious what's happening and to appease
the analyzer.
No functionality change is intended.
Bug: None
Test: Ran the analyzer. It's no longer angry about strcpy overflows.
Change-Id: I4aa812144c90f6d3e833bbcb23c0694476a0e53e
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. toybox) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.
Bug: 67916654
Bug: 64960723
Test: m -j
Change-Id: Ie59155c08890e96ce1893fa3687afcf763d7aea3
This is required in order to be able to log audit
events from wpa_supplicant. Only log writing functions
from log_event_list.h are made available.
Test: manually
Bug: 70886042
Change-Id: I097d4ad1de573662658678e6a9f1fc8f17820542