Commit 1865c47f authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

ntdll: Fix parsing of proc file. Also correct memory deallocation on the Mac.

parent 6ccf01fe
......@@ -938,7 +938,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
sppi[i].liKernelTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_SYSTEM];
sppi[i].liUserTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_USER];
}
vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count);
vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count * sizeof(natural_t));
}
}
#else
......@@ -950,10 +950,14 @@ NTSTATUS WINAPI NtQuerySystemInformation(
unsigned long idle;
int count;
char name[10];
char line[255];
/* first line is combined usage */
count = fscanf(cpuinfo,"%s %u %u %u %lu",name, &usr, &nice,
if (fgets(line,255,cpuinfo))
count = sscanf(line,"%s %u %u %u %lu",name, &usr, &nice,
&sys, &idle);
else
count = 0;
/* we set this up in the for older non-smp enabled kernels */
if (count == 5 && strcmp(name,"cpu")==0)
{
......@@ -968,8 +972,11 @@ NTSTATUS WINAPI NtQuerySystemInformation(
do
{
count = fscanf(cpuinfo,"%s %u %u %u %lu",name, &usr,
if (fgets(line,255,cpuinfo))
count = sscanf(line,"%s %u %u %u %lu",name, &usr,
&nice, &sys, &idle);
else
count = 0;
if (count == 5 && strncmp(name,"cpu",3)==0)
{
out_cpus --;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment