← Commit list

e6302b271

Denys Vlasenko
Denys Vlasenko
2026-09-29
SUCCESS Duration: 348s

Subject

swapon: with no arguments, show /proc/swaps (mimic util-linux 2.41.1)

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 →

util-linux/swaponoff.c+5 -0
@@ -323,6 +323,11 @@ int swap_on_off_main(int argc UNUSED_PARAM, char **argv)
ret = do_all_in_proc_swaps();
ret |= do_em_all_in_fstab();
} else if (!*argv) {
+ if (!do_swapoff) {
+ /* bare "swapon" shows current swap usage */
+ *--argv = (char*)"/proc/swaps";
+ return bb_cat(argv);
+ }
/* if not -a we need at least one arg */
bb_show_usage();
}