Print this page
OS-5083 lx_proc /proc/swaps needs to try harder
*** 3897,3906 ****
--- 3897,3909 ----
* lxpr_read_swaps():
*
* We don't support swap files or partitions, but some programs like to look
* here just to check we have some swap on the system, so we lie and show
* our entire swap cap as one swap partition.
+ *
+ * It is important to use formatting identical to the Linux implementation
+ * so that consumers do not break. See swap_show() in mm/swapfile.c.
*/
/* ARGSUSED */
static void
lxpr_read_swaps(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
{
*** 3912,3924 ****
totswap = zone->zone_max_swap_ctl >> 10;
usedswap = zone->zone_max_swap >> 10;
mutex_exit(&zone->zone_mem_lock);
lxpr_uiobuf_printf(uiobuf,
! "Filename "
! "Type Size Used Priority\n");
! lxpr_uiobuf_printf(uiobuf, "%-40s%-16s%-8llu%-8llu%-8d\n",
"/dev/swap", "partition", totswap, usedswap, -1);
}
/*
* inotify tunables exported via /proc.
--- 3915,3926 ----
totswap = zone->zone_max_swap_ctl >> 10;
usedswap = zone->zone_max_swap >> 10;
mutex_exit(&zone->zone_mem_lock);
lxpr_uiobuf_printf(uiobuf,
! "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
! lxpr_uiobuf_printf(uiobuf, "%-40s%s\t%llu\t%llu\t%d\n",
"/dev/swap", "partition", totswap, usedswap, -1);
}
/*
* inotify tunables exported via /proc.