summaryrefslogtreecommitdiffstats
path: root/logd/logpersist
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-05-26 14:57:13 -0700
committerMark Salyzyn <salyzyn@google.com>2015-06-02 15:28:36 -0700
commit49ed105fd91677f7c87417890bf7441146953fff (patch)
treec9f795ed2f18d558f8b00451434ccde81730b4b5 /logd/logpersist
parentcdb468abb38bb75aaad5d4c6699a824559cf272a (diff)
downloadsystem_core-49ed105fd91677f7c87417890bf7441146953fff.tar.gz
system_core-49ed105fd91677f7c87417890bf7441146953fff.tar.bz2
system_core-49ed105fd91677f7c87417890bf7441146953fff.zip
init.rc: logd: Add logpersistd (nee logcatd)
(cherry pick from commit 100658c303919d8f69c76f6f25eac376795712f0) - logpersistd is defined as a thread or process in the context of the logd domain. Here we define logpersistd as logcat -f in logd domain and call it logcatd to represent its service mechanics. - Use logcatd to manage content in /data/misc/logd/ directory. - Only turn on for persist.logd.logpersistd = logcatd. - Add logpersist.start, logpersist.stop and logpersist.cat debug class executables, thus only in the eng and userdebug builds. ToDo: Wish to add Developer Options menu to turn this feature on or off, complicated by the fact that user builds have no tools with access rights to /data/misc/logd. Bug: 19608716 Change-Id: I57ad757f121c473d04f9fabe9d4820a0eca06f31
Diffstat (limited to 'logd/logpersist')
-rwxr-xr-xlogd/logpersist36
1 files changed, 36 insertions, 0 deletions
diff --git a/logd/logpersist b/logd/logpersist
new file mode 100755
index 000000000..215e1e2d9
--- /dev/null
+++ b/logd/logpersist
@@ -0,0 +1,36 @@
+#! /system/bin/sh
+# logpersist cat start and stop handlers
+data=/data/misc/logd
+property=persist.logd.logpersistd
+service=logcatd
+progname="${0##*/}"
+if [ X"${1}" = "-h" -o X"${1}" = X"--help" ]; then
+ echo "${progname%.*}.cat - dump current ${service%d} logs"
+ echo "${progname%.*}.start - start ${service} service"
+ echo "${progname%.*}.stop [--clear] - stop ${service} service"
+ exit 0
+fi
+case ${progname} in
+*.cat)
+ su 1036 ls "${data}" |
+ tr -d '\r' |
+ sort -ru |
+ sed "s#^#${data}/#" |
+ su 1036 xargs cat
+ ;;
+*.start)
+ su 0 setprop ${property} ${service}
+ getprop ${property}
+ sleep 1
+ ps -t | grep "${data##*/}.*${service%d}"
+ ;;
+*.stop)
+ su 0 stop ${service}
+ su 0 setprop ${property} ""
+ [ X"${1}" != X"-c" -a X"${1}" != X"--clear" ] ||
+ ( sleep 1 ; su 1036,9998 rm -rf "${data}" )
+ ;;
+*)
+ echo "Unexpected command ${0##*/} ${@}" >&2
+ exit 1
+esac