From d45e112ba4fda9d2929bf578f18acdc94e44a80c Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 8 Jul 2005 01:49:18 +0000 Subject: [PATCH] some windows rlimits --- src/sigar.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/sigar.c b/src/sigar.c index 0deb59c3..fc4acdd8 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -753,7 +753,21 @@ SIGAR_DECLARE(int) sigar_who_list_get(sigar_t *sigar, SIGAR_DECLARE(int) sigar_resource_limit_get(sigar_t *sigar, sigar_resource_limit_t *rlimit) { - return SIGAR_ENOTIMPL; + MEMORY_BASIC_INFORMATION meminfo; + memset(rlimit, -1, sizeof(*rlimit)); + + if (VirtualQuery((LPCVOID)&meminfo, &meminfo, sizeof(meminfo))) { + rlimit->stack_cur = + (DWORD)&meminfo - (DWORD)meminfo.AllocationBase; + rlimit->stack_max = + ((DWORD)meminfo.BaseAddress + meminfo.RegionSize) - + (DWORD)meminfo.AllocationBase; + } + + rlimit->virtual_memory_max = rlimit->virtual_memory_cur = + 0x80000000UL; + + return SIGAR_OK; } #else