tools/squashfs4: add new tool for squashfs4 images
[openwrt/staging/aparcar.git] / tools / squashfs4 / patches / 002-Mksquashfs-Make-sysinfo-conditional.patch
diff --git a/tools/squashfs4/patches/002-Mksquashfs-Make-sysinfo-conditional.patch b/tools/squashfs4/patches/002-Mksquashfs-Make-sysinfo-conditional.patch
new file mode 100644 (file)
index 0000000..d152181
--- /dev/null
@@ -0,0 +1,30 @@
+From 374e39a786a5acda841056bec26fd0e0c4d40dac Mon Sep 17 00:00:00 2001
+From: Phillip Lougher <phillip@squashfs.org.uk>
+Date: Mon, 15 Aug 2022 17:09:05 +0100
+Subject: [PATCH 1/1] Mksquashfs: Make sysinfo() conditional
+
+Fixes https://github.com/plougher/squashfs-tools/issues/123
+
+Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
+---
+ squashfs-tools/mksquashfs.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -5802,6 +5802,7 @@ static int get_physical_memory()
+       long long page_size = sysconf(_SC_PAGESIZE);
+       int phys_mem;
++#ifdef __linux__
+       if(num_pages == -1 || page_size == -1) {
+               struct sysinfo sys;
+               int res = sysinfo(&sys);
+@@ -5812,6 +5813,7 @@ static int get_physical_memory()
+               num_pages = sys.totalram;
+               page_size = sys.mem_unit;
+       }
++#endif
+       phys_mem = num_pages * page_size >> 20;