diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2014-07-10 22:09:26 +0300 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2014-07-10 22:09:26 +0300 |
| commit | 644656aa562a78edf384abd6f4ce80bc930d5547 (patch) | |
| tree | a79082623aa01754bf31555c72031ad6bb24feb4 /src/alloc.c | |
| parent | 64c333303ce41c4d014d676ff4cbeeb887506c9e (diff) | |
| download | emacs-644656aa562a78edf384abd6f4ce80bc930d5547.tar.gz | |
Implement memory-info for MS-Windows.
src/w32.c (w32_memory_info): New function.
src/w32.h (w32_memory_info): Prototype it.
src/alloc.c (Fmemory_info) [WINDOWSNT]: Call it.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c index c535e836397..4a912703c39 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6875,7 +6875,7 @@ All values are in Kbytes. If there is no swap space, last two values are zero. If the system is not supported, return nil. */) (void) { -#ifdef HAVE_LINUX_SYSINFO +#if defined HAVE_LINUX_SYSINFO struct sysinfo si; uintmax_t units; @@ -6885,12 +6885,22 @@ values are zero. If the system is not supported, return nil. */) units = si.mem_unit; #else units = 1; -#endif +#endif return list4i ((uintmax_t) si.totalram * units / 1024, (uintmax_t) si.freeram * units / 1024, (uintmax_t) si.totalswap * units / 1024, (uintmax_t) si.freeswap * units / 1024); -#else /* not HAVE_LINUX_SYSINFO */ +#elif defined WINDOWSNT + unsigned long long totalram, freeram, totalswap, freeswap; + + if (w32_memory_info (&totalram, &freeram, &totalswap, &freeswap) == 0) + return list4i ((uintmax_t) totalram / 1024, + (uintmax_t) freeram / 1024, + (uintmax_t) totalswap / 1024, + (uintmax_t) freeswap / 1024); + else + return Qnil; +#else /* not HAVE_LINUX_SYSINFO, not WINDOWSNT */ /* FIXME: add more systems. */ return Qnil; #endif /* HAVE_LINUX_SYSINFO */ |
