1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Linux: Add memfd_create system call wrapper

The system call is somewhat obscure because it is closely related
to file descriptor sealing.  However, it is also the recommended
way to create alias mappings, which is why it has more general use.

No emulation is provided.  Except for the name of the
/proc/self/fd links, it would be possible to implement an
approximation using O_TMPFILE and tmpfs, but this does not appear
to be worth the added complexity.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Florian Weimer
2017-11-23 10:00:40 +01:00
parent 0a9d1d62b3
commit 59d2cbb1fe
36 changed files with 249 additions and 1 deletions

View File

@ -111,3 +111,19 @@
# define MCL_ONFAULT 4 /* Lock all pages that are
faulted in. */
#endif
#ifdef __USE_GNU
/* Flags for memfd_create. */
# define MFD_CLOEXEC 1U
# define MFD_ALLOW_SEALING 2U
# define MFD_HUGETLB 4U
__BEGIN_DECLS
/* 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;
__END_DECLS
#endif /* __USE_GNU */