]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fd-util: Move RAW_O_LARGEFILE definition to fd-util.h
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Thu, 3 Jul 2025 12:17:31 +0000 (14:17 +0200)
committerDaanDeMeyer <daan.j.demeyer@gmail.com>
Thu, 3 Jul 2025 12:18:50 +0000 (14:18 +0200)
This is not something that comes from glibc, but which we invent
ourselves. As such, it should not be part of our overrides of glibc
headers, but instead should be part of one of our own headers, so
let's move it to fd-util.h.

Follow up for 194a690181c4857542a094d19f5808f8f4032ed9

src/basic/fd-util.h
src/basic/include/fcntl.h

index 7d5b9f30831f67714704a82f6ba1bfdd5c9f3af4..75cc5310c7a25f48e3af8943a17877d2b099f1dd 100644 (file)
 #define EBADF_PAIR { -EBADF, -EBADF }
 #define EBADF_TRIPLET { -EBADF, -EBADF, -EBADF }
 
+/* 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.
+ *
+ * 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
+#  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
+
 int close_nointr(int fd);
 int safe_close(int fd);
 void safe_close_pair(int p[static 2]);
index 86e0c8bbf5eb976463cb1e9076b32d836b8a6ea3..344287f7680f9d526bb093e996f14b3dd745861c 100644 (file)
 #define F_SEAL_EXEC     0x0020  /* prevent chmod modifying exec bits */
 #endif
 
-/* 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.
- *
- * 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
-#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
-
 /* This is defined since glibc-2.39. */
 #ifndef AT_HANDLE_FID
 #define AT_HANDLE_FID AT_REMOVEDIR