aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ipcshm.h54
-rw-r--r--include/lapi/faccessat.h22
-rw-r--r--include/lapi/fcntl.h37
-rw-r--r--include/lapi/fs.h21
-rw-r--r--include/lapi/ioprio.h47
-rw-r--r--include/lapi/mmap.h5
-rw-r--r--include/lapi/mount.h4
-rw-r--r--include/lapi/sched.h19
-rw-r--r--include/lapi/sem.h4
-rw-r--r--include/lapi/stat.h56
-rw-r--r--include/lapi/syscalls/aarch64.in1
-rw-r--r--include/lapi/syscalls/arc.in1
-rw-r--r--include/lapi/syscalls/arm.in1
-rw-r--r--include/lapi/syscalls/hppa.in1
-rw-r--r--include/lapi/syscalls/i386.in1
-rw-r--r--include/lapi/syscalls/ia64.in1
-rw-r--r--include/lapi/syscalls/loongarch.in307
-rw-r--r--include/lapi/syscalls/order1
-rw-r--r--include/lapi/syscalls/powerpc.in1
-rw-r--r--include/lapi/syscalls/powerpc64.in1
-rw-r--r--include/lapi/syscalls/s390.in1
-rw-r--r--include/lapi/syscalls/s390x.in1
-rw-r--r--include/lapi/syscalls/sh.in1
-rw-r--r--include/lapi/syscalls/sparc.in1
-rw-r--r--include/lapi/syscalls/sparc64.in1
-rw-r--r--include/lapi/syscalls/x86_64.in1
-rw-r--r--include/libnewipc.h2
-rw-r--r--include/mk/automake.mk3
-rw-r--r--include/safe_net_fn.h3
-rw-r--r--include/tst_buffers.h11
-rw-r--r--include/tst_cgroup.h4
-rw-r--r--include/tst_clone.h1
-rw-r--r--include/tst_kernel.h14
-rw-r--r--include/tst_memutils.h5
-rw-r--r--include/tst_minmax.h3
-rw-r--r--include/tst_netdevice.h124
-rw-r--r--include/tst_pid.h8
-rw-r--r--include/tst_safe_net.h3
-rw-r--r--include/tst_safe_posix_ipc.h2
-rw-r--r--include/tst_safe_pthread.h52
-rw-r--r--include/tst_test.h7
-rw-r--r--include/tst_test_macros.h39
42 files changed, 707 insertions, 165 deletions
diff --git a/include/ipcshm.h b/include/ipcshm.h
deleted file mode 100644
index 08307d4ab..000000000
--- a/include/ipcshm.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * ipcshm.h - common definitions for the IPC shared memory tests
- */
-
-#ifndef __IPCSHM_H
-#define __IPCSHM_H
-
-#include <errno.h>
-#include <sys/wait.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#include "test.h"
-
-void cleanup(void);
-void setup(void);
-
-#define SHM_RD 0400
-#define SHM_WR 0200
-#define SHM_RW SHM_RD | SHM_WR
-
-#define SHM_SIZE 2048 /* a resonable size for a memory segment */
-#define INT_SIZE 4 /* instead of sizeof(int) */
-
-#define MODE_MASK 0x01FF /* to get the lower nine permission bits */
- /* from shmid_ds.ipc_perm.mode */
-
-key_t shmkey; /* an IPC key generated by ftok() */
-
-void rm_shm(int shm_id);
-
-int getipckey();
-int getuserid(char*);
-
-#endif /* ipcshm.h */
diff --git a/include/lapi/faccessat.h b/include/lapi/faccessat.h
new file mode 100644
index 000000000..05997d975
--- /dev/null
+++ b/include/lapi/faccessat.h
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023 FUJITSU LIMITED. All rights reserved.
+ * Copyright (c) Linux Test Project, 2003-2023
+ * Author: Yang Xu <xuyang2018.jy@fujitsu.com>
+ */
+
+#ifndef FACCESSAT2_H
+#define FACCESSAT2_H
+
+#include "tst_test.h"
+#include "config.h"
+#include "lapi/syscalls.h"
+
+#ifndef HAVE_FACCESSAT2
+int faccessat2(int dirfd, const char *pathname, int mode, int flags)
+{
+ return tst_syscall(__NR_faccessat2, dirfd, pathname, mode, flags);
+}
+#endif
+
+#endif /* FACCESSAT2_H */
diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
index f17220737..cb216e2dc 100644
--- a/include/lapi/fcntl.h
+++ b/include/lapi/fcntl.h
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2014-2023
*/
#ifndef LAPI_FCNTL_H__
@@ -10,9 +11,7 @@
#include <fcntl.h>
#include <sys/socket.h>
-#ifndef O_DIRECT
-# define O_DIRECT 040000
-#endif
+/* NOTE: #define _GNU_SOURCE if you need O_DIRECT in tests */
#ifndef O_CLOEXEC
# define O_CLOEXEC 02000000
@@ -87,20 +86,40 @@
# define AT_FDCWD -100
#endif
+#ifndef AT_SYMLINK_NOFOLLOW
+# define AT_SYMLINK_NOFOLLOW 0x100
+#endif
+
+#ifndef AT_REMOVEDIR
+# define AT_REMOVEDIR 0x200
+#endif
+
#ifndef AT_SYMLINK_FOLLOW
-# define AT_SYMLINK_FOLLOW 0x400
+# define AT_SYMLINK_FOLLOW 0x400
#endif
-#ifndef AT_SYMLINK_NOFOLLOW
-# define AT_SYMLINK_NOFOLLOW 0x100
+#ifndef AT_NO_AUTOMOUNT
+# define AT_NO_AUTOMOUNT 0x800
#endif
#ifndef AT_EMPTY_PATH
-# define AT_EMPTY_PATH 0x1000
+# define AT_EMPTY_PATH 0x1000
#endif
-#ifndef AT_REMOVEDIR
-# define AT_REMOVEDIR 0x200
+#ifndef AT_STATX_SYNC_AS_STAT
+# define AT_STATX_SYNC_AS_STAT 0x0000
+#endif
+
+#ifndef AT_STATX_FORCE_SYNC
+# define AT_STATX_FORCE_SYNC 0x2000
+#endif
+
+#ifndef AT_STATX_DONT_SYNC
+# define AT_STATX_DONT_SYNC 0x4000
+#endif
+
+#ifndef AT_STATX_SYNC_TYPE
+# define AT_STATX_SYNC_TYPE 0x6000
#endif
#ifndef O_NOATIME
diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index 84a168a67..c19ee821d 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -6,6 +6,10 @@
* Email: code@zilogic.com
*/
+#ifndef LAPI_FS_H__
+#define LAPI_FS_H__
+
+#include "config.h"
#ifndef HAVE_MOUNT_SETATTR
# ifdef HAVE_LINUX_FS_H
# include <linux/fs.h>
@@ -16,35 +20,32 @@
#include <limits.h>
#include "lapi/abisize.h"
-#ifndef LAPI_FS_H__
-#define LAPI_FS_H__
-
#ifndef FS_IOC_GETFLAGS
-#define FS_IOC_GETFLAGS _IOR('f', 1, long)
+# define FS_IOC_GETFLAGS _IOR('f', 1, long)
#endif
#ifndef FS_IOC_SETFLAGS
-#define FS_IOC_SETFLAGS _IOW('f', 2, long)
+# define FS_IOC_SETFLAGS _IOW('f', 2, long)
#endif
#ifndef FS_COMPR_FL
-#define FS_COMPR_FL 0x00000004 /* Compress file */
+# define FS_COMPR_FL 0x00000004 /* Compress file */
#endif
#ifndef FS_IMMUTABLE_FL
-#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
+# define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
#endif
#ifndef FS_APPEND_FL
-#define FS_APPEND_FL 0x00000020 /* writes to file may only append */
+# define FS_APPEND_FL 0x00000020 /* writes to file may only append */
#endif
#ifndef FS_NODUMP_FL
-#define FS_NODUMP_FL 0x00000040 /* do not dump file */
+# define FS_NODUMP_FL 0x00000040 /* do not dump file */
#endif
#ifndef FS_VERITY_FL
-#define FS_VERITY_FL 0x00100000 /* Verity protected inode */
+# define FS_VERITY_FL 0x00100000 /* Verity protected inode */
#endif
/*
diff --git a/include/lapi/ioprio.h b/include/lapi/ioprio.h
new file mode 100644
index 000000000..871aa0278
--- /dev/null
+++ b/include/lapi/ioprio.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Linus Walleij <linus.walleij@linaro.org>
+ */
+
+#ifndef LAPI_IOPRIO_H__
+#define LAPI_IOPRIO_H__
+
+#include "config.h"
+
+#ifdef HAVE_LINUX_IOPRIO_H
+# include <linux/ioprio.h>
+#else
+
+enum {
+ IOPRIO_CLASS_NONE = 0,
+ IOPRIO_CLASS_RT,
+ IOPRIO_CLASS_BE,
+ IOPRIO_CLASS_IDLE,
+};
+
+enum {
+ IOPRIO_WHO_PROCESS = 1,
+ IOPRIO_WHO_PGRP,
+ IOPRIO_WHO_USER,
+};
+
+# define IOPRIO_CLASS_SHIFT (13)
+# define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
+
+# define IOPRIO_PRIO_CLASS(data) ((data) >> IOPRIO_CLASS_SHIFT)
+# define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data)
+
+#endif
+
+/* The RT and BE I/O priority classes have 8 priority levels 0..7 */
+#ifdef IOPRIO_NR_LEVELS
+# define IOPRIO_PRIO_NUM IOPRIO_NR_LEVELS
+#else
+# define IOPRIO_PRIO_NUM 8
+#endif
+
+#ifndef IOPRIO_PRIO_LEVEL
+# define IOPRIO_PRIO_LEVEL(data) ((data) & IOPRIO_PRIO_MASK)
+#endif
+
+#endif /* LAPI_IOPRIO_H__ */
diff --git a/include/lapi/mmap.h b/include/lapi/mmap.h
index 49108338b..7512e9f81 100644
--- a/include/lapi/mmap.h
+++ b/include/lapi/mmap.h
@@ -8,6 +8,11 @@
#define LAPI_MMAP_H__
#include "config.h"
+#include <sys/mman.h>
+
+#ifndef MAP_SHARED_VALIDATE
+# define MAP_SHARED_VALIDATE 0x03
+#endif
#ifndef MAP_HUGETLB
# define MAP_HUGETLB 0x40000
diff --git a/include/lapi/mount.h b/include/lapi/mount.h
index 66e1d1319..c1af944fe 100644
--- a/include/lapi/mount.h
+++ b/include/lapi/mount.h
@@ -33,4 +33,8 @@
# define UMOUNT_NOFOLLOW 8
#endif
+#ifndef MS_NOSYMFOLLOW
+# define MS_NOSYMFOLLOW 256
+#endif
+
#endif /* LAPI_MOUNT_H__ */
diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index 459753020..720b75502 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -13,6 +13,7 @@
#include <inttypes.h>
#include "config.h"
#include "lapi/syscalls.h"
+#include "lapi/sched.h"
struct sched_attr {
uint32_t size;
@@ -54,9 +55,23 @@ struct clone_args {
uint64_t __attribute__((aligned(8))) stack;
uint64_t __attribute__((aligned(8))) stack_size;
uint64_t __attribute__((aligned(8))) tls;
+ uint64_t __attribute__((aligned(8))) set_tid;
+ uint64_t __attribute__((aligned(8))) set_tid_size;
+ uint64_t __attribute__((aligned(8))) cgroup;
};
#endif
+struct clone_args_minimal {
+ uint64_t __attribute__((aligned(8))) flags;
+ uint64_t __attribute__((aligned(8))) pidfd;
+ uint64_t __attribute__((aligned(8))) child_tid;
+ uint64_t __attribute__((aligned(8))) parent_tid;
+ uint64_t __attribute__((aligned(8))) exit_signal;
+ uint64_t __attribute__((aligned(8))) stack;
+ uint64_t __attribute__((aligned(8))) stack_size;
+ uint64_t __attribute__((aligned(8))) tls;
+};
+
#ifndef HAVE_CLONE3
static inline int clone3(struct clone_args *args, size_t size)
{
@@ -135,4 +150,8 @@ static inline int getcpu(unsigned *cpu, unsigned *node)
# define CLONE_NEWTIME 0x00000080
#endif
+#ifndef CLONE_INTO_CGROUP
+# define CLONE_INTO_CGROUP 0x200000000ULL
+#endif
+
#endif /* LAPI_SCHED_H__ */
diff --git a/include/lapi/sem.h b/include/lapi/sem.h
index 3dead200a..e7adac3cf 100644
--- a/include/lapi/sem.h
+++ b/include/lapi/sem.h
@@ -24,4 +24,8 @@ union semun {
# define SEM_STAT_ANY 20
#endif
+#ifndef SEMMSL
+# define SEMMSL 32000
+#endif
+
#endif /* LAPI_SEM_H__ */
diff --git a/include/lapi/stat.h b/include/lapi/stat.h
index ce1f2b678..3606c9eb0 100644
--- a/include/lapi/stat.h
+++ b/include/lapi/stat.h
@@ -10,7 +10,9 @@
#include <stdint.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "lapi/syscalls.h"
+
/*
* Timestamp structure for the timestamps in struct statx.
*
@@ -21,9 +23,7 @@
*
* __reserved is held in case we need a yet finer resolution.
*/
-#if defined(HAVE_STRUCT_STATX_TIMESTAMP)
-#include <sys/stat.h>
-#else
+#ifndef HAVE_STRUCT_STATX_TIMESTAMP
struct statx_timestamp {
int64_t tv_sec;
uint32_t tv_nsec;
@@ -67,9 +67,7 @@ struct statx_timestamp {
* will have values installed for compatibility purposes so that stat() and
* co. can be emulated in userspace.
*/
-#if defined(HAVE_STRUCT_STATX)
-#include <sys/stat.h>
-#else
+#ifndef HAVE_STRUCT_STATX
struct statx {
/* 0x00 */
uint32_t stx_mask;
@@ -102,7 +100,7 @@ struct statx {
};
#endif
-#if !defined(HAVE_STATX)
+#ifndef HAVE_STATX
/*
* statx: wrapper function of statx
@@ -180,8 +178,8 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
# define STATX_MNT_ID 0x00001000U
#endif
-#ifndef STATX_ALL
-# define STATX_ALL 0x00000fffU
+#ifndef STATX_DIOALIGN
+# define STATX_DIOALIGN 0x00002000U
#endif
#ifndef STATX__RESERVED
@@ -223,44 +221,12 @@ static inline int statx(int dirfd, const char *pathname, unsigned int flags,
# define STATX_ATTR_AUTOMOUNT 0x00001000
#endif
-#ifndef STATX_ATTR_VERITY
-# define STATX_ATTR_VERITY 0x00100000
-#endif
-
-#ifndef AT_SYMLINK_NOFOLLOW
-# define AT_SYMLINK_NOFOLLOW 0x100
-#endif
-
-#ifndef AT_REMOVEDIR
-# define AT_REMOVEDIR 0x200
-#endif
-
-#ifndef AT_SYMLINK_FOLLOW
-# define AT_SYMLINK_FOLLOW 0x400
+#ifndef STATX_ATTR_MOUNT_ROOT
+# define STATX_ATTR_MOUNT_ROOT 0x00002000
#endif
-#ifndef AT_NO_AUTOMOUNT
-# define AT_NO_AUTOMOUNT 0x800
-#endif
-
-#ifndef AT_EMPTY_PATH
-# define AT_EMPTY_PATH 0x1000
-#endif
-
-#ifndef AT_STATX_SYNC_TYPE
-# define AT_STATX_SYNC_TYPE 0x6000
-#endif
-
-#ifndef AT_STATX_SYNC_AS_STAT
-# define AT_STATX_SYNC_AS_STAT 0x0000
-#endif
-
-#ifndef AT_STATX_FORCE_SYNC
-# define AT_STATX_FORCE_SYNC 0x2000
-#endif
-
-#ifndef AT_STATX_DONT_SYNC
-# define AT_STATX_DONT_SYNC 0x4000
+#ifndef STATX_ATTR_VERITY
+# define STATX_ATTR_VERITY 0x00100000
#endif
#endif /* LAPI_STAT_H__ */
diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
index de4ed5fb1..2cb6c2d87 100644
--- a/include/lapi/syscalls/aarch64.in
+++ b/include/lapi/syscalls/aarch64.in
@@ -293,6 +293,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/arc.in b/include/lapi/syscalls/arc.in
index 9f11381db..3e2ee9061 100644
--- a/include/lapi/syscalls/arc.in
+++ b/include/lapi/syscalls/arc.in
@@ -313,6 +313,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in
index 4b0f63a28..7bdbca533 100644
--- a/include/lapi/syscalls/arm.in
+++ b/include/lapi/syscalls/arm.in
@@ -391,6 +391,7 @@ clone3 (__NR_SYSCALL_BASE+435)
close_range (__NR_SYSCALL_BASE+436)
openat2 (__NR_SYSCALL_BASE+437)
pidfd_getfd (__NR_SYSCALL_BASE+438)
+faccessat2 (__NR_SYSCALL_BASE+439)
epoll_pwait2 (__NR_SYSCALL_BASE+441)
quotactl_fd (__NR_SYSCALL_BASE+443)
futex_waitv (__NR_SYSCALL_BASE+449)
diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in
index b6d32d386..8ebdafafb 100644
--- a/include/lapi/syscalls/hppa.in
+++ b/include/lapi/syscalls/hppa.in
@@ -40,6 +40,7 @@ fsmount 432
fspick 433
pidfd_open 434
close_range 436
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index d0e6e9a4b..1472631c4 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -427,6 +427,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in
index 123200624..0ea6e9722 100644
--- a/include/lapi/syscalls/ia64.in
+++ b/include/lapi/syscalls/ia64.in
@@ -340,6 +340,7 @@ pidfd_open 1458
close_range 1460
openat2 1461
pidfd_getfd 1462
+faccessat2 1463
epoll_pwait2 1465
quotactl_fd 1467
futex_waitv 1473
diff --git a/include/lapi/syscalls/loongarch.in b/include/lapi/syscalls/loongarch.in
new file mode 100644
index 000000000..301f611f6
--- /dev/null
+++ b/include/lapi/syscalls/loongarch.in
@@ -0,0 +1,307 @@
+io_setup 0
+io_destroy 1
+io_submit 2
+io_cancel 3
+io_getevents 4
+setxattr 5
+lsetxattr 6
+fsetxattr 7
+getxattr 8
+lgetxattr 9
+fgetxattr 10
+listxattr 11
+llistxattr 12
+flistxattr 13
+removexattr 14
+lremovexattr 15
+fremovexattr 16
+getcwd 17
+lookup_dcookie 18
+eventfd2 19
+epoll_create1 20
+epoll_ctl 21
+epoll_pwait 22
+dup 23
+dup3 24
+fcntl 25
+inotify_init1 26
+inotify_add_watch 27
+inotify_rm_watch 28
+ioctl 29
+ioprio_set 30
+ioprio_get 31
+flock 32
+mknodat 33
+mkdirat 34
+unlinkat 35
+symlinkat 36
+linkat 37
+renameat 38
+umount2 39
+mount 40
+pivot_root 41
+nfsservctl 42
+statfs 43
+fstatfs 44
+truncate 45
+ftruncate 46
+fallocate 47
+faccessat 48
+chdir 49
+fchdir 50
+chroot 51
+fchmod 52
+fchmodat 53
+fchownat 54
+fchown 55
+openat 56
+close 57
+vhangup 58
+pipe2 59
+quotactl 60
+getdents64 61
+lseek 62
+read 63
+write 64
+readv 65
+writev 66
+pread64 67
+pwrite64 68
+preadv 69
+pwritev 70
+sendfile 71
+pselect6 72
+ppoll 73
+signalfd4 74
+vmsplice 75
+splice 76
+tee 77
+readlinkat 78
+fstatat 79
+fstat 80
+sync 81
+fsync 82
+fdatasync 83
+sync_file_range2 84
+sync_file_range 84
+timerfd_create 85
+timerfd_settime 86
+timerfd_gettime 87
+utimensat 88
+acct 89
+capget 90
+capset 91
+personality 92
+exit 93
+exit_group 94
+waitid 95
+set_tid_address 96
+unshare 97
+futex 98
+set_robust_list 99
+get_robust_list 100
+nanosleep 101
+getitimer 102
+setitimer 103
+kexec_load 104
+init_module 105
+delete_module 106
+timer_create 107
+timer_gettime 108
+timer_getoverrun 109
+timer_settime 110
+timer_delete 111
+clock_settime 112
+clock_gettime 113
+clock_getres 114
+clock_nanosleep 115
+syslog 116
+ptrace 117
+sched_setparam 118
+sched_setscheduler 119
+sched_getscheduler 120
+sched_getparam 121
+sched_setaffinity 122
+sched_getaffinity 123
+sched_yield 124
+sched_get_priority_max 125
+sched_get_priority_min 126
+sched_rr_get_interval 127
+restart_syscall 128
+kill 129
+tkill 130
+tgkill 131
+sigaltstack 132
+rt_sigsuspend 133
+rt_sigaction 134
+rt_sigprocmask 135
+rt_sigpending 136
+rt_sigtimedwait 137
+rt_sigqueueinfo 138
+rt_sigreturn 139
+setpriority 140
+getpriority 141
+reboot 142
+setregid 143
+setgid 144
+setreuid 145
+setuid 146
+setresuid 147
+getresuid 148
+setresgid 149
+getresgid 150
+setfsuid 151
+setfsgid 152
+times 153
+setpgid 154
+getpgid 155
+getsid 156
+setsid 157
+getgroups 158
+setgroups 159
+uname 160
+sethostname 161
+setdomainname 162
+getrlimit 163
+setrlimit 164
+getrusage 165
+umask 166
+prctl 167
+getcpu 168
+gettimeofday 169
+settimeofday 170
+adjtimex 171
+getpid 172
+getppid 173
+getuid 174
+geteuid 175
+getgid 176
+getegid 177
+gettid 178
+sysinfo 179
+mq_open 180
+mq_unlink 181
+mq_timedsend 182
+mq_timedreceive 183
+mq_notify 184
+mq_getsetattr 185
+msgget 186
+msgctl 187
+msgrcv 188
+msgsnd 189
+semget 190
+semctl 191
+semtimedop 192
+semop 193
+shmget 194
+shmctl 195
+shmat 196
+shmdt 197
+socket 198
+socketpair 199
+bind 200
+listen 201
+accept 202
+connect 203
+getsockname 204
+getpeername 205
+sendto 206
+recvfrom 207
+setsockopt 208
+getsockopt 209
+shutdown 210
+sendmsg 211
+recvmsg 212
+readahead 213
+brk 214
+munmap 215
+mremap 216
+add_key 217
+request_key 218
+keyctl 219
+clone 220
+execve 221
+mmap 222
+fadvise64 223
+swapon 224
+swapoff 225
+mprotect 226
+msync 227
+mlock 228
+munlock 229
+mlockall 230
+munlockall 231
+mincore 232
+madvise 233
+remap_file_pages 234
+mbind 235
+get_mempolicy 236
+set_mempolicy 237
+migrate_pages 238
+move_pages 239
+rt_tgsigqueueinfo 240
+perf_event_open 241
+accept4 242
+recvmmsg 243
+wait4 260
+prlimit64 261
+fanotify_init 262
+fanotify_mark 263
+name_to_handle_at 264
+open_by_handle_at 265
+clock_adjtime 266
+syncfs 267
+setns 268
+sendmmsg 269
+process_vm_readv 270
+process_vm_writev 271
+kcmp 272
+finit_module 273
+sched_setattr 274
+sched_getattr 275
+renameat2 276
+seccomp 277
+getrandom 278
+memfd_create 279
+bpf 280
+execveat 281
+userfaultfd 282
+membarrier 283
+mlock2 284
+copy_file_range 285
+preadv2 286
+pwritev2 287
+pkey_mprotect 288
+pkey_alloc 289
+pkey_free 290
+statx 291
+io_pgetevents 292
+rseq 293
+kexec_file_load 294
+pidfd_send_signal 424
+io_uring_setup 425
+io_uring_enter 426
+io_uring_register 427
+open_tree 428
+move_mount 429
+fsopen 430
+fsconfig 431
+fsmount 432
+fspick 433
+pidfd_open 434
+clone3 435
+close_range 436
+openat2 437
+pidfd_getfd 438
+faccessat2 439
+process_madvise 440
+epoll_pwait2 441
+mount_setattr 442
+quotactl_fd 443
+landlock_create_ruleset 444
+landlock_add_rule 445
+landlock_restrict_self 446
+memfd_secret 447
+process_mrelease 448
+futex_waitv 449
+set_mempolicy_home_node 450
diff --git a/include/lapi/syscalls/order b/include/lapi/syscalls/order
index 548097681..c18aa38cf 100644
--- a/include/lapi/syscalls/order
+++ b/include/lapi/syscalls/order
@@ -4,6 +4,7 @@ arm
hppa
i386
ia64
+loongarch
mips_n32
mips_n64
mips_o32
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index d5de621e1..545d9d3d6 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -420,6 +420,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index d5de621e1..545d9d3d6 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -420,6 +420,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in
index 6505f3822..7213ac5f8 100644
--- a/include/lapi/syscalls/s390.in
+++ b/include/lapi/syscalls/s390.in
@@ -407,6 +407,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index bc5d2b34c..879012e2b 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -355,6 +355,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index 316ffe5f1..7d5192a27 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -401,6 +401,7 @@ pidfd_open 434
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index e0c60a360..91d2fb1c2 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -406,6 +406,7 @@ pidfd_open 434
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index 0acde6856..1f2fc59b7 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -371,6 +371,7 @@ pidfd_open 434
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index 1863e1df7..dc61aa56e 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -348,6 +348,7 @@ clone3 435
close_range 436
openat2 437
pidfd_getfd 438
+faccessat2 439
epoll_pwait2 441
quotactl_fd 443
futex_waitv 449
diff --git a/include/libnewipc.h b/include/libnewipc.h
index 1e126ca1c..969c93292 100644
--- a/include/libnewipc.h
+++ b/include/libnewipc.h
@@ -53,6 +53,8 @@ int get_used_sysvipc(const char *file, const int lineno, const char *sysvipc_fil
get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/msg")
#define GET_USED_SEGMENTS() \
get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/shm")
+#define GET_USED_ARRAYS() \
+ get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/sem")
void *probe_free_addr(const char *file, const int lineno);
#define PROBE_FREE_ADDR() \
diff --git a/include/mk/automake.mk b/include/mk/automake.mk
index ee3b7f1b8..3ecdd3144 100644
--- a/include/mk/automake.mk
+++ b/include/mk/automake.mk
@@ -99,8 +99,7 @@ AUTOGENERATED_FILES = \
include/mk/config.mk \
include/mk/features.mk \
lib/ltp.pc \
- m4/Makefile \
- execltp
+ m4/Makefile
distclean:: %: clean ac-distclean
for d in $(AUTOCONFED_SUBDIRS); do \
diff --git a/include/safe_net_fn.h b/include/safe_net_fn.h
index ff81b1337..6c63cb2cf 100644
--- a/include/safe_net_fn.h
+++ b/include/safe_net_fn.h
@@ -73,6 +73,9 @@ int safe_getsockname(const char *file, const int lineno,
int safe_gethostname(const char *file, const int lineno,
char *name, size_t size);
+int safe_sethostname(const char *file, const int lineno,
+ const char *name, size_t size);
+
int tst_getsockport(const char *file, const int lineno, int sockfd);
unsigned short tst_get_unused_port(const char *file, const int lineno,
diff --git a/include/tst_buffers.h b/include/tst_buffers.h
index d19ac8cf0..b5f355f0f 100644
--- a/include/tst_buffers.h
+++ b/include/tst_buffers.h
@@ -25,6 +25,11 @@ struct tst_buffers {
* Array of iov buffer sizes terminated by -1.
*/
int *iov_sizes;
+ /*
+ * If size and iov_sizes is NULL this is the string we want to strdup()
+ * into the buffer.
+ */
+ char *str;
};
/*
@@ -47,6 +52,12 @@ char *tst_strdup(const char *str);
void *tst_alloc(size_t size);
/*
+ * Printf into a guarded buffer.
+ */
+char *tst_aprintf(const char *fmt, ...)
+ __attribute__((format (printf, 1, 2)));
+
+/*
* Allocates iovec structure including the buffers.
*
* @sizes -1 terminated array of buffer sizes.
diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
index 2826ddad1..be14d07c6 100644
--- a/include/tst_cgroup.h
+++ b/include/tst_cgroup.h
@@ -157,6 +157,10 @@ const char *
tst_cg_group_name(const struct tst_cg_group *const cg)
__attribute__ ((nonnull, warn_unused_result));
+/* This call returns a fd pointing to a v2 directory */
+int tst_cg_group_unified_dir_fd(const struct tst_cg_group *const cg)
+ __attribute__ ((nonnull, warn_unused_result));
+
/* Remove a descendant CGroup */
struct tst_cg_group *
tst_cg_group_rm(struct tst_cg_group *const cg)
diff --git a/include/tst_clone.h b/include/tst_clone.h
index 9ffdc68d1..7b278dfa7 100644
--- a/include/tst_clone.h
+++ b/include/tst_clone.h
@@ -11,6 +11,7 @@
struct tst_clone_args {
uint64_t flags;
uint64_t exit_signal;
+ uint64_t cgroup;
};
/* clone3 with fallbacks to clone when possible. Be aware that it
diff --git a/include/tst_kernel.h b/include/tst_kernel.h
index 9e17bb71e..9d3a8d315 100644
--- a/include/tst_kernel.h
+++ b/include/tst_kernel.h
@@ -10,8 +10,18 @@
*/
int tst_kernel_bits(void);
-/**
- * Checks support for the kernel driver.
+/*
+ * Checks if the kernel module is built-in.
+ *
+ * @param driver The name of the driver.
+ * @return Returns 0 if builtin driver
+ * -1 when driver is missing or config file not available.
+ * On Android *always* 0 (always expect the driver is available).
+ */
+int tst_check_builtin_driver(const char *driver);
+
+/*
+ * Checks support for the kernel module (both built-in and loadable).
*
* @param driver The name of the driver.
* @return Returns 0 if the kernel has the driver,
diff --git a/include/tst_memutils.h b/include/tst_memutils.h
index 45dec55bc..19b593430 100644
--- a/include/tst_memutils.h
+++ b/include/tst_memutils.h
@@ -26,6 +26,11 @@ void tst_pollute_memory(size_t maxsize, int fillchar);
long long tst_available_mem(void);
/*
+ * Read the value of SwapFree from /proc/meminfo.
+ */
+long long tst_available_swap(void);
+
+/*
* Enable OOM protection to prevent process($PID) being killed by OOM Killer.
* echo -1000 >/proc/$PID/oom_score_adj
*
diff --git a/include/tst_minmax.h b/include/tst_minmax.h
index 9d7d596fc..1597fbc97 100644
--- a/include/tst_minmax.h
+++ b/include/tst_minmax.h
@@ -1,10 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2020-2023
*/
#ifndef TST_MINMAX_H__
#define TST_MINMAX_H__
+#include <sys/param.h>
+
#ifndef MIN
# define MIN(a, b) ({ \
typeof(a) _a = (a); \
diff --git a/include/tst_netdevice.h b/include/tst_netdevice.h
index f02661208..5e62ba065 100644
--- a/include/tst_netdevice.h
+++ b/include/tst_netdevice.h
@@ -5,6 +5,8 @@
#ifndef TST_NETDEVICE_H
#define TST_NETDEVICE_H
+#include "tst_rtnetlink.h"
+
/* Find device index for given network interface name. */
int tst_netdev_index_by_name(const char *file, const int lineno,
const char *ifname);
@@ -18,69 +20,70 @@ int tst_netdev_set_state(const char *file, const int lineno,
tst_netdev_set_state(__FILE__, __LINE__, (ifname), (up))
/* Create a connected pair of virtual network devices */
-int tst_create_veth_pair(const char *file, const int lineno,
+int tst_create_veth_pair(const char *file, const int lineno, int strict,
const char *ifname1, const char *ifname2);
#define CREATE_VETH_PAIR(ifname1, ifname2) \
- tst_create_veth_pair(__FILE__, __LINE__, (ifname1), (ifname2))
+ tst_create_veth_pair(__FILE__, __LINE__, 1, (ifname1), (ifname2))
-int tst_netdev_add_device(const char *file, const int lineno,
+int tst_netdev_add_device(const char *file, const int lineno, int strict,
const char *ifname, const char *devtype);
#define NETDEV_ADD_DEVICE(ifname, devtype) \
- tst_netdev_add_device(__FILE__, __LINE__, (ifname), (devtype))
+ tst_netdev_add_device(__FILE__, __LINE__, 1, (ifname), (devtype))
-int tst_netdev_remove_device(const char *file, const int lineno,
+int tst_netdev_remove_device(const char *file, const int lineno, int strict,
const char *ifname);
#define NETDEV_REMOVE_DEVICE(ifname) \
- tst_netdev_remove_device(__FILE__, __LINE__, (ifname))
+ tst_netdev_remove_device(__FILE__, __LINE__, 1, (ifname))
-int tst_netdev_add_address(const char *file, const int lineno,
+int tst_netdev_add_address(const char *file, const int lineno, int strict,
const char *ifname, unsigned int family, const void *address,
unsigned int prefix, size_t addrlen, unsigned int flags);
#define NETDEV_ADD_ADDRESS(ifname, family, address, prefix, addrlen, flags) \
- tst_netdev_add_address(__FILE__, __LINE__, (ifname), (family), \
+ tst_netdev_add_address(__FILE__, __LINE__, 1, (ifname), (family), \
(address), (prefix), (addrlen), (flags))
-int tst_netdev_add_address_inet(const char *file, const int lineno,
+int tst_netdev_add_address_inet(const char *file, const int lineno, int strict,
const char *ifname, in_addr_t address, unsigned int prefix,
unsigned int flags);
#define NETDEV_ADD_ADDRESS_INET(ifname, address, prefix, flags) \
- tst_netdev_add_address_inet(__FILE__, __LINE__, (ifname), (address), \
- (prefix), (flags))
+ tst_netdev_add_address_inet(__FILE__, __LINE__, 1, (ifname), \
+ (address), (prefix), (flags))
-int tst_netdev_remove_address(const char *file, const int lineno,
+int tst_netdev_remove_address(const char *file, const int lineno, int strict,
const char *ifname, unsigned int family, const void *address,
size_t addrlen);
#define NETDEV_REMOVE_ADDRESS(ifname, family, address, addrlen) \
- tst_netdev_remove_address(__FILE__, __LINE__, (ifname), (family), \
+ tst_netdev_remove_address(__FILE__, __LINE__, 1, (ifname), (family), \
(address), (addrlen))
int tst_netdev_remove_address_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t address);
+ int strict, const char *ifname, in_addr_t address);
#define NETDEV_REMOVE_ADDRESS_INET(ifname, address) \
- tst_netdev_remove_address_inet(__FILE__, __LINE__, (ifname), (address))
+ tst_netdev_remove_address_inet(__FILE__, __LINE__, 1, (ifname), \
+ (address))
-int tst_netdev_change_ns_fd(const char *file, const int lineno,
+int tst_netdev_change_ns_fd(const char *file, const int lineno, int strict,
const char *ifname, int nsfd);
#define NETDEV_CHANGE_NS_FD(ifname, nsfd) \
- tst_netdev_change_ns_fd(__FILE__, __LINE__, (ifname), (nsfd))
+ tst_netdev_change_ns_fd(__FILE__, __LINE__, 1, (ifname), (nsfd))
-int tst_netdev_change_ns_pid(const char *file, const int lineno,
+int tst_netdev_change_ns_pid(const char *file, const int lineno, int strict,
const char *ifname, pid_t nspid);
#define NETDEV_CHANGE_NS_PID(ifname, nspid) \
- tst_netdev_change_ns_pid(__FILE__, __LINE__, (ifname), (nspid))
+ tst_netdev_change_ns_pid(__FILE__, __LINE__, 1, (ifname), (nspid))
/*
* Add new static entry to main routing table. If you specify gateway address,
* the interface name is optional.
*/
-int tst_netdev_add_route(const char *file, const int lineno,
+int tst_netdev_add_route(const char *file, const int lineno, int strict,
const char *ifname, unsigned int family, const void *srcaddr,
unsigned int srcprefix, size_t srclen, const void *dstaddr,
unsigned int dstprefix, size_t dstlen, const void *gateway,
size_t gatewaylen);
#define NETDEV_ADD_ROUTE(ifname, family, srcaddr, srcprefix, srclen, dstaddr, \
dstprefix, dstlen, gateway, gatewaylen) \
- tst_netdev_add_route(__FILE__, __LINE__, (ifname), (family), \
+ tst_netdev_add_route(__FILE__, __LINE__, 1, (ifname), (family), \
(srcaddr), (srcprefix), (srclen), (dstaddr), (dstprefix), \
(dstlen), (gateway), (gatewaylen))
@@ -89,25 +92,25 @@ int tst_netdev_add_route(const char *file, const int lineno,
* or dstprefix to 0, the corresponding address will be ignored. Interface
* name is optional if gateway address is non-zero.
*/
-int tst_netdev_add_route_inet(const char *file, const int lineno,
+int tst_netdev_add_route_inet(const char *file, const int lineno, int strict,
const char *ifname, in_addr_t srcaddr, unsigned int srcprefix,
in_addr_t dstaddr, unsigned int dstprefix, in_addr_t gateway);
#define NETDEV_ADD_ROUTE_INET(ifname, srcaddr, srcprefix, dstaddr, dstprefix, \
gateway) \
- tst_netdev_add_route_inet(__FILE__, __LINE__, (ifname), (srcaddr), \
+ tst_netdev_add_route_inet(__FILE__, __LINE__, 1, (ifname), (srcaddr), \
(srcprefix), (dstaddr), (dstprefix), (gateway))
/*
* Remove static entry from main routing table.
*/
-int tst_netdev_remove_route(const char *file, const int lineno,
+int tst_netdev_remove_route(const char *file, const int lineno, int strict,
const char *ifname, unsigned int family, const void *srcaddr,
unsigned int srcprefix, size_t srclen, const void *dstaddr,
unsigned int dstprefix, size_t dstlen, const void *gateway,
size_t gatewaylen);
#define NETDEV_REMOVE_ROUTE(ifname, family, srcaddr, srcprefix, srclen, \
dstaddr, dstprefix, dstlen, gateway, gatewaylen) \
- tst_netdev_remove_route(__FILE__, __LINE__, (ifname), (family), \
+ tst_netdev_remove_route(__FILE__, __LINE__, 1, (ifname), (family), \
(srcaddr), (srcprefix), (srclen), (dstaddr), (dstprefix), \
(dstlen), (gateway), (gatewaylen))
@@ -115,11 +118,74 @@ int tst_netdev_remove_route(const char *file, const int lineno,
* Simplified function for removing IPv4 static route.
*/
int tst_netdev_remove_route_inet(const char *file, const int lineno,
- const char *ifname, in_addr_t srcaddr, unsigned int srcprefix,
- in_addr_t dstaddr, unsigned int dstprefix, in_addr_t gateway);
+ int strict, const char *ifname, in_addr_t srcaddr,
+ unsigned int srcprefix, in_addr_t dstaddr, unsigned int dstprefix,
+ in_addr_t gateway);
#define NETDEV_REMOVE_ROUTE_INET(ifname, srcaddr, srcprefix, dstaddr, \
dstprefix, gateway) \
- tst_netdev_remove_route_inet(__FILE__, __LINE__, (ifname), (srcaddr), \
- (srcprefix), (dstaddr), (dstprefix), (gateway))
+ tst_netdev_remove_route_inet(__FILE__, __LINE__, 1, (ifname), \
+ (srcaddr), (srcprefix), (dstaddr), (dstprefix), (gateway))
+
+/*
+ * Add queueing discipline. Network interface name is optional.
+ */
+int tst_netdev_add_qdisc(const char *file, const int lineno, int strict,
+ const char *ifname, unsigned int family, unsigned int parent,
+ unsigned int handle, const char *qd_kind,
+ const struct tst_rtnl_attr_list *config);
+#define NETDEV_ADD_QDISC(ifname, family, parent, handle, qd_kind, config) \
+ tst_netdev_add_qdisc(__FILE__, __LINE__, 1, (ifname), (family), \
+ (parent), (handle), (qd_kind), (config))
+
+/*
+ * Remove queueing discipline.
+ */
+int tst_netdev_remove_qdisc(const char *file, const int lineno, int strict,
+ const char *ifname, unsigned int family, unsigned int parent,
+ unsigned int handle, const char *qd_kind);
+#define NETDEV_REMOVE_QDISC(ifname, family, parent, handle, qd_kind) \
+ tst_netdev_remove_qdisc(__FILE__, __LINE__, 1, (ifname), (family), \
+ (parent), (handle), (qd_kind))
+
+/*
+ * Add traffic class to queueing discipline. Network interface name is
+ * optional.
+ */
+int tst_netdev_add_traffic_class(const char *file, const int lineno,
+ int strict, const char *ifname, unsigned int parent,
+ unsigned int handle, const char *qd_kind,
+ const struct tst_rtnl_attr_list *config);
+#define NETDEV_ADD_TRAFFIC_CLASS(ifname, parent, handle, qd_kind, config) \
+ tst_netdev_add_traffic_class(__FILE__, __LINE__, 1, (ifname), \
+ (parent), (handle), (qd_kind), (config))
+
+int tst_netdev_remove_traffic_class(const char *file, const int lineno,
+ int strict, const char *ifname, unsigned int parent,
+ unsigned int handle, const char *qd_kind);
+#define NETDEV_REMOVE_TRAFFIC_CLASS(ifname, parent, handle, qd_kind) \
+ tst_netdev_remove_traffic_class(__FILE__, __LINE__, 1, (ifname), \
+ (parent), (handle), (qd_kind))
+
+/*
+ * Add traffic filter to queueing discipline. Protocol should be en ETH_P_*
+ * constant in host byte order. Network interface name is optional.
+ */
+int tst_netdev_add_traffic_filter(const char *file, const int lineno,
+ int strict, const char *ifname, unsigned int parent,
+ unsigned int handle, unsigned int protocol, unsigned int priority,
+ const char *f_kind, const struct tst_rtnl_attr_list *config);
+#define NETDEV_ADD_TRAFFIC_FILTER(ifname, parent, handle, protocol, priority, \
+ f_kind, config) \
+ tst_netdev_add_traffic_filter(__FILE__, __LINE__, 1, (ifname), \
+ (parent), (handle), (protocol), (priority), (f_kind), (config))
+
+int tst_netdev_remove_traffic_filter(const char *file, const int lineno,
+ int strict, const char *ifname, unsigned int parent,
+ unsigned int handle, unsigned int protocol, unsigned int priority,
+ const char *f_kind);
+#define NETDEV_REMOVE_TRAFFIC_FILTER(ifname, parent, handle, protocol, \
+ priority, f_kind) \
+ tst_netdev_remove_traffic_filter(__FILE__, __LINE__, 1, (ifname), \
+ (parent), (handle), (protocol), (priority), (f_kind))
#endif /* TST_NETDEVICE_H */
diff --git a/include/tst_pid.h b/include/tst_pid.h
index 8d999a655..774c845ce 100644
--- a/include/tst_pid.h
+++ b/include/tst_pid.h
@@ -42,4 +42,12 @@ static inline int tst_get_free_pids(void (*cleanup_fn)(void))
}
#endif
+/*
+ * Direct getpid() syscall. Some glibc versions cache getpid() return value
+ * which can cause confusing issues for example in processes created by
+ * direct clone() syscall (without using the glibc wrapper). Use this function
+ * whenever the current process may be a child of the main test process.
+ */
+pid_t tst_getpid(void);
+
#endif /* TST_PID_H__ */
diff --git a/include/tst_safe_net.h b/include/tst_safe_net.h
index e85b79a3e..98f0256fd 100644
--- a/include/tst_safe_net.h
+++ b/include/tst_safe_net.h
@@ -68,6 +68,9 @@
#define SAFE_GETHOSTNAME(name, size) \
safe_gethostname(__FILE__, __LINE__, name, size)
+#define SAFE_SETHOSTNAME(name, size) \
+ safe_sethostname(__FILE__, __LINE__, name, size)
+
#define TST_GETSOCKPORT(sockfd) \
tst_getsockport(__FILE__, __LINE__, sockfd)
diff --git a/include/tst_safe_posix_ipc.h b/include/tst_safe_posix_ipc.h
index 2d3d0928f..e7892f2af 100644
--- a/include/tst_safe_posix_ipc.h
+++ b/include/tst_safe_posix_ipc.h
@@ -121,7 +121,7 @@ static inline int safe_mq_send(const char *file, const int lineno,
if (rval == -1) {
tst_brk_(file, lineno, TBROK | TERRNO,
- "mq_send(%d,%s,%lu,%d) failed", mqdes, msg_ptr,
+ "mq_send(%d,%s,%zu,%d) failed", mqdes, msg_ptr,
msg_len, msg_prio);
}
diff --git a/include/tst_safe_pthread.h b/include/tst_safe_pthread.h
index 8fb553929..360b561b6 100644
--- a/include/tst_safe_pthread.h
+++ b/include/tst_safe_pthread.h
@@ -52,4 +52,56 @@ int safe_pthread_cancel(const char *file, const int lineno,
#define SAFE_PTHREAD_CANCEL(thread_id) \
safe_pthread_cancel(__FILE__, __LINE__, thread_id);
+int safe_pthread_mutexattr_init(const char *file, const int lineno,
+ pthread_mutexattr_t *attr);
+#define SAFE_PTHREAD_MUTEXATTR_INIT(attr) \
+ safe_pthread_mutexattr_init(__FILE__, __LINE__, (attr))
+
+int safe_pthread_mutexattr_destroy(const char *file, const int lineno,
+ pthread_mutexattr_t *attr);
+#define SAFE_PTHREAD_MUTEXATTR_DESTROY(attr) \
+ safe_pthread_mutexattr_destroy(__FILE__, __LINE__, (attr))
+
+int safe_pthread_mutexattr_settype(const char *file, const int lineno,
+ pthread_mutexattr_t *attr, int type);
+#define SAFE_PTHREAD_MUTEXATTR_SETTYPE(attr, type) \
+ safe_pthread_mutexattr_settype(__FILE__, __LINE__, (attr), (type))
+
+int safe_pthread_mutex_init(const char *file, const int lineno,
+ pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
+#define SAFE_PTHREAD_MUTEX_INIT(mutex, attr) \
+ safe_pthread_mutex_init(__FILE__, __LINE__, (mutex), (attr))
+
+int safe_pthread_mutex_destroy(const char *file, const int lineno,
+ pthread_mutex_t *mutex);
+#define SAFE_PTHREAD_MUTEX_DESTROY(mutex) \
+ safe_pthread_mutex_destroy(__FILE__, __LINE__, (mutex))
+
+int safe_pthread_mutex_lock(const char *file, const int lineno,
+ pthread_mutex_t *mutex);
+#define SAFE_PTHREAD_MUTEX_LOCK(mutex) \
+ safe_pthread_mutex_lock(__FILE__, __LINE__, (mutex))
+
+/* Terminates the test on any error other than EBUSY */
+int safe_pthread_mutex_trylock(const char *file, const int lineno,
+ pthread_mutex_t *mutex);
+#define SAFE_PTHREAD_MUTEX_TRYLOCK(mutex) \
+ safe_pthread_mutex_trylock(__FILE__, __LINE__, (mutex))
+
+/* Terminates the test on any error other than ETIMEDOUT */
+int safe_pthread_mutex_timedlock(const char *file, const int lineno,
+ pthread_mutex_t *mutex, const struct timespec *abstime);
+#define SAFE_PTHREAD_MUTEX_TIMEDLOCK(mutex, abstime) \
+ safe_pthread_mutex_timedlock(__FILE__, __LINE__, (mutex), (abstime))
+
+int safe_pthread_mutex_unlock(const char *file, const int lineno,
+ pthread_mutex_t *mutex);
+#define SAFE_PTHREAD_MUTEX_UNLOCK(mutex) \
+ safe_pthread_mutex_unlock(__FILE__, __LINE__, (mutex))
+
+int safe_pthread_kill(const char *file, const int lineno,
+ pthread_t thread, int sig);
+#define SAFE_PTHREAD_KILL(thread, sig) \
+ safe_pthread_kill(__FILE__, __LINE__, (thread), (sig))
+
#endif /* TST_SAFE_PTHREAD_H__ */
diff --git a/include/tst_test.h b/include/tst_test.h
index 22acfba59..75c2109b9 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -177,6 +177,7 @@ struct tst_test {
int child_needs_reinit:1;
int needs_devfs:1;
int restore_wallclock:1;
+
/*
* If set the test function will be executed for all available
* filesystems and the current filesystem type would be set in the
@@ -186,8 +187,11 @@ struct tst_test {
* to the test function.
*/
int all_filesystems:1;
+
int skip_in_lockdown:1;
+ int skip_in_secureboot:1;
int skip_in_compat:1;
+
/*
* If set, the hugetlbfs will be mounted at .mntpoint.
*/
@@ -206,6 +210,9 @@ struct tst_test {
/* Minimum size(MB) of MemAvailable required by the test */
unsigned long min_mem_avail;
+ /* Minimum size(MB) of SwapFree required by the test */
+ unsigned long min_swap_avail;
+
/*
* Two policies for reserving hugepage:
*
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
index 231c04951..bd0c491c1 100644
--- a/include/tst_test_macros.h
+++ b/include/tst_test_macros.h
@@ -51,7 +51,7 @@ extern void *TST_RET_PTR;
tst_res_(__FILE__, __LINE__, RES, \
TST_FMT_(TST_2_(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR, PAR2)
-#define TST_EXP_POSITIVE_(SCALL, SSCALL, ...) \
+#define TST_EXP_POSITIVE__(SCALL, SSCALL, ...) \
do { \
TEST(SCALL); \
\
@@ -73,46 +73,59 @@ extern void *TST_RET_PTR;
\
} while (0)
+#define TST_EXP_POSITIVE_(SCALL, ...) \
+ ({ \
+ TST_EXP_POSITIVE__(SCALL, #SCALL, ##__VA_ARGS__); \
+ TST_RET; \
+ })
+
#define TST_EXP_POSITIVE(SCALL, ...) \
- do { \
- TST_EXP_POSITIVE_(SCALL, #SCALL, ##__VA_ARGS__); \
+ ({ \
+ TST_EXP_POSITIVE__(SCALL, #SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) { \
TST_MSGP_(TPASS, " returned %ld", \
TST_RET, #SCALL, ##__VA_ARGS__); \
} \
- } while (0)
+ \
+ TST_RET; \
+ })
#define TST_EXP_FD_SILENT(SCALL, ...) TST_EXP_POSITIVE_(SCALL, #SCALL, ##__VA_ARGS__)
#define TST_EXP_FD(SCALL, ...) \
- do { \
- TST_EXP_POSITIVE_(SCALL, #SCALL, ##__VA_ARGS__); \
+ ({ \
+ TST_EXP_POSITIVE__(SCALL, #SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) \
TST_MSGP_(TPASS, " returned fd %ld", TST_RET, \
#SCALL, ##__VA_ARGS__); \
- } while (0)
+ \
+ TST_RET; \
+ })
-#define TST_EXP_FD_OR_FAIL(SCALL, ERRNO, ...) \
- do { \
+#define TST_EXP_FD_OR_FAIL(SCALL, ERRNO, ...) \
+ ({ \
if (ERRNO) \
TST_EXP_FAIL(SCALL, ERRNO, ##__VA_ARGS__); \
else \
TST_EXP_FD(SCALL, ##__VA_ARGS__); \
\
- } while (0)
+ TST_RET; \
+ })
#define TST_EXP_PID_SILENT(SCALL, ...) TST_EXP_POSITIVE_(SCALL, #SCALL, ##__VA_ARGS__)
#define TST_EXP_PID(SCALL, ...) \
- do { \
- TST_EXP_POSITIVE_(SCALL, #SCALL, ##__VA_ARGS__); \
+ ({ \
+ TST_EXP_POSITIVE__(SCALL, #SCALL, ##__VA_ARGS__); \
\
if (TST_PASS) \
TST_MSGP_(TPASS, " returned pid %ld", TST_RET, \
#SCALL, ##__VA_ARGS__); \
- } while (0)
+ \
+ TST_RET; \
+ })
#define TST_EXP_VAL_SILENT_(SCALL, VAL, SSCALL, ...) \
do { \