| Index: base/sys_info_posix.cc
|
| diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
|
| index 07d08b72bbcb51fd8e550ab79409c55c6dff9af4..90baa69a2f61ec6489dcc36d32932a8c5de7dcb0 100644
|
| --- a/base/sys_info_posix.cc
|
| +++ b/base/sys_info_posix.cc
|
| @@ -7,6 +7,7 @@
|
| #include <errno.h>
|
| #include <string.h>
|
| #include <sys/param.h>
|
| +#include <sys/resource.h>
|
| #include <sys/utsname.h>
|
| #include <unistd.h>
|
|
|
| @@ -45,6 +46,20 @@ base::LazyInstance<
|
| g_lazy_number_of_processors = LAZY_INSTANCE_INITIALIZER;
|
| #endif
|
|
|
| +int64 AmountOfVirtualMemory() {
|
| + struct rlimit limit;
|
| + int result = getrlimit(RLIMIT_DATA, &limit);
|
| + if (result != 0) {
|
| + NOTREACHED();
|
| + return 0;
|
| + }
|
| + return limit.rlim_cur == RLIM_INFINITY ? 0 : limit.rlim_cur;
|
| +}
|
| +
|
| +base::LazyInstance<
|
| + base::internal::LazySysInfoValue<int64, AmountOfVirtualMemory> >::Leaky
|
| + g_lazy_virtual_memory = LAZY_INSTANCE_INITIALIZER;
|
| +
|
| } // namespace
|
|
|
| namespace base {
|
| @@ -56,6 +71,11 @@ int SysInfo::NumberOfProcessors() {
|
| #endif
|
|
|
| // static
|
| +int64 SysInfo::AmountOfVirtualMemory() {
|
| + return g_lazy_virtual_memory.Get().value();
|
| +}
|
| +
|
| +// static
|
| int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
|
| base::ThreadRestrictions::AssertIOAllowed();
|
|
|
|
|