diff options
author | Thomas Weißschuh <linux@weissschuh.net> | 2023-04-02 20:48:04 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2023-06-09 11:33:05 -0700 |
commit | e8842cf04ee0e746a42e4a21b9a3a6a1327596cf (patch) | |
tree | 42462256a4112f6cb87442d22428043e4d425622 /tools/include | |
parent | fc82d7dbca3b789897bfb7fb5098439959c8f296 (diff) | |
download | lwn-e8842cf04ee0e746a42e4a21b9a3a6a1327596cf.tar.gz lwn-e8842cf04ee0e746a42e4a21b9a3a6a1327596cf.zip |
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>
Diffstat (limited to 'tools/include')
-rw-r--r-- | tools/include/nolibc/sys.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 5d624dc63a42..bea9760dbd16 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -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" |