* resource.cc (fill_rusage): Perform paranoid zero structure passed to

GetProcessMemoryInfo.
This commit is contained in:
Christopher Faylor 2001-10-22 00:10:46 +00:00
parent 1f0191e542
commit d055070040
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2001-10-21 Christopher Faylor <cgf@redhat.com>
* resource.cc (fill_rusage): Perform paranoid zero structure passed to
GetProcessMemoryInfo.
2001-10-22 Robert Collins <rbtcollins@hotmail.com> 2001-10-22 Robert Collins <rbtcollins@hotmail.com>
* autoload.cc: Autoload GetProcessMemoryInfo. * autoload.cc: Autoload GetProcessMemoryInfo.

View File

@ -77,6 +77,7 @@ fill_rusage (struct rusage *r, HANDLE h)
PROCESS_MEMORY_COUNTERS pmc; PROCESS_MEMORY_COUNTERS pmc;
memset (&pmc, 0, sizeof (pmc));
if (GetProcessMemoryInfo( h, &pmc, sizeof (pmc))) if (GetProcessMemoryInfo( h, &pmc, sizeof (pmc)))
{ {
r->ru_maxrss += (long) (pmc.WorkingSetSize /1024); r->ru_maxrss += (long) (pmc.WorkingSetSize /1024);
@ -111,8 +112,7 @@ getrusage (int intwho, struct rusage *rusage_in)
unsigned long rlim_core = RLIM_INFINITY; unsigned long rlim_core = RLIM_INFINITY;
extern "C" extern "C" int
int
getrlimit (int resource, struct rlimit *rlp) getrlimit (int resource, struct rlimit *rlp)
{ {
MEMORY_BASIC_INFORMATION m; MEMORY_BASIC_INFORMATION m;
@ -156,8 +156,7 @@ getrlimit (int resource, struct rlimit *rlp)
return 0; return 0;
} }
extern "C" extern "C" int
int
setrlimit (int resource, const struct rlimit *rlp) setrlimit (int resource, const struct rlimit *rlp)
{ {
if (check_null_invalid_struct_errno (rlp)) if (check_null_invalid_struct_errno (rlp))