* 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
Revert "Remove obsolete workaround."
This reverts commit 1f3ac7583f.
Bug: 72143978
Bug: 24465209
Test: Tested failing case on sailfish, reverted back all CL's since
Test: 3471433 for b/24465209 and apps open
Add local BM_time_clock_gettime_*, BM_time_clock_getres_* and
BM_time_time benchmarks. Relates to the bionic benchmarks of
the same names, except adds CLOCK_MONOTONIC_RAW. Added here for
developer convenience whenever updates to the liblog or logd
code base need integration testing.
ToDo: add liblog gTests that analyse the benchmark data to confirm
that the specified integrated device has vdso access to all the
pertinent clock sources. Add liblog local benchmarks and tests to
measure the device clock drift of each possible liblog clock
source to help evaluate device configuration.
Test: liblog_benchmarks --benchmark_filter=BM_time*
Bug: 63737556
Bug: 69423514
Change-Id: Ibafe0880d976ef2b3885765f71e0ba6c99d56f2a
Remove our circa 2014 snapshot of the google benchmarking library, and
use the now very stable google-benchmark suite. Some porting effort,
and deal with some benchmarking saddle points that take too long to
sort out. Focus on minimal API changes, _odd_ new behaviors, and style.
Test: liblog_benchmarks, ensure results in about the same range
Bug: 69423514
Change-Id: I2add1df9cb664333bcf983b57121ae151b26935b
Currently used clang tidy does not filter the warnings caused
by macros, even if macros come from filtered headers.
This change allows projects using ALOGV to use
readability-implicit-bool-conversion without spreading //NOLINT everywhere.
Bug: 71533509
Change-Id: Id1b193d1e56d13f00171e04f600292877c5f6cb3
In the future, the sizes of tv_sec and tv_nsec (or even the size of
log_time struct itself) can change due to the 32-bit overflow expected
to happen in the year 2138. In order to hide such implementation details
to the clients of liblog, the two macros LOG_TIME_SEC and LOG_TIME_NSEC
are introduced.
Furthermore, vendors are provided with a simplified version of log_time.h
without C++ APIs. In doing so, log_time.h no longer includes time.h.
This breaks several modules that implicitly relied on the hidden
dependency, which should be fixed.
Bug: 37629934
Test: build with BOARD_VNDK_VERSION=current
Merged-In: If213fc291395554fd8de5f5d1fb005ceaaa5ca57
Change-Id: I01b36078c1d8f3f44824be20ae769ba1465b6feb
(cherry picked from commit 98c0d030c9)
libdl is part of system_shared_libs now. -ldl -lpthread -lm are now defaults
for host_ldlibs on Linux and Darwin. -lrt is a default for host_ldlibs on
Linux.
Test: m host
Change-Id: I0b3c147b00a8ab6ff289b85db55b88836c905f5c
Exempt-From-Owner-Approval: build system cleanup
Pstore test cases should not belong to CTS.
The test cases should be a part of GTS if really required.
Test: manual
Bug: 66431569
Bug: 63969981
Bug: 63913130
Signed-off-by: Srinavasa Nagaraju <Srinavasa.Nagaraju@sony.com>
Signed-off-by: Yoshitaka Seto <yoshitaka.seto@sony.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Tested-by: Srinavasa Nagaraju <Srinavasa.Nagaraju@sony.com>
Change-Id: Icd326403711ad268ce28a3863045fc9b2f211461
for liblog.vendor. __ANDROID_API__ is __ANDROID_API_FUTURE__
with BOARD_VNDK_VERSION=current, so we need it defined.
Bug: 33241851
Test: BOARD_VNDK_VERSION=current m libgui.vendor
(that uses liblog.vendor)
Change-Id: I340ec048094c027828f516d891250651e0c88eea
Merged-In: I340ec048094c027828f516d891250651e0c88eea
In the future, the sizes of tv_sec and tv_nsec (or even the size of
log_time struct itself) can change due to the 32-bit overflow expected
to happen in the year 2138. In order to hide such implementation details
to the clients of liblog, the two macros LOG_TIME_SEC and LOG_TIME_NSEC
are introduced.
Furthermore, vendors are provided with a simplified version of log_time.h
without C++ APIs. In doing so, log_time.h no longer includes time.h.
This breaks several modules that implicitly relied on the hidden
dependency, which should be fixed.
Bug: 37629934
Test: build with BOARD_VNDK_VERSION=current
Change-Id: I01b36078c1d8f3f44824be20ae769ba1465b6feb
don't abort it after 30s.
Adds a new CTS test to verify the behaviour.
Bug: 64143705
Test: New and existing CTS tests pass. Manual testing with logcat.
(cherry picked from commit 64acdf77d6)
Change-Id: Ic2ec131a3aee293ee865c46e62566ddd82ec2507
liblog concurrent printf tests now check every write succeeds.
logd timeout_negative tests exits as soon as one run succeeds.
Test: CTS tests till pass.
Change-Id: I9a166a0abcb8b9aa5c055c35c5dccf30616a4e24
don't abort it after 30s.
Adds a new CTS test to verify the behaviour.
Bug: 64143705
Test: New and existing CTS tests pass. Manual testing with logcat.
Change-Id: Ia67175701ed8c462083e14e26123ce8ddcb226bc
* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.
Bug: 30407689
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: Ia5a00581e718d412255d6177e5a7c286cdfbec11
Add NOLINT comment to work around clang-tidy
error in checking macro arguments used in
type expressions.
Bug: 28705665
Test: make with WITH_TIDY=1 WITH_TIDY_CHECKS=-*,misc-macro-* \
WITH_TIDY_FLAGS=-header-filter=system/core/.*
Change-Id: I7619978c1804e151a11a8b0477e80076bcf21cab
for liblog.vendor. __ANDROID_API__ is __ANDROID_API_FUTURE__
with BOARD_VNDK_VERSION=current, so we need it defined.
Bug: 33241851
Test: BOARD_VNDK_VERSION=current m libgui.vendor
(that uses liblog.vendor)
Change-Id: I340ec048094c027828f516d891250651e0c88eea
Renamed NDK headers to "liblog_ndk_headers"
(these names aren't used anywhere).
libutils_headers now properly export liblog_headers.
Test: with BOARD_VNDK_VERSION=current
Change-Id: I3a85385f588b84393c57fd6d1bcac620f708f0f1
In compiling some code with a picky "Android.mk" file, it is not happy
with a function declaration that looks like:
void foo();
It requires:
void foo(void);
This commit changes that for 2 functions in "log.h".
Test: Build both Android and the code with a picky "Android.mk".
Change-Id: Icd624df34db57e642fe6b1c7da77be9b05936936
Not only vendor libs, but also Android libs that are marked as
vendor_available are using SLOG*. Since both pure vendor libs and
Android libs available to vendors are using the same liblog headers for
VNDK, SLOG* needs to be visible via the headers.
Bug: 63088165
Test: BOARD_VNDK_VERSION=current m -j ATFWD-daemon
(or any other vendor modules using SLOG*)
Change-Id: Idfb74887a42d2418d3896bfdf5be3b4fc8e4c27f
Bug: 36140955
Bug: 35360169
Test: new unit test to ensure that all modules have this field
Change-Id: I352145965e8cd20371ccce3ba2b25f3a166bc3e8
Merged-In: Ifb7a14817265b4624f1dc6414b547c86aafcf4ac
Eliminate liblog@enoent CTS test as it is bypassed on "user" builds
in commit "liblog: test: enoent requires userdebug or eng to run".
This prevents time wasted running a test that bypasses during CTS.
Test: CtsLiblogTestCases_list --gtest_list_tests |
(grep enoent && echo FAILED)
Bug: 62030441
Change-Id: Ia440db3e74dacdc5c311c640aab3a11844cc195a
(cherry picked from commit 37eaefa9a0)
If user build and for the "kernel" log buffer, allow an empty report.
Test: CTS: User: liblog#android_logger_get_
Test: remove ro.debuggable line from /default.prop,
run liblog-unit-tests --gtest_filter=*.android_logger_get_
Bug: 62030309
Change-Id: I5f91af07608988f322b3c46574becc308e1d8b13
If user build and for the "kernel" log buffer, allow an empty report.
Test: CTS: User: liblog#android_logger_get_
Test: remove ro.debuggable line from /default.prop,
run liblog-unit-tests --gtest_filter=*.android_logger_get_
Bug: 62030309
Change-Id: I5f91af07608988f322b3c46574becc308e1d8b13
(cherry picked from commit 38dad6c9e4)
Bypass test if we do not have all the prerequisites to run this check
of liblog failure propagation. We need to be root, or be able to
call su, in order to temporarily stop logd to measure the error
response from liblog. Basically a "user" build can not have the
levers to deny or fail the logger, preventing our ability to run the
liblog.enoent test.
Test: CTS: User: liblog#enoent
Test: remove ro.debuggable line from /default.prop,
run liblog-unit-tests --gtest_filter=*.enoent
Bug: 62030441
Change-Id: I52177b8dd3c66d433bddf630e840ee088e13cddc
Bypass test if we do not have all the prerequisites to run this check
of liblog failure propagation. We need to be root, or be able to
call su, in order to temporarily stop logd to measure the error
response from liblog. Basically a "user" build can not have the
levers to deny or fail the logger, preventing our ability to run the
liblog.enoent test.
Test: CTS: User: liblog#enoent
Test: remove ro.debuggable line from /default.prop,
run liblog-unit-tests --gtest_filter=*.enoent
Bug: 62030441
Change-Id: I52177b8dd3c66d433bddf630e840ee088e13cddc
scanTagLine has some loops that do not check for a terminating nul,
problematic for responses from the logger via __getEventTag.
Test: gTest logcat-unit-tests --gtest_filter=*.descriptive
Bug: 37791296
Change-Id: Ib4e900b765b407bdee43e009d6625fe289863ddc
As far as I know, this isn't used anymore, and is causing problems when
building with bionic on the host (with the cast of open).
Bug: 31559095
Test: host bionic compiles
Change-Id: I8b6e802e2d6dcc6e8476e387a5a365903aec3be1
Move the name of the "private/libc_logging.h" header to <async_safe/log.h>.
For use of libc_malloc_debug_backtrace, remove the libc_logging library.
The library now includes the async safe log functions.
Remove the references to libc_logging.cpp in liblog, it isn't needed because
the code is already protected by a check of the __ANDROID__ define.
Test: Compiled and boot bullhead device.
Test: Run debuggerd unit tests.
Test: Run liblog unit tests on target and host.
Test: Run libmemunreachable unit tests (these tests are flaky though).
Change-Id: Ie79d7274febc31f210b610a2c4da958b5304e402
Also added log_safetynet.h header. This contains a memory sensitive logging
function which is used to detect attack attempts.
Fixes: 37442967
Test: liblog-unit-tests on internal marlin
Test: build liblog with BOARD_VNDK_VERSION := current on aosp_arm
Test: libbinder vendor variant links with BOARD_VNDK_VERSION := current
Change-Id: Icfcc2b1acbb3712bf4c84403870dc93401eafb15
(cherry pick from commit b867beac56)
The gTest should not be able to set ro.device_owner, either as a unit
test or a CTS test. The CTS test should not be able to set
persist.logd.security, the gTest may as it is run on userdebug with
root, so check if we are root to discern expectations.
Test: gTest liblog-unit-tests --gtest_filter=liblog.__security
Test: cts-tradefed run cts-dev -a armeabi-v7a -m CtsLiblogTestCases -t liblog#__security
Bug: 36480230
Change-Id: I1da88aae34da4e2fca8dd88d740eeb879d9c65bb
The gTest should not be able to set ro.device_owner, either as a unit
test or a CTS test. The CTS test should not be able to set
persist.logd.security, the gTest may as it is run on userdebug with
root, so check if we are root to discern expectations.
Test: gTest liblog-unit-tests --gtest_filter=liblog.__security
Test: cts-tradefed run cts-dev -a armeabi-v7a -m CtsLiblogTestCases -t liblog#__security
Bug: 36480230
Change-Id: I1da88aae34da4e2fca8dd88d740eeb879d9c65bb
(cherry pick from commit 9fcaaba85d)
When BOOL_DEFAULT_FLAG_ENG and/or BOOL_DEFAULT_FLAG_SVELTE is set for
flags parameter in __android_logger_property_get_bool, they can not be
overridden by a supplied property value. Reset these two flags if
there is something in the specified property.
Test: gTest liblog-unit-tests, logcat-unit-tests and logd-unit-tests
Bug: 37425809
Change-Id: I5fc2d727e8c30bc1e781f8b365f44ec62dd36b4d
When BOOL_DEFAULT_FLAG_ENG and/or BOOL_DEFAULT_FLAG_SVELTE is set for
flags parameter in __android_logger_property_get_bool, they can not be
overridden by a supplied property value. Reset these two flags if
there is something in the specified property.
Test: gTest liblog-unit-tests, logcat-unit-tests and logd-unit-tests
Bug: 37425809
Change-Id: I5fc2d727e8c30bc1e781f8b365f44ec62dd36b4d
- moved __android_log_is_debuggable to a new public header
(log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*
Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
now with no problems.
Test: boots/works on internal marlin
Bug: 33241851
(cherry picked from commit 1f83aa424f)
Merged-In: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
- moved __android_log_is_debuggable to a new public header
(log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*
Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
now with no problems.
Test: boots/works on internal marlin
Bug: 33241851
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
event_log_tag parser complains about a period (.) in the name,
we would consider such an enhancement to the tag names possible.
I expect we would want to be able to support alphanumerics,
underscore (_), period (.), minus (-), at (@) and comma (,) for
starters as they are present in the other text log buffer tags.
We introduce a local endOfTag function that is used during parsing and
during android_lookupEventTagNum for submitting new tags. This
function caused us to enforce const char more closely. By filtering
in both places we resolve an issue that could have plagued us if
garbage requests were made.
Test: gTest liblog-unit-tests, logd-unit-tests & logcat-unit-tests
Bug: 31456426
Change-Id: I596b8706e843719ddac07ec40e1cd2875c214bed
Add s to report time in seconds. The time could be a period, duration
or monotonic, expanded to seconds, minutes, hours and days. gTest has
to acquire a dynamic tag allocation as there are no users of this
feature yet.
Looking to the future, audio media logging has binary content similar
to the binary events structures Android logging uses and they have
a definition of a duration field in their internal binary logging, so
may be of use when we unify the logs.
Test: gTest logcat-unit-tests --gtest_filter=*.descriptive
Bug: 31456426
Change-Id: I262c03775983b3bc7b1b00227ce2bb2b0f357bec
write() method was one-shot, a second shot on -EBUSY would always
return -EBUSY even if successful. Reset internal error if -EBUSY
when retransmitting. write() now reports a positive count for
transmission success. Composition errors trump transmission errors.
Test: gTest logcat-unit-tests --gtest_filter=*.descriptive while
under heavy DOS stress levels of logging.
Bug: 31456426
Change-Id: Ib1920c3f10cf1df8ad8eb6a884724794b577b29d
Soong handles these automatically now.
Bug: 33241851
Test: Android-aosp_arm.mk is the same before/after
Test: build.ninja is the same before/after
Test: build-aosp_arm.ninja is the same before/after
Merged-In: Ica4eedda51bb34db2f39d2c64ea436e1f633bfc3
Change-Id: Ica4eedda51bb34db2f39d2c64ea436e1f633bfc3
Soong handles these automatically now.
Bug: 33241851
Test: Android-aosp_arm.mk is the same before/after
Test: build.ninja is the same before/after
Test: build-aosp_arm.ninja is the same before/after
Change-Id: Ica4eedda51bb34db2f39d2c64ea436e1f633bfc3
This replaces the liblog_vndk_headers with a true stub library that
exports the vndk headers, and exports the vndk-specific set of symbols.
Test: generated NDK stub maps are the same before/after
Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j (with other changes)
Change-Id: I9037241963b3872a3bc7cf7ab36a70dd4ddcf9bc
(cherry picked from commit 28dab34cbb)
There is no longer a name size limit to the properties.
Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Test: liblog-benchmarks BM_is_loggable
Bug: 36696208
Change-Id: I80706a48583192b21f532a06cb8fa183a34e5f76
There is no longer a name size limit to the properties.
Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Test: liblog-benchmarks BM_is_loggable
Bug: 36696208
Change-Id: I80706a48583192b21f532a06cb8fa183a34e5f76
This replaces the liblog_vndk_headers with a true stub library that
exports the vndk headers, and exports the vndk-specific set of symbols.
Test: generated NDK stub maps are the same before/after
Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j (with other changes)
Change-Id: I9037241963b3872a3bc7cf7ab36a70dd4ddcf9bc
Add comments so that future selves can clearly see there are no file
descriptor resource leaks on normal return.
SideEffects: None
Test: Build
Change-Id: Ieec504fea00fb849cdb69c669655a918d1334e61
Measure the cost of using a known test event log tag from
system/core/logcat/event.logtags:
42 answer (to life the universe etc|3)
Test: liblog_benchmarks BM_log_event_overhead_42
Bug: 36683634
Change-Id: Ibd4be82bebfcedd381c84e8078cf6d05a636aa98
This code was supposed to be deprecated in time. Let's make it more
efficient and add QC_RIL prefix to the list of catches to redirect
from the main logs to the radio logs.
Test: gTest liblog-unit-tests
Change-Id: I38b371b25da472ec77cbde4affeebf2eafcf6155
We would experience failures as test runs interfere with each other.
Create a unique tag for each test run signature. Switch from using
TEST_PREFIX to TEST_LOGGER to identify the logger transport being
inspected and make that part of the signature. Make sure 32 bit and
64 bit tests do not interfere.
Test: gTest liblog-unit-tests
cts-tradefed run cts -m CtsLiblogTestCases
Bug: 36232924
Change-Id: I4d58242e5ef8e68e2d4b27cecf538938e17acf3f
- __security test to allow 20ms resting time after setting ro.device_owner
- enoent test resort to using "su" command if we are not root to start
and stop the logger.
- Add some instrumentation to guide us in the future if issues.
Test: gTest liblog-unit-tests
cts-tradefed run cts -m CtsLiblogTestCases
Bug: 36232924
Change-Id: I6b926a1913497f7e6204493fc744ee6c454a5ce4
We still do not have any users of the 'frontend' interface, let's
right a wrong and rename it to 'transport' as it makes more sense.
Renames android_log_set_frontend, android_log_get_frontend and
include/log/log_frontend.h.
SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I7c1c0f3dfdc7cf047285403e306edbd16ad1324d
Standalone, this logger provides no end-to-end capability. Only
provides a writer, no reader transport. All output goes, logcat-like,
into the stderr stream. Output can be adjusted with environment
variables ANDROID_PRINTF_LOG and ANDROID_LOG_TAGS.
liblog_*.__android_log_bswrite_and_print___max print fails if a string
member is truncated with "Binary log entry conversion failed" and -1.
We expose the truncated content in the tests and in LOGGER_STDERR.
The purpose of this transport selection is for command-line tools,
providing a means to shunt the logs to be mixed in with the tool's
error stream.
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: If344b6e3e67df2dc86ce317cfad8af8e857727b7
android_log_processBinaryLogBuffer and android_log_processLogBuffer
error return should have message and messageLen fields set to zero,
or to a valid-but-truncated buffer so that we can discern the
difference. This will resolve an issue with reporting content from
an uninitialized field in liblogcat should caller add --debug flag.
To enhance the debugging capability, truncated string events because
of the logger limits are provided rather than dropping the field, but
still with an error return.
Some minor coding style issues resolved. Add required, or remove
extraneous spaces. Use C-style comments only.
Test: gtest liblog-unit-tests
Bug: 27405083
Bug: 35326290
Change-Id: I4a7ddd7278fb1c582f921e1ba10e0765fadb791b
Deal with cache miss in the event tag map resources and switch to
"Plan B" to ask long-path to logd for a determination on the tag,
name and format.
logcat-unit-tests liblogcat.descriptive does an under-the-hood call
to logd to add a new logtag but the in-process mapping fails to
pick it up because the /dev/event-tag-map map is SHARED PRIVATE for a
few moments to garner some (linux) efficiency with other copies that
are in the process. Without the workaround of marking the mapping
dirty to be reread, we are using this change as the proper workaround
that fixes the later parts of this test.
Test: gTest logcat-unit-tests --gtest_filter=liblogcat.descriptive
Bug: 31456426
Bug: 35326290
Change-Id: Ibe54d4df00ed92248e1e644ecebc95f60b222b4d
Logd currently checks against LOG_ID_MAX and LOG_ID_KERNEL to
determine if a given log_id is available. liblog uses only
LOG_ID_KERNEL. While this matches with the comments in log/log_id.h
to always keep LOG_ID_KERNEL at the end it does not match with other
checks that logd makes, causing inconsistent behavior. This
inconsistency is noticable on devices that errantly rewrite
LOG_ID_MAX to not equal LOG_ID_KERNEL + 1. For log buffers with
id's greater than LOG_ID_KERNEL, liblog reports that logd is
unavailable while logd would accept the request.
The guideline is to not use buffer ids above LOG_ID_KERNEL.
This hardening change prevents an inconsistency that results if these
guidelines are not followed. Partners are urged instead to increase
LOG_ID_KERNEL locally to match their LOG_ID_MAX - 1 when they add new
local log buffers in their private builds.
Signed-off-by: Evan Ralston <eralston@amazon.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: compiles. no functional change
Change-Id: Icd4b12ac79c1e5cd1d8a32f67a9795797580aad5
causes a regression, logcat -b kernel does not work.
Check should have landed in logd_writer.c
This reverts commit 2c2337a293.
Change-Id: I1004b44ecc87f5d83d1c4463dd8b1ac16499706d
- Create the local-only logger module
- Add LOGGER_LOCAL flag to android_set_log_frontend to enable
- Permit log reader for host compilation
android_set_log_frontend(LOGGER_LOCAL) will result in logs going
into application local memory. logcat can not retrieve the data,
the user must utilize the log reading interface directly to
acquire their own logs. Some local logger tests dropped as they
represent testing other liblog facilities. Other local logger
tests dropped because we make the conscious decision to not
support LOG_ID_SECURITY logging.
ToDo: Some local logger tests dropped because of missing
functionality associated with blocking reader.
Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
logcat-unit-tests, liblog-benchmarks and CtsLiblogTestCases_list
Bug: 27405083
Change-Id: Ia23b932af9e05756eaa60bab9139876b14faf72d
Add __android_log_config_read_close() and
__android_log_config_write_close(). Fortify the list macros
to detect for list corruption, looking for entries pointing
to themselves, deleted entries in list.
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I33e8a0cae7e202f1989ddd7c2a96752b44c8e746
Add list of android_log_logger_list entities as a way of
accessing the list of transport contexts from within
one of the transports. This will enable us to iterate back
to an internal transport context which may house a last index
or signalling semaphore to propagate a wakeup on a blocking
read.
Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
logcat-unit-tests
Bug: 27405083
Change-Id: I0a5e793946c020d97ffe10192369998e4ed92a83
- cleanup of some style issues
- resolve a few minor bugs
- add -lrt for host so that clock_gettime can be issued
- enable write-only logging, logprint and event list
handling tests for host consumption.
NB: CtsLiblogTestCases_list is only outlet for host testing of
the interfaces, but it is not part of any automated testing
Test: gTest liblog-unit-tests, liblog-benchmarks and
CtsLiblogTestCases_list && build mmma system/core/liblog
Bug: 27405083
Change-Id: I13db1f45f67569407587a5a909248de33809b8cf
Additional benchmarks to check the effects and performance of the
frontend changes.
Test: manual liblog-benchmarks
Bug: 27405083
Change-Id: I2a9dba81b70e9d71cdb8de1b35e8dff099ad6038
android_set_log_frontend allows one to select LOGGER_DEFAULT,
LOGGER_LOGD or LOGGER_NULL, the latter allows a runtime mechanism to
turn logging on or off. LOGGER_DEFAULT is LOGGER_LOGD.
Test: gTest liblog-unit-tests notably liblog.android_set_log_frontend
and liblog-benchmarks before and after.
Bug: 27405083
Change-Id: I365dbee9f7d83112da0ef8d1cace748d247773c8
The behavior of passing NULL to c-string functions is undefined.
Test: passed clang-tidy checks
Bug: none
Change-Id: Ie7bcc43cd19bc4a1c314381af3929eae0a6154b9
Logd currently checks against LOG_ID_KERNEL to determine if a given
log_id is available. While this matches with the comments in log.h to
always keep LOG_ID_KERNEL at the end it does not match with other
checks that Logd makes causing inconsistent behavior. This
inconsistency is noticable on devices with log buffers with id's
greater than LOG_ID_KERNEL and liblog reports that logd is unavailable
while logd would accept the request.
Test: compiles. no functional change
Change-Id: I0302d9e3f2657706fdf778f1e78e5604abf566e2
If we don't output to stderr too, not only is it annoying to shell users (who
won't see anything), it prevents us from writing better gtests that actually
make assertions about the assert message.
Bug: http://b/23675822
Test: libutils tests still pass
Change-Id: I62b3144c385cba4dde485f0b0f9b42aeaef51e9a
android_lookupEventTagNum added. Adds support for creating a new
log tag at runtime, registered to the logd service.
Tested on Hikey, all services stopped, shell only access, CPUs not
locked (there is enough repeatability on this platform).
$ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEventTagNum
iterations ns/op
Precharge: start
Precharge: stop 231
NB: only Tag matching, linear lookup (as reference, before unordered_map)
BM_lookupEventTagNum 1000000 1017
NB: unordered_map with full Tag & Format lookup, but with Tag hashing
BM_lookupEventTagNum 2000000 683
NB: with full Tag & Format hash and lookup for matching
BM_lookupEventTagNum 2000000 814
NB: only Tag matching (Hail Mary path)
BM_lookupEventTagNum 5000000 471
Because the database can now be dynamic, we added reader/writer locks
which adds a 65ns (uncontended) premium on lookups, and switch to
check for an allocation adds 25ns (either open code, or using
string_view, no difference) which means our overall speed takes 90%
as long as the requests did before we switched to unordered_map.
Faster than before where we originally utilized binary lookup on
static content, but not by much. Dynamic updates that are not cached
locally take the following times to acquire long path to logd to
generate.
BM_lookupEventTag 20000000 139
BM_lookupEventTag_NOT 20000000 87
BM_lookupEventFormat 20000000 139
BM_lookupEventTagNum_logd_new 5000 335936
BM_lookupEventTagNum_logd_existing 10000 249226
The long path pickups are mitigated by the built-in caching, and
the public mapping in /dev/event-log-tags.
SideEffects: Event tags and signal handlers do not mix
Test: liblog benchmarks
Bug: 31456426
Change-Id: I69e6489d899cf35cdccffcee0d8d7cad469ada0a
android_openEventTagMap(NULL) will open and mix content from
/system/etc/event-log-tags and /dev/event-log-tags. Only
reports identicals if global.
Test: gTest logd-unit-tests and liblog-unit-tests, liblog-benchmarks.
Bug: 31456426
Change-Id: Ic17d52a7829a4daaf013828d08fc1c09446ae8ef
Add a hidden -v nsec flag to logcat (actually logprint in liblog.so)
so that we can do more exacting tests of logcat.tail_time. Halve the
spam pressure of logcat.tail_* in inject() routine, and give us a few
more retries at the higher counts. Add instrumentation to
logcat.logrotate failures. Add inject for logcat.year test.
Test: gTest logcat-unit-tests
Bug: 34454772
Change-Id: If6f3bd21892c8a2b9ccee8c8bbf592a1ae0b2a57
Use refreshed android/log.h for NDK
This effectively a modern revert of the commit
b7c3996f7c
Test: build
Bug: 30465923
Bug: 34250038
Change-Id: I7d4a5134bb711051283c36a2d5bc803436dca12e
The visibility macros just expand to the defaults, so this isn't
needed anyway.
Test: mm
Bug: http://b/34740564
Change-Id: If0ba6b412554300823219405c1e801ceec747dd0
Move log reading definitions to their own home.
struct logger_entry
struct logger_entry_v2
struct logger_entry_v3
struct logger_entry_v4
LOGGER_ENTRY_MAX_PAYLOAD
LOGGER_ENTRY_MAX_LEN
struct log_msg
android_logger_get_id()
android_logger_clear()
android_logger_get_log_size()
android_logger_get_log_readable_size()
struct logger_list
android_logger_get_statistics()
android_logger_get_prune_list()
android_logger_set_prune_list()
android_logger_list_alloc()
android_logger_list_alloc_time()
android_logger_list_free()
android_logger_list_read()
android_logger_open()
android_logger_list_open()
Deal with a possible scenario where fcntl.h was not included at the
top of the source files, and log/log_read.h inclusion of fcntl.h
conflicts with a source file inclusion of sys/cdefs.h definition of
__unused macro.
Test: gTest liblog-unit-tests --gtest_filter=\
liblog.__android_log_write__android_logger_list_read:\
liblog.android_logger_get_
Bug: 34250038
Change-Id: Ib33544171563d6a351164754c254c4385686025b
Move common log_id_t and simple internal support function definitions
that use it from log/log.h to log/log_id.h.
log_id_t
__android_log_buf_write
__android_log_buf_print
android_name_to_log_id
android_log_id_to_name
Test: gTest liblog-unit-tests --gtest_filter=\
liblog.log_id:\
liblog.__android_log_buf_print:\
liblog.__android_log_buf_write:\
liblog.__android_log_buf_print__concurrent64
Bug: 34250038
Change-Id: Iad3704cc72943a3094e1193a6d032c7f29a6cd5c
move LOG macros to log/log_main.h
move include/android/log.h to liblog/include/android/log.h
Test: compile of all components and gTest liblog-unit-tests
Bug: 34250038
Bug: 30465923
Change-Id: If182dd9b83689e8b7bc1a44b2f5d913c7ee5eeee
ASan runtime library depends on liblog, so we have to disable ASan,
but nothing else.
Bug: 33091541
Test: SANITIZE_TARGET=address keeps working
Change-Id: I6e22925b7f1d5ec86fe1bd8c00dba4c3e86ddf3f
Moved headers from include/libcutils and include/liblog to
libcutils/include and liblog/include respectively, so they can be
exported via these libs. They needed to be moved since Soong does
not allow export from external folder.
Added symlink from old locations. They are needed since Soong
includes system/core/include by default. Once all modules are
cleaned up to explicitly add the required libs, the symlinks will be
removed.
Also added liblog_vndk_headers that exports a special log/log.h for
VNDK.
Moved headers of libcutils to libcutils_headers. They should be used
by modules for header-only inlines. Added libcutils_headers as
dependency of libcutils.
Added libcutils_vndk_headers that exports a special cutils/log.h
deprecating usage of the file. A later CL will deprecate the one in
libcutils_headers
Test: Add above libs to shared lib of local module
Change-Id: I6e1f9c5f23d8b6eae13dc3b7e5dfe7fae93b8510
This reduces BM_log_latency from ~300ns to ~100ns. Because, well, we
read the clock earlier and that is what BM_log_latency tries to
measure. The one major improvement in the switch from kernel logger
to user space logger was that we picked up the timestamp in the
context of the caller before doing anything else, but alas changes
over time neglected this fact and placed isloggable checking ahead
of this important fact.
Test: liblog_benchmarks, check results
Change-Id: I4bc9fc3cf8b1659e88417d967b1d0f3743f9e456
I'd like to mark setuid() WARN_UNUSED_RESULT to prevent security bugs.
This line would break because the file is compiled with -Werror.
Bug: 34251640
Test: Build, run unit test.
Change-Id: Ibb6fa5e5b899d47f77f2a32da762165de310101d
Deal with recovering after transitory failures surrounding logd
crash or recovery. Improve the chances that the logging functions
can work in a signal handler, not officially supported, but making
sure logging is not blamed for system lockups when misused.
Reorder gTests so that setuid(AID_SYSTEM) is performed after
liblog.enoent test, and that this occurs after other tests that
like to see buffers with content in them as we stop logd.
Test: gTest liblog-unit-tests --gtest_filter=liblog.enoent
Bug: 33755074
Change-Id: I66f88599534614b7b61da6b2ae5fe099ebaced3a
Some tests use hard-coded offsets to interpret the binary
events buffers. Switch to using the private event structures
to access the components of common event messages.
Test: gTest liblog-unit-tests
Bug: 33755074
Change-Id: I17447814583099d5ec417a54389e962158456005
toybox has a #define noreturn that trips over this.
Also move `format` out of the way, just in case.
Bug: https://github.com/android-ndk/ndk/issues/271
Test: builds
Change-Id: Ib8811136b4b422ff74625509539a5464a3c9af18
IF_ALOG_RATELIMIT()
ALOGE("Only one message globally using IF_ALOG_RATELIMIT()"
" in the process may appear ever ten seconds,"
" (%s)", strerror(errno));
static time_t last; /* initial state zero */
IF_ALOG_RATELIMIT_LOCAL(60, &last)
ALOGE("Only one message locally may appear every minute,"
" (%s)", strerror(errno));
These new calls are guaranteed not to affect the value of a
non-zero errno to simplify logging of errors. However, the
ALOGE calls in the above examples may update the errno value
upon their return.
Test: gTest liblog-unit-tests --gtest_filter=liblog.__android_log_ratelimit
Bug: 33535908
Change-Id: Id8cc192fc7d14504ffd418933cf88ae945c089f2
>3 times faster access for lookup functions. Code simplification and
C++ coding style conversion. android_lookupEventTagNum has been
expanded to utilize the Format match, and then drops down to just
Tag match.
Performance testing on Hikey, all services stopped, shell only access,
CPU not locked had good repeatability.
$ adb reboot ; adb wait-for-device ; adb shell su root stop
Before this adjustment using binary search:
$ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEvent*
iterations ns/op
Precharge: start
Precharge: stop 231
BM_lookupEventTag 10000000 153
BM_lookupEventTag_NOT 20000000 139
BM_lookupEventFormat 10000000 153
After this adjustment strictly using std::unordered_map lookup:
$ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEvent*
iterations ns/op
Precharge: start
Precharge: stop 231
BM_lookupEventTag 50000000 56
BM_lookupEventTag_NOT 100000000 21
BM_lookupEventFormat 50000000 56
Test: gTest logd-unit-tests and liblog-unit-tests, liblog-benchmarks.
Bug: 31456426
Change-Id: I1cfc3d641c3ea9ab08d455efe0c844d3a6381440
NB: recent activities on event_tag_map.c were to allow
this transition to be unremarkable.
Test: compile
Bug: 31456426
Change-Id: I13e1771a001874244711a5ac3023861c2a5f8c7d
Robustness fortification. Deal with gtest failure if event-log-tags
file is updated, adb sync for example, and thus will report
Shared_Dirty instead of Shared_Clear. Add check for Private_Dirty
and Private_Clean being clear at zero too as a bonus.
Test: gTest liblog-unit-tests --gtest_filter=liblog.event_log_tags
Bug: 31456426
Change-Id: Id912929fdd65499aa532a15653ef387a997a5054
Some of the __BIONIC__ checks were actually looking for an android
device. Host bionic has __BIONIC__, but not __ANDROID__.
Bug: 31559095
Test: Test linux_bionic compile
Change-Id: Ia0ca36fc9486fe8ea7e5d1b2e26ab0491903723c
Utilize liblog-unit-tests as a CTS test
Replacement for EventLogTest#testWriteEventWithOversizeValue
along with some other mandatory logging functionality.
Test: run cts tests
Bug: 26235244
Change-Id: I71f549bd0b93f6c41e1f91565b0fbddf042e4991
NULL represents system default. In the future, NULL could represent
static and dynamic tags, which can come from multiple files based on
implementation details in the liblog library.
Test: gTest logd-unit-tests & liblog-unit-tests
Bug: 31456426
Change-Id: I0e3d296de81ca299ae63d7b83781639ee67ec298
Allows us to compose an event message for our own in-memory purposes.
Will be used to compose an event message in logd and directly write
it to just the pmsg buffer. Provide an internal enhanced C++ wrapper
for event handling.
Test: gTest liblog-unit-tests --gtest_filter=liblog.android_log_write_list_buffer
Bug: 31456426
Change-Id: I98246898ba580f9e506baba8af2fd1b26a2a8aae
rename class from android_log_event_context to android_log_event_list
Test: gTest logcat-unit-tests
Bug: 31992412
Bug: 31456426
Change-Id: Ib61cbca7d453837d64959c56b0e11f8c5edbfbdd
We need to accept that a log tag can contain no payload. For those
that are corrupted, and to aid debugging, report what we did manage
to interpret. Report last character as a ! for corruption, and ^
for truncation. Fix a few Android Coding standard issues.
Test: gTest logcat-unit-tests
Bug: 32903864
Change-Id: Id11bef3a7b6569305c51701dd66c45d2038d6628
Followup to c/278768 where failure to open tag map can
result in segment violation in android_closeEventTagMap.
Add check for pointer value = -1 to bypass call to close.
Test: gTest liblog-unit-tests, logcat-unit-tests & logd-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: I20547e55d7e29682fde4538bc1fc6d83b4535d49
Expand logprint feature to pull out the log tag description
fields, parse them and merge into the logging content. Add
-v descriptive, -v colour(british, hidden) and -v help. Also
added a unit test for the descriptive format borrowing from
event tags that have been unchanged since 2009.
Had to add -v help because we have too many undocumented
formats and format adverbs.
Test: gTest logcat-unit-tests --gtest_filter=logcat.descriptive
Bug: 31456426
Change-Id: I93a1c003b7a3f4c332544946fdedb7277919cec3
NB: bionic stdio is broken when providing appropriate errno value(s)
on failure so libc.__pstore_append will not report pmsg
misconfigured correctly on android for now.
Test: misconfigured kernel, watch for this message in liblog-unit-tests
Change-Id: Ifb1b550c7d3a3888000459c2f68c392cc23c379f
log/logger.h pieces moved into log/log.h. Correct for some
minor Android Coding standards.
Test: gTests liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I0a19fd8788eec20a582e72e4c62c04534bdb1b9a
We went too far, so this is a partial revert, part deux.
Keep general purpose logging macros in android/log.h for the NDK.
More internal features like Radio, System and Events logging are
moved back to log/log.h. Correct liblog ndk symbols. Correct for
some Android Coding standards.
Test: compile
Bug: 31992412
Change-Id: Id3731496fa226e8c170305d0d2a1859e8cf67e14
Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.
Correct liblog/README
Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.
Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
Add private function __android_logger_get_buffer_size() to read
properties and compose the default buffer size. This interface
complements the existing android_looger_get_size() which returns
the logd setting which can differ at runtime. For use in logd
and dumpstate. Side effect is we also add the private functions
__android_logger_property_get_bool() and
__android_logger_valid_buffer_size() for reuse in logd.
Test: gTest liblog-unit-test, logd-unit-tests and logcat-unit-tests in
combination with commit 'logd: Use private interfaces for
buffer size properties'
Bug: 31750617
Change-Id: Id95cb68f775ef6b427c122e10f6f8291d336d184
system/core/android/log.h needs some work before it can be included in
the NDK. It defines a *lot* of macros that previously were usable
names in NDK sources that used android/log.h. As an example, the
following file defines LOG_TAG as a variable, but the variable name
gets macro replaced if we use the current android/log.h.
4adc1515f8/framework/platform/android/tcuTestLogParserJNI.cpp (41)
For now, we keep a copy of the old NDK android/log.h in
legacy-ndk-includes.
Test: make checkbuild
Bug: http://b/30465923
Change-Id: I8ce942d1ee2f8f0d4c27130802c03992a1b85ec4
Allow our own libraries to use this privately instead of
running the less efficient get_properties and doing the math.
Test: compile and boot smoke test
Bug: 27566046
Bug: 31456426
Change-Id: I2f677276d27fbcb6af01b600ac1d9891c8938d43
__android_log_pmsg_file_write() will open /dev/pmsg0 if not
already, and will close it if we opened it.
Added atomic access to the android_log_context as insurance.
Fortify and correct pmsg tests.
Test: gTest liblog-unit-tests --gtest_filter=liblog.__android_log_pmsg_file_*
Bug: 31958686
Change-Id: I2cf6f971b6968938f471fda67367efe20dae3004
debuggerd does not require log/logger.h, can use android/log.h
In some cases, mark why log/logger.h was required.
Test: Compile and boot smoke test
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: Ia34987e25a01d81971ec8d785415f732b8376c4f
Allows us to mitigate the impact of MAP_PRIVATE and copy on write by
calling android_lookupEventTag_len instead of android_lookupEventTag,
and delaying the copy on write impact to the later. We return a
string length in a supplied location along with the string pointer
with android_lookupEventTag_len(const EventTagMap* map, size_t* len,
int tag). The string is not guaranteed to be nul terminated. Since
android_lookupEventTag() called even once can cause the memory
impact, we will mark it as deprecated, but we currently have no
timeframe for removal since this is a very old interface.
Add an API for __android_log_is_loggable_len() that accepts the non
null terminated content and fixup callers that would gain because the
length is known prior to the call either in the compiler or at
runtime. Tackle transition to android_lookupEventTag_len() and
fixup callers.
On any application that performs logging (eg: com.android.phone)
/proc/<pid>/smaps before:
xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 463 /system/etc/event-log-tags
Size: 20 kB
Rss: 20 kB
Pss: 1 kB
Shared_Clean: 0 kB
Shared_Dirty: 20 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 0 kB
Anonymous: 20 kB
AnonHugePages: 0 kB
Swap: 0 kB
SwapPss: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac
/proc/<pid>/smaps after:
xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 1773 /system/etc/event-log-tags
Size: 20 kB
Rss: 20 kB
Pss: 1 kB
Shared_Clean: 20 kB (was 0kB)
Shared_Dirty: 0 kB (was 20kB)
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 20 kB (was 0kB)
Anonymous: 0 kB (was 20kB)
AnonHugePages: 0 kB
Swap: 0 kB
SwapPss: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
VmFlags: rd wr mr mw me ac
Added liblog-unit-tests --gtest_filter=liblog.event_log_tags to
check for Shared_Clean: to not be 0 and Anonymous: to be 0 for
all processes referencing event-log-tags. Which can include multiple
references to /system/etc/event-log-tags and future possible refs to
/data/misc/logd/event-log-tags and /dev/event-log-tags. We want
failure messages to help point to errant code using the deprecated
interface.
This change saves 1/4MB of memory or more on a typical system.
Test: gTest liblog-unit-tests
Bug: 31456426
Change-Id: I9e08e44d9092bd96fe704b5709242e7195281d33
Allow logd to add another "consecutive" log tag
Test: gTest liblog-unit-tests, check for liblog in logcat afterwards
Bug: 31456426
Change-Id: I0c25e038878ec9a0cf368a33a63f8345c68749c3
Move all liblog related content into android/log.h, and make
log/log.h points to android/log.h.
Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I858e0ebe047b86f2a8530a99bc9c380d3d58edbb
Should use log/log.h and in some cases android/log.h instead. Can
not remove file because still in use by partners, so log/logd.h
points to log/log.h.
Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I3580d46154617abb7231027a44f4ab9ee023febf
Always used in combination with log/logger.h except in log_time.cpp,
and not used externally. As a result liblog has to support stl, a
small price to pay since goal is to convert liblog to C++ internally.
Test: compile
Bug: 31456426
Bug: 26552300
Bug: 31289077
Change-Id: I72828ec807d0a2c8e40bbdebd7a69f147a7ca5a9
Cleanup.
Save the errno for the calls that fail, and reinstate them for
return. Drop fprintf stutter, one succinct line. Solve a memory
leak in close. Change android_lookupEventTag() to use an
unsigned int so that we can use the full range of uint32_t tags.
Make sure this file compiles clean in C++.
Test: gTest liblog-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: I6a5efa6fb7e991431caba75ef0971e111968f6bf
There is no leak since a reference always remained and could get
reused. It just makes sense to also close the event tag map as well
if logging is closed. If we close we also have to fix a tagArray
leak in android_closeEventTagMap().
NB: __android_log_close() already makes an assumption that another
thread is not logging at the same time, which is true in all callers
at this time. There are some partial mitigation strategies if
__android_log_close() is called asynchronously, but not completely
solved at the cost of a lock for every logging call.
Test: gTest liblog-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: Ib76ad9302dba4d3f35250213f4dfef22498af238
- check hdr_size to make sure it is in the expected range
from sizeof entry_v1 to entry (entry_v4).
- alter msg() method to report NULL on invalid hdr_size
- alter all users of msg() method.
Bug: 30947841
Change-Id: I9bc1740d7aa9f37df5be966c18de1fb9de63d5dd
Bionic getuid() and getpid() calls cache to reduce the need to
perform a syscall, and also reset their own cache after a vfork().
No more need for liblog to be performing this flawed cache operation.
Bug: 30085794
Change-Id: I70feed8bff0ddd919c2885a348ba67b14ddc0e0d
Soong is always on now, so we don't have to distinguish between
makefiles that should be ignored because Soong is handling them with an
Android.bp file, and makefiles that are still needed with Soong. All
obsolete Android.mk files have been removed, rename all Android.soong.mk
files to Android.mk.
Change-Id: Iabbddcbfb2c837cfd4556241b570474452cc5d4d
These directories all have Android.bp files that are always used now,
delete the Android.mk files.
Change-Id: I8b0c89072a660c4a7a30fcefc76a7bbe247df977