diff options
author | Ron Yorston <rmy@pobox.com> | 2021-02-18 15:27:44 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-02-18 15:47:47 +0000 |
commit | 2b8770720868c750ad8609df4041337eb2c6cf71 (patch) | |
tree | 85aff1e2b748d0e75ee5dbe82bc574bb2a5a9c1b /include | |
parent | 2d20b9d88c4fc91637babaafa4a60dd7943e03a7 (diff) | |
download | busybox-w32-2b8770720868c750ad8609df4041337eb2c6cf71.tar.gz busybox-w32-2b8770720868c750ad8609df4041337eb2c6cf71.tar.bz2 busybox-w32-2b8770720868c750ad8609df4041337eb2c6cf71.zip |
free: implement sysinfo(2) and enable free(1)
This is an experimental implementation of sysinfo(2)/free(1).
It uses the WIN32 API GlobalMemoryStatusEx() to obtain information
about memory.
It seems that the 'total pagefile' value includes total RAM as well
as pagefile and 'available pagefile' includes available RAM. So the
RAM values are deducted.
I've no idea what corresponds to Linux buffers and cache.
Diffstat (limited to 'include')
-rw-r--r-- | include/mingw.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/mingw.h b/include/mingw.h index f16d086e2..c2a8b61bf 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -349,6 +349,28 @@ int mingw_fstat(int fd, struct mingw_stat *buf); | |||
349 | #define fstat mingw_fstat | 349 | #define fstat mingw_fstat |
350 | 350 | ||
351 | /* | 351 | /* |
352 | * sys/sysinfo.h | ||
353 | */ | ||
354 | struct sysinfo { | ||
355 | long uptime; /* Seconds since boot */ | ||
356 | unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ | ||
357 | unsigned long totalram; /* Total usable main memory size */ | ||
358 | unsigned long freeram; /* Available memory size */ | ||
359 | unsigned long sharedram; /* Amount of shared memory */ | ||
360 | unsigned long bufferram; /* Memory used by buffers */ | ||
361 | unsigned long totalswap; /* Total swap space size */ | ||
362 | unsigned long freeswap; /* Swap space still available */ | ||
363 | unsigned short procs; /* Number of current processes */ | ||
364 | unsigned long totalhigh; /* Total high memory size */ | ||
365 | unsigned long freehigh; /* Available high memory size */ | ||
366 | unsigned int mem_unit; /* Memory unit size in bytes */ | ||
367 | char _f[20-2*sizeof(long)-sizeof(int)]; | ||
368 | /* Padding to 64 bytes */ | ||
369 | }; | ||
370 | |||
371 | int sysinfo(struct sysinfo *info); | ||
372 | |||
373 | /* | ||
352 | * sys/sysmacros.h | 374 | * sys/sysmacros.h |
353 | */ | 375 | */ |
354 | #define makedev(a,b) 0*(a)*(b) /* avoid unused warning */ | 376 | #define makedev(a,b) 0*(a)*(b) /* avoid unused warning */ |