Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
sbin/sysctl/sysctl.c Fix integer overflows in printf format strings PR: 199673 Submitted by: Vitaly Magerya Reviewed by: cem Approved by: re (marius) MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D6941
This commit is contained in:
parent
a8fc1b786d
commit
4dad99bf48
@ -623,15 +623,15 @@ S_vmtotal(size_t l2, void *p)
|
||||
"%hd Sleep: %hd)\n",
|
||||
v->t_rq, v->t_dw, v->t_pw, v->t_sl);
|
||||
printf(
|
||||
"Virtual Memory:\t\t(Total: %dK Active: %dK)\n",
|
||||
v->t_vm * pageKilo, v->t_avm * pageKilo);
|
||||
printf("Real Memory:\t\t(Total: %dK Active: %dK)\n",
|
||||
v->t_rm * pageKilo, v->t_arm * pageKilo);
|
||||
printf("Shared Virtual Memory:\t(Total: %dK Active: %dK)\n",
|
||||
v->t_vmshr * pageKilo, v->t_avmshr * pageKilo);
|
||||
printf("Shared Real Memory:\t(Total: %dK Active: %dK)\n",
|
||||
v->t_rmshr * pageKilo, v->t_armshr * pageKilo);
|
||||
printf("Free Memory:\t%dK", v->t_free * pageKilo);
|
||||
"Virtual Memory:\t\t(Total: %jdK Active: %jdK)\n",
|
||||
(intmax_t)v->t_vm * pageKilo, (intmax_t)v->t_avm * pageKilo);
|
||||
printf("Real Memory:\t\t(Total: %jdK Active: %jdK)\n",
|
||||
(intmax_t)v->t_rm * pageKilo, (intmax_t)v->t_arm * pageKilo);
|
||||
printf("Shared Virtual Memory:\t(Total: %jdK Active: %jdK)\n",
|
||||
(intmax_t)v->t_vmshr * pageKilo, (intmax_t)v->t_avmshr * pageKilo);
|
||||
printf("Shared Real Memory:\t(Total: %jdK Active: %jdK)\n",
|
||||
(intmax_t)v->t_rmshr * pageKilo, (intmax_t)v->t_armshr * pageKilo);
|
||||
printf("Free Memory:\t%jdK", (intmax_t)v->t_free * pageKilo);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user