forked from SlimRoms/android_system_core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init.rc: logd: Add logpersistd (nee logcatd)
(cherry pick from commit 100658c) - 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
- Loading branch information
Mark Salyzyn
committed
Jun 2, 2015
1 parent
cdb468a
commit 49ed105
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters