tools/nolibc: add wrapper for memfd_create

This is useful for users and will also be used by a future testcase.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Thomas Weißschuh 2023-04-02 20:48:04 +02:00 committed by Paul E. McKenney
parent fc82d7dbca
commit e8842cf04e
1 changed files with 23 additions and 0 deletions

View File

@ -1365,6 +1365,29 @@ ssize_t write(int fd, const void *buf, size_t count)
return ret;
}
/*
* int memfd_create(const char *name, unsigned int flags);
*/
static __attribute__((unused))
int sys_memfd_create(const char *name, unsigned int flags)
{
return my_syscall2(__NR_memfd_create, name, flags);
}
static __attribute__((unused))
int memfd_create(const char *name, unsigned int flags)
{
ssize_t ret = sys_memfd_create(name, flags);
if (ret < 0) {
SET_ERRNO(-ret);
ret = -1;
}
return ret;
}
/* make sure to include all global symbols */
#include "nolibc.h"