Print this page
OS-5083 lx_proc /proc/swaps needs to try harder

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
          +++ new/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
↓ open down ↓ 3891 lines elided ↑ open up ↑
3892 3892                      forks_cum);
3893 3893          }
3894 3894  }
3895 3895  
3896 3896  /*
3897 3897   * lxpr_read_swaps():
3898 3898   *
3899 3899   * We don't support swap files or partitions, but some programs like to look
3900 3900   * here just to check we have some swap on the system, so we lie and show
3901 3901   * our entire swap cap as one swap partition.
     3902 + *
     3903 + * It is important to use formatting identical to the Linux implementation
     3904 + * so that consumers do not break. See swap_show() in mm/swapfile.c.
3902 3905   */
3903 3906  /* ARGSUSED */
3904 3907  static void
3905 3908  lxpr_read_swaps(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
3906 3909  {
3907 3910          zone_t *zone = curzone;
3908 3911          uint64_t totswap, usedswap;
3909 3912  
3910 3913          mutex_enter(&zone->zone_mem_lock);
3911 3914          /* Uses units of 1 kb (2^10). */
3912 3915          totswap = zone->zone_max_swap_ctl >> 10;
3913 3916          usedswap = zone->zone_max_swap >> 10;
3914 3917          mutex_exit(&zone->zone_mem_lock);
3915 3918  
3916 3919          lxpr_uiobuf_printf(uiobuf,
3917      -            "Filename                                "
3918      -            "Type            Size    Used    Priority\n");
3919      -        lxpr_uiobuf_printf(uiobuf, "%-40s%-16s%-8llu%-8llu%-8d\n",
     3920 +            "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
     3921 +        lxpr_uiobuf_printf(uiobuf, "%-40s%s\t%llu\t%llu\t%d\n",
3920 3922              "/dev/swap", "partition", totswap, usedswap, -1);
3921 3923  }
3922 3924  
3923 3925  /*
3924 3926   * inotify tunables exported via /proc.
3925 3927   */
3926 3928  extern int inotify_maxevents;
3927 3929  extern int inotify_maxinstances;
3928 3930  extern int inotify_maxwatches;
3929 3931  
↓ open down ↓ 2226 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX