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


3882                     "swap %lu %lu\n"
3883                     "intr %lu\n"
3884                     "ctxt %lu\n"
3885                     "btime %lu\n"
3886                     "processes %lu\n",
3887                     pgpgin_cum, pgpgout_cum,
3888                     pgswapin_cum, pgswapout_cum,
3889                     intr_cum,
3890                     pswitch_cum,
3891                     boot_time,
3892                     forks_cum);
3893         }
3894 }
3895 
3896 /*
3897  * lxpr_read_swaps():
3898  *
3899  * We don't support swap files or partitions, but some programs like to look
3900  * here just to check we have some swap on the system, so we lie and show
3901  * our entire swap cap as one swap partition.



3902  */
3903 /* ARGSUSED */
3904 static void
3905 lxpr_read_swaps(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
3906 {
3907         zone_t *zone = curzone;
3908         uint64_t totswap, usedswap;
3909 
3910         mutex_enter(&zone->zone_mem_lock);
3911         /* Uses units of 1 kb (2^10). */
3912         totswap = zone->zone_max_swap_ctl >> 10;
3913         usedswap = zone->zone_max_swap >> 10;
3914         mutex_exit(&zone->zone_mem_lock);
3915 
3916         lxpr_uiobuf_printf(uiobuf,
3917             "Filename                                "
3918             "Type            Size    Used    Priority\n");
3919         lxpr_uiobuf_printf(uiobuf, "%-40s%-16s%-8llu%-8llu%-8d\n",
3920             "/dev/swap", "partition", totswap, usedswap, -1);
3921 }
3922 
3923 /*
3924  * inotify tunables exported via /proc.
3925  */
3926 extern int inotify_maxevents;
3927 extern int inotify_maxinstances;
3928 extern int inotify_maxwatches;
3929 
3930 static void
3931 lxpr_read_sys_fs_inotify_max_queued_events(lxpr_node_t *lxpnp,
3932     lxpr_uiobuf_t *uiobuf)
3933 {
3934         ASSERT(lxpnp->lxpr_type == LXPR_SYS_FS_INOTIFY_MAX_QUEUED_EVENTS);
3935         lxpr_uiobuf_printf(uiobuf, "%d\n", inotify_maxevents);
3936 }
3937 
3938 static void
3939 lxpr_read_sys_fs_inotify_max_user_instances(lxpr_node_t *lxpnp,




3882                     "swap %lu %lu\n"
3883                     "intr %lu\n"
3884                     "ctxt %lu\n"
3885                     "btime %lu\n"
3886                     "processes %lu\n",
3887                     pgpgin_cum, pgpgout_cum,
3888                     pgswapin_cum, pgswapout_cum,
3889                     intr_cum,
3890                     pswitch_cum,
3891                     boot_time,
3892                     forks_cum);
3893         }
3894 }
3895 
3896 /*
3897  * lxpr_read_swaps():
3898  *
3899  * We don't support swap files or partitions, but some programs like to look
3900  * here just to check we have some swap on the system, so we lie and show
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.
3905  */
3906 /* ARGSUSED */
3907 static void
3908 lxpr_read_swaps(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
3909 {
3910         zone_t *zone = curzone;
3911         uint64_t totswap, usedswap;
3912 
3913         mutex_enter(&zone->zone_mem_lock);
3914         /* Uses units of 1 kb (2^10). */
3915         totswap = zone->zone_max_swap_ctl >> 10;
3916         usedswap = zone->zone_max_swap >> 10;
3917         mutex_exit(&zone->zone_mem_lock);
3918 
3919         lxpr_uiobuf_printf(uiobuf,
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",

3922             "/dev/swap", "partition", totswap, usedswap, -1);
3923 }
3924 
3925 /*
3926  * inotify tunables exported via /proc.
3927  */
3928 extern int inotify_maxevents;
3929 extern int inotify_maxinstances;
3930 extern int inotify_maxwatches;
3931 
3932 static void
3933 lxpr_read_sys_fs_inotify_max_queued_events(lxpr_node_t *lxpnp,
3934     lxpr_uiobuf_t *uiobuf)
3935 {
3936         ASSERT(lxpnp->lxpr_type == LXPR_SYS_FS_INOTIFY_MAX_QUEUED_EVENTS);
3937         lxpr_uiobuf_printf(uiobuf, "%d\n", inotify_maxevents);
3938 }
3939 
3940 static void
3941 lxpr_read_sys_fs_inotify_max_user_instances(lxpr_node_t *lxpnp,