tools/squashfs4: add new tool for squashfs4 images
[openwrt/staging/nbd.git] / tools / squashfs4 / patches / 002-Mksquashfs-Make-sysinfo-conditional.patch
1 From 374e39a786a5acda841056bec26fd0e0c4d40dac Mon Sep 17 00:00:00 2001
2 From: Phillip Lougher <phillip@squashfs.org.uk>
3 Date: Mon, 15 Aug 2022 17:09:05 +0100
4 Subject: [PATCH 1/1] Mksquashfs: Make sysinfo() conditional
5
6 Fixes https://github.com/plougher/squashfs-tools/issues/123
7
8 Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
9 ---
10 squashfs-tools/mksquashfs.c | 2 ++
11 1 file changed, 2 insertions(+)
12
13 --- a/squashfs-tools/mksquashfs.c
14 +++ b/squashfs-tools/mksquashfs.c
15 @@ -5802,6 +5802,7 @@ static int get_physical_memory()
16 long long page_size = sysconf(_SC_PAGESIZE);
17 int phys_mem;
18
19 +#ifdef __linux__
20 if(num_pages == -1 || page_size == -1) {
21 struct sysinfo sys;
22 int res = sysinfo(&sys);
23 @@ -5812,6 +5813,7 @@ static int get_physical_memory()
24 num_pages = sys.totalram;
25 page_size = sys.mem_unit;
26 }
27 +#endif
28
29 phys_mem = num_pages * page_size >> 20;
30