]> granicus.if.org Git - procps-ng/commitdiff
library: Cygwin doesnt have /proc/vmstat
authorCraig Small <csmall@dropbear.xyz>
Tue, 31 May 2022 10:41:30 +0000 (20:41 +1000)
committerCraig Small <csmall@dropbear.xyz>
Tue, 31 May 2022 10:41:30 +0000 (20:41 +1000)
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>
proc/vmstat.c

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