@@ -91,6 +91,7 @@ AC_SUBST(HAVE_FTS_H, $have_fts)
AC_CHECK_HEADERS(linux/vm_sockets.h, [], [], [#include <sys/socket.h>])
AC_CHECK_FUNCS_ONCE([ \
+ cachestat \
clone3 \
close_range \
copy_file_range \
@@ -243,6 +244,9 @@ AC_CHECK_TYPES([struct mount_attr],,,[
#endif
])
+AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>])
+AC_CHECK_TYPES([struct cachestat],,,[#include <sys/mman.h>])
+
# Tools knobs
# Bash
new file mode 100644
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+#ifndef LAPI_MMAN_H__
+#define LAPI_MMAN_H__
+
+#include <stdint.h>
+#include <sys/mman.h>
+#include "config.h"
+#include "syscalls.h"
+
+#ifndef HAVE_STRUCT_CACHESTAT_RANGE
+struct cachestat_range {
+ uint64_t off;
+ uint64_t len;
+};
+#endif
+
+#ifndef HAVE_STRUCT_CACHESTAT
+struct cachestat {
+ uint64_t nr_cache;
+ uint64_t nr_dirty;
+ uint64_t nr_writeback;
+ uint64_t nr_evicted;
+ uint64_t nr_recently_evicted;
+};
+#endif
+
+#ifndef HAVE_CACHESTAT
+/*
+ * cachestat: wrapper function of cachestat
+ *
+ * Returns: It returns status of cachestat syscall
+ */
+static inline int cachestat(int fd, struct cachestat_range *cstat_range,
+ struct cachestat *cstat, unsigned int flags)
+{
+ return tst_syscall(__NR_cachestat, fd, cstat_range, cstat, flags);
+}
+#endif
+
+#endif /* LAPI_MMAN_H__ */
@@ -300,4 +300,5 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
_sysctl 1078
@@ -320,3 +320,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -399,3 +399,4 @@ landlock_add_rule (__NR_SYSCALL_BASE+445)
landlock_restrict_self (__NR_SYSCALL_BASE+446)
memfd_secret (__NR_SYSCALL_BASE+447)
futex_waitv (__NR_SYSCALL_BASE+449)
+cachestat (__NR_SYSCALL_BASE+451)
@@ -47,3 +47,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -434,3 +434,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -347,3 +347,4 @@ landlock_create_ruleset 1468
landlock_add_rule 1469
landlock_restrict_self 1470
futex_waitv 1473
+cachestat 1475
@@ -305,3 +305,4 @@ memfd_secret 447
process_mrelease 448
futex_waitv 449
set_mempolicy_home_node 450
+cachestat 451
@@ -374,3 +374,4 @@ landlock_create_ruleset 6444
landlock_add_rule 6445
landlock_restrict_self 6446
futex_waitv 6449
+cachestat 6451
@@ -350,3 +350,4 @@ landlock_create_ruleset 5444
landlock_add_rule 5445
landlock_restrict_self 5446
futex_waitv 5449
+cachestat 5451
@@ -420,3 +420,4 @@ landlock_create_ruleset 4444
landlock_add_rule 4445
landlock_restrict_self 4446
futex_waitv 4449
+cachestat 4451
@@ -427,3 +427,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -427,3 +427,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -414,3 +414,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -362,3 +362,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -408,3 +408,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -413,3 +413,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -378,3 +378,4 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
@@ -355,6 +355,7 @@ landlock_create_ruleset 444
landlock_add_rule 445
landlock_restrict_self 446
futex_waitv 449
+cachestat 451
rt_sigaction 512
rt_sigreturn 513
ioctl 514