This is probably not very significant in this standalone tool,
but makes it easier for us to find leaks in our other system
code via static analysis.
(cherry-pick of 407a2195391685627e6be947491041ae3c8cbe61.)
Change-Id: I4e14cadc1e53bac0848e0e0c7f531f920e43cb0a
Add basic interface documentation to RefBase.h.
Much, but not all, of this is cut-and-pasted from an email message
from Mathias Agopian. The rest is reconstructed from the code.
Delete some, now redundant, text from Refbase.cpp, and add a bit
more about the implementation strategy.
Some minor fixes to internal comments.
Bug: 30292291
Change-Id: I56518ae5553bc6de0cc2331778e7fcf2e6c4fd87
This is needed to connect to the right debuggerd server for the crashing
process. Without this change, the following errors are observed, because a
32-bit process is trying to connect to the 64-bit debuggerd (as opposed to
debuggerd32):
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 14153 (static_crasher)
debuggerd: handling request: pid=14153 uid=0 gid=0 tid=14153
debuggerd: Not allowed to redirect action 0 to 32 bit debuggerd
Bug: 24414818
Change-Id: I2f275fbc804b0abc6e876a743e51dd8494817103
* changes:
logcat: -d, -t or -L, along with -f, do not background
logcat: lastLogTime only two most recent files
logcatd: Add --id=${ro.build.id}
logcatd: fix up logpersist.cat to filter out signature file
logcat: add --id=<id> for -f option
logcat: switch to android::base::StringPrintf
Specifically logcatd with exec logcat -L needs to be foreground
process cgroup as it is spawned and can block init progress. Makes
sense generally to only set background cgroup when we are taking
continuous content, and we are pushing that content to a set of
logrotate files.
Rename setupOutput to setupOutputAndSchedulingPolicy to more
clearly indicate its purpose.
Bug: 30630936
Bug: 30612424
Bug: 28788401
Change-Id: I628d590a42a53a6b448ecd0af53d6d1edf7bbb0e
Scaling issues if -f logrotation is specified and there are a lot of
log files to process in lastLogTime, focus on only the last two log
files. This will cover the situation where we have recently rotated
the logs and the last file is missing or empty.
This also alters monotonic processing as well as it used to focus on
only the last file; the danger being doubled now if the pair covers
more than one reboot when filling in missing content with logcat -L.
Problem was always there with one log file, but now we handle if
rotation happened recently. A fair tradeoff for KISS.
Bug: 30630936
Bug: 30612424
Bug: 28788401
Change-Id: I1c13b94e88f5edc08ecef52d407e296874ca5807
If a new build lands, this will automatically clear out old
logs in /data/misc/logd/ that may no longer be relevant.
Bug: 30591615
Change-Id: Iecf61bb2a4928ce4b2e8cc6a3b122b7ae598d268
Simple filter for no suffix, or a numerical suffix. toybox
grep did not handle a more robust regex, so we opted for
kiss in order to remove the .id suffix from consideration.
Bug: 30591615
Change-Id: I5b1c929d3e69c1ae39af95ae44a69f7b55e969ed
Clear file rotate content if id signature changes. This allows
logcatd to detect change of property ro.build.id to reset the
recorded data. The id is stored in the the -f filespec as
<filespec>.id.
If the id file is missing or unreadable, do not clear. Allow an
API where chmod 0 to the id file blocks this feature. Does not
work for root.
Add logcat.logrotate_id gTest.
Bug: 30591615
Change-Id: I895749ca7c6d4af57ec57f058a29d8e3af2f8b27
asprintf should be replaced with StringPrintf, solves
a memory leak issue because of exiting scope.
Bug: 30591615
Change-Id: I88644cc27946ba4f25d4539420199c6f40df1bfa
"killing Settings" is meaningless without context, we are killing the
Settings application to pull in new values, so make this clearer!
Change-Id: Ice0b950040bd05dcd49b7315def4dac3dd93eb27
dmesg parser could wrap taglen limit resulting in out of bound
accesses. Can lead to crash or data corruption.
Fixed an issue with two-word tag parsing. Switched to case
insensitive tag content matching. Added a few extra limit
checks that could also wrap, simplified the parsing, then added
means to stop using hard coded constants.
Bug: 30688716
Bug: 30050636
Bug: 30614675
Bug: 25620123
Change-Id: Iae4f664f63ef7b842d82eaa1638b6d7a0d28fd18
Since the equality operator '==' has higher precedence than the
assignment operator '=', we were assigning 'prev' to the result of
our comparison and not the result of mRefs.fetch_sub().
This means that 'prev' would only receive the values 0 or 1. In
the cases where fetch_sub() returned 0 or 1, we were happening to
get the correct value. But if fetch_sub() was greator than 1,
we would return to the user 0, instead of the previous reference
count.
We fix this by properly adding parentheses. We also adjust the
whitespace a little to hopefully make the groupings of the logic
easier to see.
Change-Id: Ib129798a7076854b9ca4f6385c42edbf4fb75e57
Show transfer rate for individual files, and for the overall transfer.
Bug: http://b/30411535
Change-Id: If2f3008f1287b1d1add4a23c3430b39885b6c904
Test: inspected output manually
Previously, we weren't printing a newline when reporting transfer
rates, so only the last transfer rate printed would be visible.
Bug: http://b/30667841
Change-Id: Id341147912d057673de4ad26a8f618f04a8c02f3
Test: inspected output manually
sync with list-only was using SyncConnection::Error to print its output
persistently, which would prepend "adb: error: " to messages.
Change-Id: I90df5fc1123b8c613c811cf66c37aef05663b1e4
This is broken on all devices other than N9, and has no real path to fixing
it because there are so many different values already in use (41, 43, 47,
127), with no way to tell which you should use on any given device.
Bug: http://b/30597190
Change-Id: I07eeaaf6f5dc03c5532ffbfbb85ef2ad750206a0
This lets us see what's going on in init.
Bug: http://b/29751426
Merged-In: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
Change-Id: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
killProcessGroup actually works on cgroups. Kill the POSIX process
group ourselves.
Bug: http://b/29751426
Change-Id: I1a2808488510f4262811b6407bcd0948ad23bc60
stat on Windows fails with ENOENT when passed a path with a trailing
slash or backslash, regardless of whether the target is actually a
directory. Emulate the correct POSIX behavior by stripping trailing
path separators and then checking if the target is a directory if
successful.
Bug: http://b/30481559
Bug: https://code.google.com/p/android/issues/detail?id=214633
Change-Id: I1d398d19a9bce1ecb3fdc4aabc31aa98c82c3f93
Test: Relevant adb_tests pass on Linux and Windows 10.
* Use const reference type for parameters to avoid unnecessary copy.
* Suppress warning of not using faster overloaded string find function.
Bug: 30407689
Bug: 30411878
Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee
Test: build with WITH_TIDY=1
Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525