mirror of git://git.musl-libc.org/musl
add memfd_create syscall wrapper
memfd_create was added in linux v3.17 and glibc has api for it.
This commit is contained in:
parent
b64d66d0b0
commit
38f2fa3d02
|
@ -99,6 +99,10 @@ extern "C" {
|
||||||
#define MREMAP_FIXED 2
|
#define MREMAP_FIXED 2
|
||||||
|
|
||||||
#define MLOCK_ONFAULT 0x01
|
#define MLOCK_ONFAULT 0x01
|
||||||
|
|
||||||
|
#define MFD_CLOEXEC 0x0001U
|
||||||
|
#define MFD_ALLOW_SEALING 0x0002U
|
||||||
|
#define MFD_HUGETLB 0x0004U
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <bits/mman.h>
|
#include <bits/mman.h>
|
||||||
|
@ -119,6 +123,7 @@ int munlockall (void);
|
||||||
#ifdef _GNU_SOURCE
|
#ifdef _GNU_SOURCE
|
||||||
void *mremap (void *, size_t, size_t, int, ...);
|
void *mremap (void *, size_t, size_t, int, ...);
|
||||||
int remap_file_pages (void *, size_t, int, size_t, int);
|
int remap_file_pages (void *, size_t, int, size_t, int);
|
||||||
|
int memfd_create (const char *, unsigned);
|
||||||
int mlock2 (const void *, size_t, unsigned);
|
int mlock2 (const void *, size_t, unsigned);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#define _GNU_SOURCE 1
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include "syscall.h"
|
||||||
|
|
||||||
|
int memfd_create(const char *name, unsigned flags)
|
||||||
|
{
|
||||||
|
return syscall(SYS_memfd_create, name, flags);
|
||||||
|
}
|
Loading…
Reference in New Issue