aboutsummaryrefslogtreecommitdiffstats
path: root/tools/squashfs4/patches/002-Mksquashfs-Make-sysinfo-conditional.patch
blob: d152181f8a99672142f3050b402a6f28bbea1b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;