summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Vovk <adrianvovk@gmail.com>2024-02-20 20:24:01 +0100
committerAdrian Vovk <adrianvovk@gmail.com>2024-02-20 21:01:36 +0100
commit9e3db91f2f7663860657afbf2076ecebeeb26c93 (patch)
treecf9f87df86d426c7588a539833e46339e5b30416
parentcore/mount: if umount(8) fails but mount disappeared, assume success (diff)
downloadsystemd-9e3db91f2f7663860657afbf2076ecebeeb26c93.tar.xz
systemd-9e3db91f2f7663860657afbf2076ecebeeb26c93.zip
missing_fcntl: Fix RAW_O_LARGEFILE
This value is actually arch-specific, so this commit defines it for all the arches that set it to some custom value Fixes https://github.com/systemd/systemd/issues/31417
-rw-r--r--src/basic/missing_fcntl.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/basic/missing_fcntl.h b/src/basic/missing_fcntl.h
index 24b2dc3119..3c85befda9 100644
--- a/src/basic/missing_fcntl.h
+++ b/src/basic/missing_fcntl.h
@@ -69,9 +69,26 @@
/* So O_LARGEFILE is generally implied by glibc, and defined to zero hence, because we only build in LFS
* mode. However, when invoking fcntl(F_GETFL) the flag is ORed into the result anyway — glibc does not mask
- * it away. Which sucks. Let's define the actual value here, so that we can mask it ourselves. */
+ * it away. Which sucks. Let's define the actual value here, so that we can mask it ourselves.
+ *
+ * The precise definition is arch specific, so we use the values defined in the kernel (note that some
+ * are hexa and others are octal; duplicated as-is from the kernel definitions):
+ * - alpha, arm, arm64, m68k, mips, parisc, powerpc, sparc: each has a specific value;
+ * - others: they use the "generic" value (defined in include/uapi/asm-generic/fcntl.h) */
#if O_LARGEFILE != 0
#define RAW_O_LARGEFILE O_LARGEFILE
#else
-#define RAW_O_LARGEFILE 0100000
+#if defined(__alpha__) || defined(__arm__) || defined(__aarch64__) || defined(__m68k__)
+#define RAW_O_LARGEFILE 0400000
+#elif defined(__mips__)
+#define RAW_O_LARGEFILE 0x2000
+#elif defined(__parisc__) || defined(__hppa__)
+#define RAW_O_LARGEFILE 000004000
+#elif defined(__powerpc__)
+#define RAW_O_LARGEFILE 0200000
+#elif defined(__sparc__)
+#define RAW_O_LARGEFILE 0x40000
+#else
+#define RAW_O_LARGEFILE 00100000
+#endif
#endif