← Commit list

1044533ea

Denys Vlasenko
Denys Vlasenko
2025-08-05
SUCCESS Duration: 153s

Subject

top: make uppercase 'S' walk topmem in opposite direction

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/top.c+8 -1
@@ -976,7 +976,7 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval)
}
while (1) {
- int32_t c;
+ int32_t c, cc;
c = safe_read_key(STDIN_FILENO, G.kbd_input, interval * 1000);
if (c == -1 && errno != EAGAIN) {
@@ -1021,6 +1021,7 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval)
return NO_RESCAN_MASK;
}
+ cc = c;
c |= 0x20; /* lowercase */
if (c == 'q')
return EXIT_MASK;
@@ -1068,6 +1069,12 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval)
continue;
}
# if ENABLE_FEATURE_TOPMEM
+ if (cc == 'S') {
+ if (--sort_field < 0)
+ sort_field = NUM_SORT_FIELD - 1;
+ if (--sort_field < 0)
+ sort_field = NUM_SORT_FIELD - 1;
+ }
if (c == 's') {
sort_field = (sort_field + 1) % NUM_SORT_FIELD;
if (scan_mask == TOPMEM_MASK)