OSDN Git Service

dumpsys: use a socket for dumping, add timeout support.
authorJosh Gao <jmgao@google.com>
Tue, 1 Mar 2016 00:20:34 +0000 (16:20 -0800)
committerJosh Gao <jmgao@google.com>
Wed, 2 Mar 2016 23:04:18 +0000 (15:04 -0800)
commit4b8f6f9adb8ee1a06b145c8dc83a672f8d0ac80f
tree95ed5fca46bde00682b40464ea70fefa4c6d5b2f
parentcc19ec809e45616449f332d2e72c754d7debf9fb
dumpsys: use a socket for dumping, add timeout support.

Passing the stdout file descriptor directly to a service to dump with
leads to bad things happening if the service hangs, or dumpsys is
terminated prematurely. For example, `dumpsys foo | cat` will not
terminate, even if the dumpsys process is killed, since the write end of
the pipe is still alive in the hung service.

Pass an intermediate socketpair when dumping services to avoid this.

Bug: http://b/26849443
Change-Id: Ide18741080355b3c680275a59172c61734eca92d
cmds/dumpsys/Android.mk
cmds/dumpsys/dumpsys.cpp