Commit graph

18 commits

Author SHA1 Message Date
Tom Cherry
121292dd81 liblog: use libbase_headers for TEMP_FAILURE_RETRY
Test: build
Change-Id: Id3b57ff0327d4632e91960e5e70f3aa21992ed15
2020-01-14 09:56:25 -08:00
Tom Cherry
b47aa2a592 liblog: remove more unused code
Cleanup the headers; we really don't want to encourage any more
cutils/list.h usage...

Remove __android_log_uid() since the only remaining users are built
for device, so they can just use getuid() directly.

Test: build
Change-Id: I62be2c1e43d83807deaa9342afcc72459947cf15
2020-01-08 17:11:09 -08:00
Tom Cherry
21bb36c66a liblog: remove the last of the transport structs
Test: build, liblog unit tests
Change-Id: I292662fc64e3163b570c5daeaa8f912fb6ca74e8
2020-01-08 17:11:06 -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
49a8af7dff liblog: do not check loggability of event logs before sending to logd
This code was introduced to help performance by skipping sending these
messages to logd when logd would later drop them.  However it has
multiple flaws:

1) Event logs aren't super common and non-loggable event logs are even
   less common, so it would be a trivial benefit if any.
2) This code is not particularly safe as written, which is even
   acknowledged in the comments.
3) This forces processes that write event logs to allocate a rather
   sizable amount of memory.

Therefore, it's better to simply remove this and let logd drop these
messages when it receives them.

Bug: 139705697
Test: logging works, liblog-unit-tests
Change-Id: Ide01574112e173d4922137b3d3868cf8c2c09086
2019-12-11 15:46:47 -08:00
Tom Cherry
990852ff7d liblog: remove superfluous checks
More checks in static functions where all callers always satisfy them.

Test: build
Change-Id: I3c9bd1fd4e5c55a2f9f2c42d5259c5cdd8f8a853
2019-10-02 14:27:04 -07:00
Tom Cherry
97ec4eecd4 liblog: don't set transports to nullptr when they close
The old code did not free the transports, just unlink their nodes from
the linked list, so there was no race condition between close() and
other threads writing to the logs.  By settings these to nullptr, I
introduced a race condition, but setting them to nullptr isn't
necessary, so let's simply not do that.

Test: liblog-unit-tests
Change-Id: Iec0b680addd13b5d30bd91ccef5bdeab6bf797b0
2019-10-02 14:22:07 -07:00
Tom Cherry
2187a41586 liblog: fix prio and tag validation code
These checks are not needed; all callers are in this file and there's
only one possible situation: that we have valid pointers and sizes.

Test: liblog-unit-tests, log.tag.* properties still work
Change-Id: I8b385d5124c2d93cd99a352e30f745b075c8bd09
2019-10-01 17:13:43 -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
9d35034437 liblog: remove log/log_transport.h
There are no users; future versions will need to be more generic to
support the libbase style Logger/Aborter options.

Test: build, liblog-unit-tests
Change-Id: Ia4571cd39d3e499f18306920ecbf40ea8878fb81
2019-10-01 08:14:40 -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
Elliott Hughes
de3ad1d718 Remove an ancient spam-busting hack from logd.
We have real spam detection and suppression now anyway.

Bug: 20143912
Test: build
Change-Id: I7bd4bb189373569fd1e5a7b3f2b90ce816abe864
2019-07-08 11:10:11 -07:00
Yi Kong
dd2ea5fd68 Suppress -Wstring-plus-int warning
The code section is already marked as to be removed, simply suppress
the -Wstring-plus-int warning.

Test: m checkbuild
Bug: 128878287
Change-Id: I95a03aca90dbb5d27db49f5baf534cbaacf9b830
2019-03-18 22:16:14 -07: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
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
71ba16488b liblog: convert to C++
Bug: 119867234
Test: liblog, logcat, logd unit tests

Change-Id: I2a33b6fc37f9860c0041e3573bfb59ea389f623c
2019-01-15 15:57:33 -08:00
Renamed from liblog/logger_write.c (Browse further)