History log of /system/core/logd/FlushCommand.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5e001776f405098cc825c9f6de546cd5b92b70e4 14-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: wakeup wrap timeout if realtime changes drastically

--wrap flag in logcat translates directly to the mTimeout inside logd,
the value set is ANDROID_LOG_WRAP_DEFAULT_TIMEOUT defined in
<log/log_read.h> as 7200 or 2 hours. For a non blocking read with
a selected timeout, the logger waits until either the log buffer is
about to 'wrap' and prune the log entry, or at the specified timeout.
Non blocking in the logger context means that when there are no more
log entries, the socket is closed.

clock_gettime(CLOCK_REALTIME) is UTC 1970 epoch *NIX time. Is only
affected for time updates, not timezone or daylight savings time.
If there is a large user initiated time change, both the log entries
and the timeout mentioned above really get called into question, so we
trigger a release of the logs for clarity. This is so that the log
reader can handle the disruptively updated time, and can immediately
check the local time if necessary.

The logger has a 5 second window for entries to land in time sorted
order into the logging list. This should offer the log reader some
differentiation between logging order sequence for monotonically
increasing time, and sequence order in the face of user initiated time
adjustments that break monotonicity.

This change is about major time adjustments that can cause Fear,
Uncertainty or Doubt about log entries. By returning, immediate action
can be taken, rather than having to comb through the logs with less
details about the time disruptions in hand. The least it can do is
record what we have, and restart the call with a new tail time and
timeout.

Test: gTest liblog-unit-tests logcat-unit-test logd-unit-tests
Bug: 35373582
Change-Id: I92cac83be99d68634ffd4ebd2f3a3067cfd0e942
/system/core/logd/FlushCommand.cpp
5a34d6ea43d28f3b5d27bf6dd5b9fa31ec033531 10-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: drop mSequence from LogBufferElement

Use getRealTime() instead and leverage private liblog log_time
comparison and math functions. This saves 8 bytes off each
element in the logging database.

Test: gTest liblog-unit-tests logd-unit-tests logcat-unit-tests
Bug: 35373582
Change-Id: Ia55ef8b95cbb2a841ccb1dae9a24f314735b076a
/system/core/logd/FlushCommand.cpp
501c373916e292764400dbae735f44b33378400f 10-Mar-2017 Mark Salyzyn <salyzyn@google.com> logd: specify clang format

Switch _all_ file's coding style to match to ease all future changes.

SideEffects: None
Test: compile
Bug: 35373582
Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
/system/core/logd/FlushCommand.cpp
2ad0bd0a9b594bbe2560b405b0008b7bc742cfca 23-Feb-2016 Mark Salyzyn <salyzyn@google.com> logd: Allow (some) headers to be individually importable

LogReader.h needs to be individually importable.

Fix a few others, drop includes of local includes, let them be
included in source instead and allow headers to be included
alphabetically. Was not a complete audit since goal was to
separate LogReader.h out from the pack.

Bug: 27242723
Change-Id: Ic7759ef90995e5bd285810706af33550c73cf5b5
/system/core/logd/FlushCommand.cpp
8fa8896d2ed97eb274c62f0e386dabf2e2a82a45 26-Jan-2016 Mark Salyzyn <salyzyn@google.com> logd: security buffer only AID_SYSTEM reader

- limit AID_SYSTEM uid or gid to read security buffer messages
- adjust liblog tests to reflect the reality of this adjustment

To fully test all security buffer paths and modes

$ su 0,0,0 /data/nativetest/liblog-unit-tests/liblog-unit-tests --gtest_filter=liblog.__security*
$ su 1000,1000,1000 /data/nativetest/liblog-unit-tests/liblog-unit-tests --gtest_filter=liblog.__security*
$ su 2000,2000,2000 /data/nativetest/liblog-unit-tests/liblog-unit-tests --gtest_filter=liblog.__security*

ToDo: Integrate the above individually into the gTest Q/A testing

Bug: 26029733
Change-Id: Idcf5492db78fa6934ef6fb43f3ef861052675651
/system/core/logd/FlushCommand.cpp
015709784537755d42ea564a558c0eae5b1d1546 07-Jan-2016 Mark Salyzyn <salyzyn@google.com> logd: wrap timed entry too early, timeout immediately

Bug: 26447386
Change-Id: I8d5588831f558061ef21b2a5aeedc865e9ae4cc7
/system/core/logd/FlushCommand.cpp
083b037c0740ca00f72429e4457bfdd4b4d4dfa7 04-Dec-2015 Mark Salyzyn <salyzyn@google.com> logd: liblog: logcat: Add LOG_ID_SECURITY

- Largish commit, buffer and access controls done together
- Add LOG_ID_SECURITY binary content log
- Add "default" meta buffer
- allow LOG_ID_SECURITY only from AID_SYSTEM and AID_ROOT UID & GID
- Use __android_log_security() to gate logging
- Add __android_log_security_bwrite() native access to security
logging.
- Add liblog.__security_buffer end-to-end gTest

Bug: 26029733
Change-Id: Ibcf5b4660c17c1aa6902c0d93f8ffd29c93d9a93
/system/core/logd/FlushCommand.cpp
b75cce0389748bea111ca62af623645117e12d9d 30-Nov-2015 Mark Salyzyn <salyzyn@google.com> logd: wakeup on wrap or timeout

If a timeout is specified for the reader, then go to sleep
with the socket open. If the start time is about to get
pruned in the specified log buffers, then wakeup and dump
the logs; or wakeup on timeout, whichever comes first.

Bug: 25929746
Change-Id: I7d2421c2c5083b33747b84f74d9a560d3ba645df
/system/core/logd/FlushCommand.cpp
98dca2d0b15f9a579efae8592dbb45059aad082e 19-Aug-2015 Mark Salyzyn <salyzyn@google.com> logd: logtimes switch to std::list

Bug: 23350706
Change-Id: Icc60dd06119ea20a22610644ff880d5135363aba
/system/core/logd/FlushCommand.cpp
7718778793b106498b931dd708a466cf3a6f6a0f 13-May-2015 Mark Salyzyn <salyzyn@google.com> logd: Cleanup

- Android Coding Standard for Constructors
- Side effects NONE

Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
/system/core/logd/FlushCommand.cpp
f7c0f75275d0fde2d8b7614f1501f0ad0cd3a01c 03-Mar-2015 Mark Salyzyn <salyzyn@google.com> logd: replace internal CLOCK_MONOTONIC use with sequence numbers

- switch to simpler and faster internal sequence number, drops
a syscall overhead on 32-bit platforms.
- add ability to break-out of flushTo loop with filter return -1
allowing in reduction in reader overhead.

Change-Id: Ic5cb2b9afa4d9470153971fc9197b07279e2b79d
/system/core/logd/FlushCommand.cpp
fa3716b2501ccddc8e0cd30f6343692b8deb7639 15-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: liblog: logcat: Arbitrary time to tail

Change-Id: I10e8d92c933e31ee11e78d2d1114261a30c4be0e
/system/core/logd/FlushCommand.cpp
1114f1806521b2a6447b7c68934e4f3c29b60cb5 21-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: institute getGroups for socket credentials

(cherry pick from commit 4d851290fc81eb36d2fcf76e6f06213a28b877f5)

Change-Id: Ib8be84d2a3f873e91fb1495df439a498f395c137
/system/core/logd/FlushCommand.cpp
c03e72cc1c155ff668df8df1caec363b07347d0d 18-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: Adjust to match defacto coding style

(cherry picked from commit c46f77bd2ad01f3a695416c4cf22d6a9738bb7b8)

Change-Id: I80685cdc7116e10c5a5a77abe856fd96804f9117
/system/core/logd/FlushCommand.cpp
0175b0747a1f55329109e84c9a1322dcb95e2848 26-Feb-2014 Mark Salyzyn <salyzyn@google.com> logd: initial checkin.

* Create a new userspace log daemon for handling logging messages.

Original-Change-Id: I75267df16359684490121e6c31cca48614d79856
Signed-off-by: Nick Kralevich <nnk@google.com>

* Merge conflicts
* rename new syslog daemon to logd to prevent confusion with bionic syslog
* replace racy getGroups call with KISS call to client->getGid()
* Timestamps are filed at logging source
* insert entries into list in timestamp order
* Added LogTimeEntry tail filtration handling
* Added region locking around LogWriter list
* separate threads for each writer
* /dev/socket/logd* permissions

Signed-off-by: Mark Salyzyn <salyzyn@google.com>

(cherry picked from commit 3e76e0a49760c4970b7cda6153e51026af98e4f3)

Author: Nick Kralevich <nnk@google.com>
Change-Id: Ice88b1412d8f9daa7f9119b2b5aaf684a5e28098
/system/core/logd/FlushCommand.cpp