aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/hardware_physmem.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-11-15 12:40:17 +0200
committerLasse Collin <lasse.collin@tukaani.org>2009-11-15 12:40:17 +0200
commit93e418562cf127a9171e87bcd4e9af8e1bfcdae4 (patch)
treeed57e18edfa1758f3763d7b85c370a8926861ccb /src/liblzma/common/hardware_physmem.c
parentUpdated THANKS. (diff)
downloadxz-93e418562cf127a9171e87bcd4e9af8e1bfcdae4.tar.xz
Add lzma_physmem().
I had hoped to keep liblzma as purely a compression library as possible (e.g. file I/O will go into a different library), but it seems that applications linking agaisnt liblzma need some way to determine the memory usage limit, and knowing the amount of RAM is one reasonable way to help making such decisions. Thanks to Jonathan Nieder for the original patch.
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/hardware_physmem.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/liblzma/common/hardware_physmem.c b/src/liblzma/common/hardware_physmem.c
new file mode 100644
index 00000000..7405b658
--- /dev/null
+++ b/src/liblzma/common/hardware_physmem.c
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file hardware_physmem.c
+/// \brief Get the total amount of physical memory (RAM)
+//
+// Author: Jonathan Nieder
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "common.h"
+
+#include "tuklib_physmem.h"
+
+
+extern LZMA_API(uint64_t)
+lzma_physmem(void)
+{
+ // It is simpler to make lzma_physmem() a wrapper for
+ // tuklib_physmem() than to hack appropriate symbol visiblity
+ // support for the tuklib modules.
+ return tuklib_physmem();
+}