diff options
| author | Eli Zaretskii | 2014-07-10 22:09:26 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-07-10 22:09:26 +0300 |
| commit | 644656aa562a78edf384abd6f4ce80bc930d5547 (patch) | |
| tree | a79082623aa01754bf31555c72031ad6bb24feb4 /src/alloc.c | |
| parent | 64c333303ce41c4d014d676ff4cbeeb887506c9e (diff) | |
| download | emacs-644656aa562a78edf384abd6f4ce80bc930d5547.tar.gz emacs-644656aa562a78edf384abd6f4ce80bc930d5547.zip | |
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 | |||
| 6875 | values are zero. If the system is not supported, return nil. */) | 6875 | values are zero. If the system is not supported, return nil. */) |
| 6876 | (void) | 6876 | (void) |
| 6877 | { | 6877 | { |
| 6878 | #ifdef HAVE_LINUX_SYSINFO | 6878 | #if defined HAVE_LINUX_SYSINFO |
| 6879 | struct sysinfo si; | 6879 | struct sysinfo si; |
| 6880 | uintmax_t units; | 6880 | uintmax_t units; |
| 6881 | 6881 | ||
| @@ -6885,12 +6885,22 @@ values are zero. If the system is not supported, return nil. */) | |||
| 6885 | units = si.mem_unit; | 6885 | units = si.mem_unit; |
| 6886 | #else | 6886 | #else |
| 6887 | units = 1; | 6887 | units = 1; |
| 6888 | #endif | 6888 | #endif |
| 6889 | return list4i ((uintmax_t) si.totalram * units / 1024, | 6889 | return list4i ((uintmax_t) si.totalram * units / 1024, |
| 6890 | (uintmax_t) si.freeram * units / 1024, | 6890 | (uintmax_t) si.freeram * units / 1024, |
| 6891 | (uintmax_t) si.totalswap * units / 1024, | 6891 | (uintmax_t) si.totalswap * units / 1024, |
| 6892 | (uintmax_t) si.freeswap * units / 1024); | 6892 | (uintmax_t) si.freeswap * units / 1024); |
| 6893 | #else /* not HAVE_LINUX_SYSINFO */ | 6893 | #elif defined WINDOWSNT |
| 6894 | unsigned long long totalram, freeram, totalswap, freeswap; | ||
| 6895 | |||
| 6896 | if (w32_memory_info (&totalram, &freeram, &totalswap, &freeswap) == 0) | ||
| 6897 | return list4i ((uintmax_t) totalram / 1024, | ||
| 6898 | (uintmax_t) freeram / 1024, | ||
| 6899 | (uintmax_t) totalswap / 1024, | ||
| 6900 | (uintmax_t) freeswap / 1024); | ||
| 6901 | else | ||
| 6902 | return Qnil; | ||
| 6903 | #else /* not HAVE_LINUX_SYSINFO, not WINDOWSNT */ | ||
| 6894 | /* FIXME: add more systems. */ | 6904 | /* FIXME: add more systems. */ |
| 6895 | return Qnil; | 6905 | return Qnil; |
| 6896 | #endif /* HAVE_LINUX_SYSINFO */ | 6906 | #endif /* HAVE_LINUX_SYSINFO */ |