aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-05-06 11:06:20 -0700
committerElliott Hughes <enh@google.com>2016-05-06 11:06:20 -0700
commit93eb0e019e298939867733b9fd831a51f65b1872 (patch)
tree2a0908ddb55957a20ec920165f2bfdc5b3020da6
parente38619247153b7e78e4720bae85b0e315439d543 (diff)
parentd3e8dd1bf56afc2277960472a46907d419e4b3da (diff)
downloadandroid_external_toybox-93eb0e019e298939867733b9fd831a51f65b1872.tar.gz
android_external_toybox-93eb0e019e298939867733b9fd831a51f65b1872.tar.bz2
android_external_toybox-93eb0e019e298939867733b9fd831a51f65b1872.zip
Merge remote-tracking branch 'toybox/master' into HEAD
-rw-r--r--toys/android/getprop.c5
-rw-r--r--toys/posix/ps.c13
-rwxr-xr-xwww/roadmap.html10
3 files changed, 16 insertions, 12 deletions
diff --git a/toys/android/getprop.c b/toys/android/getprop.c
index efb1e447..9675d9f1 100644
--- a/toys/android/getprop.c
+++ b/toys/android/getprop.c
@@ -54,7 +54,8 @@ static void add_property(char *name, char *value, void *unused)
}
// Needed to supress extraneous "Loaded property_contexts from" message
-int selinux_log_callback(int type, const char *fmt, ...) {
+static int selinux_log_callback_local(int type, const char *fmt, ...)
+{
va_list ap;
if (type == SELINUX_INFO) return 0;
@@ -69,7 +70,7 @@ void getprop_main(void)
if (toys.optflags & FLAG_Z) {
union selinux_callback cb;
- cb.func_log = selinux_log_callback;
+ cb.func_log = selinux_log_callback_local;
selinux_set_callback(SELINUX_CB_LOG, cb);
TT.handle = selinux_android_prop_context_handle();
if (!TT.handle) error_exit("unable to get selinux property context handle");
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 6b89c5ff..bfd6807a 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -45,7 +45,7 @@
USE_PS(NEWTOY(ps, "k(sort)*P(ppid)*aAdeflMno*O*p(pid)*s*t*Tu*U*g*G*wZ[!ol][+Ae]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE))
// stayroot because iotop needs root to read other process' proc/$$/io
-USE_TOP(NEWTOY(top, ">0m" "k*o*p*u*s#<1=9d#=3<1n#<1bq", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE))
+USE_TOP(NEWTOY(top, ">0m" "Hk*o*p*u*s#<1=9d#=3<1n#<1bq", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE))
USE_IOTOP(NEWTOY(iotop, ">0AaKO" "k*o*p*u*s#<1=7d#=3<1n#<1bq", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_STAYROOT|TOYFLAG_LOCALE))
USE_PGREP(NEWTOY(pgrep, "?cld:u*U*t*s*P*g*G*fnovxL:[-no]", TOYFLAG_USR|TOYFLAG_BIN))
USE_PKILL(NEWTOY(pkill, "Vu*U*t*s*P*g*G*fnovxl:[-no]", TOYFLAG_USR|TOYFLAG_BIN))
@@ -70,7 +70,7 @@ config PS
-P Parent PIDs (--ppid)
-s In session IDs
-t Attached to selected TTYs
- -T Show Threads
+ -T Show threads
-u Owned by USERs
-U Owned by real USERs (before suid)
@@ -126,10 +126,11 @@ config TOP
bool "top"
default y
help
- usage: top [-m] [ -d seconds ] [ -n iterations ]
+ usage: top [-H] [-k FIELD,] [-o FIELD,] [-s SORT]
Show process activity in real time.
+ -H Show threads
-k Fallback sort FIELDS (default -S,-%CPU,-ETIME,-PID)
-o Show FIELDS (def PID,USER,PR,NI,VIRT,RES,SHR,S,%CPU,%MEM,TIME+,CMDLINE)
-s Sort by field number (1-X, default 9)
@@ -155,7 +156,7 @@ config TOP_COMMON
bool
default y
help
- usage: COMMON [-bq] [-n NUMBER] [-d SECONDS] [-p PID,] [-u USER,] [-s SORT]
+ usage: COMMON [-bq] [-n NUMBER] [-d SECONDS] [-p PID,] [-u USER,]
-b Batch mode (no tty)
-d Delay SECONDS between each cycle (default 3)
@@ -1263,7 +1264,9 @@ static void top_common(
plold = plist+(tock++&1);
plnew = plist+(tock&1);
plnew->whence = millitime();
- dt = dirtree_read("/proc", get_ps);
+ dt = dirtree_read("/proc",
+ ((toys.optflags&FLAG_H) || (TT.bits&(_PS_TID|_PS_TCNT)))
+ ? get_threads : get_ps);
plnew->tb = collate(plnew->count = TT.kcount, dt);
TT.kcount = 0;
diff --git a/www/roadmap.html b/www/roadmap.html
index 32d093f7..56067317 100755
--- a/www/roadmap.html
+++ b/www/roadmap.html
@@ -269,8 +269,8 @@ system/core/toolbox/Android.mk</a> the toolbox directory builds the
following commands:</p>
<blockquote><b>
-dd getevent iftop ioctl log
-nandread newfs_msdos ps
+dd getevent ioctl log
+nandread newfs_msdos
sendevent start stop top
</b></blockquote>
@@ -297,9 +297,9 @@ implementing the full commands (fdisk, init, and sudo) come first.</p>
<p>For reference, combining everything listed above, we get:</p>
<blockquote><b>
-dd getevent iftop init ioctl
+dd getevent init ioctl
log logcat logwrapper nandread
-newfs_msdos ps reboot run-as
+newfs_msdos reboot run-as
sendevent start stop top
</b></blockquote>
@@ -312,7 +312,7 @@ for later).</p>
<p>This means toybox should implement (or finish implementing):</p>
<blockquote><b>
<span id=toolbox>
-dd getevent iftop ioctl log logcat logwrapper
+dd getevent ioctl log logcat logwrapper
nandread newfs_msdos sendevent start stop
</span>
</b></blockquote>