library: Cygwin doesnt have /proc/vmstat

Make the vmstat_read_failed() return non-error for Cygwin as
it always will error because /proc/vmstat doesn't exist.

Patch from Achim of the Cygwin project.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
Craig Small 2022-05-31 20:41:30 +10:00
parent 20859f6fa6
commit 4a183003a0

View File

@ -1170,6 +1170,7 @@ static int vmstat_read_failed (
// clear out the soon to be 'current' values // clear out the soon to be 'current' values
memset(&info->hist.new, 0, sizeof(struct vmstat_data)); memset(&info->hist.new, 0, sizeof(struct vmstat_data));
#ifndef __CYGWIN__ /* /proc/vmstat does not exist */
if (-1 == info->vmstat_fd if (-1 == info->vmstat_fd
&& (-1 == (info->vmstat_fd = open(VMSTAT_FILE, O_RDONLY)))) && (-1 == (info->vmstat_fd = open(VMSTAT_FILE, O_RDONLY))))
return 1; return 1;
@ -1213,7 +1214,7 @@ static int vmstat_read_failed (
break; break;
head = tail + 1; head = tail + 1;
} }
#endif /* !__CYGWIN__ */
return 0; return 0;
} // end: vmstat_read_failed } // end: vmstat_read_failed