tools/squashfs4: add new tool for squashfs4 images
[openwrt/staging/aparcar.git] / tools / squashfs4 / patches / 006-Move-sysinfo.h-into-the-linux-only-section-should-fi.patch
diff --git a/tools/squashfs4/patches/006-Move-sysinfo.h-into-the-linux-only-section-should-fi.patch b/tools/squashfs4/patches/006-Move-sysinfo.h-into-the-linux-only-section-should-fi.patch
new file mode 100644 (file)
index 0000000..3643561
--- /dev/null
@@ -0,0 +1,49 @@
+From b2f6454a2b2517cfba7a24cf02e9bdf3b959c86a Mon Sep 17 00:00:00 2001
+From: Tony Butler <spudz76@gmail.com>
+Date: Sat, 18 Feb 2023 13:20:48 -0800
+Subject: [PATCH] Move sysinfo.h into the linux-only section, should fix build
+ on MacOS.
+
+All compilers set `__linux__`, but `linux` may not be defined, and usage
+was mixed.  Use `__linux__` everywhere instead.
+
+Signed-off-by: Tony Butler <spudz76@gmail.com>
+---
+ squashfs-tools/mksquashfs.c | 6 +++---
+ squashfs-tools/unsquashfs.c | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -50,9 +50,9 @@
+ #include <sys/wait.h>
+ #include <limits.h>
+ #include <ctype.h>
+-#include <sys/sysinfo.h>
+-#ifdef linux
++#ifdef __linux__
++#include <sys/sysinfo.h>
+ #include <sched.h>
+ #else
+ #include <sys/sysctl.h>
+@@ -5081,7 +5081,7 @@ static void initialise_threads(int readq
+               BAD_ERROR("Failed to set signal mask in intialise_threads\n");
+       if(processors == -1) {
+-#ifdef linux
++#ifdef __linux__
+               cpu_set_t cpu_set;
+               CPU_ZERO(&cpu_set);
+--- a/squashfs-tools/unsquashfs.c
++++ b/squashfs-tools/unsquashfs.c
+@@ -2720,7 +2720,7 @@ void initialise_threads(int fragment_buf
+       }
+       if(processors == -1) {
+-#ifdef linux
++#ifdef __linux__
+               cpu_set_t cpu_set;
+               CPU_ZERO(&cpu_set);