Bug 969800 - Fix nsMemoryReporterManager::GetVsize for !HAVE_VSIZE_AND_RESIDENT_REPORTERS and add GNU/kFreeBSD support to nsMemoryReporterManager. r=njn

This commit is contained in:
Mike Hommey 2014-02-11 10:43:41 +09:00
parent 082475052b
commit 9ff8bb64aa

View File

@ -120,11 +120,12 @@ public:
NS_IMPL_ISUPPORTS1(ResidentUniqueReporter, nsIMemoryReporter)
#elif defined(__DragonFly__) || defined(__FreeBSD__) \
|| defined(__NetBSD__) || defined(__OpenBSD__)
|| defined(__NetBSD__) || defined(__OpenBSD__) \
|| defined(__FreeBSD_kernel__)
#include <sys/param.h>
#include <sys/sysctl.h>
#if defined(__DragonFly__) || defined(__FreeBSD__)
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <sys/user.h>
#endif
@ -141,7 +142,7 @@ NS_IMPL_ISUPPORTS1(ResidentUniqueReporter, nsIMemoryReporter)
#if defined(__DragonFly__)
#define KP_SIZE(kp) (kp.kp_vm_map_size)
#define KP_RSS(kp) (kp.kp_vm_rssize * getpagesize())
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#define KP_SIZE(kp) (kp.ki_size)
#define KP_RSS(kp) (kp.ki_rssize * getpagesize())
#elif defined(__NetBSD__)
@ -1381,7 +1382,7 @@ nsMemoryReporterManager::GetVsize(int64_t* aVsize)
#ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
return VsizeDistinguishedAmount(aVsize);
#else
*aResident = 0;
*aVsize = 0;
return NS_ERROR_NOT_AVAILABLE;
#endif
}