summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2024-08-11 20:22:48 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2024-08-11 20:22:48 +0200
commit811cd361e144dd7bdf75bcad8b4572ec786af5c7 (patch)
tree81451cdd45f1ecf5f72a2a12dd17fecb7b1cb889 /libc/sysdeps/linux
parent593eff77fa4d9ce95f3a9e7e8207ef9ddf4dcf9b (diff)
add memfd_create syscall wrapper
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/aarch64/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/alpha/bits/fcntl.h2
-rwxr-xr-xlibc/sysdeps/linux/arc/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/arm/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/avr32/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/bfin/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/c6x/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/common/Makefile.in1
-rw-r--r--libc/sysdeps/linux/common/bits/fcntl-linux.h34
-rw-r--r--libc/sysdeps/linux/common/bits/mman-shared.h2
-rw-r--r--libc/sysdeps/linux/common/memfd_create.c13
-rw-r--r--libc/sysdeps/linux/cris/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/csky/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/frv/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/h8300/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/hppa/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/i386/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/ia64/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/kvx/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/lm32/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/metag/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/microblaze/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/mips/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/nds32/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/nios2/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/or1k/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/riscv32/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/riscv64/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/sh/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/sparc/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/sparc64/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/tile/bits/fcntl.h3
-rw-r--r--libc/sysdeps/linux/x86_64/bits/fcntl.h2
-rw-r--r--libc/sysdeps/linux/xtensa/bits/fcntl.h2
36 files changed, 121 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/aarch64/bits/fcntl.h b/libc/sysdeps/linux/aarch64/bits/fcntl.h
index dbe929351..024344eec 100644
--- a/libc/sysdeps/linux/aarch64/bits/fcntl.h
+++ b/libc/sysdeps/linux/aarch64/bits/fcntl.h
@@ -289,3 +289,6 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
#endif /* use GNU */
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
index 11e68214e..7d06c76b7 100644
--- a/libc/sysdeps/linux/alpha/bits/fcntl.h
+++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
@@ -236,3 +236,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/arc/bits/fcntl.h b/libc/sysdeps/linux/arc/bits/fcntl.h
index beb32e41e..b02849691 100755
--- a/libc/sysdeps/linux/arc/bits/fcntl.h
+++ b/libc/sysdeps/linux/arc/bits/fcntl.h
@@ -230,3 +230,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
index 823660648..52dee4287 100644
--- a/libc/sysdeps/linux/arm/bits/fcntl.h
+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/avr32/bits/fcntl.h b/libc/sysdeps/linux/avr32/bits/fcntl.h
index ec0a3b55d..9e41550be 100644
--- a/libc/sysdeps/linux/avr32/bits/fcntl.h
+++ b/libc/sysdeps/linux/avr32/bits/fcntl.h
@@ -218,3 +218,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
__END_DECLS
#endif
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/bfin/bits/fcntl.h b/libc/sysdeps/linux/bfin/bits/fcntl.h
index 0909ae6c4..67d2c5245 100644
--- a/libc/sysdeps/linux/bfin/bits/fcntl.h
+++ b/libc/sysdeps/linux/bfin/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h
index 14aea565e..00f3b34e0 100644
--- a/libc/sysdeps/linux/c6x/bits/fcntl.h
+++ b/libc/sysdeps/linux/c6x/bits/fcntl.h
@@ -237,3 +237,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 848bc1e4a..83be2691e 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -30,6 +30,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
inotify.c \
ioperm.c \
iopl.c \
+ memfd_create.c \
modify_ldt.c \
module.c \
name_to_handle_at.c \
diff --git a/libc/sysdeps/linux/common/bits/fcntl-linux.h b/libc/sysdeps/linux/common/bits/fcntl-linux.h
new file mode 100644
index 000000000..d0236fd8b
--- /dev/null
+++ b/libc/sysdeps/linux/common/bits/fcntl-linux.h
@@ -0,0 +1,34 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 2001-2024 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl-linux.h> directly; include <fcntl.h> instead."
+#endif
+
+#ifdef __USE_GNU
+/* Types of seals. */
+# define F_SEAL_SEAL 0x0001 /* Prevent further seals from being set. */
+# define F_SEAL_SHRINK 0x0002 /* Prevent file from shrinking. */
+# define F_SEAL_GROW 0x0004 /* Prevent file from growing. */
+# define F_SEAL_WRITE 0x0008 /* Prevent writes. */
+# define F_SEAL_FUTURE_WRITE 0x0010 /* Prevent future writes while
+ mapped. */
+# define F_SEAL_EXEC 0x0020 /* Prevent chmod modifying exec bits. */
+
+# define F_ADD_SEALS 1033 /* Add seals to file. */
+# define F_GET_SEALS 1034 /* Get seals for file. */
+#endif
diff --git a/libc/sysdeps/linux/common/bits/mman-shared.h b/libc/sysdeps/linux/common/bits/mman-shared.h
index 98c9e1d3c..c40ae2d1e 100644
--- a/libc/sysdeps/linux/common/bits/mman-shared.h
+++ b/libc/sysdeps/linux/common/bits/mman-shared.h
@@ -40,11 +40,9 @@
__BEGIN_DECLS
-#if 0
/* 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;
-#endif
/* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into
memory. FLAGS is a combination of the MLOCK_* flags above. */
diff --git a/libc/sysdeps/linux/common/memfd_create.c b/libc/sysdeps/linux/common/memfd_create.c
new file mode 100644
index 000000000..7165f3278
--- /dev/null
+++ b/libc/sysdeps/linux/common/memfd_create.c
@@ -0,0 +1,13 @@
+/*
+ * memfd_create() for uClibc-ng
+ *
+ * Copyright (C) 2024 Waldemar Brodkorb <wbx@uclibc-ng.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <sys/mman.h>
+#if defined(__NR_memfd_create)
+_syscall2(int, memfd_create, const char *, name, unsigned int, flags)
+#endif
diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
index e9bc90ea9..e1d4ee1a6 100644
--- a/libc/sysdeps/linux/cris/bits/fcntl.h
+++ b/libc/sysdeps/linux/cris/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/csky/bits/fcntl.h b/libc/sysdeps/linux/csky/bits/fcntl.h
index b36f41569..25f4491ba 100644
--- a/libc/sysdeps/linux/csky/bits/fcntl.h
+++ b/libc/sysdeps/linux/csky/bits/fcntl.h
@@ -232,3 +232,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/frv/bits/fcntl.h b/libc/sysdeps/linux/frv/bits/fcntl.h
index 02c8ac310..81a1bcd99 100644
--- a/libc/sysdeps/linux/frv/bits/fcntl.h
+++ b/libc/sysdeps/linux/frv/bits/fcntl.h
@@ -226,3 +226,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h
index 2062f7cda..7cbe04e15 100644
--- a/libc/sysdeps/linux/h8300/bits/fcntl.h
+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/hppa/bits/fcntl.h b/libc/sysdeps/linux/hppa/bits/fcntl.h
index 4ce76ce5f..bcd6618b2 100644
--- a/libc/sysdeps/linux/hppa/bits/fcntl.h
+++ b/libc/sysdeps/linux/hppa/bits/fcntl.h
@@ -234,3 +234,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/i386/bits/fcntl.h b/libc/sysdeps/linux/i386/bits/fcntl.h
index f3c08bbe5..5caf66114 100644
--- a/libc/sysdeps/linux/i386/bits/fcntl.h
+++ b/libc/sysdeps/linux/i386/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/ia64/bits/fcntl.h b/libc/sysdeps/linux/ia64/bits/fcntl.h
index a20f44ff7..53263c3d3 100644
--- a/libc/sysdeps/linux/ia64/bits/fcntl.h
+++ b/libc/sysdeps/linux/ia64/bits/fcntl.h
@@ -238,3 +238,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/kvx/bits/fcntl.h b/libc/sysdeps/linux/kvx/bits/fcntl.h
index ea0c59d09..79cd3f14e 100644
--- a/libc/sysdeps/linux/kvx/bits/fcntl.h
+++ b/libc/sysdeps/linux/kvx/bits/fcntl.h
@@ -227,3 +227,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/lm32/bits/fcntl.h b/libc/sysdeps/linux/lm32/bits/fcntl.h
index 0bfea6e7a..049c7fd83 100644
--- a/libc/sysdeps/linux/lm32/bits/fcntl.h
+++ b/libc/sysdeps/linux/lm32/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
index 5a56c8781..92c0964d9 100644
--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/metag/bits/fcntl.h b/libc/sysdeps/linux/metag/bits/fcntl.h
index bdd697348..471938b7d 100644
--- a/libc/sysdeps/linux/metag/bits/fcntl.h
+++ b/libc/sysdeps/linux/metag/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
index 110927d95..8c9c2ceef 100644
--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
index 33251c74d..a98b8c2e5 100644
--- a/libc/sysdeps/linux/mips/bits/fcntl.h
+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
@@ -268,3 +268,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/nds32/bits/fcntl.h b/libc/sysdeps/linux/nds32/bits/fcntl.h
index 2e6a95ec8..cfce8ab27 100644
--- a/libc/sysdeps/linux/nds32/bits/fcntl.h
+++ b/libc/sysdeps/linux/nds32/bits/fcntl.h
@@ -249,3 +249,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/nios2/bits/fcntl.h b/libc/sysdeps/linux/nios2/bits/fcntl.h
index 200a35443..0c11c3aba 100644
--- a/libc/sysdeps/linux/nios2/bits/fcntl.h
+++ b/libc/sysdeps/linux/nios2/bits/fcntl.h
@@ -244,3 +244,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/or1k/bits/fcntl.h b/libc/sysdeps/linux/or1k/bits/fcntl.h
index c9599ef3a..78eed9d5f 100644
--- a/libc/sysdeps/linux/or1k/bits/fcntl.h
+++ b/libc/sysdeps/linux/or1k/bits/fcntl.h
@@ -244,3 +244,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
index ef1beeca0..54e4894ec 100644
--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/riscv32/bits/fcntl.h b/libc/sysdeps/linux/riscv32/bits/fcntl.h
index a9d7c84e0..fdfb1805d 100644
--- a/libc/sysdeps/linux/riscv32/bits/fcntl.h
+++ b/libc/sysdeps/linux/riscv32/bits/fcntl.h
@@ -229,3 +229,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/riscv64/bits/fcntl.h b/libc/sysdeps/linux/riscv64/bits/fcntl.h
index a9d7c84e0..fdfb1805d 100644
--- a/libc/sysdeps/linux/riscv64/bits/fcntl.h
+++ b/libc/sysdeps/linux/riscv64/bits/fcntl.h
@@ -229,3 +229,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/sh/bits/fcntl.h b/libc/sysdeps/linux/sh/bits/fcntl.h
index 0d687f04f..4ae682425 100644
--- a/libc/sysdeps/linux/sh/bits/fcntl.h
+++ b/libc/sysdeps/linux/sh/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/sparc/bits/fcntl.h b/libc/sysdeps/linux/sparc/bits/fcntl.h
index 935495937..35224cdb3 100644
--- a/libc/sysdeps/linux/sparc/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc/bits/fcntl.h
@@ -252,3 +252,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/sparc64/bits/fcntl.h b/libc/sysdeps/linux/sparc64/bits/fcntl.h
index 395c95baf..00e91a671 100644
--- a/libc/sysdeps/linux/sparc64/bits/fcntl.h
+++ b/libc/sysdeps/linux/sparc64/bits/fcntl.h
@@ -248,3 +248,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/tile/bits/fcntl.h b/libc/sysdeps/linux/tile/bits/fcntl.h
index 818da5c4a..28fda899d 100644
--- a/libc/sysdeps/linux/tile/bits/fcntl.h
+++ b/libc/sysdeps/linux/tile/bits/fcntl.h
@@ -229,3 +229,6 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/x86_64/bits/fcntl.h b/libc/sysdeps/linux/x86_64/bits/fcntl.h
index 3547a2046..821b2e3cc 100644
--- a/libc/sysdeps/linux/x86_64/bits/fcntl.h
+++ b/libc/sysdeps/linux/x86_64/bits/fcntl.h
@@ -259,3 +259,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/sysdeps/linux/xtensa/bits/fcntl.h b/libc/sysdeps/linux/xtensa/bits/fcntl.h
index 5af9d2124..9bc5fa893 100644
--- a/libc/sysdeps/linux/xtensa/bits/fcntl.h
+++ b/libc/sysdeps/linux/xtensa/bits/fcntl.h
@@ -245,3 +245,5 @@ extern ssize_t tee (int __fdin, int __fdout, size_t __len,
#endif
__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>