From ca6bde9e1c43cb839d974be583e9b05069b4906a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 7 Feb 2024 10:05:37 -0800 Subject: [PATCH 1/2] top -b: add missing flush. We need to flush after each batch in batch mode. (Found by inspection, looking for sleeps similar to the vmstat one.) --- toys/posix/ps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toys/posix/ps.c b/toys/posix/ps.c index e4a69a4fa..b99fa183d 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -1742,13 +1742,15 @@ static void top_common( if (timeout<=now) timeout = new.whence+TT.top.d; if (timeout<=now || timeout>now+TT.top.d) timeout = now+TT.top.d; + fflush(stdout); + // In batch mode, we ignore the keyboard. if (FLAG(b)) { msleep(timeout-now); // Make an obvious gap between datasets. xputs("\n\n"); break; - } else fflush(stdout); + } recalc = 1; i = scan_key_getsize(scratch, timeout-now, &TT.width, &TT.height); From 0562629fa863a751e04e4a5979c76b1106e467d3 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Wed, 7 Feb 2024 13:23:53 -0800 Subject: [PATCH 2/2] toybox: Make readelf aware of NT_ANDROID_TYPE_PAD_SEGMENT Android includes a new note in of type NT_ANDROID_TYPE_PAD_SEGMENT [1], make readelf -n able to decode notes for this type. [1] https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/arch-common/bionic/crt_pad_segment.S Signed-off-by: Kalesh Singh --- toys/other/readelf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toys/other/readelf.c b/toys/other/readelf.c index 15e5e7d76..19387360f 100644 --- a/toys/other/readelf.c +++ b/toys/other/readelf.c @@ -424,6 +424,8 @@ static void show_notes(unsigned long offset, unsigned long size) if (type == 1) { printf("NT_VERSION\tAPI level %u", elf_int(&p)), j=1; if (descsz>=132) printf(", NDK %.64s (%.64s)", p, p+64); + } else if (type == 5) { + printf("NT_PAD_SEGMENT\tpad_segment=%u", elf_int(&p)), j=1; } else p -= 8; } else if (notematch(namesz, &p, "CORE")) { if (*(desc = nt_type_core(type)) != '0') printf("%s", desc), j=1;