Commit graph

68 commits

Author SHA1 Message Date
Jeffrey Huang
66f58a3ecc Add apex available to liblog
Bug: 145923087
Test: m -j
Change-Id: I3ac890cbc71ad062ff095adfa2272f6f76db466b
2020-02-13 12:46:09 -08:00
Tom Cherry
e2187bfbbc liblog: remove fake_log_device
This is now dead code as __android_log_stderr_logger() has superseded it.

Bug: 147496863
Test: build
Change-Id: Ibdea2961ec4fc093bf9e35581dc1c46db2cff06a
2020-01-28 10:42:02 -08:00
Yifan Hong
7dd4553991 Make ramdisk_available.
Test: pass
Bug: 147347110
Change-Id: I9787e386e552393efc5beed5aac577be9ce1a3c5
2020-01-22 16:47:14 -08:00
Chong Zhang
265eee2006 Add version #29 and #30 to liblog
bug: 147759770
test: build
Change-Id: I38bcab9bc14088adbdbc3a92620f89a6fe397994
2020-01-16 11:11:44 -08:00
Tom Cherry
ee747e7dfa liblog: don't destroy global mutexes
Some objects may log when they're destructed, so don't destroy the
global std::mutex in fake_log_device.cpp.

Test: AAPT works with a log in VectorImpl::finish_vector()
Change-Id: Ie5a0ac9fc4e6a137e9516059a831e499d55d5ddb
2019-12-20 16:13:00 -08:00
Tom Cherry
06e0fced63 liblog: have writers handle their own state
Remove the transport available and open functions since the writers
are able to manage their own state.  Remove the initialization dance
with write_to_log, since it is unneeded once this is removed as well.

Remove the global lock around the close() functions as correct locking
has been added to the writers in a previous change.

Test: logging works, liblog-unit-tests
Change-Id: If7fa11e773763d0b5fcb2e696ad1c88ff4a4cfdf
2019-12-12 16:19:08 -08:00
Tom Cherry
c619e49f74 liblog: simplify fake_log_device
This still fakes the long removed /dev/log devices, whereas it only
needs to print to stderr, so simplify that code.

Use std::mutex now that it is C++ to easy portability concerns.

Use the proper liblog headers for formatting information instead of
hardcoding a copy.

Test: liblog-host unit test
Change-Id: I310a6e7ad939960300eafa729cbfc535c5ced445
2019-12-11 07:20:37 -08:00
Tom Cherry
896fb9e57a liblog: disable header_abi_checker
I'm about to make a bunch of changes that are safe for backwards
compatibility, but would otherwise flag the checker, so it's time to
temporarily disable it.

Test: CLs pass despite making header changes
Change-Id: Ibc2d4ae51fb8e6125b9117ccd92bf821db945e67
2019-10-24 10:52:25 -07:00
Tom Cherry
2beabe5c26 liblog: remove config_write.cpp/.h
Now that we only have one transport in a given build configuration,
there is no need to have these lists.

Test: liblog-unit-tests
Change-Id: I3fdcdc33c1224a9522080ea06f36f14c83d946ac
2019-10-01 13:05:58 -07:00
Tom Cherry
2238ce2d7f liblog: remove stderr logger
There are no users of the liblog stderr logger, but 66 users of
android::base::StderrLogger.  We'll prefer that format and work to
merge it into liblog.

Test: liblog-unit-tests
Change-Id: Ifad24b27ac0f51379b925f6644caa1f6f3d9ad81
2019-09-30 13:51:09 -07:00
Tom Cherry
7d045f6b74 liblog: add -Wall,-Wextra and do related clean-up.
Test: build
Change-Id: I3b33f2b896cb8bf7ad9edf110d1739d559028282
2019-09-30 12:58:55 -07:00
Tom Cherry
f7e1b1ebd4 liblog: only allow one transport for reading
liblog has left over code from local_logger that allows for reading
from multiple sources and merging the contents.  Since we've already
removed local_logger, this change removes the rest of this code.

Test: liblog-unit-tests
Change-Id: I5685ad6c1e7cbcaa0a660ed10f47714784a40791
2019-08-26 19:50:32 -07:00
dimitry
a808b1150a Enable native_bridge_support
Enable native bridge support for libbase, liblog,
libziparchive and libpropertyinfoparser.

