From: Ricardo Branco <rbranco@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4 1/2] memfd_create: move sys_memfd_create() to lapi/memfd.h
Date: Wed, 1 Apr 2026 23:03:33 +0200 [thread overview]
Message-ID: <20260401210338.485029-1-rbranco@suse.de> (raw)
In-Reply-To: <20260331220354.297027-1-rbranco@suse.de>
Add the static inline wrapper to include/lapi/memfd.h and include the
required headers so other tests can reuse it.
Also fix some minor issues detected by make check.
Signed-off-by: Ricardo Branco <rbranco@suse.de>
---
include/lapi/memfd.h | 8 ++++++++
testcases/kernel/syscalls/memfd_create/memfd_create01.c | 1 -
.../kernel/syscalls/memfd_create/memfd_create_common.c | 5 -----
.../kernel/syscalls/memfd_create/memfd_create_common.h | 2 +-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/lapi/memfd.h b/include/lapi/memfd.h
index 57b6cd83d..46ccb0a3f 100644
--- a/include/lapi/memfd.h
+++ b/include/lapi/memfd.h
@@ -6,6 +6,9 @@
#ifndef LAPI_MEMFD_H__
#define LAPI_MEMFD_H__
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
/* flags for memfd_create(2) (unsigned int) */
#ifndef MFD_CLOEXEC
# define MFD_CLOEXEC 0x0001U
@@ -47,4 +50,9 @@
#define MFD_HUGE_16GB (34 << 26)
#endif
+static inline int sys_memfd_create(const char *name, unsigned int flags)
+{
+ return tst_syscall(__NR_memfd_create, name, flags);
+}
+
#endif /* LAPI_MEMFD_H__ */
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create01.c b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
index 73f6b01e8..28ad04a86 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create01.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
@@ -212,7 +212,6 @@ static void test_share_open(int fd)
SAFE_CLOSE(fd2);
}
-
static const struct tcase {
int flags;
void (*func)(int fd);
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
index a52b02a56..63e8daac5 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
@@ -24,11 +24,6 @@
#include "memfd_create_common.h"
-int sys_memfd_create(const char *name, unsigned int flags)
-{
- return tst_syscall(__NR_memfd_create, name, flags);
-}
-
int check_fallocate(const char *filename, const int lineno, int fd,
int mode, off_t offset, off_t len)
{
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create_common.h b/testcases/kernel/syscalls/memfd_create/memfd_create_common.h
index 60ad895fe..8e5a3efbd 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create_common.h
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create_common.h
@@ -50,7 +50,7 @@
check_munmap(__FILE__, __LINE__, (p), (length))
#define CHECK_MFD_HAS_SEALS(fd, seals) \
- check_mfd_has_seals(__FILE__, __LINE__, (fd), (seals));
+ check_mfd_has_seals(__FILE__, __LINE__, (fd), (seals))
#define CHECK_MFD_ADD_SEALS(fd, seals) \
({int r = SAFE_FCNTL((fd), F_ADD_SEALS, (seals)); \
--
2.53.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-04-01 21:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 22:03 [LTP] [PATCH v3] userfaultfd: Add new test using UFFDIO_CONTINUE Ricardo Branco
2026-04-01 21:03 ` Ricardo Branco [this message]
2026-04-01 21:03 ` [LTP] [PATCH v4 2/2] " Ricardo Branco
2026-04-09 14:15 ` Andrea Cervesato via ltp
2026-04-09 14:51 ` Andrea Cervesato via ltp
2026-04-09 15:19 ` [LTP] [PATCH v5 1/2] memfd_create: move sys_memfd_create() to lapi/memfd.h Ricardo Branco
2026-04-09 15:19 ` [LTP] [PATCH v5 2/2] userfaultfd: Add new test using UFFDIO_CONTINUE Ricardo Branco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401210338.485029-1-rbranco@suse.de \
--to=rbranco@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox