History log of /frameworks/native/cmds/dumpstate/utils.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
bfb1f1cc832840b7232c25a91d49eb39aa79687f 16-May-2015 Elliott Hughes <enh@google.com> Don't use TEMP_FAILURE_RETRY on close in frameworks/native.

Bug: http://b/20501816
Change-Id: Id13a62f02243c6c4831e2f47944dc34fa822f5b6
(cherry picked from commit 997abb668b9248c2174c6cf169a0b7c6a02fd2cb)
326842fca4883f1256aa9ed019bb3206ee76fca7 30-Apr-2015 Mark Salyzyn <salyzyn@google.com> dumpstate: report per-partition MMC performance

(Cherry pick from commit 540e3de99fa1baa5eaf3eb3d49f4e98fd9f5bd91)

Change-Id: If5cabe186d8377056effa1c0672a90e277cd7221
4796bc3b27186de67f1af732be87e20ab1757198 19-Mar-2015 Nick Kralevich <nnk@google.com> am 4b9d0b9b: am f3201498: Merge "dumpstate: add O_CLOEXEC"

* commit '4b9d0b9b676afec086bf579015b2f74623b357fd':
dumpstate: add O_CLOEXEC
cd67e9f059e270017d5defd8784c89dd8e6bcde7 19-Mar-2015 Nick Kralevich <nnk@google.com> dumpstate: add O_CLOEXEC

Add O_CLOEXEC to various file descriptor calls, to avoid
leaking file descriptors to dumpstate's child processes.

Bug: 18342188
Change-Id: I74c47a98dfddc29c618067ad53d879b98ed1d87a
123edd9f812c93973de923397f2a5cb6fdaa4135 26-Feb-2015 Christopher Ferris <cferris@google.com> resolved conflicts for merge of 04e13acd to master

Change-Id: I9bbc9907a5cbde8b374398493bc0dc6b056ea734
54bcc5ffd5a79f4f194089c58d3de571532bf39b 10-Feb-2015 Christopher Ferris <cferris@google.com> Add timeout for dump_file.

It turns out dump_file is used on a number of /proc and system files.
In one case, the read of a file stalled and caused a bugreport to
hang forever. It's still possible if there is a kernel bug that this
could stall forever, but less likely.

Also, change the return type of nanotime to uint64_t.

- Created a named fifo and verified that dump_file fails with a timeout.
- Created a large /data/anr/traces.txt to verify that large files still
dump properly and that the additional NONBLOCK parameter doesn't cause
a problem.
- Created a dummy /data/tombstones/tombstone_00 to verify that the
dump of these files still works.
- Compared a dump using the old dumpstate to the new dumpstate to verify
nothing obviously different.

Bug: 19117030
Change-Id: I0d3dd27583c853cdaccd2fd278748cb5f9ccd4fb
d527bcbc10b1fb6b998b94bbac7bfbfd3a9efdf6 17-Feb-2015 Svetoslav <svetoslavganov@google.com> Remove unnecessary settings state dump.

The settings provider now implements dump, hance special dump
code is no longer needed.

Change-Id: I93af3f6acac4ac70d6bbf569d2348cb16b8c0946
ff4a4dc7e6e3ead12020b4dc17548d767a419dde 10-Feb-2015 Christopher Ferris <cferris@google.com> Remove -z option.

This option doesn't work with the current selinux protections and
doesn't serve much of a purpose. You can get the same results running

dumpstate | gzip > /data/local/tmp/dump.txt.gz

Bug: 19271141
Change-Id: Icc76200df33dc708e30c556ec8a0f393f995fe7c
1a9a3386151d90152cc18d995b9877b50ca84d90 30-Jan-2015 Christopher Ferris <cferris@google.com> Add better timeout mechanism for running commands.

Change-Id: I60fc9e7d59c3e0e4b8b2f69f79c6903240bfd131
31ef85529d86a9db68b002f51ec84fd9938908ab 14-Jan-2015 Christopher Ferris <cferris@google.com> Use the timeout stack dump functions.

Use the native stack dumping functions that allows time outs. If
debuggerd locks up, before a bugreport would hang forever. Now
it will timeout properly and still get all of the other information.

Bug: 18766581

(cherry picked from commit 457731f69e3106b5aae8fc04f9565af1d875876c)

Change-Id: I39e8e9c60209e3ef9efac795fedb8e1edce2bd3e
67c5a8af9ed128d8bb56d4723303aef6f0a4500f 10-Jan-2015 Christopher Ferris <cferris@google.com> Fix message when a command times out.

The previous version printed out the nanoseconds elapsed, not seconds.

Change-Id: I10f6d7bf7b7a4647658313ed83781fda6fd744a5
1dc94e315680b47fe430ef90f46c50a25c92fb6d 11-Sep-2014 Jeff Brown <jeffbrown@google.com> Make dumpstate vibrate immediately.

Previously, the vibration was not performed until after stacks
were gathered which takes a long time. Moved the vibration
to happen earlier so we provide better user feedback for the
three-button salute when collecting a bug report.

Deleted some dead code for playing begin/end sounds.

Improved the timing measurement code to help track down why
bug reports are so slow. (They take over a minute now which
can cause us to lose valuable diagnostic information.)

Bug: 17474152
Change-Id: Iac73f7993d7dc85196aad96f459b22fd4a710f94
89d4949f86f4f7b6710e951afefad186c667fd6e 09-Sep-2014 Christopher Ferris <cferris@google.com> Use time() instead of clock() for timeouts.

The clock() function returns the processor time used by the process. This
is not a good timeout mechanism since the code is suspended most of the
time waiting for the forked process to finish. Replace with the time()

Bug: 17154069
Change-Id: Ib383329f9db269445d71a100553b08e71fddda3f
2e671bbdb741c2926b6df7b240fdc31c7361f330 21-Aug-2014 Andres Morales <anmorales@google.com> Fix deadlock when killing adb bugreport

Leave default signal handler (terminate) for parent process,
add SIG_IGN as signal handler for children and let them
go down when the parent gets SIGPIPE.

Bug: 17109154
Change-Id: Id33db3e97a32f289eb2a9a1a0ca8acbe3dcd285d
7dc7f3221f26b771c266a26ec785eb74287922f1 23-Jul-2014 Christopher Ferris <cferris@google.com> Add dumping of tombstones to dumpstate.

Dump only those tombstones modified within the last half an hour.

Change-Id: I8ce836b2e19eba7a9c0c31a4f312f9a382526da7
0d6180f122127a9541e6193e0e6eceb5b08c608c 17-Jul-2014 Colin Cross <ccross@android.com> dumpstate: fix dumping traces for vm processes on 64-bit

dumpstate was not dumping any stack traces for vm processes because
it was failing the string compare for /system/bin/app_process.
64-bit devices use app_process32 and app_process64 instead of
app_process, and zygote64 alongside zygote. Change the string
matching to be prefix matching.

(cherry picked from commit 8eb25d552b07ffa799b7b61ad46d0109e7512741)

Change-Id: I6b1568161fae278f0e6107990e5b750cf0ca902b
c88da7cc21c61b9ac8fcac11aa812f647ffb181c 09-Jul-2014 Sreeram Ramachandran <sreeram@google.com> resolved conflicts for merge of 928e05b1 to master

Change-Id: I1d1e623a1f95baa4375a87242ce71ea789884649
928e05b12b21a846ac956e83d46635bbab592ea7 09-Jul-2014 Sreeram Ramachandran <sreeram@google.com> am 0d2bee0c: Merge "Dump all the correct routing tables."

* commit '0d2bee0c0baec56ec98867d7e044602097525248':
Dump all the correct routing tables.
2b3bba34aec65b612be8d1f52cd124d9c30955f9 09-Jul-2014 Sreeram Ramachandran <sreeram@google.com> Dump all the correct routing tables.

The list of tables is maintained in /data/misc/net/rt_tables by netd.

Change-Id: I55475c08c5e43bcf61af916210e680c47480ac32
bd81c258c2ac9f41a9263a20953d6f0f63a88887 01-May-2014 Nick Vaccaro <nvaccaro@google.com> am 45fcfb48: am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging

* commit '45fcfb48ef9e65747e7a3f35e1a4da232f6e161a':
dumpstate: increase poll timeout waiting for SIGQUIT logging
45fcfb48ef9e65747e7a3f35e1a4da232f6e161a 30-Apr-2014 Nick Vaccaro <nvaccaro@google.com> am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging

* commit '85453ecc90a94564e586f0f97c9ec2c0cf831501':
dumpstate: increase poll timeout waiting for SIGQUIT logging
85453ecc90a94564e586f0f97c9ec2c0cf831501 30-Apr-2014 Nick Vaccaro <nvaccaro@google.com> dumpstate: increase poll timeout waiting for SIGQUIT logging

Increased the maximum time dumpstate will wait for SIGQUIT process
to finish dumping its thread stacks to the logfile to 5 seconds.

Bug: 14057177
Change-Id: I0b43004512855d202f2fe0ea7b0e934e77a3a070
165c8bdfb585b224325423b21301620f9097dc64 13-Feb-2014 Nick Kralevich <nnk@google.com> am 0e4d2885: am 2044ac43: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."

* commit '0e4d2885a34d31f5dbe5a08bdb654953abaf82a2':
Convert all selinux_android_restorecon and _setfilecon calls to new API.
26288202e7bdf2e897a11bf31a15685d7c20945f 07-Feb-2014 Stephen Smalley <sds@tycho.nsa.gov> Convert all selinux_android_restorecon and _setfilecon calls to new API.

libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
5ecd4beef8f10f91febf916414c65d3d0e1cf734 29-Jan-2014 John Spurlock <jspurlock@google.com> Dump system settings for all users

Change-Id: Ic832b19fe698da1984876b2949c3f26990ae5076
e167d889e4917e6b4f569026a1492b9e9818b08e 05-Apr-2013 Geremy Condra <gcondra@google.com> am a3d3e137: Merge "dumpstate: Add SELinux restorecon call."

* commit 'a3d3e137f473a965fefced9670e3b0c6b5f7f791':
dumpstate: Add SELinux restorecon call.
957983787d7a753d34b582ae0165160f4ebf815c 04-Apr-2013 Robert Craig <rpcraig@tycho.ncsc.mil> dumpstate: Add SELinux restorecon call.

Set the security context on the directory used
to dump Dalvik and native stack traces.

Change-Id: Iba13783f10e850485ce1a8d4aa5792d55085eb22
Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>
27f9e6d849fce956c9b8f1ad5c3d9a954501a76b 13-Mar-2013 Jeff Sharkey <jsharkey@android.com> Support broadcast when dumpstate finishes.

Add flag that sends BUGREPORT_FINISHED broadcast when dumpstate
is finished, including the resulting filesystem paths. Also reduces
directory creation to 0770.

Bug: 7005318
Change-Id: Id4c6b699a56f8acd859b7ab73368500e1a8f3c67
574d6902b7e30a1e9c2375481549c8e8a712d6e6 11-Mar-2013 jp abgrall <jpa@google.com> am ba8abb51: Merge "Ensure dumpstate children die"

* commit 'ba8abb517d1eddebeda62bf907fa446e3c3b81f6':
Ensure dumpstate children die
e7b6cf13f94f66ea446c95ab34040b0a577e43dc 07-Mar-2013 John Michelau <w14107@motorola.com> Ensure dumpstate children die

Use prctl(PR_SET_PDEATHSIG, SIGKILL) in each forked child to ensure
it dies when dumpstate dies.

This is important for two cases:
- dumpstate runs a timer for each child process. On expiration, it
sends SIGTERM to kill the process. Sometimes SIGTERM isn't enough
to kill a hung process, so the child lives on.
- When dumpstate is killed by the user before completing, outstanding
children continue to run and generate output.

Change-Id: I96e0dc918c26d56c9fee53611980ba2edd238712
1493a3974a725d6873f317b774be333ca035a64c 07-Nov-2012 Colin Cross <ccross@android.com> dumpstate: fix incorrectly zeroed array

Change-Id: I55a916568baf66629b02a6d80fce34b84ffb3a34
0c22e8b31651caf12a2b4d4acef5bc65d486e570 02-Nov-2012 Colin Cross <ccross@android.com> dumpstate: dump all threads in show_wchan

for_each_pid only finds processes and not their threads. Add
for_each_tid and call it for show_wchan so we can see where all
threads are blocked in the kernel.

Change-Id: Iffb59f7c2933cecf51cdd358a36e19932c2f24c7
5f87b31d8076dff08b2363961b07fc052364fe95 17-Sep-2012 Elliott Hughes <enh@google.com> Use a named constant rather than a magic number.

Change-Id: I86e8c91c6f5628df3eec38faf28598cc8cef2ea3
1fc4f80fc38f782f128102795481924a97a2d3c5 11-Sep-2012 James Dong <jdong@google.com> Add stack dump from drmserver process to bugreports

This would be helpful tracking down ANR issues in drmserver

o related-to-bug: 7132419

Change-Id: I7eceaa0c29af26bd0092110be6bddf8f4c063545
bf7f49238d0af497d4300f7e611cf831854d6434 08-Jun-2012 Jeff Brown <jeffbrown@google.com> Include stack traces for certain native processes in bugreport.

Bug: 6615693
Change-Id: I64c3b3ce0bba62d9c332a795f7d979fb753dc27b
d51820e8dea4f5bd9d06ff22335bead7409864b2 06-Apr-2012 Nick Kralevich <nnk@google.com> dumpstate: don't follow symlinks when creating /data/anr/traces.txt

Make Android more robust against symlink attacks when /data/anr
is world-writable.

Bug: 5614000
Change-Id: I9a7e4c4ec9aa4300ac30a968db0dcd276f364ab6
c7f1fe26804ab986b90f3ba007db94f71e94932a 06-Apr-2012 Nick Kralevich <nnk@google.com> Ensure that /data/anr/traces.txt is world-writable

The umask changed for init. We have to force /data/anr to be world
readble and /data/anr/traces.txt to be world writable so dalvik
processes can write to it.

Hopefully this is a short term change while we investigate tightening
up these permissions.

Bug: 6300296
Change-Id: Iacb4c9f1bc69d2ac679697f9cf9a52694f888489
f45fa6b2853cc32385375a0b63ee39ad6a968869 26-Mar-2012 Colin Cross <ccross@android.com> move dumpstate and dumpsys from frameworks/base to frameworks/native

Change-Id: I8a5318022ce5cd3e7c8055f21fe5da74639aa6c0