Browse Source

use getpagesize() to get PAGE_SIZE on FreeBSD.

v0.7.4-release
Vanilla Hsu 15 years ago
committed by Ryan Dahl
parent
commit
b13081691e
  1. 3
      src/node.cc

3
src/node.cc

@ -597,6 +597,7 @@ int getmem(size_t *rss, size_t *vsize) {
struct kinfo_proc *kinfo = NULL; struct kinfo_proc *kinfo = NULL;
pid_t pid; pid_t pid;
int nprocs; int nprocs;
size_t page_size = getpagesize();
pid = getpid(); pid = getpid();
@ -606,7 +607,7 @@ int getmem(size_t *rss, size_t *vsize) {
kinfo = kvm_getprocs(kd, KERN_PROC_PID, pid, &nprocs); kinfo = kvm_getprocs(kd, KERN_PROC_PID, pid, &nprocs);
if (kinfo == NULL) goto error; if (kinfo == NULL) goto error;
*rss = kinfo->ki_rssize * PAGE_SIZE; *rss = kinfo->ki_rssize * page_size;
*vsize = kinfo->ki_size; *vsize = kinfo->ki_size;
kvm_close(kd); kvm_close(kd);

Loading…
Cancel
Save