This makes it possible to use them in binaries for translated
architectures.

Bug: http://b/77159578
Test: make
Change-Id: If67ce92288b17a052ea1e79a268e284f7d941439
2019-05-06 14:05:05 +02:00
Vic Yang
270f65ffdb Version liblog LL-NDK library
The system version of liblog has been versioned.  Do the same for
LL-NDK verison as well.

Test: Build and examine the dynamic symbols.
Change-Id: Ie63cc845c891d9372fb1990e713b3fe4f0f2f723
2019-04-02 12:22:50 -07:00
Tom Cherry
fe1f701761 liblog: add stubs variant
Ensure that only the symbols in liblog.map.txt can be used by the
platform.

Bug: 123349183
Test: build
Change-Id: I99ae5d0e8ba8f5061ec20701c941d861c9eb615d
2019-02-20 12:32:12 -08:00
Elliott Hughes
3c3bdc128f liblog: make liblog_headers truly stand-alone.
We don't want to imply dependencies on libc or libc++.

Bug: https://issuetracker.google.com/issues/119713191
Test: boots
Change-Id: I4abe312e73fad3ca8e96abd328b16387507baed4
2019-02-13 12:42:06 -08:00
Tom Cherry
2d9779e87b liblog: remove visibility macros
Visibility is managed through version scripts now.

Bug: 123349183
Test: build
Change-Id: Ia388611a2ec14d0ff9c3896cfe97ccdce17dbb8b
2019-02-08 11:48:19 -08:00
Tom Cherry
44f0023e81 Add a version script for liblog for the platform
liblog has a version script for the NDK and VNDK, however it doesn't
have symbols intended to be used by the platform.  This change adds
those symbols to the version script and enables it, hiding the rest of
the symbols.

Test: build
Change-Id: I494d048d78bb47d763482eb56a6f79babfe163f4
2019-01-17 11:46:31 -08:00
Tom Cherry
e181bf5116 Merge "Remove liblog/uio.c and <log/uio.h>" 2019-01-17 17:19:52 +00:00
Tom Cherry
6f6ef39b48 Remove liblog/uio.c and <log/uio.h>
readv() isn't used by anyone, writev() has one easily replaced user.
uio.h can be left as a private header for windows compatibility with
struct iovec.

Test: build
Change-Id: I33d4c6bdee6fd818271f78ae06abdd2aa09430f2
2019-01-16 14:26:36 -08:00
Tom Cherry
3b4bddc638 Remove liblog's rate limiting
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
2019-01-16 10:37:14 -08:00
Tom Cherry
71ba16488b liblog: convert to C++
Bug: 119867234
Test: liblog, logcat, logd unit tests

Change-Id: I2a33b6fc37f9860c0041e3573bfb59ea389f623c
2019-01-15 15:57:33 -08:00
Tom Cherry
d1febd3316 liblog: remove LOGGER_LOCAL
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
2019-01-10 10:39:35 -08:00
Chih-Hung Hsieh
462df10d91 Work around b/24465209, do not pack relocation table.
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
2018-05-24 09:34:54 -07:00
Chih-Hung Hsieh
0f975a2099 Work around b/24465209, do not use clang lld
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
2018-05-23 17:15:48 +00:00
Jiyong Park
612210c75b Mark as recovery_available: true
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
2018-05-15 09:47:04 +09:00
Ian Pedowitz
7bb9785a1d Fixing app compat issue b/72143978
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
2018-01-18 16:25:24 -08:00
Elliott Hughes
1f3ac7583f Remove obsolete workaround.
Bug: http://b/24465209
Test: manually ran the app.
Change-Id: I573d2480c70632b100096ba6b2029bfc335595d6
2018-01-09 14:43:00 -08:00
Steven Moreland
e1c834db04 Use override_export_include_dirs.
Bug: 62878521
Test: soong build system finds renamed attribute
Change-Id: I51e42f4378db366b8711cd373fb835fecda88416
2018-01-05 14:42:12 -08:00
Steven Moreland
95d7cbb77a Add vendor_available to liblog_headers.
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
Merged-In: I3a85385f588b84393c57fd6d1bcac620f708f0f1
Change-Id: I3a85385f588b84393c57fd6d1bcac620f708f0f1
(cherry picked from commit 42b485cc53)
2017-10-17 12:09:50 +09:00
Dan Willemsen
a0113de2f3 Merge "Remove default libraries"
am: 8b7feee38f

Change-Id: Ic39ecabd37ffe06ba3a119410b5dcd4885fb584c
2017-09-30 23:32:45 +00:00
Dan Willemsen
1e45d533b3 Remove default libraries
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
2017-09-29 13:17:06 -07:00
Steven Moreland
25db8dc21b Add vendor_available to liblog_headers.
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: I7b2d9e77e313e3f2ef362a19a03f4c23874d589a
Merged-In: I3a85385f588b84393c57fd6d1bcac620f708f0f1
2017-09-06 12:55:32 -07:00
Dan Willemsen
c8202dc5f7 Remove .(ll)ndk suffix from (ll)ndk_library
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
2017-04-10 12:54:31 -07:00
Dan Willemsen
38b4a9265d Add LLNDK liblog stub library for the VNDK
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)
2017-04-07 20:35:02 -07:00
Mark Salyzyn
4d99c986d9 liblog: add LOGGER_STDERR frontend
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
2017-03-08 07:17:31 -08:00
Mark Salyzyn
7100288532 liblog: add local_logger
- 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
2017-02-08 15:07:06 -08:00
Mark Salyzyn
62d0d2d683 liblog: add logprint to host build
- 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
2017-02-08 13:37:44 -08:00
Mark Salyzyn
bdac221cc3 Revert "Continue using the legacy NDK android/log.h."
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
2017-01-30 22:14:59 +00:00
Vijay Venkatraman
651f8383e6 Revert "Revert "Exporting C headers from system/core""
This reverts commit a3f2be2b73.

Test: compile
Change-Id: I04b3a8e47e1fa3eb9d80c14ae3a90c68a780e858
2017-01-25 12:50:29 -08:00
Vijay Venkatraman
22b7f76a00 Merge "Revert "Exporting C headers from system/core"" 2017-01-25 00:53:07 +00:00
Vijay Venkatraman
a3f2be2b73 Revert "Exporting C headers from system/core"
This reverts commit 3c6763ca21.

Change-Id: If3b3e106478d28a5df927d57649abdca0a99dd0e
2017-01-25 00:44:08 +00:00
Evgenii Stepanov
f38ae34bbc Merge "Don't disable all sanitizers in liblog, just asan." 2017-01-24 23:00:54 +00:00
Evgenii Stepanov
ffdabdc6f2 Don't disable all sanitizers in liblog, just asan.
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
2017-01-24 12:57:23 -08:00
Vijay Venkatraman
3c6763ca21 Exporting C headers from system/core
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
2017-01-22 19:45:38 -08:00
Dan Albert
9a41bcecc6 Unversion NDK stub libraries.
The system versions of these libraries aren't versioned yet.

Bug: https://github.com/android-ndk/ndk/issues/278
Test: make ndk
Change-Id: Icf5ff9921441d3e252771aef37002c772c08cbd0
2017-01-06 11:04:15 -08:00
Mark Salyzyn
fc148f7f33 liblog: add IF_ALOG_RATELIMIT
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
2016-12-21 21:36:14 +00:00
Mark Salyzyn
774e04f779 liblog: move log_is_loggable.c to properties.c
Just makes sense cleanup

Test: gTest liblog-unit-tests
Bug: 33535908
Change-Id: I85de049f3cd73a473d56db5970d42eee5f9f70a8
2016-12-16 08:43:56 -08:00
Mark Salyzyn
ed9dc8abe2 liblog: switch event_tag_map.c to event_tag_map.cpp
NB: recent activities on event_tag_map.c were to allow
    this transition to be unremarkable.

Test: compile
Bug: 31456426
Change-Id: I13e1771a001874244711a5ac3023861c2a5f8c7d
2016-12-01 15:42:03 -08:00
Dan Willemsen
0910d2dbb9 Enable liblog on host bionic
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
2016-11-29 13:39:55 -08:00