diff options
author | Alex Wilson <alex.wilson@joyent.com> | 2015-08-18 14:36:18 -0700 |
---|---|---|
committer | Alex Wilson <alex.wilson@joyent.com> | 2015-08-18 16:59:06 -0700 |
commit | 0419a9a222016c689edfe5fe1244f983cbb7f807 (patch) | |
tree | 5a68715653a0e724b006d586e72679ac6e901a0b | |
parent | abaee2673042ff817f068c8401f34b8316e8962c (diff) | |
download | illumos-joyent-0419a9a222016c689edfe5fe1244f983cbb7f807.tar.gz |
OS-4657 LX brand /proc/swaps should show some swap
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Cody Mello <cody.mello@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r-- | usr/src/uts/common/brand/lx/procfs/lx_prvnops.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c index b574992967..d7949aee53 100644 --- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c +++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c @@ -3851,16 +3851,28 @@ lxpr_read_stat(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf) /* * lxpr_read_swaps(): * - * We don't support swap files or partitions, so just provide a dummy file with - * the necessary header. + * 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. */ /* ARGSUSED */ static void lxpr_read_swaps(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf) { + zone_t *zone = curzone; + uint64_t totswap, usedswap; + + mutex_enter(&zone->zone_mem_lock); + /* Uses units of 1 kb (2^10). */ + 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); } /* |