aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/mingw.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index 75635fdf1..48d2eefa7 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -1368,6 +1368,30 @@ int mingw_unlink(const char *pathname)
1368 return ret; 1368 return ret;
1369} 1369}
1370 1370
1371int sysinfo(struct sysinfo *info)
1372{
1373 DECLARE_PROC_ADDR(BOOL, GlobalMemoryStatusEx, LPMEMORYSTATUSEX);
1374 MEMORYSTATUSEX mem;
1375
1376 memset((void *)info, 0, sizeof(struct sysinfo));
1377
1378 if (!INIT_PROC_ADDR(kernel32.dll, GlobalMemoryStatusEx)) {
1379 return -1;
1380 }
1381
1382 mem.dwLength = sizeof(MEMORYSTATUSEX);
1383 if (!GlobalMemoryStatusEx(&mem))
1384 return -1;
1385
1386 info->mem_unit = 1;
1387 info->totalram = mem.ullTotalPhys;
1388 info->freeram = mem.ullAvailPhys;
1389 info->totalswap = mem.ullTotalPageFile - mem.ullTotalPhys;
1390 info->freeswap = mem.ullAvailPageFile - mem.ullAvailPhys;
1391
1392 return 0;
1393}
1394
1371#undef strftime 1395#undef strftime
1372size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm *tm) 1396size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm *tm)
1373{ 1397{