commit a06a7108c88d7571a87a69f7c9bd59af49d538ca (tree)
parent 6a6e72fff820fb641aa1b00700f6835430dae72e
Author: Hugo Beauzée-Luyssen <hugo.beauzee@datadoghq.com>
Date: Fri, 7 Feb 2025 11:59:57 +0100
generic glibc: guard memfd_create & mlock2 declarations
They were introduced in glibc 2.27
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/libc/include/generic-glibc/bits/mman-shared.h b/lib/libc/include/generic-glibc/bits/mman-shared.h
@@ -50,6 +50,9 @@
__BEGIN_DECLS
+// zig patch: check target glibc version
+# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 27) || __GLIBC__ > 2
+
/* Create a new memory file descriptor. NAME is a name for debugging.
FLAGS is a combination of the MFD_* constants. */
int memfd_create (const char *__name, unsigned int __flags) __THROW;
@@ -58,6 +61,8 @@ int memfd_create (const char *__name, unsigned int __flags) __THROW;
memory. FLAGS is a combination of the MLOCK_* flags above. */
int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
+#endif /* if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 27) || __GLIBC__ > 2 */
+
/* Allocate a new protection key, with the PKEY_DISABLE_* bits
specified in ACCESS_RIGHTS. The protection key mask for the
current thread is updated to match the access privilege for the new
@@ -82,4 +87,4 @@ int pkey_mprotect (void *__addr, size_t __len, int __prot, int __pkey) __THROW;
__END_DECLS
-#endif /* __USE_GNU */
-\ No newline at end of file
+#endif /* __USE_GNU */