Index: sys/sys/vmmeter.h =================================================================== --- sys/sys/vmmeter.h +++ sys/sys/vmmeter.h @@ -46,15 +46,15 @@ int16_t t_pw; /* jobs in page wait */ int16_t t_sl; /* jobs sleeping in core */ int16_t t_sw; /* swapped out runnable/short block jobs */ - int32_t t_vm; /* total virtual memory */ - int32_t t_avm; /* active virtual memory */ + uint64_t t_vm; /* total virtual memory */ + uint64_t t_avm; /* active virtual memory */ int32_t t_rm; /* total real memory in use */ int32_t t_arm; /* active real memory */ - int32_t t_vmshr; /* shared virtual memory */ - int32_t t_avmshr; /* active shared virtual memory */ + uint64_t t_vmshr; /* shared virtual memory */ + uint64_t t_avmshr; /* active shared virtual memory */ int32_t t_rmshr; /* shared real memory */ int32_t t_armshr; /* active shared real memory */ - int32_t t_free; /* free memory pages */ + uint32_t t_free; /* free memory pages */ }; #if defined(_KERNEL) || defined(_WANT_VMMETER) Index: sys/vm/vm_meter.c =================================================================== --- sys/vm/vm_meter.c +++ sys/vm/vm_meter.c @@ -152,10 +152,32 @@ return (obj->ref_count > obj->shadow_count); } +#if defined(COMPAT_FREEBSD11) +struct vmtotal11 { + int16_t t_rq; + int16_t t_dw; + int16_t t_pw; + int16_t t_sl; + int16_t t_sw; + int32_t t_vm; + int32_t t_avm; + int32_t t_rm; + int32_t t_arm; + int32_t t_vmshr; + int32_t t_avmshr; + int32_t t_rmshr; + int32_t t_armshr; + int32_t t_free; +}; +#endif + static int vmtotal(SYSCTL_HANDLER_ARGS) { struct vmtotal total; +#if defined(COMPAT_FREEBSD11) + struct vmtotal11 total11; +#endif vm_object_t object; struct proc *p; struct thread *td; @@ -253,6 +275,29 @@ } mtx_unlock(&vm_object_list_mtx); total.t_free = vm_cnt.v_free_count; +#if defined(COMPAT_FREEBSD11) + if (req->oldlen == sizeof(total11)) { + bzero(&total11, sizeof(total11)); + + total11.t_rq = total.t_rq; + total11.t_dw = total.t_dw; + total11.t_pw = total.t_pw; + total11.t_sl = total.t_sl; + total11.t_sw = total.t_sw; + total11.t_vm = total.t_vm; /* trucate */ + total11.t_avm = total.t_avm; /* trucate */ + total11.t_rm = total.t_rm; + total11.t_arm = total.t_arm; + total11.t_vmshr = total.t_vmshr; /* truncate */ + total11.t_avmshr = total.t_avmshr; /* truncate */ + total11.t_rmshr = total.t_rmshr; + total11.t_armshr = total.t_armshr; + total11.t_free = total.t_free; /* trucate */ + + return (sysctl_handle_opaque(oidp, &total11, sizeof(total11), + req)); + } +#endif return (sysctl_handle_opaque(oidp, &total, sizeof(total), req)); }