Snap for 6356162 from 50e1a20da917deeab47b75793437f1ab0bec3ba6 to r-keystone-qcom-release

Change-Id: I536a78dcd5544dd41d3eb1dfffb9b5e7c820cf47
diff --git a/.travis.yml b/.travis.yml
index a295516..51efa22 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,11 +19,29 @@
           env: DISTRO=debian:stable VARIANT=cross-compile.aarch64 TREE="out"
           compiler: aarch64-linux-gnu-gcc
 
+        # musl (native)
+        - os: linux
+          # Message: WARNING: xsltproc: cannot process http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
+          # doc/meson.build:70:1: ERROR: Problem encountered: Docs cannot be built: xsltproc does not work correctly
+          env: DISTRO=alpine:latest
+          compiler: gcc
+
         # build with minimal dependencies
         - os: linux
           env: DISTRO=debian:stable VARIANT=minimal TREE="out"
           compiler: clang
 
+        # native non-intel
+        - os: linux
+          arch: ppc64le
+          compiler: gcc
+          env: DISTRO=debian:testing
+
+        - os: linux
+          arch: s390x
+          compiler: gcc
+          env: DISTRO=debian:stable
+
         # other builds
         - os: linux
           env: DISTRO=fedora:latest
@@ -80,4 +98,4 @@
     - INSTALL="${INSTALL%%/*}"
     - if [ ! "$TREE" ]; then TREE="in"; fi
     - case $VARIANT in cross-compile*) BUILD="cross";; i386) BUILD="32";; *) BUILD="native";; esac
-    - docker run -it ltp /bin/sh -c "cd travis && ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ./$INSTALL.$VARIANT.sh; fi && ../build.sh -o $TREE -t $BUILD -c $CC"
+    - docker run -t ltp /bin/sh -c "cd travis && ./$INSTALL.sh && if [ \"$VARIANT\" ]; then ./$INSTALL.$VARIANT.sh; fi && ../build.sh -o $TREE -t $BUILD -c $CC"
diff --git a/Android.bp b/Android.bp
index aeff927..8b7f2e7 100644
--- a/Android.bp
+++ b/Android.bp
@@ -45,11 +45,11 @@
         "-Wno-empty-body",
         "-Wno-format",
         "-Wno-gnu-designator",
-	"-Wno-implicit-function-declaration",
-	"-Wno-incompatible-pointer-types-discards-qualifiers",
+        "-Wno-implicit-function-declaration",
+        "-Wno-incompatible-pointer-types-discards-qualifiers",
         "-Wno-knr-promoted-parameter",
         "-Wno-macro-redefined",
-	"-Wno-missing-braces",
+        "-Wno-missing-braces",
         "-Wno-missing-field-initializers",
         "-Wno-parentheses-equality",
         "-Wno-pointer-arith",
@@ -57,6 +57,7 @@
         "-Wno-sign-compare",
         "-Wno-tautological-compare",
         "-Wno-unneeded-internal-declaration",
+        "-Wno-unreachable-code-loop-increment",
         "-Wno-unused-function",
         "-Wno-unused-parameter",
         "-Wno-unused-variable",
diff --git a/INSTALL b/INSTALL
index 2620af0..3d86415 100644
--- a/INSTALL
+++ b/INSTALL
@@ -38,32 +38,18 @@
 Configuration
 -------------------
 
-Using autoconf (preferred):
-	$ make autotools # This must be run from "$TOP_SRCDIR"!
-	$ test -d "$TOP_BUILDDIR" || mkdir -p "$TOP_BUILDDIR"
-	$ cd "$TOP_BUILDDIR" && "$TOP_SRCDIR/configure" \
-	  # [configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc]
+Configuration requires autoconf:
 
-Not using autoconf:
-
-	$ test -d "$TOP_BUILDDIR" || mkdir -p "$TOP_BUILDDIR"
-	$ cp "$TOP_SRCDIR/include/config.h.default" \
-	     "$TOP_BUILDDIR/include/config.h"
-	$ cp "$TOP_SRCDIR/include/mk/config.mk.default" \
-	     "$TOP_BUILDDIR/include/mk/config.mk"
-	$ cp "$TOP_SRCDIR/include/mk/features.mk.default" \
-	     "$TOP_BUILDDIR/include/mk/features.mk"
-
-	# Fire up your favorite editor and set each value appropriately in
-	# include/mk/config.mk. Uncomment all values commented out, such as
-	# NUMA_LIBS, etc, but only if you're sure that the libraries exist and
-	# can be linked on your system.
+	$ cd $TOP_SRCDIR
+	$ make autotools
+	$ mkdir -p $TOP_BUILDDIR
+	$ cd $TOP_BUILDDIR && ./configure # configure args go here, e.g. CC=$CC, LDFLAGS=$LDFLAGS, etc
 
 - $TOP_SRCDIR and $TOP_BUILDDIR are the same for in-build-tree scenarios.
 - $TOP_SRCDIR and $TOP_BUILDDIR differ for out-of-build-tree scenarios.
 
 See the In-build-tree and Out-of-build-tree sections below for more details on
-what to do next...
+what to do next.
 
 Compiling LTP
 -------------------
@@ -225,7 +211,7 @@
     iv) Finally, before running the network.sh script, two variables must be
 	set: The "RHOST" variable should be set to the hostname of the server.
 	The "PASSWD" variable should be set to root's password on the server
-	machine. This is necessary for tests such as telnet01 and ftp01.
+	machine. This is necessary for tests such as telnet01.sh and ftp01.sh.
 
    You can now successfully execute the network.sh script.
 
@@ -239,7 +225,7 @@
 ---------------
 
 To cross compile, you must specify the correct variables when running configure.
-e.g. CC, CXX, CXXFLAGS, LDFLAGS, etc...
+e.g. CC, LDFLAGS, etc...
 
 After configure has run, it will generate include/mk/config.mk. You can tweak
 settings in there if need be, but you should not specificy settings on the
@@ -264,8 +250,6 @@
 
 CFLAGS   - used when compiling/linking C code, e.g. -D_GNU_SOURCE (no CPPFLAGS!)
 
-CXXFLAGS - used when compiling/linking C++ code (no CPPFLAGS!)
-
 CPPFLAGS - used when preprocessor is run (so C/C++ compiling with $(CPP)
 	   functions, e.g. -I$SYSROOT/usr/include -I$SYSROOT/include -I$SYSROOT
 
diff --git a/README.md b/README.md
index 1eb4747..d248f7c 100644
--- a/README.md
+++ b/README.md
@@ -165,6 +165,9 @@
 limited to shell scripts, many C based tests need environment variables as
 well.
 
+For more info see `doc/user-guide.txt` or online at
+https://github.com/linux-test-project/ltp/wiki/User-Guidelines.
+
 Developers corner
 =================
 
@@ -181,7 +184,14 @@
 list. Also note that these documents are available online at:
 
 * https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines
-* https://github.com/linux-test-project/ltp/wiki/BuildSystem
+* https://github.com/linux-test-project/ltp/wiki/Style-Guide
+* https://github.com/linux-test-project/ltp/wiki/Build-System
 * https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial
 
 Although we accept GitHub pull requests, the preferred way is sending patches to our mailing list.
+
+It's a good idea to test patches on Travis CI before posting to mailing
+list. Our travis setup covers various architectures and distributions in
+order to make sure LTP compiles cleanly on most common configurations.
+For testing you need to sign up to Travis CI, enable running builds on your LTP fork on
+https://travis-ci.org/account/repositories and push your branch.
diff --git a/VERSION b/VERSION
index 4b208e8..74a2a4f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-20190517
+20200120
diff --git a/android/Android.ltp.mk b/android/Android.ltp.mk
index 8261829..18d119e 100644
--- a/android/Android.ltp.mk
+++ b/android/Android.ltp.mk
@@ -41,38 +41,6 @@
 module_src_files := testcases/commands/ld/datafiles/f1.c
 include $(ltp_build_prebuilt)
 
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config0
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config0
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config1
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config1
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config2
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config2
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config3
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config3
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config4
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config4
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config5
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config5
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config6
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config6
-include $(ltp_build_prebuilt)
-
-module_prebuilt := testcases/data/ext4-ffsb/ffsb-config7
-module_src_files := testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config7
-include $(ltp_build_prebuilt)
-
 module_prebuilt := testcases/data/binfmt_misc02/file.extension
 module_src_files := testcases/kernel/fs/binfmt_misc/datafiles/file.extension
 include $(ltp_build_prebuilt)
diff --git a/android/README.md b/android/README.md
index e222546..8445834 100644
--- a/android/README.md
+++ b/android/README.md
@@ -160,6 +160,10 @@
 passing. If something is failing there it should either be fixed with priority
 or disabled until it can be fixed.
 
+If the runtime of LTP changes significantly be sure to update the runtime-hint
+and test-timeout parameters to VTS in
+`test/vts-testcase/kernel/ltp/stable/AndroidTest.xml`.
+
 How do I see or get notified about recent VTS LTP results?
 ----------------------------------------------------------
 
diff --git a/android/include/config.h b/android/include/config.h
index f127914..49a64e3 100644
--- a/android/include/config.h
+++ b/android/include/config.h
@@ -20,21 +20,12 @@
 /* Define to 1 if you have __builtin___clear_cache */
 #define HAVE_BUILTIN_CLEAR_CACHE 1
 
+/* Define to 1 if you have the `copy_file_range' function. */
+/* #undef HAVE_COPY_FILE_RANGE */
+
 /* Define to 1 if you have the `daemon' function. */
 #define HAVE_DAEMON 1
 
-/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_COARSE', and to
-   0 if you don't. */
-#define HAVE_DECL_CLOCK_MONOTONIC_COARSE 1
-
-/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC_RAW', and to 0
-   if you don't. */
-#define HAVE_DECL_CLOCK_MONOTONIC_RAW 1
-
-/* Define to 1 if you have the declaration of `CLOCK_REALTIME_COARSE', and to
-   0 if you don't. */
-#define HAVE_DECL_CLOCK_REALTIME_COARSE 1
-
 /* Define to 1 if you have the declaration of `IFLA_NET_NS_PID', and to 0 if
    you don't. */
 #define HAVE_DECL_IFLA_NET_NS_PID 1
@@ -81,12 +72,29 @@
 /* Define to 1 if you have the `fork' function. */
 #define HAVE_FORK 1
 
+/* Define to 1 if you have the `fsconfig' function. */
+/* #undef HAVE_FSCONFIG */
+
+/* Define to 1 if you have the `fsmount' function. */
+/* #undef HAVE_FSMOUNT */
+
+/* Define to 1 if you have the `fsopen' function. */
+/* #undef HAVE_FSOPEN */
+
+/* Define to 1 if you have the `fspick' function. */
+/* #undef HAVE_FSPICK */
+
 /* Define to 1 if you have the `fstatat' function. */
 #define HAVE_FSTATAT 1
 
-/* Define to 1 if you have FS_IOC_GETFLAGS and FS_IOC_SETFLAGS in
-   <linux/fs.h>. */
-#define HAVE_FS_IOC_FLAGS 1
+/* Define to 1 if you have the <fts.h> header file. */
+#define HAVE_FTS_H 1
+
+/* Define to 1 if you have the `getdents' function. */
+/* #undef HAVE_GETDENTS */
+
+/* Define to 1 if you have the `getdents64' function. */
+/* #undef HAVE_GETDENTS64 */
 
 /* Define to 1 if you have the <ifaddrs.h> header file. */
 #define HAVE_IFADDRS_H 1
@@ -94,6 +102,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1
 
+/* Define to 1 if you have the `io_pgetevents' function. */
+/* #undef HAVE_IO_PGETEVENTS */
+
 /* Define to 1 if you have `io_set_eventfd' function. */
 /* #undef HAVE_IO_SET_EVENTFD */
 
@@ -130,15 +141,24 @@
 /* Define to 1 if you have the <linux/can.h> header file. */
 #define HAVE_LINUX_CAN_H 1
 
+/* Define to 1 if you have the <linux/cgroupstats.h> header file. */
+#define HAVE_LINUX_CGROUPSTATS_H 1
+
 /* Define to 1 if you have the <linux/cryptouser.h> header file. */
 #define HAVE_LINUX_CRYPTOUSER_H 1
 
 /* Define to 1 if you have the <linux/dccp.h> header file. */
 #define HAVE_LINUX_DCCP_H 1
 
+/* Define to 1 if you have the <linux/fs.h> header file. */
+#define HAVE_LINUX_FS_H 1
+
 /* Define to 1 if you have the <linux/genetlink.h> header file. */
 #define HAVE_LINUX_GENETLINK_H 1
 
+/* Define to 1 if you have the <linux/if_alg.h> header file. */
+#define HAVE_LINUX_IF_ALG_H 1
+
 /* Define to 1 if you have the <linux/if_ether.h> header file. */
 #define HAVE_LINUX_IF_ETHER_H 1
 
@@ -163,6 +183,9 @@
 /* Define to 1 if having a valid linux/random.h */
 #define HAVE_LINUX_RANDOM_H 1
 
+/* Define to 1 if you have the <linux/seccomp.h> header file. */
+#define HAVE_LINUX_SECCOMP_H 1
+
 /* Define to 1 if you have the <linux/securebits.h> header file. */
 #define HAVE_LINUX_SECUREBITS_H 1
 
@@ -175,8 +198,8 @@
 /* Define to 1 if you have the <linux/types.h> header file. */
 #define HAVE_LINUX_TYPES_H 1
 
-/* Define to 1 if you have MADV_MERGEABLE */
-#define HAVE_MADV_MERGEABLE 1
+/* Define to 1 if you have the <linux/userfaultfd.h> header file. */
+#define HAVE_LINUX_USERFAULTFD_H 1
 
 /* Define to 1 if you have the <memory.h> header file. */
 #define HAVE_MEMORY_H 1
@@ -196,15 +219,24 @@
 /* Define to 1 if you have the `modify_ldt' function. */
 /* #undef HAVE_MODIFY_LDT */
 
+/* Define to 1 if you have the `move_mount' function. */
+/* #undef HAVE_MOVE_MOUNT */
+
 /* Define to 1 if you have MREMAP_FIXED in <sys/mman.h>. */
 #define HAVE_MREMAP_FIXED 1
 
+/* Define to 1 if you have the `name_to_handle_at' function. */
+/* #undef HAVE_NAME_TO_HANDLE_AT */
+
 /* Define to 1 if you have the <netconfig.h> header file. */
 /* #undef HAVE_NETCONFIG_H */
 
 /* Define to 1 if you have the <netinet/sctp.h> header file. */
 /* #undef HAVE_NETINET_SCTP_H */
 
+/* Define to 1 if you have newer libcap-2 installed. */
+/* #undef HAVE_NEWER_LIBCAP */
+
 /* Define to 1 if you have the <numaif.h> header file. */
 /* #undef HAVE_NUMAIF_H */
 
@@ -220,9 +252,21 @@
 /* Define to 1 if you have the <openssl/sha.h> header file. */
 #define HAVE_OPENSSL_SHA_H 1
 
+/* Define to 1 if you have the `open_tree' function. */
+/* #undef HAVE_OPEN_TREE */
+
 /* Define to 1 if you have struct perf_event_attr */
 #define HAVE_PERF_EVENT_ATTR 1
 
+/* Define to 1 if you have the `pidfd_open' function. */
+#define HAVE_PIDFD_OPEN 1
+
+/* Define to 1 if you have the `pidfd_send_signal' function. */
+/* #undef HAVE_PIDFD_SEND_SIGNAL */
+
+/* Define to 1 if you have the `pkey_mprotect' function. */
+/* #undef HAVE_PKEY_MPROTECT */
+
 /* Define to 1 if you have the `preadv' function. */
 #define HAVE_PREADV 1
 
@@ -238,29 +282,35 @@
 /* Define to 1 if you have the `pwritev' function. */
 #define HAVE_PWRITEV 1
 
-/* Define to 1 if you have quota v1 */
-/* #undef HAVE_QUOTAV1 */
-
-/* Define to 1 if you have quota v2 */
-/* #undef HAVE_QUOTAV2 */
+/* Define to 1 if you have the `pwritev2' function. */
+/* #undef HAVE_PWRITEV2 */
 
 /* Define to 1 if you have the `readlinkat' function. */
 #define HAVE_READLINKAT 1
 
+/* Define to 1 if you have the `recvmmsg' function. */
+#define HAVE_RECVMMSG 1
+
 /* Define to 1 if you have the `renameat' function. */
 #define HAVE_RENAMEAT 1
 
 /* Define to 1 if you have the `renameat2' function. */
-/* #undef HAVE_RENAMEAT2 */
+#define HAVE_RENAMEAT2 1
+
+/* Define to 1 if you have the `sched_getcpu' function. */
+#define HAVE_SCHED_GETCPU 1
 
 /* Define to 1 if you have the <selinux/selinux.h> header file. */
 #define HAVE_SELINUX_SELINUX_H 1
 
+/* Define to 1 if you have the `sendmmsg' function. */
+#define HAVE_SENDMMSG 1
+
 /* Define to 1 if you have the `signalfd' function. */
 #define HAVE_SIGNALFD 1
 
-/* Define to 1 if you have the <signalfd.h> header file. */
-/* #undef HAVE_SIGNALFD_H */
+/* Define to 1 if you have the `sigpending' function. */
+/* #undef HAVE_SIGPENDING */
 
 /* Define to 1 if you have the `splice' function. */
 #define HAVE_SPLICE 1
@@ -274,15 +324,41 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 #define HAVE_STDLIB_H 1
 
+/* Define to 1 if you have the `stime' function. */
+/* #undef HAVE_STIME */
+
 /* Define to 1 if you have the <strings.h> header file. */
 #define HAVE_STRINGS_H 1
 
 /* Define to 1 if you have the <string.h> header file. */
 #define HAVE_STRING_H 1
 
+/* Define to 1 if the system has the type `struct acct_v3'. */
+/* #undef HAVE_STRUCT_ACCT_V3 */
+
+/* Define to 1 if the system has the type `struct fanotify_event_info_fid'. */
+#define HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID 1
+
+/* Define to 1 if `fsid.__val' is a member of `struct
+   fanotify_event_info_fid'. */
+/* #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */
+
+/* Define to 1 if the system has the type `struct fanotify_event_info_header'.
+   */
+#define HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER 1
+
+/* Define to 1 if the system has the type `struct file_dedupe_range'. */
+#define HAVE_STRUCT_FILE_DEDUPE_RANGE 1
+
+/* Define to 1 if the system has the type `struct fs_quota_statv'. */
+/* #undef HAVE_STRUCT_FS_QUOTA_STATV */
+
 /* Define to 1 if you have struct f_owner_ex */
 #define HAVE_STRUCT_F_OWNER_EX 1
 
+/* Define to 1 if the system has the type `struct if_nextdqblk'. */
+#define HAVE_STRUCT_IF_NEXTDQBLK 1
+
 /* Define to 1 if the system has the type `struct iovec'. */
 #define HAVE_STRUCT_IOVEC 1
 
@@ -307,9 +383,6 @@
 /* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */
 #define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1
 
-/* Define to 1 if `signo' is a member of `struct signalfd_siginfo'. */
-#define HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO 1
-
 /* Define to 1 if `ssi_signo' is a member of `struct signalfd_siginfo'. */
 #define HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO 1
 
@@ -328,6 +401,9 @@
 /* Define to 1 if `read_bytes' is a member of `struct taskstats'. */
 #define HAVE_STRUCT_TASKSTATS_READ_BYTES 1
 
+/* Define to 1 if the system has the type `struct termio'. */
+#define HAVE_STRUCT_TERMIO 1
+
 /* Define to 1 if the system has the type `struct tpacket_req3'. */
 #define HAVE_STRUCT_TPACKET_REQ3 1
 
@@ -350,6 +426,9 @@
 /* Define to 1 if the system has the type `struct xt_entry_target'. */
 #define HAVE_STRUCT_XT_ENTRY_TARGET 1
 
+/* Define to 1 if you have the `syncfs' function. */
+#define HAVE_SYNCFS 1
+
 /* Define to 1 if you have __sync_add_and_fetch */
 #define HAVE_SYNC_ADD_AND_FETCH 1
 
@@ -398,6 +477,9 @@
 /* Define to 1 if you have the <sys/ustat.h> header file. */
 /* #undef HAVE_SYS_USTAT_H */
 
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
 /* Define to 1 if you have the <sys/xattr.h> header file. */
 #define HAVE_SYS_XATTR_H 1
 
@@ -434,8 +516,8 @@
 /* Define to 1 if you have the `vmsplice' function. */
 #define HAVE_VMSPLICE 1
 
-/* Define to 1 if you have xfs quota */
-/* #undef HAVE_XFS_QUOTA */
+/* Define to 1 if you have the <xfs/xqm.h> header file. */
+/* #undef HAVE_XFS_XQM_H */
 
 /* Error message when no NUMA support */
 #define NUMA_ERROR_MSG "test requires libnuma >= 2 and it's development packages"
diff --git a/android/ltp_package_list.mk b/android/ltp_package_list.mk
index 5b30137..045e9f5 100644
--- a/android/ltp_package_list.mk
+++ b/android/ltp_package_list.mk
@@ -17,12 +17,15 @@
   ltp_abort01 \
   ltp_abs01 \
   ltp_accept01 \
+  ltp_accept02 \
   ltp_accept4_01 \
   ltp_access01 \
   ltp_access02 \
   ltp_access03 \
   ltp_access04 \
   ltp_acct01 \
+  ltp_acct02 \
+  ltp_acct02_helper \
   ltp_acl1 \
   ltp_add_key01 \
   ltp_add_key02 \
@@ -49,14 +52,16 @@
   ltp_asapi_01 \
   ltp_asapi_02 \
   ltp_asapi_03 \
-  ltp_asyncio02 \
   ltp_atof01 \
   ltp_autogroup01 \
-  ltp_bdflush01 \
   ltp_bind01 \
   ltp_bind02 \
   ltp_bind03 \
   ltp_block_dev \
+  ltp_bpf_map01 \
+  ltp_bpf_prog01 \
+  ltp_bpf_prog02 \
+  ltp_bpf_prog03 \
   ltp_brk01 \
   ltp_cacheflush01 \
   ltp_can_filter \
@@ -68,6 +73,8 @@
   ltp_capget02 \
   ltp_capset01 \
   ltp_capset02 \
+  ltp_capset03 \
+  ltp_capset04 \
   ltp_cgroup_fj_proc \
   ltp_cgroup_regression_6_2 \
   ltp_cgroup_regression_fork_processes \
@@ -122,6 +129,8 @@
   ltp_close08 \
   ltp_connect01 \
   ltp_copy_file_range01 \
+  ltp_copy_file_range02 \
+  ltp_copy_file_range03 \
   ltp_cpuacct_task \
   ltp_cpuctl_def_task01 \
   ltp_cpuctl_def_task02 \
@@ -154,9 +163,8 @@
   ltp_creat08 \
   ltp_create-files \
   ltp_create_datafile \
-  ltp_create_long_dirs \
-  ltp_create_short_dirs \
   ltp_crypto_user01 \
+  ltp_crypto_user02 \
   ltp_cve-2014-0196 \
   ltp_cve-2015-3290 \
   ltp_cve-2016-10044 \
@@ -245,8 +253,6 @@
   ltp_exit01 \
   ltp_exit02 \
   ltp_exit_group01 \
-  ltp_ext4_file_time \
-  ltp_ext4_test_inode_version \
   ltp_f1 \
   ltp_f2 \
   ltp_f3 \
@@ -268,6 +274,9 @@
   ltp_fanotify10 \
   ltp_fanotify11 \
   ltp_fanotify12 \
+  ltp_fanotify13 \
+  ltp_fanotify14 \
+  ltp_fanotify15 \
   ltp_fanotify_child \
   ltp_fanout01 \
   ltp_fchdir01 \
@@ -408,14 +417,10 @@
   ltp_fs_perms \
   ltp_fsetxattr01 \
   ltp_fsetxattr02 \
-  ltp_fstat01 \
-  ltp_fstat01_64 \
   ltp_fstat02 \
   ltp_fstat02_64 \
   ltp_fstat03 \
   ltp_fstat03_64 \
-  ltp_fstat05 \
-  ltp_fstat05_64 \
   ltp_fstatat01 \
   ltp_fstatfs01 \
   ltp_fstatfs01_64 \
@@ -436,12 +441,12 @@
   ltp_ftest08 \
   ltp_ftruncate01 \
   ltp_ftruncate01_64 \
-  ltp_ftruncate02 \
-  ltp_ftruncate02_64 \
   ltp_ftruncate03 \
   ltp_ftruncate03_64 \
   ltp_ftruncate04 \
   ltp_ftruncate04_64 \
+  ltp_futex_cmp_requeue01 \
+  ltp_futex_cmp_requeue02 \
   ltp_futex_wait01 \
   ltp_futex_wait03 \
   ltp_futex_wait04 \
@@ -626,6 +631,10 @@
   ltp_ioperm02 \
   ltp_iopl01 \
   ltp_iopl02 \
+  ltp_ioprio_get01 \
+  ltp_ioprio_set01 \
+  ltp_ioprio_set02 \
+  ltp_ioprio_set03 \
   ltp_kcmp01 \
   ltp_kcmp02 \
   ltp_kcmp03 \
@@ -660,6 +669,7 @@
   ltp_lchown02_16 \
   ltp_lchown03 \
   ltp_lchown03_16 \
+  ltp_leapsec01 \
   ltp_lftest \
   ltp_lgetxattr01 \
   ltp_lgetxattr02 \
@@ -692,8 +702,6 @@
   ltp_lstat01_64 \
   ltp_lstat02 \
   ltp_lstat02_64 \
-  ltp_lstat03 \
-  ltp_lstat03_64 \
   ltp_ltp-diorh \
   ltp_ltpClient \
   ltp_ltpServer \
@@ -708,6 +716,9 @@
   ltp_madvise10 \
   ltp_max_map_count \
   ltp_mbind01 \
+  ltp_mbind02 \
+  ltp_mbind03 \
+  ltp_mbind04 \
   ltp_mc_member_test \
   ltp_mc_recv \
   ltp_mc_send \
@@ -816,7 +827,6 @@
   ltp_move_pages05 \
   ltp_move_pages06 \
   ltp_move_pages07 \
-  ltp_move_pages08 \
   ltp_move_pages09 \
   ltp_move_pages10 \
   ltp_move_pages11 \
@@ -842,7 +852,6 @@
   ltp_munmap03 \
   ltp_nanosleep01 \
   ltp_nanosleep02 \
-  ltp_nanosleep03 \
   ltp_nanosleep04 \
   ltp_netstress \
   ltp_newns \
@@ -908,6 +917,9 @@
   ltp_perf_event_open02 \
   ltp_personality01 \
   ltp_personality02 \
+  ltp_pidfd_send_signal01 \
+  ltp_pidfd_send_signal02 \
+  ltp_pidfd_send_signal03 \
   ltp_pids_task1 \
   ltp_pids_task2 \
   ltp_pipe01 \
@@ -924,6 +936,7 @@
   ltp_pipe2_01 \
   ltp_pipe2_02 \
   ltp_pivot_root01 \
+  ltp_pkey01 \
   ltp_pm_get_sched_values \
   ltp_poll01 \
   ltp_poll02 \
@@ -939,6 +952,13 @@
   ltp_prctl01 \
   ltp_prctl02 \
   ltp_prctl03 \
+  ltp_prctl04 \
+  ltp_prctl05 \
+  ltp_prctl06 \
+  ltp_prctl06_execve \
+  ltp_prctl07 \
+  ltp_prctl08 \
+  ltp_prctl09 \
   ltp_pread01 \
   ltp_pread01_64 \
   ltp_pread02 \
@@ -955,6 +975,8 @@
   ltp_preadv201_64 \
   ltp_preadv202 \
   ltp_preadv202_64 \
+  ltp_preadv203 \
+  ltp_preadv203_64 \
   ltp_print_caps \
   ltp_proc01 \
   ltp_process_vm01 \
@@ -1003,6 +1025,9 @@
   ltp_quotactl01 \
   ltp_quotactl02 \
   ltp_quotactl03 \
+  ltp_quotactl04 \
+  ltp_quotactl05 \
+  ltp_quotactl06 \
   ltp_random-access \
   ltp_random-access-del-create \
   ltp_read01 \
@@ -1244,6 +1269,7 @@
   ltp_setsockopt01 \
   ltp_setsockopt02 \
   ltp_setsockopt03 \
+  ltp_setsockopt04 \
   ltp_settimeofday01 \
   ltp_settimeofday02 \
   ltp_setuid01 \
@@ -1281,6 +1307,7 @@
   ltp_smack_notroot \
   ltp_smack_set_socket_labels \
   ltp_smount \
+  ltp_snd_timer01 \
   ltp_socket01 \
   ltp_socket02 \
   ltp_socketcall01 \
@@ -1300,6 +1327,8 @@
   ltp_stack_space \
   ltp_stat01 \
   ltp_stat01_64 \
+  ltp_stat02 \
+  ltp_stat02_64 \
   ltp_stat03 \
   ltp_stat03_64 \
   ltp_statfs01 \
@@ -1385,8 +1414,10 @@
   ltp_test19 \
   ltp_test_exec \
   ltp_test_exec_child \
+  ltp_test_guarded_buf \
   ltp_test_kconfig \
   ltp_testcases_bin_add_ipv6addr \
+  ltp_testcases_bin_ar01.sh \
   ltp_testcases_bin_arping01.sh \
   ltp_testcases_bin_ask_password.sh \
   ltp_testcases_bin_assign_password.sh \
@@ -1414,10 +1445,10 @@
   ltp_testcases_bin_cgroup_fj_function.sh \
   ltp_testcases_bin_cgroup_fj_stress.sh \
   ltp_testcases_bin_cgroup_lib.sh \
-  ltp_testcases_bin_cgroup_regression_10_1.sh \
-  ltp_testcases_bin_cgroup_regression_10_2.sh \
   ltp_testcases_bin_cgroup_regression_3_1.sh \
   ltp_testcases_bin_cgroup_regression_3_2.sh \
+  ltp_testcases_bin_cgroup_regression_5_1.sh \
+  ltp_testcases_bin_cgroup_regression_5_2.sh \
   ltp_testcases_bin_cgroup_regression_6_1.sh \
   ltp_testcases_bin_cgroup_regression_9_1.sh \
   ltp_testcases_bin_cgroup_regression_9_2.sh \
@@ -1469,22 +1500,13 @@
   ltp_testcases_bin_dctcp01.sh \
   ltp_testcases_bin_dhcp_lib.sh \
   ltp_testcases_bin_dhcpd_tests.sh \
-  ltp_testcases_bin_dns-stress \
   ltp_testcases_bin_dns-stress-lib.sh \
-  ltp_testcases_bin_dns-stress01-rmt \
-  ltp_testcases_bin_dns-stress02-rmt \
+  ltp_testcases_bin_dns-stress.sh \
+  ltp_testcases_bin_dns-stress01-rmt.sh \
+  ltp_testcases_bin_dns-stress02-rmt.sh \
   ltp_testcases_bin_dnsmasq_tests.sh \
   ltp_testcases_bin_dynamic_debug01.sh \
-  ltp_testcases_bin_ext4-alloc-test.sh \
-  ltp_testcases_bin_ext4_funcs.sh \
-  ltp_testcases_bin_ext4_get_inode_version.sh \
-  ltp_testcases_bin_ext4_inode_version_test.sh \
-  ltp_testcases_bin_ext4_journal_checksum.sh \
-  ltp_testcases_bin_ext4_nsec_timestamps_test.sh \
-  ltp_testcases_bin_ext4_online_defrag_test.sh \
-  ltp_testcases_bin_ext4_persist_prealloc_test.sh \
-  ltp_testcases_bin_ext4_subdir_limit_test.sh \
-  ltp_testcases_bin_ext4_uninit_groups_test.sh \
+  ltp_testcases_bin_evm_overlay.sh \
   ltp_testcases_bin_file01.sh \
   ltp_testcases_bin_filecapstest.sh \
   ltp_testcases_bin_find_portbundle \
@@ -1559,14 +1581,13 @@
   ltp_testcases_bin_fsx.sh \
   ltp_testcases_bin_fsxtest \
   ltp_testcases_bin_fsxtest02 \
-  ltp_testcases_bin_ftp-download-stress \
-  ltp_testcases_bin_ftp-download-stress01-rmt \
-  ltp_testcases_bin_ftp-download-stress02-rmt \
-  ltp_testcases_bin_ftp-upload-stress \
-  ltp_testcases_bin_ftp-upload-stress01-rmt \
-  ltp_testcases_bin_ftp-upload-stress02-rmt \
-  ltp_testcases_bin_ftp01 \
-  ltp_testcases_bin_ftp_setup \
+  ltp_testcases_bin_ftp-download-stress.sh \
+  ltp_testcases_bin_ftp-download-stress01-rmt.sh \
+  ltp_testcases_bin_ftp-download-stress02-rmt.sh \
+  ltp_testcases_bin_ftp-upload-stress.sh \
+  ltp_testcases_bin_ftp-upload-stress01-rmt.sh \
+  ltp_testcases_bin_ftp-upload-stress02-rmt.sh \
+  ltp_testcases_bin_ftp01.sh \
   ltp_testcases_bin_ftrace_lib.sh \
   ltp_testcases_bin_ftrace_regression01.sh \
   ltp_testcases_bin_ftrace_regression02.sh \
@@ -1595,10 +1616,10 @@
   ltp_testcases_bin_get_ifname \
   ltp_testcases_bin_gre01.sh \
   ltp_testcases_bin_gre02.sh \
-  ltp_testcases_bin_host01 \
-  ltp_testcases_bin_http-stress \
-  ltp_testcases_bin_http-stress01-rmt \
-  ltp_testcases_bin_http-stress02-rmt \
+  ltp_testcases_bin_host01.sh \
+  ltp_testcases_bin_http-stress.sh \
+  ltp_testcases_bin_http-stress01-rmt.sh \
+  ltp_testcases_bin_http-stress02-rmt.sh \
   ltp_testcases_bin_icmp-uni-basic.sh \
   ltp_testcases_bin_icmp-uni-vti.sh \
   ltp_testcases_bin_icmp4-multi-diffip01 \
@@ -1629,14 +1650,14 @@
   ltp_testcases_bin_icmp6-multi-diffnic05 \
   ltp_testcases_bin_icmp6-multi-diffnic06 \
   ltp_testcases_bin_icmp6-multi-diffnic07 \
-  ltp_testcases_bin_if-addr-adddel \
-  ltp_testcases_bin_if-addr-addlarge \
+  ltp_testcases_bin_if-addr-adddel.sh \
+  ltp_testcases_bin_if-addr-addlarge.sh \
   ltp_testcases_bin_if-lib.sh \
-  ltp_testcases_bin_if-mtu-change \
-  ltp_testcases_bin_if-route-adddel \
-  ltp_testcases_bin_if-route-addlarge \
-  ltp_testcases_bin_if-updown \
-  ltp_testcases_bin_if4-addr-change \
+  ltp_testcases_bin_if-mtu-change.sh \
+  ltp_testcases_bin_if-route-adddel.sh \
+  ltp_testcases_bin_if-route-addlarge.sh \
+  ltp_testcases_bin_if-updown.sh \
+  ltp_testcases_bin_if4-addr-change.sh \
   ltp_testcases_bin_ima_measurements.sh \
   ltp_testcases_bin_ima_policy.sh \
   ltp_testcases_bin_ima_setup.sh \
@@ -1646,12 +1667,15 @@
   ltp_testcases_bin_ip_tests.sh \
   ltp_testcases_bin_ipneigh01.sh \
   ltp_testcases_bin_ipsec_lib.sh \
-  ltp_testcases_bin_iptables_tests.sh \
+  ltp_testcases_bin_iptables01.sh \
+  ltp_testcases_bin_iptables_lib.sh \
   ltp_testcases_bin_ipvlan01.sh \
   ltp_testcases_bin_isofs.sh \
   ltp_testcases_bin_killall_icmp_traffic \
   ltp_testcases_bin_killall_tcp_traffic \
   ltp_testcases_bin_killall_udp_traffic \
+  ltp_testcases_bin_ld01.sh \
+  ltp_testcases_bin_ldd01.sh \
   ltp_testcases_bin_libcgroup_freezer \
   ltp_testcases_bin_linktest.sh \
   ltp_testcases_bin_ln_tests.sh \
@@ -1663,10 +1687,10 @@
   ltp_testcases_bin_macsec_lib.sh \
   ltp_testcases_bin_macvlan01.sh \
   ltp_testcases_bin_macvtap01.sh \
-  ltp_testcases_bin_mc_cmds \
-  ltp_testcases_bin_mc_commo \
-  ltp_testcases_bin_mc_member \
-  ltp_testcases_bin_mc_opts \
+  ltp_testcases_bin_mc_cmds.sh \
+  ltp_testcases_bin_mc_commo.sh \
+  ltp_testcases_bin_mc_member.sh \
+  ltp_testcases_bin_mc_opts.sh \
   ltp_testcases_bin_mcast-group-multiple-socket \
   ltp_testcases_bin_mcast-group-same-group \
   ltp_testcases_bin_mcast-group-single-socket \
@@ -1714,7 +1738,7 @@
   ltp_testcases_bin_myfunctions-io.sh \
   ltp_testcases_bin_myfunctions.sh \
   ltp_testcases_bin_net_cmdlib.sh \
-  ltp_testcases_bin_netstat01 \
+  ltp_testcases_bin_netstat01.sh \
   ltp_testcases_bin_nfs01 \
   ltp_testcases_bin_nfs02 \
   ltp_testcases_bin_nfs03 \
@@ -1724,6 +1748,8 @@
   ltp_testcases_bin_nfs_lib.sh \
   ltp_testcases_bin_nfslock01 \
   ltp_testcases_bin_nfsstat01 \
+  ltp_testcases_bin_nft01.sh \
+  ltp_testcases_bin_nm01.sh \
   ltp_testcases_bin_ns-echoclient \
   ltp_testcases_bin_numa01.sh \
   ltp_testcases_bin_output_ipsec_conf \
@@ -1737,21 +1763,19 @@
   ltp_testcases_bin_pm_sched_domain.py \
   ltp_testcases_bin_pm_sched_mc.py \
   ltp_testcases_bin_quota_remount_test01.sh \
-  ltp_testcases_bin_rcp01 \
+  ltp_testcases_bin_rcp01.sh \
   ltp_testcases_bin_rcu_torture.sh \
   ltp_testcases_bin_remove_password.sh \
-  ltp_testcases_bin_rlogin01 \
-  ltp_testcases_bin_route4-change-dst \
-  ltp_testcases_bin_route4-change-gw \
-  ltp_testcases_bin_route4-change-if \
+  ltp_testcases_bin_rlogin01.sh \
+  ltp_testcases_bin_route-change-dst.sh \
+  ltp_testcases_bin_route-change-gw.sh \
+  ltp_testcases_bin_route-change-if.sh \
+  ltp_testcases_bin_route-lib.sh \
   ltp_testcases_bin_route4-redirect \
   ltp_testcases_bin_route4-rmmod \
-  ltp_testcases_bin_route6-change-dst \
-  ltp_testcases_bin_route6-change-gw \
-  ltp_testcases_bin_route6-change-if \
   ltp_testcases_bin_route6-redirect \
   ltp_testcases_bin_route6-rmmod \
-  ltp_testcases_bin_rsh01 \
+  ltp_testcases_bin_rsh01.sh \
   ltp_testcases_bin_run_capbounds.sh \
   ltp_testcases_bin_run_cpuctl_latency_test.sh \
   ltp_testcases_bin_run_cpuctl_stress_test.sh \
@@ -1778,7 +1802,7 @@
   ltp_testcases_bin_sctp01.sh \
   ltp_testcases_bin_sctp_ipsec.sh \
   ltp_testcases_bin_sctp_ipsec_vti.sh \
-  ltp_testcases_bin_sendfile01 \
+  ltp_testcases_bin_sendfile01.sh \
   ltp_testcases_bin_set_ipv4addr \
   ltp_testcases_bin_sit01.sh \
   ltp_testcases_bin_smack_common.sh \
@@ -1793,14 +1817,15 @@
   ltp_testcases_bin_smack_set_onlycap.sh \
   ltp_testcases_bin_smt_smp_affinity.sh \
   ltp_testcases_bin_smt_smp_enabled.sh \
-  ltp_testcases_bin_ssh-stress \
-  ltp_testcases_bin_ssh-stress01-rmt \
-  ltp_testcases_bin_ssh-stress02-rmt \
-  ltp_testcases_bin_ssh-stress03-rmt \
+  ltp_testcases_bin_ssh-stress.sh \
+  ltp_testcases_bin_ssh-stress01-rmt.sh \
+  ltp_testcases_bin_ssh-stress02-rmt.sh \
+  ltp_testcases_bin_ssh-stress03-rmt.sh \
   ltp_testcases_bin_stop_freeze_sleep_thaw_cont.sh \
   ltp_testcases_bin_stop_freeze_thaw_cont.sh \
   ltp_testcases_bin_stress_floppy \
   ltp_testcases_bin_sysctl01.sh \
+  ltp_testcases_bin_sysctl02.sh \
   ltp_testcases_bin_tcp4-multi-diffip01 \
   ltp_testcases_bin_tcp4-multi-diffip02 \
   ltp_testcases_bin_tcp4-multi-diffip03 \
@@ -2113,8 +2138,8 @@
   ltp_testcases_bin_tcp_fastopen_run.sh \
   ltp_testcases_bin_tcp_ipsec.sh \
   ltp_testcases_bin_tcp_ipsec_vti.sh \
-  ltp_testcases_bin_tcpdump01 \
-  ltp_testcases_bin_telnet01 \
+  ltp_testcases_bin_tcpdump01.sh \
+  ltp_testcases_bin_telnet01.sh \
   ltp_testcases_bin_test.sh \
   ltp_testcases_bin_test_controllers.sh \
   ltp_testcases_bin_test_ioctl \
@@ -2210,14 +2235,6 @@
   ltp_testcases_data_ar01_file4.in \
   ltp_testcases_data_binfmt_misc02_file.extension \
   ltp_testcases_data_binfmt_misc02_file.magic \
-  ltp_testcases_data_ext4-ffsb_ffsb-config0 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config1 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config2 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config3 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config4 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config5 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config6 \
-  ltp_testcases_data_ext4-ffsb_ffsb-config7 \
   ltp_testcases_data_file01_in.ar \
   ltp_testcases_data_file01_in.bash \
   ltp_testcases_data_file01_in.c \
@@ -2264,15 +2281,15 @@
   ltp_time01 \
   ltp_time02 \
   ltp_timed_forkbomb \
+  ltp_timer_create01 \
   ltp_timer_create02 \
   ltp_timer_create03 \
-  ltp_timer_create04 \
+  ltp_timer_delete01 \
   ltp_timer_delete02 \
-  ltp_timer_delete03 \
   ltp_timer_getoverrun01 \
   ltp_timer_gettime01 \
+  ltp_timer_settime01 \
   ltp_timer_settime02 \
-  ltp_timer_settime03 \
   ltp_timerfd01 \
   ltp_timerfd02 \
   ltp_timerfd03 \
@@ -2302,6 +2319,8 @@
   ltp_truncate03_64 \
   ltp_tst_brk \
   ltp_tst_brkm \
+  ltp_tst_capability01 \
+  ltp_tst_capability02 \
   ltp_tst_check_drivers \
   ltp_tst_checkpoint \
   ltp_tst_checkpoint_wait_timeout \
@@ -2341,6 +2360,9 @@
   ltp_tst_supported_fs \
   ltp_tst_tmpdir_test \
   ltp_uaccess \
+  ltp_uevent01 \
+  ltp_uevent02 \
+  ltp_uevent03 \
   ltp_umask01 \
   ltp_umip_basic_test \
   ltp_umount01 \
@@ -2384,6 +2406,7 @@
   ltp_vma05_vdso \
   ltp_vmsplice01 \
   ltp_vmsplice02 \
+  ltp_vmsplice03 \
   ltp_wait01 \
   ltp_wait02 \
   ltp_wait401 \
diff --git a/build.sh b/build.sh
index ae3b86f..c6d1463 100755
--- a/build.sh
+++ b/build.sh
@@ -9,6 +9,9 @@
 
 set -e
 
+CFLAGS="${CFLAGS:--Werror=implicit-function-declaration}"
+CC="${CC:-gcc}"
+
 DEFAULT_PREFIX="$HOME/ltp-install"
 DEFAULT_BUILD="native"
 DEFAULT_TREE="in"
@@ -16,12 +19,12 @@
 # TODO: open posix testsuite is currently broken in out-tree-build. Enable it once it's fixed.
 CONFIGURE_OPTS_OUT_TREE="--with-realtime-testsuite"
 MAKE_OPTS="-j$(getconf _NPROCESSORS_ONLN)"
-CC=gcc
 
 build_32()
 {
 	echo "===== 32-bit ${1}-tree build into $PREFIX ====="
-	build $1 CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32"
+	CFLAGS="-m32 $CFLAGS" LDFLAGS="-m32 $LDFLAGS"
+	build $1
 }
 
 build_native()
@@ -63,7 +66,7 @@
 
 	mkdir -p $build
 	cd $build
-	run_configure $tree/configure $CONFIGURE_OPTS_OUT_TREE CC="$CC" $@
+	run_configure $tree/configure $CONFIGURE_OPTS_OUT_TREE $@
 
 	echo "=== build ==="
 	make $make_opts
@@ -74,7 +77,7 @@
 
 build_in_tree()
 {
-	run_configure ./configure $CONFIGURE_OPTS_IN_TREE CC="$CC" --prefix=$PREFIX $@
+	run_configure ./configure $CONFIGURE_OPTS_IN_TREE --prefix=$PREFIX $@
 
 	echo "=== build ==="
 	make $MAKE_OPTS
@@ -88,6 +91,9 @@
 	local configure=$1
 	shift
 
+	export CC CFLAGS LDFLAGS
+	echo "CC='$CC' CFLAGS='$CFLAGS' LDFLAGS='$LDFLAGS'"
+
 	echo "=== configure $configure $@ ==="
 	if ! $configure $@; then
 		echo "== ERROR: configure failed, config.log =="
diff --git a/configure.ac b/configure.ac
index e59c3f5..50d1496 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,16 +36,20 @@
     ifaddrs.h \
     keyutils.h \
     linux/can.h \
-    linux/dccp.h \
+    linux/cgroupstats.h \
     linux/cryptouser.h \
+    linux/dccp.h \
     linux/genetlink.h \
-    linux/keyctl.h \
     linux/if_alg.h \
     linux/if_packet.h \
     linux/if_ether.h \
+    linux/keyctl.h \
     linux/mempolicy.h \
     linux/module.h \
     linux/netlink.h \
+    linux/seccomp.h \
+    linux/securebits.h \
+    linux/types.h \
     linux/userfaultfd.h \
     mm.h \
     netinet/sctp.h \
@@ -56,19 +60,27 @@
     sys/prctl.h \
     sys/shm.h \
     sys/ustat.h \
+    sys/utsname.h \
     sys/xattr.h \
+    xfs/xqm.h \
 ])
 
 AC_CHECK_FUNCS([ \
+    copy_file_range \
     epoll_pwait \
     execveat \
     fallocate \
     fchownat \
     fstatat \
+    getdents \
+    getdents64 \
     kcmp \
     mkdirat \
     mknodat \
+    name_to_handle_at \
     openat \
+    pidfd_send_signal \
+    pkey_mprotect \
     preadv \
     preadv2 \
     profil \
@@ -96,8 +108,9 @@
 # Expect
 AC_ARG_WITH([bash],
   [AC_HELP_STRING([--with-bash],
-    [have the Bourne Again SHell interpreter (default=no)])],
-  [with_bash=yes],
+    [have the Bourne Again Shell interpreter])],
+  [with_bash=$withval],
+  [with_bash=no]
 )
 if test "x$with_bash" = xyes; then
     AC_SUBST([WITH_BASH],["yes"])
@@ -107,8 +120,8 @@
 
 AC_ARG_WITH([expect],
   [AC_HELP_STRING([--with-expect],
-    [have the Tcl/expect library (default=yes)])],
-  [with_expect=yes],
+    [have the Tcl/expect library])],
+  [with_expect=$withval],
   [with_expect=no]
 )
 if test "x$with_expect" = xyes; then
@@ -120,16 +133,16 @@
 # Numa
 AC_ARG_WITH([numa],
   AC_HELP_STRING([--without-numa],
-    [without numa support (default=no)]),
-  [with_numa=no],
+    [without numa support]),
+  [with_numa=$withval],
   [with_numa=yes]
 )
 
 # Perl
 AC_ARG_WITH([perl],
   [AC_HELP_STRING([--with-perl],
-    [have a perl interpreter (default=yes)])],
-  [with_perl=yes],
+    [have a perl interpreter])],
+  [with_perl=$withval],
   [with_perl=no]
 )
 if test "x$with_perl" = xyes; then
@@ -141,8 +154,8 @@
 # Python
 AC_ARG_WITH([python],
   [AC_HELP_STRING([--with-python],
-    [have a python interpreter (default=yes)])],
-  [with_python=yes],
+    [have a python interpreter])],
+  [with_python=$withval],
   [with_python=no]
 )
 if test "x$with_python" = xyes; then
@@ -154,8 +167,8 @@
 # TI RPC
 AC_ARG_WITH([tirpc],
   AC_HELP_STRING([--without-tirpc],
-    [without libtirpc support (default=no)]),
-  [with_tirpc=no],
+    [without libtirpc support]),
+  [with_tirpc=$withval],
   [with_tirpc=yes]
 )
 # END tools knobs
@@ -164,8 +177,9 @@
 
 AC_ARG_WITH([open-posix-testsuite],
   [AC_HELP_STRING([--with-open-posix-testsuite],
-    [compile and install the open posix testsuite (default=no)])],
-  [with_open_posix_testsuite=$withval]
+    [compile and install the open posix testsuite])],
+  [with_open_posix_testsuite=$withval],
+  [with_open_posix_testsuite=no]
 )
 if test "x$with_open_posix_testsuite" = xyes; then
     AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["yes"])
@@ -173,14 +187,14 @@
     AC_SUBST([WITH_OPEN_POSIX_TESTSUITE],["no"])
 fi
 
-# testcases/realtime requires bash and python.
-if test "x$with_bash" = xyes && test "x$with_python" = xyes; then
-    AC_ARG_WITH([realtime-testsuite],
-      [AC_HELP_STRING([--with-realtime-testsuite],
-        [compile and install the realtime testsuite (default=no)])],
-      [with_realtime_testsuite=yes]
-    )
-fi
+# TODO: testcases/realtime requires bash and python.
+AC_ARG_WITH([realtime-testsuite],
+  [AC_HELP_STRING([--with-realtime-testsuite],
+    [compile and install the realtime testsuite])],
+  [with_realtime_testsuite=$withval],
+  [with_realtime_testsuite=no]
+)
+
 if test "x$with_realtime_testsuite" = xyes; then
     AC_SUBST([WITH_REALTIME_TESTSUITE],["yes"])
     # Run configure on testcases/realtime as well.
@@ -189,11 +203,10 @@
     AC_SUBST([WITH_REALTIME_TESTSUITE],["no"])
 fi
 
-AC_CONFIG_SUBDIRS([utils/ffsb-6.0-rc2])
-
 AC_CONFIG_COMMANDS([syscalls.h], [cd ${ac_top_srcdir}/include/lapi/syscalls; ./regen.sh])
 
 # custom functions
+LTP_CHECK_ACCT
 LTP_CHECK_ACL_SUPPORT
 LTP_CHECK_ATOMIC_MEMORY_MODEL
 LTP_CHECK_BUILTIN_CLEAR_CACHE
@@ -201,9 +214,9 @@
 LTP_CHECK_CC_WARN_OLDSTYLE
 LTP_CHECK_CLONE_SUPPORTS_7_ARGS
 LTP_CHECK_CRYPTO
+LTP_CHECK_FANOTIFY
 LTP_CHECK_FIDEDUPE
 LTP_CHECK_FORTIFY_SOURCE
-LTP_CHECK_FS_IOC_FLAGS
 LTP_CHECK_FTS_H
 LTP_CHECK_IF_LINK
 LTP_CHECK_IOVEC
@@ -220,7 +233,6 @@
 LTP_CHECK_PERF_EVENT
 LTP_CHECK_PRCTL_SUPPORT
 LTP_CHECK_RLIMIT64
-LTP_CHECK_SECUREBITS
 LTP_CHECK_SELINUX
 LTP_CHECK_SIGNAL
 LTP_CHECK_STATX
@@ -237,17 +249,16 @@
 fi
 AC_DEFINE_UNQUOTED(NUMA_ERROR_MSG, ["$numa_error_msg"], [Error message when no NUMA support])
 
+
 LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
 LTP_CHECK_SYSCALL_QUOTACTL
 LTP_CHECK_SYSCALL_SIGNALFD
 LTP_CHECK_SYSCALL_UTIMENSAT
 LTP_CHECK_TASKSTATS
-LTP_CHECK_TIME
 LTP_CHECK_TIMERFD
 test "x$with_tirpc" = xyes && LTP_CHECK_TIRPC
 LTP_CHECK_TPACKET_V3
 LTP_CHECK_UNAME_DOMAINNAME
-LTP_CHECK_XFS_QUOTACTL
 LTP_CHECK_X_TABLES
 LTP_DETECT_HOST_CPU
 
diff --git a/doc/build-system-guide.txt b/doc/build-system-guide.txt
index e9717f1..c4b3623 100644
--- a/doc/build-system-guide.txt
+++ b/doc/build-system-guide.txt
@@ -137,20 +137,14 @@
 
 $(CC)			: The system C compiler.
 
-$(CXX)			: The system C++ compiler.
-
 $(CPP)			: The system C preprocessor.
 
 $(CFLAGS)		: C compiler flags.
 
 $(CPPFLAGS)		: Preprocessor flags, e.g. -I arguments.
 
-$(CXXFLAGS)		: C++ compiler flags, e.g. -I arguments.
-
 $(DEBUG_CFLAGS)		: Debug flags to pass to $(CC), -g, etc.
 
-$(DEBUG_CXXFLAGS)	: Debug flags to pass to $(CXX).
-
 $(LD)			: The system linker (typically $(CC), but not
 			  necessarily).
 
@@ -179,14 +173,10 @@
 			  logic in the tree-optimization portion of the gcc
 			  compiler, from 3.3.x to 4.4.
 
-$(OPT_CXXFLAGS)		: Optimization flags to pass to the C++ compiler.
-
 $(RANLIB)		: What to run after archiving a library.
 
 $(WCFLAGS)		: Warning flags to pass to $(CC), e.g. -Werror,
 			  -Wall, etc.
-
-$(WCXXFLAGS)		: Same as $(WCFLAGS), but for $(CXX).
 -------------------------------------------------------------------------------
 
 Make System Variables
diff --git a/doc/c-test-tutorial-simple.txt b/doc/c-test-tutorial-simple.txt
index 48f3ed5..34b2142 100644
--- a/doc/c-test-tutorial-simple.txt
+++ b/doc/c-test-tutorial-simple.txt
@@ -111,21 +111,9 @@
 
 [source,c]
 ------------------------------------------------------------------------------
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Instruction Ignorer <"can't"@be.bothered.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -190,20 +178,8 @@
 
 [source,make]
 ------------------------------------------------------------------------------
-# Copyright (c) 2017 Linux Test Project
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Linux Test Project
 
 top_srcdir		?= ../../../..
 
diff --git a/doc/colorized-output.txt b/doc/colorized-output.txt
deleted file mode 100644
index c1859cc..0000000
--- a/doc/colorized-output.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Colorized output
-================
-
-1. Usage
---------
-By default LTP colorizes it's output unless using pipe or redirect to file.
-
-It's possible to force behaviour with LTP_COLORIZE_OUTPUT environment variable:
-y or 1: always colorize
-n or 0: never colorize
diff --git a/doc/ltp-howto.lyx b/doc/ltp-howto.lyx
deleted file mode 100644
index ae898fa..0000000
--- a/doc/ltp-howto.lyx
+++ /dev/null
@@ -1,978 +0,0 @@
-#LyX 1.1 created this file. For more info see http://www.lyx.org/
-\lyxformat 2.16
-\textclass docbook
-\begin_preamble
-<!entity header system "header.sgml">
-\end_preamble
-\language default
-\inputencoding default
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize Default
-\paperpackage a4
-\use_geometry 0
-\use_amsmath 0
-\paperorientation portrait
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\quotes_times 2
-\papercolumns 1
-\papersides 1
-\paperpagestyle default
-
-\layout Title
-\added_space_top vfill \added_space_bottom vfill
-Linux Test Project HOWTO
-\layout Date
-
-10 October 2000
-\layout Author
-
-Nate Straz
-\layout Abstract
-
-This document explains some of the more in depth topics of the Linux Test
- Project and related testing issues.
- It does not cover basic installation procedures.
- See the INSTALL and README files in the tarball for that information.
-\layout Section
-
-Preface
-\layout Standard
-
-This document was written to help bring the community up to speed on the
- ins and outs of the Linux Test Project.
-\layout Subsection
-
-Copyright
-\layout Standard
-
-Copyright (c) 2000 by SGI, Inc.
-
-\layout Standard
-
-Please freely copy and distribute (sell or give away) this document in any
- format.
-  It's requested that corrections and/or comments be fowarded to the document
- maintainer.
- You may create a derivative work and distribute it provided that you:
-\layout Itemize
-
-Send your derivative work (in the most suitable format such as sgml) to
- the LDP (Linux Documentation Project) or the like for posting on the Internet.
-  If not the LDP, then let the LDP know where it is available.
-
-\layout Itemize
-
-License the derivative work with this same license or use GPL.
- Include a copyright notice and at least a pointer to the license used.
-
-\layout Itemize
-
-Give due credit to previous authors and major contributors.
-
-\layout Standard
-
-If you're considering making a derived work other than a translation, it's
- requested that you discuss your plans with the current maintainer.
-
-\layout Subsection
-
-Disclaimer
-\layout Standard
-
-Use the information in this document at your own risk.
- I disavow any potential liability for the contents of this document.
- Use of the concepts, examples, and/or other content of this document is
- entirely at your own risk.
-
-\layout Standard
-
-All copyrights are owned by their owners, unless specifically noted otherwise.
-  Use of a term in this document should not be regarded as affecting the
- validity of any trademark or service mark.
-
-\layout Standard
-
-Naming of particular products or brands should not be seen as endorsements.
-
-\layout Standard
-
-You are strongly recommended to take a backup of your system before major
- installation and backups at regular intervals.
-
-\layout Section
-
-Introduction
-\layout Subsection
-
-What is the Linux Test Project?
-\layout Standard
-
-The Linux Test Project (LTP) is an effort to create a set of tools and tests
- to verify the functionality and stability of the Linux kernel.
- We hope this will support Linux development by making unit testing more
- complete and minimizing user impact by building a barrier to keep bugs
- from making it to the user.
-
-\layout Subsection
-
-What is wrong with the current testing model?
-\layout Standard
-
-The Linux development community utilizes two important (some out argue most
- important) testing techniques in its normal operations: Design and Code
- Inspections.
- The intent of LTP is to support this by giving developers an ever growing
- set of tools to help identify any operational problems in their code that
- may be missed by human review.
- One of the toughest categories of problems to catch with inspection is
- that of interaction of features.
- With a continuously improving set of tests and tools, developers can get
- an indication of whether their changes may have broken some other functionality.
-
-\layout Standard
-
-There is no such thing as a perfect test base.
-  It is only useful it if keeps up with new and changing functionality,
- and if it actually gets used.
-
-\layout Subsection
-
-Are you doing benchmarking?
-\layout Standard
-
-Not at  this time.
- We are more interested in functional, regression, and stress testing the
- Linux kernel.
- Benchmarking may be workable to compare the performance among kernel versions.
-
-\layout Subsection
-
-Are you doing standards testing?
-\layout Standard
-
-No, we are leaving that to the Linux Standards Base (LSB).
-  See the Linux Standards Base
-\begin_inset LatexCommand \htmlurl[web site]{http://www.linuxbase.org/}
-
-\end_inset
-
- for more information.
-
-\layout Section
-
-Structure
-\layout Standard
-
-The basic building block of the test project is a
-\series bold
-test case
-\series default
- that consists of a single action and a verification that the action worked.
-  The result of the test case is usually restricted to PASS/FAIL.
-
-\layout Standard
-
-A
-\series bold
-test program
-\series default
- is a runnable program that contains one or more test cases.
- Test programs often understand command line options which alter their behavior.
- The options could determine the amount of memory tested, the location of
- temporary files, the type of network packet used, or any other useful parameter.
-\layout Standard
-
-
-\series bold
-Test tags
-\series default
- are used to pair a unique identifier with a test program and a set of command
- line options.
- Test tags are the basis for test suites.
-\layout Section
-
-Writing Tests
-\layout Standard
-
-Writing a test case is a lot easier than most people think.
-  Any code that you write to examine how a part of the kernel works can
- be adapted into a test case.
-  All that is needed is a way to report the result of the action to the
- rest of the world.
-  There are several ways of doing this, some more involved than others.
-
-\layout Subsection
-
-Exit Style Tests
-\layout Standard
-
-Probably the simplest way of reporting the results of a test case is the
- exit status of your program.
-  If your test program encounters unexpected or incorrect results, exit
- the test program with a non-zero exit status, i.e.
-
-\family typewriter
-exit(1)
-\family default
-.
- Conversely, if your program completes as expected, return a zero exit status,
- i.e.
-
-\family typewriter
-exit(0)
-\family default
-.
- Any test driver should be able to handle this type of error reporting.
- If a test program has multiple test cases you won't know which test case
- failed, but you will know the program that failed.
-
-\layout Subsection
-
-Formatted Output Tests
-\layout Standard
-
-The next easiest way of reporting the results is to write the results of
- each test case to standard output.
- This allows for the testing results to be more understandable to both the
- tester and the analysis tools.
- When the results are written in a standard way, tools can be used to analyze
- the results.
-
-\layout Section
-
-Testing Tools
-\layout Standard
-
-The Linux Test Project has not yet decided on a "final" test harness.
-  We have provided a simple solution with
-\family typewriter
-ltp-pan
-\family default
- to make due until a complete solution has been found/created that compliments
- the Linux kernel development process.
-  Several people have said we should use such and such a test harness.
- Until we find we need a large complex test harness, we will apply the KISS
- concept.
-
-\layout Subsection
-
-Ltp-pan
-\layout Standard
-
-
-\family typewriter
-ltp-pan
-\family default
- is a simple test driver with the ability to keep track of orphaned processes
- and capture test output.
- It works by reading a list of test tags and command lines and runs them.
- By default ltp-pan will select a command randomly from the list of test tags,
- wait for it to finish.
- Through command line options you can run through the entire list sequentially,
- run n tests, keep n test running at all times, and buffer test output.
- Ltp-pan can be nested to create very complex test environments.
-\layout Standard
-
-Ltp-pan uses an
-\emph on
-active file
-\emph default
-, also called a
-\emph on
-zoo file
-\emph default
- to keep track of which tests are currently running.
- This file holds the pid, tag, and a portion of the command line.
- When you start ltp-pan it becomes a test tag in itself, thus it requires a
- name for itself.
- Ltp-pan updates the active file to show which test tags are currently running.
- When a test tag exits, ltp-pan will overwrite the first character with a '#'.
- The active file can be shared between multiple instances of ltp-pan so you
- know which tests were running when the system crashes by looking at one
- file.
-
-\layout Standard
-
-A
-\emph on
-ltp-pan file
-\emph default
- contains a list of test tags for ltp-pan to run.
- The format of a ltp-pan file is as follows:
-\layout Code
-
-
-\latex no_latex
-testtag testprogram -o one -p two other command line options
-\layout Code
-
-
-\latex no_latex
-# This is a comment.
- It is a good idea to describe the test
-\layout Code
-
-
-\latex no_latex
-# tags in your ltp-pan file.
- Tests programs can have different
-\layout Code
-
-
-\latex no_latex
-# behaviors depending on the command line options so it is
-\layout Code
-
-
-\latex no_latex
-# helpful to describe what each test tag is meant to verify or # provoke.
-\layout Code
-
-
-\latex no_latex
-# Some more test cases
-\layout Code
-
-
-\latex no_latex
-mm01 mmap001 -m 10000
-\layout Code
-
-
-\latex no_latex
-# 40 Mb mmap() test.
-\layout Code
-
-
-\latex no_latex
-# Creates a 10000 page mmap, touches all of the map, sync's
-\layout Code
-
-
-\latex no_latex
-# it, and munmap()s it.
-\layout Code
-
-
-\latex no_latex
-mm03 mmap001 -i 0 -I 1 -m 100
-\layout Code
-
-
-\latex no_latex
-# repetitive mmapping test.
-\layout Code
-
-
-\latex no_latex
-# Creates a one page map repetitively for one minute.
-\layout Code
-
-
-\latex no_latex
-dup02 dup02
-\layout Code
-
-
-\latex no_latex
-# Negative test for dup(2) with bad fd
-\layout Code
-
-
-\latex no_latex
-kill09 kill09
-\layout Code
-
-
-\latex no_latex
-# Basic test for kill(2)
-\layout Code
-
-
-\latex no_latex
-fs-suite01 ltp-pan -e -a fs-suite01.zoo -n fs-suite01 -f runtest/fs
-\layout Code
-
-
-\latex no_latex
-# run the entire set of file system tests
-\layout Standard
-
-The test tags are simple identifiers, no spaces are allowed.
- The test of the line is the program to run, which is done using execvp(3).
- Lines starting with '#' are comments and ignored by ltp-pan.
- It is a good practice to include descriptions with your test tags so you
- can have a reminder what a certain obscure test tag tries to do.
-\layout Subsubsection
-
-Examples
-\layout Standard
-
-The most basic way to run ltp-pan is by passing the test program and parameters
- on the command line.
- This will run the single program once and wrap the output.
-
-\layout Code
-
-
-\latex no_latex
-$ ltp-pan -a ltp.zoo -n tutor sleep 4
-\layout Code
-
-
-\latex no_latex
-<<<test_start>>>
-\layout Code
-
-
-\latex no_latex
-tag=cmdln stime=971450564
-\layout Code
-
-
-\latex no_latex
-cmdline="sleep 4"
-\layout Code
-
-
-\latex no_latex
-contacts=""
-\layout Code
-
-
-\latex no_latex
-analysis=exit
-\layout Code
-
-
-\latex no_latex
-initiation_status="ok"
-\layout Code
-
-
-\latex no_latex
-<<<test_output>>>
-\layout Code
-
-
-\latex no_latex
-<<<execution_status>>>
-\layout Code
-
-
-\latex no_latex
-duration=103341903 termination_type=exited termination_id=0 corefile=no
- cutime=0 cstime=0
-\layout Code
-
-
-\latex no_latex
-<<<test_end>>>
-\layout Code
-
-
-\latex no_latex
-$ cat ltp.zoo
-\layout Code
-
-
-\latex no_latex
-#9357,tutor,pan/ltp-pan -a ltp.zoo -n tutor sleep 4
-\layout Code
-
-
-\latex no_latex
-#9358,cmdln,sleep 4
-\layout Code
-
-
-\latex no_latex
-$
-\layout Paragraph
-
-How it works
-\layout Standard
-
-This example shows the two parameters that are always required by ltp-pan, the
- active file and a test tag for ltp-pan.
- The
-\begin_inset Quotes eld
-\end_inset
-
-sleep 4
-\begin_inset Quotes erd
-\end_inset
-
- on the end of the command line is a test program and parameters that ltp-pan
- should run.
- This test is given the tag
-\begin_inset Quotes eld
-\end_inset
-
-cmdln.
-\begin_inset Quotes erd
-\end_inset
-
- Ltp-pan will run one test randomly, which ends up being cmdln since it is the
- only test that we told ltp-pan about.
-
-\layout Standard
-
-In the active file,
-\family typewriter
-ltp.zoo
-\family default
-, ltp-pan writes the pid, test tag, and part of the command line for the currently
- running tests.
- The command lines are truncated so each line will fit on an 80 column display.
- When a test tag finishes, ltp-pan will place a '#' at the beginning of the
- line to mark it as available.
- Here you can see that cmdln and tutor, the name we gave ltp-pan, ran to completion.
- If the computer hangs, you can read this file to see which test programs
- were running.
-\layout Standard
-
-We have run one test once.
- Let's do something a little more exciting.
- Let's run one test several times, at the same time.
-
-\layout Code
-
-
-\latex no_latex
-$ ltp-pan -a ltp.zoo -n tutor -x 3 -s 3 -O /tmp sleep 1
-\layout Code
-
-
-\latex no_latex
-<<<test_start>>>
-\layout Code
-
-
-\latex no_latex
-tag=cmdln stime=971465653
-\layout Code
-
-
-\latex no_latex
-cmdline="sleep 1"
-\layout Code
-
-
-\latex no_latex
-contacts=""
-\layout Code
-
-
-\latex no_latex
-analysis=exit
-\layout Code
-
-
-\latex no_latex
-initiation_status="ok"
-\layout Code
-
-
-\latex no_latex
-<<<test_output>>>
-\layout Code
-
-
-\latex no_latex
-
-\layout Code
-
-
-\latex no_latex
-<<<execution_status>>>
-\layout Code
-
-
-\latex no_latex
-duration=103326814 termination_type=exited termination_id=0 corefile=no
-\layout Code
-
-
-\latex no_latex
-cutime=1 cstime=0
-\layout Code
-
-
-\latex no_latex
-<<<test_end>>>
-\layout Code
-
-
-\latex no_latex
-<<<test_start>>>
-\layout Code
-
-
-\latex no_latex
-tag=cmdln stime=971465653
-\layout Code
-
-
-\latex no_latex
-cmdline="sleep 1"
-\layout Code
-
-
-\latex no_latex
-contacts=""
-\layout Code
-
-
-\latex no_latex
-analysis=exit
-\layout Code
-
-
-\latex no_latex
-initiation_status="ok"
-\layout Code
-
-
-\latex no_latex
-<<<test_output>>>
-\layout Code
-
-
-\latex no_latex
-
-\layout Code
-
-
-\latex no_latex
-<<<execution_status>>>
-\layout Code
-
-
-\latex no_latex
-duration=103326814 termination_type=exited termination_id=0 corefile=no
-\layout Code
-
-
-\latex no_latex
-cutime=0 cstime=1
-\layout Code
-
-
-\latex no_latex
-<<<test_end>>>
-\layout Code
-
-
-\latex no_latex
-<<<test_start>>>
-\layout Code
-
-
-\latex no_latex
-tag=cmdln stime=971465653
-\layout Code
-
-
-\latex no_latex
-cmdline="sleep 1"
-\layout Code
-
-
-\latex no_latex
-contacts=""
-\layout Code
-
-
-\latex no_latex
-analysis=exit
-\layout Code
-
-
-\latex no_latex
-initiation_status="ok"
-\layout Code
-
-
-\latex no_latex
-<<<test_output>>>
-\layout Code
-
-
-\latex no_latex
-
-\layout Code
-
-
-\latex no_latex
-<<<execution_status>>>
-\layout Code
-
-
-\latex no_latex
-duration=103326814 termination_type=exited termination_id=0 corefile=no
-\layout Code
-
-
-\latex no_latex
-cutime=0 cstime=0
-\layout Code
-
-
-\latex no_latex
-<<<test_end>>>
-\layout Paragraph
-
-How it works
-\layout Standard
-
-In this example we run another fake test from the command line, but we run
- it three times (-s 3) and keep three test tags active at the same time
- (-x 3).
- The -O parameter is a directory where temporary files can be created to
- buffer the output of each test tag.
- You can see in the output that cmdln ran three times.
- If the -O option were omitted, your test output would be mixed, making
- it almost worthless.
-
-\layout Itemize
-
-Using a ltp-pan file to run multiple tests
-\layout Itemize
-
-Nesting ltp-pan
-\layout Standard
-
-For more information on ltp-pan see the man page
-\family typewriter
-doc/man1/ltp-pan.1
-\family default
-.
-\layout Subsection
-
-Scanner
-\layout Standard
-
-
-\family typewriter
-Ltp-scanner
-\family default
- is a results analysis tool that understands the
-\emph on
-rts
-\emph default
- style output which
-\family typewriter
-ltp-pan
-\family default
- generates by default.
- It will produce a table summarizing which tests passed and which failed.
-
-\layout Subsection
-
-The Quick-hitter Package
-\layout Standard
-
-Many of the tests released use the Quick-hitter test package to perform
- tasks like create and move to a temporary directory, handle some common
- command line parameters, loop, run in parallel, handle signals, and clean
- up.
-
-\layout Standard
-
-There is an example test case,
-\family typewriter
-doc/examples/quickhit.c
-\family default
-, which shows how the quick-hitter package can be used.
- The file is meant to be a supplement to the documentation, not a working
- test case.
- Use any of the tests in
-\family typewriter
-tests/
-\family default
- as a template.
-\layout Section
-
-To Do
-\layout Standard
-
-There are a lot of things that still need to be done to make this a complete
- kernel testing system.
- The following sections will discuss some of the to do items in detail.
-
-\layout Subsection
-
-Configuration Analysis
-\layout Standard
-
-While the number of configuration options for the Linux kernel is seen as
- a strength to developers and users alike, it is a curse to testers.
-  To create a powerful automated testing system, we need to be able to determine
- what the configuration on the booted box is and then determine which tests
- should be run on that box.
-
-\layout Standard
-
-The Linux kernel has hundreds of configuration options that can be set to
- compile the kernel.
-  There are more options that can be set when you boot the kernel and while
- it is running.
-  There are also many patches that can be applied to the kernel to add functiona
-lity or change behavior.
-
-\layout Subsection
-
-Result Comparison
-\layout Standard
-
-A lot of testing will be done in the life of the Linux Test Project.
- Keeping track of the results from all the testing will require some infrastruct
-ure.
- It would be nice to take that output from a test machine, feed it to a
- program and receive a list of items that broke since the last run on that
- machine, or were fixed, or work on another test machine but not on this
- one.
-
-\layout Section
-
-Contact information and updates
-\layout Literal
-
-URL: http://ltp.sourceforge.net/
-\layout Literal
-
-mailing list: ltp@lists.linux.it
-\layout Literal
-
-list archive: http://lists.linux.it/pipermail/ltp/
-\layout Standard
-
-Questions and comments should be sent to the LTP mailing
- list at ltp@lists.linux.it. To subscribe, please go to
- http://lists.linux.it/pipermail/ltp/.
-
-\layout Standard
-
-The source is also available via CVS.
-  See the web site for a web interface and check out instructions.
-
-\layout Section
-
-Glossary
-\layout Description
-
-Test IEEE/ANSI
-\begin_float footnote
-\layout Standard
-
-Kit, Edward, Software Testing in the Real World: Improving the Process.
- P.
- 82.
- ACM Press, 1995.
-\end_float
-:
-\shape italic
-
-\newline
-
-\shape default
-
-\shape italic
-(i)
-\shape default
- An activity in which a system or component is executed under specified
- conditions, the results are observed or record, and an evaluation is made
- of some aspect of the system or component.
-
-\shape italic
-
-\newline
-
-\shape default
-
-\shape italic
-(ii)
-\shape default
- A set of one or more test cases.
-
-\layout Description
-
-Test\SpecialChar ~
-Case A test assertion with a single result that is being verified.
- This allows designations such as PASS or FAIL to be applied to a single
- bit of functionality.
-  A single test case may be one of many test cases for testing the complete
- functionality of a system.
-
-\newline
-IEEE/ANSI:
-\shape italic
-
-\newline
-(i)
-\shape default
-A set of test inputs, execution conditions, and expected results developed
- for a particular objective.
-
-\shape italic
-
-\newline
-(ii)
-\shape default
- The smallest entity that is always executed as a unit, from beginning to
- end.
-
-\layout Description
-
-Test\SpecialChar ~
-Driver A program that handles the execution of test programs.
- It is responsible for starting the test programs, capturing their output,
- and recording their results.
- Ltp-pan is an example of a test driver.
-\layout Description
-
-Test\SpecialChar ~
-Framework A mechanism for organizing a group of tests.
-  Frameworks may have complex or very simple API's, drivers and result logging
- mechanisms.
- Examples of frameworks are TETware and DejaGnu.
-
-\layout Description
-
-Test\SpecialChar ~
-Harness A Test harness is the mechanism that connects a test program
- to a test framework.
-  It may be a specification of exit codes,  or a set of libraries for formatting
- messages and determining exit codes.
-  In TETware, the tet_result() API is the test harness.
-
-\layout Description
-
-Test\SpecialChar ~
-Program A single invokable program.
-  A test program can contain one or more test cases.
- The test harness's API allows for reporting/analysis of the individual
- test cases.
-
-\layout Description
-
-Test\SpecialChar ~
-Suite A collection of tests programs, assertions, cases grouped together
- under a framework.
-
-\layout Description
-
-Test\SpecialChar ~
-Tag An identifier that corresponds to a command line which runs a test.
-  The tag is a single word that matches a test program with a set of command
- line arguments.
-
-\the_end
diff --git a/doc/ltp-howto.txt b/doc/ltp-howto.txt
deleted file mode 100644
index 9f1a573..0000000
--- a/doc/ltp-howto.txt
+++ /dev/null
@@ -1,488 +0,0 @@
-
-
-Linux Test Project HOWTO
-
-10 October 2000
-
-Nate Straz
-
-Abstract
-
-This document explains some of the more in depth topics of
-the Linux Test Project and related testing issues. It does
-not cover basic installation procedures. See the INSTALL
-and README files in the tarball for that information.
-
-1 Preface
-
-This document was written to help bring the community up
-to speed on the ins and outs of the Linux Test Project.
-
-1.1 Copyright
-
-Copyright (c) 2000 by SGI, Inc.
-
-Please freely copy and distribute (sell or give away) this
-document in any format.  It's requested that corrections
-and/or comments be forwarded to the document maintainer.
-You may create a derivative work and distribute it provided
-that you:
-
-* Send your derivative work (in the most suitable format
-  such as sgml) to the LDP (Linux Documentation Project)
-  or the like for posting on the Internet.  If not the LDP,
-  then let the LDP know where it is available.
-
-* License the derivative work with this same license or use
-  GPL. Include a copyright notice and at least a pointer
-  to the license used.
-
-* Give due credit to previous authors and major contributors.
-
-If you're considering making a derived work other than a
-translation, it's requested that you discuss your plans
-with the current maintainer.
-
-1.2 Disclaimer
-
-Use the information in this document at your own risk. I
-disavow any potential liability for the contents of this
-document. Use of the concepts, examples, and/or other content
-of this document is entirely at your own risk.
-
-All copyrights are owned by their owners, unless specifically
-noted otherwise.  Use of a term in this document should
-not be regarded as affecting the validity of any trademark
-or service mark.
-
-Naming of particular products or brands should not be seen
-as endorsements.
-
-You are strongly recommended to take a backup of your system
-before major installation and backups at regular intervals.
-
-2 Introduction
-
-2.1 What is the Linux Test Project?
-
-The Linux Test Project (LTP) is an effort to create a set
-of tools and tests to verify the functionality and stability
-of the Linux kernel. We hope this will support Linux development
-by making unit testing more complete and minimizing user
-impact by building a barrier to keep bugs from making it
-to the user.
-
-2.2 What is wrong with the current testing model?
-
-The Linux development community utilizes two important (some
-out argue most important) testing techniques in its normal
-operations: Design and Code Inspections. The intent of LTP
-is to support this by giving developers an ever growing
-set of tools to help identify any operational problems in
-their code that may be missed by human review. One of the
-toughest categories of problems to catch with inspection
-is that of interaction of features. With a continuously
-improving set of tests and tools, developers can get an
-indication of whether their changes may have broken some
-other functionality.
-
-There is no such thing as a perfect test base.  It is only
-useful it if keeps up with new and changing functionality,
-and if it actually gets used.
-
-2.3 Are you doing benchmarking?
-
-Not at  this time. We are more interested in functional,
-regression, and stress testing the Linux kernel. Benchmarking
-may be workable to compare the performance among kernel
-versions.
-
-2.4 Are you doing standards testing?
-
-No, we are leaving that to the Linux Standards Base (LSB).
- See the Linux Standards Base [http://www.linuxbase.org/||web site]
-for more information.
-
-3 Structure
-
-The basic building block of the test project is a test case
-that consists of a single action and a verification that
-the action worked.  The result of the test case is usually
-restricted to PASS/FAIL.
-
-A test program is a runnable program that contains one or
-more test cases. Test programs often understand command
-line options which alter their behavior. The options could
-determine the amount of memory tested, the location of temporary
-files, the type of network packet used, or any other useful
-parameter.
-
-Test tags are used to pair a unique identifier with a test
-program and a set of command line options. Test tags are
-the basis for test suites.
-
-4 Writing Tests
-
-Writing a test case is a lot easier than most people think.
- Any code that you write to examine how a part of the kernel
-works can be adapted into a test case.  All that is needed
-is a way to report the result of the action to the rest
-of the world.  There are several ways of doing this, some
-more involved than others.
-
-4.1 Exit Style Tests
-
-Probably the simplest way of reporting the results of a test
-case is the exit status of your program.  If your test program
-encounters unexpected or incorrect results, exit the test
-program with a non-zero exit status, i.e. exit(1). Conversely,
-if your program completes as expected, return a zero exit
-status, i.e. exit(0). Any test driver should be able to
-handle this type of error reporting. If a test program has
-multiple test cases you won't know which test case failed,
-but you will know the program that failed.
-
-4.2 Formatted Output Tests
-
-The next easiest way of reporting the results is to write
-the results of each test case to standard output. This allows
-for the testing results to be more understandable to both
-the tester and the analysis tools. When the results are
-written in a standard way, tools can be used to analyze
-the results.
-
-5 Testing Tools
-
-The Linux Test Project has not yet decided on a "final" test
-harness.  We have provided a simple solution with ltp-pan to
-make due until a complete solution has been found/created
-that compliments the Linux kernel development process.
-Several people have said we should use such and such a test
-harness. Until we find we need a large complex test harness,
-we will apply the KISS concept.
-
-5.1 Ltp-pan
-
-Ltp-pan is a simple test driver with the ability to keep track
-of orphaned processes and capture test output. It works
-by reading a list of test tags and command lines and runs
-them. By default ltp-pan will select a command randomly from
-the list of test tags, wait for it to finish. Through command
-line options you can run through the entire list sequentially,
-run n tests, keep n test running at all times, and buffer
-test output. Ltp-pan can be nested to create very complex test
-environments.
-
-Ltp-pan uses an active file, also called a zoo file to keep track
-of which tests are currently running. This file holds the
-pid, tag, and a portion of the command line. When you start
-ltp-pan it becomes a test tag in itself, thus it requires a
-name for itself. Ltp-pan updates the active file to show which
-test tags are currently running. When a test tag exits,
-ltp-pan will overwrite the first character with a '#'. The active
-file can be shared between multiple instances of ltp-pan so
-you know which tests were running when the system crashes
-by looking at one file.
-
-A ltp-pan file contains a list of test tags for ltp-pan to run. The
-format of a ltp-pan file is as follows:
-
-testtag testprogram -o one -p two other command line options
-
-# This is a comment. It is a good idea to describe the test
-
-# tags in your ltp-pan file. Tests programs can have different
-
-# behaviors depending on the command line options so it is
-
-# helpful to describe what each test tag is meant to verify
-or # provoke.
-
-# Some more test cases
-
-mm01 mmap001 -m 10000
-
-# 40 Mb mmap() test.
-
-# Creates a 10000 page mmap, touches all of the map, sync's
-
-# it, and munmap()s it.
-
-mm03 mmap001 -i 0 -I 1 -m 100
-
-# repetitive mmapping test.
-
-# Creates a one page map repetitively for one minute.
-
-dup02 dup02
-
-# Negative test for dup(2) with bad fd
-
-kill09 kill09
-
-# Basic test for kill(2)
-
-fs-suite01 ltp-pan -e -a fs-suite01.zoo -n fs-suite01 -f runtest/fs
-
-# run the entire set of file system tests
-
-The test tags are simple identifiers, no spaces are allowed.
-The test of the line is the program to run, which is done
-using execvp(3). Lines starting with '#' are comments and
-ignored by ltp-pan. It is a good practice to include descriptions
-with your test tags so you can have a reminder what a certain
-obscure test tag tries to do.
-
-5.1.1 Examples
-
-The most basic way to run ltp-pan is by passing the test program
-and parameters on the command line. This will run the single
-program once and wrap the output.
-
-$ ltp-pan -a ltp.zoo -n tutor sleep 4
-
-<<<test_start>>>
-
-tag=cmdln stime=971450564
-
-cmdline="sleep 4"
-
-contacts=""
-
-analysis=exit
-
-initiation_status="ok"
-
-<<<test_output>>>
-
-<<<execution_status>>>
-
-duration=103341903 termination_type=exited termination_id=0
-corefile=no cutime=0 cstime=0
-
-<<<test_end>>>
-
-$ cat ltp.zoo
-
-#9357,tutor,pan/ltp-pan -a ltp.zoo -n tutor sleep 4
-
-#9358,cmdln,sleep 4
-
-$
-
-How it works
-
-This example shows the two parameters that are always required
-by ltp-pan, the active file and a test tag for ltp-pan. The "sleep
-4" on the end of the command line is a test program and
-parameters that ltp-pan should run. This test is given the tag
-"cmdln." Ltp-pan will run one test randomly, which ends
-up being cmdln since it is the only test that we told ltp-pan
-about.
-
-In the active file, ltp.zoo, ltp-pan writes the pid, test tag,
-and part of the command line for the currently running tests.
-The command lines are truncated so each line will fit on
-an 80 column display. When a test tag finishes, ltp-pan will
-place a '#' at the beginning of the line to mark it as available.
-Here you can see that cmdln and tutor, the name we gave
-ltp-pan, ran to completion. If the computer hangs, you can read
-this file to see which test programs were running.
-
-We have run one test once. Let's do something a little more
-exciting. Let's run one test several times, at the same
-time.
-
-$ ltp-pan -a ltp.zoo -n tutor -x 3 -s 3 -O /tmp sleep 1
-
-<<<test_start>>>
-
-tag=cmdln stime=971465653
-
-cmdline="sleep 1"
-
-contacts=""
-
-analysis=exit
-
-initiation_status="ok"
-
-<<<test_output>>>
-
-
-
-<<<execution_status>>>
-
-duration=103326814 termination_type=exited termination_id=0
-corefile=no
-
-cutime=1 cstime=0
-
-<<<test_end>>>
-
-<<<test_start>>>
-
-tag=cmdln stime=971465653
-
-cmdline="sleep 1"
-
-contacts=""
-
-analysis=exit
-
-initiation_status="ok"
-
-<<<test_output>>>
-
-
-
-<<<execution_status>>>
-
-duration=103326814 termination_type=exited termination_id=0
-corefile=no
-
-cutime=0 cstime=1
-
-<<<test_end>>>
-
-<<<test_start>>>
-
-tag=cmdln stime=971465653
-
-cmdline="sleep 1"
-
-contacts=""
-
-analysis=exit
-
-initiation_status="ok"
-
-<<<test_output>>>
-
-
-
-<<<execution_status>>>
-
-duration=103326814 termination_type=exited termination_id=0
-corefile=no
-
-cutime=0 cstime=0
-
-<<<test_end>>>
-
-How it works
-
-In this example we run another fake test from the command
-line, but we run it three times (-s 3) and keep three test
-tags active at the same time (-x 3). The -O parameter is
-a directory where temporary files can be created to buffer
-the output of each test tag. You can see in the output that
-cmdln ran three times. If the -O option were omitted, your
-test output would be mixed, making it almost worthless.
-
-* Using a ltp-pan file to run multiple tests
-
-* Nesting ltp-pan
-
-For more information on ltp-pan see the man page doc/man1/ltp-pan.1.
-
-5.2 Scanner
-
-Ltp-scanner is a results analysis tool that understands the rts
-style output which ltp-pan generates by default. It will produce
-a table summarizing which tests passed and which failed.
-
-6 To Do
-
-There are a lot of things that still need to be done to make
-this a complete kernel testing system. The following sections
-will discuss some of the to do items in detail.
-
-6.1 Configuration Analysis
-
-While the number of configuration options for the Linux kernel
-is seen as a strength to developers and users alike, it
-is a curse to testers.  To create a powerful automated testing
-system, we need to be able to determine what the configuration
-on the booted box is and then determine which tests should
-be run on that box.
-
-The Linux kernel has hundreds of configuration options that
-can be set to compile the kernel.  There are more options
-that can be set when you boot the kernel and while it is
-running.  There are also many patches that can be applied
-to the kernel to add functionality or change behavior.
-
-6.2 Result Comparison
-
-A lot of testing will be done in the life of the Linux Test
-Project. Keeping track of the results from all the testing
-will require some infrastructure. It would be nice to take
-that output from a test machine, feed it to a program and
-receive a list of items that broke since the last run on
-that machine, or were fixed, or work on another test machine
-but not on this one.
-
-7 Contact information and updates
-
-URL: http://ltp.sourceforge.net/
-
-mailing list: ltp@lists.linux.it
-
-list archive: http://lists.linux.it/pipermail/ltp/
-
-Questions and comments should be sent to the LTP mailing
-list at ltp@lists.linux.it. To subscribe, please go to
-http://lists.linux.it/listinfo/ltp.
-
-The source is also available via CVS.  See the web site for
-a web interface and check out instructions.
-
-8 Glossary
-
-Test IEEE/ANSI([footnote] Kit, Edward, Software Testing in the Real World:
-Improving the Process. P. 82. ACM Press, 1995.) :
- (i) An activity in which a system or component is executed
-under specified conditions, the results are observed or
-record, and an evaluation is made of some aspect of the
-system or component.
- (ii) A set of one or more test cases.
-
-Test Case A test assertion with a single result that
-  is being verified. This allows designations such as PASS
-  or FAIL to be applied to a single bit of functionality.
-   A single test case may be one of many test cases for
-  testing the complete functionality of a system.
-  IEEE/ANSI:
-  (i)A set of test inputs, execution conditions, and expected
-  results developed for a particular objective.
-  (ii) The smallest entity that is always executed as a unit,
-  from beginning to end.
-
-Test Driver A program that handles the execution of
-  test programs. It is responsible for starting the test
-  programs, capturing their output, and recording their
-  results. Ltp-pan is an example of a test driver.
-
-Test Framework A mechanism for organizing a group of
-  tests.  Frameworks may have complex or very simple API's,
-  drivers and result logging mechanisms. Examples of frameworks
-  are TETware and DejaGnu.
-
-Test Harness A Test harness is the mechanism that connects
-  a test program to a test framework.  It may be a specification
-  of exit codes,  or a set of libraries for formatting messages
-  and determining exit codes.  In TETware, the tet_result()
-  API is the test harness.
-
-Test Program A single invokable program.  A test program
-  can contain one or more test cases. The test harness's
-  API allows for reporting/analysis of the individual test
-  cases.
-
-Test Suite A collection of tests programs, assertions,
-  cases grouped together under a framework.
-
-Test Tag An identifier that corresponds to a command
-  line which runs a test.  The tag is a single word that
-  matches a test program with a set of command line arguments.
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index f1912dc..f0aa69a 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -153,7 +153,7 @@
 ~~~~~~~~~~~
 
 Code contributed to LTP should be licensed under GPLv2+ (GNU GPL version 2 or
-any later version).
+any later version). Use `SPDX-License-Identifier: GPL-2.0-or-later`.
 
 2. Writing a testcase
 ---------------------
@@ -319,7 +319,7 @@
 IMPORTANT: Only one of '.test' and '.test_all' can be set at a time.
 
 Each test has a default timeout set to 300s. The default timeout can be
-overriden by setting '.timeout' in the test structure or by calling
+overridden by setting '.timeout' in the test structure or by calling
 'tst_set_timeout()' in the test 'setup()'. There are a few testcases whose run
 time may vary arbitrarily, for these timeout can be disabled by setting it to
 -1.
@@ -347,6 +347,14 @@
 extra flag that is set right after successful initialization though. Consider,
 for example, test setup below.
 
+We also prefer cleaning up resources that would otherwise be released on the
+program exit. There are two main reasons for this decision. Resources such as
+file descriptors and mmaped memory could block umounting a block device in
+cases where the test library has mounted a filesystem for the test temporary
+directory. Not freeing allocated memory would upset static analysis and tools
+such as valgrind and produce false-positives when checking for leaks in the
+libc and other low level libraries.
+
 [source,c]
 -------------------------------------------------------------------------------
 static int fd0, fd1, mount_flag;
@@ -464,7 +472,7 @@
 void tst_set_timeout(unsigned int timeout);
 -------------------------------------------------------------------------------
 
-Allows for setting timeout per test iteration dymanically in the test setup(),
+Allows for setting timeout per test iteration dynamically in the test setup(),
 the timeout is specified in seconds. There are a few testcases whose runtime
 can vary arbitrarily, these can disable timeouts by setting it to -1.
 
@@ -485,7 +493,10 @@
 
 If '.needs_tmpdir' is set to '1' in the 'struct tst_test' unique test
 temporary is created and it's set as the test working directory. Tests *MUST
-NOT* create temporary files outside that directory.
+NOT* create temporary files outside that directory. The flag is not needed to
+be set when use these flags: '.all_filesystems', '.format_device', '.mntpoint',
+'.mount_device' '.needs_checkpoints', '.needs_device', '.resource_file'
+(these flags imply creating temporary directory).
 
 IMPORTANT: Close all file descriptors (that point to files in test temporary
            directory, even the unlinked ones) either in the 'test()' function
@@ -558,7 +569,7 @@
 int tst_parse_float(const char *str, float *val, float min, float max);
 -------------------------------------------------------------------------------
 
-Helpers for parsing the the strings returned in the 'struct tst_option'.
+Helpers for parsing the strings returned in the 'struct tst_option'.
 
 Both return zero on success and 'errno', mostly 'EINVAL' or 'ERANGE', on
 failure.
@@ -695,7 +706,7 @@
 children and exits with 'tst_brk(TBROK, ...)' if any of them returned
 a non zero exit code.
 
-.Using tst_res() from binaries started by exec()
+.Using 'tst_res()' from binaries started by 'exec()'
 [source,c]
 -------------------------------------------------------------------------------
 /* test.c */
@@ -736,7 +747,7 @@
 The 'tst_res()' function can be also used from binaries started by 'exec()',
 the parent test process has to set the '.child_needs_reinit' flag so that the
 library prepares for it and has to make sure the 'LTP_IPC_PATH' environment
-vairiable is passed down, then the very fist thing the program has to call in
+variable is passed down, then the very fist thing the program has to call in
 'main()' is 'tst_reinit()' that sets up the IPC.
 
 2.2.9 Fork() and Parent-child synchronization
@@ -818,8 +829,8 @@
 It's mostly used with state 'S' which means that process is sleeping in kernel
 for example in 'pause()' or any other blocking syscall.
 
-2.2.10 Signal handlers
-^^^^^^^^^^^^^^^^^^^^^^
+2.2.10 Signals and signal handlers
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 If you need to use signal handlers, keep the code short and simple. Don't
 forget that the signal handler is called asynchronously and can interrupt the
@@ -851,6 +862,14 @@
 'typedef' to 'int'). So the correct type for a flag that is changed from a
 signal handler is either 'volatile int' or 'volatile sig_atomic_t'.
 
+If a crash (e.g. triggered by signal SIGSEGV) is expected in testing, you
+can avoid creation of core files by calling tst_no_corefile() function.
+This takes effect for process (and its children) which invoked it, unless
+they subsequently modify RLIMIT_CORE.
+
+Note that LTP library will reap any processes that test didn't reap itself,
+and report any non-zero exit code as failure.
+
 2.2.11 Kernel Modules
 ^^^^^^^^^^^^^^^^^^^^^
 
@@ -858,7 +877,7 @@
 happily, LTP can build a kernel module and then insert it to the kernel on test
 start for you. See 'testcases/kernel/device-drivers/block' for details.
 
-2.2.11 Useful macros
+2.2.12 Useful macros
 ^^^^^^^^^^^^^^^^^^^^^
 
 [source,c]
@@ -876,7 +895,7 @@
 
 Aligns the x to be next multiple of a. The a must be power of 2.
 
-2.2.12 Filesystem type detection
+2.2.13 Filesystem type detection
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Some tests are known to fail on certain filesystems (you cannot swap on TMPFS,
@@ -911,7 +930,7 @@
 	}
 -------------------------------------------------------------------------------
 
-2.2.13 Thread-safety in the LTP library
+2.2.14 Thread-safety in the LTP library
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 It is safe to use library 'tst_res()' function in multi-threaded tests.
@@ -929,7 +948,7 @@
 The test-supplied cleanup function runs *concurrently* to the rest of the
 threads in a case that cleanup was entered from 'tst_brk()'. Subsequent
 threads entering 'tst_brk()' must be suspended or terminated at the start of
-the the user supplied cleanup function. It may be necessary to stop or exit
+the user supplied cleanup function. It may be necessary to stop or exit
 the rest of the threads before the test cleans up as well. For example threads
 that create new files should be stopped before temporary directory is be
 removed.
@@ -963,13 +982,13 @@
 -------------------------------------------------------------------------------
 
 
-2.2.14 Testing with a block device
+2.2.15 Testing with a block device
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Some tests needs a block device (inotify tests, syscall 'EROFS' failures,
 etc.). LTP library contains a code to prepare a testing device.
 
-If '.needs_device' flag in the 'struct tst_test' is set the the 'tst_device'
+If '.needs_device' flag in the 'struct tst_test' is set the 'tst_device'
 structure is initialized with a path to a test device and default filesystem
 to be used.
 
@@ -998,7 +1017,7 @@
 filesystem the 'tst_device.fs_type' is set to the currently tested fs type, if
 '.format_device' is set the device is formatted as well, if '.mount_device' is
 set it's mounted at '.mntpoint'. Also the test timeout is reset for each
-execution of the test fuction. This flag is expected to be used for filesystem
+execution of the test function. This flag is expected to be used for filesystem
 related syscalls that are at least partly implemented in the filesystem
 specific code e.g. fallocate().
 
@@ -1037,13 +1056,28 @@
 -------------------------------------------------------------------------------
 #include "tst_test.h"
 
+int tst_find_free_loopdev(const char *path, size_t path_len);
+-------------------------------------------------------------------------------
+
+This function finds a free loopdev and returns the free loopdev minor (-1 for no
+free loopdev). If path is non-NULL, it will be filled with free loopdev path.
+If you want to use a customized loop device, we can call tst_find_free_loopdev
+(NULL, 0) in tests to get a free minor number and then mknod.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include "tst_test.h"
+
 unsigned long tst_dev_bytes_written(const char *dev);
 -------------------------------------------------------------------------------
 
 This function reads test block device stat file (/sys/block/<device>/stat) and
-returns the bytes written since the last invocation of this function.
+returns the bytes written since the last invocation of this function. To avoid
+FS deferred IO metadata/cache interference, we suggest doing "syncfs" before the
+tst_dev_bytes_written first invocation. And an inline function named tst_dev_sync
+is created for that intention.
 
-2.2.15 Formatting a device with a filesystem
+2.2.16 Formatting a device with a filesystem
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 [source,c]
@@ -1070,7 +1104,7 @@
 will be passed after device name. e.g: +mkfs -t ext4 -b 1024 /dev/sda1 102400+
 in this case.
 
-2.2.16 Verifying a filesystem's free space
+2.2.17 Verifying a filesystem's free space
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Some tests have size requirements for the filesystem's free space. If these
@@ -1095,7 +1129,7 @@
 filesystem, which '"/tmp/testfile"' is in, has 64MB free space at least, and 0
 if not.
 
-2.2.17 Files, directories and fs limits
+2.2.18 Files, directories and fs limits
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Some tests need to know the maximum count of links to a regular file or
@@ -1168,9 +1202,9 @@
 int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount);
 -------------------------------------------------------------------------------
 
-Creates/ovewrites a file with specified pattern using file path.
+Creates/overwrites a file with specified pattern using file path.
 
-2.2.18 Getting an unused PID number
+2.2.19 Getting an unused PID number
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Some tests require a 'PID', which is not used by the OS (does not belong to
@@ -1275,7 +1309,7 @@
 last timer stop in several formats and units.
 
 The 'tst_timer_expired_ms()' function checks if the timer started by
-'tst_timer_start()' has been running longer than ms miliseconds. The function
+'tst_timer_start()' has been running longer than ms milliseconds. The function
 returns non-zero if timer has expired and zero otherwise.
 
 IMPORTANT: The timer functions use 'clock_gettime()' internally which needs to
@@ -1305,7 +1339,7 @@
 	...
 }
 
-sturct tst_test test = {
+struct tst_test test = {
 	...
 	.setup = setup,
 	.test_all = run,
@@ -1507,15 +1541,17 @@
 file is saved and restored.
 
 Pathnames can be optionally prefixed to specify how strictly (during
-'store') are handled files that don't exist:
-  (no prefix) - test ends with TCONF
-  '?'         - test prints info message and continues
-  '!'         - test ends with TBROK
+'store') are handled errors:
+
+* (no prefix) - test ends with TCONF, if file doesn't exist
+* '?'         - test prints info message and continues,
+                if file doesn't exist or open/read fails
+* '!'         - test ends with TBROK, if file doesn't exist
 
 'restore' is always strict and will TWARN if it encounters any error.
 
-Example:
-
+[source,c]
+-------------------------------------------------------------------------------
 static const char *save_restore[] = {
 	"/proc/sys/kernel/core_pattern",
 	NULL,
@@ -1531,6 +1567,7 @@
 	.setup = setup,
 	.save_restore = save_restore,
 };
+-------------------------------------------------------------------------------
 
 2.2.28 Parsing kernel .config
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1594,7 +1631,7 @@
 	...
 }
 
-sturct tst_test test = {
+struct tst_test test = {
 	...
 	.setup = setup,
 	.test_all = run,
@@ -1603,7 +1640,7 @@
 };
 -------------------------------------------------------------------------------
 
-2.2.29 Testing similar syscalls in one test
+2.2.30 Testing similar syscalls in one test
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 In some cases kernel has several very similar syscalls that do either the same
@@ -1659,7 +1696,7 @@
 	}
 }
 
-sturct tst_test test = {
+struct tst_test test = {
 	...
 	.setup = setup,
 	.test_all = run,
@@ -1668,6 +1705,239 @@
 };
 -------------------------------------------------------------------------------
 
+2.2.31 Guarded buffers
+^^^^^^^^^^^^^^^^^^^^^^
+
+The test library supports guarded buffers, which are buffers allocated so
+that:
+
+* The end of the buffer is followed by a PROT_NONE page
+
+* The remainder of the page before the buffer is filled with random canary
+  data
+
+Which means that the any access after the buffer will yield a Segmentation
+fault or EFAULT depending on if the access happened in userspace or the kernel
+respectively. The canary before the buffer will also catch any write access
+outside of the buffer.
+
+The purpose of the patch is to catch off-by-one bugs which happens when
+buffers and structures are passed to syscalls. New tests should allocate
+guarded buffers for all data passed to the tested syscall which are passed by
+a pointer.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include "tst_test.h"
+
+static struct foo *foo_ptr;
+static struct iovec *iov;
+static void *buf_ptr;
+static char *id;
+...
+
+static void run(void)
+{
+	...
+
+	foo_ptr->bar = 1;
+	foo_ptr->buf = buf_ptr;
+
+	...
+}
+
+static void setup(void)
+{
+	...
+
+	id = tst_strdup(string);
+
+	...
+}
+
+static struct tst_test test = {
+	...
+	.bufs = (struct tst_buffers []) {
+		{&foo_ptr, .size = sizeof(*foo_ptr)},
+		{&buf_ptr, .size = BUF_SIZE},
+		{&iov, .iov_sizes = (int[]){128, 32, -1},
+		{}
+	}
+};
+-------------------------------------------------------------------------------
+
+Guarded buffers can be allocated on runtime in a test setup() by a
+'tst_alloc()' or by 'tst_strdup()' as well as by filling up the .bufs array in
+the tst_test structure.
+
+So far the tst_test structure supports allocating either a plain buffer by
+setting up the size or struct iovec, which is allocated recursively including
+the individual buffers as described by an '-1' terminated array of buffer
+sizes.
+
+2.2.32 Adding and removing capabilities
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Some tests may require the presence or absence of particular
+capabilities. Using the API provided by 'tst_capability.h' the test author can
+try to ensure that some capabilities are either present or absent during the
+test.
+
+For example; below we try to create a raw socket, which requires
+CAP_NET_ADMIN. During setup we should be able to do it, then during run it
+should be impossible. The LTP capability library will check before setup that
+we have this capability, then after setup it will drop it.
+
+[source,c]
+--------------------------------------------------------------------------------
+#include "tst_test.h"
+#include "tst_capability.h"
+#include "tst_safe_net.h"
+
+#include "lapi/socket.h"
+
+static void run(void)
+{
+	TEST(socket(AF_INET, SOCK_RAW, 1));
+	if (TST_RET > -1) {
+		tst_res(TFAIL, "Created raw socket");
+	} else if (TST_ERR != EPERM) {
+		tst_res(TBROK | TTERRNO,
+			"Failed to create socket for wrong reason");
+	} else {
+		tst_res(TPASS | TTERRNO, "Didn't create raw socket");
+	}
+}
+
+static void setup(void)
+{
+	TEST(socket(AF_INET, SOCK_RAW, 1));
+	if (TST_RET < 0)
+		tst_brk(TCONF | TTERRNO, "We don't have CAP_NET_RAW to begin with");
+
+	SAFE_CLOSE(TST_RET);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_REQ, CAP_NET_RAW),
+		TST_CAP(TST_CAP_DROP, CAP_NET_RAW),
+		{}
+	},
+};
+--------------------------------------------------------------------------------
+
+Look at the test struct at the bottom. We have filled in the 'caps' field with
+a NULL terminated array containing two 'tst_cap' structs. 'TST_CAP_REQ'
+actions are executed before setup and 'TST_CAP_DROP' are executed after
+setup. This means it is possible to both request and drop a capability.
+
+[source,c]
+--------------------------------------------------------------------------------
+static struct tst_test test = {
+	.test_all = run,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_REQ, CAP_NET_RAW),
+		TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
+		{}
+	},
+};
+--------------------------------------------------------------------------------
+
+Here we request 'CAP_NET_RAW', but drop 'CAP_SYS_ADMIN'. If the capability is
+in the permitted set, but not the effective set, the library will try to
+permit it. If it is not in the permitted set, then it will fail with 'TCONF'.
+
+This API does not require 'libcap' to be installed. However it has limited
+features relative to 'libcap'. It only tries to add or remove capabilities
+from the effective set. This means that tests which need to spawn child
+processes may have difficulties ensuring the correct capabilities are
+available to the children (see the capabilities (7) manual pages).
+
+However a lot of problems can be solved by using 'tst_cap_action(struct
+tst_cap  *cap)' directly which can be called at any time. This also helps if
+you wish to drop a capability at the begining of setup.
+
+2.2.33 Reproducing race-conditions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If a bug is caused by two tasks in the kernel racing and you wish to create a
+regression test (or bug-fix validation test) then the 'tst_fuzzy_sync.h'
+library should be used.
+
+It allows you to specify, in your code, two race windows. One window in each
+thread's loop (triggering a race usually requires many iterations). These
+windows show fuzzy-sync where the race can happen. They don't need to be
+exact, hence the 'fuzzy' part. If the race condition is not immediately
+triggered then the library will begin experimenting with different timings.
+
+[source,c]
+--------------------------------------------------------------------------------
+#include "tst_fuzzy_sync.h"
+
+static struct tst_fzsync_pair fzsync_pair;
+
+static void setup(void)
+{
+        tst_fzsync_pair_init(&fzsync_pair);
+}
+
+static void cleanup(void)
+{
+	tst_fzsync_pair_cleanup(&fzsync_pair);
+}
+
+static void *thread_b(void *arg)
+{
+	while (tst_fzsync_run_b(&fzsync_pair)) {
+
+		tst_fzsync_start_race_b(&fzsync_pair);
+
+                /* This is the race window for thread B */
+
+                tst_fzsync_end_race_b(&fzsync_pair);
+	}
+
+	return arg;
+}
+
+static void thread_a(void)
+{
+	tst_fzsync_pair_reset(&fzsync_pair, thread_b);
+
+        while (tst_fzsync_run_a(&fzsync_pair)) {
+
+		tst_fzsync_start_race_a(&fzsync_pair);
+
+		/* This is the race window for thread A */
+
+                tst_fzsync_end_race_a(&fzsync_pair);
+	}
+}
+
+static struct tst_test test = {
+	.test_all = thread_a,
+	.setup = setup,
+	.cleanup = cleanup,
+};
+--------------------------------------------------------------------------------
+
+Above is a minimal template for a test using fuzzy-sync. In a simple case, you
+just need to put the bits you want to race inbetween 'start_race' and
+'end_race'. Meanwhile, any setup you need to do per-iteration goes outside the
+windows.
+
+Fuzzy sync synchronises 'run_a' and 'run_b', which act as barriers, so that
+neither thread can progress until the other has caught up with it. There is
+also the 'pair_wait' function which can be used to add barriers in other
+locations. Of course 'start/end_race_a/b' are also a barriers.
+
+The library decides how long the test should run for based on the timeout
+specified by the user plus some other heuristics.
+
+For full documentation see the comments in 'include/tst_fuzzy_sync.h'.
 
 2.3 Writing a testcase in shell
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1686,9 +1956,8 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
-# This is a basic test for true shell buildin
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
+# This is a basic test for true shell builtin
 
 TST_TESTFUNC=do_test
 . tst_test.sh
@@ -1734,9 +2003,8 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Example test with tests in separate functions
-#
 
 TST_TESTFUNC=test
 TST_CNT=2
@@ -1765,9 +2033,8 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Example test with tests in a single function
-#
 
 TST_TESTFUNC=do_test
 TST_CNT=2
@@ -1794,10 +2061,9 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Example test with tests in a single function, using $TST_TEST_DATA and
 # $TST_TEST_DATA_IFS
-#
 
 TST_TESTFUNC=do_test
 TST_TEST_DATA="foo:bar:d dd"
@@ -1822,9 +2088,8 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Example test with tests in a single function, using $TST_TEST_DATA and $TST_CNT
-#
 
 TST_TESTFUNC=do_test
 TST_CNT=2
@@ -1850,8 +2115,8 @@
 '$TST_TEST_DATA' can be used with '$TST_CNT'. If '$TST_TEST_DATA_IFS' not specified,
 space as default value is used. Of course, it's possible to use separate functions.
 
-2.3.2 Library variables
-^^^^^^^^^^^^^^^^^^^^^^^
+2.3.2 Library environment variables for shell
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Similarily to the C library various checks and preparations can be requested
 simply by setting right '$TST_NEEDS_FOO'.
@@ -1863,12 +2128,20 @@
 | 'TST_NEEDS_TMPDIR' | Create test temporary directory and cd into it.
 | 'TST_NEEDS_DEVICE' | Prepare test temporary device, the path to testing
                        device is stored in '$TST_DEVICE' variable.
+                       The option implies 'TST_NEEDS_TMPDIR'.
 | 'TST_NEEDS_CMDS'   | String with command names that has to be present for
                        the test (see below).
 | 'TST_NEEDS_MODULE' | Test module name needed for the test (see below).
 | 'TST_NEEDS_DRIVERS'| Checks kernel drivers support for the test.
+| 'TST_TIMEOUT'      | Maximum timeout set for the test in sec. Must be int >= 1,
+                       or -1 (special value to disable timeout), default is 300.
+                       Variable is meant be set in tests, not by user.
+                       It's equivalent of `tst_test.timeout` in C.
 |=============================================================================
 
+NOTE: Network tests (see testcases/network/README.md) use additional variables
+in 'tst_net.sh'.
+
 Checking for presence of commands
 +++++++++++++++++++++++++++++++++
 
@@ -1886,9 +2159,9 @@
 -------------------------------------------------------------------------------
 
 Setting '$TST_NEEDS_CMDS' to a string listing required commands will check for
-existence each of them and exits the test with 'TCONF' on first misssing.
+existence each of them and exits the test with 'TCONF' on first missing.
 
-Alternatively the 'tst_test_cmds()' function can be used to do the same on
+Alternatively the 'tst_require_cmds()' function can be used to do the same on
 runtime, since sometimes we need to the check at runtime too.
 
 'tst_check_cmds()' can be used for requirements just for a particular test
@@ -1912,7 +2185,7 @@
 +++++++++++++++++++++++
 
 The LTP build system can build kernel modules as well, setting
-'$TST_NEEDS_MODULE' to module name will cause to library to look for the
+'$TST_NEEDS_MODULE' to module name will cause the library to look for the
 module in a few possible paths.
 
 If module was found the path to it will be stored into '$TST_MODPATH'
@@ -1924,9 +2197,8 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Optional test command line parameters
-#
 
 TST_OPTS="af:"
 TST_USAGE=usage
@@ -1972,15 +2244,14 @@
 The function that prints the usage is passed in '$TST_USAGE', the help for
 the options implemented in the library is appended when usage is printed.
 
-Lastly the fucntion '$PARSE_ARGS' is called with the option name in the '$1'
+Lastly the function '$PARSE_ARGS' is called with the option name in the '$1'
 and, if option has argument, its value in the '$2'.
 
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Optional test positional parameters
-#
 
 TST_POS_ARGS=3
 TST_USAGE=usage
@@ -2012,7 +2283,7 @@
 '$TST_POS_ARGS' variable. If you do, these will be available as they were
 passed directly to the script in '$1', '$2', ..., '$n'.
 
-2.3.4 Usefull library functions
+2.3.4 Useful library functions
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Retrieving configuration variables
@@ -2049,7 +2320,8 @@
 Sometimes LTP test needs retrying a function for many times to get success.
 This achievement makes that possible via keeping it retrying if the return
 value of the function is NOT as we expected. After exceeding a limited time,
-test will break from the retries immediately.
+test will break from the retries immediately. The time limit is multiplied
+with LTP_TIMEOUT_MUL.
 
 [source,c]
 -------------------------------------------------------------------------------
@@ -2078,6 +2350,16 @@
 tst_is_int "$FOO"
 -------------------------------------------------------------------------------
 
+Checking for integers and floating point numbers
+++++++++++++++++++++++++++++++++++++++++++++++++
+
+[source,sh]
+-------------------------------------------------------------------------------
+# returns zero if passed an integer or floating point number parameter,
+# non-zero otherwise
+tst_is_num "$FOO"
+-------------------------------------------------------------------------------
+
 Obtaining random numbers
 ++++++++++++++++++++++++
 
@@ -2115,8 +2397,8 @@
 '$TST_MNT_PARAMS'. The '$TST_MNTPOINT' directory is created if it didn't
 exist prior to the function call.
 
-If the path passed to the 'tst_umount' is not mounted (present in '/proc/mounts')
-it's noop.
+If the path passed (optional, defaults to '$TST_DEVICE') to the 'tst_umount' is
+not mounted (present in '/proc/mounts') it's noop.
 Otherwise it retries to umount the filesystem a few times on a failure, which
 is a workaround since there are a daemons dumb enough to probe all newly
 mounted filesystems, which prevents them from umounting shortly after they
@@ -2168,8 +2450,8 @@
 passed to the 'ROD' function as parameters and the 'ROD' function contains
 code to split '$@' on '>' and redirects the output to the file.
 
-EXPECT_PASS and EXPECT_FAIL
-+++++++++++++++++++++++++++
+EXPECT_PASS{,_BRK} and EXPECT_FAIL{,_BRK}
++++++++++++++++++++++++++++++++++++++++++
 
 [source,sh]
 -------------------------------------------------------------------------------
@@ -2183,6 +2465,17 @@
 Output redirection rules are the same as for the 'ROD' function. In addition
 to that, 'EXPECT_FAIL' always redirects the command's stderr to '/dev/null'.
 
+There are also 'EXPECT_PASS_BRK' and 'EXPECT_FAIL_BRK', which works the same way
+except breaking a test when unexpected action happen.
+
+It's possible to detect whether expected value happened:
+[source,sh]
+-------------------------------------------------------------------------------
+if ! EXPECT_PASS command arg1 2\> /dev/null; then
+	continue
+fi
+-------------------------------------------------------------------------------
+
 tst_kvcmp
 +++++++++
 
@@ -2294,9 +2587,9 @@
 [source,sh]
 -------------------------------------------------------------------------------
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Cron daemon restart example
-#
+
 TCID=cron01
 TST_COUNT=1
 . test.sh
@@ -2315,7 +2608,7 @@
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The shell library provides an implementation of the checkpoint interface
-compatible with the C version. All TST_CHECKPOINT_* functions are available.
+compatible with the C version. All 'TST_CHECKPOINT_*' functions are available.
 
 In order to initialize checkpoints '$TST_NEEDS_CHECKPOINTS' must be set to '1'
 before the inclusion of 'test.sh':
@@ -2330,7 +2623,7 @@
 
 Since both the implementations are compatible, it's also possible to start
 a child binary process from a shell test and synchronize with it. This process
-must have checkpoints initialized by calling tst_reinit()'.
+must have checkpoints initialized by calling 'tst_reinit()'.
 
 3. Common problems
 ------------------
@@ -2346,7 +2639,7 @@
 not* the mode the file is created with. The mode depends on current 'umask()'
 settings which may clear some of the bits. If your test depends on specific
 file permissions you need either to change umask to 0 or 'chmod()' the file
-afterwards or use SAFE_TOUCH() that does the 'chmod()' for you.
+afterwards or use 'SAFE_TOUCH()' that does the 'chmod()' for you.
 
 3.2 access()
 ~~~~~~~~~~~
diff --git a/doc/user-guide.txt b/doc/user-guide.txt
new file mode 100644
index 0000000..13865bc
--- /dev/null
+++ b/doc/user-guide.txt
@@ -0,0 +1,30 @@
+LTP User Guidelines
+===================
+
+For compiling and installing and running the tests see `README.md`.
+For running LTP network tests see `testcases/network/README.md`.
+
+1. Library environment variables
+--------------------------------
+
+|==============================================================================
+| 'KCONFIG_PATH'        | The path to the kernel config file, (if not set, it tries
+                          the usual paths '/boot/config-RELEASE' or '/proc/config.gz').
+| 'LTPROOT'             | Prefix for installed LTP, the default is '/opt/ltp'.
+| 'LTP_COLORIZE_OUTPUT' | Force colorized output behaviour. 'y' or '1': always colorize
+                          'n' or '0': never colorize.
+| 'LTP_TIMEOUT_MUL'     | Multiply timeout, must be number >= 1 (> 1 is useful for
+                          slow machines to avoid unexpected timeout).
+                          Variable is also used in shell tests, but ceiled to int.
+| 'PATH'                | It's required to addjust path:
+                          `PATH="$PATH:$LTPROOT/testcases/bin"`
+| 'TMPDIR'              | Base directory for template directory, which is required by C tests
+                          `tst_test->needs_tmpdir=1` (or others) or shell 'TST_NEEDS_TMPDIR=1').
+| 'TST_NO_CLEANUP'      | Disable running test cleanup (defined in 'TST_CLEANUP').
+|==============================================================================
+
+2. Colorized output
+-------------------
+
+By default LTP colorizes it's output unless using pipe or redirect to file.
+It's possible to force behaviour with 'LTP_COLORIZE_OUTPUT' environment variable.
diff --git a/gen.bp b/gen.bp
index aa52174..a338480 100644
--- a/gen.bp
+++ b/gen.bp
@@ -109,9 +109,12 @@
         "lib/tlibio.c",
         "lib/tst_af_alg.c",
         "lib/tst_ansi_color.c",
+        "lib/tst_buffers.c",
+        "lib/tst_capability.c",
         "lib/tst_checkpoint.c",
         "lib/tst_checksum.c",
         "lib/tst_clocks.c",
+        "lib/tst_coredump.c",
         "lib/tst_cpu.c",
         "lib/tst_crypto.c",
         "lib/tst_device.c",
@@ -120,8 +123,10 @@
         "lib/tst_fill_fs.c",
         "lib/tst_fs_has_free.c",
         "lib/tst_fs_link_count.c",
+        "lib/tst_fs_setup.c",
         "lib/tst_fs_type.c",
         "lib/tst_get_bad_addr.c",
+        "lib/tst_ioctl.c",
         "lib/tst_kconfig.c",
         "lib/tst_kernel.c",
         "lib/tst_kvercmp.c",
@@ -164,6 +169,18 @@
 }
 
 cc_library_static {
+    name: "libltp_ltpuinput",
+    defaults: ["ltp_defaults"],
+    local_include_dirs: [
+        "include",
+        "include/old",
+    ],
+    srcs: [
+        "libs/libltpuinput/tst_uinput.c",
+    ],
+}
+
+cc_library_static {
     name: "libltp_mem",
     defaults: ["ltp_defaults"],
     local_include_dirs: [
@@ -205,6 +222,15 @@
 }
 
 cc_test {
+    name: "ltp_accept02",
+    stem: "accept02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/accept/accept02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_accept4_01",
     stem: "accept4_01",
     defaults: ["ltp_test_defaults"],
@@ -259,6 +285,24 @@
 }
 
 cc_test {
+    name: "ltp_acct02",
+    stem: "acct02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/acct/acct02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_acct02_helper",
+    stem: "acct02_helper",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/acct/acct02_helper.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_acl1",
     stem: "acl1",
     defaults: ["ltp_test_defaults"],
@@ -506,15 +550,6 @@
 }
 
 cc_test {
-    name: "ltp_asyncio02",
-    stem: "asyncio02",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/asyncio/asyncio02.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_atof01",
     stem: "atof01",
     defaults: ["ltp_test_defaults"],
@@ -533,15 +568,6 @@
 }
 
 cc_test {
-    name: "ltp_bdflush01",
-    stem: "bdflush01",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/bdflush/bdflush01.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_bind01",
     stem: "bind01",
     defaults: ["ltp_test_defaults"],
@@ -578,6 +604,46 @@
 }
 
 cc_test {
+    name: "ltp_bpf_map01",
+    stem: "bpf_map01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/bpf/bpf_map01.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_bpf_prog01",
+    stem: "bpf_prog01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/bpf/bpf_prog01.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_bpf_prog02",
+    stem: "bpf_prog02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/bpf/bpf_prog02.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_bpf_prog03",
+    stem: "bpf_prog03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/bpf/bpf_prog03.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_brk01",
     stem: "brk01",
     defaults: ["ltp_test_defaults"],
@@ -687,6 +753,24 @@
 }
 
 cc_test {
+    name: "ltp_capset03",
+    stem: "capset03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/capset/capset03.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_capset04",
+    stem: "capset04",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/capset/capset04.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_cgroup_fj_proc",
     stem: "cgroup_fj_proc",
     defaults: ["ltp_test_defaults"],
@@ -1225,6 +1309,24 @@
 }
 
 cc_test {
+    name: "ltp_copy_file_range02",
+    stem: "copy_file_range02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/copy_file_range/copy_file_range02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_copy_file_range03",
+    stem: "copy_file_range03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/copy_file_range/copy_file_range03.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_cpuacct_task",
     stem: "cpuacct_task",
     defaults: ["ltp_test_defaults"],
@@ -1619,24 +1721,6 @@
 }
 
 cc_test {
-    name: "ltp_create_long_dirs",
-    stem: "create_long_dirs",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_long_dirs.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_create_short_dirs",
-    stem: "create_short_dirs",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_short_dirs.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_crypto_user01",
     stem: "crypto_user01",
     defaults: ["ltp_test_defaults"],
@@ -1647,6 +1731,16 @@
 }
 
 cc_test {
+    name: "ltp_crypto_user02",
+    stem: "crypto_user02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/crypto/crypto_user02.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_cve-2014-0196",
     stem: "cve-2014-0196",
     defaults: ["ltp_test_defaults"],
@@ -2540,24 +2634,6 @@
 }
 
 cc_test {
-    name: "ltp_ext4_file_time",
-    stem: "ext4_file_time",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_file_time.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_ext4_test_inode_version",
-    stem: "ext4_test_inode_version",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_test_inode_version.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_f1",
     stem: "f1",
     defaults: ["ltp_test_defaults"],
@@ -2744,6 +2820,33 @@
 }
 
 cc_test {
+    name: "ltp_fanotify13",
+    stem: "fanotify13",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/fanotify/fanotify13.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_fanotify14",
+    stem: "fanotify14",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/fanotify/fanotify14.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_fanotify15",
+    stem: "fanotify15",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/fanotify/fanotify15.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_fanotify_child",
     stem: "fanotify_child",
     defaults: ["ltp_test_defaults"],
@@ -4557,36 +4660,6 @@
 }
 
 cc_test {
-    name: "ltp_fstat01",
-    stem: "fstat01",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/fstat/fstat01.c"],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/fstat",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_fstat01_64",
-    stem: "fstat01_64",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/fstat/fstat01.c"],
-    cflags: [
-        "-D_FILE_OFFSET_BITS=64",
-        "-DTST_USE_NEWER64_SYSCALL=1",
-    ],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/fstat",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_fstat02",
     stem: "fstat02",
     defaults: ["ltp_test_defaults"],
@@ -4647,36 +4720,6 @@
 }
 
 cc_test {
-    name: "ltp_fstat05",
-    stem: "fstat05",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/fstat/fstat05.c"],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/fstat",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_fstat05_64",
-    stem: "fstat05_64",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/fstat/fstat05.c"],
-    cflags: [
-        "-D_FILE_OFFSET_BITS=64",
-        "-DTST_USE_NEWER64_SYSCALL=1",
-    ],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/fstat",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_fstatat01",
     stem: "fstatat01",
     defaults: ["ltp_test_defaults"],
@@ -4924,36 +4967,6 @@
 }
 
 cc_test {
-    name: "ltp_ftruncate02",
-    stem: "ftruncate02",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate02.c"],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/ftruncate",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_ftruncate02_64",
-    stem: "ftruncate02_64",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/ftruncate/ftruncate02.c"],
-    cflags: [
-        "-D_FILE_OFFSET_BITS=64",
-        "-DTST_USE_NEWER64_SYSCALL=1",
-    ],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/utils",
-        "testcases/kernel/syscalls/ftruncate",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_ftruncate03",
     stem: "ftruncate03",
     defaults: ["ltp_test_defaults"],
@@ -5014,6 +5027,24 @@
 }
 
 cc_test {
+    name: "ltp_futex_cmp_requeue01",
+    stem: "futex_cmp_requeue01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/futex/futex_cmp_requeue01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_futex_cmp_requeue02",
+    stem: "futex_cmp_requeue02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/futex/futex_cmp_requeue02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_futex_wait01",
     stem: "futex_wait01",
     defaults: ["ltp_test_defaults"],
@@ -6881,6 +6912,42 @@
 }
 
 cc_test {
+    name: "ltp_ioprio_get01",
+    stem: "ioprio_get01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/ioprio/ioprio_get01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_ioprio_set01",
+    stem: "ioprio_set01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/ioprio/ioprio_set01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_ioprio_set02",
+    stem: "ioprio_set02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/ioprio/ioprio_set02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_ioprio_set03",
+    stem: "ioprio_set03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/ioprio/ioprio_set03.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_kcmp01",
     stem: "kcmp01",
     defaults: ["ltp_test_defaults"],
@@ -7322,6 +7389,15 @@
 }
 
 cc_test {
+    name: "ltp_leapsec01",
+    stem: "leapsec01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/clock_gettime/leapsec01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_lftest",
     stem: "lftest",
     defaults: ["ltp_test_defaults"],
@@ -7641,36 +7717,6 @@
 }
 
 cc_test {
-    name: "ltp_lstat03",
-    stem: "lstat03",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/lstat/lstat03.c"],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/lstat",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_lstat03_64",
-    stem: "lstat03_64",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/lstat/lstat03.c"],
-    cflags: [
-        "-D_FILE_OFFSET_BITS=64",
-        "-DTST_USE_NEWER64_SYSCALL=1",
-    ],
-    local_include_dirs: [
-        "testcases/kernel/syscalls/lstat",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_ltp-diorh",
     stem: "ltp-diorh",
     defaults: ["ltp_test_defaults"],
@@ -7807,6 +7853,58 @@
     static_libs: [
         "libltp_kerntest",
         "libltp_ltp",
+        "libltp_ltpnuma",
+    ],
+}
+
+cc_test {
+    name: "ltp_mbind02",
+    stem: "mbind02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/mbind/mbind02.c"],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/utils",
+        "testcases/kernel/include",
+        "include/old",
+    ],
+    static_libs: [
+        "libltp_kerntest",
+        "libltp_ltp",
+        "libltp_ltpnuma",
+    ],
+}
+
+cc_test {
+    name: "ltp_mbind03",
+    stem: "mbind03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/mbind/mbind03.c"],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/utils",
+        "testcases/kernel/include",
+        "include/old",
+    ],
+    static_libs: [
+        "libltp_kerntest",
+        "libltp_ltp",
+        "libltp_ltpnuma",
+    ],
+}
+
+cc_test {
+    name: "ltp_mbind04",
+    stem: "mbind04",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/mbind/mbind04.c"],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/utils",
+        "testcases/kernel/include",
+        "include/old",
+    ],
+    static_libs: [
+        "libltp_kerntest",
+        "libltp_ltp",
+        "libltp_ltpnuma",
     ],
 }
 
@@ -8932,25 +9030,6 @@
 }
 
 cc_test {
-    name: "ltp_move_pages08",
-    stem: "move_pages08",
-    defaults: ["ltp_test_defaults"],
-    srcs: [
-        "testcases/kernel/syscalls/move_pages/move_pages_support.c",
-        "testcases/kernel/syscalls/move_pages/move_pages08.c",
-    ],
-    local_include_dirs: [
-        "testcases/kernel/include",
-        "testcases/kernel/syscalls/utils",
-        "include/old",
-    ],
-    static_libs: [
-        "libltp_kerntest",
-        "libltp_ltp",
-    ],
-}
-
-cc_test {
     name: "ltp_move_pages09",
     stem: "move_pages09",
     defaults: ["ltp_test_defaults"],
@@ -9240,15 +9319,6 @@
 }
 
 cc_test {
-    name: "ltp_nanosleep03",
-    stem: "nanosleep03",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/nanosleep/nanosleep03.c"],
-    local_include_dirs: ["include/old"],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
     name: "ltp_nanosleep04",
     stem: "nanosleep04",
     defaults: ["ltp_test_defaults"],
@@ -9938,6 +10008,33 @@
 }
 
 cc_test {
+    name: "ltp_pidfd_send_signal01",
+    stem: "pidfd_send_signal01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_pidfd_send_signal02",
+    stem: "pidfd_send_signal02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_pidfd_send_signal03",
+    stem: "pidfd_send_signal03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_pids_task1",
     stem: "pids_task1",
     defaults: ["ltp_test_defaults"],
@@ -10088,6 +10185,15 @@
 }
 
 cc_test {
+    name: "ltp_pkey01",
+    stem: "pkey01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/pkeys/pkey01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_pm_get_sched_values",
     stem: "pm_get_sched_values",
     defaults: ["ltp_test_defaults"],
@@ -10271,6 +10377,69 @@
 }
 
 cc_test {
+    name: "ltp_prctl04",
+    stem: "prctl04",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl04.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_prctl05",
+    stem: "prctl05",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl05.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_prctl06",
+    stem: "prctl06",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl06.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_prctl06_execve",
+    stem: "prctl06_execve",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl06_execve.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_prctl07",
+    stem: "prctl07",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl07.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_prctl08",
+    stem: "prctl08",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl08.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_prctl09",
+    stem: "prctl09",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/prctl/prctl09.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_pread01",
     stem: "pread01",
     defaults: ["ltp_test_defaults"],
@@ -10511,6 +10680,36 @@
 }
 
 cc_test {
+    name: "ltp_preadv203",
+    stem: "preadv203",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/preadv2/preadv203.c"],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/preadv2",
+        "testcases/kernel/syscalls/utils",
+        "include/old",
+    ],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_preadv203_64",
+    stem: "preadv203_64",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/preadv2/preadv203.c"],
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-DTST_USE_NEWER64_SYSCALL=1",
+    ],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/utils",
+        "include/old",
+        "testcases/kernel/syscalls/preadv2",
+    ],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_print_caps",
     stem: "print_caps",
     defaults: ["ltp_test_defaults"],
@@ -11099,6 +11298,33 @@
 }
 
 cc_test {
+    name: "ltp_quotactl04",
+    stem: "quotactl04",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/quotactl/quotactl04.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_quotactl05",
+    stem: "quotactl05",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/quotactl/quotactl05.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_quotactl06",
+    stem: "quotactl06",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/quotactl/quotactl06.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_random-access",
     stem: "random-access",
     defaults: ["ltp_test_defaults"],
@@ -13005,7 +13231,8 @@
     name: "ltp_sethostname01",
     stem: "sethostname01",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/sethostname/sethostname01.c"],
+    srcs: ["testcases/kernel/syscalls/setdomainname/setdomainname01.c"],
+    cflags: ["-DTEST_SETHOSTNAME"],
     local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
@@ -13014,7 +13241,8 @@
     name: "ltp_sethostname02",
     stem: "sethostname02",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/sethostname/sethostname02.c"],
+    srcs: ["testcases/kernel/syscalls/setdomainname/setdomainname02.c"],
+    cflags: ["-DTEST_SETHOSTNAME"],
     local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
@@ -13023,7 +13251,8 @@
     name: "ltp_sethostname03",
     stem: "sethostname03",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/sethostname/sethostname03.c"],
+    srcs: ["testcases/kernel/syscalls/setdomainname/setdomainname03.c"],
+    cflags: ["-DTEST_SETHOSTNAME"],
     local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
@@ -13768,6 +13997,15 @@
 }
 
 cc_test {
+    name: "ltp_setsockopt04",
+    stem: "setsockopt04",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/setsockopt/setsockopt04.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_settimeofday01",
     stem: "settimeofday01",
     defaults: ["ltp_test_defaults"],
@@ -14146,6 +14384,16 @@
 }
 
 cc_test {
+    name: "ltp_snd_timer01",
+    stem: "snd_timer01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/sound/snd_timer01.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_socket01",
     stem: "socket01",
     defaults: ["ltp_test_defaults"],
@@ -14333,6 +14581,36 @@
 }
 
 cc_test {
+    name: "ltp_stat02",
+    stem: "stat02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/stat/stat02.c"],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/stat",
+        "testcases/kernel/syscalls/utils",
+        "include/old",
+    ],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_stat02_64",
+    stem: "stat02_64",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/stat/stat02.c"],
+    cflags: [
+        "-D_FILE_OFFSET_BITS=64",
+        "-DTST_USE_NEWER64_SYSCALL=1",
+    ],
+    local_include_dirs: [
+        "testcases/kernel/syscalls/utils",
+        "testcases/kernel/syscalls/stat",
+        "include/old",
+    ],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_stat03",
     stem: "stat03",
     defaults: ["ltp_test_defaults"],
@@ -14640,8 +14918,14 @@
     name: "ltp_swapoff01",
     stem: "swapoff01",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/swapoff/swapoff01.c"],
-    local_include_dirs: ["include/old"],
+    srcs: [
+        "testcases/kernel/syscalls/swapon/libswapon.c",
+        "testcases/kernel/syscalls/swapoff/swapoff01.c",
+    ],
+    local_include_dirs: [
+        "include/old",
+        "testcases/kernel/syscalls/swapon",
+    ],
     static_libs: ["libltp_ltp"],
 }
 
@@ -14649,8 +14933,14 @@
     name: "ltp_swapoff02",
     stem: "swapoff02",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/syscalls/swapoff/swapoff02.c"],
-    local_include_dirs: ["include/old"],
+    srcs: [
+        "testcases/kernel/syscalls/swapoff/swapoff02.c",
+        "testcases/kernel/syscalls/swapon/libswapon.c",
+    ],
+    local_include_dirs: [
+        "include/old",
+        "testcases/kernel/syscalls/swapon",
+    ],
     static_libs: ["libltp_ltp"],
 }
 
@@ -14662,7 +14952,10 @@
         "testcases/kernel/syscalls/swapon/swapon01.c",
         "testcases/kernel/syscalls/swapon/libswapon.c",
     ],
-    local_include_dirs: ["include/old"],
+    local_include_dirs: [
+        "include/old",
+        "testcases/kernel/syscalls/swapon",
+    ],
     static_libs: ["libltp_ltp"],
 }
 
@@ -14674,7 +14967,10 @@
         "testcases/kernel/syscalls/swapon/libswapon.c",
         "testcases/kernel/syscalls/swapon/swapon02.c",
     ],
-    local_include_dirs: ["include/old"],
+    local_include_dirs: [
+        "include/old",
+        "testcases/kernel/syscalls/swapon",
+    ],
     static_libs: ["libltp_ltp"],
 }
 
@@ -14686,7 +14982,10 @@
         "testcases/kernel/syscalls/swapon/swapon03.c",
         "testcases/kernel/syscalls/swapon/libswapon.c",
     ],
-    local_include_dirs: ["include/old"],
+    local_include_dirs: [
+        "include/old",
+        "testcases/kernel/syscalls/swapon",
+    ],
     static_libs: ["libltp_ltp"],
 }
 
@@ -15176,6 +15475,15 @@
 }
 
 cc_test {
+    name: "ltp_test_guarded_buf",
+    stem: "test_guarded_buf",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["lib/newlib_tests/test_guarded_buf.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_test_kconfig",
     stem: "test_kconfig",
     defaults: ["ltp_test_defaults"],
@@ -15193,6 +15501,14 @@
 }
 
 sh_test {
+    name: "ltp_testcases_bin_ar01.sh",
+    src: "testcases/commands/ar/ar01.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "ar01.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
     name: "ltp_testcases_bin_arping01.sh",
     src: "testcases/network/tcp_cmds/arping/arping01.sh",
     sub_dir: "ltp/testcases/bin",
@@ -15409,22 +15725,6 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_cgroup_regression_10_1.sh",
-    src: "testcases/kernel/controllers/cgroup/cgroup_regression_10_1.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "cgroup_regression_10_1.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_cgroup_regression_10_2.sh",
-    src: "testcases/kernel/controllers/cgroup/cgroup_regression_10_2.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "cgroup_regression_10_2.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
     name: "ltp_testcases_bin_cgroup_regression_3_1.sh",
     src: "testcases/kernel/controllers/cgroup/cgroup_regression_3_1.sh",
     sub_dir: "ltp/testcases/bin",
@@ -15441,6 +15741,22 @@
 }
 
 sh_test {
+    name: "ltp_testcases_bin_cgroup_regression_5_1.sh",
+    src: "testcases/kernel/controllers/cgroup/cgroup_regression_5_1.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "cgroup_regression_5_1.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
+    name: "ltp_testcases_bin_cgroup_regression_5_2.sh",
+    src: "testcases/kernel/controllers/cgroup/cgroup_regression_5_2.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "cgroup_regression_5_2.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
     name: "ltp_testcases_bin_cgroup_regression_6_1.sh",
     src: "testcases/kernel/controllers/cgroup/cgroup_regression_6_1.sh",
     sub_dir: "ltp/testcases/bin",
@@ -15849,14 +16165,6 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_dns-stress",
-    src: "testcases/network/stress/dns/dns-stress",
-    sub_dir: "ltp/testcases/bin",
-    filename: "dns-stress",
-    compile_multilib: "both",
-}
-
-sh_test {
     name: "ltp_testcases_bin_dns-stress-lib.sh",
     src: "testcases/network/stress/dns/dns-stress-lib.sh",
     sub_dir: "ltp/testcases/bin",
@@ -15865,18 +16173,26 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_dns-stress01-rmt",
-    src: "testcases/network/stress/dns/dns-stress01-rmt",
+    name: "ltp_testcases_bin_dns-stress.sh",
+    src: "testcases/network/stress/dns/dns-stress.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "dns-stress01-rmt",
+    filename: "dns-stress.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_dns-stress02-rmt",
-    src: "testcases/network/stress/dns/dns-stress02-rmt",
+    name: "ltp_testcases_bin_dns-stress01-rmt.sh",
+    src: "testcases/network/stress/dns/dns-stress01-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "dns-stress02-rmt",
+    filename: "dns-stress01-rmt.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
+    name: "ltp_testcases_bin_dns-stress02-rmt.sh",
+    src: "testcases/network/stress/dns/dns-stress02-rmt.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "dns-stress02-rmt.sh",
     compile_multilib: "both",
 }
 
@@ -15897,82 +16213,10 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ext4-alloc-test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/ext4-alloc-test.sh",
+    name: "ltp_testcases_bin_evm_overlay.sh",
+    src: "testcases/kernel/security/integrity/ima/tests/evm_overlay.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ext4-alloc-test.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_funcs.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4_funcs.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_funcs.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_get_inode_version.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_get_inode_version.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_inode_version_test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_inode_version_test.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_inode_version_test.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_journal_checksum.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_journal_checksum.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_nsec_timestamps_test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_nsec_timestamps_test.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_online_defrag_test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-online-defrag/ext4_online_defrag_test.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_online_defrag_test.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_persist_prealloc_test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_persist_prealloc_test.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_subdir_limit_test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_subdir_limit_test.sh",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ext4_uninit_groups_test.sh",
-    src: "testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ext4_uninit_groups_test.sh",
+    filename: "evm_overlay.sh",
     compile_multilib: "both",
 }
 
@@ -16569,66 +16813,58 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp-download-stress",
-    src: "testcases/network/stress/ftp/ftp-download-stress",
+    name: "ltp_testcases_bin_ftp-download-stress.sh",
+    src: "testcases/network/stress/ftp/ftp-download-stress.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp-download-stress",
+    filename: "ftp-download-stress.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp-download-stress01-rmt",
-    src: "testcases/network/stress/ftp/ftp-download-stress01-rmt",
+    name: "ltp_testcases_bin_ftp-download-stress01-rmt.sh",
+    src: "testcases/network/stress/ftp/ftp-download-stress01-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp-download-stress01-rmt",
+    filename: "ftp-download-stress01-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp-download-stress02-rmt",
-    src: "testcases/network/stress/ftp/ftp-download-stress02-rmt",
+    name: "ltp_testcases_bin_ftp-download-stress02-rmt.sh",
+    src: "testcases/network/stress/ftp/ftp-download-stress02-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp-download-stress02-rmt",
+    filename: "ftp-download-stress02-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp-upload-stress",
-    src: "testcases/network/stress/ftp/ftp-upload-stress",
+    name: "ltp_testcases_bin_ftp-upload-stress.sh",
+    src: "testcases/network/stress/ftp/ftp-upload-stress.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp-upload-stress",
+    filename: "ftp-upload-stress.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp-upload-stress01-rmt",
-    src: "testcases/network/stress/ftp/ftp-upload-stress01-rmt",
+    name: "ltp_testcases_bin_ftp-upload-stress01-rmt.sh",
+    src: "testcases/network/stress/ftp/ftp-upload-stress01-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp-upload-stress01-rmt",
+    filename: "ftp-upload-stress01-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp-upload-stress02-rmt",
-    src: "testcases/network/stress/ftp/ftp-upload-stress02-rmt",
+    name: "ltp_testcases_bin_ftp-upload-stress02-rmt.sh",
+    src: "testcases/network/stress/ftp/ftp-upload-stress02-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp-upload-stress02-rmt",
+    filename: "ftp-upload-stress02-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ftp01",
-    src: "testcases/network/tcp_cmds/ftp/ftp01",
+    name: "ltp_testcases_bin_ftp01.sh",
+    src: "testcases/network/tcp_cmds/ftp/ftp01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ftp01",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_ftp_setup",
-    src: "testcases/network/tcp_cmds/ftp/ftp_setup",
-    sub_dir: "ltp/testcases/bin",
-    filename: "ftp_setup",
+    filename: "ftp01.sh",
     compile_multilib: "both",
 }
 
@@ -16857,34 +17093,34 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_host01",
-    src: "testcases/network/tcp_cmds/host/host01",
+    name: "ltp_testcases_bin_host01.sh",
+    src: "testcases/network/tcp_cmds/host/host01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "host01",
+    filename: "host01.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_http-stress",
-    src: "testcases/network/stress/http/http-stress",
+    name: "ltp_testcases_bin_http-stress.sh",
+    src: "testcases/network/stress/http/http-stress.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "http-stress",
+    filename: "http-stress.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_http-stress01-rmt",
-    src: "testcases/network/stress/http/http-stress01-rmt",
+    name: "ltp_testcases_bin_http-stress01-rmt.sh",
+    src: "testcases/network/stress/http/http-stress01-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "http-stress01-rmt",
+    filename: "http-stress01-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_http-stress02-rmt",
-    src: "testcases/network/stress/http/http-stress02-rmt",
+    name: "ltp_testcases_bin_http-stress02-rmt.sh",
+    src: "testcases/network/stress/http/http-stress02-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "http-stress02-rmt",
+    filename: "http-stress02-rmt.sh",
     compile_multilib: "both",
 }
 
@@ -17129,18 +17365,18 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if-addr-adddel",
-    src: "testcases/network/stress/interface/if-addr-adddel",
+    name: "ltp_testcases_bin_if-addr-adddel.sh",
+    src: "testcases/network/stress/interface/if-addr-adddel.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if-addr-adddel",
+    filename: "if-addr-adddel.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if-addr-addlarge",
-    src: "testcases/network/stress/interface/if-addr-addlarge",
+    name: "ltp_testcases_bin_if-addr-addlarge.sh",
+    src: "testcases/network/stress/interface/if-addr-addlarge.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if-addr-addlarge",
+    filename: "if-addr-addlarge.sh",
     compile_multilib: "both",
 }
 
@@ -17153,42 +17389,42 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if-mtu-change",
-    src: "testcases/network/stress/interface/if-mtu-change",
+    name: "ltp_testcases_bin_if-mtu-change.sh",
+    src: "testcases/network/stress/interface/if-mtu-change.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if-mtu-change",
+    filename: "if-mtu-change.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if-route-adddel",
-    src: "testcases/network/stress/interface/if-route-adddel",
+    name: "ltp_testcases_bin_if-route-adddel.sh",
+    src: "testcases/network/stress/interface/if-route-adddel.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if-route-adddel",
+    filename: "if-route-adddel.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if-route-addlarge",
-    src: "testcases/network/stress/interface/if-route-addlarge",
+    name: "ltp_testcases_bin_if-route-addlarge.sh",
+    src: "testcases/network/stress/interface/if-route-addlarge.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if-route-addlarge",
+    filename: "if-route-addlarge.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if-updown",
-    src: "testcases/network/stress/interface/if-updown",
+    name: "ltp_testcases_bin_if-updown.sh",
+    src: "testcases/network/stress/interface/if-updown.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if-updown",
+    filename: "if-updown.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_if4-addr-change",
-    src: "testcases/network/stress/interface/if4-addr-change",
+    name: "ltp_testcases_bin_if4-addr-change.sh",
+    src: "testcases/network/stress/interface/if4-addr-change.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "if4-addr-change",
+    filename: "if4-addr-change.sh",
     compile_multilib: "both",
 }
 
@@ -17265,10 +17501,18 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_iptables_tests.sh",
-    src: "testcases/network/iptables/iptables_tests.sh",
+    name: "ltp_testcases_bin_iptables01.sh",
+    src: "testcases/network/iptables/iptables01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "iptables_tests.sh",
+    filename: "iptables01.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
+    name: "ltp_testcases_bin_iptables_lib.sh",
+    src: "testcases/network/iptables/iptables_lib.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "iptables_lib.sh",
     compile_multilib: "both",
 }
 
@@ -17313,6 +17557,22 @@
 }
 
 sh_test {
+    name: "ltp_testcases_bin_ld01.sh",
+    src: "testcases/commands/ld/ld01.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "ld01.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
+    name: "ltp_testcases_bin_ldd01.sh",
+    src: "testcases/commands/ldd/ldd01.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "ldd01.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
     name: "ltp_testcases_bin_libcgroup_freezer",
     src: "testcases/kernel/controllers/freezer/libcgroup_freezer",
     sub_dir: "ltp/testcases/bin",
@@ -17401,34 +17661,34 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_mc_cmds",
-    src: "testcases/network/multicast/mc_cmds/mc_cmds",
+    name: "ltp_testcases_bin_mc_cmds.sh",
+    src: "testcases/network/multicast/mc_cmds/mc_cmds.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "mc_cmds",
+    filename: "mc_cmds.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_mc_commo",
-    src: "testcases/network/multicast/mc_commo/mc_commo",
+    name: "ltp_testcases_bin_mc_commo.sh",
+    src: "testcases/network/multicast/mc_commo/mc_commo.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "mc_commo",
+    filename: "mc_commo.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_mc_member",
-    src: "testcases/network/multicast/mc_member/mc_member",
+    name: "ltp_testcases_bin_mc_member.sh",
+    src: "testcases/network/multicast/mc_member/mc_member.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "mc_member",
+    filename: "mc_member.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_mc_opts",
-    src: "testcases/network/multicast/mc_opts/mc_opts",
+    name: "ltp_testcases_bin_mc_opts.sh",
+    src: "testcases/network/multicast/mc_opts/mc_opts.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "mc_opts",
+    filename: "mc_opts.sh",
     compile_multilib: "both",
 }
 
@@ -17809,10 +18069,10 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_netstat01",
-    src: "testcases/network/tcp_cmds/netstat/netstat01",
+    name: "ltp_testcases_bin_netstat01.sh",
+    src: "testcases/network/tcp_cmds/netstat/netstat01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "netstat01",
+    filename: "netstat01.sh",
     compile_multilib: "both",
 }
 
@@ -17889,6 +18149,22 @@
 }
 
 sh_test {
+    name: "ltp_testcases_bin_nft01.sh",
+    src: "testcases/network/iptables/nft01.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "nft01.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
+    name: "ltp_testcases_bin_nm01.sh",
+    src: "testcases/commands/nm/nm01.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "nm01.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
     name: "ltp_testcases_bin_ns-echoclient",
     src: "testcases/network/stress/ns-tools/ns-echoclient",
     sub_dir: "ltp/testcases/bin",
@@ -17993,10 +18269,10 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_rcp01",
-    src: "testcases/network/tcp_cmds/rcp/rcp01",
+    name: "ltp_testcases_bin_rcp01.sh",
+    src: "testcases/network/tcp_cmds/rcp/rcp01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "rcp01",
+    filename: "rcp01.sh",
     compile_multilib: "both",
 }
 
@@ -18017,34 +18293,42 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_rlogin01",
-    src: "testcases/network/tcp_cmds/rlogin/rlogin01",
+    name: "ltp_testcases_bin_rlogin01.sh",
+    src: "testcases/network/tcp_cmds/rlogin/rlogin01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "rlogin01",
+    filename: "rlogin01.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_route4-change-dst",
-    src: "testcases/network/stress/route/route4-change-dst",
+    name: "ltp_testcases_bin_route-change-dst.sh",
+    src: "testcases/network/stress/route/route-change-dst.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "route4-change-dst",
+    filename: "route-change-dst.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_route4-change-gw",
-    src: "testcases/network/stress/route/route4-change-gw",
+    name: "ltp_testcases_bin_route-change-gw.sh",
+    src: "testcases/network/stress/route/route-change-gw.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "route4-change-gw",
+    filename: "route-change-gw.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_route4-change-if",
-    src: "testcases/network/stress/route/route4-change-if",
+    name: "ltp_testcases_bin_route-change-if.sh",
+    src: "testcases/network/stress/route/route-change-if.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "route4-change-if",
+    filename: "route-change-if.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
+    name: "ltp_testcases_bin_route-lib.sh",
+    src: "testcases/network/stress/route/route-lib.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "route-lib.sh",
     compile_multilib: "both",
 }
 
@@ -18065,30 +18349,6 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_route6-change-dst",
-    src: "testcases/network/stress/route/route6-change-dst",
-    sub_dir: "ltp/testcases/bin",
-    filename: "route6-change-dst",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_route6-change-gw",
-    src: "testcases/network/stress/route/route6-change-gw",
-    sub_dir: "ltp/testcases/bin",
-    filename: "route6-change-gw",
-    compile_multilib: "both",
-}
-
-sh_test {
-    name: "ltp_testcases_bin_route6-change-if",
-    src: "testcases/network/stress/route/route6-change-if",
-    sub_dir: "ltp/testcases/bin",
-    filename: "route6-change-if",
-    compile_multilib: "both",
-}
-
-sh_test {
     name: "ltp_testcases_bin_route6-redirect",
     src: "testcases/network/stress/route/route6-redirect",
     sub_dir: "ltp/testcases/bin",
@@ -18105,10 +18365,10 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_rsh01",
-    src: "testcases/network/tcp_cmds/rsh/rsh01",
+    name: "ltp_testcases_bin_rsh01.sh",
+    src: "testcases/network/tcp_cmds/rsh/rsh01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "rsh01",
+    filename: "rsh01.sh",
     compile_multilib: "both",
 }
 
@@ -18321,10 +18581,10 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_sendfile01",
-    src: "testcases/network/tcp_cmds/sendfile/sendfile01",
+    name: "ltp_testcases_bin_sendfile01.sh",
+    src: "testcases/network/tcp_cmds/sendfile/sendfile01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "sendfile01",
+    filename: "sendfile01.sh",
     compile_multilib: "both",
 }
 
@@ -18441,34 +18701,34 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ssh-stress",
-    src: "testcases/network/stress/ssh/ssh-stress",
+    name: "ltp_testcases_bin_ssh-stress.sh",
+    src: "testcases/network/stress/ssh/ssh-stress.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ssh-stress",
+    filename: "ssh-stress.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ssh-stress01-rmt",
-    src: "testcases/network/stress/ssh/ssh-stress01-rmt",
+    name: "ltp_testcases_bin_ssh-stress01-rmt.sh",
+    src: "testcases/network/stress/ssh/ssh-stress01-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ssh-stress01-rmt",
+    filename: "ssh-stress01-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ssh-stress02-rmt",
-    src: "testcases/network/stress/ssh/ssh-stress02-rmt",
+    name: "ltp_testcases_bin_ssh-stress02-rmt.sh",
+    src: "testcases/network/stress/ssh/ssh-stress02-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ssh-stress02-rmt",
+    filename: "ssh-stress02-rmt.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_ssh-stress03-rmt",
-    src: "testcases/network/stress/ssh/ssh-stress03-rmt",
+    name: "ltp_testcases_bin_ssh-stress03-rmt.sh",
+    src: "testcases/network/stress/ssh/ssh-stress03-rmt.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "ssh-stress03-rmt",
+    filename: "ssh-stress03-rmt.sh",
     compile_multilib: "both",
 }
 
@@ -18505,6 +18765,14 @@
 }
 
 sh_test {
+    name: "ltp_testcases_bin_sysctl02.sh",
+    src: "testcases/commands/sysctl/sysctl02.sh",
+    sub_dir: "ltp/testcases/bin",
+    filename: "sysctl02.sh",
+    compile_multilib: "both",
+}
+
+sh_test {
     name: "ltp_testcases_bin_tcp4-multi-diffip01",
     src: "testcases/network/stress/tcp/multi-diffip/tcp4-multi-diffip01",
     sub_dir: "ltp/testcases/bin",
@@ -21001,18 +21269,18 @@
 }
 
 sh_test {
-    name: "ltp_testcases_bin_tcpdump01",
-    src: "testcases/network/tcp_cmds/tcpdump/tcpdump01",
+    name: "ltp_testcases_bin_tcpdump01.sh",
+    src: "testcases/network/tcp_cmds/tcpdump/tcpdump01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "tcpdump01",
+    filename: "tcpdump01.sh",
     compile_multilib: "both",
 }
 
 sh_test {
-    name: "ltp_testcases_bin_telnet01",
-    src: "testcases/network/tcp_cmds/telnet/telnet01",
+    name: "ltp_testcases_bin_telnet01.sh",
+    src: "testcases/network/tcp_cmds/telnet/telnet01.sh",
     sub_dir: "ltp/testcases/bin",
-    filename: "telnet01",
+    filename: "telnet01.sh",
     compile_multilib: "both",
 }
 
@@ -21885,15 +22153,22 @@
 }
 
 cc_test {
+    name: "ltp_timer_create01",
+    stem: "timer_create01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/timer_create/timer_create01.c"],
+    cflags: ["-D_GNU_SOURCE"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_timer_create02",
     stem: "timer_create02",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_create/timer_create02.c"],
+    srcs: ["testcases/kernel/syscalls/timer_create/timer_create02.c"],
     cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
+    local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
 
@@ -21901,25 +22176,19 @@
     name: "ltp_timer_create03",
     stem: "timer_create03",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_create/timer_create03.c"],
+    srcs: ["testcases/kernel/syscalls/timer_create/timer_create03.c"],
     cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
+    local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
 
 cc_test {
-    name: "ltp_timer_create04",
-    stem: "timer_create04",
+    name: "ltp_timer_delete01",
+    stem: "timer_delete01",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_create/timer_create04.c"],
+    srcs: ["testcases/kernel/syscalls/timer_delete/timer_delete01.c"],
     cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
+    local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
 
@@ -21927,25 +22196,9 @@
     name: "ltp_timer_delete02",
     stem: "timer_delete02",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_delete/timer_delete02.c"],
+    srcs: ["testcases/kernel/syscalls/timer_delete/timer_delete02.c"],
     cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
-    static_libs: ["libltp_ltp"],
-}
-
-cc_test {
-    name: "ltp_timer_delete03",
-    stem: "timer_delete03",
-    defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_delete/timer_delete03.c"],
-    cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
+    local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
 
@@ -21968,28 +22221,22 @@
 }
 
 cc_test {
-    name: "ltp_timer_settime02",
-    stem: "timer_settime02",
+    name: "ltp_timer_settime01",
+    stem: "timer_settime01",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_settime/timer_settime02.c"],
+    srcs: ["testcases/kernel/syscalls/timer_settime/timer_settime01.c"],
     cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
+    local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
 
 cc_test {
-    name: "ltp_timer_settime03",
-    stem: "timer_settime03",
+    name: "ltp_timer_settime02",
+    stem: "timer_settime02",
     defaults: ["ltp_test_defaults"],
-    srcs: ["testcases/kernel/timers/timer_settime/timer_settime03.c"],
+    srcs: ["testcases/kernel/syscalls/timer_settime/timer_settime02.c"],
     cflags: ["-D_GNU_SOURCE"],
-    local_include_dirs: [
-        "testcases/kernel/timers/include",
-        "include/old",
-    ],
+    local_include_dirs: ["include/old"],
     static_libs: ["libltp_ltp"],
 }
 
@@ -22293,6 +22540,24 @@
 }
 
 cc_test {
+    name: "ltp_tst_capability01",
+    stem: "tst_capability01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["lib/newlib_tests/tst_capability01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_tst_capability02",
+    stem: "tst_capability02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["lib/newlib_tests/tst_capability02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_tst_check_drivers",
     stem: "tst_check_drivers",
     defaults: ["ltp_test_defaults"],
@@ -22651,6 +22916,36 @@
 }
 
 cc_test {
+    name: "ltp_uevent01",
+    stem: "uevent01",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/uevents/uevent01.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_uevent02",
+    stem: "uevent02",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/uevents/uevent02.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
+    name: "ltp_uevent03",
+    stem: "uevent03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/uevents/uevent03.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: [
+        "libltp_ltp",
+        "libltp_ltpuinput",
+    ],
+}
+
+cc_test {
     name: "ltp_umask01",
     stem: "umask01",
     defaults: ["ltp_test_defaults"],
@@ -23080,6 +23375,15 @@
 }
 
 cc_test {
+    name: "ltp_vmsplice03",
+    stem: "vmsplice03",
+    defaults: ["ltp_test_defaults"],
+    srcs: ["testcases/kernel/syscalls/vmsplice/vmsplice03.c"],
+    local_include_dirs: ["include/old"],
+    static_libs: ["libltp_ltp"],
+}
+
+cc_test {
     name: "ltp_wait01",
     stem: "wait01",
     defaults: ["ltp_test_defaults"],
diff --git a/include/config.h.default b/include/config.h.default
deleted file mode 100644
index 8b245fc..0000000
--- a/include/config.h.default
+++ /dev/null
@@ -1,245 +0,0 @@
-/* include/config.h.default.
-   A semi-sane set of defaults for more recent Linux platforms. Please tailor
-   to meet your needs.
- */
-
-/* Define to 1 if you have the new implementation of quotactl that only
-   requires sys/types.h and sys/quota.h */
-#define HAS_NEW_MINIMAL_QUOTACTL 1
-
-/* Define to 1 if you have the RHEL ~4.6 version of quotactl, e.g. require
-   linux/quota.h instead of sys/quota.h */
-#undef HAS_RHEL46_QUOTACTL
-
-/* Define to 1 if you have the RHEL 4.8+ version of quotactl, e.g. require
-   sys/quota.h */
-#define HAS_RHEL48_QUOTACTL
-
-/* Define to 1 if you have the <asm/ldt.h> header file. */
-#undef HAVE_ASM_LDT_H
-
-/* Define to 1 if you have the <sys/xattr.h> header file. */
-#undef HAVE_SYS_XATTR_H
-
-/* Define to 1 if you have the declaration of `CAP_BSET_DROP', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_BSET_DROP
-
-/* Define to 1 if you have the declaration of `CAP_BSET_READ', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_BSET_READ
-
-/* Define to 1 if you have the declaration of `cap_compare', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_COMPARE
-
-/* Define to 1 if you have the declaration of `cap_free', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_FREE
-
-/* Define to 1 if you have the declaration of `cap_from_text', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_FROM_TEXT
-
-/* Define to 1 if you have the declaration of `cap_get_proc', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_GET_PROC
-
-/* Define to 1 if you have the declaration of `cap_set_file', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_SET_FILE
-
-/* Define to 1 if you have the declaration of `cap_set_flag', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_SET_FLAG
-
-/* Define to 1 if you have the declaration of `cap_set_proc', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_SET_PROC
-
-/* Define to 1 if you have the declaration of `cap_to_text', and to 0 if you
-   don't. */
-#undef HAVE_DECL_CAP_TO_TEXT
-
-/* Define to 1 if you have the declaration of `PR_CAPBSET_READ', and to 0 if
-   you don't. */
-#undef HAVE_DECL_PR_CAPBSET_READ
-
-/* Define to 1 if you have the declaration of `PTRACE_GETSIGINFO', and to 0 if
-   you don't. */
-#define HAVE_DECL_PTRACE_GETSIGINFO 1
-
-/* Define to 1 if you have the declaration of `PTRACE_O_TRACEVFORKDONE', and
-   to 0 if you don't. */
-#define HAVE_DECL_PTRACE_O_TRACEVFORKDONE 1
-
-/* Define to 1 if you have the declaration of `PTRACE_SETOPTIONS', and to 0 if
-   you don't. */
-#undef HAVE_DECL_PTRACE_SETOPTIONS
-
-/* Define to 1 if you have the <ifaddrs.h> header file. */
-#define HAVE_IFADDRS_H 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `io_set_eventfd' function. */
-#undef HAVE_IO_SET_EVENTFD
-
-/* Define to 1 if you have the <libaio.h> header file. */
-#undef HAVE_LIBAIO_H
-
-/* Define to 1 if you have both SELinux libraries and headers. */
-#undef HAVE_LIBSELINUX_DEVEL
-
-/* Define to 1 if you have the <linux/genetlink.h> header file. */
-#undef HAVE_LINUX_GENETLINK_H
-
-/* Define to 1 if you have the <linux/module.h> header file. */
-#undef HAVE_LINUX_MODULE_H
-
-/* Define to 1 if you have the <linux/netlink.h> header file. */
-#undef HAVE_LINUX_NETLINK_H
-
-/* Define to 1 if you have the <linux/ptrace.h> header file. */
-#undef HAVE_LINUX_PTRACE_H
-
-/* Define to 1 if you have the <linux/signalfd.h> header file. */
-#undef HAVE_LINUX_SIGNALFD_H
-
-/* Define to 1 if you have the <linux/taskstats.h> header file. */
-#undef HAVE_LINUX_TASKSTATS_H
-
-/* Define to 1 if you have the <linux/types.h> header file. */
-#undef HAVE_LINUX_TYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <mm.h> header file. */
-#undef HAVE_MM_H
-
-/* Define to 1 if you have the `modify_ldt' function. */
-#undef HAVE_MODIFY_LDT
-
-/* 2.6 version of swapon/swapoff */
-#define HAVE_NEW_SWAPONOFF 1
-
-/* Define to 1 if you have the <numa.h> header file. */
-#undef HAVE_NUMA_H
-
-/* 2.4 version of swapon/swapoff */
-#undef HAVE_OLD_SWAPONOFF
-
-/* Define to 1 if you have the <openssl/sha.h> header file. */
-#undef HAVE_OPENSSL_SHA_H
-
-/* Define to 1 if you have the <pthread.h> header file. */
-#undef HAVE_PTHREAD_H
-
-/* Define to 1 if you have the <selinux/selinux.h> header file. */
-#undef HAVE_SELINUX_SELINUX_H
-
-/* Define to 1 if you have the `signalfd' function. */
-#define HAVE_SIGNALFD 1
-
-/* Define to 1 if you have the <signalfd.h> header file. */
-#define HAVE_SIGNALFD_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if the system has the type `struct modify_ldt_ldt_s'. */
-#undef HAVE_STRUCT_MODIFY_LDT_LDT_S
-
-/* Define to 1 if the system has the type `struct ptrace_peeksiginfo_args'. */
-#undef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
-
-/* Define to 1 if `signo' is member of `struct signalfd_siginfo'. */
-#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
-
-/* Define to 1 if `ssi_signo' is member of `struct signalfd_siginfo'. */
-#undef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO
-
-/* Define to 1 if `freepages_count' is member of `struct taskstats'. */
-#undef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT
-
-/* Define to 1 if `nvcsw' is member of `struct taskstats'. */
-#undef HAVE_STRUCT_TASKSTATS_NVCSW
-
-/* Define to 1 if `read_bytes' is member of `struct taskstats'. */
-#undef HAVE_STRUCT_TASKSTATS_READ_BYTES
-
-/* Define to 1 if the system has the type `struct user_desc'. */
-#undef HAVE_STRUCT_USER_DESC
-
-/* Define to 1 if you have the <sys/acl.h> header file. */
-#define HAVE_SYS_ACL_H 1
-
-/* Define to 1 if you have the <sys/capability.h> header file. */
-#define HAVE_SYS_CAPABILITY_H 1
-
-/* Define to 1 if you have the <sys/epoll.h> header file. */
-#define HAVE_SYS_EPOLL_H 1
-
-/* Define to 1 if you have the <sys/inotify.h> header file. */
-#define HAVE_SYS_INOTIFY_H 1
-
-/* Define to 1 if you have the <sys/prctl.h> header file. */
-#undef HAVE_SYS_PRCTL_H
-
-/* Define to 1 if you have the <sys/signalfd.h> header file. */
-#undef HAVE_SYS_SIGNALFD_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the `unshare' function. */
-#undef HAVE_UNSHARE
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
-   `char[]'. */
-#undef YYTEXT_POINTER
-
-/*
- * vim: syntax=c
- */
diff --git a/include/lapi/acct.h b/include/lapi/acct.h
new file mode 100644
index 0000000..c81b78b
--- /dev/null
+++ b/include/lapi/acct.h
@@ -0,0 +1,74 @@
+//SPDX-License-Identifier: GPL-2.0-or-later
+
+#ifndef LAPI_ACCT_H
+#define LAPI_ACCT_H
+
+#include <sys/types.h>
+#include "config.h"
+
+#ifdef HAVE_STRUCT_ACCT_V3
+#include <sys/acct.h>
+#else
+
+#define ACCT_COMM 16
+
+typedef uint16_t comp_t;
+
+/* Fallback structures to parse the process accounting file */
+struct acct {
+	char ac_flag;
+	uint16_t ac_uid;
+	uint16_t ac_gid;
+	uint16_t ac_tty;
+	uint32_t ac_btime;
+	comp_t    ac_utime;
+	comp_t    ac_stime;
+	comp_t    ac_etime;
+	comp_t    ac_mem;
+	comp_t    ac_io;
+	comp_t    ac_rw;
+	comp_t    ac_minflt;
+	comp_t    ac_majflt;
+	comp_t    ac_swaps;
+	uint32_t ac_exitcode;
+	char      ac_comm[ACCT_COMM+1];
+	char      ac_pad[10];
+};
+
+struct acct_v3 {
+	char      ac_flag;
+	char      ac_version;
+	uint16_t ac_tty;
+	uint32_t ac_exitcode;
+	uint32_t ac_uid;
+	uint32_t ac_gid;
+	uint32_t ac_pid;
+	uint32_t ac_ppid;
+	uint32_t ac_btime;
+	float     ac_etime;
+	comp_t    ac_utime;
+	comp_t    ac_stime;
+	comp_t    ac_mem;
+	comp_t    ac_io;
+	comp_t    ac_rw;
+	comp_t    ac_minflt;
+	comp_t    ac_majflt;
+	comp_t    ac_swaps;
+	char      ac_comm[ACCT_COMM];
+};
+
+/* Possible values for the ac_flag member */
+enum {
+	AFORK = 0x01,
+	ASU   = 0x02,
+	ACORE = 0x08,
+	AXSIG = 0x10
+};
+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define ACCT_BYTEORDER  0x80
+# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+# define ACCT_BYTEORDER  0x00
+# endif
+#endif /* HAVE_STRUCT_ACCT_V3 */
+
+#endif /* LAPI_ACCT_H */
diff --git a/include/lapi/bpf.h b/include/lapi/bpf.h
new file mode 100644
index 0000000..d3d444b
--- /dev/null
+++ b/include/lapi/bpf.h
@@ -0,0 +1,567 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * Essential Extended Berkeley Packet Filter (eBPF) headers
+ *
+ * Mostly copied/adapted from linux/bpf.h and libbpf so that we can perform
+ * some eBPF testing without any external dependencies.
+ */
+
+#ifndef BPF_H
+# define BPF_H
+
+#include <stdint.h>
+
+#include "lapi/syscalls.h"
+
+/* Start copy from linux/bpf_(common).h */
+#define BPF_CLASS(code) ((code) & 0x07)
+#define		BPF_LD		0x00
+#define		BPF_LDX		0x01
+#define		BPF_ST		0x02
+#define		BPF_STX		0x03
+#define		BPF_ALU		0x04
+#define		BPF_JMP		0x05
+
+#define BPF_JNE		0x50	/* jump != */
+
+#define BPF_SIZE(code)  ((code) & 0x18)
+#define		BPF_W		0x00    /* 32-bit */
+#define         BPF_DW		0x18	/* double word (64-bit) */
+
+#define BPF_MODE(code)  ((code) & 0xe0)
+#define		BPF_IMM		0x00
+#define		BPF_MEM		0x60
+
+#define BPF_OP(code)    ((code) & 0xf0)
+#define		BPF_ADD		0x00
+#define		BPF_SUB		0x10
+#define		BPF_LSH		0x60
+#define		BPF_RSH		0x70
+
+#define		BPF_JEQ		0x10
+
+#define BPF_SRC(code)   ((code) & 0x08)
+#define		BPF_K		0x00
+#define		BPF_X		0x08
+
+#define BPF_ALU64	0x07	/* alu mode in double word width */
+#define BPF_MOV		0xb0	/* mov reg to reg */
+#define BPF_CALL	0x80	/* function call */
+#define BPF_EXIT	0x90	/* function return */
+
+/* Register numbers */
+enum {
+	BPF_REG_0 = 0,
+	BPF_REG_1,
+	BPF_REG_2,
+	BPF_REG_3,
+	BPF_REG_4,
+	BPF_REG_5,
+	BPF_REG_6,
+	BPF_REG_7,
+	BPF_REG_8,
+	BPF_REG_9,
+	BPF_REG_10,
+	MAX_BPF_REG,
+};
+
+struct bpf_insn {
+	uint8_t	code;		/* opcode */
+	uint8_t	dst_reg:4;	/* dest register */
+	uint8_t	src_reg:4;	/* source register */
+	int16_t	off;		/* signed offset */
+	int32_t	imm;		/* signed immediate constant */
+};
+
+enum bpf_cmd {
+	BPF_MAP_CREATE,
+	BPF_MAP_LOOKUP_ELEM,
+	BPF_MAP_UPDATE_ELEM,
+	BPF_MAP_DELETE_ELEM,
+	BPF_MAP_GET_NEXT_KEY,
+	BPF_PROG_LOAD,
+	BPF_OBJ_PIN,
+	BPF_OBJ_GET,
+	BPF_PROG_ATTACH,
+	BPF_PROG_DETACH,
+	BPF_PROG_TEST_RUN,
+	BPF_PROG_GET_NEXT_ID,
+	BPF_MAP_GET_NEXT_ID,
+	BPF_PROG_GET_FD_BY_ID,
+	BPF_MAP_GET_FD_BY_ID,
+	BPF_OBJ_GET_INFO_BY_FD,
+	BPF_PROG_QUERY,
+	BPF_RAW_TRACEPOINT_OPEN,
+	BPF_BTF_LOAD,
+	BPF_BTF_GET_FD_BY_ID,
+	BPF_TASK_FD_QUERY,
+	BPF_MAP_LOOKUP_AND_DELETE_ELEM,
+	BPF_MAP_FREEZE,
+};
+
+enum bpf_map_type {
+	BPF_MAP_TYPE_UNSPEC,
+	BPF_MAP_TYPE_HASH,
+	BPF_MAP_TYPE_ARRAY,
+	BPF_MAP_TYPE_PROG_ARRAY,
+	BPF_MAP_TYPE_PERF_EVENT_ARRAY,
+	BPF_MAP_TYPE_PERCPU_HASH,
+	BPF_MAP_TYPE_PERCPU_ARRAY,
+	BPF_MAP_TYPE_STACK_TRACE,
+	BPF_MAP_TYPE_CGROUP_ARRAY,
+	BPF_MAP_TYPE_LRU_HASH,
+	BPF_MAP_TYPE_LRU_PERCPU_HASH,
+	BPF_MAP_TYPE_LPM_TRIE,
+	BPF_MAP_TYPE_ARRAY_OF_MAPS,
+	BPF_MAP_TYPE_HASH_OF_MAPS,
+	BPF_MAP_TYPE_DEVMAP,
+	BPF_MAP_TYPE_SOCKMAP,
+	BPF_MAP_TYPE_CPUMAP,
+	BPF_MAP_TYPE_XSKMAP,
+	BPF_MAP_TYPE_SOCKHASH,
+	BPF_MAP_TYPE_CGROUP_STORAGE,
+	BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
+	BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
+	BPF_MAP_TYPE_QUEUE,
+	BPF_MAP_TYPE_STACK,
+	BPF_MAP_TYPE_SK_STORAGE,
+};
+
+enum bpf_prog_type {
+	BPF_PROG_TYPE_UNSPEC,
+	BPF_PROG_TYPE_SOCKET_FILTER,
+	BPF_PROG_TYPE_KPROBE,
+	BPF_PROG_TYPE_SCHED_CLS,
+	BPF_PROG_TYPE_SCHED_ACT,
+	BPF_PROG_TYPE_TRACEPOINT,
+	BPF_PROG_TYPE_XDP,
+	BPF_PROG_TYPE_PERF_EVENT,
+	BPF_PROG_TYPE_CGROUP_SKB,
+	BPF_PROG_TYPE_CGROUP_SOCK,
+	BPF_PROG_TYPE_LWT_IN,
+	BPF_PROG_TYPE_LWT_OUT,
+	BPF_PROG_TYPE_LWT_XMIT,
+	BPF_PROG_TYPE_SOCK_OPS,
+	BPF_PROG_TYPE_SK_SKB,
+	BPF_PROG_TYPE_CGROUP_DEVICE,
+	BPF_PROG_TYPE_SK_MSG,
+	BPF_PROG_TYPE_RAW_TRACEPOINT,
+	BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
+	BPF_PROG_TYPE_LWT_SEG6LOCAL,
+	BPF_PROG_TYPE_LIRC_MODE2,
+	BPF_PROG_TYPE_SK_REUSEPORT,
+	BPF_PROG_TYPE_FLOW_DISSECTOR,
+	BPF_PROG_TYPE_CGROUP_SYSCTL,
+	BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
+	BPF_PROG_TYPE_CGROUP_SOCKOPT,
+};
+
+#define BPF_PSEUDO_MAP_FD	1
+
+#define BPF_OBJ_NAME_LEN 16U
+
+#define BPF_ANY		0 /* create new element or update existing */
+#define BPF_NOEXIST	1 /* create new element if it didn't exist */
+#define BPF_EXIST	2 /* update existing element */
+#define BPF_F_LOCK	4 /* spin_lock-ed map_lookup/map_update */
+
+#define aligned_uint64_t uint64_t __attribute__((aligned(8)))
+
+union bpf_attr {
+	struct { /* anonymous struct used by BPF_MAP_CREATE command */
+		uint32_t	map_type;	/* one of enum bpf_map_type */
+		uint32_t	key_size;	/* size of key in bytes */
+		uint32_t	value_size;	/* size of value in bytes */
+		uint32_t	max_entries;	/* max number of entries in a map */
+		uint32_t	map_flags;	/* BPF_MAP_CREATE related
+					 * flags defined above.
+					 */
+		uint32_t	inner_map_fd;	/* fd pointing to the inner map */
+		uint32_t	numa_node;	/* numa node (effective only if
+					 * BPF_F_NUMA_NODE is set).
+					 */
+		char	map_name[BPF_OBJ_NAME_LEN];
+		uint32_t	map_ifindex;	/* ifindex of netdev to create on */
+		uint32_t	btf_fd;		/* fd pointing to a BTF type data */
+		uint32_t	btf_key_type_id;	/* BTF type_id of the key */
+		uint32_t	btf_value_type_id;	/* BTF type_id of the value */
+	};
+
+	struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
+		uint32_t		map_fd;
+		aligned_uint64_t	key;
+		union {
+			aligned_uint64_t value;
+			aligned_uint64_t next_key;
+		};
+		uint64_t		flags;
+	};
+
+	struct { /* anonymous struct used by BPF_PROG_LOAD command */
+		uint32_t		prog_type;	/* one of enum bpf_prog_type */
+		uint32_t		insn_cnt;
+		aligned_uint64_t	insns;
+		aligned_uint64_t	license;
+		uint32_t		log_level;	/* verbosity level of verifier */
+		uint32_t		log_size;	/* size of user buffer */
+		aligned_uint64_t	log_buf;	/* user supplied buffer */
+		uint32_t		kern_version;	/* not used */
+		uint32_t		prog_flags;
+		char		prog_name[BPF_OBJ_NAME_LEN];
+		uint32_t		prog_ifindex;	/* ifindex of netdev to prep for */
+		/* For some prog types expected attach type must be known at
+		 * load time to verify attach type specific parts of prog
+		 * (context accesses, allowed helpers, etc).
+		 */
+		uint32_t		expected_attach_type;
+		uint32_t		prog_btf_fd;	/* fd pointing to BTF type data */
+		uint32_t		func_info_rec_size;	/* userspace bpf_func_info size */
+		aligned_uint64_t	func_info;	/* func info */
+		uint32_t		func_info_cnt;	/* number of bpf_func_info records */
+		uint32_t		line_info_rec_size;	/* userspace bpf_line_info size */
+		aligned_uint64_t	line_info;	/* line info */
+		uint32_t		line_info_cnt;	/* number of bpf_line_info records */
+	};
+
+	struct { /* anonymous struct used by BPF_OBJ_* commands */
+		aligned_uint64_t	pathname;
+		uint32_t		bpf_fd;
+		uint32_t		file_flags;
+	};
+
+	struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
+		uint32_t		target_fd;	/* container object to attach to */
+		uint32_t		attach_bpf_fd;	/* eBPF program to attach */
+		uint32_t		attach_type;
+		uint32_t		attach_flags;
+	};
+
+	struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
+		uint32_t		prog_fd;
+		uint32_t		retval;
+		uint32_t		data_size_in;	/* input: len of data_in */
+		uint32_t		data_size_out;	/* input/output: len of data_out
+						 *   returns ENOSPC if data_out
+						 *   is too small.
+						 */
+		aligned_uint64_t	data_in;
+		aligned_uint64_t	data_out;
+		uint32_t		repeat;
+		uint32_t		duration;
+		uint32_t		ctx_size_in;	/* input: len of ctx_in */
+		uint32_t		ctx_size_out;	/* input/output: len of ctx_out
+						 *   returns ENOSPC if ctx_out
+						 *   is too small.
+						 */
+		aligned_uint64_t	ctx_in;
+		aligned_uint64_t	ctx_out;
+	} test;
+
+	struct { /* anonymous struct used by BPF_*_GET_*_ID */
+		union {
+			uint32_t		start_id;
+			uint32_t		prog_id;
+			uint32_t		map_id;
+			uint32_t		btf_id;
+		};
+		uint32_t		next_id;
+		uint32_t		open_flags;
+	};
+
+	struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */
+		uint32_t		bpf_fd;
+		uint32_t		info_len;
+		aligned_uint64_t	info;
+	} info;
+
+	struct { /* anonymous struct used by BPF_PROG_QUERY command */
+		uint32_t		target_fd;	/* container object to query */
+		uint32_t		attach_type;
+		uint32_t		query_flags;
+		uint32_t		attach_flags;
+		aligned_uint64_t	prog_ids;
+		uint32_t		prog_cnt;
+	} query;
+
+	struct {
+		uint64_t name;
+		uint32_t prog_fd;
+	} raw_tracepoint;
+
+	struct { /* anonymous struct for BPF_BTF_LOAD */
+		aligned_uint64_t	btf;
+		aligned_uint64_t	btf_log_buf;
+		uint32_t		btf_size;
+		uint32_t		btf_log_size;
+		uint32_t		btf_log_level;
+	};
+
+	struct {
+		uint32_t		pid;		/* input: pid */
+		uint32_t		fd;		/* input: fd */
+		uint32_t		flags;		/* input: flags */
+		uint32_t		buf_len;	/* input/output: buf len */
+		aligned_uint64_t	buf;		/* input/output:
+						 *   tp_name for tracepoint
+						 *   symbol for kprobe
+						 *   filename for uprobe
+						 */
+		uint32_t		prog_id;	/* output: prod_id */
+		uint32_t		fd_type;	/* output: BPF_FD_TYPE_* */
+		uint64_t		probe_offset;	/* output: probe_offset */
+		uint64_t		probe_addr;	/* output: probe_addr */
+	} task_fd_query;
+} __attribute__((aligned(8)));
+
+#define __BPF_FUNC_MAPPER(FN)		\
+	FN(unspec),			\
+	FN(map_lookup_elem),		\
+	FN(map_update_elem),		\
+	FN(map_delete_elem),		\
+	FN(probe_read),			\
+	FN(ktime_get_ns),		\
+	FN(trace_printk),		\
+	FN(get_prandom_u32),		\
+	FN(get_smp_processor_id),	\
+	FN(skb_store_bytes),		\
+	FN(l3_csum_replace),		\
+	FN(l4_csum_replace),		\
+	FN(tail_call),			\
+	FN(clone_redirect),		\
+	FN(get_current_pid_tgid),	\
+	FN(get_current_uid_gid),	\
+	FN(get_current_comm),		\
+	FN(get_cgroup_classid),		\
+	FN(skb_vlan_push),		\
+	FN(skb_vlan_pop),		\
+	FN(skb_get_tunnel_key),		\
+	FN(skb_set_tunnel_key),		\
+	FN(perf_event_read),		\
+	FN(redirect),			\
+	FN(get_route_realm),		\
+	FN(perf_event_output),		\
+	FN(skb_load_bytes),		\
+	FN(get_stackid),		\
+	FN(csum_diff),			\
+	FN(skb_get_tunnel_opt),		\
+	FN(skb_set_tunnel_opt),		\
+	FN(skb_change_proto),		\
+	FN(skb_change_type),		\
+	FN(skb_under_cgroup),		\
+	FN(get_hash_recalc),		\
+	FN(get_current_task),		\
+	FN(probe_write_user),		\
+	FN(current_task_under_cgroup),	\
+	FN(skb_change_tail),		\
+	FN(skb_pull_data),		\
+	FN(csum_update),		\
+	FN(set_hash_invalid),		\
+	FN(get_numa_node_id),		\
+	FN(skb_change_head),		\
+	FN(xdp_adjust_head),		\
+	FN(probe_read_str),		\
+	FN(get_socket_cookie),		\
+	FN(get_socket_uid),		\
+	FN(set_hash),			\
+	FN(setsockopt),			\
+	FN(skb_adjust_room),		\
+	FN(redirect_map),		\
+	FN(sk_redirect_map),		\
+	FN(sock_map_update),		\
+	FN(xdp_adjust_meta),		\
+	FN(perf_event_read_value),	\
+	FN(perf_prog_read_value),	\
+	FN(getsockopt),			\
+	FN(override_return),		\
+	FN(sock_ops_cb_flags_set),	\
+	FN(msg_redirect_map),		\
+	FN(msg_apply_bytes),		\
+	FN(msg_cork_bytes),		\
+	FN(msg_pull_data),		\
+	FN(bind),			\
+	FN(xdp_adjust_tail),		\
+	FN(skb_get_xfrm_state),		\
+	FN(get_stack),			\
+	FN(skb_load_bytes_relative),	\
+	FN(fib_lookup),			\
+	FN(sock_hash_update),		\
+	FN(msg_redirect_hash),		\
+	FN(sk_redirect_hash),		\
+	FN(lwt_push_encap),		\
+	FN(lwt_seg6_store_bytes),	\
+	FN(lwt_seg6_adjust_srh),	\
+	FN(lwt_seg6_action),		\
+	FN(rc_repeat),			\
+	FN(rc_keydown),			\
+	FN(skb_cgroup_id),		\
+	FN(get_current_cgroup_id),	\
+	FN(get_local_storage),		\
+	FN(sk_select_reuseport),	\
+	FN(skb_ancestor_cgroup_id),	\
+	FN(sk_lookup_tcp),		\
+	FN(sk_lookup_udp),		\
+	FN(sk_release),			\
+	FN(map_push_elem),		\
+	FN(map_pop_elem),		\
+	FN(map_peek_elem),		\
+	FN(msg_push_data),		\
+	FN(msg_pop_data),		\
+	FN(rc_pointer_rel),		\
+	FN(spin_lock),			\
+	FN(spin_unlock),		\
+	FN(sk_fullsock),		\
+	FN(tcp_sock),			\
+	FN(skb_ecn_set_ce),		\
+	FN(get_listener_sock),		\
+	FN(skc_lookup_tcp),		\
+	FN(tcp_check_syncookie),	\
+	FN(sysctl_get_name),		\
+	FN(sysctl_get_current_value),	\
+	FN(sysctl_get_new_value),	\
+	FN(sysctl_set_new_value),	\
+	FN(strtol),			\
+	FN(strtoul),			\
+	FN(sk_storage_get),		\
+	FN(sk_storage_delete),		\
+	FN(send_signal),
+
+/* integer value in 'imm' field of BPF_CALL instruction selects which helper
+ * function eBPF program intends to call
+ */
+#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x
+enum bpf_func_id {
+	__BPF_FUNC_MAPPER(__BPF_ENUM_FN)
+	__BPF_FUNC_MAX_ID,
+};
+#undef __BPF_ENUM_FN
+
+/* End copy from linux/bpf.h */
+
+/* Start copy from tools/include/filter.h */
+
+#define BPF_ALU64_REG(OP, DST, SRC)				\
+	((struct bpf_insn) {					\
+		.code  = BPF_ALU64 | BPF_OP(OP) | BPF_X,	\
+		.dst_reg = DST,					\
+		.src_reg = SRC,					\
+		.off   = 0,					\
+		.imm   = 0 })
+
+#define BPF_ALU64_IMM(OP, DST, IMM)				\
+	((struct bpf_insn) {					\
+		.code  = BPF_ALU64 | BPF_OP(OP) | BPF_K,	\
+		.dst_reg = DST,					\
+		.src_reg = 0,					\
+		.off   = 0,					\
+		.imm   = IMM })
+
+#define BPF_MOV64_REG(DST, SRC)					\
+	((struct bpf_insn) {					\
+		.code  = BPF_ALU64 | BPF_MOV | BPF_X,		\
+		.dst_reg = DST,					\
+		.src_reg = SRC,					\
+		.off   = 0,					\
+		.imm   = 0 })
+
+#define BPF_LD_IMM64(DST, IMM)					\
+	BPF_LD_IMM64_RAW(DST, 0, IMM)
+
+#define BPF_LD_IMM64_RAW(DST, SRC, IMM)				\
+	((struct bpf_insn) {					\
+		.code  = BPF_LD | BPF_DW | BPF_IMM,		\
+		.dst_reg = DST,					\
+		.src_reg = SRC,					\
+		.off   = 0,					\
+		.imm   = (uint32_t) (IMM) }),			\
+	((struct bpf_insn) {					\
+		.code  = 0, /* zero is reserved opcode */	\
+		.dst_reg = 0,					\
+		.src_reg = 0,					\
+		.off   = 0,					\
+		.imm   = ((uint64_t) (IMM)) >> 32 })
+
+/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
+#define BPF_LD_MAP_FD(DST, MAP_FD)				\
+	BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
+
+#define BPF_ST_MEM(SIZE, DST, OFF, IMM)				\
+	((struct bpf_insn) {					\
+		.code  = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM,	\
+		.dst_reg = DST,					\
+		.src_reg = 0,					\
+		.off   = OFF,					\
+		.imm   = IMM })
+
+#define BPF_LDX_MEM(SIZE, DST, SRC, OFF)			\
+	((struct bpf_insn) {					\
+		.code  = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM,	\
+		.dst_reg = DST,					\
+		.src_reg = SRC,					\
+		.off   = OFF,					\
+		.imm   = 0 })
+
+#define BPF_STX_MEM(SIZE, DST, SRC, OFF)			\
+	((struct bpf_insn) {					\
+		.code  = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM,	\
+		.dst_reg = DST,					\
+		.src_reg = SRC,					\
+		.off   = OFF,					\
+		.imm   = 0 })
+
+#define BPF_JMP_IMM(OP, DST, IMM, OFF)				\
+	((struct bpf_insn) {					\
+		.code  = BPF_JMP | BPF_OP(OP) | BPF_K,		\
+		.dst_reg = DST,					\
+		.src_reg = 0,					\
+		.off   = OFF,					\
+		.imm   = IMM })
+
+#define BPF_MOV64_IMM(DST, IMM)					\
+	((struct bpf_insn) {					\
+		.code  = BPF_ALU64 | BPF_MOV | BPF_K,		\
+		.dst_reg = DST,					\
+		.src_reg = 0,					\
+		.off   = 0,					\
+		.imm   = IMM })
+
+#define BPF_MOV32_IMM(DST, IMM)					\
+	((struct bpf_insn) {					\
+		.code  = BPF_ALU | BPF_MOV | BPF_K,		\
+		.dst_reg = DST,					\
+		.src_reg = 0,					\
+		.off   = 0,					\
+		.imm   = IMM })
+
+#define BPF_EMIT_CALL(FUNC)					\
+	((struct bpf_insn) {					\
+		.code  = BPF_JMP | BPF_CALL,			\
+		.dst_reg = 0,					\
+		.src_reg = 0,					\
+		.off   = 0,					\
+		.imm   = ((FUNC) - BPF_FUNC_unspec) })
+
+#define BPF_EXIT_INSN()						\
+	((struct bpf_insn) {					\
+		.code  = BPF_JMP | BPF_EXIT,			\
+		.dst_reg = 0,					\
+		.src_reg = 0,					\
+		.off   = 0,					\
+		.imm   = 0 })
+
+/* End copy from tools/include/filter.h */
+
+/* Start copy from tools/lib/bpf  */
+inline uint64_t ptr_to_u64(const void *ptr)
+{
+	return (uint64_t) (unsigned long) ptr;
+}
+
+inline int bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size)
+{
+	return tst_syscall(__NR_bpf, cmd, attr, size);
+}
+/* End copy from tools/lib/bpf */
+
+#endif	/* BPF_H */
diff --git a/include/lapi/capability.h b/include/lapi/capability.h
new file mode 100644
index 0000000..8833f06
--- /dev/null
+++ b/include/lapi/capability.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ */
+
+#ifndef LAPI_CAPABILITY_H
+#define LAPI_CAPABILITY_H
+
+#include "config.h"
+
+#ifdef HAVE_SYS_CAPABILITY_H
+# include <sys/capability.h>
+/**
+ * Some old libcap-devel(1.96~2.16) define _LINUX_TYPES_H in
+ * sys/capability.h that makes ltp-lib cann't include linux/types.h
+ * essentially. Here undefine it if include such old header-file.
+ */
+# ifndef HAVE_NEWER_LIBCAP
+#  undef _LINUX_TYPES_H
+# endif
+#endif
+
+#ifndef CAP_NET_RAW
+# define CAP_NET_RAW          13
+#endif
+
+#ifndef CAP_SYS_ADMIN
+# define CAP_SYS_ADMIN        21
+#endif
+
+#ifndef CAP_AUDIT_READ
+# define CAP_AUDIT_READ       37
+#endif
+
+#ifndef CAP_TO_INDEX
+# define CAP_TO_INDEX(x)     ((x) >> 5)
+#endif
+
+#ifndef CAP_TO_MASK
+# define CAP_TO_MASK(x)      (1 << ((x) & 31))
+#endif
+
+#endif
diff --git a/testcases/kernel/timers/include/common_timers.h b/include/lapi/common_timers.h
similarity index 68%
rename from testcases/kernel/timers/include/common_timers.h
rename to include/lapi/common_timers.h
index 313cd41..df4196e 100644
--- a/testcases/kernel/timers/include/common_timers.h
+++ b/include/lapi/common_timers.h
@@ -7,27 +7,23 @@
 #ifndef __COMMON_TIMERS_H__
 #define __COMMON_TIMERS_H__
 
-#define CLEANUP cleanup
 #include "config.h"
 #include "lapi/syscalls.h"
+#include "lapi/posix_clocks.h"
 
 #ifndef NSEC_PER_SEC
 #define NSEC_PER_SEC (1000000000L)
 #endif
+
 clock_t clock_list[] = {
 	CLOCK_REALTIME,
 	CLOCK_MONOTONIC,
 	CLOCK_PROCESS_CPUTIME_ID,
 	CLOCK_THREAD_CPUTIME_ID,
-#if HAVE_CLOCK_MONOTONIC_RAW
-	CLOCK_MONOTONIC_RAW,
-#endif
-#if HAVE_CLOCK_REALTIME_COARSE
-	CLOCK_REALTIME_COARSE,
-#endif
-#if HAVE_CLOCK_MONOTONIC_COARSE
-	CLOCK_MONOTONIC_COARSE,
-#endif
+	CLOCK_BOOTTIME,
+	CLOCK_BOOTTIME_ALARM,
+	CLOCK_REALTIME_ALARM,
+	CLOCK_TAI,
 };
 /* CLOCKS_DEFINED is the number of clock sources defined for sure */
 #define CLOCKS_DEFINED (sizeof(clock_list) / sizeof(*clock_list))
@@ -40,25 +36,38 @@
 
 const char *get_clock_str(const int clock_id)
 {
-	switch(clock_id) {
+	switch (clock_id) {
 	CLOCK_TO_STR(CLOCK_REALTIME);
 	CLOCK_TO_STR(CLOCK_MONOTONIC);
 	CLOCK_TO_STR(CLOCK_PROCESS_CPUTIME_ID);
 	CLOCK_TO_STR(CLOCK_THREAD_CPUTIME_ID);
-#if HAVE_CLOCK_MONOTONIC_RAW
-	CLOCK_TO_STR(CLOCK_MONOTONIC_RAW);
-#endif
-#if HAVE_CLOCK_REALTIME_COARSE
-	CLOCK_TO_STR(CLOCK_REALTIME_COARSE);
-#endif
-#if HAVE_CLOCK_MONOTONIC_COARSE
-	CLOCK_TO_STR(CLOCK_MONOTONIC_COARSE);
-#endif
+	CLOCK_TO_STR(CLOCK_BOOTTIME);
+	CLOCK_TO_STR(CLOCK_BOOTTIME_ALARM);
+	CLOCK_TO_STR(CLOCK_REALTIME_ALARM);
+	CLOCK_TO_STR(CLOCK_TAI);
 	default:
 		return "CLOCK_!?!?!?";
 	}
 }
 
+int possibly_unsupported(clock_t clock)
+{
+	switch (clock) {
+	case CLOCK_BOOTTIME:
+	case CLOCK_BOOTTIME_ALARM:
+	case CLOCK_REALTIME_ALARM:
+	case CLOCK_TAI:
+			return 1;
+	default:
+			return 0;
+	}
+}
+
+int have_cputime_timers(void)
+{
+	return tst_kvercmp(2, 6, 12) >= 0;
+}
+
 #include "lapi/syscalls.h"
 
 #include <time.h>
diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index 42cb4f9..430d21f 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -1,13 +1,19 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Referred from linux kernel -github/torvalds/linux/include/uapi/linux/fs.h
+ * Referred from linux kernel include/uapi/linux/fs.h
+ * Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
  * Copyright (c) Zilogic Systems Pvt. Ltd., 2018
  * Email: code@zilogic.com
  */
+
 #ifdef HAVE_LINUX_FS_H
 # include <linux/fs.h>
 #endif
 
+#include <sys/user.h>
+#include <limits.h>
+#include "lapi/abisize.h"
+
 #ifndef LAPI_FS_H
 #define LAPI_FS_H
 
@@ -35,4 +41,26 @@
 #define FS_NODUMP_FL	   0x00000040 /* do not dump file */
 #endif
 
+/*
+ * Helper function to get MAX_LFS_FILESIZE.
+ * Missing PAGE_SHIFT on some libc prevents defining MAX_LFS_FILESIZE.
+ *
+ * 64 bit: macro taken from kernel from include/linux/fs.h
+ * 32 bit: own implementation
+ */
+static inline loff_t tst_max_lfs_filesize(void)
+{
+#ifdef TST_ABI64
+	return (loff_t)LLONG_MAX;
+#else
+        long page_size = getpagesize();
+        loff_t ret = ULONG_MAX;
+
+        while (page_size >>= 1)
+                ret <<= 1;
+
+        return ret;
+#endif
+}
+
 #endif
diff --git a/include/lapi/mmap.h b/include/lapi/mmap.h
index 18547c0..98b6ade 100644
--- a/include/lapi/mmap.h
+++ b/include/lapi/mmap.h
@@ -19,6 +19,8 @@
 #ifndef LAPI_MMAP_H__
 #define LAPI_MMAP_H__
 
+#include "config.h"
+
 #ifndef MAP_HUGETLB
 # define MAP_HUGETLB 0x40000
 #endif
diff --git a/include/lapi/posix_clocks.h b/include/lapi/posix_clocks.h
index 4914479..ae2139f 100644
--- a/include/lapi/posix_clocks.h
+++ b/include/lapi/posix_clocks.h
@@ -35,4 +35,8 @@
 # define CLOCK_BOOTTIME_ALARM 9
 #endif
 
+#ifndef CLOCK_TAI
+#define CLOCK_TAI 11
+#endif
+
 #endif /* POSIX_CLOCKS_H__ */
diff --git a/include/lapi/prctl.h b/include/lapi/prctl.h
index 6db8a64..4499df0 100644
--- a/include/lapi/prctl.h
+++ b/include/lapi/prctl.h
@@ -9,9 +9,47 @@
 
 #include <sys/prctl.h>
 
+#ifndef PR_SET_NAME
+# define PR_SET_NAME 15
+# define PR_GET_NAME 16
+#endif
+
+#ifndef PR_SET_SECCOMP
+# define PR_GET_SECCOMP  21
+# define PR_SET_SECCOMP  22
+#endif
+
+#ifndef PR_SET_TIMERSLACK
+# define PR_SET_TIMERSLACK 29
+# define PR_GET_TIMERSLACK 30
+#endif
+
 #ifndef PR_SET_CHILD_SUBREAPER
 # define PR_SET_CHILD_SUBREAPER	36
 # define PR_GET_CHILD_SUBREAPER	37
 #endif
 
+#ifndef PR_SET_NO_NEW_PRIVS
+# define PR_SET_NO_NEW_PRIVS 38
+# define PR_GET_NO_NEW_PRIVS 39
+#endif
+
+#ifndef PR_SET_THP_DISABLE
+# define PR_SET_THP_DISABLE 41
+# define PR_GET_THP_DISABLE 42
+#endif
+
+#ifndef PR_CAP_AMBIENT
+# define PR_CAP_AMBIENT             47
+# define PR_CAP_AMBIENT_IS_SET      1
+# define PR_CAP_AMBIENT_RAISE       2
+# define PR_CAP_AMBIENT_LOWER       3
+# define PR_CAP_AMBIENT_CLEAR_ALL   4
+#endif
+
+#ifndef PR_GET_SPECULATION_CTRL
+# define PR_GET_SPECULATION_CTRL 52
+# define PR_SET_SPECULATION_CTRL 53
+#endif
+
 #endif /* LAPI_PRCTL_H__ */
diff --git a/include/lapi/preadv2.h b/include/lapi/preadv2.h
index aacf96f..538ed72 100644
--- a/include/lapi/preadv2.h
+++ b/include/lapi/preadv2.h
@@ -10,6 +10,10 @@
 #include "config.h"
 #include "lapi/syscalls.h"
 
+#ifndef RWF_NOWAIT
+# define RWF_NOWAIT 0x00000008
+#endif
+
 #if !defined(HAVE_PREADV2)
 
 /* LO_HI_LONG taken from glibc */
diff --git a/include/lapi/quotactl.h b/include/lapi/quotactl.h
index 729472f..d3223b8 100644
--- a/include/lapi/quotactl.h
+++ b/include/lapi/quotactl.h
@@ -1,26 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) 2017 Fujitsu Ltd.
+ * Copyright (c) 2017-2019 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
+ * Author: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
  */
 
 #ifndef LAPI_QUOTACTL_H__
-# define LAPI_QUOTACTL_H__
+#define LAPI_QUOTACTL_H__
 
-# ifndef Q_XGETNEXTQUOTA
-#  define Q_XGETNEXTQUOTA XQM_CMD(9)
-# endif
+#include <sys/quota.h>
+
+#ifdef HAVE_STRUCT_IF_NEXTDQBLK
+# include <linux/quota.h>
+#else
+# include <stdint.h>
+struct if_nextdqblk {
+	uint64_t	dqb_bhardlimit;
+	uint64_t	dqb_bsoftlimit;
+	uint64_t	dqb_curspace;
+	uint64_t	dqb_ihardlimit;
+	uint64_t	dqb_isoftlimit;
+	uint64_t	dqb_curinodes;
+	uint64_t	dqb_btime;
+	uint64_t	dqb_itime;
+	uint32_t	dqb_valid;
+	uint32_t	dqb_id;
+};
+#endif /* HAVE_STRUCT_IF_NEXTDQBLK */
+
+#ifndef HAVE_STRUCT_FS_QUOTA_STATV
+# include <stdint.h>
+struct fs_qfilestatv {
+	uint64_t	qfs_ino;
+	uint64_t	qfs_nblks;
+	uint32_t	qfs_nextents;
+	uint32_t	qfs_pad;
+};
+
+struct fs_quota_statv {
+	int8_t			qs_version;
+	uint8_t			qs_pad1;
+	uint16_t		qs_flags;
+	uint32_t		qs_incoredqs;
+	struct fs_qfilestatv	qs_uquota;
+	struct fs_qfilestatv	qs_gquota;
+	struct fs_qfilestatv	qs_pquota;
+	int32_t			qs_btimelimit;
+	int32_t			qs_itimelimit;
+	int32_t			qs_rtbtimelimit;
+	uint16_t		qs_bwarnlimit;
+	uint16_t		qs_iwarnlimit;
+	uint64_t		qs_pad2[8];
+};
+# define FS_QSTATV_VERSION1 1
+#endif /* HAVE_STRUCT_FS_QUOTA_STATV */
+
+#ifndef PRJQUOTA
+# define PRJQUOTA 2
+#endif
+
+#ifndef Q_XGETQSTATV
+# define Q_XGETQSTATV XQM_CMD(8)
+#endif
+
+#ifndef Q_XGETNEXTQUOTA
+# define Q_XGETNEXTQUOTA XQM_CMD(9)
+#endif
+
+#ifndef Q_GETNEXTQUOTA
+# define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */
+#endif
 
 #endif /* LAPI_QUOTACTL_H__ */
diff --git a/include/lapi/rpc.h b/include/lapi/rpc.h
index a779a6d..c20a95b 100644
--- a/include/lapi/rpc.h
+++ b/include/lapi/rpc.h
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef LAPI_RPC_H__
diff --git a/include/lapi/seccomp.h b/include/lapi/seccomp.h
new file mode 100644
index 0000000..fe95cab
--- /dev/null
+++ b/include/lapi/seccomp.h
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+#ifndef LAPI_SECCOMP_H
+#define LAPI_SECCOMP_H
+
+#include <stdint.h>
+
+#ifdef HAVE_LINUX_SECCOMP_H
+# include <linux/seccomp.h>
+#else
+/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
+# define SECCOMP_MODE_DISABLED   0
+# define SECCOMP_MODE_STRICT     1
+# define SECCOMP_MODE_FILTER     2
+
+# define SECCOMP_RET_KILL_THREAD  0x00000000U /* kill the thread */
+# define SECCOMP_RET_KILL         SECCOMP_RET_KILL_THREAD
+# define SECCOMP_RET_ALLOW        0x7fff0000U /* allow */
+
+/**
+ * struct seccomp_data - the format the BPF program executes over.
+ * @nr: the system call number
+ * @arch: indicates system call convention as an AUDIT_ARCH_* value
+ *        as defined in <linux/audit.h>.
+ * @instruction_pointer: at the time of the system call.
+ * @args: up to 6 system call arguments always stored as 64-bit values
+ * regardless of the architecture.
+ */
+struct seccomp_data {
+	int nr;
+	uint32_t arch;
+	uint64_t instruction_pointer;
+	uint64_t args[6];
+};
+
+#endif /* HAVE_LINUX_SECCOMP_H*/
+#endif /* LAPI_SECCOMP_H */
diff --git a/include/lapi/securebits.h b/include/lapi/securebits.h
new file mode 100644
index 0000000..2da137c
--- /dev/null
+++ b/include/lapi/securebits.h
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+#ifndef LAPI_SECUREBITS_H
+#define LAPI_SECUREBITS_H
+
+# ifdef HAVE_LINUX_SECUREBITS_H
+#  include <linux/securebits.h>
+# endif
+
+# ifndef SECBIT_NO_CAP_AMBIENT_RAISE
+#  define SECBIT_NO_CAP_AMBIENT_RAISE  6
+# endif
+
+#endif /* LAPI_SECUREBITS_H */
diff --git a/include/lapi/socket.h b/include/lapi/socket.h
index 6d9e9fe..f32782f 100644
--- a/include/lapi/socket.h
+++ b/include/lapi/socket.h
@@ -38,6 +38,10 @@
 # define SO_BUSY_POLL	46
 #endif
 
+#ifndef SO_ATTACH_BPF
+# define SO_ATTACH_BPF  50
+#endif
+
 #ifndef SO_ZEROCOPY
 # define SO_ZEROCOPY	60
 #endif
diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
index 177dd01..0e00641 100644
--- a/include/lapi/syscalls/aarch64.in
+++ b/include/lapi/syscalls/aarch64.in
@@ -258,6 +258,7 @@
 kcmp 272
 getrandom 278
 memfd_create 279
+bpf 280
 userfaultfd 282
 membarrier 283
 execveat 281
@@ -265,4 +266,8 @@
 copy_file_range 285
 preadv2 286
 pwritev2 287
+pkey_mprotect 288
+pkey_alloc 289
+pkey_free 290
+pidfd_send_signal 424
 _sysctl 1078
diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in
index f4adedb..a6a594c 100644
--- a/include/lapi/syscalls/arm.in
+++ b/include/lapi/syscalls/arm.in
@@ -334,6 +334,7 @@
 fanotify_init (__NR_SYSCALL_BASE+367)
 fanotify_mark (__NR_SYSCALL_BASE+368)
 prlimit64 (__NR_SYSCALL_BASE+369)
+syncfs (__NR_SYSCALL_BASE+373)
 process_vm_readv (__NR_SYSCALL_BASE+376)
 process_vm_writev (__NR_SYSCALL_BASE+377)
 kcmp (__NR_SYSCALL_BASE+378)
@@ -349,4 +350,8 @@
 copy_file_range (__NR_SYSCALL_BASE+391)
 preadv2 (__NR_SYSCALL_BASE+392)
 pwritev2 (__NR_SYSCALL_BASE+393)
+pkey_mprotect (__NR_SYSCALL_BASE+394)
+pkey_alloc (__NR_SYSCALL_BASE+395)
+pkey_free (__NR_SYSCALL_BASE+396)
 statx (__NR_SYSCALL_BASE+397)
+pidfd_send_signal (__NR_SYSCALL_BASE+424)
diff --git a/include/lapi/syscalls/hppa.in b/include/lapi/syscalls/hppa.in
index a0dd230..d92f33f 100644
--- a/include/lapi/syscalls/hppa.in
+++ b/include/lapi/syscalls/hppa.in
@@ -16,6 +16,7 @@
 splice 291
 tee 293
 vmsplice 294
+syncfs 327
 process_vm_readv 330
 process_vm_writev 331
 memfd_create 340
@@ -25,3 +26,4 @@
 copy_file_range 346
 preadv2 347
 pwritev2 348
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index af5254f..bad6e40 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -332,6 +332,7 @@
 fanotify_init 338
 fanotify_mark 339
 prlimit64 340
+syncfs 344
 process_vm_readv 347
 process_vm_writev 348
 kcmp 349
@@ -340,6 +341,7 @@
 renameat2 354
 getrandom 355
 memfd_create 356
+bpf 357
 execveat 358
 userfaultfd 374
 membarrier 375
@@ -347,4 +349,8 @@
 copy_file_range 377
 preadv2 378
 pwritev2 379
+pkey_mprotect 380
+pkey_alloc 381
+pkey_free 382
 statx 383
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/ia64.in b/include/lapi/syscalls/ia64.in
index c0aeed0..0e6ba54 100644
--- a/include/lapi/syscalls/ia64.in
+++ b/include/lapi/syscalls/ia64.in
@@ -293,6 +293,7 @@
 fanotify_init 1323
 fanotify_mark 1324
 prlimit64 1325
+syncfs 1329
 process_vm_readv 1332
 process_vm_writev 1333
 renameat2 1338
@@ -305,3 +306,7 @@
 copy_file_range 1347
 preadv2 1348
 pwritev2 1349
+pkey_mprotect 1354
+pkey_alloc 1355
+pkey_free 1356
+pidfd_send_signal 1448
diff --git a/include/lapi/syscalls/mips_n32.in b/include/lapi/syscalls/mips_n32.in
new file mode 100644
index 0000000..25dc020
--- /dev/null
+++ b/include/lapi/syscalls/mips_n32.in
@@ -0,0 +1,363 @@
+read 0
+write 1
+open 2
+close 3
+stat 4
+fstat 5
+lstat 6
+poll 7
+lseek 8
+mmap 9
+mprotect 10
+munmap 11
+brk 12
+rt_sigaction 13
+rt_sigprocmask 14
+ioctl 15
+pread64 16
+pwrite64 17
+readv 18
+writev 19
+access 20
+pipe 21
+_newselect 22
+sched_yield 23
+mremap 24
+msync 25
+mincore 26
+madvise 27
+shmget 28
+shmat 29
+shmctl 30
+dup 31
+dup2 32
+pause 33
+nanosleep 34
+getitimer 35
+setitimer 36
+alarm 37
+getpid 38
+sendfile 39
+socket 40
+connect 41
+accept 42
+sendto 43
+recvfrom 44
+sendmsg 45
+recvmsg 46
+shutdown 47
+bind 48
+listen 49
+getsockname 50
+getpeername 51
+socketpair 52
+setsockopt 53
+getsockopt 54
+clone 55
+fork 56
+execve 57
+exit 58
+wait4 59
+kill 60
+uname 61
+semget 62
+semop 63
+semctl 64
+shmdt 65
+msgget 66
+msgsnd 67
+msgrcv 68
+msgctl 69
+fcntl 70
+flock 71
+fsync 72
+fdatasync 73
+truncate 74
+ftruncate 75
+getdents 76
+getcwd 77
+chdir 78
+fchdir 79
+rename 80
+mkdir 81
+rmdir 82
+creat 83
+link 84
+unlink 85
+symlink 86
+readlink 87
+chmod 88
+fchmod 89
+chown 90
+fchown 91
+lchown 92
+umask 93
+gettimeofday 94
+getrlimit 95
+getrusage 96
+sysinfo 97
+times 98
+ptrace 99
+getuid 100
+syslog 101
+getgid 102
+setuid 103
+setgid 104
+geteuid 105
+getegid 106
+setpgid 107
+getppid 108
+getpgrp 109
+setsid 110
+setreuid 111
+setregid 112
+getgroups 113
+setgroups 114
+setresuid 115
+getresuid 116
+setresgid 117
+getresgid 118
+getpgid 119
+setfsuid 120
+setfsgid 121
+getsid 122
+capget 123
+capset 124
+rt_sigpending 125
+rt_sigtimedwait 126
+rt_sigqueueinfo 127
+rt_sigsuspend 128
+sigaltstack 129
+utime 130
+mknod 131
+personality 132
+ustat 133
+statfs 134
+fstatfs 135
+sysfs 136
+getpriority 137
+setpriority 138
+sched_setparam 139
+sched_getparam 140
+sched_setscheduler 141
+sched_getscheduler 142
+sched_get_priority_max 143
+sched_get_priority_min 144
+sched_rr_get_interval 145
+mlock 146
+munlock 147
+mlockall 148
+munlockall 149
+vhangup 150
+pivot_root 151
+_sysctl 152
+prctl 153
+adjtimex 154
+setrlimit 155
+chroot 156
+sync 157
+acct 158
+settimeofday 159
+mount 160
+umount2 161
+swapon 162
+swapoff 163
+reboot 164
+sethostname 165
+setdomainname 166
+create_module 167
+init_module 168
+delete_module 169
+get_kernel_syms 170
+query_module 171
+quotactl 172
+nfsservctl 173
+getpmsg 174
+putpmsg 175
+afs_syscall 176
+reserved177 177
+gettid 178
+readahead 179
+setxattr 180
+lsetxattr 181
+fsetxattr 182
+getxattr 183
+lgetxattr 184
+fgetxattr 185
+listxattr 186
+llistxattr 187
+flistxattr 188
+removexattr 189
+lremovexattr 190
+fremovexattr 191
+tkill 192
+reserved193 193
+futex 194
+sched_setaffinity 195
+sched_getaffinity 196
+cacheflush 197
+cachectl 198
+sysmips 199
+io_setup 200
+io_destroy 201
+io_getevents 202
+io_submit 203
+io_cancel 204
+exit_group 205
+lookup_dcookie 206
+epoll_create 207
+epoll_ctl 208
+epoll_wait 209
+remap_file_pages 210
+rt_sigreturn 211
+fcntl64 212
+set_tid_address 213
+restart_syscall 214
+semtimedop 215
+fadvise64 216
+statfs64 217
+fstatfs64 218
+sendfile64 219
+timer_create 220
+timer_settime 221
+timer_gettime 222
+timer_getoverrun 223
+timer_delete 224
+clock_settime 225
+clock_gettime 226
+clock_getres 227
+clock_nanosleep 228
+tgkill 229
+utimes 230
+mbind 231
+get_mempolicy 232
+set_mempolicy 233
+mq_open 234
+mq_unlink 235
+mq_timedsend 236
+mq_timedreceive 237
+mq_notify 238
+mq_getsetattr 239
+vserver 240
+waitid 241
+add_key 243
+request_key 244
+keyctl 245
+set_thread_area 246
+inotify_init 247
+inotify_add_watch 248
+inotify_rm_watch 249
+migrate_pages 250
+openat 251
+mkdirat 252
+mknodat 253
+fchownat 254
+futimesat 255
+newfstatat 256
+unlinkat 257
+renameat 258
+linkat 259
+symlinkat 260
+readlinkat 261
+fchmodat 262
+faccessat 263
+pselect6 264
+ppoll 265
+unshare 266
+splice 267
+sync_file_range 268
+tee 269
+vmsplice 270
+move_pages 271
+set_robust_list 272
+get_robust_list 273
+kexec_load 274
+getcpu 275
+epoll_pwait 276
+ioprio_set 277
+ioprio_get 278
+utimensat 279
+signalfd 280
+timerfd 281
+eventfd 282
+fallocate 283
+timerfd_create 284
+timerfd_gettime 285
+timerfd_settime 286
+signalfd4 287
+eventfd2 288
+epoll_create1 289
+dup3 290
+pipe2 291
+inotify_init1 292
+preadv 293
+pwritev 294
+rt_tgsigqueueinfo 295
+perf_event_open 296
+accept4 297
+recvmmsg 298
+getdents64 299
+fanotify_init 300
+fanotify_mark 301
+prlimit64 302
+name_to_handle_at 303
+open_by_handle_at 304
+clock_adjtime 305
+syncfs 306
+sendmmsg 307
+setns 308
+process_vm_readv 309
+process_vm_writev 310
+kcmp 311
+finit_module 312
+sched_setattr 313
+sched_getattr 314
+renameat2 315
+seccomp 316
+getrandom 317
+memfd_create 318
+bpf 319
+execveat 320
+userfaultfd 321
+membarrier 322
+mlock2 323
+copy_file_range 324
+preadv2 325
+pwritev2 326
+pkey_mprotect 327
+pkey_alloc 328
+pkey_free 329
+statx 330
+rseq 331
+io_pgetevents 332
+clock_gettime64 403
+clock_settime64 404
+clock_adjtime64 405
+clock_getres_time64 406
+clock_nanosleep_time64 407
+timer_gettime64 408
+timer_settime64 409
+timerfd_gettime64 410
+timerfd_settime64 411
+utimensat_time64 412
+pselect6_time64 413
+ppoll_time64 414
+io_pgetevents_time64 416
+recvmmsg_time64 417
+mq_timedsend_time64 418
+mq_timedreceive_time64 419
+semtimedop_time64 420
+rt_sigtimedwait_time64 421
+futex_time64 422
+sched_rr_get_interval_time64 423
+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
diff --git a/include/lapi/syscalls/mips_n64.in b/include/lapi/syscalls/mips_n64.in
new file mode 100644
index 0000000..68ba6f1
--- /dev/null
+++ b/include/lapi/syscalls/mips_n64.in
@@ -0,0 +1,339 @@
+read 0
+write 1
+open 2
+close 3
+stat 4
+fstat 5
+lstat 6
+poll 7
+lseek 8
+mmap 9
+mprotect 10
+munmap 11
+brk 12
+rt_sigaction 13
+rt_sigprocmask 14
+ioctl 15
+pread64 16
+pwrite64 17
+readv 18
+writev 19
+access 20
+pipe 21
+_newselect 22
+sched_yield 23
+mremap 24
+msync 25
+mincore 26
+madvise 27
+shmget 28
+shmat 29
+shmctl 30
+dup 31
+dup2 32
+pause 33
+nanosleep 34
+getitimer 35
+setitimer 36
+alarm 37
+getpid 38
+sendfile 39
+socket 40
+connect 41
+accept 42
+sendto 43
+recvfrom 44
+sendmsg 45
+recvmsg 46
+shutdown 47
+bind 48
+listen 49
+getsockname 50
+getpeername 51
+socketpair 52
+setsockopt 53
+getsockopt 54
+clone 55
+fork 56
+execve 57
+exit 58
+wait4 59
+kill 60
+uname 61
+semget 62
+semop 63
+semctl 64
+shmdt 65
+msgget 66
+msgsnd 67
+msgrcv 68
+msgctl 69
+fcntl 70
+flock 71
+fsync 72
+fdatasync 73
+truncate 74
+ftruncate 75
+getdents 76
+getcwd 77
+chdir 78
+fchdir 79
+rename 80
+mkdir 81
+rmdir 82
+creat 83
+link 84
+unlink 85
+symlink 86
+readlink 87
+chmod 88
+fchmod 89
+chown 90
+fchown 91
+lchown 92
+umask 93
+gettimeofday 94
+getrlimit 95
+getrusage 96
+sysinfo 97
+times 98
+ptrace 99
+getuid 100
+syslog 101
+getgid 102
+setuid 103
+setgid 104
+geteuid 105
+getegid 106
+setpgid 107
+getppid 108
+getpgrp 109
+setsid 110
+setreuid 111
+setregid 112
+getgroups 113
+setgroups 114
+setresuid 115
+getresuid 116
+setresgid 117
+getresgid 118
+getpgid 119
+setfsuid 120
+setfsgid 121
+getsid 122
+capget 123
+capset 124
+rt_sigpending 125
+rt_sigtimedwait 126
+rt_sigqueueinfo 127
+rt_sigsuspend 128
+sigaltstack 129
+utime 130
+mknod 131
+personality 132
+ustat 133
+statfs 134
+fstatfs 135
+sysfs 136
+getpriority 137
+setpriority 138
+sched_setparam 139
+sched_getparam 140
+sched_setscheduler 141
+sched_getscheduler 142
+sched_get_priority_max 143
+sched_get_priority_min 144
+sched_rr_get_interval 145
+mlock 146
+munlock 147
+mlockall 148
+munlockall 149
+vhangup 150
+pivot_root 151
+_sysctl 152
+prctl 153
+adjtimex 154
+setrlimit 155
+chroot 156
+sync 157
+acct 158
+settimeofday 159
+mount 160
+umount2 161
+swapon 162
+swapoff 163
+reboot 164
+sethostname 165
+setdomainname 166
+create_module 167
+init_module 168
+delete_module 169
+get_kernel_syms 170
+query_module 171
+quotactl 172
+nfsservctl 173
+getpmsg 174
+putpmsg 175
+afs_syscall 176
+reserved177 177
+gettid 178
+readahead 179
+setxattr 180
+lsetxattr 181
+fsetxattr 182
+getxattr 183
+lgetxattr 184
+fgetxattr 185
+listxattr 186
+llistxattr 187
+flistxattr 188
+removexattr 189
+lremovexattr 190
+fremovexattr 191
+tkill 192
+reserved193 193
+futex 194
+sched_setaffinity 195
+sched_getaffinity 196
+cacheflush 197
+cachectl 198
+sysmips 199
+io_setup 200
+io_destroy 201
+io_getevents 202
+io_submit 203
+io_cancel 204
+exit_group 205
+lookup_dcookie 206
+epoll_create 207
+epoll_ctl 208
+epoll_wait 209
+remap_file_pages 210
+rt_sigreturn 211
+set_tid_address 212
+restart_syscall 213
+semtimedop 214
+fadvise64 215
+timer_create 216
+timer_settime 217
+timer_gettime 218
+timer_getoverrun 219
+timer_delete 220
+clock_settime 221
+clock_gettime 222
+clock_getres 223
+clock_nanosleep 224
+tgkill 225
+utimes 226
+mbind 227
+get_mempolicy 228
+set_mempolicy 229
+mq_open 230
+mq_unlink 231
+mq_timedsend 232
+mq_timedreceive 233
+mq_notify 234
+mq_getsetattr 235
+vserver 236
+waitid 237
+add_key 239
+request_key 240
+keyctl 241
+set_thread_area 242
+inotify_init 243
+inotify_add_watch 244
+inotify_rm_watch 245
+migrate_pages 246
+openat 247
+mkdirat 248
+mknodat 249
+fchownat 250
+futimesat 251
+newfstatat 252
+unlinkat 253
+renameat 254
+linkat 255
+symlinkat 256
+readlinkat 257
+fchmodat 258
+faccessat 259
+pselect6 260
+ppoll 261
+unshare 262
+splice 263
+sync_file_range 264
+tee 265
+vmsplice 266
+move_pages 267
+set_robust_list 268
+get_robust_list 269
+kexec_load 270
+getcpu 271
+epoll_pwait 272
+ioprio_set 273
+ioprio_get 274
+utimensat 275
+signalfd 276
+timerfd 277
+eventfd 278
+fallocate 279
+timerfd_create 280
+timerfd_gettime 281
+timerfd_settime 282
+signalfd4 283
+eventfd2 284
+epoll_create1 285
+dup3 286
+pipe2 287
+inotify_init1 288
+preadv 289
+pwritev 290
+rt_tgsigqueueinfo 291
+perf_event_open 292
+accept4 293
+recvmmsg 294
+fanotify_init 295
+fanotify_mark 296
+prlimit64 297
+name_to_handle_at 298
+open_by_handle_at 299
+clock_adjtime 300
+syncfs 301
+sendmmsg 302
+setns 303
+process_vm_readv 304
+process_vm_writev 305
+kcmp 306
+finit_module 307
+getdents64 308
+sched_setattr 309
+sched_getattr 310
+renameat2 311
+seccomp 312
+getrandom 313
+memfd_create 314
+bpf 315
+execveat 316
+userfaultfd 317
+membarrier 318
+mlock2 319
+copy_file_range 320
+preadv2 321
+pwritev2 322
+pkey_mprotect 323
+pkey_alloc 324
+pkey_free 325
+statx 326
+rseq 327
+io_pgetevents 328
+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
diff --git a/include/lapi/syscalls/mips_o32.in b/include/lapi/syscalls/mips_o32.in
new file mode 100644
index 0000000..505bfd8
--- /dev/null
+++ b/include/lapi/syscalls/mips_o32.in
@@ -0,0 +1,409 @@
+syscall 0
+exit 1
+fork 2
+read 3
+write 4
+open 5
+close 6
+waitpid 7
+creat 8
+link 9
+unlink 10
+execve 11
+chdir 12
+time 13
+mknod 14
+chmod 15
+lchown 16
+break 17
+unused18 18
+lseek 19
+getpid 20
+mount 21
+umount 22
+setuid 23
+getuid 24
+stime 25
+ptrace 26
+alarm 27
+unused28 28
+pause 29
+utime 30
+stty 31
+gtty 32
+access 33
+nice 34
+ftime 35
+sync 36
+kill 37
+rename 38
+mkdir 39
+rmdir 40
+dup 41
+pipe 42
+times 43
+prof 44
+brk 45
+setgid 46
+getgid 47
+signal 48
+geteuid 49
+getegid 50
+acct 51
+umount2 52
+lock 53
+ioctl 54
+fcntl 55
+mpx 56
+setpgid 57
+ulimit 58
+unused59 59
+umask 60
+chroot 61
+ustat 62
+dup2 63
+getppid 64
+getpgrp 65
+setsid 66
+sigaction 67
+sgetmask 68
+ssetmask 69
+setreuid 70
+setregid 71
+sigsuspend 72
+sigpending 73
+sethostname 74
+setrlimit 75
+getrlimit 76
+getrusage 77
+gettimeofday 78
+settimeofday 79
+getgroups 80
+setgroups 81
+reserved82 82
+symlink 83
+unused84 84
+readlink 85
+uselib 86
+swapon 87
+reboot 88
+readdir 89
+mmap 90
+munmap 91
+truncate 92
+ftruncate 93
+fchmod 94
+fchown 95
+getpriority 96
+setpriority 97
+profil 98
+statfs 99
+fstatfs 100
+ioperm 101
+socketcall 102
+syslog 103
+setitimer 104
+getitimer 105
+stat 106
+lstat 107
+fstat 108
+unused109 109
+iopl 110
+vhangup 111
+idle 112
+vm86 113
+wait4 114
+swapoff 115
+sysinfo 116
+ipc 117
+fsync 118
+sigreturn 119
+clone 120
+setdomainname 121
+uname 122
+modify_ldt 123
+adjtimex 124
+mprotect 125
+sigprocmask 126
+create_module 127
+init_module 128
+delete_module 129
+get_kernel_syms 130
+quotactl 131
+getpgid 132
+fchdir 133
+bdflush 134
+sysfs 135
+personality 136
+afs_syscall 137
+setfsuid 138
+setfsgid 139
+_llseek 140
+getdents 141
+_newselect 142
+flock 143
+msync 144
+readv 145
+writev 146
+cacheflush 147
+cachectl 148
+sysmips 149
+unused150 150
+getsid 151
+fdatasync 152
+_sysctl 153
+mlock 154
+munlock 155
+mlockall 156
+munlockall 157
+sched_setparam 158
+sched_getparam 159
+sched_setscheduler 160
+sched_getscheduler 161
+sched_yield 162
+sched_get_priority_max 163
+sched_get_priority_min 164
+sched_rr_get_interval 165
+nanosleep 166
+mremap 167
+accept 168
+bind 169
+connect 170
+getpeername 171
+getsockname 172
+getsockopt 173
+listen 174
+recv 175
+recvfrom 176
+recvmsg 177
+send 178
+sendmsg 179
+sendto 180
+setsockopt 181
+shutdown 182
+socket 183
+socketpair 184
+setresuid 185
+getresuid 186
+query_module 187
+poll 188
+nfsservctl 189
+setresgid 190
+getresgid 191
+prctl 192
+rt_sigreturn 193
+rt_sigaction 194
+rt_sigprocmask 195
+rt_sigpending 196
+rt_sigtimedwait 197
+rt_sigqueueinfo 198
+rt_sigsuspend 199
+pread64 200
+pwrite64 201
+chown 202
+getcwd 203
+capget 204
+capset 205
+sigaltstack 206
+sendfile 207
+getpmsg 208
+putpmsg 209
+mmap2 210
+truncate64 211
+ftruncate64 212
+stat64 213
+lstat64 214
+fstat64 215
+pivot_root 216
+mincore 217
+madvise 218
+getdents64 219
+fcntl64 220
+reserved221 221
+gettid 222
+readahead 223
+setxattr 224
+lsetxattr 225
+fsetxattr 226
+getxattr 227
+lgetxattr 228
+fgetxattr 229
+listxattr 230
+llistxattr 231
+flistxattr 232
+removexattr 233
+lremovexattr 234
+fremovexattr 235
+tkill 236
+sendfile64 237
+futex 238
+sched_setaffinity 239
+sched_getaffinity 240
+io_setup 241
+io_destroy 242
+io_getevents 243
+io_submit 244
+io_cancel 245
+exit_group 246
+lookup_dcookie 247
+epoll_create 248
+epoll_ctl 249
+epoll_wait 250
+remap_file_pages 251
+set_tid_address 252
+restart_syscall 253
+fadvise64 254
+statfs64 255
+fstatfs64 256
+timer_create 257
+timer_settime 258
+timer_gettime 259
+timer_getoverrun 260
+timer_delete 261
+clock_settime 262
+clock_gettime 263
+clock_getres 264
+clock_nanosleep 265
+tgkill 266
+utimes 267
+mbind 268
+get_mempolicy 269
+set_mempolicy 270
+mq_open 271
+mq_unlink 272
+mq_timedsend 273
+mq_timedreceive 274
+mq_notify 275
+mq_getsetattr 276
+vserver 277
+waitid 278
+add_key 280
+request_key 281
+keyctl 282
+set_thread_area 283
+inotify_init 284
+inotify_add_watch 285
+inotify_rm_watch 286
+migrate_pages 287
+openat 288
+mkdirat 289
+mknodat 290
+fchownat 291
+futimesat 292
+fstatat64 293
+unlinkat 294
+renameat 295
+linkat 296
+symlinkat 297
+readlinkat 298
+fchmodat 299
+faccessat 300
+pselect6 301
+ppoll 302
+unshare 303
+splice 304
+sync_file_range 305
+tee 306
+vmsplice 307
+move_pages 308
+set_robust_list 309
+get_robust_list 310
+kexec_load 311
+getcpu 312
+epoll_pwait 313
+ioprio_set 314
+ioprio_get 315
+utimensat 316
+signalfd 317
+timerfd 318
+eventfd 319
+fallocate 320
+timerfd_create 321
+timerfd_gettime 322
+timerfd_settime 323
+signalfd4 324
+eventfd2 325
+epoll_create1 326
+dup3 327
+pipe2 328
+inotify_init1 329
+preadv 330
+pwritev 331
+rt_tgsigqueueinfo 332
+perf_event_open 333
+accept4 334
+recvmmsg 335
+fanotify_init 336
+fanotify_mark 337
+prlimit64 338
+name_to_handle_at 339
+open_by_handle_at 340
+clock_adjtime 341
+syncfs 342
+sendmmsg 343
+setns 344
+process_vm_readv 345
+process_vm_writev 346
+kcmp 347
+finit_module 348
+sched_setattr 349
+sched_getattr 350
+renameat2 351
+seccomp 352
+getrandom 353
+memfd_create 354
+bpf 355
+execveat 356
+userfaultfd 357
+membarrier 358
+mlock2 359
+copy_file_range 360
+preadv2 361
+pwritev2 362
+pkey_mprotect 363
+pkey_alloc 364
+pkey_free 365
+statx 366
+rseq 367
+io_pgetevents 368
+semget 393
+semctl 394
+shmget 395
+shmctl 396
+shmat 397
+shmdt 398
+msgget 399
+msgsnd 400
+msgrcv 401
+msgctl 402
+clock_gettime64 403
+clock_settime64 404
+clock_adjtime64 405
+clock_getres_time64 406
+clock_nanosleep_time64 407
+timer_gettime64 408
+timer_settime64 409
+timerfd_gettime64 410
+timerfd_settime64 411
+utimensat_time64 412
+pselect6_time64 413
+ppoll_time64 414
+io_pgetevents_time64 416
+recvmmsg_time64 417
+mq_timedsend_time64 418
+mq_timedreceive_time64 419
+semtimedop_time64 420
+rt_sigtimedwait_time64 421
+futex_time64 422
+sched_rr_get_interval_time64 423
+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
diff --git a/include/lapi/syscalls/order b/include/lapi/syscalls/order
index 5455cbc..62352c7 100644
--- a/include/lapi/syscalls/order
+++ b/include/lapi/syscalls/order
@@ -3,6 +3,9 @@
 hppa
 i386
 ia64
+mips_n32
+mips_n64
+mips_o32
 powerpc64
 powerpc
 s390x
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index 6b6be58..91467f3 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -339,6 +339,7 @@
 recvmmsg 343
 accept4 344
 syscalls 345
+syncfs 348
 process_vm_readv  351
 process_vm_writev 352
 kcmp 354
@@ -355,3 +356,7 @@
 preadv2 380
 pwritev2 381
 statx 383
+pidfd_send_signal 424
+pkey_mprotect 386
+pkey_alloc 384
+pkey_free 385
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index 6b6be58..91467f3 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -339,6 +339,7 @@
 recvmmsg 343
 accept4 344
 syscalls 345
+syncfs 348
 process_vm_readv  351
 process_vm_writev 352
 kcmp 354
@@ -355,3 +356,7 @@
 preadv2 380
 pwritev2 381
 statx 383
+pidfd_send_signal 424
+pkey_mprotect 386
+pkey_alloc 384
+pkey_free 385
diff --git a/include/lapi/syscalls/regen.sh b/include/lapi/syscalls/regen.sh
index 425fe15..b6fb0f8 100755
--- a/include/lapi/syscalls/regen.sh
+++ b/include/lapi/syscalls/regen.sh
@@ -88,6 +88,9 @@
 		sparc64) echo "#if defined(__sparc__) && defined(__arch64__)" ;;
 		sparc) echo "#if defined(__sparc__) && !defined(__arch64__)" ;;
 		s390) echo "#if defined(__s390__) && !defined(__s390x__)" ;;
+		mips_n32) echo "#if defined(__mips__) && defined(_ABIN32)" ;;
+		mips_n64) echo "#if defined(__mips__) && defined(_ABI64)" ;;
+		mips_o32) echo "#if defined(__mips__) && defined(_ABIO32)" ;;
 		*) echo "#ifdef __${arch}__" ;;
 	esac
 	while read line ; do
diff --git a/include/lapi/syscalls/s390.in b/include/lapi/syscalls/s390.in
index 2a2ffe2..dcf0a71 100644
--- a/include/lapi/syscalls/s390.in
+++ b/include/lapi/syscalls/s390.in
@@ -323,6 +323,7 @@
 setfsuid 215
 setfsgid 216
 newfstatat 293
+syncfs 338
 process_vm_readv 340
 process_vm_writev 341
 kcmp 343
@@ -331,6 +332,7 @@
 renameat2 347
 getrandom 349
 memfd_create 350
+bpf 351
 userfaultfd 355
 membarrier 356
 execveat 354
@@ -338,3 +340,7 @@
 copy_file_range 375
 preadv2 376
 pwritev2 377
+pkey_mprotect 384
+pkey_alloc 385
+pkey_free 386
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index 4c36ce1..2dce00f 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -322,6 +322,7 @@
 setfsuid 215
 setfsgid 216
 newfstatat 293
+syncfs 338
 process_vm_readv 340
 process_vm_writev 341
 kcmp 343
@@ -337,3 +338,7 @@
 copy_file_range 375
 preadv2 376
 pwritev2 377
+pkey_mprotect 384
+pkey_alloc 385
+pkey_free 386
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index a942fb5..996ebc9 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -360,6 +360,7 @@
 fanotify_init 367
 fanotify_mark 368
 prlimit64 369
+syncfs 373
 process_vm_readv 376
 process_vm_writev 377
 kcmp 378
@@ -369,3 +370,4 @@
 copy_file_range 391
 preadv2 392
 pwritev2 393
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index 20dc37b..65902e0 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -330,12 +330,14 @@
 fanotify_init 329
 fanotify_mark 330
 prlimit64 331
+syncfs 335
 process_vm_readv 338
 process_vm_writev 339
 kcmp 341
 renameat2 345
 getrandom 347
 memfd_create 348
+bpf 349
 membarrier 351
 userfaultfd 352
 execveat 350
@@ -343,3 +345,7 @@
 copy_file_range 357
 preadv2 358
 pwritev2 359
+pkey_mprotect 362
+pkey_alloc 363
+pkey_free 364
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index c100b8e..d303622 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -306,6 +306,7 @@
 fanotify_init 329
 fanotify_mark 330
 prlimit64 331
+syncfs 335
 process_vm_readv 338
 process_vm_writev 339
 kcmp 341
@@ -319,3 +320,7 @@
 copy_file_range 357
 preadv2 358
 pwritev2 359
+pkey_mprotect 362
+pkey_alloc 363
+pkey_free 364
+pidfd_send_signal 424
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index 87849e5..3e9e19a 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -299,6 +299,7 @@
 fanotify_init 300
 fanotify_mark 301
 prlimit64 302
+syncfs 306
 process_vm_readv 310
 process_vm_writev 311
 kcmp 312
@@ -307,6 +308,7 @@
 renameat2 316
 getrandom 318
 memfd_create 319
+bpf 321
 execveat 322
 userfaultfd 323
 membarrier 324
@@ -314,4 +316,8 @@
 copy_file_range 326
 preadv2 327
 pwritev2 328
+pkey_mprotect 329
+pkey_alloc 330
+pkey_free 331
 statx 332
+pidfd_send_signal 424
diff --git a/include/lapi/ustat.h b/include/lapi/ustat.h
index 12c0735..98633e7 100644
--- a/include/lapi/ustat.h
+++ b/include/lapi/ustat.h
@@ -9,9 +9,10 @@
 
 #ifdef HAVE_SYS_USTAT_H
 # include <sys/ustat.h>
-#else
+#elif HAVE_LINUX_TYPES_H
+# include <linux/types.h>
 struct ustat {
-	daddr_t f_tfree;
+	__kernel_daddr_t f_tfree;
 	ino_t f_tinode;
 	char f_fname[6];
 	char f_fpack[6];
diff --git a/include/lapi/utsname.h b/include/lapi/utsname.h
new file mode 100644
index 0000000..6209eac
--- /dev/null
+++ b/include/lapi/utsname.h
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+ */
+
+#ifdef HAVE_SYS_UTSNAME_H
+# include <sys/utsname.h>
+#endif
+
+#ifndef _UTSNAME_LENGTH
+# define _UTSNAME_LENGTH 65
+#endif
+
+#ifndef _UTSNAME_DOMAIN_LENGTH
+# define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH
+#endif
diff --git a/include/mk/config.mk.default b/include/mk/config.mk.default
deleted file mode 100644
index 0934d94..0000000
--- a/include/mk/config.mk.default
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-#    config.mk.in.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    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.
-#
-# Ngie Cooper, July 2009
-#
-
-# See this page for more info about LEX*:
-# http://www.gnu.org/software/hello/manual/autoconf/Particular-Programs.html
-
-# Application specifying variables. You should never have to change these.
-AR			:= $(CROSS_COMPILE)ar
-CC			:= $(CROSS_COMPILE)cc
-LEX			:= flex
-RANLIB			:= $(CROSS_COMPILE)ranlib
-STRIP			:= $(CROSS_COMPILE)strip
-YACC			:= bison -y
-
-#JAR			:= jar
-#JAVAC			:= javac
-
-#AIO_LIBS		:= -laio
-#CAP_LIBS		:= -lcap
-#ACL_LIBS		:= -lacl
-#CRYPTO_LIBS		:= -lcrypto
-#LEXLIB			:= -lfl
-#NUMA_LIBS		:= -lnuma
-#SELINUX_LIBS		:= -lselinux
-#TIRPC_CPPFLAGS		:= -I/usr/include/tirpc
-#TIRPC_LIBS		:= -ltirpc
-
-prefix			:= /opt/ltp
-
-datarootdir		:= ${prefix}/share
-includedir		:= ${prefix}/include
-exec_prefix		:= ${prefix}
-bindir			:= ${exec_prefix}/bin
-libdir			:= ${exec_prefix}/lib
-mandir			:= ${datarootdir}/man
-
-CPPFLAGS		:=
-CFLAGS			:= -g -O2
-LDLIBS			:=
-LDFLAGS			:=
-
-DEBUG_CFLAGS		?= -g
-DEBUG_CXXFLAGS		?= $(DEBUG_CFLAGS)
-
-# Please see README.mk-devel about -fstrict-aliasing.
-OPT_CFLAGS		?= -O2 -fno-strict-aliasing -pipe
-OPT_CXXFLAGS		?= $(OPT_CFLAGS)
-
-WCFLAGS			?= -Wall
-WCXXFLAGS		?= $(WCFLAGS)
-
-LDFLAGS			+= $(WLDFLAGS)
-CFLAGS			+= $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
-CXXFLAGS		+= $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
-
-LINUX_VERSION		:=
-LINUX_DIR		:=
-LINUX_VERSION_MAJOR	:=
-LINUX_VERSION_PATCH	:=
-WITH_MODULES		:= no
-
-export datarootdir includedir libdir mandir prefix
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index d55fe96..0bc5988 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -63,18 +63,14 @@
 LDFLAGS			:= @LDFLAGS@
 
 DEBUG_CFLAGS		?= -g
-DEBUG_CXXFLAGS		?= $(DEBUG_CFLAGS)
 
 # Please see README.mk-devel about -fstrict-aliasing.
 OPT_CFLAGS		?= -O2 -fno-strict-aliasing -pipe
-OPT_CXXFLAGS		?= $(OPT_CFLAGS)
 
 WCFLAGS			?= -Wall -W @GCC_WARN_OLDSTYLE@
-WCXXFLAGS		?= $(WCFLAGS)
 
 LDFLAGS			+= $(WLDFLAGS)
 CFLAGS			+= $(DEBUG_CFLAGS) $(OPT_CFLAGS) $(WCFLAGS)
-CXXFLAGS		+= $(DEBUG_CXXFLAGS) $(OPT_CXXFLAGS) $(WCXXFLAGS)
 
 LINUX_VERSION		:= @LINUX_VERSION@
 LINUX_DIR		:= @LINUX_DIR@
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index 913bdf5..f4169ad 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -42,10 +42,6 @@
 endif
 
 ifeq ($(ANDROID),1)
-# There are many undeclared functions, it's best not to accidentally overlook
-# them.
-CFLAGS				+= -Werror-implicit-function-declaration
-
 LDFLAGS				+= -L$(top_builddir)/lib/android_libpthread
 LDFLAGS				+= -L$(top_builddir)/lib/android_librt
 endif
diff --git a/include/mk/features.mk.default b/include/mk/features.mk.default
deleted file mode 100644
index 94b8b0c..0000000
--- a/include/mk/features.mk.default
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-#    features.mk.default - feature tuning include Makefile.
-#
-#    Copyright (C) 2010, Linux Test Project.
-#
-#    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.
-#
-# Ngie Cooper, October 2010
-#
-
-# Tools enable knobs
-WITH_EXPECT			:= no
-
-WITH_PERL			:= no
-
-WITH_PYTHON			:= no
-
-# Features knobs
-
-# Is securebits[.h], et all support available?
-HAVE_SECUREBITS			:= no
-
-# Test suite knobs
-
-# Enable testcases/kernel/power_management's compile and install?
-ifeq ($(UCLINUX),1)
-WITH_POWER_MANAGEMENT_TESTSUITE	:= no
-else
-WITH_POWER_MANAGEMENT_TESTSUITE	:= yes
-endif
-
-# Enable testcases/open_posix_testsuite's compile and install?
-WITH_OPEN_POSIX_TESTSUITE	:= no
-
-# Enable testcases/realtime's compile and install?
-ifeq ($(UCLINUX),1)
-WITH_REALTIME_TESTSUITE		:= no
-else
-WITH_REALTIME_TESTSUITE		:= no
-endif
diff --git a/include/mk/features.mk.in b/include/mk/features.mk.in
index 7536b6f..8e561b7 100644
--- a/include/mk/features.mk.in
+++ b/include/mk/features.mk.in
@@ -29,9 +29,6 @@
 
 # Features knobs
 
-# Is securebits[.h], et all support available?
-HAVE_SECUREBITS			:= @HAVE_SECUREBITS@
-
 # Test suite knobs
 
 # Enable testcases/kernel/power_management's compile and install?
diff --git a/include/safe_file_ops_fn.h b/include/safe_file_ops_fn.h
index 35ec4fb..052fb1b 100644
--- a/include/safe_file_ops_fn.h
+++ b/include/safe_file_ops_fn.h
@@ -76,4 +76,8 @@
 		const char *pathname,
 		mode_t mode, const struct timespec times[2]);
 
+/* helper functions to setup overlayfs mountpoint */
+void create_overlay_dirs(void);
+int mount_overlay(const char *file, const int lineno, int skip);
+
 #endif /* SAFE_FILE_OPS_FN */
diff --git a/include/safe_net_fn.h b/include/safe_net_fn.h
index fdbb379..2fda11f 100644
--- a/include/safe_net_fn.h
+++ b/include/safe_net_fn.h
@@ -57,6 +57,9 @@
 int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void),
 		int socket, int backlog);
 
+int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void),
+		int sockfd, struct sockaddr *addr, socklen_t *addrlen);
+
 int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void),
 		 int sockfd, const struct sockaddr *addr, socklen_t addrlen);
 
diff --git a/include/tst_buffers.h b/include/tst_buffers.h
new file mode 100644
index 0000000..d19ac8c
--- /dev/null
+++ b/include/tst_buffers.h
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef TST_BUFFERS_H__
+#define TST_BUFFERS_H__
+
+/*
+ * Buffer description consist of a pointer to a pointer and buffer type/size
+ * encoded as a different structure members.
+ *
+ * Only one of the size and iov_sizes can be set at a time.
+ */
+struct tst_buffers {
+	/*
+	 * This pointer points to a buffer pointer.
+	 */
+	void *ptr;
+	/*
+	 * Buffer size.
+	 */
+	size_t size;
+	/*
+	 * Array of iov buffer sizes terminated by -1.
+	 */
+	int *iov_sizes;
+};
+
+/*
+ * Allocates buffers based on the tst_buffers structure.
+ *
+ * @bufs NULL terminated array of test buffer descriptions.
+ *
+ * This is called from the test library if the tst_test->bufs pointer is set.
+ */
+void tst_buffers_alloc(struct tst_buffers bufs[]);
+
+/*
+ * strdup() that callls tst_alloc().
+ */
+char *tst_strdup(const char *str);
+
+/*
+ * Allocates size bytes, returns pointer to the allocated buffer.
+ */
+void *tst_alloc(size_t size);
+
+/*
+ * Allocates iovec structure including the buffers.
+ *
+ * @sizes -1 terminated array of buffer sizes.
+ */
+struct iovec *tst_iovec_alloc(int sizes[]);
+
+/*
+ * Frees all allocated buffers.
+ *
+ * This is called at the end of the test automatically.
+ */
+void tst_free_all(void);
+
+#endif	/* TST_BUFFERS_H__ */
diff --git a/include/tst_capability.h b/include/tst_capability.h
new file mode 100644
index 0000000..6067804
--- /dev/null
+++ b/include/tst_capability.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ */
+/**
+ * @file tst_capability.h
+ *
+ * Limited capability operations without libcap.
+ */
+
+#ifndef TST_CAPABILITY_H
+#define TST_CAPABILITY_H
+
+#include <stdint.h>
+
+#include "lapi/capability.h"
+
+#define TST_CAP_DROP 1
+#define TST_CAP_REQ  (1 << 1)
+
+#define TST_CAP(action, capability) {action, capability, #capability}
+
+struct tst_cap_user_header {
+	uint32_t version;
+	int pid;
+};
+
+struct tst_cap_user_data {
+	uint32_t effective;
+	uint32_t permitted;
+	uint32_t inheritable;
+};
+
+struct tst_cap {
+	uint32_t action;
+	uint32_t id;
+	char *name;
+};
+
+/**
+ * Get the capabilities as decided by hdr.
+ *
+ * Note that the memory pointed to by data should be large enough to store two
+ * structs.
+ */
+int tst_capget(struct tst_cap_user_header *hdr,
+	       struct tst_cap_user_data *data);
+
+/**
+ * Set the capabilities as decided by hdr and data
+ *
+ * Note that the memory pointed to by data should be large enough to store two
+ * structs.
+ */
+int tst_capset(struct tst_cap_user_header *hdr,
+	       const struct tst_cap_user_data *data);
+
+/**
+ * Add, check or remove a capability
+ *
+ * It will attempt to drop or add capability to the effective set. It will
+ * try to detect if this is needed and whether it can or can't be done. If it
+ * clearly can not add a privilege to the effective set then it will return
+ * TCONF. However it may fail for some other reason and return TBROK.
+ *
+ * This only tries to change the effective set. Some tests may need to change
+ * the inheritable and ambient sets, so that child processes retain some
+ * capability.
+ */
+void tst_cap_action(struct tst_cap *cap);
+
+
+/**
+ * Add, check or remove a capabilities
+ *
+ * Takes a NULL terminated array of structs which describe whether some
+ * capabilities are needed or not and mask that determines subset of the
+ * actions to be performed. Loops over the array and if mask matches the
+ * element action it's passed to tst_cap_action().
+ */
+void tst_cap_setup(struct tst_cap *cap, unsigned int action_mask);
+
+#endif /* TST_CAPABILITY_H */
diff --git a/include/tst_checkpoint_fn.h b/include/tst_checkpoint_fn.h
index 0730fb0..4967981 100644
--- a/include/tst_checkpoint_fn.h
+++ b/include/tst_checkpoint_fn.h
@@ -30,7 +30,7 @@
  * Waits for wakeup.
  *
  * @id: Checkpoint id, possitive number
- * @msec_timeout: Timeout in miliseconds, 0 == no timeout
+ * @msec_timeout: Timeout in milliseconds, 0 == no timeout
  */
 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout);
 
@@ -39,7 +39,7 @@
  *
  * @id: Checkpoint id, possitive number
  * @nr_wake: Number of processes/threads to wake up
- * @msec_timeout: Timeout in miliseconds, 0 == no timeout
+ * @msec_timeout: Timeout in milliseconds, 0 == no timeout
  */
 int tst_checkpoint_wake(unsigned int id, unsigned int nr_wake,
                         unsigned int msec_timeout);
diff --git a/include/tst_clone.h b/include/tst_clone.h
index 72145fa..fd52097 100644
--- a/include/tst_clone.h
+++ b/include/tst_clone.h
@@ -29,10 +29,11 @@
 		size_t stack_size, void *stack);
 int ltp_clone7(unsigned long flags, int (*fn)(void *arg), void *arg,
 		size_t stack_size, void *stack, ...);
-int ltp_clone_malloc(unsigned long clone_flags, int (*fn)(void *arg),
+int ltp_clone_alloc(unsigned long clone_flags, int (*fn)(void *arg),
 		void *arg, size_t stacksize);
 int ltp_clone_quick(unsigned long clone_flags, int (*fn)(void *arg),
 		void *arg);
+void *ltp_alloc_stack(size_t size);
 
 #define clone(...) (use_the_ltp_clone_functions__do_not_use_clone)
 
diff --git a/include/tst_common.h b/include/tst_common.h
index c215054..a0c06a3 100644
--- a/include/tst_common.h
+++ b/include/tst_common.h
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2013 Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
  * Copyright (c) 2010 Ngie Cooper <yaneurabeya@gmail.com>
  * Copyright (c) 2008 Mike Frysinger <vapier@gmail.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef TST_COMMON_H__
@@ -43,19 +31,21 @@
  * This macro will call @FUNC in a loop with a delay between retries. If @FUNC
  * returns @ERET then the loop exits. The delay between retries starts at one
  * micro second and is then doubled each iteration until it exceeds one second
- * (the total time sleeping will be aproximately one second as well). When the
+ * (the total time sleeping will be approximately one second as well). When the
  * delay exceeds one second tst_brk() is called.
  */
 #define TST_RETRY_FUNC(FUNC, ERET) \
 	TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, 1)
 
 #define TST_RETRY_FN_EXP_BACKOFF(FUNC, ERET, MAX_DELAY)	\
-({	int tst_delay_ = 1;						\
+({	unsigned int tst_delay_, tst_max_delay_;			\
+	tst_delay_ = 1;							\
+	tst_max_delay_ = tst_multiply_timeout(MAX_DELAY * 1000000);	\
 	for (;;) {							\
 		typeof(FUNC) tst_ret_ = FUNC;				\
 		if (tst_ret_ == ERET)					\
 			break;						\
-		if (tst_delay_ < MAX_DELAY * 1000000) {			\
+		if (tst_delay_ < tst_max_delay_) {			\
 			usleep(tst_delay_);				\
 			tst_delay_ *= 2;				\
 		} else {						\
diff --git a/include/tst_coredump.h b/include/tst_coredump.h
new file mode 100644
index 0000000..e1f8925
--- /dev/null
+++ b/include/tst_coredump.h
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Red Hat, Inc.
+ */
+
+#ifndef TST_COREDUMP__
+#define TST_COREDUMP__
+
+/*
+ * If crash is expected, avoid dumping corefile.
+ * 1 is a special value, that disables core-to-pipe.
+ * At the same time it is small enough value for
+ * core-to-file, so it skips creating cores as well.
+ */
+void tst_no_corefile(int verbose);
+
+#endif /* TST_COREDUMP_H */
+
diff --git a/include/tst_device.h b/include/tst_device.h
index 61902b7..3ad33bd 100644
--- a/include/tst_device.h
+++ b/include/tst_device.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2016-2019 Cyril Hrubis <chrubis@suse.cz>
  *
  * 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
@@ -18,6 +18,8 @@
 #ifndef TST_DEVICE_H__
 #define TST_DEVICE_H__
 
+#include <unistd.h>
+
 struct tst_device {
 	const char *dev;
 	const char *fs_type;
@@ -45,6 +47,37 @@
 int tst_clear_device(const char *dev);
 
 /*
+ * Finds a free loop device for use and returns the free loopdev minor(-1 for no
+ * free loopdev). If path is non-NULL, it will be filled with free loopdev path.
+ *
+ */
+int tst_find_free_loopdev(const char *path, size_t path_len);
+
+/*
+ * Attaches a file to a loop device.
+ *
+ * @dev_path Path to the loop device e.g. /dev/loop0
+ * @file_path Path to a file e.g. disk.img
+ * @return Zero on success, non-zero otherwise.
+ */
+int tst_attach_device(const char *dev_path, const char *file_path);
+
+/*
+ * Detaches a file from a loop device.
+ *
+ * @dev_path Path to the loop device e.g. /dev/loop0
+ * @return Zero on succes, non-zero otherwise.
+ */
+int tst_detach_device(const char *dev_path);
+
+/*
+ * To avoid FS deferred IO metadata/cache interference, so we do syncfs
+ * simply before the tst_dev_bytes_written invocation. For easy to use,
+ * we create this inline function tst_dev_sync.
+ */
+int tst_dev_sync(int fd);
+
+/*
  * Reads test block device stat file and returns the bytes written since the
  * last call of this function.
  * @dev: test block device
diff --git a/include/tst_fs.h b/include/tst_fs.h
index b2b19ad..386fea3 100644
--- a/include/tst_fs.h
+++ b/include/tst_fs.h
@@ -50,6 +50,12 @@
 	TST_GB = 1073741824,
 };
 
+#define OVL_BASE_MNTPOINT        "mntpoint"
+#define OVL_LOWER	OVL_BASE_MNTPOINT"/lower"
+#define OVL_UPPER	OVL_BASE_MNTPOINT"/upper"
+#define OVL_WORK	OVL_BASE_MNTPOINT"/work"
+#define OVL_MNT		OVL_BASE_MNTPOINT"/ovl"
+
 /*
  * @path: path is the pathname of any file within the mounted file system
  * @mult: mult should be TST_KB, TST_MB or TST_GB
@@ -156,22 +162,29 @@
  */
 int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount);
 
+#define TST_FS_SKIP_FUSE 0x01
+
 /*
  * Return 1 if a specified fiilsystem is supported
  * Return 0 if a specified fiilsystem isn't supported
  */
-int tst_fs_is_supported(const char *fs_type);
+int tst_fs_is_supported(const char *fs_type, int flags);
 
 /*
  * Returns NULL-terminated array of kernel-supported filesystems.
  */
-const char **tst_get_supported_fs_types(void);
+const char **tst_get_supported_fs_types(int flags);
 
 /*
  * Creates and writes to files on given path until write fails with ENOSPC
  */
 void tst_fill_fs(const char *path, int verbose);
 
+/*
+ * test if FIBMAP ioctl is supported
+ */
+int tst_fibmap(const char *filename);
+
 #ifdef TST_TEST_H__
 static inline long tst_fs_type(const char *path)
 {
diff --git a/include/tst_fuzzy_sync.h b/include/tst_fuzzy_sync.h
index de0402c..cc569cb 100644
--- a/include/tst_fuzzy_sync.h
+++ b/include/tst_fuzzy_sync.h
@@ -63,6 +63,7 @@
 #include <time.h>
 #include <math.h>
 #include <stdlib.h>
+#include <pthread.h>
 #include "tst_atomic.h"
 #include "tst_timer.h"
 #include "tst_safe_pthread.h"
@@ -218,12 +219,47 @@
 static void tst_fzsync_pair_cleanup(struct tst_fzsync_pair *pair)
 {
 	if (pair->thread_b) {
-		tst_atomic_store(1, &pair->exit);
+		/* Revoke thread B if parent hits accidental break */
+		if (!pair->exit) {
+			tst_atomic_store(1, &pair->exit);
+			usleep(100000);
+
+/*
+ * b/148414662
+ * Android does not support pthread_cancel. This mechanism is just used to avoid
+ * a timeout in a rare failure case and is not required for proper operation, so
+ * just skip it for now (effort will be made upstream to remove the use of
+ * pthread_cancel).
+ *		pthread_cancel(pair->thread_b);
+ */
+		}
 		SAFE_PTHREAD_JOIN(pair->thread_b, NULL);
 		pair->thread_b = 0;
 	}
 }
 
+/** To store the run_b pointer and pass to tst_fzsync_thread_wrapper */
+struct tst_fzsync_run_thread {
+	void *(*func)(void *);
+	void *arg;
+};
+
+/**
+ * Wrap run_b for tst_fzsync_pair_reset to enable pthread cancel
+ * at the start of the thread B.
+ */
+static void *tst_fzsync_thread_wrapper(void *run_thread)
+{
+       struct tst_fzsync_run_thread t = *(struct tst_fzsync_run_thread *)run_thread;
+
+/*
+ * See above comment for b/148414662
+ *     pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+ *     pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+ */
+       return t.func(t.arg);
+}
+
 /**
  * Zero some stat fields
  *
@@ -271,8 +307,10 @@
 	pair->a_cntr = 0;
 	pair->b_cntr = 0;
 	pair->exit = 0;
-	if (run_b)
-		SAFE_PTHREAD_CREATE(&pair->thread_b, 0, run_b, 0);
+	if (run_b) {
+		struct tst_fzsync_run_thread wrap_run_b = {.func = run_b, .arg = NULL};
+		SAFE_PTHREAD_CREATE(&pair->thread_b, 0, tst_fzsync_thread_wrapper, &wrap_run_b);
+	}
 
 	pair->exec_time_start = (float)tst_timeout_remaining();
 }
@@ -477,8 +515,8 @@
 			tst_res(TINFO, "Minimum sampling period ended");
 			tst_fzsync_pair_info(pair);
 		}
-	} else if (fabsf(pair->diff_ab.avg) >= 1 && pair->spins_avg.avg >= 1) {
-		per_spin_time = fabsf(pair->diff_ab.avg) / pair->spins_avg.avg;
+	} else if (fabsf(pair->diff_ab.avg) >= 1) {
+		per_spin_time = fabsf(pair->diff_ab.avg) / MAX(pair->spins_avg.avg, 1.0f);
 		time_delay = drand48() * (pair->diff_sa.avg + pair->diff_sb.avg)
 			- pair->diff_sb.avg;
 		pair->delay += (int)(time_delay / per_spin_time);
@@ -495,6 +533,7 @@
 		}
 	} else if (!pair->sampling) {
 		tst_res(TWARN, "Can't calculate random delay");
+		tst_fzsync_pair_info(pair);
 		pair->sampling = -1;
 	}
 
diff --git a/include/tst_net.h b/include/tst_net.h
index cb97b7b..e1edc72 100644
--- a/include/tst_net.h
+++ b/include/tst_net.h
@@ -1,22 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
  */
 
 #include <arpa/inet.h>
 #include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define MAX_IPV4_PREFIX 32
 #define MAX_IPV6_PREFIX 128
@@ -45,7 +36,7 @@
 /*
  * Function bit_count is from ipcalc project, ipcalc.c.
  */
-static int bit_count(uint32_t i)
+static inline int bit_count(uint32_t i)
 {
 	int c = 0;
 	unsigned int seen_one = 0;
@@ -67,7 +58,7 @@
 /*
  * Function mask2prefix is from ipcalc project, ipcalc.c.
  */
-static int mask2prefix(struct in_addr mask)
+static inline int mask2prefix(struct in_addr mask)
 {
 	return bit_count(ntohl(mask.s_addr));
 }
@@ -75,7 +66,7 @@
 /*
  * Function ipv4_mask_to_int is from ipcalc project, ipcalc.c.
  */
-static int ipv4_mask_to_int(const char *prefix)
+static inline int ipv4_mask_to_int(const char *prefix)
 {
 	int ret;
 	struct in_addr in;
@@ -90,7 +81,7 @@
 /*
  * Function safe_atoi is from ipcalc project, ipcalc.c.
  */
-static int safe_atoi(const char *s, int *ret_i)
+static inline int safe_atoi(const char *s, int *ret_i)
 {
 	char *x = NULL;
 	long l;
@@ -112,7 +103,7 @@
 /*
  * Function get_prefix use code from ipcalc project, str_to_prefix/ipcalc.c.
  */
-static int get_prefix(const char *ip_str, int is_ipv6)
+static inline int get_prefix(const char *ip_str, int is_ipv6)
 {
 	char *prefix_str = NULL;
 	int prefix = -1, r;
@@ -140,13 +131,13 @@
 	return prefix;
 }
 
-static void get_in_addr(const char *ip_str, struct in_addr *ip)
+static inline void get_in_addr(const char *ip_str, struct in_addr *ip)
 {
 	if (inet_pton(AF_INET, ip_str, ip) <= 0)
 		tst_brk_comment("bad IPv4 address: '%s'", ip_str);
 }
 
-static void get_in6_addr(const char *ip_str, struct in6_addr *ip6)
+static inline void get_in6_addr(const char *ip_str, struct in6_addr *ip6)
 {
 	if (inet_pton(AF_INET6, ip_str, ip6) <= 0)
 		tst_brk_comment("bad IPv6 address: '%s'", ip_str);
diff --git a/include/tst_safe_file_ops.h b/include/tst_safe_file_ops.h
index 5c3fea4..b62a744 100644
--- a/include/tst_safe_file_ops.h
+++ b/include/tst_safe_file_ops.h
@@ -59,4 +59,10 @@
 	safe_touch(__FILE__, __LINE__, NULL, \
 			(pathname), (mode), (times))
 
+#define SAFE_MOUNT_OVERLAY() \
+	((void) mount_overlay(__FILE__, __LINE__, 1))
+
+#define TST_MOUNT_OVERLAY() \
+	(mount_overlay(__FILE__, __LINE__, 0) == 0)
+
 #endif /* TST_SAFE_FILE_OPS */
diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 53a888c..80c4d9c 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -24,6 +24,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
+#include <sys/vfs.h>
 #include <fcntl.h>
 #include <libgen.h>
 #include <signal.h>
@@ -340,6 +341,23 @@
 #define SAFE_LSTAT(path, buf) \
 	safe_lstat(__FILE__, __LINE__, (path), (buf))
 
+static inline int safe_statfs(const char *file, const int lineno,
+                              const char *path, struct statfs *buf)
+{
+	int rval;
+
+	rval = statfs(path, buf);
+
+	if (rval == -1) {
+		tst_brk_(file, lineno, TBROK | TERRNO,
+		         "statfs(%s,%p) failed", path, buf);
+	}
+
+	return rval;
+}
+#define SAFE_STATFS(path, buf) \
+        safe_statfs(__FILE__, __LINE__, (path), (buf))
+
 static inline off_t safe_lseek(const char *file, const int lineno,
                                int fd, off_t offset, int whence)
 {
diff --git a/include/tst_safe_net.h b/include/tst_safe_net.h
index d49a360..9bc257c 100644
--- a/include/tst_safe_net.h
+++ b/include/tst_safe_net.h
@@ -64,6 +64,9 @@
 #define SAFE_LISTEN(socket, backlog) \
 	safe_listen(__FILE__, __LINE__, NULL, socket, backlog)
 
+#define SAFE_ACCEPT(sockfd, addr, addrlen) \
+	safe_accept(__FILE__, __LINE__, NULL, sockfd, addr, addrlen)
+
 #define SAFE_CONNECT(sockfd, addr, addrlen) \
 	safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen)
 
diff --git a/include/tst_taint.h b/include/tst_taint.h
index 1039e2d..0acc114 100644
--- a/include/tst_taint.h
+++ b/include/tst_taint.h
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Michael Moese <mmoese@suse.de>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /* Usage example
diff --git a/include/tst_test.h b/include/tst_test.h
index e4b935c..21c7dfb 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #include <limits.h>
 #include <string.h>
+#include <errno.h>
 
 #include "tst_common.h"
 #include "tst_res_flags.h"
@@ -33,6 +34,9 @@
 #include "tst_get_bad_addr.h"
 #include "tst_path_has_mnt_flags.h"
 #include "tst_sys_conf.h"
+#include "tst_coredump.h"
+#include "tst_buffers.h"
+#include "tst_capability.h"
 
 /*
  * Reports testcase result.
@@ -104,6 +108,11 @@
 int tst_parse_long(const char *str, long *val, long min, long max);
 int tst_parse_float(const char *str, float *val, float min, float max);
 
+struct tst_tag {
+	const char *name;
+	const char *value;
+};
+
 extern unsigned int tst_variant;
 
 struct tst_test {
@@ -122,6 +131,7 @@
 	int forks_child:1;
 	int needs_device:1;
 	int needs_checkpoints:1;
+	int needs_overlay:1;
 	int format_device:1;
 	int mount_device:1;
 	int needs_rofs:1;
@@ -153,6 +163,8 @@
 
 	/* Device filesystem type override NULL == default */
 	const char *dev_fs_type;
+	/* Flags to be passed to tst_get_supported_fs_types() */
+	int dev_fs_flags;
 
 	/* Options passed to SAFE_MKFS() when format_device is set */
 	const char *const *dev_fs_opts;
@@ -195,6 +207,21 @@
 	 * test.
 	 */
 	const char *const *needs_kconfigs;
+
+	/*
+	 * NULL-terminated array to be allocated buffers.
+	 */
+	struct tst_buffers *bufs;
+
+	/*
+	 * NULL-terminated array of capability settings
+	 */
+	struct tst_cap *caps;
+
+	/*
+	 * {NULL, NULL} terminated array of tags.
+	 */
+	const struct tst_tag *tags;
 };
 
 /*
@@ -250,6 +277,7 @@
 const char *tst_strstatus(int status);
 
 unsigned int tst_timeout_remaining(void);
+unsigned int tst_multiply_timeout(unsigned int timeout);
 void tst_set_timeout(int timeout);
 
 
diff --git a/include/tst_timer.h b/include/tst_timer.h
index 8751149..d361aa2 100644
--- a/include/tst_timer.h
+++ b/include/tst_timer.h
@@ -48,7 +48,7 @@
 }
 
 /*
- * Converts timespec to miliseconds.
+ * Converts timespec to milliseconds.
  */
 static inline long long tst_timespec_to_ms(struct timespec t)
 {
@@ -64,7 +64,7 @@
 }
 
 /*
- * Converts timeval to miliseconds.
+ * Converts timeval to milliseconds.
  */
 static inline long long tst_timeval_to_ms(struct timeval t)
 {
@@ -302,7 +302,7 @@
  * Returns true if timer started by tst_timer_start() has been running for
  * longer than ms seconds.
  *
- * @ms: Time interval in miliseconds.
+ * @ms: Time interval in milliseconds.
  */
 int tst_timer_expired_ms(long long ms);
 
@@ -317,7 +317,7 @@
 struct timespec tst_timer_elapsed(void);
 
 /*
- * Returns elapsed time in miliseconds.
+ * Returns elapsed time in milliseconds.
  */
 static inline long long tst_timer_elapsed_ms(void)
 {
diff --git a/include/tst_timer_test.h b/include/tst_timer_test.h
index 23fc0ba..b825a4d 100644
--- a/include/tst_timer_test.h
+++ b/include/tst_timer_test.h
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
  /*
diff --git a/include/tst_uinput.h b/include/tst_uinput.h
new file mode 100644
index 0000000..cf351cd
--- /dev/null
+++ b/include/tst_uinput.h
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef TST_UINPUT_H__
+#define TST_UINPUT_H__
+
+/**
+ * Tries to open the uinput device.
+ *
+ * Returns file descriptor on success, -1 on failure.
+ */
+int open_uinput(void);
+
+/**
+ * Creates virtual input device.
+ *
+ * @fd File descriptor returned by open_uinput().
+ */
+void create_input_device(int fd);
+
+/**
+ * Parses /proc/bus/input/devices and returns the strings for our virtual device.
+ * If passing 'H' to it, it returns HANDLERS string. If passing 'S' to it, it
+ * returns SYSFS string.
+ *
+ * Returns newly allocated string, or NULL in a case of failure.
+ */
+char *get_input_field_value(char field);
+
+/**
+ * Sets up the virtual device to appear as a mouse, this must be called before
+ * the call to create_input_device().
+ *
+ * @fd File descriptor as returned by open_uinput().
+ */
+void setup_mouse_events(int fd);
+
+/**
+ * Destroys virtual input device.
+ *
+ * @fd File descriptor returned by open_uinput().
+ */
+void destroy_input_device(int fd);
+
+#endif	/* TST_UINPUT_H__ */
diff --git a/lib/cloner.c b/lib/cloner.c
index 63f223d..11401f2 100644
--- a/lib/cloner.c
+++ b/lib/cloner.c
@@ -28,8 +28,8 @@
 #include <stdlib.h>
 #include <sched.h>
 #include <stdarg.h>
-#include "test.h"
 #include "config.h"
+#include "tst_clone.h"
 
 #undef clone			/* we want to use clone() */
 
@@ -118,18 +118,36 @@
 }
 
 /*
- * ltp_clone_malloc: also does the memory allocation for clone with a
+ * ltp_alloc_stack: allocate stack of size 'size', that is sufficiently
+ * aligned for all arches. User is responsible for freeing allocated
+ * memory.
+ * Returns pointer to new stack. On error, returns NULL with errno set.
+ */
+void *ltp_alloc_stack(size_t size)
+{
+	void *ret = NULL;
+	int err;
+
+	err = posix_memalign(&ret, 64, size);
+	if (err)
+		errno = err;
+
+	return ret;
+}
+
+/*
+ * ltp_clone_alloc: also does the memory allocation for clone with a
  * caller-specified size.
  */
 int
-ltp_clone_malloc(unsigned long clone_flags, int (*fn) (void *arg), void *arg,
+ltp_clone_alloc(unsigned long clone_flags, int (*fn) (void *arg), void *arg,
 		 size_t stack_size)
 {
 	void *stack;
 	int ret;
 	int saved_errno;
 
-	stack = malloc(stack_size);
+	stack = ltp_alloc_stack(stack_size);
 	if (stack == NULL)
 		return -1;
 
@@ -145,7 +163,7 @@
 }
 
 /*
- * ltp_clone_quick: calls ltp_clone_malloc with predetermined stack size.
+ * ltp_clone_quick: calls ltp_clone_alloc with predetermined stack size.
  * Experience thus far suggests that one page is often insufficient,
  * while 6*getpagesize() seems adequate.
  */
@@ -153,5 +171,5 @@
 {
 	size_t stack_size = getpagesize() * 6;
 
-	return ltp_clone_malloc(clone_flags, fn, arg, stack_size);
+	return ltp_clone_alloc(clone_flags, fn, arg, stack_size);
 }
diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
index d92b898..d4aa493 100644
--- a/lib/newlib_tests/.gitignore
+++ b/lib/newlib_tests/.gitignore
@@ -14,6 +14,8 @@
 test14
 test15
 test16
+tst_capability01
+tst_capability02
 tst_device
 tst_safe_fileops
 tst_res_hexd
@@ -26,3 +28,4 @@
 test_exec_child
 test_kconfig
 variant
+test_guarded_buf
diff --git a/lib/newlib_tests/shell/net/tst_ipaddr_un.sh b/lib/newlib_tests/shell/net/tst_ipaddr_un.sh
new file mode 100755
index 0000000..512d6d8
--- /dev/null
+++ b/lib/newlib_tests/shell/net/tst_ipaddr_un.sh
@@ -0,0 +1,168 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+
+TST_TESTFUNC=do_test
+TST_CNT=2
+
+PATH="$(dirname $0)/../../../../testcases/lib/:$PATH"
+
+# workaround to disable netns initialization
+RHOST="foo"
+
+. tst_net.sh
+
+IPV4_DATA="
+0 0|10.23.0.0
+0 1|10.23.0.1
+1 0|10.23.1.0
+1 1|10.23.1.1
+1 2|10.23.1.2
+2 2|10.23.2.2
+1 3|10.23.1.3
+3 3|10.23.3.3
+1 128|10.23.1.128
+128 128|10.23.128.128
+1 254|10.23.1.254
+254 254|10.23.254.254
+1 255|10.23.1.255
+255 255|10.23.255.255
+1 256|10.23.1.0
+256 256|10.23.0.0
+1 257|10.23.1.1
+257 257|10.23.1.1
+
+-c 0|10.23.0.2
+-c 0 lhost|10.23.0.2
+-c 0 rhost|10.23.0.1
+
+-c 1|10.23.0.2
+-c 1 rhost|10.23.0.1
+-c 2|10.23.0.4
+-c 2 rhost|10.23.0.3
+-c 127|10.23.0.254
+-c 127 rhost|10.23.0.253
+-c 128|10.23.1.2
+-c 128 rhost|10.23.1.1
+-c 254|10.23.1.254
+-c 254 rhost|10.23.1.253
+-c 255|10.23.2.2
+-c 255 rhost|10.23.2.1
+
+-c 0 -h1,255|10.23.0.2
+-c 0 -h1,255 rhost|10.23.0.1
+-c 1 -h1,255|10.23.0.2
+-c 1 -h1,255 rhost|10.23.0.1
+-c 127 -h1,255|10.23.0.254
+-c 127 -h1,255 rhost|10.23.0.253
+-c 128 -h1,255|10.23.1.1
+-c 128 -h1,255 rhost|10.23.0.255
+-c 255 -h1,255|10.23.1.255
+-c 255 -h1,255 rhost|10.23.1.254
+-c 256 -h1,255|10.23.2.2
+-c 256 -h1,255 rhost|10.23.2.1
+
+-c1 -h 2,8 -n 2,8|10.23.2.3
+-c1 -h 2,8 -n 2,8 rhost|10.23.2.2
+-c2 -h 2,8 -n 2,8|10.23.2.5
+-c2 -h 2,8 -n 2,8 rhost|10.23.2.4
+
+-c1 -n 22,44|10.23.22.2
+-c1 -n 22,44 rhost|10.23.22.1
+-c2 -n 22,44|10.23.22.4
+-c2 -n 22,44 rhost|10.23.22.3
+"
+
+IPV6_DATA="
+0 0|fd00:23::
+0 1|fd00:23::1
+1 0|fd00:23:1::
+1 1|fd00:23:1::1
+1 2|fd00:23:1::2
+2 2|fd00:23:2::2
+1 3|fd00:23:1::3
+3 3|fd00:23:3::3
+1 32767|fd00:23:1::7fff
+32767 32767|fd00:23:7fff::7fff
+1 65534|fd00:23:1::fffe
+65534 65534|fd00:23:fffe::fffe
+1 65535|fd00:23:1::ffff
+65535 65535|fd00:23:ffff::ffff
+1 65536|fd00:23:1::
+65536 65536|fd00:23::
+1 65537|fd00:23:1::1
+65537 65537|fd00:23:1::1
+
+-c 0|fd00:23::2
+-c 0 lhost|fd00:23::2
+-c 0 rhost|fd00:23::1
+
+-c 1|fd00:23::2
+-c 1 rhost|fd00:23::1
+-c 2|fd00:23::4
+-c 2 rhost|fd00:23::3
+-c 32767|fd00:23::fffe
+-c 32767 rhost|fd00:23::fffd
+-c 32768|fd00:23:1::2
+-c 32768 rhost|fd00:23:1::1
+-c 65534|fd00:23:1::fffe
+-c 65534 rhost|fd00:23:1::fffd
+-c 65535|fd00:23:2::2
+-c 65535 rhost|fd00:23:2::1
+
+-c 0 -h1,65535|fd00:23::2
+-c 0 -h1,65535 rhost|fd00:23::1
+-c 1 -h1,65535|fd00:23::2
+-c 1 -h1,65535 rhost|fd00:23::1
+-c 32767 -h1,65535|fd00:23::fffe
+-c 32767 -h1,65535 rhost|fd00:23::fffd
+-c 32768 -h1,65535|fd00:23:1::1
+-c 32768 -h1,65535 rhost|fd00:23::ffff
+-c 65535 -h1,65535|fd00:23:1::ffff
+-c 65535 -h1,65535 rhost|fd00:23:1::fffe
+-c 65536 -h1,65535|fd00:23:2::2
+-c 65536 -h1,65535 rhost|fd00:23:2::1
+
+-c1 -h 2,8 -n 2,8|fd00:23:2::3
+-c1 -h 2,8 -n 2,8 rhost|fd00:23:2::2
+-c2 -h 2,8 -n 2,8|fd00:23:2::5
+-c2 -h 2,8 -n 2,8 rhost|fd00:23:2::4
+
+-c1 -n 22,44|fd00:23:16::2
+-c1 -n 22,44 rhost|fd00:23:16::1
+-c2 -n 22,44|fd00:23:16::4
+-c2 -n 22,44 rhost|fd00:23:16::3
+"
+
+test_tst_ipaddr_un()
+{
+	local data cmd i result
+	local var="$1"
+
+	tst_res TINFO "Testing for IPv${TST_IPVER}, data: \$$var"
+
+	eval data="\$$var"
+	IFS="
+"
+	for i in $data; do
+		cmd="tst_ipaddr_un $(echo $i | cut -d'|' -f 1)"
+		result="$(echo $i | cut -d'|' -f 2)"
+		tst_res TINFO "testing $cmd"
+		EXPECT_PASS "[ '$(eval $cmd)' = '$result' ]"
+	done
+}
+
+do_test2()
+{
+	test_tst_ipaddr_un "IPV${TST_IPVER}_DATA"
+}
+
+do_test()
+{
+	case $1 in
+	 1) TST_IPV6= TST_IPVER=4 do_test2;;
+	 2) TST_IPV6=6 TST_IPVER=6 do_test2;;
+	esac
+}
+
+tst_run
diff --git a/lib/newlib_tests/shell/test_timeout.sh b/lib/newlib_tests/shell/test_timeout.sh
new file mode 100755
index 0000000..26477d6
--- /dev/null
+++ b/lib/newlib_tests/shell/test_timeout.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+
+PATH="$(dirname $0):$(dirname $0)/../../../testcases/lib/:$PATH"
+
+DATA="
+timeout01.sh||0
+timeout02.sh||0
+timeout02.sh|foo|2
+timeout02.sh|2|0
+timeout01.sh|2|0
+timeout02.sh|1.1|0
+timeout02.sh|-10|2
+timeout02.sh|-0.1|0
+timeout02.sh|-1.1|2
+timeout02.sh|-10.1|2
+"
+
+echo "Testing timeout in shell API"
+echo
+
+failed=0
+for i in $DATA; do
+	file=$(echo $i | cut -d'|' -f1)
+	timeout=$(echo $i | cut -d'|' -f2)
+	exp_exit=$(echo $i | cut -d'|' -f3)
+
+	echo "=== $file (LTP_TIMEOUT_MUL='$timeout') ==="
+	LTP_TIMEOUT_MUL=$timeout $file
+	ret=$?
+	if [ $ret -ne $exp_exit ]; then
+		echo "FAILED (exit code: $ret, expected $exp_exit)"
+		failed=$((failed+1))
+	else
+		echo "PASSED"
+	fi
+	echo
+done
+
+echo "Failed tests: $failed"
+exit $failed
diff --git a/lib/newlib_tests/shell/timeout01.sh b/lib/newlib_tests/shell/timeout01.sh
new file mode 100755
index 0000000..8f0971a
--- /dev/null
+++ b/lib/newlib_tests/shell/timeout01.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+
+TST_TESTFUNC=do_test
+
+TST_TIMEOUT=-1
+. tst_test.sh
+
+do_test()
+{
+	tst_res TPASS "timeout $TST_TIMEOUT set"
+}
+
+tst_run
diff --git a/lib/newlib_tests/shell/timeout02.sh b/lib/newlib_tests/shell/timeout02.sh
new file mode 100755
index 0000000..47e7a2d
--- /dev/null
+++ b/lib/newlib_tests/shell/timeout02.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+
+TST_TESTFUNC=do_test
+
+TST_TIMEOUT=2
+. tst_test.sh
+
+do_test()
+{
+	tst_res TPASS "timeout $TST_TIMEOUT set (LTP_TIMEOUT_MUL='$LTP_TIMEOUT_MUL')"
+}
+
+tst_run
diff --git a/lib/newlib_tests/test01.c b/lib/newlib_tests/test01.c
index 32bba12..304c205 100644
--- a/lib/newlib_tests/test01.c
+++ b/lib/newlib_tests/test01.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test02.c b/lib/newlib_tests/test02.c
index b4ea0b6..f1b6a7c 100644
--- a/lib/newlib_tests/test02.c
+++ b/lib/newlib_tests/test02.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test03.c b/lib/newlib_tests/test03.c
index 8ed78aa..3b45124 100644
--- a/lib/newlib_tests/test03.c
+++ b/lib/newlib_tests/test03.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test04.c b/lib/newlib_tests/test04.c
index b233279..7ecf2ca 100644
--- a/lib/newlib_tests/test04.c
+++ b/lib/newlib_tests/test04.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test05.c b/lib/newlib_tests/test05.c
index 640abe4..9f5d898 100644
--- a/lib/newlib_tests/test05.c
+++ b/lib/newlib_tests/test05.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test06.c b/lib/newlib_tests/test06.c
index cce1768..5499f44 100644
--- a/lib/newlib_tests/test06.c
+++ b/lib/newlib_tests/test06.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test07.c b/lib/newlib_tests/test07.c
index 8c06506..de9c832 100644
--- a/lib/newlib_tests/test07.c
+++ b/lib/newlib_tests/test07.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test08.c b/lib/newlib_tests/test08.c
index 5463b53..5099b08 100644
--- a/lib/newlib_tests/test08.c
+++ b/lib/newlib_tests/test08.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test09.c b/lib/newlib_tests/test09.c
index 02911bd..0f42bac 100644
--- a/lib/newlib_tests/test09.c
+++ b/lib/newlib_tests/test09.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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.
- *
  */
 
 /*
diff --git a/lib/newlib_tests/test10.c b/lib/newlib_tests/test10.c
index d0ad7a2..df61908 100644
--- a/lib/newlib_tests/test10.c
+++ b/lib/newlib_tests/test10.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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.
- *
  */
 
 /*
diff --git a/lib/newlib_tests/test11.c b/lib/newlib_tests/test11.c
index 211e7e6..fd9dbc6 100644
--- a/lib/newlib_tests/test11.c
+++ b/lib/newlib_tests/test11.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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.
- *
  */
 
 /*
diff --git a/lib/newlib_tests/test12.c b/lib/newlib_tests/test12.c
index 47ca735..b4f0d63 100644
--- a/lib/newlib_tests/test12.c
+++ b/lib/newlib_tests/test12.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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.
- *
  */
 
 /*
diff --git a/lib/newlib_tests/test13.c b/lib/newlib_tests/test13.c
index e71af19..c447dc3 100644
--- a/lib/newlib_tests/test13.c
+++ b/lib/newlib_tests/test13.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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.
- *
  */
 
 /*
diff --git a/lib/newlib_tests/test14.c b/lib/newlib_tests/test14.c
index 56d6d2f..171149d 100644
--- a/lib/newlib_tests/test14.c
+++ b/lib/newlib_tests/test14.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "tst_test.h"
diff --git a/lib/newlib_tests/test15.c b/lib/newlib_tests/test15.c
index 7563cb7..3a2ac36 100644
--- a/lib/newlib_tests/test15.c
+++ b/lib/newlib_tests/test15.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/lib/newlib_tests/test16.c b/lib/newlib_tests/test16.c
index f453968..0d74e1e 100644
--- a/lib/newlib_tests/test16.c
+++ b/lib/newlib_tests/test16.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /* Basic functionality test for tst_fuzzy_sync.h similar to the atomic tests
  * (test15.c). One thread writes to the odd indexes of an array while the
diff --git a/lib/newlib_tests/test17.c b/lib/newlib_tests/test17.c
index f83c9ed..c0fc0bc 100644
--- a/lib/newlib_tests/test17.c
+++ b/lib/newlib_tests/test17.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /* Basic functionality test for tst_fuzzy_sync.h similar to the atomic tests
  * (test15.c). One thread writes to the odd indexes of an array while the
diff --git a/lib/newlib_tests/test18.c b/lib/newlib_tests/test18.c
index 6615471..026435d 100644
--- a/lib/newlib_tests/test18.c
+++ b/lib/newlib_tests/test18.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018, Linux Test Project
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdlib.h>
diff --git a/lib/newlib_tests/test19.c b/lib/newlib_tests/test19.c
index b15470f..78b5202 100644
--- a/lib/newlib_tests/test19.c
+++ b/lib/newlib_tests/test19.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018, Linux Test Project
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdlib.h>
diff --git a/lib/newlib_tests/test_exec.c b/lib/newlib_tests/test_exec.c
index 2c86568..75f1b03 100644
--- a/lib/newlib_tests/test_exec.c
+++ b/lib/newlib_tests/test_exec.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/test_exec_child.c b/lib/newlib_tests/test_exec_child.c
index 696ff5b..c572150 100644
--- a/lib/newlib_tests/test_exec_child.c
+++ b/lib/newlib_tests/test_exec_child.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/lib/newlib_tests/test_guarded_buf.c b/lib/newlib_tests/test_guarded_buf.c
new file mode 100644
index 0000000..c0deb84
--- /dev/null
+++ b/lib/newlib_tests/test_guarded_buf.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Test that acces after guarded buffer causes segfault.
+ */
+
+#include <stdlib.h>
+#include <sys/wait.h>
+#include "tst_test.h"
+
+#define BUF1_LEN 10
+#define BUF2_LEN 4096
+#define BUF3_LEN 12004
+
+static char *buf1;
+static char *buf2;
+static char *buf3;
+
+static void do_test(unsigned int n)
+{
+	int pid;
+	int status;
+
+	if (n == 6) {
+		buf1[-1] = 0;
+		buf3[-1] = 0;
+		tst_res(TPASS, "Buffers dirtied!");
+	}
+
+	pid = SAFE_FORK();
+	if (!pid) {
+		switch (n) {
+		case 0:
+			buf1[BUF1_LEN - 1] = 0;
+		break;
+		case 1:
+			buf2[BUF2_LEN - 1] = 0;
+		break;
+		case 2:
+			buf3[BUF3_LEN - 1] = 0;
+		break;
+		case 3:
+			buf1[BUF1_LEN] = 0;
+		break;
+		case 4:
+			buf2[BUF2_LEN] = 0;
+		break;
+		case 5:
+			buf3[BUF3_LEN] = 0;
+		break;
+		case 6:
+			buf1[-2] = 0;
+			buf3[-2] = 0;
+		break;
+		}
+
+		exit(0);
+	}
+
+	SAFE_WAITPID(pid, &status, 0);
+
+	if (n == 6)
+		return;
+
+	if (n < 3) {
+		if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+			tst_res(TPASS, "Exitted normally");
+			return;
+		}
+	} else {
+		if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
+			tst_res(TPASS, "Killed by SIGSEGV");
+			return;
+		}
+	}
+
+	tst_res(TFAIL, "Child %s", tst_strstatus(status));
+}
+
+static struct tst_test test = {
+	.forks_child = 1,
+	.test = do_test,
+	.tcnt = 7,
+	.bufs = (struct tst_buffers []) {
+		{&buf1, .size = BUF1_LEN},
+		{&buf2, .size = BUF2_LEN},
+		{&buf3, .size = BUF3_LEN},
+		{}
+	}
+};
diff --git a/lib/newlib_tests/tst_capability01.c b/lib/newlib_tests/tst_capability01.c
new file mode 100644
index 0000000..7d3f0f1
--- /dev/null
+++ b/lib/newlib_tests/tst_capability01.c
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * The user or file requires CAP_NET_RAW for this test to work.
+ * e.g use "$ setcap cap_net_raw=pei tst_capability"
+ */
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "tst_test.h"
+#include "tst_capability.h"
+#include "tst_safe_net.h"
+
+#include "lapi/socket.h"
+
+static void run(void)
+{
+	TEST(socket(AF_INET, SOCK_RAW, 1));
+	if (TST_RET > -1) {
+		tst_res(TFAIL, "Created raw socket");
+		SAFE_CLOSE(TST_RET);
+	} else if (TST_ERR != EPERM) {
+		tst_res(TBROK | TTERRNO,
+			"Failed to create socket for wrong reason");
+	} else {
+		tst_res(TPASS | TTERRNO, "Didn't create raw socket");
+	}
+}
+
+static void setup(void)
+{
+	if (geteuid() == 0)
+		tst_res(TWARN, "CAP_NET_RAW may be ignored when euid == 0");
+
+	TEST(socket(AF_INET, SOCK_RAW, 1));
+	if (TST_RET < 0)
+		tst_brk(TFAIL | TTERRNO, "Can't create raw socket in setup");
+
+	SAFE_CLOSE(TST_RET);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_REQ, CAP_NET_RAW),
+		TST_CAP(TST_CAP_DROP, CAP_NET_RAW),
+		{}
+	},
+};
diff --git a/lib/newlib_tests/tst_capability02.c b/lib/newlib_tests/tst_capability02.c
new file mode 100644
index 0000000..45e3f2d
--- /dev/null
+++ b/lib/newlib_tests/tst_capability02.c
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ */
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include "tst_test.h"
+#include "tst_capability.h"
+#include "tst_safe_net.h"
+
+#include "lapi/socket.h"
+
+static void run(void)
+{
+	TEST(socket(AF_INET, SOCK_RAW, 1));
+	if (TST_RET > -1) {
+		tst_res(TPASS, "Created raw socket");
+		SAFE_CLOSE(TST_RET);
+	} else {
+		tst_res(TFAIL | TTERRNO, "Didn't create raw socket");
+	}
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.needs_root = 1,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_REQ, CAP_NET_RAW),
+		TST_CAP(TST_CAP_DROP, CAP_AUDIT_READ), /* 64bit capability */
+		TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
+		{}
+	},
+};
diff --git a/lib/newlib_tests/tst_device.c b/lib/newlib_tests/tst_device.c
index 3314901..1344495 100644
--- a/lib/newlib_tests/tst_device.c
+++ b/lib/newlib_tests/tst_device.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdlib.h>
@@ -44,7 +32,6 @@
 }
 
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.needs_device = 1,
 	.dev_min_size = 300,
 	.test_all = do_test,
diff --git a/lib/newlib_tests/tst_expiration_timer.c b/lib/newlib_tests/tst_expiration_timer.c
index 2543d53..6cc7336 100644
--- a/lib/newlib_tests/tst_expiration_timer.c
+++ b/lib/newlib_tests/tst_expiration_timer.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/newlib_tests/tst_res_hexd.c b/lib/newlib_tests/tst_res_hexd.c
index bff9edd..ac461c5 100644
--- a/lib/newlib_tests/tst_res_hexd.c
+++ b/lib/newlib_tests/tst_res_hexd.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
diff --git a/lib/newlib_tests/tst_safe_fileops.c b/lib/newlib_tests/tst_safe_fileops.c
index 1b8d523..e8419bd 100644
--- a/lib/newlib_tests/tst_safe_fileops.c
+++ b/lib/newlib_tests/tst_safe_fileops.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
diff --git a/lib/newlib_tests/tst_strstatus.c b/lib/newlib_tests/tst_strstatus.c
index ca6be49..aeeeb77 100644
--- a/lib/newlib_tests/tst_strstatus.c
+++ b/lib/newlib_tests/tst_strstatus.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /*
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index 046568e..41fa4ca 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -699,15 +699,12 @@
 	return rval;
 }
 
-struct fuse_fs_type {
-	char const *fs_type;
-	int fallback;
-} fuse_fs_types[] = {
-	{ "exfat", 1 },
-	{ "ntfs", 0 },
+static const char *const fuse_fs_types[] = {
+	"exfat",
+	"ntfs",
 };
 
-static struct fuse_fs_type* find_fuse_fs_type(const char *fs_type)
+static int possibly_fuse(const char *fs_type)
 {
 	unsigned int i;
 
@@ -715,11 +712,11 @@
 		return 0;
 
 	for (i = 0; i < ARRAY_SIZE(fuse_fs_types); i++) {
-		if (!strcmp(fuse_fs_types[i].fs_type, fs_type))
-			return &fuse_fs_types[i];
+		if (!strcmp(fuse_fs_types[i], fs_type))
+			return 1;
 	}
 
-	return NULL;
+	return 0;
 }
 
 int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
@@ -728,7 +725,16 @@
 	       const void *data)
 {
 	int rval;
-	struct fuse_fs_type *fuse_fs_type = find_fuse_fs_type(filesystemtype);
+
+	/*
+	 * Don't try using the kernel's NTFS driver when mounting NTFS, since
+	 * the kernel's NTFS driver doesn't have proper write support.
+	 */
+	if (!filesystemtype || strcmp(filesystemtype, "ntfs")) {
+		rval = mount(source, target, filesystemtype, mountflags, data);
+		if (!rval)
+			return 0;
+	}
 
 	/*
 	 * The FUSE filesystem executes mount.fuse helper, which tries to
@@ -737,7 +743,7 @@
          *
 	 * The mount helpers are called mount.$fs_type.
 	 */
-	if (fuse_fs_type) {
+	if (possibly_fuse(filesystemtype)) {
 		char buf[1024];
 
 		tst_resm(TINFO, "Trying FUSE...");
@@ -748,26 +754,17 @@
 		if (WIFEXITED(rval) && WEXITSTATUS(rval) == 0)
 			return 0;
 
-		if (fuse_fs_type->fallback) {
-			tst_resm(TINFO,
-				 "mount.%s failed with %i, falling back to mount()",
-				 filesystemtype, rval);
-		} else {
-			tst_brkm(TBROK, cleanup_fn, "mount.%s failed with %i",
-				 filesystemtype, rval);
-			return -1;
-		}
-	}
-
-	rval = mount(source, target, filesystemtype, mountflags, data);
-	if (rval == -1) {
+		tst_brkm(TBROK, cleanup_fn, "mount.%s failed with %i",
+			 filesystemtype, rval);
+		return -1;
+	} else {
 		tst_brkm(TBROK | TERRNO, cleanup_fn,
 			 "%s:%d: mount(%s, %s, %s, %lu, %p) failed",
 			 file, lineno, source, target, filesystemtype,
 			 mountflags, data);
 	}
 
-	return rval;
+	return -1;
 }
 
 int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void),
diff --git a/lib/safe_net.c b/lib/safe_net.c
index 970a2ab..4993680 100644
--- a/lib/safe_net.c
+++ b/lib/safe_net.c
@@ -322,6 +322,22 @@
 	return rval;
 }
 
+int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void),
+		int sockfd, struct sockaddr *addr, socklen_t *addrlen)
+{
+	int rval;
+
+	rval = accept(sockfd, addr, addrlen);
+
+	if (rval < 0) {
+		tst_brkm(TBROK | TERRNO, cleanup_fn,
+			"%s:%d: accept(%d, %p, %d) failed", file, lineno,
+			sockfd, addr, *addrlen);
+	}
+
+	return rval;
+}
+
 int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void),
 		 int sockfd, const struct sockaddr *addr, socklen_t addrlen)
 {
@@ -373,6 +389,9 @@
 	return rval;
 }
 
+/*
+ * @return port in network byte order.
+ */
 unsigned short tst_get_unused_port(const char *file, const int lineno,
 	      void (cleanup_fn)(void), unsigned short family, int type)
 {
diff --git a/lib/safe_pthread.c b/lib/safe_pthread.c
index 6b45392..2866aa5 100644
--- a/lib/safe_pthread.c
+++ b/lib/safe_pthread.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <pthread.h>
diff --git a/lib/tlibio.c b/lib/tlibio.c
index 8b30d59..cc110d1 100644
--- a/lib/tlibio.c
+++ b/lib/tlibio.c
@@ -105,7 +105,7 @@
 #else
 /* for linux or sgi */
 #include <sys/uio.h>		/* readv(2)/writev(2) */
-#include <string.h>		/* bzero */
+#include <string.h>
 #endif
 #if defined(__linux__) || defined(__sun) || defined(__hpux) || defined(_AIX)
 #if !defined(UCLINUX) && !defined(__UCLIBC__)
diff --git a/lib/tst_ansi_color.c b/lib/tst_ansi_color.c
index f25c4d9..1c29268 100644
--- a/lib/tst_ansi_color.c
+++ b/lib/tst_ansi_color.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <unistd.h>
diff --git a/lib/tst_buffers.c b/lib/tst_buffers.c
new file mode 100644
index 0000000..b8b597a
--- /dev/null
+++ b/lib/tst_buffers.c
@@ -0,0 +1,143 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#include <sys/mman.h>
+#include <stdlib.h>
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+
+struct map {
+	void *addr;
+	size_t size;
+	size_t buf_shift;
+	struct map *next;
+};
+
+static struct map *maps;
+
+static void setup_canary(struct map *map)
+{
+	size_t i;
+	char *buf = map->addr;
+
+	for (i = 0; i < map->buf_shift/2; i++) {
+		char c = random();
+		buf[map->buf_shift - i - 1] = c;
+		buf[i] = c;
+	}
+}
+
+static void check_canary(struct map *map)
+{
+	size_t i;
+	char *buf = map->addr;
+
+	for (i = 0; i < map->buf_shift/2; i++) {
+		if (buf[map->buf_shift - i - 1] != buf[i]) {
+			tst_res(TWARN,
+				"pid %i: buffer modified address %p[%zi]",
+				getpid(), (char*)map->addr + map->buf_shift, -i-1);
+		}
+	}
+}
+
+void *tst_alloc(size_t size)
+{
+	size_t page_size = getpagesize();
+	unsigned int pages = (size / page_size) + !!(size % page_size) + 1;
+	void *ret;
+	struct map *map = SAFE_MALLOC(sizeof(struct map));
+	static int print_msg = 1;
+
+	if (print_msg) {
+		tst_res(TINFO, "Test is using guarded buffers");
+		print_msg = 0;
+	}
+
+	ret = SAFE_MMAP(NULL, page_size * pages, PROT_READ | PROT_WRITE,
+	                MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+
+	mprotect(ret + (pages-1) * page_size, page_size, PROT_NONE);
+
+	map->addr = ret;
+	map->size = pages * page_size;
+	map->next = maps;
+	maps = map;
+
+	if (size % page_size)
+		map->buf_shift = page_size - (size % page_size);
+	else
+		map->buf_shift = 0;
+
+	setup_canary(map);
+
+	return ret + map->buf_shift;
+}
+
+static int count_iovec(int *sizes)
+{
+	int ret = 0;
+
+	while (sizes[ret++] != -1);
+
+	return ret - 1;
+}
+
+struct iovec *tst_iovec_alloc(int sizes[])
+{
+	int i, cnt = count_iovec(sizes);
+	struct iovec *iovec;
+
+	if (cnt <= 0)
+		return NULL;
+
+	iovec = tst_alloc(sizeof(struct iovec) * cnt);
+
+	for (i = 0; i < cnt; i++) {
+		if (sizes[i]) {
+			iovec[i].iov_base = tst_alloc(sizes[i]);
+			iovec[i].iov_len = sizes[i];
+		} else {
+			iovec[i].iov_base = NULL;
+			iovec[i].iov_base = 0;
+		}
+	}
+
+	return iovec;
+}
+
+void tst_buffers_alloc(struct tst_buffers bufs[])
+{
+	unsigned int i;
+
+	for (i = 0; bufs[i].ptr; i++) {
+		if (bufs[i].size)
+			*((void**)bufs[i].ptr) = tst_alloc(bufs[i].size);
+		else
+			*((void**)bufs[i].ptr) = tst_iovec_alloc(bufs[i].iov_sizes);
+	}
+}
+
+char *tst_strdup(const char *str)
+{
+	size_t len = strlen(str);
+	char *ret = tst_alloc(len + 1);
+	return strcpy(ret, str);
+}
+
+void tst_free_all(void)
+{
+	struct map *i = maps;
+
+	while (i) {
+		struct map *j = i;
+		check_canary(i);
+		SAFE_MUNMAP(i->addr, i->size);
+		i = i->next;
+		free(j);
+	}
+
+	maps = NULL;
+}
diff --git a/lib/tst_capability.c b/lib/tst_capability.c
new file mode 100644
index 0000000..1fa0e49
--- /dev/null
+++ b/lib/tst_capability.c
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ */
+
+#include <string.h>
+
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+#include "tst_capability.h"
+
+#include "lapi/syscalls.h"
+
+int tst_capget(struct tst_cap_user_header *hdr,
+	       struct tst_cap_user_data *data)
+{
+	return tst_syscall(__NR_capget, hdr, data);
+}
+
+int tst_capset(struct tst_cap_user_header *hdr,
+	       const struct tst_cap_user_data *data)
+{
+	return tst_syscall(__NR_capset, hdr, data);
+}
+
+static void do_cap_drop(uint32_t *set, uint32_t mask, const struct tst_cap *cap)
+{
+	if (*set & mask) {
+		tst_res(TINFO, "Dropping %s(%d)", cap->name, cap->id);
+		*set &= ~mask;
+	}
+}
+
+static void do_cap_req(uint32_t *permitted, uint32_t *effective, uint32_t mask,
+		       const struct tst_cap *cap)
+{
+	if (!(*permitted & mask))
+		tst_brk(TCONF, "Need %s(%d)", cap->name, cap->id);
+
+	if (!(*effective & mask)) {
+		tst_res(TINFO, "Permitting %s(%d)", cap->name, cap->id);
+		*effective |= mask;
+	}
+}
+
+void tst_cap_action(struct tst_cap *cap)
+{
+	struct tst_cap_user_header hdr = {
+		.version = 0x20080522,
+		.pid = tst_syscall(__NR_gettid),
+	};
+	struct tst_cap_user_data cur[2] = { {0} };
+	struct tst_cap_user_data new[2] = { {0} };
+	uint32_t act = cap->action;
+	uint32_t *pE = &new[CAP_TO_INDEX(cap->id)].effective;
+	uint32_t *pP = &new[CAP_TO_INDEX(cap->id)].permitted;
+	uint32_t mask = CAP_TO_MASK(cap->id);
+
+	if (tst_capget(&hdr, cur))
+		tst_brk(TBROK | TTERRNO, "tst_capget()");
+
+	memcpy(new, cur, sizeof(new));
+
+	switch (act) {
+	case TST_CAP_DROP:
+		do_cap_drop(pE, mask, cap);
+		break;
+	case TST_CAP_REQ:
+		do_cap_req(pP, pE, mask, cap);
+		break;
+	default:
+		tst_brk(TBROK, "Unrecognised action %d", cap->action);
+	}
+
+	if (!memcmp(cur, new, sizeof(new)))
+		return;
+
+	if (tst_capset(&hdr, new))
+		tst_brk(TBROK | TERRNO, "tst_capset(%s)", cap->name);
+}
+
+void tst_cap_setup(struct tst_cap *caps, unsigned int action_mask)
+{
+	struct tst_cap *cap;
+
+	for (cap = caps; cap->action; cap++) {
+		if (cap->action & action_mask)
+			tst_cap_action(cap);
+	}
+}
diff --git a/lib/tst_clocks.c b/lib/tst_clocks.c
index 35798a4..5195da3 100644
--- a/lib/tst_clocks.c
+++ b/lib/tst_clocks.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/lib/tst_coredump.c b/lib/tst_coredump.c
new file mode 100644
index 0000000..83aa2c3
--- /dev/null
+++ b/lib/tst_coredump.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Red Hat, Inc.
+ */
+
+#define TST_NO_DEFAULT_MAIN
+
+#include <sys/time.h>
+#include <sys/resource.h>
+
+#include "tst_test.h"
+#include "tst_coredump.h"
+
+void tst_no_corefile(int verbose)
+{
+	struct rlimit new_r, old_r;
+
+	SAFE_GETRLIMIT(RLIMIT_CORE, &old_r);
+	if (old_r.rlim_max >= 1 || geteuid() == 0) {
+		/*
+		 * 1 is a special value, that disables core-to-pipe.
+		 * At the same time it is small enough value for
+		 * core-to-file, so it skips creating cores as well.
+		 */
+		new_r.rlim_cur = 1;
+		new_r.rlim_max = 1;
+		SAFE_SETRLIMIT(RLIMIT_CORE, &new_r);
+
+		if (verbose) {
+			tst_res(TINFO,
+				"Avoid dumping corefile for process(pid=%d)",
+				getpid());
+		}
+	}
+}
diff --git a/lib/tst_crypto.c b/lib/tst_crypto.c
index 37d5eb7..685e087 100644
--- a/lib/tst_crypto.c
+++ b/lib/tst_crypto.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Richard Palethorpe <rpalethorpe@suse.com>
  *                    Nicolai Stange <nstange@suse.de>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <errno.h>
diff --git a/lib/tst_device.c b/lib/tst_device.c
index cae4b5f..b9a2bc8 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -31,6 +31,7 @@
 #include <linux/loop.h>
 #include <stdint.h>
 #include <inttypes.h>
+#include "lapi/syscalls.h"
 #include "test.h"
 #include "safe_macros.h"
 
@@ -53,25 +54,26 @@
 	"/dev/block/loop%i"
 };
 
-static int set_dev_path(int dev)
+static int set_dev_path(int dev, char *path, size_t path_len)
 {
 	unsigned int i;
 	struct stat st;
 
 	for (i = 0; i < ARRAY_SIZE(dev_variants); i++) {
-		snprintf(dev_path, sizeof(dev_path), dev_variants[i], dev);
+		snprintf(path, path_len, dev_variants[i], dev);
 
-		if (stat(dev_path, &st) == 0 && S_ISBLK(st.st_mode))
+		if (stat(path, &st) == 0 && S_ISBLK(st.st_mode))
 			return 1;
 	}
 
 	return 0;
 }
 
-static int find_free_loopdev(void)
+int tst_find_free_loopdev(char *path, size_t path_len)
 {
 	int ctl_fd, dev_fd, rc, i;
 	struct loop_info loopinfo;
+	char buf[1024];
 
 	/* since Linux 3.1 */
 	ctl_fd = open(LOOP_CONTROL_FILE, O_RDWR);
@@ -80,12 +82,14 @@
 		rc = ioctl(ctl_fd, LOOP_CTL_GET_FREE);
 		close(ctl_fd);
 		if (rc >= 0) {
-			set_dev_path(rc);
-			tst_resm(TINFO, "Found free device '%s'", dev_path);
-			return 0;
+			if (path)
+				set_dev_path(rc, path, path_len);
+			tst_resm(TINFO, "Found free device %d '%s'",
+				rc, path ?: "");
+			return rc;
 		}
 		tst_resm(TINFO, "Couldn't find free loop device");
-		return 1;
+		return -1;
 	}
 
 	switch (errno) {
@@ -106,22 +110,26 @@
 	 */
 	for (i = 0; i < 256; i++) {
 
-		if (!set_dev_path(i))
+		if (!set_dev_path(i, buf, sizeof(buf)))
 			continue;
 
-		dev_fd = open(dev_path, O_RDONLY);
+		dev_fd = open(buf, O_RDONLY);
 
 		if (dev_fd < 0)
 			continue;
 
 		if (ioctl(dev_fd, LOOP_GET_STATUS, &loopinfo) == 0) {
-			tst_resm(TINFO, "Device '%s' in use", dev_path);
+			tst_resm(TINFO, "Device '%s' in use", buf);
 		} else {
 			if (errno != ENXIO)
 				continue;
-			tst_resm(TINFO, "Found free device '%s'", dev_path);
+			tst_resm(TINFO, "Found free device '%s'", buf);
 			close(dev_fd);
-			return 0;
+			if (path != NULL) {
+				strncpy(path, buf, path_len);
+				path[path_len-1] = '\0';
+			}
+			return i;
 		}
 
 		close(dev_fd);
@@ -129,16 +137,16 @@
 
 	tst_resm(TINFO, "No free devices found");
 
-	return 1;
+	return -1;
 }
 
-static int attach_device(const char *dev, const char *file)
+int tst_attach_device(const char *dev, const char *file)
 {
 	int dev_fd, file_fd;
 	struct loop_info loopinfo;
 
 	/* b/148978487 */
-	int attach_tries = 3;
+	int attach_tries = 20;
 	while (attach_tries--) {
 		dev_fd = open(dev, O_RDWR);
 		if (dev_fd >= 0)
@@ -185,7 +193,7 @@
 	return 0;
 }
 
-static int detach_device(const char *dev)
+int tst_detach_device(const char *dev)
 {
 	int dev_fd, ret, i;
 
@@ -222,6 +230,11 @@
 	return 1;
 }
 
+int tst_dev_sync(int fd)
+{
+	return syscall(__NR_syncfs, fd);
+}
+
 const char *tst_acquire_device__(unsigned int size)
 {
 	int fd;
@@ -281,10 +294,10 @@
 		return NULL;
 	}
 
-	if (find_free_loopdev())
+	if (tst_find_free_loopdev(dev_path, sizeof(dev_path)) == -1)
 		return NULL;
 
-	if (attach_device(dev_path, DEV_FILE))
+	if (tst_attach_device(dev_path, DEV_FILE))
 		return NULL;
 
 	device_acquired = 1;
@@ -329,7 +342,7 @@
 	 *
 	 * The file image is deleted in tst_rmdir();
 	 */
-	ret = detach_device(dev);
+	ret = tst_detach_device(dev);
 
 	device_acquired = 0;
 
@@ -373,16 +386,37 @@
 	return -1;
 }
 
+int find_stat_file(const char *dev, char *path, size_t path_len)
+{
+	const char *devname = strrchr(dev, '/') + 1;
+
+	snprintf(path, path_len, "/sys/block/%s/stat", devname);
+
+	if (!access(path, F_OK))
+		return 1;
+
+	DIR *dir = SAFE_OPENDIR(NULL, "/sys/block/");
+	struct dirent *ent;
+
+	while ((ent = readdir(dir))) {
+		snprintf(path, path_len, "/sys/block/%s/%s/stat", ent->d_name, devname);
+
+		if (!access(path, F_OK)) {
+			SAFE_CLOSEDIR(NULL, dir);
+			return 1;
+		}
+	}
+
+	SAFE_CLOSEDIR(NULL, dir);
+	return 0;
+}
+
 unsigned long tst_dev_bytes_written(const char *dev)
 {
-	struct stat st;
 	unsigned long dev_sec_write = 0, dev_bytes_written, io_ticks = 0;
 	char dev_stat_path[1024];
 
-	snprintf(dev_stat_path, sizeof(dev_stat_path), "/sys/block/%s/stat",
-		 strrchr(dev, '/') + 1);
-
-	if (stat(dev_stat_path, &st) != 0)
+	if (!find_stat_file(dev, dev_stat_path, sizeof(dev_stat_path)))
 		tst_brkm(TCONF, NULL, "Test device stat file: %s not found",
 			 dev_stat_path);
 
diff --git a/lib/tst_fill_fs.c b/lib/tst_fill_fs.c
index 2775a2c..121dd2f 100644
--- a/lib/tst_fill_fs.c
+++ b/lib/tst_fill_fs.c
@@ -1,23 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/statvfs.h>
 
 #define TST_NO_DEFAULT_MAIN
 #include "tst_test.h"
@@ -31,6 +20,8 @@
 	size_t len;
 	ssize_t ret;
 	int fd;
+	struct statvfs fi;
+	statvfs(path, &fi);
 
 	for (;;) {
 		len = random() % (1024 * 102400);
@@ -53,6 +44,13 @@
 			ret = write(fd, buf, MIN(len, sizeof(buf)));
 
 			if (ret < 0) {
+				/* retry on ENOSPC to make sure filesystem is really full */
+				if (errno == ENOSPC && len >= fi.f_bsize/2) {
+					SAFE_FSYNC(fd);
+					len /= 2;
+					continue;
+				}
+
 				SAFE_CLOSE(fd);
 
 				if (errno != ENOSPC)
diff --git a/lib/tst_fs_setup.c b/lib/tst_fs_setup.c
new file mode 100644
index 0000000..54ea370
--- /dev/null
+++ b/lib/tst_fs_setup.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <dirent.h>
+#include <errno.h>
+#include <sys/mount.h>
+
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+#include "tst_fs.h"
+
+#define TST_FS_SETUP_OVERLAYFS_MSG "overlayfs is not configured in this kernel"
+#define TST_FS_SETUP_OVERLAYFS_CONFIG "lowerdir="OVL_LOWER",upperdir="OVL_UPPER",workdir="OVL_WORK
+
+void create_overlay_dirs(void)
+{
+	DIR *dir = opendir(OVL_LOWER);
+	if (dir == NULL) {
+		SAFE_MKDIR(OVL_LOWER, 0755);
+		SAFE_MKDIR(OVL_UPPER, 0755);
+		SAFE_MKDIR(OVL_WORK, 0755);
+		SAFE_MKDIR(OVL_MNT, 0755);
+		return;
+	}
+	closedir(dir);
+}
+
+int mount_overlay(const char *file, const int lineno, int skip)
+{
+	int ret;
+
+	create_overlay_dirs();
+	ret = mount("overlay", OVL_MNT, "overlay", 0,
+				TST_FS_SETUP_OVERLAYFS_CONFIG);
+	if (ret == 0)
+		return 0;
+
+	if (errno == ENODEV) {
+		if (skip) {
+			tst_brk(TCONF, "%s:%d: " TST_FS_SETUP_OVERLAYFS_MSG,
+				file, lineno);
+		} else {
+			tst_res(TINFO, "%s:%d: " TST_FS_SETUP_OVERLAYFS_MSG,
+				file, lineno);
+		}
+	} else {
+		tst_brk(TBROK | TERRNO, "overlayfs mount failed");
+	}
+	return ret;
+}
diff --git a/lib/tst_ioctl.c b/lib/tst_ioctl.c
new file mode 100644
index 0000000..364220b
--- /dev/null
+++ b/lib/tst_ioctl.c
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <linux/fs.h>
+
+#define TST_NO_DEFAULT_MAIN
+
+#include "tst_test.h"
+
+int tst_fibmap(const char *filename)
+{
+	/* test if FIBMAP ioctl is supported */
+	int fd, block = 0;
+
+	fd = open(filename, O_RDWR | O_CREAT, 0666);
+	if (fd < 0) {
+		tst_res(TWARN | TERRNO,
+			 "open(%s, O_RDWR | O_CREAT, 0666) failed", filename);
+		return -1;
+	}
+
+	if (ioctl(fd, FIBMAP, &block)) {
+		tst_res(TINFO | TERRNO, "FIBMAP ioctl is NOT supported");
+		close(fd);
+		return 1;
+	}
+	tst_res(TINFO, "FIBMAP ioctl is supported");
+
+	if (close(fd)) {
+		tst_res(TWARN | TERRNO, "close(fd) failed");
+		return -1;
+	}
+	return 0;
+}
diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
index a33d36a..5d208ec 100644
--- a/lib/tst_mkfs.c
+++ b/lib/tst_mkfs.c
@@ -98,7 +98,7 @@
 			 "%s:%d: %s not found in $PATH", file, lineno, mkfs);
 	default:
 		tst_brkm(TBROK, cleanup_fn,
-			 "%s:%d: %s failed with %i", mkfs, ret, file, lineno);
+			 "%s:%d: %s failed with %i", file, lineno, mkfs, ret);
 	}
 }
 
diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c
index 0e59a3f..f5413a1 100644
--- a/lib/tst_safe_macros.c
+++ b/lib/tst_safe_macros.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define _GNU_SOURCE
diff --git a/lib/tst_safe_sysv_ipc.c b/lib/tst_safe_sysv_ipc.c
index 86f2d93..30b5f6e 100644
--- a/lib/tst_safe_sysv_ipc.c
+++ b/lib/tst_safe_sysv_ipc.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Xiao yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
diff --git a/lib/tst_sig_proc.c b/lib/tst_sig_proc.c
index 579047a..509418a 100644
--- a/lib/tst_sig_proc.c
+++ b/lib/tst_sig_proc.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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.
  */
 
 #include <stdlib.h>
diff --git a/lib/tst_status.c b/lib/tst_status.c
index bfe3b5f..f1affea 100644
--- a/lib/tst_status.c
+++ b/lib/tst_status.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
index b7e647f..00ede54 100644
--- a/lib/tst_supported_fs_types.c
+++ b/lib/tst_supported_fs_types.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
@@ -57,7 +45,7 @@
 	return 1;
 }
 
-static int has_kernel_support(const char *fs_type)
+static int has_kernel_support(const char *fs_type, int flags)
 {
 	static int fuse_supported = -1;
 	const char *tmpdir = getenv("TMPDIR");
@@ -96,21 +84,26 @@
 		return 0;
 	}
 
+	if (flags & TST_FS_SKIP_FUSE) {
+		tst_res(TINFO, "Skipping FUSE as requested by the test");
+		return 0;
+	}
+
 	tst_res(TINFO, "FUSE does support %s", fs_type);
 	return 1;
 }
 
-int tst_fs_is_supported(const char *fs_type)
+int tst_fs_is_supported(const char *fs_type, int flags)
 {
-	return has_kernel_support(fs_type) && has_mkfs(fs_type);
+	return has_kernel_support(fs_type, flags) && has_mkfs(fs_type);
 }
 
-const char **tst_get_supported_fs_types(void)
+const char **tst_get_supported_fs_types(int flags)
 {
 	unsigned int i, j = 0;
 
 	for (i = 0; fs_type_whitelist[i]; i++) {
-		if (tst_fs_is_supported(fs_type_whitelist[i]))
+		if (tst_fs_is_supported(fs_type_whitelist[i], flags))
 			fs_types[j++] = fs_type_whitelist[i];
 	}
 
diff --git a/lib/tst_sys_conf.c b/lib/tst_sys_conf.c
index e767856..bbe4699 100644
--- a/lib/tst_sys_conf.c
+++ b/lib/tst_sys_conf.c
@@ -66,6 +66,9 @@
 
 	fp = fopen(path, "r");
 	if (fp == NULL) {
+		if (flag == '?')
+			return 1;
+
 		tst_brk(TBROK | TERRNO, "Failed to open FILE '%s' for reading",
 			path);
 		return 1;
@@ -75,6 +78,9 @@
 	fclose(fp);
 
 	if (ret == NULL) {
+		if (flag == '?')
+			return 1;
+
 		tst_brk(TBROK | TERRNO, "Failed to read anything from '%s'",
 			path);
 	}
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 2d88adb..8d7dee2 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015-2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
@@ -43,13 +31,18 @@
 #include "old_device.h"
 #include "old_tmpdir.h"
 
+#define LINUX_GIT_URL "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id="
+#define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
+
 struct tst_test *tst_test;
 
 static const char *tid;
 static int iterations = 1;
 static float duration = -1;
+static float timeout_mul = -1;
 static pid_t main_pid, lib_pid;
 static int mntpoint_mounted;
+static int ovl_mounted;
 static struct timespec tst_start_time; /* valid only for test pid */
 
 struct results {
@@ -137,6 +130,7 @@
 	if (results) {
 		msync((void*)results, size, MS_SYNC);
 		munmap((void*)results, size);
+		results = NULL;
 	}
 }
 
@@ -187,7 +181,7 @@
 {
 	char buf[1024];
 	char *str = buf;
-	int ret, size = sizeof(buf), ssize;
+	int ret, size = sizeof(buf), ssize, int_errno;
 	const char *str_errno = NULL;
 	const char *res;
 
@@ -215,15 +209,19 @@
 		abort();
 	}
 
-	if (ttype & TERRNO)
+	if (ttype & TERRNO) {
 		str_errno = tst_strerrno(errno);
+		int_errno = errno;
+	}
 
-	if (ttype & TTERRNO)
+	if (ttype & TTERRNO) {
 		str_errno = tst_strerrno(TST_ERR);
+		int_errno = TST_ERR;
+	}
 
 	if (ttype & TRERRNO) {
-		ret = TST_RET < 0 ? -(int)TST_RET : (int)TST_RET;
-		str_errno = tst_strerrno(ret);
+		int_errno = TST_RET < 0 ? -(int)TST_RET : (int)TST_RET;
+		str_errno = tst_strerrno(int_errno);
 	}
 
 	ret = snprintf(str, size, "%s:%i: ", file, lineno);
@@ -247,7 +245,7 @@
 				"Next message is too long and truncated:");
 	} else if (str_errno) {
 		ssize = size - 2;
-		ret = snprintf(str, size, ": %s", str_errno);
+		ret = snprintf(str, size, ": %s (%d)", str_errno, int_errno);
 		str += MIN(ret, ssize);
 		size -= MIN(ret, ssize);
 		if (ret >= ssize)
@@ -293,6 +291,8 @@
 	if (tst_test->cleanup)
 		tst_test->cleanup();
 
+	tst_free_all();
+
 	tst_brk_handler = tst_vbrk_;
 }
 
@@ -398,6 +398,9 @@
 	if (pid < 0)
 		tst_brk_(filename, lineno, TBROK | TERRNO, "fork() failed");
 
+	if (!pid)
+		atexit(tst_free_all);
+
 	return pid;
 }
 
@@ -415,6 +418,9 @@
 {
 	unsigned int i;
 
+	fprintf(stderr, "Options\n");
+	fprintf(stderr, "-------\n");
+
 	for (i = 0; i < ARRAY_SIZE(options); i++)
 		fprintf(stderr, "%s\n", options[i].help);
 
@@ -425,6 +431,28 @@
 		fprintf(stderr, "%s\n", tst_test->options[i].help);
 }
 
+static void print_test_tags(void)
+{
+	unsigned int i;
+	const struct tst_tag *tags = tst_test->tags;
+
+	printf("\nTags\n");
+	printf("----\n");
+
+	if (tags) {
+		for (i = 0; tags[i].name; i++) {
+			if (!strcmp(tags[i].name, "CVE"))
+				printf(CVE_DB_URL "%s\n", tags[i].value);
+			else if (!strcmp(tags[i].name, "linux-git"))
+				printf(LINUX_GIT_URL "%s\n", tags[i].value);
+			else
+				printf("%s: %s\n", tags[i].name, tags[i].value);
+		}
+	}
+
+	printf("\n");
+}
+
 static void check_option_collision(void)
 {
 	unsigned int i, j;
@@ -468,6 +496,9 @@
 	if (i >= topts_len)
 		tst_brk(TBROK, "Invalid option '%c' (should not happen)", opt);
 
+	if (*toptions[i].arg)
+		tst_res(TWARN, "Option -%c passed multiple times", opt);
+
 	*(toptions[i].arg) = optarg ? optarg : "";
 }
 
@@ -500,6 +531,7 @@
 		break;
 		case 'h':
 			print_help();
+			print_test_tags();
 			exit(0);
 		case 'i':
 			iterations = atoi(optarg);
@@ -585,26 +617,74 @@
 	return 0;
 }
 
+static void print_colored(const char *str)
+{
+	if (tst_color_enabled(STDOUT_FILENO))
+		printf("%s%s%s", ANSI_COLOR_YELLOW, str, ANSI_COLOR_RESET);
+	else
+		printf("%s", str);
+}
+
+static void print_failure_hints(void)
+{
+	unsigned int i;
+	const struct tst_tag *tags = tst_test->tags;
+
+	if (!tags)
+		return;
+
+	int hint_printed = 0;
+	for (i = 0; tags[i].name; i++) {
+		if (!strcmp(tags[i].name, "linux-git")) {
+			if (!hint_printed) {
+				hint_printed = 1;
+				printf("\n");
+				print_colored("HINT: ");
+				printf("You _MAY_ be missing kernel fixes, see:\n\n");
+			}
+
+			printf(LINUX_GIT_URL "%s\n", tags[i].value);
+		}
+
+	}
+
+	hint_printed = 0;
+	for (i = 0; tags[i].name; i++) {
+		if (!strcmp(tags[i].name, "CVE")) {
+			if (!hint_printed) {
+				hint_printed = 1;
+				printf("\n");
+				print_colored("HINT: ");
+				printf("You _MAY_ be vunerable to CVE(s), see:\n\n");
+			}
+
+			printf(CVE_DB_URL "%s\n", tags[i].value);
+		}
+	}
+}
+
 static void do_exit(int ret)
 {
 	if (results) {
-		printf("\nSummary:\n");
-		printf("passed   %d\n", results->passed);
-		printf("failed   %d\n", results->failed);
-		printf("skipped  %d\n", results->skipped);
-		printf("warnings %d\n", results->warnings);
-
 		if (results->passed && ret == TCONF)
 			ret = 0;
 
-		if (results->failed)
+		if (results->failed) {
 			ret |= TFAIL;
+			print_failure_hints();
+		}
 
 		if (results->skipped && !results->passed)
 			ret |= TCONF;
 
 		if (results->warnings)
 			ret |= TWARN;
+
+		printf("\nSummary:\n");
+		printf("passed   %d\n", results->passed);
+		printf("failed   %d\n", results->failed);
+		printf("skipped  %d\n", results->skipped);
+		printf("warnings %d\n", results->warnings);
 	}
 
 	do_cleanup();
@@ -812,6 +892,9 @@
 
 	setup_ipc();
 
+	if (tst_test->bufs)
+		tst_buffers_alloc(tst_test->bufs);
+
 	if (needs_tmpdir() && !tst_tmpdir_created())
 		tst_tmpdir();
 
@@ -871,6 +954,17 @@
 			prepare_device();
 	}
 
+	if (tst_test->needs_overlay && !tst_test->mount_device) {
+		tst_brk(TBROK, "tst_test->mount_device must be set");
+	}
+	if (tst_test->needs_overlay && !mntpoint_mounted) {
+		tst_brk(TBROK, "tst_test->mntpoint must be mounted");
+	}
+	if (tst_test->needs_overlay && !ovl_mounted) {
+		SAFE_MOUNT_OVERLAY();
+		ovl_mounted = 1;
+	}
+
 	if (tst_test->resource_files)
 		copy_resources();
 
@@ -882,15 +976,24 @@
 {
 	main_pid = getpid();
 
+	if (tst_test->caps)
+		tst_cap_setup(tst_test->caps, TST_CAP_REQ);
+
 	if (tst_test->setup)
 		tst_test->setup();
 
 	if (main_pid != getpid())
 		tst_brk(TBROK, "Runaway child in setup()!");
+
+	if (tst_test->caps)
+		tst_cap_setup(tst_test->caps, TST_CAP_DROP);
 }
 
 static void do_cleanup(void)
 {
+	if (ovl_mounted)
+		SAFE_UMOUNT(OVL_MNT);
+
 	if (mntpoint_mounted)
 		tst_umount(tst_test->mntpoint);
 
@@ -906,10 +1009,10 @@
 	if (tst_test->save_restore)
 		tst_sys_conf_restore(0);
 
-	cleanup_ipc();
-
 	if (tst_test->restore_wallclock)
 		tst_wallclock_restore();
+
+	cleanup_ipc();
 }
 
 static void run_tests(void)
@@ -1071,25 +1174,43 @@
 	return 0;
 }
 
+unsigned int tst_multiply_timeout(unsigned int timeout)
+{
+	char *mul;
+	int ret;
+
+	if (timeout_mul == -1) {
+		mul = getenv("LTP_TIMEOUT_MUL");
+		if (mul) {
+			if ((ret = tst_parse_float(mul, &timeout_mul, 1, 10000))) {
+				tst_brk(TBROK, "Failed to parse LTP_TIMEOUT_MUL: %s",
+						tst_strerrno(ret));
+			}
+		} else {
+			timeout_mul = 1;
+		}
+	}
+	if (timeout_mul < 1)
+		tst_brk(TBROK, "LTP_TIMEOUT_MUL must to be int >= 1! (%.2f)",
+				timeout_mul);
+
+	if (timeout < 1)
+		tst_brk(TBROK, "timeout must to be >= 1! (%d)", timeout);
+
+	return timeout * timeout_mul;
+}
+
 void tst_set_timeout(int timeout)
 {
-	char *mul = getenv("LTP_TIMEOUT_MUL");
-
 	if (timeout == -1) {
 		tst_res(TINFO, "Timeout per run is disabled");
 		return;
 	}
 
-	results->timeout = timeout;
+	if (timeout < 1)
+		tst_brk(TBROK, "timeout must to be >= 1! (%d)", timeout);
 
-	if (mul) {
-		float m = atof(mul);
-
-		if (m < 1)
-			tst_brk(TBROK, "Invalid timeout multiplier '%s'", mul);
-
-		results->timeout = results->timeout * m + 0.5;
-	}
+	results->timeout = tst_multiply_timeout(timeout);
 
 	tst_res(TINFO, "Timeout per run is %uh %02um %02us",
 		results->timeout/3600, (results->timeout%3600)/60,
@@ -1147,7 +1268,7 @@
 {
 	int ret = 0;
 	unsigned int i;
-	const char *const *filesystems = tst_get_supported_fs_types();
+	const char *const *filesystems = tst_get_supported_fs_types(tst_test->dev_fs_flags);
 
 	if (!filesystems[0])
 		tst_brk(TCONF, "There are no supported filesystems");
diff --git a/lib/tst_timer_test.c b/lib/tst_timer_test.c
index 8ad831c..13e9def 100644
--- a/lib/tst_timer_test.c
+++ b/lib/tst_timer_test.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/prctl.h>
@@ -171,7 +159,7 @@
 {
 	const long long *aa = a, *bb = b;
 
-	return *aa < *bb;
+	return (*bb - *aa);
 }
 
 /*
@@ -352,6 +340,9 @@
 	struct timespec t;
 	int ret;
 
+	if (setup)
+		setup();
+
 	tst_clock_getres(CLOCK_MONOTONIC, &t);
 
 	tst_res(TINFO, "CLOCK_MONOTONIC resolution %lins", (long)t.tv_nsec);
@@ -372,16 +363,11 @@
 	tst_res(TINFO, "PR_GET_TIMERSLACK not defined, using %uus",
 		timerslack);
 #endif /* PR_GET_TIMERSLACK */
-
 	parse_timer_opts();
 
 	samples = SAFE_MALLOC(sizeof(long long) * MAX(MAX_SAMPLES, sample_cnt));
-
 	if (set_latency() < 0)
 		tst_res(TINFO, "Failed to set zero latency constraint: %m");
-
-	if (setup)
-		setup();
 }
 
 static void timer_cleanup(void)
diff --git a/libs/libltpuinput/Makefile b/libs/libltpuinput/Makefile
new file mode 100644
index 0000000..dd2a6c0
--- /dev/null
+++ b/libs/libltpuinput/Makefile
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) Cyril Hrubis <chrubis@suse.cz>
+
+top_srcdir		?= ../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+LIB			:= libltpuinput.a
+
+include $(top_srcdir)/include/mk/lib.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/libs/libltpuinput/tst_uinput.c b/libs/libltpuinput/tst_uinput.c
new file mode 100644
index 0000000..f4eee07
--- /dev/null
+++ b/libs/libltpuinput/tst_uinput.c
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2015 Cedric Hnyda <chnyda@suse.com>
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#include <linux/input.h>
+#include <linux/uinput.h>
+#include <stdio.h>
+#include <string.h>
+
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+
+#include "tst_uinput.h"
+
+#define VIRTUAL_DEVICE "virtual-device-ltp"
+
+static const char *uinput_paths[] = {
+	"/dev/input/uinput",
+	"/dev/uinput",
+};
+
+int open_uinput(void)
+{
+	unsigned int i;
+	int fd;
+
+	for (i = 0; i < ARRAY_SIZE(uinput_paths); i++) {
+		fd = open(uinput_paths[i], O_WRONLY | O_NONBLOCK);
+
+		if (fd > 0) {
+			tst_res(TINFO, "Found uinput dev at %s", uinput_paths[i]);
+			return fd;
+		}
+
+		if (fd < 0 && errno != ENOENT) {
+			tst_brk(TBROK | TERRNO, "open(%s)", uinput_paths[i]);
+		}
+	}
+
+	return -1;
+}
+
+
+#define SYSFS_PREFIX "Sysfs="
+#define HANDLERS_PREFIX "Handlers="
+
+static char *parse_field(char *line, char field)
+{
+	char *value;
+
+	switch (field) {
+	case 'H':
+		value = strstr(line, HANDLERS_PREFIX) + sizeof(HANDLERS_PREFIX) - 1;
+		break;
+	case 'S':
+		value = strstr(line, SYSFS_PREFIX) + sizeof(SYSFS_PREFIX) - 1;
+		break;
+	default:
+		return NULL;
+	}
+
+	value[strlen(value) - 1] = 0;
+
+	return strdup(value);
+}
+
+char *get_input_field_value(char field)
+{
+	FILE *file;
+	char line[1024];
+	int flag = 0;
+
+	file = fopen("/proc/bus/input/devices", "r");
+	if (!file)
+		return NULL;
+
+	while (fgets(line, sizeof(line), file)) {
+		if (strstr(line, "N: Name=\""VIRTUAL_DEVICE"\""))
+			flag = 1;
+
+		if (flag) {
+			if (line[0] == field)
+				return parse_field(line, field);
+
+			if (line[0] == '\n')
+				flag = 0;
+		}
+	}
+
+	fclose(file);
+	return NULL;
+}
+
+static int check_device(void)
+{
+	FILE *file;
+	char line[256];
+
+	file = fopen("/proc/bus/input/devices", "r");
+	if (!file)
+		return 0;
+
+	while (fgets(line, sizeof(line), file)) {
+		if (strstr(line, "Name=\""VIRTUAL_DEVICE"\""))
+			return 1;
+	}
+
+	fclose(file);
+
+	return 0;
+}
+
+void setup_mouse_events(int fd)
+{
+	SAFE_IOCTL(fd, UI_SET_EVBIT, EV_KEY);
+	SAFE_IOCTL(fd, UI_SET_KEYBIT, BTN_LEFT);
+	SAFE_IOCTL(fd, UI_SET_EVBIT, EV_REL);
+	SAFE_IOCTL(fd, UI_SET_RELBIT, REL_X);
+	SAFE_IOCTL(fd, UI_SET_RELBIT, REL_Y);
+}
+
+void destroy_input_device(int fd)
+{
+	SAFE_IOCTL(fd, UI_DEV_DESTROY, NULL);
+	SAFE_CLOSE(fd);
+}
+
+void create_input_device(int fd)
+{
+	int nb;
+	struct uinput_user_dev uidev = {
+		.name = VIRTUAL_DEVICE,
+		.id = {
+			.bustype = BUS_USB,
+			.vendor = 0x1,
+			.product = 0x1,
+			.version = 1,
+		}
+	};
+
+	SAFE_WRITE(1, fd, &uidev, sizeof(uidev));
+	SAFE_IOCTL(fd, UI_DEV_CREATE, NULL);
+
+	for (nb = 100; nb > 0; nb--) {
+		if (check_device())
+			return;
+		usleep(10000);
+	}
+
+	destroy_input_device(fd);
+	tst_brk(TBROK, "Failed to create device");
+}
diff --git a/m4/ltp-acct.m4 b/m4/ltp-acct.m4
new file mode 100644
index 0000000..61bc019
--- /dev/null
+++ b/m4/ltp-acct.m4
@@ -0,0 +1,7 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 SUSE LLC
+dnl Author: Christian Amann <camann@suse.com>
+
+AC_DEFUN([LTP_CHECK_ACCT],[
+AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
+])
diff --git a/m4/ltp-acl.m4 b/m4/ltp-acl.m4
index 603837d..7059125 100644
--- a/m4/ltp-acl.m4
+++ b/m4/ltp-acl.m4
@@ -1,27 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2011
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Cyril Hrubis <chrubis@suse.cz>
-dnl
 
-dnl
-dnl LTP_CHECK_ACL_SUPPORT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_ACL_SUPPORT], [
 	AC_CHECK_LIB([acl], [acl_init], [have_libacl=yes], [AC_MSG_WARN(missing libacl)])
 	AC_CHECK_HEADERS([sys/acl.h], [have_acl=yes], [AC_MSG_WARN(missing libacl headers)])
diff --git a/m4/ltp-atomic.m4 b/m4/ltp-atomic.m4
index 59614a1..87e1224 100644
--- a/m4/ltp-atomic.m4
+++ b/m4/ltp-atomic.m4
@@ -1,18 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2016
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
 
-AC_DEFUN([LTP_CHECK_ATOMIC_MEMORY_MODEL],[dnl
+AC_DEFUN([LTP_CHECK_ATOMIC_MEMORY_MODEL],[
 	AC_MSG_CHECKING([for __atomic_* compiler builtins])
 	AC_LINK_IFELSE([AC_LANG_SOURCE([
 int main(void) {
diff --git a/m4/ltp-builtin_clear_cache.m4 b/m4/ltp-builtin_clear_cache.m4
index 74e4ccd..86e1cfc 100644
--- a/m4/ltp-builtin_clear_cache.m4
+++ b/m4/ltp-builtin_clear_cache.m4
@@ -1,18 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2016
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
 
-AC_DEFUN([LTP_CHECK_BUILTIN_CLEAR_CACHE],[dnl
+AC_DEFUN([LTP_CHECK_BUILTIN_CLEAR_CACHE],[
 	AC_MSG_CHECKING([for __builtin___clear_cache])
 	AC_LINK_IFELSE([AC_LANG_SOURCE([[
 int main(void) {
diff --git a/m4/ltp-cap.m4 b/m4/ltp-cap.m4
index 834ab36..4981e84 100644
--- a/m4/ltp-cap.m4
+++ b/m4/ltp-cap.m4
@@ -1,28 +1,8 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Cisco Systems Inc., 2009
-dnl Copyright (c) Linux Test Project, 2010
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
+dnl Copyright (c) Linux Test Project, 2019
 dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
-dnl
 
-dnl
-dnl LTP_CHECK_CAPABILITY_SUPPORT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_CAPABILITY_SUPPORT],[
 AH_TEMPLATE(HAVE_LIBCAP,
 [Define to 1 if you have libcap-2 installed.])
@@ -34,4 +14,19 @@
 	AC_DEFINE(HAVE_LIBCAP)
 fi
 AC_SUBST(CAP_LIBS,$cap_libs)
+
+AH_TEMPLATE(HAVE_NEWER_LIBCAP,
+[Define to 1 if you have newer libcap-2 installed.])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <sys/capability.h>
+#include <linux/types.h>
+int main(void) {
+	__u16 a;
+	__u32 b;
+	return 0;
+}])],[has_newer_libcap="yes"])
+
+if test "x$has_newer_libcap" = xyes; then
+	AC_DEFINE(HAVE_NEWER_LIBCAP)
+fi
 ])
diff --git a/m4/ltp-cgroupstats.m4 b/m4/ltp-cgroupstats.m4
deleted file mode 100644
index e45b868..0000000
--- a/m4/ltp-cgroupstats.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-dnl
-dnl LTP_CHECK_CGROUPSTATS
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_CGROUPSTATS],
-[dnl
-AC_CHECK_HEADERS(linux/cgroupstats.h,[LTP_CHECK_CGROUPSTATS_HEADER=yes])
-AC_SUBST(LTP_CHECK_CGROUPSTATS_HEADER)
-])
diff --git a/m4/ltp-clone7args.m4 b/m4/ltp-clone7args.m4
index b85cf0d..ab55c1e 100644
--- a/m4/ltp-clone7args.m4
+++ b/m4/ltp-clone7args.m4
@@ -1,25 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2014
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
-dnl
-dnl LTP_CHECK_CLONE_SUPPORTS_7_ARGS
-dnl -------------------------------
-dnl
 AC_DEFUN([LTP_CHECK_CLONE_SUPPORTS_7_ARGS],[
 AH_TEMPLATE(CLONE_SUPPORTS_7_ARGS,
 [Define to 1 if clone() supports 7 arguments.])
diff --git a/m4/ltp-crypto.m4 b/m4/ltp-crypto.m4
index c0c65e0..42f0d85 100644
--- a/m4/ltp-crypto.m4
+++ b/m4/ltp-crypto.m4
@@ -1,7 +1,6 @@
-dnl
-dnl LTP_CHECK_CRYPTO
-dnl ----------------------------
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Linux Test Project, 2009-2017
+
 AC_DEFUN([LTP_CHECK_CRYPTO], [
 	AC_CHECK_LIB([crypto], [SHA1_Init], [have_libcrypto=yes], [AC_MSG_WARN(missing libcrypto)])
 	AC_CHECK_HEADERS([openssl/sha.h], [have_sha=yes], [AC_MSG_WARN(missing openssl headers)])
diff --git a/m4/ltp-eventfd.m4 b/m4/ltp-eventfd.m4
index d06ddba..5d729a3 100644
--- a/m4/ltp-eventfd.m4
+++ b/m4/ltp-eventfd.m4
@@ -1,28 +1,8 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Red Hat Inc., 2008
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-dnl Author: Masatake YAMATO <yamato@redhat.com>
 dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
-dnl
+dnl Author: Masatake YAMATO <yamato@redhat.com>
 
-dnl
-dnl LTP_CHECK_SYSCALL_EVENTFD
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_EVENTFD], [
 	AC_CHECK_HEADERS(libaio.h, [have_libaio=yes])
 	AC_CHECK_LIB(aio, io_setup, [have_aio=yes])
diff --git a/m4/ltp-fanotify.m4 b/m4/ltp-fanotify.m4
new file mode 100644
index 0000000..f2e31eb
--- /dev/null
+++ b/m4/ltp-fanotify.m4
@@ -0,0 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+
+AC_DEFUN([LTP_CHECK_FANOTIFY],[
+AC_CHECK_TYPES([struct fanotify_event_info_header],,,[#include <sys/fanotify.h>])
+AC_CHECK_TYPES([struct fanotify_event_info_fid],,,[#include <sys/fanotify.h>])
+AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>])
+])
diff --git a/m4/ltp-fcntl.m4 b/m4/ltp-fcntl.m4
index 6401bb8..90ab5fd 100644
--- a/m4/ltp-fcntl.m4
+++ b/m4/ltp-fcntl.m4
@@ -1,27 +1,8 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2014 Fujitsu Ltd.
 dnl Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
-dnl
-dnl LTP_CHECK_SYSCALL_FCNTL
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_SYSCALL_FCNTL],[dnl
+AC_DEFUN([LTP_CHECK_SYSCALL_FCNTL],[
 	AC_MSG_CHECKING([for fcntl f_owner_ex])
 	AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #define _GNU_SOURCE
diff --git a/m4/ltp-fortify_source.m4 b/m4/ltp-fortify_source.m4
index ffb22b4..4c19179 100644
--- a/m4/ltp-fortify_source.m4
+++ b/m4/ltp-fortify_source.m4
@@ -1,26 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
-dnl
-dnl LTP_CHECK_FORTIFY_SOURCE
-dnl ------------------------
-dnl
-AC_DEFUN([LTP_CHECK_FORTIFY_SOURCE],[dnl
+AC_DEFUN([LTP_CHECK_FORTIFY_SOURCE],[
 	AC_MSG_CHECKING(whether to define _FORTIFY_SOURCE=2)
 	AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #include <stdio.h>
diff --git a/m4/ltp-fs_ioc_flags.m4 b/m4/ltp-fs_ioc_flags.m4
deleted file mode 100644
index 544cd77..0000000
--- a/m4/ltp-fs_ioc_flags.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl
-dnl Copyright (c) Linux Test Project, 2012
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-dnl Author: Cyril Hrubis <chrubis@suse.cz>
-dnl
-
-dnl
-dnl LTP_CHECK_FS_IOC_FLAGS
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_FS_IOC_FLAGS],[
-AH_TEMPLATE(HAVE_FS_IOC_FLAGS,
-[Define to 1 if you have FS_IOC_GETFLAGS and FS_IOC_SETFLAGS in <linux/fs.h>.])
-AC_MSG_CHECKING([for FS_IOC_GETFLAGS and FS_IOC_SETFLAGS in <linux/fs.h>])
-AC_TRY_COMPILE([#include <linux/fs.h>], [int flags = FS_IOC_GETFLAGS;],
-               AC_DEFINE(HAVE_FS_IOC_FLAGS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
-])
diff --git a/m4/ltp-host-cpu.m4 b/m4/ltp-host-cpu.m4
index 2536047..85b894c 100644
--- a/m4/ltp-host-cpu.m4
+++ b/m4/ltp-host-cpu.m4
@@ -1,17 +1,5 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 AC_DEFUN([LTP_DETECT_HOST_CPU], [
 AC_SUBST([HOST_CPU], [$host_cpu])
diff --git a/m4/ltp-if_link.m4 b/m4/ltp-if_link.m4
index 007af44..b7228bf 100644
--- a/m4/ltp-if_link.m4
+++ b/m4/ltp-if_link.m4
@@ -1,25 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2015
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
-dnl
-dnl LTP_CHECK_NS_IF_LINK
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_IF_LINK],[
 AC_CHECK_DECLS([IFLA_NET_NS_PID],,,[#include <linux/if_link.h>])
 ])
diff --git a/m4/ltp-iovec.m4 b/m4/ltp-iovec.m4
index dde3974..27cef70 100644
--- a/m4/ltp-iovec.m4
+++ b/m4/ltp-iovec.m4
@@ -1,20 +1,5 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2014 Linux Test Project
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
 AC_DEFUN([LTP_CHECK_IOVEC],[
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
diff --git a/m4/ltp-kcmp_type.m4 b/m4/ltp-kcmp_type.m4
index 17571e2..a752128 100644
--- a/m4/ltp-kcmp_type.m4
+++ b/m4/ltp-kcmp_type.m4
@@ -1,22 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2015
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software Foundation,
-dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Cedric Hnyda <chnyda@suse.com>
-dnl
 
 AC_DEFUN([LTP_CHECK_KCMP_TYPE],[
 AC_CHECK_TYPES([enum kcmp_type],,,[#include <linux/kcmp.h>])
diff --git a/m4/ltp-kernel_devel.m4 b/m4/ltp-kernel_devel.m4
index 1c4e71f..8a0598e 100644
--- a/m4/ltp-kernel_devel.m4
+++ b/m4/ltp-kernel_devel.m4
@@ -1,30 +1,10 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2 of
-dnl the License, or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it would be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write the Free Software Foundation,
-dnl Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-dnl
 dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com>
-dnl
-
-dnl
-dnl LTP_CHECK_KERNEL_DEVEL
-dnl ----------------------------
 dnl Building kernel modules
-dnl requires kernel-devel installed
-dnl
+dnl kernel development headers installed
 
-AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[dnl
+AC_DEFUN([LTP_CHECK_KERNEL_DEVEL],[
 
 AC_MSG_CHECKING([for kernel-devel])
 AC_ARG_WITH(
diff --git a/m4/ltp-keyutils.m4 b/m4/ltp-keyutils.m4
index 82b86ad..451c549 100644
--- a/m4/ltp-keyutils.m4
+++ b/m4/ltp-keyutils.m4
@@ -1,25 +1,8 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2016 Fujitsu Ltd.
 dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
-dnl
 dnl Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-dnl
-dnl This program is free software; you can redistribute it and/or modify it
-dnl under the terms of version 2 of the GNU General Public License as
-dnl published by the Free Software Foundation.
-dnl
-dnl This program is distributed in the hope that it would be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl alone with this program.
-dnl
 
-dnl
-dnl LTP_CHECK_KEYUTILS_SUPPORT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_KEYUTILS_SUPPORT], [
 	AC_CHECK_LIB([keyutils], [add_key],
 	[AC_DEFINE(HAVE_LIBKEYUTILS, 1, [Define to 1 if you have libkeyutils installed.])
diff --git a/m4/ltp-linuxrandom.m4 b/m4/ltp-linuxrandom.m4
index 4b7e585..4f6b9d1 100644
--- a/m4/ltp-linuxrandom.m4
+++ b/m4/ltp-linuxrandom.m4
@@ -1,23 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2015
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
 
-dnl
-dnl LTP_CHECK_LINUXRANDOM
-dnl ----------------------------
-dnl
-
-AC_DEFUN([LTP_CHECK_LINUXRANDOM],[dnl
+AC_DEFUN([LTP_CHECK_LINUXRANDOM],[
 	AC_MSG_CHECKING([for linux/random.h])
 	AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 
diff --git a/m4/ltp-madvise.m4 b/m4/ltp-madvise.m4
index c82e3cc..3ab203c 100644
--- a/m4/ltp-madvise.m4
+++ b/m4/ltp-madvise.m4
@@ -1,29 +1,9 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2011
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Cyril Hrubis <chrubis@suse.cz>
-dnl
 
-dnl
-dnl LTP_CHECK_MADVISE
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_MADVISE],
-[dnl
+[
 AC_CHECK_DECLS([MADV_MERGEABLE],[have_madv_mergeable="yes"],,[#include <sys/mman.h>])
 if test "x$have_madv_mergeable" = "xyes"; then
 	AC_DEFINE(HAVE_MADV_MERGEABLE,1,[Define to 1 if you have MADV_MERGEABLE])
diff --git a/m4/ltp-mkdtemp.m4 b/m4/ltp-mkdtemp.m4
index 94a6d49..8fe99d9 100644
--- a/m4/ltp-mkdtemp.m4
+++ b/m4/ltp-mkdtemp.m4
@@ -1,2 +1,5 @@
+dnl Copyright (c) Linux Test Project, 2011-2012
+dnl Author: Cyril Hrubis <chrubis@suse.cz>
+
 AC_DEFUN([LTP_CHECK_MKDTEMP],[
 AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!))])
diff --git a/m4/ltp-mmsghdr.m4 b/m4/ltp-mmsghdr.m4
index 0552218..c509c6a 100644
--- a/m4/ltp-mmsghdr.m4
+++ b/m4/ltp-mmsghdr.m4
@@ -1,17 +1,5 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 AC_DEFUN([LTP_CHECK_MMSGHDR],[
 AC_CHECK_TYPES([struct mmsghdr],,,[
diff --git a/m4/ltp-modify_ldt.m4 b/m4/ltp-modify_ldt.m4
index 465747f..e473ddc 100644
--- a/m4/ltp-modify_ldt.m4
+++ b/m4/ltp-modify_ldt.m4
@@ -1,33 +1,13 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Red Hat Inc., 2008
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Masatake YAMATO <yamato@redhat.com>
-dnl
 
-dnl
-dnl LTP_CHECK_SYSCALL_MODIFY_LDT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_MODIFY_LDT],
-[dnl
+[
 AC_CHECK_FUNCS(modify_ldt)
 AC_CHECK_HEADERS(asm/ldt.h,[LTP_SYSCALL_MODIFY_LDT_HEADER=yes])
 if test x"$LTP_SYSCALL_MODIFY_LDT_HEADER" = xyes; then
-   AC_CHECK_TYPES([struct user_desc, struct modify_ldt_ldt_s],[],[],[dnl
+   AC_CHECK_TYPES([struct user_desc, struct modify_ldt_ldt_s],[],[],[
 #include <asm/ldt.h>
 ])
-fi])dnl
+fi])
diff --git a/m4/ltp-mremap_fixed.m4 b/m4/ltp-mremap_fixed.m4
index e67962d..66548b8 100644
--- a/m4/ltp-mremap_fixed.m4
+++ b/m4/ltp-mremap_fixed.m4
@@ -1,27 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2012
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Cyril Hrubis <chrubis@suse.cz>
-dnl
 
-dnl
-dnl LTP_CHECK_MREMAP_FIXED
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_MREMAP_FIXED],[
 AH_TEMPLATE(HAVE_MREMAP_FIXED,
 [Define to 1 if you have MREMAP_FIXED in <sys/mman.h>.])
diff --git a/m4/ltp-nommu-linux.m4 b/m4/ltp-nommu-linux.m4
index ab97a78..7471ddd 100644
--- a/m4/ltp-nommu-linux.m4
+++ b/m4/ltp-nommu-linux.m4
@@ -1,13 +1,9 @@
-dnl
-dnl NOMMU/Linux (aka uClinux) checks
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) Linux Test Project, 2010
+dnl Author: Mike Frysinger <vapier@gentoo.org>
 
-dnl
-dnl LTP_CHECK_NOMMU_LINUX
-dnl ---------------------
-dnl
 AC_DEFUN([LTP_CHECK_NOMMU_LINUX],
-[dnl
+[
 	AC_CHECK_FUNCS([fork daemon vfork])
 	UCLINUX=0
 	if test "x$ac_cv_func_fork" = "xno" ; then
diff --git a/m4/ltp-numa.m4 b/m4/ltp-numa.m4
index 633f54c..483f571 100644
--- a/m4/ltp-numa.m4
+++ b/m4/ltp-numa.m4
@@ -1,28 +1,8 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Cisco Systems Inc., 2009
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
 dnl Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
-dnl
+dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
 
-dnl
-dnl LTP_CHECK_SYSCALL_NUMA
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [
 	AC_CHECK_LIB(numa, numa_available, [have_libnuma=yes])
 	AC_CHECK_HEADERS([numa.h numaif.h], [], [have_numa_headers=no])
diff --git a/m4/ltp-perf_event.m4 b/m4/ltp-perf_event.m4
index 109ad49..9415c07 100644
--- a/m4/ltp-perf_event.m4
+++ b/m4/ltp-perf_event.m4
@@ -1,13 +1,6 @@
-dnl
-dnl Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
-dnl
 dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl
+dnl Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
 
-dnl
-dnl LTP_CHECK_PERF_EVENT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_PERF_EVENT],[
 AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>])
 ])
diff --git a/m4/ltp-perf_event_open.m4 b/m4/ltp-perf_event_open.m4
index 2236340..6966cf2 100644
--- a/m4/ltp-perf_event_open.m4
+++ b/m4/ltp-perf_event_open.m4
@@ -1,28 +1,9 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2014 Fujitsu Ltd.
-dnl Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
 dnl Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
+dnl Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
 
-dnl
-dnl LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_SYSCALL_PERF_EVENT_OPEN],[dnl
+AC_DEFUN([LTP_CHECK_SYSCALL_PERF_EVENT_OPEN],[
 AH_TEMPLATE(HAVE_PERF_EVENT_ATTR,
 [Define to 1 if you have struct perf_event_attr])
 AC_MSG_CHECKING([for perf_event_attr in linux/perf_event.h])
diff --git a/m4/ltp-prctl.m4 b/m4/ltp-prctl.m4
index 55872ef..e429db8 100644
--- a/m4/ltp-prctl.m4
+++ b/m4/ltp-prctl.m4
@@ -1,30 +1,10 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Cisco Systems Inc., 2009
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
-dnl
 
-dnl
-dnl LTP_CHECK_PRCTL_SUPPORT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_PRCTL_SUPPORT],[
 AC_CHECK_HEADERS(sys/prctl.h,[
-	AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ], [],[],[dnl
+	AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ], [],[],[
 #include <sys/prctl.h>
 ]) dnl AC_CHECK_DECLS
 ])]
diff --git a/m4/ltp-ptrace.m4 b/m4/ltp-ptrace.m4
index ca360bb..6f03fa5 100644
--- a/m4/ltp-ptrace.m4
+++ b/m4/ltp-ptrace.m4
@@ -1,34 +1,13 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Jiri Palecek 2009
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-
 
 AC_DEFUN([LTP_CHECK_LINUX_PTRACE],
 _LTP_CHECK_LINUX_PTRACE
-)dnl
+)
 
-dnl _LTP_CHECK_LINUX_PTRACE
-dnl ----------------------------------------
-dnl
 dnl Check for ptrace support
 dnl in commit 016ae219 in July 2008
-dnl
-
-AC_DEFUN([_LTP_CHECK_LINUX_PTRACE],[dnl
+AC_DEFUN([_LTP_CHECK_LINUX_PTRACE],[
 dnl order of headers checked here is significant
 AC_CHECK_HEADERS([ \
 	sys/ptrace.h \
diff --git a/m4/ltp-quota.m4 b/m4/ltp-quota.m4
index a25e34a..bcdff70 100644
--- a/m4/ltp-quota.m4
+++ b/m4/ltp-quota.m4
@@ -1,58 +1,8 @@
-dnl
-dnl Copyright (c) Cisco Systems, Inc, 2008
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
+dnl Copyright (c) 2019 Fujitsu Ltd.
+dnl Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
 
-dnl
-dnl LTP_CHECK_SYSCALL_QUOTACTL
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_SYSCALL_QUOTACTL],[dnl
-	AC_LINK_IFELSE([AC_LANG_SOURCE([
-#define _LINUX_QUOTA_VERSION 2
-#include <sys/types.h>
-#include <sys/quota.h>
-#include <unistd.h>
-int main(void) {
-	struct dqblk dq;
-	return quotactl(QCMD(Q_GETINFO, USRQUOTA), (const char *) "/dev/null",
-			geteuid(), (caddr_t) &dq);
-}])],[has_quotav2="yes"])
-
-if test "x$has_quotav2" = xyes; then
-	AC_DEFINE(HAVE_QUOTAV2,1,[Define to 1 if you have quota v2])
-else
-
-	# got quota v1?
-	AC_LINK_IFELSE([AC_LANG_SOURCE([
-#define _LINUX_QUOTA_VERSION 1
-#include <sys/types.h>
-#include <sys/quota.h>
-#include <unistd.h>
-int main(void) {
-	struct dqblk dq;
-	return quotactl(QCMD(Q_GETQUOTA, USRQUOTA), (const char *) "/dev/null",
-			geteuid(), (caddr_t) &dq);
-}])],[has_quotav1="yes"])
-
-	if test "x$has_quotav1" = xyes; then
-		AC_DEFINE(HAVE_QUOTAV1,1,[Define to 1 if you have quota v1])
-	else
-		AC_MSG_WARN(Couldn't determine quota version (please submit config.log and manpage to ltp@lists.linux.it))
-	fi
-
-fi
+AC_DEFUN([LTP_CHECK_SYSCALL_QUOTACTL],[
+AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
+AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 ])
diff --git a/m4/ltp-securebits.m4 b/m4/ltp-securebits.m4
deleted file mode 100644
index bb27469..0000000
--- a/m4/ltp-securebits.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-dnl
-dnl Copyright (c) Serge Hallyn (2010)
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-
-AC_DEFUN([LTP_CHECK_SECUREBITS],[
-	AC_CHECK_HEADERS(linux/securebits.h,[have_securebits=yes])
-if test "x$have_securebits" != xyes; then
-	have_securebits=no
-fi
-AC_SUBST(HAVE_SECUREBITS,$have_securebits)
-])
diff --git a/m4/ltp-selinux.m4 b/m4/ltp-selinux.m4
index 53dca7d..fd0aeee 100644
--- a/m4/ltp-selinux.m4
+++ b/m4/ltp-selinux.m4
@@ -1,27 +1,8 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Red Hat Inc., 2009
-dnl
-dnl This program is free software;  you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2 of
-dnl the License, or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-dnl USA
 
-dnl
-dnl LTP_CHECK_SELINUX
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_SELINUX],
-[dnl
+[
 AH_TEMPLATE(HAVE_LIBSELINUX_DEVEL,
 [Define to 1 if you have both SELinux libraries and headers.])
 AC_CHECK_HEADERS(selinux/selinux.h,[
diff --git a/m4/ltp-signal.m4 b/m4/ltp-signal.m4
index e0a9335..6f5ce83 100644
--- a/m4/ltp-signal.m4
+++ b/m4/ltp-signal.m4
@@ -1,37 +1,17 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Cisco Systems, Inc. 2009
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
-dnl
 
-dnl
 dnl LTP_CHECK_SIGNAL
 dnl --------------------------
-dnl
 dnl * Check for sa_handler in struct_sigaction. The very fact that this
 dnl   definition is present or missing signifies whether or not the rt_sig*
 dnl   syscalls exist and are implemented on the target architecture, as the
 dnl   sigaction(2) call obscures this point in glibc. This doesn't signify
 dnl   whether or not the RT signals function though -- those must be proved
-dnl   through functionality tests..
-dnl
-
+dnl   through functionality tests.
 AC_DEFUN([LTP_CHECK_SIGNAL],
-[dnl
+[
 AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[
 #include <signal.h>
 ])
diff --git a/m4/ltp-signalfd.m4 b/m4/ltp-signalfd.m4
index d543edf..5aac395 100644
--- a/m4/ltp-signalfd.m4
+++ b/m4/ltp-signalfd.m4
@@ -1,91 +1,17 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Red Hat Inc., 2008
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
+dnl Copyright (c) 2019 Fujitsu Ltd.
 dnl Author: Masatake YAMATO <yamato@redhat.com>
-dnl
 
-dnl
-dnl LTP_CHECK_SYSCALL_SIGNALFD
-dnl --------------------------
-dnl
-dnl * Checking the existence of the libc wrapper for signalfd.
-dnl   If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FUNCTION is set to "yes".
-dnl
-dnl * Checking the existence of signalfd.h.
-dnl   If it exists, a shell variable LTP_SYSCALL_SIGNALFD_HEADER is set to "yes".
-dnl
-dnl * Checking the prefix used in fileds for signalfd_siginfo structure.
-dnl   If it exists, a shell variable LTP_SYSCALL_SIGNALFD_FIELD_PREFIX is set to "given".
-dnl
-dnl About cpp macros defined in this macro,
-dnl see testcases/kernel/syscalls/signalfd/signalfd01.c of ltp.
-dnl
+AC_DEFUN([LTP_CHECK_SYSCALL_SIGNALFD],[
 
-AC_DEFUN([LTP_CHECK_SYSCALL_SIGNALFD],
-[dnl
-_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
-_LTP_CHECK_SYSCALL_SIGNALFD_HEADER
-
-if test x"$LTP_SYSCALL_SIGNALFD_HEADER" = xyes; then
-   _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
-fi]dnl
-)dnl
-
-dnl _LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION
-dnl ------------------------------------
-dnl
-dnl
-AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FUNCTION],[dnl
-AC_CHECK_FUNCS(signalfd,[LTP_SYSCALL_SIGNALFD_FUNCTION=yes])])
-
-dnl _LTP_CHECK_SYSCALL_SIGNALFD_HEADER
-dnl ----------------------------------
-dnl
-dnl
-AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_HEADER],
-[dnl
-AC_CHECK_HEADERS([sys/signalfd.h linux/types.h])
-AC_CHECK_HEADERS([linux/signalfd.h signalfd.h],[dnl
-LTP_SYSCALL_SIGNALFD_HEADER=yes],,[dnl
-#ifdef HAVE_LINUX_TYPES_H
-#include <linux/types.h>
-#endif
-]dnl
-)dnl
-]dnl
-)dnl
-
-dnl _LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX
-dnl ----------------------------------------
-dnl
-dnl
-AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX],
-[dnl
-AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo, struct signalfd_siginfo.signo],[dnl
-LTP_SYSCALL_SIGNALFD_FIELD_PREFIX=given],,[dnl
+AC_CHECK_FUNCS(signalfd,,)
+AC_CHECK_HEADERS([sys/signalfd.h],,)
+AC_CHECK_HEADERS([linux/signalfd.h],,)
+AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo],,,[
 #if defined HAVE_SYS_SIGNALFD_H
 #include <sys/signalfd.h>
 #elif defined HAVE_LINUX_SIGNALFD_H
-#ifdef HAVE_LINUX_TYPES_H
-#include <linux/types.h>
-#endif
 #include <linux/signalfd.h>
-#elif defined HAVE_SIGNALFD_H
-#include <signalfd.h>
 #endif])
-]dnl
-)dnl
+])
diff --git a/m4/ltp-statx.m4 b/m4/ltp-statx.m4
index 7629f51..3dc06f6 100644
--- a/m4/ltp-statx.m4
+++ b/m4/ltp-statx.m4
@@ -1,25 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Zilogic Systems Pvt. Ltd., 2018
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
-dnl
-dnl LTP_CHECK_STATX
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_STATX],[
 AC_CHECK_FUNCS(statx,,)
 AC_CHECK_HEADER(linux/fs.h,,,)
diff --git a/m4/ltp-sync_add_and_fetch.m4 b/m4/ltp-sync_add_and_fetch.m4
index b9e2225..3815a07 100644
--- a/m4/ltp-sync_add_and_fetch.m4
+++ b/m4/ltp-sync_add_and_fetch.m4
@@ -1,18 +1,7 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2016
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
 
-AC_DEFUN([LTP_CHECK_SYNC_ADD_AND_FETCH],[dnl
+AC_DEFUN([LTP_CHECK_SYNC_ADD_AND_FETCH],[
 	AC_MSG_CHECKING([for __sync_add_and_fetch])
 	AC_LINK_IFELSE([AC_LANG_SOURCE([
 int main(void) {
diff --git a/m4/ltp-taskstats.m4 b/m4/ltp-taskstats.m4
index 19a9308..361daf5 100644
--- a/m4/ltp-taskstats.m4
+++ b/m4/ltp-taskstats.m4
@@ -1,39 +1,20 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Jiri Palecek 2009
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
 AC_DEFUN([LTP_CHECK_TASKSTATS],
 _LTP_CHECK_TASKSTATS_FREEPAGES
-)dnl
+)
 
-dnl _LTP_CHECK_TASKSTATS_FREEPAGES
-dnl ----------------------------------------
-dnl
 dnl Check for taskstat.freepages_* members, introduced to the kernel
 dnl in commit 016ae219 in July 2008
-dnl
 
 AC_DEFUN([_LTP_CHECK_TASKSTATS_FREEPAGES],[
 AC_CHECK_HEADERS([linux/taskstats.h],[
     AC_CHECK_MEMBERS([struct taskstats.freepages_count, struct taskstats.nvcsw, struct taskstats.read_bytes],
-                     [],[],[dnl
+                     [],[],[
 #include <linux/taskstats.h>
-]) dnl AC_CHECK_MEMBERS
+])
 ],[],[
 #include <linux/types.h>
-]) dnl AC_CHECK_HEADERS_ONCE
-]) dnl _LTP_CHECK_TASKSTATS_FREEPAGES
+])
+])
diff --git a/m4/ltp-time.m4 b/m4/ltp-time.m4
deleted file mode 100644
index 9d29547..0000000
--- a/m4/ltp-time.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl
-dnl Copyright (c) Copyrights-are-for-losers, Inc 2010
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-dnl Author: Ngie Cooper <yaneurabeya@gmail.com>
-dnl
-
-dnl
-dnl LTP_CHECK_TIME
-dnl
-dnl For all directly related time syscalls.
-dnl
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_TIME],[
-	AC_CHECK_DECLS([CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE],,,[
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include <time.h>
-])
-])
diff --git a/m4/ltp-timerfd.m4 b/m4/ltp-timerfd.m4
index a86a3a2..02d1969 100644
--- a/m4/ltp-timerfd.m4
+++ b/m4/ltp-timerfd.m4
@@ -1,25 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) Linux Test Project, 2014
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
 
-dnl
-dnl LTP_CHECK_TIMERFD
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_TIMERFD],[
 AC_CHECK_FUNCS([timerfd_create timerfd_settime timerfd_gettime])
 AC_CHECK_HEADERS([sys/timerfd.h])
diff --git a/m4/ltp-tirpc.m4 b/m4/ltp-tirpc.m4
index 707c373..baa5239 100644
--- a/m4/ltp-tirpc.m4
+++ b/m4/ltp-tirpc.m4
@@ -1,25 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2 of
-dnl the License, or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it would be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write the Free Software Foundation,
-dnl Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-dnl
 
-dnl
-dnl LTP_CHECK_TIRPC
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_TIRPC],[
 	TIRPC_CPPFLAGS=""
 	TIRPC_LIBS=""
diff --git a/m4/ltp-tpacket-v3.m4 b/m4/ltp-tpacket-v3.m4
index fce2e0e..7b730a2 100644
--- a/m4/ltp-tpacket-v3.m4
+++ b/m4/ltp-tpacket-v3.m4
@@ -1,17 +1,5 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 AC_DEFUN([LTP_CHECK_TPACKET_V3],[
 AC_CHECK_TYPES([struct tpacket_req3],,,[
diff --git a/m4/ltp-uname.m4 b/m4/ltp-uname.m4
index 5a30022..9e9f1d5 100644
--- a/m4/ltp-uname.m4
+++ b/m4/ltp-uname.m4
@@ -1,17 +1,5 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 AC_DEFUN([LTP_CHECK_UNAME_DOMAINNAME],[
 AC_CHECK_MEMBERS([struct utsname.domainname],,,[
diff --git a/m4/ltp-utimensat.m4 b/m4/ltp-utimensat.m4
index 1f9a055..0ababef 100644
--- a/m4/ltp-utimensat.m4
+++ b/m4/ltp-utimensat.m4
@@ -1,25 +1,6 @@
-dnl
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2 of
-dnl the License, or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it would be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write the Free Software Foundation,
-dnl Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-dnl
 
-dnl
-dnl LTP_CHECK_SYSCALL_UTIMENSAT
-dnl ----------------------------
-dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_UTIMENSAT],[
 	AC_MSG_CHECKING([for utimensat])
 	AC_LINK_IFELSE([AC_LANG_SOURCE([
diff --git a/m4/ltp-warn_oldstyle.m4 b/m4/ltp-warn_oldstyle.m4
index e6aedd7..fa6de7c 100644
--- a/m4/ltp-warn_oldstyle.m4
+++ b/m4/ltp-warn_oldstyle.m4
@@ -1,23 +1,8 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2 of
-dnl the License, or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it would be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write the Free Software Foundation,
-dnl Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-dnl
 dnl Author: Alexey Kodanev <alexey.kodanev@oracle.com>
-dnl
 
-AC_DEFUN([LTP_CHECK_CC_WARN_OLDSTYLE],[dnl
+AC_DEFUN([LTP_CHECK_CC_WARN_OLDSTYLE],[
 
 wflag="-Wold-style-definition"
 AC_MSG_CHECKING([if $CC supports $wflag])
diff --git a/m4/ltp-x_tables.m4 b/m4/ltp-x_tables.m4
index cd6a600..736aa8b 100644
--- a/m4/ltp-x_tables.m4
+++ b/m4/ltp-x_tables.m4
@@ -1,3 +1,4 @@
+dnl SPDX-License-Identifier: GPL-2.0-or-later
 dnl Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
 dnl
 dnl This program is free software;  you can redistribute it and/or modify
diff --git a/m4/ltp-xfs_quota.m4 b/m4/ltp-xfs_quota.m4
deleted file mode 100644
index c23412a..0000000
--- a/m4/ltp-xfs_quota.m4
+++ /dev/null
@@ -1,42 +0,0 @@
-dnl
-dnl Copyright (c) 2013 Fujitsu Ltd.
-dnl Author: DAN LI <li.dan@cn.fujitsu.com>
-dnl
-dnl This program is free software;  you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY;  without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-dnl the GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program;  if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-dnl
-
-dnl
-dnl LTP_CHECK_XFS_QUOTACTL
-dnl ----------------------------
-dnl
-AC_DEFUN([LTP_CHECK_XFS_QUOTACTL],[dnl
-	AC_MSG_CHECKING([for XFS quota (xfs/xqm.h)])
-	AC_LINK_IFELSE([AC_LANG_SOURCE([
-#define _GNU_SOURCE
-#include <xfs/xqm.h>
-#include <sys/quota.h>
-int main(void) {
-	struct fs_quota_stat qstat;
-	return quotactl(QCMD(Q_XGETQSTAT, USRQUOTA), "/dev/null", geteuid(),
-			(caddr_t) &qstat);
-}])],[has_xfs_quota="yes"])
-
-if test "x$has_xfs_quota" = xyes; then
-	AC_DEFINE(HAVE_XFS_QUOTA,1,[Define to 1 if you have xfs quota])
-	AC_MSG_RESULT(yes)
-else
-	AC_MSG_RESULT(no)
-fi
-])
diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 8ac484e..8b9fbe5 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -65,6 +65,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <ctype.h>
 
 #include "splitstr.h"
 #include "zoolib.h"
@@ -1200,6 +1201,14 @@
 				n->pcnt_f[1] = 's';
 			}
 			n->name = strdup(strsep(&a, " \t"));
+			while (a != NULL && isspace(*a))
+				a++;
+			if (a == NULL || a[0] == 0) {
+				fprintf(stderr,
+					"pan(%s): Testcase '%s' requires a command to execute.\n",
+					panname, n->name);
+				return NULL;
+			}
 			n->cmdline = strdup(a);
 			n->next = NULL;
 
diff --git a/runtest/commands b/runtest/commands
index ac15e8b..058266b 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -1,8 +1,8 @@
 #DESCRIPTION:General Linux commands
-ar_sh export TCdat=$LTPROOT/testcases/bin; ar01
-ld01_sh ld01
-ldd01_sh ldd01
-nm01_sh nm01
+ar_sh export TCdat=$LTPROOT/testcases/bin; ar01.sh
+ld01_sh ld01.sh
+ldd01_sh ldd01.sh
+nm01_sh nm01.sh
 file01_sh file01.sh
 tar01_sh  tar_tests.sh
 logrotate_sh export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh
@@ -40,3 +40,4 @@
 gdb01_sh gdb01.sh
 unshare01_sh unshare01.sh
 sysctl01_sh sysctl01.sh
+sysctl02_sh sysctl02.sh
diff --git a/runtest/crashme b/runtest/crashme
index a4c5b41..1475074 100644
--- a/runtest/crashme
+++ b/runtest/crashme
@@ -7,7 +7,7 @@
 crash01 crash01
 # Generate random code and execute it. Read f00f comment,
 # this test lockup SunOS,WindowsNT,etc. in seconds..
-crash02 crash02
+crash02 crash02 -v 2
 # Generate random syscalls and execute them, less probability
 # to hose your system, but still.
 mem01 mem01 -r
diff --git a/runtest/crypto b/runtest/crypto
index ad713c5..be8bc81 100644
--- a/runtest/crypto
+++ b/runtest/crypto
@@ -6,3 +6,4 @@
 af_alg06 af_alg06
 pcrypt_aead01 pcrypt_aead01
 crypto_user01 crypto_user01
+crypto_user02 crypto_user02
diff --git a/runtest/cve b/runtest/cve
index 031bcdc..57cf660 100644
--- a/runtest/cve
+++ b/runtest/cve
@@ -16,7 +16,6 @@
 cve-2016-10044 cve-2016-10044
 cve-2017-2618 cve-2017-2618
 cve-2017-2671 cve-2017-2671
-cve-2017-5669 shmat03
 cve-2017-6951 request_key05
 cve-2017-7308 setsockopt02
 cve-2017-7472 keyctl04
@@ -34,8 +33,10 @@
 cve-2017-5754 meltdown
 cve-2017-17052 cve-2017-17052
 cve-2017-16939 cve-2017-16939
+cve-2017-16995 bpf_prog03
 cve-2017-17053 cve-2017-17053
 cve-2017-18075 pcrypt_aead01
+cve-2017-1000380 snd_timer01
 cve-2018-5803 sctp_big_chunk
 cve-2018-1000001 realpath01
 cve-2018-19854 crypto_user01
diff --git a/runtest/fs b/runtest/fs
index ef2e848..4631857 100644
--- a/runtest/fs
+++ b/runtest/fs
@@ -66,12 +66,12 @@
 
 # Read every file in /proc. Not likely to crash, but does enough
 # to disturb the kernel. A good kernel latency killer too.
-# Was not sure why it should reside in runtest/crashme and won´t get tested ever
+# Was not sure why it should reside in runtest/crashme and won't get tested ever
 proc01 proc01 -m 128
 
 read_all_dev read_all -d /dev -p -q -r 10
 read_all_proc read_all -d /proc -q -r 10
-read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count
+read_all_sys read_all -d /sys -q -r 10
 
 #Run the File System Race Condition Check tests as well
 fs_racer fs_racer.sh -t 5
diff --git a/runtest/fs_ext4 b/runtest/fs_ext4
deleted file mode 100644
index 35697c5..0000000
--- a/runtest/fs_ext4
+++ /dev/null
@@ -1,4 +0,0 @@
-ext4-nsec-timestamps	ext4_nsec_timestamps_test.sh
-ext4-uninit-groups	ext4_uninit_groups_test.sh
-ext4-persist-prealloc	ext4_persist_prealloc_test.sh
-ext4-subdir-limit	ext4_subdir_limit_test.sh
diff --git a/runtest/ima b/runtest/ima
index bcae16b..f3ea88c 100644
--- a/runtest/ima
+++ b/runtest/ima
@@ -3,3 +3,4 @@
 ima_policy ima_policy.sh
 ima_tpm ima_tpm.sh
 ima_violations ima_violations.sh
+evm_overlay evm_overlay.sh
diff --git a/runtest/net.ipv6 b/runtest/net.ipv6
index 261a725..e599978 100644
--- a/runtest/net.ipv6
+++ b/runtest/net.ipv6
@@ -1,10 +1,12 @@
 #DESCRIPTION:IPV6 related tests
 ping601 ping01.sh -6
 ping602 ping02.sh -6
-sendfile601 sendfile01 -6
-tcpdump601 tcpdump01 -6
+sendfile601 sendfile01.sh -6
+tcpdump601 tcpdump01.sh -6
 tracepath601 tracepath01.sh -6
 traceroute601 traceroute01.sh -6
 dhcpd6 dhcpd_tests.sh -6
 dnsmasq6 dnsmasq_tests.sh -6
 ipneigh6_ip ipneigh01.sh -6 -c ip
+ip6tables iptables01.sh -6
+nft6 nft01.sh -6
diff --git a/runtest/net.multicast b/runtest/net.multicast
index 44c384a..14c8e5a 100644
--- a/runtest/net.multicast
+++ b/runtest/net.multicast
@@ -2,7 +2,7 @@
 #
 # PLEASE READ THE README FILE IN /multicast BEFORE RUNNING THESE.
 #
-mc_cmds mc_cmds
-mc_commo mc_commo
-mc_member mc_member
-mc_opts mc_opts
+mc_cmds mc_cmds.sh
+mc_commo mc_commo.sh
+mc_member mc_member.sh
+mc_opts mc_opts.sh
diff --git a/runtest/net.rpc b/runtest/net.rpc
index b65268c..fb0665f 100644
--- a/runtest/net.rpc
+++ b/runtest/net.rpc
@@ -2,7 +2,7 @@
 #
 # PLEASE READ THE README FILE IN /rpc BEFORE RUNNING THESE.
 #
-rpc01 rpc01
-rpcinfo rpcinfo01
-rup rup01
-rusers rusers01
+rpc01 rpc01.sh
+rpcinfo rpcinfo01.sh
+rup rup01.sh
+rusers rusers01.sh
diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index cfeacee..afe6d7c 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -6,18 +6,19 @@
 ipneigh01_ip ipneigh01.sh -c ip
 arping01 arping01.sh
 clockdiff01 clockdiff01.sh
-ftp export TCbin=$LTPROOT/testcases/network/tcp_cmds/ftp; ftp01
-host host01
-netstat netstat01
+ftp ftp01.sh
+host host01.sh
+netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
-rcp export TCbin=$LTPROOT/testcases/network/tcp_cmds/rcp; rcp01
-rlogin rlogin01
-rsh rsh01
-sendfile export TCbin=$LTPROOT/testcases/network/tcp_cmds/sendfile; sendfile01
-tcpdump tcpdump01
-telnet telnet01
-iptables iptables_tests.sh
+rcp rcp01.sh
+rlogin rlogin01.sh
+rsh rsh01.sh
+sendfile sendfile01.sh
+tcpdump tcpdump01.sh
+telnet telnet01.sh
+iptables iptables01.sh
+nft nft01.sh
 dhcpd dhcpd_tests.sh
 dnsmasq dnsmasq_tests.sh
 iproute ip_tests.sh
diff --git a/runtest/net.tirpc_tests b/runtest/net.tirpc_tests
index ba96749..48e9ba3 100644
--- a/runtest/net.tirpc_tests
+++ b/runtest/net.tirpc_tests
@@ -4,8 +4,6 @@
 tirpc_authnone_create rpc_test.sh -c tirpc_authnone_create
 tirpc_authsys_create rpc_test.sh -s tirpc_svc_1 -c tirpc_authsys_create
 tirpc_authsys_create_default rpc_test.sh -c tirpc_authsys_create_default
-tirpc_authdes_create rpc_test.sh -s tirpc_svc_1 -c tirpc_authdes_create
-tirpc_authdes_seccreate rpc_test.sh -s tirpc_svc_1 -c tirpc_authdes_seccreate
 
 tirpc_clnt_dg_create rpc_test.sh -s tirpc_svc_5 -c tirpc_clnt_dg_create
 tirpc_svc_dg_create rpc_test.sh -c tirpc_svc_dg_create
diff --git a/runtest/net_stress.appl b/runtest/net_stress.appl
index c06af71..0da1271 100644
--- a/runtest/net_stress.appl
+++ b/runtest/net_stress.appl
@@ -2,17 +2,17 @@
 # Stress test for major application protocol (ssh, dns, http, ftp)
 #
 
-ssh4-stress ssh-stress
-ssh6-stress ssh-stress -6
+ssh4-stress ssh-stress.sh
+ssh6-stress ssh-stress.sh -6
 
-dns4-stress dns-stress
-dns6-stress dns-stress -6
+dns4-stress dns-stress.sh
+dns6-stress dns-stress.sh -6
 
-http4-stress http-stress
-http6-stress http-stress -6
+http4-stress http-stress.sh
+http6-stress http-stress.sh -6
 
-ftp4-download-stress ftp-download-stress
-ftp6-download-stress ftp-download-stress -6
+ftp4-download-stress ftp-download-stress.sh
+ftp6-download-stress ftp-download-stress.sh -6
 
-ftp4-upload-stress ftp-upload-stress
-ftp6-upload-stress ftp-upload-stress -6
+ftp4-upload-stress ftp-upload-stress.sh
+ftp6-upload-stress ftp-upload-stress.sh -6
diff --git a/runtest/net_stress.interface b/runtest/net_stress.interface
index 315f125..106f2f1 100644
--- a/runtest/net_stress.interface
+++ b/runtest/net_stress.interface
@@ -2,30 +2,30 @@
 # Stress test for interface
 #
 
-if4-addr-change_ifconfig if4-addr-change
+if4-addr-change_ifconfig if4-addr-change.sh
 
-if4-updown_ip if-updown -c ip
-if4-updown_ifconfig if-updown -c ifconfig
-if4-addr-adddel_ip if-addr-adddel -c ip
-if4-addr-adddel_ifconfig if-addr-adddel -c ifconfig
-if4-addr-addlarge_ip if-addr-addlarge -c ip
-if4-addr-addlarge_ifconfig if-addr-addlarge -c ifconfig
-if4-route-adddel_ip if-route-adddel -c ip
-if4-route-adddel_route if-route-adddel -c route
-if4-route-addlarge_ip if-route-addlarge -c ip
-if4-route-addlarge_route if-route-addlarge -c route
-if4-mtu-change_ip if-mtu-change -c ip
-if4-mtu-change_ifconfig if-mtu-change -c ifconfig
+if4-updown_ip if-updown.sh -c ip
+if4-updown_ifconfig if-updown.sh -c ifconfig
+if4-addr-adddel_ip if-addr-adddel.sh -c ip
+if4-addr-adddel_ifconfig if-addr-adddel.sh -c ifconfig
+if4-addr-addlarge_ip if-addr-addlarge.sh -c ip
+if4-addr-addlarge_ifconfig if-addr-addlarge.sh -c ifconfig
+if4-route-adddel_ip if-route-adddel.sh -c ip
+if4-route-adddel_route if-route-adddel.sh -c route
+if4-route-addlarge_ip if-route-addlarge.sh -c ip
+if4-route-addlarge_route if-route-addlarge.sh -c route
+if4-mtu-change_ip if-mtu-change.sh -c ip
+if4-mtu-change_ifconfig if-mtu-change.sh -c ifconfig
 
-if6-updown_ip if-updown -6 -c ip
-if6-updown_ifconfig if-updown -6 -c ifconfig
-if6-addr-adddel_ip if-addr-adddel -6 -c ip
-if6-addr-adddel_ifconfig if-addr-adddel -6 -c ifconfig
-if6-addr-addlarge_ip if-addr-addlarge -6 -c ip
-if6-addr-addlarge_ifconfig if-addr-addlarge -6 -c ifconfig
-if6-route-adddel_ip if-route-adddel -6 -c ip
-if6-route-adddel_route if-route-adddel -6 -c route
-if6-route-addlarge_ip if-route-addlarge -6 -c ip
-if6-route-addlarge_route if-route-addlarge -6 -c route
-if6-mtu-change_ip if-mtu-change -6 -c ip
-if6-mtu-change_ifconfig if-mtu-change -6 -c ifconfig
+if6-updown_ip if-updown.sh -6 -c ip
+if6-updown_ifconfig if-updown.sh -6 -c ifconfig
+if6-addr-adddel_ip if-addr-adddel.sh -6 -c ip
+if6-addr-adddel_ifconfig if-addr-adddel.sh -6 -c ifconfig
+if6-addr-addlarge_ip if-addr-addlarge.sh -6 -c ip
+if6-addr-addlarge_ifconfig if-addr-addlarge.sh -6 -c ifconfig
+if6-route-adddel_ip if-route-adddel.sh -6 -c ip
+if6-route-adddel_route if-route-adddel.sh -6 -c route
+if6-route-addlarge_ip if-route-addlarge.sh -6 -c ip
+if6-route-addlarge_route if-route-addlarge.sh -6 -c route
+if6-mtu-change_ip if-mtu-change.sh -6 -c ip
+if6-mtu-change_ifconfig if-mtu-change.sh -6 -c ifconfig
diff --git a/runtest/net_stress.route b/runtest/net_stress.route
index 266ef03..4eff676 100644
--- a/runtest/net_stress.route
+++ b/runtest/net_stress.route
@@ -1,15 +1,12 @@
-#
 # Stress test for routing table
-#
-
-route4-change-dst route4-change-dst
-route4-change-gw route4-change-gw
-route4-change-if route4-change-if
+route4-change-dst route-change-dst.sh
+route4-change-gw route-change-gw.sh
+route4-change-if route-change-if.sh
 route4-redirect route4-redirect
 route4-rmmod route4-rmmod
 
-route6-change-dst route6-change-dst
-route6-change-gw route6-change-gw
-route6-change-if route6-change-if
+route6-change-dst route-change-dst.sh -6
+route6-change-gw route-change-gw.sh -6
+route6-change-if route-change-if.sh -6
 route6-redirect route6-redirect
 route6-rmmod route6-rmmod
diff --git a/runtest/numa b/runtest/numa
index 7885be9..7b9c2ae 100644
--- a/runtest/numa
+++ b/runtest/numa
@@ -1,4 +1,7 @@
-Numa-testcases numa01.sh
+migrate_pages01 migrate_pages01
+migrate_pages02 migrate_pages02
+migrate_pages03 migrate_pages03
+
 move_pages01 move_pages01
 move_pages02 move_pages02
 move_pages03 move_pages03
@@ -6,12 +9,13 @@
 move_pages05 move_pages05
 move_pages06 move_pages06
 move_pages07 move_pages07
-move_pages08 move_pages08
 move_pages09 move_pages09
 move_pages10 move_pages10
 move_pages11 move_pages11
 move_pages12 move_pages12
 
+numa_testcases numa01.sh
+
 set_mempolicy01 set_mempolicy01
 set_mempolicy02 set_mempolicy02
 set_mempolicy03 set_mempolicy03
diff --git a/runtest/quickhit b/runtest/quickhit
index b13ce08..e01b838 100644
--- a/runtest/quickhit
+++ b/runtest/quickhit
@@ -20,21 +20,6 @@
 #    TEST CASES
 # 	1.) alarm(100), fork, child's alarm(0) shall return 0;
 #	2.) alarm(100), fork, parent's alarm(0) shall return non-zero.
-asyncio02 asyncio02
-# 	Attempt to get some memory to work with.
-# 	Call testrun writing (BUFSIZ + 1) bytes
-# 	Call testrun writing BUFSIZ bytes
-# 	Repeated call to testrun() with decreasing write sizes
-# 		less than BUFSIZ
-# 	End
-#
-# 	Start testrun()
-# 	Attempt to open a temporary file.
-# 	Write the memory to the file.
-# 	Attempt to close the file which also flushes the buffers.
-# 	Now check to see if the number of bytes written is the
-# 		same as the number of bytes in the file.
-# 	Cleanup
 brk01 brk01
 # Basic test for brk()
 #    TEST CASES
@@ -122,8 +107,6 @@
 # %gs is not handled correctly.  See fork05.c for a copy of Ulrich's email
 fpathconf01 fpathconf01
 # Basic test for fpathconf(2)
-fstat01 fstat01
-# Basic test for fstat(2)
 fstatfs01 fstatfs01
 # Basic test for fstatfs(2)
 fsync01 fsync01
diff --git a/runtest/scsi_debug.part1 b/runtest/scsi_debug.part1
index 5d0aed7..ce14702 100644
--- a/runtest/scsi_debug.part1
+++ b/runtest/scsi_debug.part1
@@ -143,39 +143,3 @@
 rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2  -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/msdos/rwtest03%f
 rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2  -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/msdos/rwtest04%f
 rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/msdos/rwtest05%f
-# Check the Reiserfs filesystem
-gf201 growfiles -W gf201 -d /test/growfiles/reiser -b -e 1 -u -i 0 -L 20 -w -C 1 -l -I r -T 10 glseek20 glseek20.2
-gf202 growfiles -W gf202 -d /test/growfiles/reiser -b -e 1 -L 10 -i 100 -I p -S 2 -u -f gf03_
-gf203 growfiles -W gf203 -d /test/growfiles/reiser -b -e 1 -g 1 -i 1 -S 150 -u -f gf05_
-gf204 growfiles -W gf204 -d /test/growfiles/reiser -b -e 1 -g 4090 -i 500 -t 39000 -u -f gf06_
-gf205 growfiles -W gf205 -d /test/growfiles/reiser -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -u -f gf07_
-gf206 growfiles -W gf206 -d /test/growfiles/reiser -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 g_rand10 g_rand10.2
-gf207 growfiles -W gf207 -d /test/growfiles/reiser -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p g_rand13 g_rand13.2
-gf208 growfiles -W gf208 -d /test/growfiles/reiser -b -e 1 -u -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 g_rand11 g_rand11.2
-gf209 growfiles -W gf209 -d /test/growfiles/reiser -b -e 1 -u -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 -I p g_rand12 g_rand12.2
-gf210 growfiles -W gf210 -d /test/growfiles/reiser -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I l g_lio14 g_lio14.2
-gf211 growfiles -W gf211 -d /test/growfiles/reiser -b -e 1 -u -r 1-5000 -i 0 -L 30 -C 1 -I L g_lio15 g_lio15.2
-gf212 mkfifo gffifo17; growfiles -W gf212 -d /test/growfiles/reiser -b -e 1 -u -i 0 -L 30 gffifo17
-gf213 mkfifo gffifo18; growfiles -W gf213 -d /test/growfiles/reiser -b -e 1 -u -i 0 -L 30 -I r -r 1-4096 gffifo18
-gf214 growfiles -W gf214 -d /test/growfiles/reiser -b -e 1 -u -i 0 -L 20 -w -l -C 1 -T 10 glseek19 glseek19.2
-gf215 growfiles -W gf215 -d /test/growfiles/reiser -b -e 1 -u -r 1-49600 -I r -u -i 0 -L 120 Lgfile1
-gf216 growfiles -W gf216 -d /test/growfiles/reiser -b -e 1 -i 0 -L 120 -u -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -S 10 -f Lgf02_
-gf217 growfiles -W gf217 -d /test/growfiles/reiser -b -e 1 -i 0 -L 120 -u -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -S 10 -f Lgf03_
-gf218 growfiles -W gf218 -d /test/growfiles/reiser -b -e 1 -i 0 -L 120 -w -u -r 10-5000 -I r -T 10 -l -S 2 -f Lgf04_
-gf219 growfiles -W gf219 -d /test/growfiles/reiser -b -e 1 -g 5000 -i 500 -t 49900 -T10 -c9 -I p -o O_RDWR,O_CREAT,O_TRUNC -u -f gf08i_
-gf220 growfiles -W gf220 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1-256000:512 -R 512-256000 -T 4 gfbigio-$$
-gf221 growfiles -W gf221 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 gf-bld-$$
-gf222 growfiles -W gf222 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 -T 10 -t 20480 gf-bldf-$$
-gf223 growfiles -W gf223 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 512-64000:1024 -R 1-384000 -T 4 gf-inf-$$
-gf224 growfiles -W gf224 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -g 20480 gf-jbld-$$
-gf225 growfiles -W gf225 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 1024000-2048000:2048 -R 4095-2048000 -T 1 gf-large-gs-$$
-gf226 growfiles -W gf226 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 gfsmallio-$$
-gf227 growfiles -W gf227 -d /test/growfiles/reiser -b -D 0 -w -g 8b -C 1 -b -i 1000 -u gfsparse-1-$$
-gf228 growfiles -W gf228 -d /test/growfiles/reiser -b -D 0 -w -g 16b -C 1 -b -i 1000 -u gfsparse-2-$$
-gf229 growfiles -W gf229 -d /test/growfiles/reiser -b -D 0 -r 1-4096 -R 0-33554432 -i 0 -L 60 -C 1 -u gfsparse-3-$$
-gf230 growfiles -W gf230 -d /test/growfiles/reiser -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -o O_RDWR,O_CREAT,O_SYNC -g 20480 -T 10 -t 20480 gf-sync-$$
-rwtest01 export LTPROOT; rwtest -N rwtest01 -c -q -i 60s  -f sync 10%25000:rw-sync-$$ 500b:/test/growfiles/reiser/rwtest06%f
-rwtest02 export LTPROOT; rwtest -N rwtest02 -c -q -i 60s  -f buffered 10%25000:rw-buffered-$$ 500b:/test/growfiles/reiser/rwtest07%f
-rwtest03 export LTPROOT; rwtest -N rwtest03 -c -q -i 60s -n 2  -f buffered -s mmread,mmwrite -m random -Dv 10%25000:mm-buff-$$ 500b:/test/growfiles/reiser/rwtest08%f
-rwtest04 export LTPROOT; rwtest -N rwtest04 -c -q -i 60s -n 2  -f sync -s mmread,mmwrite -m random -Dv 10%25000:mm-sync-$$ 500b:/test/growfiles/reiser/rwtest09%f
-rwtest05 export LTPROOT; rwtest -N rwtest05 -c -q -i 50 -T 64b 500b:/test/growfiles/reiser/rwtest10%f
diff --git a/runtest/syscalls b/runtest/syscalls
index 4565c3a..a39ad2f 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -2,6 +2,8 @@
 abort01 abort01
 
 accept01 accept01
+accept02 accept02
+
 accept4_01 accept4_01
 
 access01 access01
@@ -10,6 +12,7 @@
 access04 access04
 
 acct01 acct01
+acct02 acct02
 
 add_key01 add_key01
 add_key02 add_key02
@@ -25,13 +28,14 @@
 alarm06 alarm06
 alarm07 alarm07
 
-asyncio02 asyncio02
-
 bind01 bind01
 bind02 bind02
 bind03 bind03
 
-bdflush01 bdflush01
+bpf_map01 bpf_map01
+bpf_prog01 bpf_prog01
+bpf_prog02 bpf_prog02
+bpf_prog03 bpf_prog03
 
 brk01 brk01
 
@@ -40,6 +44,8 @@
 
 capset01 capset01
 capset02 capset02
+capset03 capset03
+capset04 capset04
 
 cacheflush01 cacheflush01
 
@@ -84,6 +90,7 @@
 
 clock_gettime01 clock_gettime01
 clock_gettime02 clock_gettime02
+leapsec01 leapsec01
 
 clock_settime01 clock_settime01
 clock_settime02 clock_settime02
@@ -334,14 +341,10 @@
 fremovexattr01 fremovexattr01
 fremovexattr02 fremovexattr02
 
-fstat01 fstat01
-fstat01_64 fstat01_64
 fstat02 fstat02
 fstat02_64 fstat02_64
 fstat03 fstat03
 fstat03_64 fstat03_64
-fstat05 fstat05
-fstat05_64 fstat05_64
 
 #fstatat64/newfstatat test cases
 fstatat01 fstatat01
@@ -358,8 +361,6 @@
 
 ftruncate01 ftruncate01
 ftruncate01_64 ftruncate01_64
-ftruncate02 ftruncate02
-ftruncate02_64 ftruncate02_64
 ftruncate03 ftruncate03
 ftruncate03_64 ftruncate03_64
 ftruncate04 ftruncate04
@@ -537,6 +538,9 @@
 fanotify10 fanotify10
 fanotify11 fanotify11
 fanotify12 fanotify12
+fanotify13 fanotify13
+fanotify14 fanotify14
+fanotify15 fanotify15
 
 ioperm01 ioperm01
 ioperm02 ioperm02
@@ -544,6 +548,11 @@
 iopl01 iopl01
 iopl02 iopl02
 
+ioprio_get01 ioprio_get01
+ioprio_set01 ioprio_set01
+ioprio_set02 ioprio_set02
+ioprio_set03 ioprio_set03
+
 io_cancel01 io_cancel01
 io_destroy01 io_destroy01
 io_getevents01 io_getevents01
@@ -626,12 +635,13 @@
 lstat01_64 lstat01_64
 lstat02 lstat02
 lstat02_64 lstat02_64
-lstat03 lstat03
-lstat03_64 lstat03_64
 
 mallopt01 mallopt01
 
 mbind01 mbind01
+mbind02 mbind02
+mbind03 mbind03
+mbind04 mbind04
 
 memset01 memset01
 memcmp01 memcmp01
@@ -715,7 +725,6 @@
 move_pages05 move_pages05
 move_pages06 move_pages06
 move_pages07 move_pages07
-move_pages08 move_pages08
 move_pages09 move_pages09
 move_pages10 move_pages10
 move_pages11 move_pages11
@@ -726,6 +735,8 @@
 mprotect03 mprotect03
 mprotect04 mprotect04
 
+pkey01 pkey01
+
 mq_notify01 mq_notify01
 mq_notify02 mq_notify02
 mq_open01 mq_open01
@@ -783,7 +794,6 @@
 
 nanosleep01 nanosleep01
 nanosleep02 nanosleep02
-nanosleep03 nanosleep03
 nanosleep04 nanosleep04
 
 nftw01 nftw01
@@ -838,6 +848,10 @@
 personality01 personality01
 personality02 personality02
 
+pidfd_send_signal01 pidfd_send_signal01
+pidfd_send_signal02 pidfd_send_signal02
+pidfd_send_signal03 pidfd_send_signal03
+
 pipe01 pipe01
 pipe02 pipe02
 pipe03 pipe03
@@ -863,6 +877,12 @@
 prctl01 prctl01
 prctl02 prctl02
 prctl03 prctl03
+prctl04 prctl04
+prctl05 prctl05
+prctl06 prctl06
+prctl07 prctl07
+prctl08 prctl08
+prctl09 prctl09
 
 pread01 pread01
 pread01_64 pread01_64
@@ -882,6 +902,8 @@
 preadv201_64 preadv201_64
 preadv202 preadv202
 preadv202_64 preadv202_64
+preadv203 preadv203
+preadv203_64 preadv203_64
 
 profil01 profil01
 
@@ -935,6 +957,9 @@
 quotactl01 quotactl01
 quotactl02 quotactl02
 quotactl03 quotactl03
+quotactl04 quotactl04
+quotactl05 quotactl05
+quotactl06 quotactl06
 
 read01 read01
 read02 read02
@@ -1127,6 +1152,15 @@
 sendto01 sendto01
 sendto02 sendto02
 
+set_mempolicy01 set_mempolicy01
+set_mempolicy02 set_mempolicy02
+set_mempolicy03 set_mempolicy03
+set_mempolicy04 set_mempolicy04
+
+set_robust_list01 set_robust_list01
+set_thread_area01 set_thread_area01
+set_tid_address01 set_tid_address01
+
 setdomainname01	setdomainname01
 setdomainname02	setdomainname02
 setdomainname03	setdomainname03
@@ -1240,15 +1274,12 @@
 setrlimit05 setrlimit05
 setrlimit06 setrlimit06
 
-set_robust_list01 set_robust_list01
-set_thread_area01 set_thread_area01
-set_tid_address01 set_tid_address01
-
 setsid01 setsid01
 
 setsockopt01 setsockopt01
 setsockopt02 setsockopt02
 setsockopt03 setsockopt03
+setsockopt04 setsockopt04
 
 settimeofday01 settimeofday01
 settimeofday02 settimeofday02
@@ -1343,6 +1374,8 @@
 
 stat01 stat01
 stat01_64 stat01_64
+stat02 stat02
+stat02_64 stat02_64
 stat03 stat03
 stat03_64 stat03_64
 stat04 symlink01 -T stat04
@@ -1444,9 +1477,19 @@
 timerfd_gettime01 timerfd_gettime01
 timerfd_settime01 timerfd_settime01
 
+timer_create01 timer_create01
+timer_create02 timer_create02
+timer_create03 timer_create03
+
+timer_delete01 timer_delete01
+timer_delete02 timer_delete02
+
 timer_getoverrun01 timer_getoverrun01
 timer_gettime01 timer_gettime01
 
+timer_settime01 timer_settime01
+timer_settime02 timer_settime02
+
 tkill01 tkill01
 tkill02 tkill02
 
@@ -1521,6 +1564,7 @@
 #vmsplice test cases
 vmsplice01 vmsplice01
 vmsplice02 vmsplice02
+vmsplice03 vmsplice03
 
 wait01 wait01
 wait02 wait02
@@ -1560,6 +1604,8 @@
 perf_event_open01 perf_event_open01
 perf_event_open02 perf_event_open02
 
+futex_cmp_requeue01 futex_cmp_requeue01
+futex_cmp_requeue02 futex_cmp_requeue02
 futex_wait01 futex_wait01
 futex_wait02 futex_wait02
 futex_wait03 futex_wait03
@@ -1578,6 +1624,8 @@
 memfd_create04 memfd_create04
 
 copy_file_range01 copy_file_range01
+copy_file_range02 copy_file_range02
+copy_file_range03 copy_file_range03
 
 statx01 statx01
 statx02 statx02
diff --git a/runtest/timers b/runtest/timers
deleted file mode 100644
index 5f5ecb6..0000000
--- a/runtest/timers
+++ /dev/null
@@ -1,9 +0,0 @@
-#DESCRIPTION:Posix Timer Tests
-timer_create02 timer_create02
-timer_create03 timer_create03
-timer_create04 timer_create04
-timer_delete02 timer_delete02
-timer_delete03 timer_delete03
-timer_settime02 timer_settime02
-timer_settime03 timer_settime03
-leapsec_timer leapsec_timer
diff --git a/runtest/tracing b/runtest/tracing
index 504132d..d2700ca 100644
--- a/runtest/tracing
+++ b/runtest/tracing
@@ -4,3 +4,7 @@
 ftrace-stress-test	ftrace_stress_test.sh 90
 dynamic_debug01		dynamic_debug01.sh
 pt_full_trace_basic pt_test
+pt_snapshot_trace_basic pt_test -m
+pt_ex_user pt_test -e user
+pt_ex_kernel pt_test -e kernel
+pt_disable_branch pt_test -b
diff --git a/runtest/uevent b/runtest/uevent
new file mode 100644
index 0000000..0b59c87
--- /dev/null
+++ b/runtest/uevent
@@ -0,0 +1,3 @@
+uevent01 uevent01
+uevent02 uevent02
+uevent03 uevent03
diff --git a/scenario_groups/default b/scenario_groups/default
index 1f3e5b2..439783d 100644
--- a/scenario_groups/default
+++ b/scenario_groups/default
@@ -17,16 +17,15 @@
 cap_bounds
 fcntl-locktests
 connectors
-timers
 power_management_tests
 hugetlb
 commands
 hyperthreading
-kernel_misc
-fs_ext4
 can
 cpuhotplug
 net.ipv6_lib
 input
 cve
 crypto
+kernel_misc
+uevent
diff --git a/scenario_groups/vts b/scenario_groups/vts
index 203cbdf..6519e39 100644
--- a/scenario_groups/vts
+++ b/scenario_groups/vts
@@ -10,7 +10,6 @@
 filecaps
 fs
 fs_bind
-fs_ext4
 fs_perms_simple
 fsx
 hugetlb
@@ -28,5 +27,4 @@
 sched_low_mem
 securebits
 syscalls
-timers
 tracing
diff --git a/testcases/commands/ar/Makefile b/testcases/commands/ar/Makefile
index 3b694a3..05a9080 100644
--- a/testcases/commands/ar/Makefile
+++ b/testcases/commands/ar/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= ar01
+INSTALL_TARGETS		:= ar01.sh
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/commands/ar/ar01 b/testcases/commands/ar/ar01.sh
similarity index 89%
rename from testcases/commands/ar/ar01
rename to testcases/commands/ar/ar01.sh
index 0252c6d..b4af622 100644
--- a/testcases/commands/ar/ar01
+++ b/testcases/commands/ar/ar01.sh
@@ -1,27 +1,11 @@
 #!/bin/sh
-#
-# Copyright (c) International Business Machines  Corp., 2000
-#  06/01 Robbie Williamson (robbiew@us.ibm.com)
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2000
 # Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-#
-# 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
-#
-#-----------------------------------------------------------------------
+# Author: Robbie Williamson <robbiew@us.ibm.com>
 #
 # This is a basic ar command test.
-#
+
 AR="${AR:=ar}"
 TST_CNT=17
 TST_SETUP=setup
diff --git a/testcases/commands/cp/cp_tests.sh b/testcases/commands/cp/cp_tests.sh
index 30bb183..9a6590e 100755
--- a/testcases/commands/cp/cp_tests.sh
+++ b/testcases/commands/cp/cp_tests.sh
@@ -1,28 +1,11 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author:       Manoj Iyer, manjo@mail.utexas.edu                           ##
-## Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>                          ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
 # Tests basic cp functionality
-#
+
 TST_CNT=5
 TST_TESTFUNC=do_test
 TST_SETUP=setup
diff --git a/testcases/commands/cpio/cpio_tests.sh b/testcases/commands/cpio/cpio_tests.sh
index 9ebfb10..a1469d8 100755
--- a/testcases/commands/cpio/cpio_tests.sh
+++ b/testcases/commands/cpio/cpio_tests.sh
@@ -1,28 +1,8 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author: Manoj Iyer, manjo@mail.utexas.edu                                 ##
-## Copyright (c) Cyril Hrubis <chrubis@suse.cz>                               ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
 #
 # Test basic functionality of cpio command
-#
+
 TST_TESTFUNC=cpio_test
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="cpio"
diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index 9b0be76..02aeec7 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -1,30 +1,18 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
 # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>
 #
-# 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.
-#
 # Test df command with some basic options.
-#
 
 TST_CNT=12
 TST_SETUP=setup
-TST_CLEANUP=cleanup
+TST_CLEANUP=tst_umount
 TST_TESTFUNC=test
 TST_OPTS="f:"
 TST_USAGE=usage
 TST_PARSE_ARGS=parse_args
 TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
 TST_NEEDS_DEVICE=1
 . tst_test.sh
 
@@ -54,11 +42,6 @@
 	DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk '{print $5}')
 }
 
-cleanup()
-{
-	tst_umount $TST_DEVICE
-}
-
 df_test()
 {
 	local cmd="$1 -P"
diff --git a/testcases/commands/du/du01.sh b/testcases/commands/du/du01.sh
index c750682..1f0df95 100755
--- a/testcases/commands/du/du01.sh
+++ b/testcases/commands/du/du01.sh
@@ -1,24 +1,9 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
 # Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
 #
-# 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 St, Fifth Floor, Boston, MA  02110-1301  USA
-#
 # Test du command with some basic options.
-#
 
 TST_CNT=23
 TST_SETUP=setup
diff --git a/testcases/commands/eject/eject-tests.sh b/testcases/commands/eject/eject-tests.sh
index c1dcd58..299b9fa 100755
--- a/testcases/commands/eject/eject-tests.sh
+++ b/testcases/commands/eject/eject-tests.sh
@@ -1,28 +1,10 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author: Manoj Iyer, manjo@mail.utexas.edu                                 ##
-## Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>                          ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
 # Tests basic functionality of eject command.
-#
 
 TST_CNT=4
 TST_SETUP=setup
diff --git a/testcases/commands/file/file01.sh b/testcases/commands/file/file01.sh
index 55c0433..ff1e081 100755
--- a/testcases/commands/file/file01.sh
+++ b/testcases/commands/file/file01.sh
@@ -1,29 +1,12 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-## Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>                          ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
 #
 # This program tests the file command. The tests are aimed at
 # testing if the file command can recognize some of the commonly
 # used file formats like, tar, tar.gz, rpm, C, ASCII, ELF etc.
-#
+
 TST_CNT=20
 TST_SETUP=setup
 TST_TESTFUNC=do_test
diff --git a/testcases/commands/gdb/gdb01.sh b/testcases/commands/gdb/gdb01.sh
index e3a5b51..04259c5 100755
--- a/testcases/commands/gdb/gdb01.sh
+++ b/testcases/commands/gdb/gdb01.sh
@@ -1,26 +1,9 @@
 #!/bin/sh
-
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (C) 2017 Red Hat, Inc.
 #
-# 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, see <http://www.gnu.org/licenses/>.
-#
-
-# Test description: See if gdb can successfully attach to a process and
-#                   this process exits normally.
-
-# Usage
-# ./gdb01.sh
+# Test if gdb can successfully attach to a process and
+# this process exits normally.
 
 TST_TESTFUNC=simple_test
 TST_NEEDS_CMDS="gdb /bin/cat"
diff --git a/testcases/commands/gzip/gzip_tests.sh b/testcases/commands/gzip/gzip_tests.sh
index 05ecb6f..f4e3366 100755
--- a/testcases/commands/gzip/gzip_tests.sh
+++ b/testcases/commands/gzip/gzip_tests.sh
@@ -1,32 +1,14 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-## Author:       Manoj Iyer, manjo@mail.utexas.edu                            ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
-# Description:  Test basic functionality of gzip and gunzip command
-#		- Test #1:  Test that gzip -r will travel directories and
-#			    compress all the files available.
+# Test basic functionality of gzip and gunzip command
+# Test #1: Test that gzip -r will travel directories and
+#  compress all the files available.
 #
-#		- Test #2:  Test that gunzip -r will travel directories and
-#			    uncompress all the files available.
-#
+# Test #2: Test that gunzip -r will travel directories and
+# uncompress all the files available.
 
 TST_CNT=2
 TST_TESTFUNC=test
diff --git a/testcases/commands/insmod/insmod01.sh b/testcases/commands/insmod/insmod01.sh
index a7835f9..e7c3d6f 100755
--- a/testcases/commands/insmod/insmod01.sh
+++ b/testcases/commands/insmod/insmod01.sh
@@ -1,20 +1,9 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Fujitsu Ltd.
 # Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
-# 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.
-#
-# Test the basic functionality of insmod command.
-#
+# Test basic functionality of insmod command.
 
 TST_CLEANUP=cleanup
 TST_TESTFUNC=do_test
diff --git a/testcases/commands/insmod/ltp_insmod01.c b/testcases/commands/insmod/ltp_insmod01.c
index 398714e..9e85951 100644
--- a/testcases/commands/insmod/ltp_insmod01.c
+++ b/testcases/commands/insmod/ltp_insmod01.c
@@ -31,5 +31,7 @@
 
 }
 
+MODULE_LICENSE("GPL");
+
 module_init(test_init);
 module_exit(test_exit);
diff --git a/testcases/commands/keyctl/keyctl01.sh b/testcases/commands/keyctl/keyctl01.sh
index 3fda389..0858b68 100644
--- a/testcases/commands/keyctl/keyctl01.sh
+++ b/testcases/commands/keyctl/keyctl01.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 Fujitsu Ltd.
 # Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # This is a regression test about potential uninitialized variable,
 # the test can crash the buggy kernel, and the bug has been fixed in:
 #
@@ -24,7 +11,6 @@
 #   Date:   Thu Jun 16 15:48:57 2016 +0100
 #
 #   KEYS: potential uninitialized variable
-#
 
 TST_SETUP=setup
 TST_CLEANUP=cleanup
diff --git a/testcases/commands/ld/Makefile b/testcases/commands/ld/Makefile
index 4b7ca96..a4117c8 100644
--- a/testcases/commands/ld/Makefile
+++ b/testcases/commands/ld/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= ld01
+INSTALL_TARGETS		:= ld01.sh
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/commands/ld/ld01 b/testcases/commands/ld/ld01.sh
similarity index 61%
rename from testcases/commands/ld/ld01
rename to testcases/commands/ld/ld01.sh
index 986ad1e..a05627f 100755
--- a/testcases/commands/ld/ld01
+++ b/testcases/commands/ld/ld01.sh
@@ -1,26 +1,10 @@
 #!/bin/sh
-#
-# Copyright (c) International Business Machines  Corp., 2000
-#  06/01 Robbie Williamson (robbiew@us.ibm.com)
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2000
 # Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+# Author: Robbie Williamson <robbiew@us.ibm.com>
 #
-# 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
-#---------------------------------------------------------------------------
-#
-# Test the basic functionality of the `ld` command.
-#
+# Test basic functionality of the `ld` command.
 
 CC=${CC:=gcc}
 LD=${LD:=ld}
diff --git a/testcases/commands/ldd/Makefile b/testcases/commands/ldd/Makefile
index 6a6af07..1afd3da 100644
--- a/testcases/commands/ldd/Makefile
+++ b/testcases/commands/ldd/Makefile
@@ -20,6 +20,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= ldd01
+INSTALL_TARGETS		:= ldd01.sh
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/commands/ldd/ldd01 b/testcases/commands/ldd/ldd01
deleted file mode 100755
index cf2aac3..0000000
--- a/testcases/commands/ldd/ldd01
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-#
-#   Copyright (c) International Business Machines  Corp., 2000
-#
-#   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
-#
-#
-#
-#  FILE   : ldd01
-#
-#  PURPOSE: To test the basic functionality of the `ldd` command.
-#
-#  HISTORY:
-#    06/01 Robbie Williamson (robbiew@us.ibm.com)
-#     -Ported
-#---------------------------------------------------------------------------
-
-TST_CNT=2
-TST_SETUP=setup
-TST_TESTFUNC=test
-. tst_test.sh
-
-LDD=${LDD:=ldd}
-
-setup()
-{
-	export LD_LIBRARY_PATH="$TST_DATAROOT:$LD_LIBRARY_PATH"
-	LDDTESTFILE="$TST_DATAROOT/lddfile.out"
-}
-
-test1()
-{
-
-	$LDD $LDDTESTFILE | grep -q -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
-	if [ $? -eq 0 ]; then
-		tst_res TPASS "Found lddfile*.obj.so"
-	else
-		tst_res TFAIL "Haven't found lddfile*.obj.so"
-	fi
-}
-
-test2()
-{
-	$LDD -v $LDDTESTFILE | grep -q -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
-	if [ $? -eq 0 ]; then
-		tst_res TPASS "Found GLIBC"
-	else
-		tst_res TFAIL "Haven't found GLIBC"
-	fi
-}
-
-tst_run
diff --git a/testcases/commands/ldd/ldd01.sh b/testcases/commands/ldd/ldd01.sh
new file mode 100755
index 0000000..8d7965a
--- /dev/null
+++ b/testcases/commands/ldd/ldd01.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2000
+# Author: Robbie Williamson <robbiew@us.ibm.com>
+#
+# test basic functionality of the `ldd` command.
+
+TST_CNT=2
+TST_SETUP=setup
+TST_TESTFUNC=test
+. tst_test.sh
+
+LDD=${LDD:=ldd}
+
+setup()
+{
+	export LD_LIBRARY_PATH="$TST_DATAROOT:$LD_LIBRARY_PATH"
+	LDDTESTFILE="$TST_DATAROOT/lddfile.out"
+}
+
+test1()
+{
+
+	$LDD $LDDTESTFILE | grep -q -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
+	if [ $? -eq 0 ]; then
+		tst_res TPASS "Found lddfile*.obj.so"
+	else
+		tst_res TFAIL "Haven't found lddfile*.obj.so"
+	fi
+}
+
+test2()
+{
+	$LDD -v $LDDTESTFILE | grep -q -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
+	if [ $? -eq 0 ]; then
+		tst_res TPASS "Found GLIBC"
+	else
+		tst_res TFAIL "Haven't found GLIBC"
+	fi
+}
+
+tst_run
diff --git a/testcases/commands/ln/ln_tests.sh b/testcases/commands/ln/ln_tests.sh
index bc48bed..ecf7bf5 100755
--- a/testcases/commands/ln/ln_tests.sh
+++ b/testcases/commands/ln/ln_tests.sh
@@ -1,28 +1,11 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author:       Manoj Iyer, manjo@mail.utexas.edu                           ##
-## Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>                          ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
 # Basic test for ln
-#
+
 TST_CNT=6
 TST_TESTFUNC=do_test
 TST_SETUP=setup
diff --git a/testcases/commands/lsmod/lsmod01.sh b/testcases/commands/lsmod/lsmod01.sh
index 132a446..0f5b6aa 100755
--- a/testcases/commands/lsmod/lsmod01.sh
+++ b/testcases/commands/lsmod/lsmod01.sh
@@ -1,50 +1,54 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
 # Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
-# 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.
-#
-# Test the basic functionality of lsmod command.
-#
+# Test basic functionality of lsmod command.
+
 TST_TESTFUNC=lsmod_test
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="lsmod"
 . tst_test.sh
 
-lsmod_test()
+lsmod_matches_proc_modules()
 {
 	lsmod_output=$(lsmod | awk '!/Module/{print $1, $2, $3}' | sort)
 	if [ -z "$lsmod_output" ]; then
-		tst_res TFAIL "Failed to parse the output from lsmod"
-		return
+		tst_brk TBROK "Failed to parse the output from lsmod"
 	fi
 
 	modules_output=$(awk '{print $1, $2, $3}' /proc/modules | sort)
 	if [ -z "$modules_output" ]; then
-		tst_res TFAIL "Failed to parse /proc/modules"
-		return
+		tst_brk TBROK "Failed to parse /proc/modules"
 	fi
 
 	if [ "$lsmod_output" != "$modules_output" ]; then
-		tst_res TFAIL "lsmod output different from /proc/modules."
+		tst_res TINFO "lsmod output different from /proc/modules"
 
 		echo "$lsmod_output" > temp1
 		echo "$modules_output" > temp2
-		diff temp1 temp2
+		if tst_cmd_available diff; then
+			diff temp1 temp2
+		else
+			cat temp1 temp2
+		fi
 
-		return
+		return 1
 	fi
+	return 0
+}
 
-	tst_res TPASS "'lsmod' passed."
+lsmod_test()
+{
+	for i in $(seq 1 5); do
+		if lsmod_matches_proc_modules; then
+			tst_res TPASS "'lsmod' passed"
+			return
+		fi
+		tst_res TINFO "Trying again"
+		sleep 1
+	done
+	tst_res TFAIL "'lsmod' doesn't match /proc/modules output"
 }
 
 tst_run
diff --git a/testcases/commands/mkdir/mkdir_tests.sh b/testcases/commands/mkdir/mkdir_tests.sh
index 990162b..0e88a83 100755
--- a/testcases/commands/mkdir/mkdir_tests.sh
+++ b/testcases/commands/mkdir/mkdir_tests.sh
@@ -1,27 +1,10 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author:       Manoj Iyer, manjo@mail.utexas.edu                           ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
 # Basic mkdir tests
-#
+
 TST_CNT=3
 TST_SETUP=setup
 TST_TESTFUNC=test
diff --git a/testcases/commands/mkfs/mkfs01.sh b/testcases/commands/mkfs/mkfs01.sh
index 88f7f0b..9036819 100755
--- a/testcases/commands/mkfs/mkfs01.sh
+++ b/testcases/commands/mkfs/mkfs01.sh
@@ -1,20 +1,9 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
 # Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
-# 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.
-#
 # Test mkfs command with some basic options.
-#
 
 TST_CNT=5
 TST_SETUP=setup
@@ -23,7 +12,6 @@
 TST_USAGE=usage
 TST_PARSE_ARGS=parse_args
 TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
 TST_NEEDS_DEVICE=1
 TST_NEEDS_CMDS="blkid df"
 . tst_test.sh
@@ -48,7 +36,7 @@
 setup()
 {
 	if [ -n "$TST_FS_TYPE" ]; then
-		tst_test_cmds mkfs.${TST_FS_TYPE}
+		tst_require_cmds mkfs.${TST_FS_TYPE}
 	fi
 
 	ROD_SILENT mkdir -p mntpoint
@@ -71,7 +59,7 @@
 {
 	tst_mount
 	local blocknum=`df -P -B 1k mntpoint | tail -n1 | awk '{print $2}'`
-	tst_umount "$TST_DEVICE"
+	tst_umount
 
 	if [ $blocknum -gt "$2" ]; then
 		return 1
diff --git a/testcases/commands/mkswap/mkswap01.sh b/testcases/commands/mkswap/mkswap01.sh
index 0c59f0e..f6494f6 100755
--- a/testcases/commands/mkswap/mkswap01.sh
+++ b/testcases/commands/mkswap/mkswap01.sh
@@ -1,26 +1,14 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
 # Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
-# 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.
-#
 # Test mkswap command with some basic options.
-#
 
 TST_CNT=10
 TST_SETUP=setup
 TST_TESTFUNC=do_test
 TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
 TST_NEEDS_DEVICE=1
 TST_NEEDS_CMDS="uuidgen blkid blockdev mkswap"
 . tst_test.sh
@@ -140,6 +128,8 @@
 		return
 	fi
 
+	udevadm trigger --name-match=$TST_DEVICE
+
 	if [ -n "$device" ]; then
 		mkswap_verify "$mkswap_op" "$op_arg" "$device" "$size" "$dev_file"
 		if [ $? -ne 0 ]; then
diff --git a/testcases/commands/mv/mv_tests.sh b/testcases/commands/mv/mv_tests.sh
index ed55066..253b273 100755
--- a/testcases/commands/mv/mv_tests.sh
+++ b/testcases/commands/mv/mv_tests.sh
@@ -1,31 +1,13 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-## Author:       Manoj Iyer, manjo@mail.utexas.edu                            ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
-# Description:  Test basic functionality of mv command
-#		- Test #1:  mv <dir1> <dir2>
-#		  move dir1 to dir2 and all its contents.
-#		- Test #2:  mv -b <file1> <file2>
-#		  move file1 to file2 and backup the file2.
-#
+# Test basic functionality of mv command
+# Test #1:  mv <dir1> <dir2>
+# move dir1 to dir2 and all its contents.
+# Test #2:  mv -b <file1> <file2>
+# move file1 to file2 and backup the file2.
 
 TST_CNT=2
 TST_SETUP=setup
diff --git a/testcases/commands/nm/Makefile b/testcases/commands/nm/Makefile
index 37a9d78..4efb4b5 100644
--- a/testcases/commands/nm/Makefile
+++ b/testcases/commands/nm/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= nm01
+INSTALL_TARGETS		:= nm01.sh
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/commands/nm/nm01 b/testcases/commands/nm/nm01.sh
similarity index 68%
rename from testcases/commands/nm/nm01
rename to testcases/commands/nm/nm01.sh
index 39d5c9a..fd9d3d9 100755
--- a/testcases/commands/nm/nm01
+++ b/testcases/commands/nm/nm01.sh
@@ -1,27 +1,11 @@
 #!/bin/sh
-#
-# Copyright (c) International Business Machines  Corp., 2000
-#  06/01 Robbie Williamson (robbiew@us.ibm.com)
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2000
 # Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-#
-# 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
-#
-#---------------------------------------------------------------------------
+# Author: Robbie Williamson <robbiew@us.ibm.com>
 #
 # Tests the basic functionality of the `nm` command.
-#
+
 NM=${NM:=nm}
 
 TST_CNT=7
@@ -100,8 +84,11 @@
 	EXPECT_PASS $NM -f bsd $TST_DATAROOT/f1 \> nm_bsd.out
 	EXPECT_PASS $NM -f posix $TST_DATAROOT/f1 \> nm_posix.out
 
-	ROD awk '{print $3 $2 $1}' nm_bsd.out \> nm1.out
-	ROD awk '{print $1 $2 $3}' nm_posix.out \> nm2.out
+	ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}' nm_bsd.out \> trimmed_nm_bsd.out
+	ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}' nm_posix.out \> trimmed_nm_posix.out
+
+	ROD awk '{print $3 $2 $1}' trimmed_nm_bsd.out \> nm1.out
+	ROD awk '{print $1 $2 $3}' trimmed_nm_posix.out \> nm2.out
 
 	if diff nm1.out nm2.out > /dev/null; then
 		tst_res TPASS "Got BSD format with -f bsd"
diff --git a/testcases/commands/sysctl/sysctl01.sh b/testcases/commands/sysctl/sysctl01.sh
index 7522da5..d885cb1 100755
--- a/testcases/commands/sysctl/sysctl01.sh
+++ b/testcases/commands/sysctl/sysctl01.sh
@@ -1,22 +1,8 @@
 #!/bin/sh
-
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
 # Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
 #
-# 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, see <http://www.gnu.org/licenses/>.
-#
-# Description:
 # This is a regression test for invalid value of sysctl_sched_time_avg.
 # System will hang if user set sysctl_sched_time_avg to 0 on buggy kernel.
 #
diff --git a/testcases/commands/sysctl/sysctl02.sh b/testcases/commands/sysctl/sysctl02.sh
new file mode 100755
index 0000000..3964a98
--- /dev/null
+++ b/testcases/commands/sysctl/sysctl02.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Author: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
+#
+# Test for these regressions causing buffer overflow when writing into
+# /proc/sys/fs/file-max:
+# 7f2923c4f73f ("sysctl: handle overflow in proc_get_long")
+# 32a5ad9c2285 ("sysctl: handle overflow for file-max")
+#
+# This bug has been fixed in 9002b21465fa ("kernel/sysctl.c: fix
+# out-of-bounds access when setting file-max")
+#
+# We test in sysctl02.sh setting 2^64, 2^64-1, 2^63 and 0.
+
+TST_TESTFUNC=do_test
+TST_SETUP=setup
+TST_CLEANUP=cleanup
+TST_CNT=4
+TST_NEEDS_ROOT=1
+TST_NEEDS_CMDS="sysctl"
+sys_name="fs.file-max"
+sys_file="/proc/sys/fs/file-max"
+syms_file="/proc/kallsyms"
+
+. tst_test.sh
+
+setup()
+{
+	[ ! -f "$sys_file" ] && tst_brk TCONF "$sys_file not enabled"
+	orig_value=$(cat "$sys_file")
+}
+
+do_test()
+{
+	case $1 in
+	1) sysctl_test_overflow 18446744073709551616 ;;
+	2) sysctl_test_overflow 18446744073709551615 ;;
+	3) sysctl_test_overflow 9223372036854775808 ;;
+	4) sysctl_test_zero ;;
+	esac
+}
+
+sysctl_test_overflow()
+{
+	local test_value="$1"
+	local old_value="$(cat $sys_file)"
+
+	tst_res TINFO "trying to set $sys_name=$test_value"
+	sysctl -w -q $sys_name=$test_value 2>/dev/null
+	local new_value="$(cat $sys_file)"
+
+	if [ "$new_value" = "$old_value" ]; then
+		tst_res TPASS "$sys_file keeps old value ($old_value)"
+	else
+		tst_res TFAIL "$sys_file overflows and is set to $new_value"
+	fi
+	cleanup
+}
+
+sysctl_test_zero()
+{
+	[ ! -f "$syms_file" ] && tst_brk TCONF "$syms_file not enabled"
+	ROD sysctl -w -q $sys_name=0
+
+	if grep -q kasan_report $syms_file; then
+		if dmesg | grep -q "KASAN: global-out-of-bounds in __do_proc_doulongvec_minmax"; then
+			tst_res TFAIL "$sys_file is set 0 and trigger a KASAN error"
+		else
+			tst_res TPASS "$sys_file is set 0 and doesn't trigger a KASAN error"
+		fi
+	else
+		tst_res TCONF "kernel doesn't support KASAN"
+	fi
+}
+
+cleanup()
+{
+	[ -n "$orig_value" ] && sysctl -w -q $sys_name=$orig_value
+}
+
+tst_run
diff --git a/testcases/commands/tar/tar_tests.sh b/testcases/commands/tar/tar_tests.sh
index 946e9c7..f90ff21 100755
--- a/testcases/commands/tar/tar_tests.sh
+++ b/testcases/commands/tar/tar_tests.sh
@@ -1,28 +1,10 @@
 #!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author: Manoj Iyer, manjo@mail.utexas.edu                                 ##
-## Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>                          ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
 # Creates, lists and extracts an plain, gzip and bzip tar archive.
-#
 
 TST_CNT=6
 TST_TESTFUNC=do_test
diff --git a/testcases/commands/unshare/unshare01.sh b/testcases/commands/unshare/unshare01.sh
index 075511f..bf163a7 100755
--- a/testcases/commands/unshare/unshare01.sh
+++ b/testcases/commands/unshare/unshare01.sh
@@ -1,18 +1,8 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
 # Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
 #
-# 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.
-#
 # Test unshare command with some basic options.
 # 1) If we run unshare with "--user", UID in the newly created user namespace
 #    is set to 65534.
@@ -35,7 +25,6 @@
 #    Please see the following URL for detailed information:
 #    http://man7.org/linux/man-pages/man7/user_namespaces.7.html
 #    http://man7.org/linux/man-pages/man7/mount_namespaces.7.html
-#
 
 TST_CNT=8
 TST_SETUP=setup
diff --git a/testcases/commands/unzip/unzip01.sh b/testcases/commands/unzip/unzip01.sh
index 532afc0..750718d 100755
--- a/testcases/commands/unzip/unzip01.sh
+++ b/testcases/commands/unzip/unzip01.sh
@@ -1,28 +1,10 @@
-#! /bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2001                 ##
-##  Author:        Manoj Iyer, manjo@mail.utexas.edu                          ##
-## Copyright (c) Cyril Hrubis <chrubis@suse.cz>                               ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-################################################################################
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Copyright (c) Cyril Hrubis <chrubis@suse.cz>
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
 #
 # Tests basic functionality of unzip command.
-#
 
 TST_SETUP=setup
 TST_TESTFUNC=do_test
diff --git a/testcases/commands/vmcp/vmcp_m.sh b/testcases/commands/vmcp/vmcp_m.sh
index 6702094..5dc7bf0 100644
--- a/testcases/commands/vmcp/vmcp_m.sh
+++ b/testcases/commands/vmcp/vmcp_m.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 #
 # vmcp tool and module test
@@ -7,11 +8,8 @@
 #
 # The test case contains one shell script:
 #
-#    vmcp_m.sh: basically executes the vmcp tool with different parameters and verifies that
-#               output and exitcodes are as expected
-#
-
-#!/bin/sh
+# basically executes the vmcp tool with different parameters and verifies that
+# output and exitcodes are as expected
 
 TST_CNT=2
 TST_TESTFUNC=vmcp_main
diff --git a/testcases/commands/wc/wc01.sh b/testcases/commands/wc/wc01.sh
index 74d69e2..ee12e2b 100755
--- a/testcases/commands/wc/wc01.sh
+++ b/testcases/commands/wc/wc01.sh
@@ -1,20 +1,9 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Fujitsu Ltd.
 # Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
 #
-# 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.
-#
 # Test wc command with some basic options.
-#
 
 TST_CNT=12
 TST_SETUP=setup
diff --git a/testcases/commands/which/which01.sh b/testcases/commands/which/which01.sh
index 0bd698e..dd6659e 100755
--- a/testcases/commands/which/which01.sh
+++ b/testcases/commands/which/which01.sh
@@ -1,20 +1,9 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
 # Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
-# 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.
-#
 # Test which command with some basic options.
-#
 
 TST_CNT=10
 TST_SETUP=setup
diff --git a/testcases/cve/cve-2014-0196.c b/testcases/cve/cve-2014-0196.c
index 50a8b35..012cbb7 100644
--- a/testcases/cve/cve-2014-0196.c
+++ b/testcases/cve/cve-2014-0196.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
  * Original POC by Matthew Daley <mattd@bugfuzz.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * This test attempts to cause a buffer overflow using the race condition
@@ -153,4 +141,9 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "4291086b1f08"},
+		{"CVE", "2014-0196"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c
index 435ed44..6c4fd57 100644
--- a/testcases/cve/cve-2015-3290.c
+++ b/testcases/cve/cve-2015-3290.c
@@ -1,27 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Pavel Boldin <pboldin@cloudlinux.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Original exploit: http://www.openwall.com/lists/oss-security/2015/08/04/8
- *
- * Copyright (c) 2015 Andrew Lutomirski.
- * GPL v2
- *
- * Build with -O2.  Don't use -fno-omit-frame-pointer.
- *
- * Thanks to Petr Matousek for pointing out a bug in the exploit.
  */
 
 /*
@@ -490,6 +469,11 @@
 	.setup = setup,
 	.timeout = TIMEOUT,
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "9b6e6a8334d5"},
+		{"CVE", "2015-3290"},
+		{}
+	}
 };
 
 #else /* HAVE_PERF_EVENT_ATTR && (defined(__x86_64__) || defined(__i386__)) */
diff --git a/testcases/cve/cve-2016-10044.c b/testcases/cve/cve-2016-10044.c
index 1659e6c..7519676 100644
--- a/testcases/cve/cve-2016-10044.c
+++ b/testcases/cve/cve-2016-10044.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
  * Copyright (c) 2016 Jan Horn <jann@thejh.net>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Test for CVE-2016-10044, which was fixed in commit
@@ -74,4 +62,9 @@
 	.test_all = run,
 	.cleanup = cleanup,
 	.min_kver = "2.6.8",
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "22f6b4d34fcf"},
+		{"CVE", "2016-10044"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2016-7042.c b/testcases/cve/cve-2016-7042.c
index 8719eba..4434265 100644
--- a/testcases/cve/cve-2016-7042.c
+++ b/testcases/cve/cve-2016-7042.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -83,4 +71,9 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "03dab869b7b2"},
+		{"CVE", "2016-7042"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2016-7117.c b/testcases/cve/cve-2016-7117.c
index 2c4ad54..dca0029 100644
--- a/testcases/cve/cve-2016-7117.c
+++ b/testcases/cve/cve-2016-7117.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * CVE-2016-7117
@@ -162,4 +150,9 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.min_kver = "2.6.33",
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "a2e2725541fa"},
+		{"CVE", "2016-7117"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2017-16939.c b/testcases/cve/cve-2017-16939.c
index 8101afc..d8c0901 100644
--- a/testcases/cve/cve-2017-16939.c
+++ b/testcases/cve/cve-2017-16939.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Michael Moese <mmoese@suse.de>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /* Regression test for commit:
  * 1137b5e2529a ipsec: Fix aborted xfrm policy dump crash aka CVE-2017-16939
@@ -78,7 +66,7 @@
 {
 	int var = 0x100;
 
-	SAFE_SETSOCKOPT(fd, 1, SO_RCVBUF, &var, sizeof(int));
+	SAFE_SETSOCKOPT(fd, SOL_SOCKET, SO_RCVBUF, &var, sizeof(int));
 	SAFE_SENDTO(1, fd, (void *) &p->msg, p->msg.nlmsg_len, 0,
 		    (struct sockaddr *) &addr,
 		    sizeof(struct sockaddr_nl));
@@ -89,4 +77,9 @@
 static struct tst_test test = {
 	.setup = setup,
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "1137b5e2529a"},
+		{"CVE", "2017-16939"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2017-17052.c b/testcases/cve/cve-2017-17052.c
index d7da7e9..361ed66 100644
--- a/testcases/cve/cve-2017-17052.c
+++ b/testcases/cve/cve-2017-17052.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Michael Moese <mmoese@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Test for CVE-2017-17052, original reproducer taken from kernel commit:
@@ -58,8 +46,6 @@
 	for (;;) {
 		SAFE_MMAP(NULL, 0x1000000, PROT_READ,
 				MAP_POPULATE|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
-		if (*do_exit)
-			exit(0);
 	}
 
 	return arg;
@@ -67,9 +53,6 @@
 
 static void *fork_thread(void *arg)
 {
-	if (*do_exit)
-		exit(0);
-
 	usleep(rand() % 10000);
 	SAFE_FORK();
 
@@ -102,9 +85,11 @@
 static void run(void)
 {
 	pid_t pid;
+	int status;
 	volatile int run = 0;
 
 	while (run < RUNS) {
+		*do_exit = 0;
 		pid = SAFE_FORK();
 
 		if (pid == 0) {
@@ -113,7 +98,14 @@
 			usleep(EXEC_USEC);
 			*do_exit = 1;
 		}
-		tst_res(TINFO, "run %d passed", run);
+
+		SAFE_WAIT(&status);
+		if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
+			tst_res(TINFO, "run %d passed", run);
+		} else {
+			tst_res(TFAIL, "child %s", tst_strstatus(status));
+		}
+
 		run++;
 	}
 
@@ -128,4 +120,9 @@
 	.cleanup = cleanup,
 	.setup = setup,
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "2b7e8665b4ff"},
+		{"CVE", "2017-17052"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2017-17053.c b/testcases/cve/cve-2017-17053.c
index e01db3d..08a0821 100644
--- a/testcases/cve/cve-2017-17053.c
+++ b/testcases/cve/cve-2017-17053.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Michael Moese <mmoese@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /* Regression test for CVE-2017-17053, original reproducer can be found
  * here:
@@ -166,6 +154,11 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "ccd5b3235180"},
+		{"CVE", "2017-17053"},
+		{}
+	}
 };
 
 #else
diff --git a/testcases/cve/cve-2017-2618.c b/testcases/cve/cve-2017-2618.c
index e1e94f6..4ab3cfb 100644
--- a/testcases/cve/cve-2017-2618.c
+++ b/testcases/cve/cve-2017-2618.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 FUJITSU LIMITED
  * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -63,4 +51,9 @@
 	.forks_child = 1,
 	.setup = setup,
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "0c461cb727d1"},
+		{"CVE", "2017-2618"},
+		{}
+	}
 };
diff --git a/testcases/cve/cve-2017-2671.c b/testcases/cve/cve-2017-2671.c
index 5bdb37b..e72795d 100644
--- a/testcases/cve/cve-2017-2671.c
+++ b/testcases/cve/cve-2017-2671.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
  * Original POC by Daniel Jiang
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Test for CVE-2017-2671 faulty locking on ping socket
@@ -121,4 +109,9 @@
 	.test_all = run,
 	.cleanup = cleanup,
 	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "43a6684519ab"},
+		{"CVE", "2017-2671"},
+		{}
+	}
 };
diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c
index a53ea9b..db00e18 100644
--- a/testcases/cve/meltdown.c
+++ b/testcases/cve/meltdown.c
@@ -1,20 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Pavel Boldin <pboldin@cloudlinux.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Original exploit: https://github.com/paboldin/meltdown-exploit.
  */
 
 #include "config.h"
@@ -267,9 +253,15 @@
 	int ret, read;
 	char fmt[strlen(symname) + 64];
 
+	tst_res(TINFO, "Looking for %s in %s", symname, filename);
+	if (access(filename, F_OK) == -1) {
+		tst_res(TINFO, "%s not available", filename);
+		return 0;
+	}
+
 	sprintf(fmt, "%%lx %%c %s%%c", symname);
 
-	ret = SAFE_FILE_LINES_SCANF(filename, fmt, &addr, &type, &read);
+	ret = FILE_LINES_SCANF(filename, fmt, &addr, &type, &read);
 	if (ret)
 		return 0;
 
@@ -287,13 +279,9 @@
 	if (addr)
 		return addr;
 
-	tst_res(TINFO, "not found '%s' in /proc/kallsyms", name);
 	if (uname(&utsname) < 0)
 		tst_brk(TBROK | TERRNO, "uname");
-
 	sprintf(systemmap, "/boot/System.map-%s", utsname.release);
-
-	tst_res(TINFO, "looking in '%s'\n", systemmap);
 	addr = find_symbol_in_file(systemmap, name);
 	return addr;
 }
@@ -308,6 +296,9 @@
 	saved_cmdline_addr = find_kernel_symbol("saved_command_line");
 	tst_res(TINFO, "&saved_command_line == 0x%lx", saved_cmdline_addr);
 
+	if (!saved_cmdline_addr)
+		tst_brk(TCONF, "saved_command_line not found");
+
 	spec_fd = SAFE_OPEN("/proc/cmdline", O_RDONLY);
 
 	memset(target_array, 1, sizeof(target_array));
@@ -386,7 +377,11 @@
 	.setup = setup,
 	.test_all = run,
 	.cleanup = cleanup,
-	.min_kver = "2.6.32"
+	.min_kver = "2.6.32",
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-5754"},
+		{}
+	}
 };
 
 #else /* #if defined(__x86_64__) || defined(__i386__) */
diff --git a/testcases/cve/stack_clash.c b/testcases/cve/stack_clash.c
index ac4a31a..ecbf5f6 100644
--- a/testcases/cve/stack_clash.c
+++ b/testcases/cve/stack_clash.c
@@ -1,20 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Pavel Boldin <pboldin@cloudlinux.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Adapted from code by Michal Hocko.
  */
 
 /* This is a regression test of the Stack Clash [1] vulnerability. This tests
@@ -264,4 +250,8 @@
 	.needs_root = 1,
 	.setup = setup,
 	.test_all = stack_clash_test,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-1000364"},
+		{}
+	}
 };
diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
index 39d79c7..3319b31 100644
--- a/testcases/kernel/Makefile
+++ b/testcases/kernel/Makefile
@@ -52,8 +52,9 @@
 			   pty \
 			   sched \
 			   security \
-			   timers \
+			   sound \
 			   tracing \
+			   uevents \
 
 ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
 SUBDIRS			+= power_management
@@ -63,7 +64,7 @@
 
 ifeq ($(ANDROID),1)
 FILTER_OUT_DIRS		+= containers controllers device-drivers fs io ipc mem \
-				sched security timers
+				sched security
 endif
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/containers/netns/netns_breakns.sh b/testcases/kernel/containers/netns/netns_breakns.sh
index 3ef8f98..c7aa2c3 100755
--- a/testcases/kernel/containers/netns/netns_breakns.sh
+++ b/testcases/kernel/containers/netns/netns_breakns.sh
@@ -61,7 +61,7 @@
 
 
 # TEST CASE #2
-tst_test_cmds ifconfig
+tst_require_cmds ifconfig
 $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK 2>/dev/null
 if [ $? -ne 0 ]; then
 	tst_resm TPASS "controlling device over ioctl"
diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
index a9d0459..c765a0c 100755
--- a/testcases/kernel/containers/netns/netns_helper.sh
+++ b/testcases/kernel/containers/netns/netns_helper.sh
@@ -110,7 +110,7 @@
 netns_setup()
 {
 	tst_require_root
-	tst_test_cmds ip modprobe
+	tst_require_cmds ip modprobe
 
 	modprobe veth > /dev/null 2>&1
 
@@ -139,7 +139,7 @@
 		;;
 	ioctl)
 		USE_IFCONFIG=1
-		tst_test_cmds ifconfig
+		tst_require_cmds ifconfig
 		;;
 	*)
 		tst_brkm TBROK \
diff --git a/testcases/kernel/containers/userns/userns06.c b/testcases/kernel/containers/userns/userns06.c
index 23f6da4..29f635d 100644
--- a/testcases/kernel/containers/userns/userns06.c
+++ b/testcases/kernel/containers/userns/userns06.c
@@ -49,7 +49,7 @@
 static int child_fn1(void)
 {
 	int exit_val = 0;
-	char *const args[] = { "userns06_capcheck", "privileged" };
+	char *const args[] = { "userns06_capcheck", "privileged", NULL };
 
 	TST_SAFE_CHECKPOINT_WAIT(NULL, 0);
 
@@ -69,7 +69,7 @@
 {
 	int exit_val = 0;
 	int uid, gid;
-	char *const args[] = { "userns06_capcheck", "unprivileged" };
+	char *const args[] = { "userns06_capcheck", "unprivileged", NULL };
 
 	TST_SAFE_CHECKPOINT_WAIT(NULL, 1);
 
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_10_1.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_5_1.sh
similarity index 100%
rename from testcases/kernel/controllers/cgroup/cgroup_regression_10_1.sh
rename to testcases/kernel/controllers/cgroup/cgroup_regression_5_1.sh
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_10_2.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_5_2.sh
similarity index 100%
rename from testcases/kernel/controllers/cgroup/cgroup_regression_10_2.sh
rename to testcases/kernel/controllers/cgroup/cgroup_regression_5_2.sh
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index e197f5d..1f7f382 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -7,7 +7,7 @@
 TST_TESTFUNC=test
 TST_SETUP=do_setup
 TST_CLEANUP=do_cleanup
-TST_CNT=10
+TST_CNT=9
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="awk dmesg find mountpoint rmdir"
@@ -233,77 +233,28 @@
 }
 
 #---------------------------------------------------------------------------
-# Bug:    When mount cgroup fs and the fs was busy, root_count should not be
-#         decremented in cgroup_kill_sb()
-# Kernel: 2.6.29-rcX
-# Links:  https://openvz.org/pipermail/devel/2009-January/016345.html
-#         http://lkml.org/lkml/2009/1/28/190
-# Fix:    commit 839ec5452ebfd5905b9c69b20ceb640903a8ea1a
+# Bug:    When running 2 concurrent mount/umount threads, kernel WARNING
+#         may be triggered, but it's VFS' issue but not cgroup.
+# Kernel: 2.6.24 - 2.6.29-rcX
+# Links:  http://lkml.org/lkml/2009/1/4/354
+# Fix:    commit 1a88b5364b535edaa321d70a566e358390ff0872
 #---------------------------------------------------------------------------
 test5()
 {
-	local mounted
-	local failing
-	local mntpoint
+	cgroup_regression_5_1.sh &
+	local pid1=$!
+	cgroup_regression_5_2.sh &
+	local pid2=$!
 
-	local lines=`cat /proc/cgroups | wc -l`
-	if [ $lines -le 2 ]; then
-		tst_res TCONF "require at least 2 cgroup subsystems"
-		return
-	fi
+	sleep 30
+	kill -USR1 $pid1 $pid2
+	wait $pid1 2>/dev/null
+	wait $pid2 2>/dev/null
 
-	local subsys1=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
-	local subsys2=`tail -n 2 /proc/cgroups | head -1 | awk '{ print $1 }'`
-
-	# Accounting here for the fact that the chosen subsystems could
-	# have been already previously mounted at boot time: in such a
-	# case we must skip the initial co-mount step (which would
-	# fail anyway) and properly re-organize the $mntpoint and
-	# $failing params to be used in the following expected-to-fail
-	# mount action. Note that the subsysN name itself will be listed
-	# amongst mounts options.
-	get_cgroup_mountpoint $subsys1 >/dev/null && mounted=$subsys1
-	[ -z "$mounted" ] && get_cgroup_mountpoint $subsys2 >/dev/null && mounted=$subsys2
-	if [ -z "$mounted" ]; then
-		mntpoint=cgroup
-		failing=$subsys1
-		mount -t cgroup -o $subsys1,$subsys2 xxx $mntpoint/
-		if [ $? -ne 0 ]; then
-			tst_res TFAIL "mount $subsys1 and $subsys2 failed"
-			return
-		fi
-	else
-		# Use the pre-esistent mountpoint as $mntpoint and use a
-		# co-mount with $failing: this way the 2nd mount will
-		# also fail (as expected) in this 'mirrored' configuration.
-		mntpoint=$(get_cgroup_mountpoint $mounted)
-		failing=$subsys1,$subsys2
-	fi
-
-	# This 2nd mount has been properly configured to fail
-	mount -t cgroup -o $failing xxx $mntpoint/ 2> /dev/null
-	if [ $? -eq 0 ]; then
-		tst_res TFAIL "mount $failing should fail"
-		# Do NOT unmount pre-existent mountpoints...
-		[ -z "$mounted" ] && umount $mntpoint/
-		return
-	fi
-
-	mkdir $mntpoint/0
-	# Otherwise we can't attach task
-	if [ "$subsys1" = cpuset -o "$subsys2" = cpuset ]; then
-		echo 0 > $mntpoint/0/cpuset.cpus 2> /dev/null
-		echo 0 > $mntpoint/0/cpuset.mems 2> /dev/null
-	fi
-
-	sleep 100 &
-	echo $! > $mntpoint/0/tasks
-
-	kill -TERM $! > /dev/null
-	wait $! 2>/dev/null
-	rmdir $mntpoint/0
-	# Do NOT unmount pre-existent mountpoints...
-	[ -z "$mounted" ] && umount $mntpoint/
+	mount -t cgroup none cgroup 2> /dev/null
+	mkdir cgroup/0
+	rmdir cgroup/0
+	umount cgroup/ 2> /dev/null
 	check_kernel_bug
 }
 
@@ -488,30 +439,4 @@
 	check_kernel_bug
 }
 
-#---------------------------------------------------------------------------
-# Bug:    When running 2 concurrent mount/umount threads, kernel WARNING
-#         may be triggered, but it's VFS' issue but not cgroup.
-# Kernel: 2.6.24 - 2.6.29-rcX
-# Links:  http://lkml.org/lkml/2009/1/4/354
-# Fix:    commit 1a88b5364b535edaa321d70a566e358390ff0872
-#---------------------------------------------------------------------------
-test10()
-{
-	cgroup_regression_10_1.sh &
-	local pid1=$!
-	cgroup_regression_10_2.sh &
-	local pid2=$!
-
-	sleep 30
-	kill -USR1 $pid1 $pid2
-	wait $pid1 2>/dev/null
-	wait $pid2 2>/dev/null
-
-	mount -t cgroup none cgroup 2> /dev/null
-	mkdir cgroup/0
-	rmdir cgroup/0
-	umount cgroup/ 2> /dev/null
-	check_kernel_bug
-}
-
 tst_run
diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
index f608375..5594fe9 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
@@ -83,7 +83,7 @@
 setup()
 {
     tst_require_root
-    tst_test_cmds killall
+    tst_require_cmds killall
 
     if [ ! -f /proc/cgroups ]; then
         tst_brkm TCONF "Kernel does not support for control groups"
diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh
index 698aa49..292df6f 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_stress.sh
@@ -74,6 +74,7 @@
 export TMPFILE=./tmp_tasks.$$
 
 count=0
+collected_pids=
 
 build_subgroups()
 {
@@ -107,6 +108,7 @@
     if [ -z "$ppid" ]; then
         cgroup_fj_proc&
         pid=$!
+        collected_pids="$collected_pids $pid"
     else
         pid="$ppid"
     fi
@@ -148,9 +150,10 @@
 "each" )
     tst_resm TINFO "Attaching task to each subgroup"
     attach_task "$start_path" 0
-    ROD killall -9 "cgroup_fj_proc"
-    # Wait for attached tasks to terminate
-    wait
+    for pid in $collected_pids; do
+        ROD kill -9 "$pid"
+        wait "$pid"
+    done
     ;;
 *  )
     ;;
diff --git a/testcases/kernel/controllers/cpuacct/cpuacct.sh b/testcases/kernel/controllers/cpuacct/cpuacct.sh
index 5e90b05..323aa75 100755
--- a/testcases/kernel/controllers/cpuacct/cpuacct.sh
+++ b/testcases/kernel/controllers/cpuacct/cpuacct.sh
@@ -1,39 +1,16 @@
 #!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2015 SUSE                                                    ##
-##                                                                            ##
-## 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                                                                        ##
-##                                                                            ##
-## Author: Cedric Hnyda <chnyda@suse.com>                                     ##
-##                                                                            ##
-################################################################################
-
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2015 SUSE
+# Author: Cedric Hnyda <chnyda@suse.com>
+#
 # Usage
 # ./cpuacct.sh nbsubgroup nbprocess
-#
-# 1) nbsubgroup : number of subgroup to create
-# 2) nbprocess : number of process to attach to each subgroup
+# nbsubgroup: number of subgroup to create
+# nbprocess: number of process to attach to each subgroup
 #
 # Description
-#
 # 1) Find if cpuacct is mounted, if not mounted, cpuacct will be mounted
 # 2) Check that sum ltp_test/subgroup*/cpuacct.usage = ltp_test/cpuacct.usage
-#
 
 TST_SETUP=setup
 TST_CLEANUP=cleanup
diff --git a/testcases/kernel/controllers/cpuset/Makefile.inc b/testcases/kernel/controllers/cpuset/Makefile.inc
index db6a843..c03dd77 100644
--- a/testcases/kernel/controllers/cpuset/Makefile.inc
+++ b/testcases/kernel/controllers/cpuset/Makefile.inc
@@ -41,7 +41,7 @@
 
 LDFLAGS			+= -L$(abs_builddir)/$(LIBCPUSET_DIR) -L$(abs_builddir)/$(LIBCONTROLLERS_DIR)
 
-LDLIBS			+= -lcpu_set -lcontrollers -lltp
+LDLIBS			:= -lcpu_set -lcontrollers -lltp $(LDLIBS)
 
 INSTALL_TARGETS		?= *.sh
 
diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile b/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile
index 322d03c..069ebc3 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile
+++ b/testcases/kernel/controllers/cpuset/cpuset_lib/Makefile
@@ -25,7 +25,7 @@
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS			+= -lm -lcontrollers -lltp
+LDLIBS			:= -lm -lcontrollers -lltp $(LDLIBS)
 
 LIB			:= libcpu_set.a
 
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
index aadaae4..22ef4f5 100755
--- a/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
+++ b/testcases/kernel/controllers/memcg/functional/memcg_lib.sh
@@ -35,7 +35,7 @@
 fi
 
 # Check for dependencies
-tst_test_cmds killall
+tst_require_cmds killall
 
 # Post 4.16 kernel updates stat in batch (> 32 pages) every time
 PAGESIZES=$(( $PAGESIZE * 33 ))
@@ -83,7 +83,7 @@
 
 shmmax_setup()
 {
-	tst_test_cmds bc
+	tst_require_cmds bc
 
 	shmmax=`cat /proc/sys/kernel/shmmax`
 	if [ $(echo "$shmmax < $HUGEPAGESIZE" |bc) -eq 1 ]; then
diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
index 29a535c..0e671f5 100644
--- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
+++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
@@ -1,24 +1,8 @@
-/******************************************************************************/
-/*                                                                            */
-/* Copyright (c) 2009 FUJITSU LIMITED                                         */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/* Author: Li Zefan <lizf@cn.fujitsu.com>                                     */
-/*                                                                            */
-/******************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2009 FUJITSU LIMITED
+ * Author: Li Zefan <lizf@cn.fujitsu.com>
+ */
 
 #include <sys/types.h>
 #include <sys/mman.h>
diff --git a/testcases/kernel/controllers/memcg/regression/memcg_test_3.c b/testcases/kernel/controllers/memcg/regression/memcg_test_3.c
index 9df4389..75a6e15 100644
--- a/testcases/kernel/controllers/memcg/regression/memcg_test_3.c
+++ b/testcases/kernel/controllers/memcg/regression/memcg_test_3.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
  * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
index 5b19cc2..ad8605e 100755
--- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
+++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh
@@ -17,7 +17,7 @@
 
 # Each test case runs for 900 secs when everything fine
 # therefore the default 5 mins timeout is not enough.
-LTP_TIMEOUT_MUL=7
+TST_TIMEOUT=2100
 
 . cgroup_lib.sh
 
diff --git a/testcases/kernel/controllers/pids/pids.sh b/testcases/kernel/controllers/pids/pids.sh
index fab33c4..afcf0a2 100755
--- a/testcases/kernel/controllers/pids/pids.sh
+++ b/testcases/kernel/controllers/pids/pids.sh
@@ -1,31 +1,10 @@
 #!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2015 SUSE                                                    ##
-##                                                                            ##
-## 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                                                                        ##
-##                                                                            ##
-## Author: Cedric Hnyda <chnyda@suse.com>                                     ##
-##                                                                            ##
-################################################################################
-
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2015 SUSE
+# Author: Cedric Hnyda <chnyda@suse.com>
 # Usage
 # ./pids.sh caseno max
-#
+
 TST_CLEANUP=cleanup
 TST_SETUP=setup
 TST_TESTFUNC=do_test
diff --git a/testcases/kernel/crypto/.gitignore b/testcases/kernel/crypto/.gitignore
index 7340bde..c5be011 100644
--- a/testcases/kernel/crypto/.gitignore
+++ b/testcases/kernel/crypto/.gitignore
@@ -6,3 +6,4 @@
 af_alg06
 pcrypt_aead01
 crypto_user01
+crypto_user02
diff --git a/testcases/kernel/crypto/Makefile b/testcases/kernel/crypto/Makefile
index 6547e1c..7cbdb72 100644
--- a/testcases/kernel/crypto/Makefile
+++ b/testcases/kernel/crypto/Makefile
@@ -22,3 +22,5 @@
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
 
 af_alg02: CFLAGS += -pthread
+
+crypto_user02: LDLIBS += -lrt
diff --git a/testcases/kernel/crypto/af_alg01.c b/testcases/kernel/crypto/af_alg01.c
index bb6e017..d3e823e 100644
--- a/testcases/kernel/crypto/af_alg01.c
+++ b/testcases/kernel/crypto/af_alg01.c
@@ -76,4 +76,9 @@
 static struct tst_test test = {
 	.test = do_test,
 	.tcnt = ARRAY_SIZE(hash_algs),
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "af3ff8045bbf"},
+		{"CVE", "2017-17806"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/af_alg02.c b/testcases/kernel/crypto/af_alg02.c
index 08087ec..fab0010 100644
--- a/testcases/kernel/crypto/af_alg02.c
+++ b/testcases/kernel/crypto/af_alg02.c
@@ -59,4 +59,9 @@
 	.test_all = run,
 	.timeout = 20,
 	.needs_checkpoints = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "ecaaab564978"},
+		{"CVE", "2017-17805"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/af_alg03.c b/testcases/kernel/crypto/af_alg03.c
index 240c528..5f214e4 100644
--- a/testcases/kernel/crypto/af_alg03.c
+++ b/testcases/kernel/crypto/af_alg03.c
@@ -28,4 +28,8 @@
 
 static struct tst_test test = {
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "e57121d08c38"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/af_alg04.c b/testcases/kernel/crypto/af_alg04.c
index 48239e0..df04904 100644
--- a/testcases/kernel/crypto/af_alg04.c
+++ b/testcases/kernel/crypto/af_alg04.c
@@ -55,4 +55,8 @@
 static struct tst_test test = {
 	.test_all = run,
 	.forks_child = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "bb2964810233"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/af_alg05.c b/testcases/kernel/crypto/af_alg05.c
index 419c65e..df2b035 100644
--- a/testcases/kernel/crypto/af_alg05.c
+++ b/testcases/kernel/crypto/af_alg05.c
@@ -10,6 +10,12 @@
  * block size, and where the destination buffer starts exactly at a page
  * boundary.  Based on the reproducer from the commit message.  Note that this
  * issue only reproduces on certain architectures, such as arm and arm64.
+ *
+ * On some older kernel without commit 160544075f2a ("crypto: scatterwalk - Hide
+ * PageSlab call to optimise away flush_dcache_page") , it doesn't use
+ * ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE macro. It can crash on all architectures.
+ * Without skcipher walk interface, it is also a regresstion test for commit
+ * 0868def3e410("crypto: blkcipher - fix crash flushing dcache in error path").
  */
 
 #include <errno.h>
@@ -40,4 +46,10 @@
 
 static struct tst_test test = {
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "8088d3dd4d7c"},
+		{"linux-git", "160544075f2a"},
+		{"linux-git", "0868def3e410"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/af_alg06.c b/testcases/kernel/crypto/af_alg06.c
index 586d91b..6acdf85 100644
--- a/testcases/kernel/crypto/af_alg06.c
+++ b/testcases/kernel/crypto/af_alg06.c
@@ -48,4 +48,8 @@
 
 static struct tst_test test = {
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "8f9c46934848"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/crypto_user01.c b/testcases/kernel/crypto/crypto_user01.c
index 163d7a2..47bf9f0 100644
--- a/testcases/kernel/crypto/crypto_user01.c
+++ b/testcases/kernel/crypto/crypto_user01.c
@@ -192,4 +192,10 @@
 	.setup = setup,
 	.test_all = run,
 	.cleanup = cleanup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "f43f39958beb"},
+		{"CVE", "2013-2547"},
+		{"CVE", "2018-19854"},
+		{}
+	}
 };
diff --git a/testcases/kernel/crypto/crypto_user02.c b/testcases/kernel/crypto/crypto_user02.c
new file mode 100644
index 0000000..384e344
--- /dev/null
+++ b/testcases/kernel/crypto/crypto_user02.c
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2019 Google LLC
+ */
+
+/*
+ * Regression test for kernel commit 21d4120ec6f5 ("crypto: user - prevent
+ * operating on larval algorithms").  See the commit message for a detailed
+ * explanation of the problem.  Basically, this test tries to cause a NULL
+ * pointer dereference in the kernel by abusing the CRYPTO_MSG_DELALG message in
+ * the NETLINK_CRYPTO interface to try to delete a "larval" algorithm, which is
+ * a kernel-internal marker for an algorithm which has been registered but isn't
+ * ready yet (e.g., hasn't completed the in-kernel crypto self-tests yet).
+ *
+ * CRYPTO_MSG_NEWALG will create such a larval algorithm.  However, it waits
+ * (killably) for the larval to mature before returning, and it holds a lock
+ * that prevents CRYPTO_MSG_DELALG from running.  To get around this, this test
+ * sends a fatal signal to the process executing CRYPTO_MSG_NEWALG.
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+
+#include "tst_test.h"
+#include "tst_crypto.h"
+#include "tst_timer.h"
+
+static struct tst_crypto_session ses = TST_CRYPTO_SESSION_INIT;
+
+static void setup(void)
+{
+	tst_crypto_open(&ses);
+}
+
+static void run(void)
+{
+	struct crypto_user_alg alg = {
+		/*
+		 * Any algorithm instantiated from a template can do here, but
+		 * choose something that's commonly available.
+		 */
+		.cru_driver_name = "hmac(sha256-generic)",
+	};
+	pid_t pid;
+	int status;
+
+	/* Check whether the algorithm is supported before continuing. */
+	TEST(tst_crypto_add_alg(&ses, &alg));
+	if (TST_RET != 0 && TST_RET != -EEXIST) {
+		if (TST_RET == -ENOENT)
+			tst_brk(TCONF, "%s not supported", alg.cru_driver_name);
+
+		tst_brk(TBROK | TRERRNO,
+			"unexpected error checking for algorithm support");
+	}
+
+	tst_res(TINFO,
+		"Starting crypto_user larval deletion test.  May crash buggy kernels.");
+
+	tst_timer_start(CLOCK_MONOTONIC);
+
+	while (!tst_timer_expired_ms(1000)) {
+		pid = SAFE_FORK();
+
+		if (pid == 0) {
+			/* Child process: execute CRYPTO_MSG_NEWALG. */
+			tst_crypto_open(&ses);
+			for (;;) {
+				TEST(tst_crypto_add_alg(&ses, &alg));
+				if (TST_RET && TST_RET != -EEXIST)
+					tst_brk(TBROK | TRERRNO,
+						"unexpected error from tst_crypto_add_alg()");
+			}
+		}
+
+		/*
+		 * Parent process: kill the child process (hopefully while it's
+		 * executing CRYPTO_MSG_NEWALG) and execute CRYPTO_MSG_DELALG.
+		 * Buggy kernels sometimes dereferenced a NULL pointer during
+		 * CRYPTO_MSG_DELALG here.
+		 */
+		usleep(rand() % 5000);
+		kill(pid, SIGKILL);
+		SAFE_WAIT(&status);
+		if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGKILL)
+			tst_brk(TBROK, "child %s", tst_strstatus(status));
+		TEST(tst_crypto_del_alg(&ses, &alg));
+		if (TST_RET && TST_RET != -ENOENT)
+			tst_brk(TBROK | TRERRNO,
+				"unexpected error from tst_crypto_del_alg()");
+	}
+
+	tst_res(TPASS, "didn't crash");
+}
+
+static void cleanup(void)
+{
+	tst_crypto_close(&ses);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+	.cleanup = cleanup,
+	.needs_root = 1,
+	.forks_child = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "21d4120ec6f5"},
+		{}
+	}
+};
diff --git a/testcases/kernel/crypto/pcrypt_aead01.c b/testcases/kernel/crypto/pcrypt_aead01.c
index 92ce3b2..0609af9 100644
--- a/testcases/kernel/crypto/pcrypt_aead01.c
+++ b/testcases/kernel/crypto/pcrypt_aead01.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 SUSE
  * Author: Nicolai Stange <nstange@suse.de>
@@ -6,19 +7,6 @@
  * Originally found by syzkaller:
  * https://groups.google.com/forum/#!topic/syzkaller-bugs/NKn_ivoPOpk
  *
- * 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, see <http://www.gnu.org/licenses/>.
- *
  * Test for CVE-2017-5754 - pcrypt mishandles freeing instances.
  *
  * The test works by adding and then removing pcrypt-AEAD instances.
@@ -66,6 +54,12 @@
 		TEST(tst_crypto_del_alg(&ses, &a));
 		if (TST_RET)
 			tst_brk(TBROK | TRERRNO, "del_alg");
+
+		if (tst_timeout_remaining() < 10) {
+			tst_res(TINFO, "Time limit reached, stopping at "
+				"%d iterations", i);
+			break;
+		}
 	}
 
 	tst_res(TPASS, "Nothing bad appears to have happened");
@@ -81,4 +75,9 @@
 	.test_all = run,
 	.cleanup = cleanup,
 	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "d76c68109f37"},
+		{"CVE", "2017-5754"},
+		{}
+	}
 };
diff --git a/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c b/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
index 2733753..0ce70c6 100644
--- a/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
+++ b/testcases/kernel/device-drivers/acpi/ltp_acpi_cmds.c
@@ -233,6 +233,9 @@
 static acpi_handle dev_handle;
 static int acpi_hw_reduced;
 
+/* check if PM2 control register supported */
+static bool pm2_supported;
+
 static int acpi_init(void)
 {
 	acpi_status status;
@@ -240,12 +243,15 @@
 	struct acpi_table_fadt *fadt;
 	struct acpi_table_header *table;
 	struct acpi_device_info *dev_info;
+	pm2_supported = true;
 
 	status = acpi_get_table(ACPI_SIG_FADT, 0, &table);
 	if (ACPI_SUCCESS(status)) {
 		fadt = (struct acpi_table_fadt *)table;
 		if (fadt->flags & ACPI_FADT_HW_REDUCED)
 			acpi_hw_reduced = 1;
+		if (fadt->pm2_control_block == 0 || fadt->pm2_control_length == 0)
+			pm2_supported = false;
 	}
 	if (acpi_hw_reduced)
 		prk_alert("Detected the Hardware-reduced ACPI mode");
@@ -481,6 +487,8 @@
 	 * commit/?id=50ffba1bd3120b069617455545bc27bcf3cf7579
 	 */
 	for (i = 0; i < ACPI_NUM_BITREG; ++i) {
+		if (i == ACPI_BITREG_ARB_DISABLE && !pm2_supported)
+			continue;
 		status = acpi_read_bit_register(i, &val);
 		err |= acpi_failure(status, "acpi_read_bit_register");
 		if (ACPI_SUCCESS(status))
diff --git a/testcases/kernel/device-drivers/rcu/rcu_torture.sh b/testcases/kernel/device-drivers/rcu/rcu_torture.sh
index c3739f9..bca1530 100755
--- a/testcases/kernel/device-drivers/rcu/rcu_torture.sh
+++ b/testcases/kernel/device-drivers/rcu/rcu_torture.sh
@@ -1,20 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# 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 would 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 the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
+# Copyright (C) 2019 Xiao Yang <ice_yangxiao@163.com>
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 #
 # One of the possible ways to test RCU is to use rcutorture kernel module.
@@ -23,89 +10,86 @@
 # dmesg output for module's test results.
 # For more information, please read Linux Documentation: RCU/torture.txt
 
-TCID="rcu_torture"
-TST_TOTAL=14
-TST_CLEANUP=cleanup
+TST_CNT=4
+TST_SETUP=rcutorture_setup
+TST_TESTFUNC=do_test
+TST_NEEDS_ROOT=1
+TST_NEEDS_CMDS="modprobe dmesg sed tail"
+TST_OPTS="t:w:"
+TST_USAGE=rcutorture_usage
+TST_PARSE_ARGS=rcutorture_parse_args
 
-. test.sh
+. tst_test.sh
 
 # default options
-test_time=60
+test_time=30
 num_writers=5
 
-while getopts :ht:w: opt; do
-	case "$opt" in
-	h)
-		echo "Usage:"
-		echo "h        help"
-		echo "t x      time in seconds for each test-case"
-		echo "w x      number of writers"
-		exit 0
-	;;
-	t) test_time=$OPTARG ;;
-	w) num_writers=$OPTARG ;;
-	*)
-		tst_brkm TBROK "unknown option: $opt"
-	;;
-	esac
-done
-
-cleanup()
+rcutorture_usage()
 {
-	tst_resm TINFO "cleanup"
-	rmmod rcutorture > /dev/null 2>&1
+	echo "Usage:"
+	echo "-t x    time in seconds for each test-case"
+	echo "-w x    number of writers"
 }
 
-tst_require_root
+rcutorture_parse_args()
+{
+	case $1 in
+	t) test_time=$2 ;;
+	w) num_writers=$2 ;;
+	esac
+}
 
-# check if module is present
-modprobe rcutorture > /dev/null 2>&1 || \
-	tst_brkm TCONF "Test requires rcutorture module"
-rmmod rcutorture > /dev/null 2>&1
+rcutorture_setup()
+{
+	local module=1
 
-trap cleanup INT
+	# check if rcutorture is built as a kernel module by inserting
+	# and then removing it
+	modprobe -q rcutorture ||  module=
+	modprobe -qr rcutorture || module=
 
-rcu_type="rcu rcu_bh srcu sched"
+	[ -z "$module" ] && \
+		tst_brk TCONF "rcutorture is built-in, non-existent or in use"
+}
 
-if tst_kvcmp -lt "3.12"; then
-	rcu_type="$rcu_type rcu_sync rcu_expedited rcu_bh_sync rcu_bh_expedited \
-	          srcu_sync srcu_expedited sched_sync sched_expedited"
+rcutorture_test()
+{
+	local rcu_type=$1
 
-	if tst_kvcmp -lt "3.11"; then
-		rcu_type="$rcu_type srcu_raw srcu_raw_sync"
-	fi
-fi
-
-TST_TOTAL=$(echo "$rcu_type" | wc -w)
-
-est_time=`echo "scale=2; $test_time * $TST_TOTAL / 60 " | bc`
-tst_resm TINFO "estimate time $est_time min"
-
-for type in $rcu_type; do
-
-	tst_resm TINFO "$type: running $test_time sec..."
+	tst_res TINFO "$rcu_type-torture: running $test_time sec..."
 
 	modprobe rcutorture nfakewriters=$num_writers \
-	         stat_interval=60 test_no_idle_hz=1 shuffle_interval=3 \
-	         stutter=5 irqreader=1 fqs_duration=0 fqs_holdoff=0 \
-	         fqs_stutter=3 test_boost=1 test_boost_interval=7 \
-	         test_boost_duration=4 shutdown_secs=0 \
-	         stall_cpu=0 stall_cpu_holdoff=10 n_barrier_cbs=0 \
-	         onoff_interval=0 onoff_holdoff=0 torture_type=$type \
-	         > /dev/null 2>&1 || tst_brkm TBROK "failed to load module"
+		torture_type=$rcu_type >/dev/null
+	if [ $? -ne 0 ]; then
+		dmesg | grep -q "invalid torture type: \"$rcu_type\"" && \
+			tst_brk TCONF "invalid $rcu_type type"
+
+		tst_brk TBROK "failed to load module"
+	fi
 
 	sleep $test_time
 
-	rmmod rcutorture > /dev/null 2>&1 || \
-		tst_brkm TBROK "failed to unload module"
+	modprobe -r rcutorture >/dev/null || \
+		tst_brk TBROK "failed to unload module"
 
 	# check module status in dmesg
-	result_str=`dmesg | sed -nE '$s/.*End of test: ([A-Z]+):.*/\1/p'`
-	if [ "$result_str" = "SUCCESS" ]; then
-		tst_resm TPASS "$type: completed"
+	local res=$(dmesg | sed -nE "s/.* $rcu_type-torture:.* End of test: (.*): .*/\1/p" | tail -n1)
+	if [ "$res" = "SUCCESS" ]; then
+		tst_res TPASS "$rcu_type-torture: $res"
 	else
-		tst_resm TFAIL "$type: $result_str, see dmesg"
+		tst_res TFAIL "$rcu_type-torture: $res, see dmesg"
 	fi
-done
+}
 
-tst_exit
+do_test()
+{
+	case $1 in
+	1) rcutorture_test rcu;;
+	2) rcutorture_test srcu;;
+	3) rcutorture_test srcud;;
+	4) rcutorture_test tasks;;
+	esac
+}
+
+tst_run
diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
index 7d3951a..7f855ef 100755
--- a/testcases/kernel/device-drivers/zram/zram01.sh
+++ b/testcases/kernel/device-drivers/zram/zram01.sh
@@ -1,29 +1,14 @@
 #!/bin/sh
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# 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 would 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 the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 #
 # Test creates several zram devices with different filesystems on them.
 # It fills each device with zeros and checks that compression works.
-#
-# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
-TCID="zram01"
-TST_TOTAL=8
-
-. test.sh
+TST_CNT=7
+TST_TESTFUNC="do_test"
+TST_NEEDS_CMDS="awk bc dd"
 . zram_lib.sh
 
 # Test will create the following number of zram devices:
@@ -37,7 +22,7 @@
 
 RAM_SIZE=$(awk '/MemTotal:/ {print $2}' /proc/meminfo)
 if [ "$RAM_SIZE" -lt 1048576 ]; then
-	tst_res TINFO "Not enough space for Btrfs"
+	tst_res TINFO "not enough space for Btrfs"
 	FS_SIZE="26214400"
 	FS_TYPE="ext2"
 fi
@@ -54,53 +39,55 @@
 zram_filesystems="ext3 ext4 xfs $FS_TYPE"
 zram_algs="lzo lzo lzo lzo"
 
-TST_CLEANUP="zram_cleanup"
-
 zram_fill_fs()
 {
-	tst_test_cmds dd free awk
-	local mem_free0=$(free -m | awk 'NR==2 {print $4}')
-
 	for i in $(seq 0 $(($dev_num - 1))); do
-		tst_resm TINFO "fill zram$i..."
+		tst_res TINFO "filling zram$i (it can take long time)"
 		local b=0
 		while true; do
 			dd conv=notrunc if=/dev/zero of=zram${i}/file \
 				oflag=append count=1 bs=1024 status=none \
-				> /dev/null 2>&1 || break
+				>/dev/null 2>err.txt || break
 			b=$(($b + 1))
 		done
-		tst_resm TINFO "zram$i can be filled with '$b' KB"
+		if [ $b -eq 0 ]; then
+			[ -s err.txt ] && tst_res TWARN "dd error: $(cat err.txt)"
+			tst_brk TBROK "cannot fill zram $i"
+		fi
+		tst_res TPASS "zram$i was filled with '$b' KB"
+
+		if [ ! -f "/sys/block/zram$i/mm_stat" ]; then
+			if [ $i -eq 0 ]; then
+				tst_res TCONF "zram compression ratio test requires zram mm_stat sysfs file"
+			fi
+
+			continue
+		fi
+
+		local compr_size=`awk '{print $2}' "/sys/block/zram$i/mm_stat"`
+		local v=$((100 * 1024 * $b / $compr_size))
+		local r=`echo "scale=2; $v / 100 " | bc`
+
+		if [ "$v" -lt 100 ]; then
+			tst_res TFAIL "compression ratio: $r:1"
+			break
+		fi
+
+		tst_res TPASS "compression ratio: $r:1"
 	done
-
-	local mem_free1=$(free -m | awk 'NR==2 {print $4}')
-	local used_mem=$(($mem_free0 - $mem_free1))
-
-	local total_size=0
-	for sm in $zram_sizes; do
-		local s=$(echo $sm | sed 's/M//')
-		total_size=$(($total_size + $s))
-	done
-
-	tst_resm TINFO "zram used ${used_mem}M, zram disk sizes ${total_size}M"
-
-	local v=$((100 * $total_size / $used_mem))
-
-	if [ "$v" -lt 100 ]; then
-		tst_resm TFAIL "compression ratio: 0.$v:1"
-		return
-	fi
-
-	tst_resm TPASS "compression ratio: $(echo "scale=2; $v / 100 " | bc):1"
 }
 
-zram_load
-zram_max_streams
-zram_compress_alg
-zram_set_disksizes
-zram_set_memlimit
-zram_makefs
-zram_mount
-zram_fill_fs
+do_test()
+{
+	case $1 in
+	 1) zram_max_streams;;
+	 2) zram_compress_alg;;
+	 3) zram_set_disksizes;;
+	 4) zram_set_memlimit;;
+	 5) zram_makefs;;
+	 6) zram_mount;;
+	 7) zram_fill_fs;;
+	esac
+}
 
-tst_exit
+tst_run
diff --git a/testcases/kernel/device-drivers/zram/zram02.sh b/testcases/kernel/device-drivers/zram/zram02.sh
index 59b3f9f..f97cf64 100755
--- a/testcases/kernel/device-drivers/zram/zram02.sh
+++ b/testcases/kernel/device-drivers/zram/zram02.sh
@@ -1,28 +1,12 @@
 #!/bin/sh
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# 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 would 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 the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 #
 # Test checks that we can create swap zram device.
-#
-# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
-TCID="zram02"
-TST_TOTAL=7
-
-. test.sh
+TST_CNT=5
+TST_TESTFUNC="do_test"
 . zram_lib.sh
 
 # Test will create the following number of zram devices:
@@ -41,13 +25,15 @@
 zram_sizes="107374182400" # 100GB
 zram_mem_limits="1M"
 
-TST_CLEANUP="zram_cleanup"
+do_test()
+{
+	case $1 in
+	 1) zram_max_streams;;
+	 2) zram_set_disksizes;;
+	 3) zram_set_memlimit;;
+	 4) zram_makeswap;;
+	 5) zram_swapoff;;
+	esac
+}
 
-zram_load
-zram_max_streams
-zram_set_disksizes
-zram_set_memlimit
-zram_makeswap
-zram_swapoff
-
-tst_exit
+tst_run
diff --git a/testcases/kernel/device-drivers/zram/zram_lib.sh b/testcases/kernel/device-drivers/zram/zram_lib.sh
index 45116af..68b933c 100755
--- a/testcases/kernel/device-drivers/zram/zram_lib.sh
+++ b/testcases/kernel/device-drivers/zram/zram_lib.sh
@@ -1,31 +1,20 @@
 #!/bin/sh
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
-#
-# 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 would 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 the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 dev_makeswap=-1
 dev_mounted=-1
 
-trap tst_exit INT
+TST_NEEDS_TMPDIR=1
+TST_SETUP="zram_load"
+TST_CLEANUP="zram_cleanup"
+. tst_test.sh
 
 zram_cleanup()
 {
-	tst_resm TINFO "zram cleanup"
-	local i=
+	local i
+
 	for i in $(seq 0 $dev_makeswap); do
 		swapoff /dev/zram$i
 	done
@@ -39,193 +28,185 @@
 	done
 
 	rmmod zram > /dev/null 2>&1
-
-	tst_rmdir
 }
 
 zram_load()
 {
-	tst_resm TINFO "create '$dev_num' zram device(s)"
+	tst_res TINFO "create '$dev_num' zram device(s)"
 	modprobe zram num_devices=$dev_num || \
-		tst_brkm TBROK "failed to insert zram module"
+		tst_brk TBROK "failed to insert zram module"
 
 	dev_num_created=$(ls /dev/zram* | wc -w)
 
 	if [ "$dev_num_created" -ne "$dev_num" ]; then
-		tst_brkm TFAIL "unexpected num of devices: $dev_num_created"
+		tst_brk TFAIL "unexpected num of devices: $dev_num_created"
 	else
-		tst_resm TPASS "test succeeded"
+		tst_res TPASS "test succeeded"
 	fi
-
-	tst_tmpdir
 }
 
 zram_max_streams()
 {
 	if tst_kvcmp -lt "3.15" -o -ge "4.7"; then
-		tst_resm TCONF "The device attribute max_comp_streams was"\
+		tst_res TCONF "The device attribute max_comp_streams was"\
 		               "introduced in kernel 3.15 and deprecated in 4.7"
 		return
 	fi
 
-	tst_resm TINFO "set max_comp_streams to zram device(s)"
+	tst_res TINFO "set max_comp_streams to zram device(s)"
 
 	local i=0
+
 	for max_s in $zram_max_streams; do
 		local sys_path="/sys/block/zram${i}/max_comp_streams"
 		echo $max_s > $sys_path || \
-			tst_brkm TFAIL "failed to set '$max_s' to $sys_path"
+			tst_brk TFAIL "failed to set '$max_s' to $sys_path"
 		local max_streams=$(cat $sys_path)
 
 		[ "$max_s" -ne "$max_streams" ] && \
-			tst_brkm TFAIL "can't set max_streams '$max_s', get $max_stream"
+			tst_brk TFAIL "can't set max_streams '$max_s', get $max_stream"
 
 		i=$(($i + 1))
-		tst_resm TINFO "$sys_path = '$max_streams' ($i/$dev_num)"
+		tst_res TINFO "$sys_path = '$max_streams' ($i/$dev_num)"
 	done
 
-	tst_resm TPASS "test succeeded"
+	tst_res TPASS "test succeeded"
 }
 
 zram_compress_alg()
 {
 	if tst_kvcmp -lt "3.15"; then
-		tst_resm TCONF "device attribute comp_algorithm is"\
+		tst_res TCONF "device attribute comp_algorithm is"\
 			"introduced since kernel v3.15, the running kernel"\
 			"does not support it"
 		return
 	fi
 
-	tst_resm TINFO "test that we can set compression algorithm"
-
-	local algs=$(cat /sys/block/zram0/comp_algorithm)
-	tst_resm TINFO "supported algs: $algs"
 	local i=0
+
+	tst_res TINFO "test that we can set compression algorithm"
+	local algs="$(cat /sys/block/zram0/comp_algorithm)"
+	tst_res TINFO "supported algs: $algs"
+
 	for alg in $zram_algs; do
 		local sys_path="/sys/block/zram${i}/comp_algorithm"
 		echo "$alg" >  $sys_path || \
-			tst_brkm TFAIL "can't set '$alg' to $sys_path"
+			tst_brk TFAIL "can't set '$alg' to $sys_path"
 		i=$(($i + 1))
-		tst_resm TINFO "$sys_path = '$alg' ($i/$dev_num)"
+		tst_res TINFO "$sys_path = '$alg' ($i/$dev_num)"
 	done
 
-	tst_resm TPASS "test succeeded"
+	tst_res TPASS "test succeeded"
 }
 
 zram_set_disksizes()
 {
-	tst_resm TINFO "set disk size to zram device(s)"
 	local i=0
+	local ds
+
+	tst_res TINFO "set disk size to zram device(s)"
 	for ds in $zram_sizes; do
 		local sys_path="/sys/block/zram${i}/disksize"
 		echo "$ds" >  $sys_path || \
-			tst_brkm TFAIL "can't set '$ds' to $sys_path"
+			tst_brk TFAIL "can't set '$ds' to $sys_path"
 
 		i=$(($i + 1))
-		tst_resm TINFO "$sys_path = '$ds' ($i/$dev_num)"
+		tst_res TINFO "$sys_path = '$ds' ($i/$dev_num)"
 	done
 
-	tst_resm TPASS "test succeeded"
+	tst_res TPASS "test succeeded"
 }
 
 zram_set_memlimit()
 {
 	if tst_kvcmp -lt "3.18"; then
-		tst_resm TCONF "device attribute mem_limit is"\
+		tst_res TCONF "device attribute mem_limit is"\
 			"introduced since kernel v3.18, the running kernel"\
 			"does not support it"
 		return
 	fi
 
-	tst_resm TINFO "set memory limit to zram device(s)"
-
 	local i=0
+	local ds
+
+	tst_res TINFO "set memory limit to zram device(s)"
+
 	for ds in $zram_mem_limits; do
 		local sys_path="/sys/block/zram${i}/mem_limit"
 		echo "$ds" >  $sys_path || \
-			tst_brkm TFAIL "can't set '$ds' to $sys_path"
+			tst_brk TFAIL "can't set '$ds' to $sys_path"
 
 		i=$(($i + 1))
-		tst_resm TINFO "$sys_path = '$ds' ($i/$dev_num)"
+		tst_res TINFO "$sys_path = '$ds' ($i/$dev_num)"
 	done
 
-	tst_resm TPASS "test succeeded"
+	tst_res TPASS "test succeeded"
 }
 
 zram_makeswap()
 {
-	tst_resm TINFO "make swap with zram device(s)"
-	tst_test_cmds mkswap swapon swapoff
+	tst_res TINFO "make swap with zram device(s)"
+	tst_require_cmds mkswap swapon swapoff
 	local i=0
+
 	for i in $(seq 0 $(($dev_num - 1))); do
-		mkswap /dev/zram$i > err.log 2>&1
-		if [ $? -ne 0 ]; then
-			cat err.log
-			tst_brkm TFAIL "mkswap /dev/zram$1 failed"
-		fi
-
-		swapon /dev/zram$i > err.log 2>&1
-		if [ $? -ne 0 ]; then
-			cat err.log
-			tst_brkm TFAIL "swapon /dev/zram$1 failed"
-		fi
-
-		tst_resm TINFO "done with /dev/zram$i"
+		ROD mkswap /dev/zram$i
+		ROD swapon /dev/zram$i
+		tst_res TINFO "done with /dev/zram$i"
 		dev_makeswap=$i
 	done
 
-	tst_resm TPASS "making zram swap succeeded"
+	tst_res TPASS "making zram swap succeeded"
 }
 
 zram_swapoff()
 {
-	tst_test_cmds swapoff
-	local i=
+	tst_require_cmds swapoff
+	local i
+
 	for i in $(seq 0 $dev_makeswap); do
-		swapoff /dev/zram$i > err.log 2>&1
-		if [ $? -ne 0 ]; then
-			cat err.log
-			tst_brkm TFAIL "swapoff /dev/zram$i failed"
-		fi
+		ROD swapoff /dev/zram$i
 	done
 	dev_makeswap=-1
 
-	tst_resm TPASS "swapoff completed"
+	tst_res TPASS "swapoff completed"
 }
 
 zram_makefs()
 {
-	tst_test_cmds mkfs
+	tst_require_cmds mkfs
 	local i=0
+
 	for fs in $zram_filesystems; do
 		# if requested fs not supported default it to ext2
 		tst_supported_fs $fs 2> /dev/null || fs=ext2
 
-		tst_resm TINFO "make $fs filesystem on /dev/zram$i"
+		tst_res TINFO "make $fs filesystem on /dev/zram$i"
 		mkfs.$fs /dev/zram$i > err.log 2>&1
 		if [ $? -ne 0 ]; then
 			cat err.log
-			tst_brkm TFAIL "failed to make $fs on /dev/zram$i"
+			tst_brk TFAIL "failed to make $fs on /dev/zram$i"
 		fi
+
 		i=$(($i + 1))
 	done
 
-	tst_resm TPASS "zram_makefs succeeded"
+	tst_res TPASS "zram_makefs succeeded"
 }
 
 zram_mount()
 {
 	local i=0
+
 	for i in $(seq 0 $(($dev_num - 1))); do
-		tst_resm TINFO "mount /dev/zram$i"
+		tst_res TINFO "mount /dev/zram$i"
 		mkdir zram$i
-		mount /dev/zram$i zram$i > /dev/null || \
-			tst_brkm TFAIL "mount /dev/zram$i failed"
+		ROD mount /dev/zram$i zram$i
 		dev_mounted=$i
 	done
 
-	tst_resm TPASS "mount of zram device(s) succeeded"
+	tst_res TPASS "mount of zram device(s) succeeded"
 }
 
 modinfo zram > /dev/null 2>&1 ||
-	tst_brkm TCONF "zram not configured in kernel"
+	tst_brk TCONF "zram not configured in kernel"
diff --git a/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh b/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh
index 8d0ecd8..9dbcd68 100755
--- a/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh
+++ b/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh
@@ -26,7 +26,7 @@
 recognised_unrecognised()
 {
 	local file=$1
-	local string=$2
+	local string="$2"
 
 	eval $file >temp 2>&1
 	if [ $? -ne 0 ] || ! grep -q "$string" temp; then
@@ -52,7 +52,7 @@
 unrecognised()
 {
 	local file=$1
-	local string=$2
+	local string="$2"
 
 	eval $file >temp 2>&1
 	if [ $? -eq 0 ] || grep -q "$string" temp; then
diff --git a/testcases/kernel/fs/ext4-new-features/.gitignore b/testcases/kernel/fs/ext4-new-features/.gitignore
deleted file mode 100644
index d0f1f74..0000000
--- a/testcases/kernel/fs/ext4-new-features/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/ext4-inode-version/ext4_test_inode_version
-/ext4-nsec-timestamps/ext4_file_time
-/ext4-subdir-limit/create_long_dirs
-/ext4-subdir-limit/create_short_dirs
diff --git a/testcases/kernel/fs/ext4-new-features/Makefile b/testcases/kernel/fs/ext4-new-features/Makefile
deleted file mode 100644
index 5f4349d..0000000
--- a/testcases/kernel/fs/ext4-new-features/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-#    kernel/fs/ext4-new-features testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS		+= ext4_funcs.sh
-
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/README b/testcases/kernel/fs/ext4-new-features/README
deleted file mode 100644
index 9b0809f..0000000
--- a/testcases/kernel/fs/ext4-new-features/README
+++ /dev/null
@@ -1,127 +0,0 @@
-TEST SUITE:
-
-The directory ext4-new-features contains the tests related to the ext4
-filesystem's new features.
-
-Ext4 is an advanced level of the ext3 filesystem which incorporates scalability
-and reliability enhancements for supporting large filesystems(64 bit) in keeping
-with increasing disk capacities and state-of-the-art feature requirements. More
-extensive information of ext4 can be found at the ext4 wiki site at the URL:
-http://ext4.wiki.kernel.org
-
-There are total 117 testcases for ext4 new features test that have been added.
-Now, these testcases can test multi-block alloc/delayed alloc, inode version
-field on disk, journal checksumming, nanosec timestamps, online defrag, persist
-prealloc, subdirectory limit and uninit groups of ext4.
-The detail information of ext4 new features can be found at the URL:
-http://ext4.wiki.kernel.org/index.php/New_ext4_features
-
-
-TESTS AIM:
-
-The aim of the tests is to test ext4 new features.
-
-
-TEST STEPS:
-# cd LTPROOT/testcases/kernel/fs/ext4-new-features
-# make
-# make install
-# cd LTPROOT
-# ./runltp -f fs_ext4 -z 'big unmounted block device partition'
-
-
-NOTE:
-
-1. This test can be run by root only.
-
-2. These tests need a big unmounted block device partition. You MUST run runltp
-   with "-z" option to specify such a big block device, if not, these tests
-   will exit with TCONF.
-
-   Be CAREFUL the data on the specified partition would be DESTROYED.
-
-   The recommended size of partition is between 5G and 10G. If the partition is
-   too big, the test will run for a long time, which is unnecessary.
-
-3. Before starting test ext4 new features, please check whether ext4 filesystem
-   is compiled into the kernel or not, and the kernel version is *2.6.31* or
-   above.
-
-4. A snapshot of config file options is given below:
-   ONFIG_EXT4_FS=y
-   CONFIG_EXT4DEV_COMPAT=y
-   CONFIG_EXT4_FS_XATTR=y
-   CONFIG_EXT4_FS_POSIX_ACL=y
-   CONFIG_EXT4_FS_SECURITY=y
-
-5. Beside that, the following packages are necessary:
-   e2fsprogs
-     (http://www.rpmfind.net/linux/rpm2html/search.php?query=e2fsprogs)
-   e2fsprogs-devel
-     (http://www.rpmfind.net/linux/rpm2html/search.php?query=e2fsprogs-devel)
-   e2fsprogs-libs
-     (http://www.rpmfind.net/linux/rpm2html/search.php?query=e2fsprogs-libs)
-   and the version of these packages should be 1.41.4 or above, otherwise the
-   test will fail.
-
-
-FILES DESCRIPTION:
-
-ext4-delalloc-mballoc
----------------------
-Directory containing the shell script which is used to test multi-block
-allocation and delayed allocation of ext4.
-
-ext4-ffsb-config
-----------------
-Directory containing the config of ffsb for test.
-
-ext4-inode-version
-------------------
-Directory containing the shell script which is used to test inode version field
-on disk of ext4.
-
-ext4-journal-checksum
----------------------
-Directory containing the shell script which is used to test journal checksumming
-of ext4.
-
-ext4-nsec-timestamps
---------------------
-Directory containing the shell script which is used to test nanosec timestamps
-of ext4.
-
-ext4-online-defrag
-------------------
-Directory containing the shell script which is used to test online defrag
-feature of ext4.
-
-ext4-persist-prealloc
----------------------
-Directory containing the shell script which is used to test persist prealloc
-feature of ext4.
-
-ext4-subdir-limit
------------------
-Directory containing the shell script which is used to test subdirectory limit
-of ext4. According to the kernel documentation, we create more than 32000
-subdirectorys on the ext4 filesystem.
-
-ext4-uninit-groups
-------------------
-Directory containing the shell script which is used to test uninitialized groups
-feature of ext4.
-
-ext4_funcs.sh
--------------
-This script contains some functions for ext4 new features test script.
-such as: ext4_setup, ext4_cleanup
-
-Makefile
---------
-Each directory in this directory has its usual makefile, it is for its
-directory.
-
-README
-------
-The one you have gone through.
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/Makefile
deleted file mode 100644
index 1980349..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, Fujitsu LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-MAKE_TARGETS		:=
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/ext4-alloc-test.sh b/testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/ext4-alloc-test.sh
deleted file mode 100755
index 25ebdaf..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-delalloc-mballoc/ext4-alloc-test.sh
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/bin/bash
-
-################################################################################
-#                                                                              #
-# Copyright (c) 2009 FUJITSU LIMITED                                           #
-#                                                                              #
-# 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      #
-#                                                                              #
-################################################################################
-
-export TCID="ext4-delalloc-mballoc"
-export TST_TOTAL=17
-
-. ext4_funcs.sh
-
-# Case 17: mount ext4 partition to ext3
-ext4_test_remount()
-{
-	mkfs.ext3 -I 256 -b 1024 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	mount -t ext4 -o delalloc,auto_da_alloc $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	ffsb $LTPROOT/testcases/data/ext4-ffsb/ffsb-config0 > /dev/null
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "ffsb returned failure"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	mount -t ext3 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount to ext3"
-		return
-	fi
-	umount mnt_point
-
-	fsck -p $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck returned failure"
-		return
-	fi
-
-	tst_resm TPASS "remount test pass"
-}
-
-# Case 1-16: Use ffsb to test mballoc and delalloc
-# $1: delalloc or nodelalloc
-# $2: 0 - indirect-io, 1 - direct-io
-# $3: block size
-# $4: auto_da_alloc
-ext4_test_delalloc_mballoc()
-{
-	tst_resm TINFO "isDelalloc: $1, isDirectIO: $2, Blocksize: $3, isAuto_da_alloc: $4"
-
-	mkfs.ext4 -I 256 -b $3 /$EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	tune2fs -O extents $EXT4_DEV >/dev/null 2>&1
-
-	mount -t ext4 -o $1,$4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	ffsb $LTPROOT/testcases/data/ext4-ffsb/ffsb-config$2 > /dev/null
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "ffsb returned failure"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	fsck -p $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck returned failure"
-		return
-	fi
-
-	tst_resm TPASS "delalloc/mballoc test pass"
-}
-
-# main
-ext4_setup
-
-tst_test_cmds ffsb
-
-DELALLOC=( "delalloc" "nodelalloc" )
-DIRECT_IO=( 0 1 )
-BLOCK_SIZE=( 1024 4096 )
-BLOCK_AUTO_DA_ALLOC=( "auto_da_alloc=1" "noauto_da_alloc" )
-
-for ((i = 0; i < 2; i++))
-{
-	for ((j = 0; j < 2; j++))
-	{
-		for ((k = 0; k < 2; k++))
-		{
-			for ((l = 0; l < 2; l++))
-			{
-				ext4_test_delalloc_mballoc ${DELALLOC[$k]} \
-						${DIRECT_IO[$j]} \
-						${BLOCK_SIZE[$i]} \
-						${BLOCK_AUTO_DA_ALLOC[$l]}
-			}
-		}
-	}
-}
-
-ext4_test_remount
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/Makefile
deleted file mode 100644
index 173a583..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-#    Copyright (C) 2009, FUJITSU LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-MAKE_TARGETS		:=
-INSTALL_DIR	:= testcases/data/ext4-ffsb/
-INSTALL_TARGETS		?= ffsb-config[0-7]
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config0 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config0
deleted file mode 100644
index caf1928..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config0
+++ /dev/null
@@ -1,23 +0,0 @@
-directio=0
-time=500
-
-[filesystem0]
-location=mnt_point
-num_files=100000
-num_dirs=40
-max_filesize=40960
-min_filesize=4096
-[end0]
-
-
-[threadgroup0]
-num_threads=10
-read_weight=3
-write_weight=1
-append_weight=1
-write_random=1
-write_size=4096
-write_blocksize=4096
-read_size=4096
-read_blocksize=4096
-[end0]
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config1 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config1
deleted file mode 100644
index 9fe820d..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config1
+++ /dev/null
@@ -1,23 +0,0 @@
-directio=1
-time=400
-
-[filesystem0]
-location=mnt_point
-num_files=100000
-num_dirs=40
-max_filesize=4096
-min_filesize=4096
-[end0]
-
-
-[threadgroup0]
-num_threads=10
-read_weight=3
-write_weight=1
-append_weight=1
-write_random=1
-write_size=4096
-write_blocksize=4096
-read_size=4096
-read_blocksize=4096
-[end0]
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config2 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config2
deleted file mode 100644
index 993fe14..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config2
+++ /dev/null
@@ -1,23 +0,0 @@
-directio=0
-time=500
-
-[filesystem0]
-location=mnt_point
-num_files=100000
-num_dirs=40
-max_filesize=20480
-min_filesize=4096
-[end0]
-
-
-[threadgroup0]
-num_threads=10
-read_weight=3
-write_weight=1
-append_weight=1
-write_random=1
-write_size=4096
-write_blocksize=4096
-read_size=4096
-read_blocksize=4096
-[end0]
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config3 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config3
deleted file mode 100644
index d95149d..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config3
+++ /dev/null
@@ -1,29 +0,0 @@
-directio=0
-time=0
-
-[filesystem0]
-	location=mnt_point/
-	num_files=1
-	num_dirs=1
-	max_filesize=409600
-	min_filesize=40960
-	agefs=1
-	[threadgroup0]
-		num_threads=10
-		write_size=409600
-		write_blocksize=40960
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-		desired_util=0.20
-[end0]
-
-[threadgroup0]
-	num_threads=32
-	read_weight=1
-
-	read_size=4096
-	read_blocksize=4096
-[end0]
-
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config4 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config4
deleted file mode 100644
index f1a432e..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config4
+++ /dev/null
@@ -1,29 +0,0 @@
-directio=0
-time=0
-
-[filesystem0]
-	location=mnt_point/
-	num_files=1
-	num_dirs=1
-	max_filesize=409600
-	min_filesize=40960
-	agefs=1
-	[threadgroup0]
-		num_threads=10
-		write_size=409600
-		write_blocksize=40960
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-		desired_util=0.40
-[end0]
-
-[threadgroup0]
-	num_threads=32
-	read_weight=1
-
-	read_size=4096
-	read_blocksize=4096
-[end0]
-
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config5 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config5
deleted file mode 100644
index 758eded..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config5
+++ /dev/null
@@ -1,29 +0,0 @@
-directio=0
-time=0
-
-[filesystem0]
-	location=mnt_point/
-	num_files=1
-	num_dirs=1
-	max_filesize=409600
-	min_filesize=40960
-	agefs=1
-	[threadgroup0]
-		num_threads=10
-		write_size=409600
-		write_blocksize=40960
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-		desired_util=0.60
-[end0]
-
-[threadgroup0]
-	num_threads=32
-	read_weight=1
-
-	read_size=4096
-	read_blocksize=4096
-[end0]
-
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config6 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config6
deleted file mode 100644
index 6592177..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config6
+++ /dev/null
@@ -1,29 +0,0 @@
-directio=0
-time=0
-
-[filesystem0]
-	location=mnt_point/
-	num_files=1
-	num_dirs=1
-	max_filesize=409600
-	min_filesize=40960
-	agefs=1
-	[threadgroup0]
-		num_threads=10
-		write_size=409600
-		write_blocksize=40960
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-		desired_util=0.80
-[end0]
-
-[threadgroup0]
-	num_threads=32
-	read_weight=1
-
-	read_size=4096
-	read_blocksize=4096
-[end0]
-
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config7 b/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config7
deleted file mode 100644
index 0f6df51..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-ffsb-config/ffsb-config7
+++ /dev/null
@@ -1,29 +0,0 @@
-directio=0
-time=0
-
-[filesystem0]
-	location=mnt_point/
-	num_files=1
-	num_dirs=1
-	max_filesize=409600
-	min_filesize=40960
-	agefs=1
-	[threadgroup0]
-		num_threads=10
-		write_size=409600
-		write_blocksize=40960
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-		desired_util=1.00
-[end0]
-
-[threadgroup0]
-	num_threads=32
-	read_weight=1
-
-	read_size=4096
-	read_blocksize=4096
-[end0]
-
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-inode-version/Makefile
deleted file mode 100644
index 6b8aabb..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, FUJITSU LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += -lm
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh b/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh
deleted file mode 100755
index 5c89b23..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/bash
-
-################################################################################
-#                                                                              #
-# Copyright (c) 2009 FUJITSU LIMITED                                           #
-#                                                                              #
-# 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      #
-#                                                                              #
-################################################################################
-
-#$1: inode version of which file
-#$2: 1  - return inode version by return value
-#    !1 - writting inode version to stddev
-
-inode_version=`debugfs -R "stat $1" $EXT4_DEV 2> /dev/null | grep 'Version' | awk '{
-print $NF }'`
-
-# The inode_version's format: '0x0000000a' or '0x00000000:0000000a',
-# so delete ':'
-inode_version=`echo $inode_version | sed 's/://'`
-
-inode_version=$(( $inode_version ))
-
-if [ "$2" = "1" ]; then
-	exit $inode_version
-else
-	echo $inode_version
-fi
-
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_inode_version_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_inode_version_test.sh
deleted file mode 100755
index ef02cc0..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_inode_version_test.sh
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/bin/bash
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2009 FUJITSU LIMITED                                         ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
-##         Miao Xie <miaox@cn.fujitsu.com>                                    ##
-##                                                                            ##
-################################################################################
-
-export TCID="ext4-inode-version"
-export TST_TOTAL=8
-
-. ext4_funcs.sh
-
-# Test that inode version is not 32 bits with 128 inode size
-ext4_test_128_inode_version()
-{
-	tst_resm TINFO "Test inode version is 32 bits with 128 inode size"
-
-	mkfs.ext4 -I 128 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	tune2fs -O extents $EXT4_DEV >/dev/null 2>&1
-
-	mount -t ext4 -o i_version $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	# inode version > 0
-	touch mnt_point/tmp_file
-	sync
-	version=`ext4_get_inode_version.sh tmp_file`
-
-	if [ $version -lt 1 ]; then
-		tst_resm TFAIL "inode version is smaller than 1"
-		umount mnt_point
-		return
-	fi
-
-	# inode version is 32 bits: 0x00000000
-	version=`debugfs $EXT4_DEV -R "stat tmp_file" 2> /dev/null | grep 'Version'`
-	version=`echo $version | awk '{ print $NF }'`
-	version=`echo $version | sed 's/^0x//'`
-	len=${#version}
-
-	if [ $len -ne 8 ]; then
-		tst_resm TFAIL "inode version is not 32 bits"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	tst_resm TPASS "32 bits inode version with 128 inode size test pass"
-}
-
-# Test file timestamps is nanosecond with 256 inode size
-# $1: file operation
-test_inode_version()
-{
-	mkfs.ext3 -I 256 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	mount -t ext4 -o i_version $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	# Check the inode version after some file operation
-	old_version=`ext4_test_inode_version $1 mnt_point/tmp_file tmp_file`
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "inode version is wrong"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	# Test mount to ext3 and then mount back to ext4
-	mount -t ext3 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount to ext3"
-		return
-	fi
-	umount mnt_point
-
-	mount -t ext4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount back to ext4"
-		return
-	fi
-
-	version=`ext4_get_inode_version.sh tmp_file`
-#	echo "remount: old - $old_version"
-#	echo "remount: new - $version"
-	if [ $old_version -ne $version ]; then
-		tst_resm TFAIL "inode version has changed unexpected"
-		umount mnt_point
-		return
-	else
-		tst_resm TPASS "inode version with 256 inode size test pass"
-		umount mnt_point
-	fi
-}
-
-# main
-ext4_setup
-
-ext4_test_128_inode_version
-
-test_inode_version create
-
-test_inode_version chmod
-
-test_inode_version chown
-
-test_inode_version read
-
-test_inode_version write
-
-test_inode_version mmap_read
-
-test_inode_version mmap_write
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_test_inode_version.c b/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_test_inode_version.c
deleted file mode 100644
index 1f7647b..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_test_inode_version.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/******************************************************************************/
-/*                                                                            */
-/* Copyright (c) 2009 FUJITSU LIMITED                                         */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/* Author: Li Zefan <lizf@cn.fujitsu.com>                                     */
-/*                                                                            */
-/******************************************************************************/
-
-#include <unistd.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-char *filename;
-char *filepath;
-int fd;
-
-int old_inode_version;
-int new_inode_version;
-
-int get_inode_version(void)
-{
-	char buf[1024];
-
-	sprintf(buf, "ext4_get_inode_version.sh %s 1", filename);
-
-	/* sync before run debugfs to get inode version */
-	sync();
-
-	return WEXITSTATUS(system(buf));
-}
-
-void test_chmod(void)
-{
-	if (fchmod(fd, S_IRUSR | S_IWUSR)) {
-		fprintf(stderr, "fchmod failed\n");
-		exit(1);
-	}
-}
-
-void test_chown(void)
-{
-	if (fchown(fd, 1, 1)) {
-		fprintf(stderr, "fchown failed\n");
-		exit(1);
-	}
-}
-
-void test_read(void)
-{
-	char buf[2];
-
-	/* write something before read */
-	if (write(fd, "abc", 4) == -1) {
-		perror("write");
-		exit(1);
-	}
-	close(fd);
-
-	if (open(filepath, O_RDONLY) == -1) {
-		perror("open");
-		exit(1);
-	}
-
-	old_inode_version = get_inode_version();
-
-	if (read(fd, buf, 1) == -1) {
-		perror("read");
-		exit(1);
-	}
-}
-
-void test_write(void)
-{
-	if (write(fd, "a", 1) == -1) {
-		fprintf(stderr, "write failed\n");
-		exit(1);
-	}
-}
-
-void test_mmap_read(void)
-{
-	char *p;
-	char c;
-
-	/* write something before read */
-	if (write(fd, "abc", 4) == -1) {
-		perror("write");
-		exit(1);
-	}
-	close(fd);
-
-	if (open(filepath, O_RDONLY) == -1) {
-		perror("open");
-		exit(1);
-	}
-
-	old_inode_version = get_inode_version();
-
-	p = mmap(NULL, 1, PROT_READ, MAP_PRIVATE | MAP_FILE, fd, 0);
-	if (p == (void *)-1) {
-		perror("mmap");
-		exit(1);
-	}
-	c = *p;
-
-	new_inode_version = get_inode_version();
-
-	msync(p, 1, MS_SYNC);
-}
-
-void test_mmap_write(void)
-{
-	char *p;
-
-	if (write(fd, "abc", 4) == -1) {
-		perror("write");
-		exit(1);
-	}
-	close(fd);
-
-	if (open(filepath, O_RDWR) == -1) {
-		perror("open");
-		exit(1);
-	}
-
-	old_inode_version = get_inode_version();
-
-	p = mmap(NULL, 1, PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0);
-	if (p == (void *)-1) {
-		perror("mmap");
-		exit(1);
-	}
-	*p = 'x';
-
-	new_inode_version = get_inode_version();
-
-	msync(p, 1, MS_SYNC);
-}
-
-/**
- * argv[1]: file operation
- * argv[2]: file to test (with path)
- * argv[3]: file to test (without path)
- */
-int main(int argc, char *argv[])
-{
-	if (argc != 4) {
-		fprintf(stderr, "wrong argument number\n");
-		return 1;
-	}
-	filepath = argv[2];
-	filename = argv[3];
-
-	/* create file and get the initial inode version */
-	fd = creat(argv[2], O_RDWR);
-	if (fd == -1) {
-		fprintf(stderr, "failed to create file: %s\n", argv[2]);
-		return 1;
-	}
-
-	old_inode_version = get_inode_version();
-
-	if (strcmp(argv[1], "create") == 0) {
-		printf("%d\n", old_inode_version);
-		return 0;
-	} else if (strcmp(argv[1], "chmod") == 0) {
-		test_chmod();
-	} else if (strcmp(argv[1], "chown") == 0) {
-		test_chown();
-	} else if (strcmp(argv[1], "read") == 0) {
-		test_read();
-	} else if (strcmp(argv[1], "write") == 0) {
-		test_write();
-	} else if (strcmp(argv[1], "mmap_read") == 0) {
-		test_mmap_read();
-	} else if (strcmp(argv[1], "mmap_write") == 0) {
-		test_mmap_write();
-	} else {
-		fprintf(stderr, "wrong file operation: %s\n", argv[1]);
-		return 1;
-	}
-
-	new_inode_version = get_inode_version();
-#if 0
-	fprintf(stderr, "test_inode_version: old - %d\n", old_inode_version);
-	fprintf(stderr, "test_inode_version: new - %d\n", new_inode_version);
-#endif
-	/* wrong inode version, test failed */
-	if (new_inode_version <= old_inode_version)
-		return 1;
-
-	printf("%d\n", new_inode_version);
-
-	close(fd);
-
-	return 0;
-}
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/Makefile
deleted file mode 100644
index 1980349..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, Fujitsu LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-MAKE_TARGETS		:=
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh b/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh
deleted file mode 100755
index 9edb893..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/bash
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2009 FUJITSU LIMITED                                         ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
-##         Miao Xie <miaox@cn.fujitsu.com>                                    ##
-##                                                                            ##
-################################################################################
-
-
-export TCID="ext4-journal-checksum"
-export TST_TOTAL=36
-
-. ext4_funcs.sh
-
-# Use ffsb to test journal checksumming
-# $1: journal mode: writeback, ordered, journal
-# $2: commit interval: 1 sec, 100 sec
-# $3: journal_checksum or not
-# $4: journal_async_commit or not
-# $5: barrier: 0, 1
-ext4_test_journal_checksum()
-{
-	local checksum=
-	local async_commit=
-
-	if [ -z "$3" ]; then
-		checksum="No use"
-	else
-		checksum="Used"
-	fi
-	if [ -z "$4" ]; then
-		async_commit="No use"
-	else
-		async_commit="Used"
-	fi
-
-	tst_resm TINFO "journal mode: $1, commit interval: $2, " \
-		"journal_checksum: $checksum, " \
-		"journal_async_commit: $async_commit, barrier: $5"
-
-	mkfs.ext4 -I 256 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	tune2fs -O extents $EXT4_DEV >/dev/null 2>&1
-
-	mount -t ext4 -o data=$1,commit=$2,$3,$4,barrier=$5 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	ffsb ffsb-config2 > /dev/null
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "ffsb returned failure"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	e2fsck -p $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck returned failure"
-		return
-	fi
-
-	tst_resm TPASS "ext4 journal checksum test pass"
-}
-
-# main
-ext4_setup
-
-tst_test_cmds ffsb
-
-DATA=( "writeback" "ordered" "journal" )
-COMMIT=( 1 100 )
-JOURNAL_CHECKSUM=( "journal_checksum" "" )
-JOURNAL_ASYNC_COMMIT=( "journal_async_commit" "" )
-BARRIER=( 0 1 )
-
-for ((i = 0; i < 2; i++))
-{
-	for ((j = 0; j < 2; j++))
-	{
-		for ((k = 0; k < 2; k++))
-		{
-			for ((l = 0; l < 2; l++))
-			{
-				for ((m = 0; m < 3; m++))
-				{
-
-					# when journal_async_commit is used,
-					# journal_checksum is set automatically
-					if [ $j -eq 0 -a $k -eq 1 ]; then
-						continue
-					fi
-
-					ext4_test_journal_checksum ${DATA[$m]} \
-						${COMMIT[$l]} \
-						"${JOURNAL_CHECKSUM[$k]}" \
-						"${JOURNAL_ASYNC_COMMIT[$j]}" \
-						${BARRIER[$i]}
-				}
-			}
-		}
-	}
-}
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/Makefile
deleted file mode 100644
index 6b8aabb..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, FUJITSU LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += -lm
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_file_time.c b/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_file_time.c
deleted file mode 100644
index a10adb3..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_file_time.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/******************************************************************************/
-/*                                                                            */
-/* Copyright (c) 2009 FUJITSU LIMITED                                         */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/* Author: Li Zefan <lizf@cn.fujitsu.com>                                     */
-/*                                                                            */
-/******************************************************************************/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-
-/*
- * Usage: file_time <filename> <atime|mtime|ctime> <sec|nsec>
- */
-int main(int argc, char *argv[])
-{
-	time_t t;
-	struct stat st;
-
-	if (argc != 4) {
-		fprintf(stderr, "Wrong argument num!\n");
-		return 1;
-	}
-
-	if (stat(argv[1], &st) != 0) {
-		perror("stat failed");
-		return 1;
-	}
-
-	if (strcmp(argv[3], "sec") == 0) {
-		if (strcmp(argv[2], "atime") == 0)
-			t = st.st_atime;
-		else if (strcmp(argv[2], "mtime") == 0)
-			t = st.st_mtime;
-		else
-			t = st.st_ctime;
-	} else if (strcmp(argv[3], "nsec") == 0) {
-		if (strcmp(argv[2], "atime") == 0)
-			t = st.st_atim.tv_nsec;
-		else if (strcmp(argv[2], "mtime") == 0)
-			t = st.st_mtim.tv_nsec;
-		else
-			t = st.st_ctim.tv_nsec;
-	} else {
-		fprintf(stderr, "Wrong argument: %s\n", argv[3]);
-		return 1;
-	}
-
-	printf("%lu\n", t);
-
-	return 0;
-}
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh
deleted file mode 100755
index 762b8dd..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-nsec-timestamps/ext4_nsec_timestamps_test.sh
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2009 FUJITSU LIMITED                                         ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
-##         Miao Xie <miaox@cn.fujitsu.com>                                    ##
-##                                                                            ##
-################################################################################
-
-export TCID="ext4-nsec-timestamps"
-export TST_TOTAL=2
-
-. ext4_funcs.sh
-
-# Test that file timestamps is second with 128 inode size
-ext4_test_sec_timestamps()
-{
-	tst_resm TINFO "Test timestamps with 128 inode size"
-
-	mkfs.ext4 -I 128 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	tune2fs -O extents $EXT4_DEV >/dev/null 2>&1
-
-	mount -t ext4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	touch mnt_point/tmp_file
-
-	atime=`ext4_file_time mnt_point/tmp_file atime nsec`
-	mtime=`ext4_file_time mnt_point/tmp_file mtime nsec`
-	ctime=`ext4_file_time mnt_point/tmp_file ctime nsec`
-
-	if [ $atime -ne 0 -o $mtime -ne 0 -o $ctime -ne 0 ]; then
-		tst_resm TFAIL "Timestamp is not second(atime: $atime, mtime: \
-				$mtime, ctime: $ctime)"
-		tst_umount mnt_point
-		return
-	fi
-	tst_umount mnt_point
-
-	tst_resm TPASS "Ext4 nanosecond timestamps test with 128 inode size pass"
-}
-
-# Test file timestamps is nanosecond with 256 inode size
-ext4_test_nsec_timestamps()
-{
-	tst_resm TINFO "Test timestamps with 256 inode size"
-
-	mkfs.ext3 -I 256 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext3 filesystem"
-		return
-	fi
-
-	mount -t ext4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	# Create file
-	touch mnt_point/tmp_file
-	sleep 1
-
-	# Change atime, ctime and mtime of the file
-	touch mnt_point/tmp_file
-
-	cur_time=`date '+%s %N'`
-	sec=`echo $cur_time | awk {'print $1'}`
-	nsec=`echo $cur_time | awk {'print $2'}`
-
-	sec_atime=`ext4_file_time mnt_point/tmp_file atime sec`
-	sec_mtime=`ext4_file_time mnt_point/tmp_file mtime sec`
-	sec_ctime=`ext4_file_time mnt_point/tmp_file ctime sec`
-	nsec_atime=`ext4_file_time mnt_point/tmp_file atime nsec`
-	nsec_mtime=`ext4_file_time mnt_point/tmp_file mtime nsec`
-	nsec_ctime=`ext4_file_time mnt_point/tmp_file ctime nsec`
-
-	# Test nanosecond
-	if [ $nsec_atime -eq 0 -a $nsec_mtime -eq 0 -a $nsec_ctime -eq 0 ]; then
-		tst_resm TFAIL "The timestamp is not nanosecond(nsec_atime: $nsec_atime, nsec_mtime: $nsec_mtime, nsec_ctime: $nsec_ctime)"
-		tst_umount mnt_point
-		return
-	fi
-
-	diff1=$(( $sec_atime - $sec ))
-	diff2=$(( $sec_mtime - $sec ))
-	diff3=$(( $sec_ctime - $sec ))
-
-	# Test difference between file time and current time
-	if [ $diff1 -gt 1 -o $diff2 -gt 1 -o $diff2 -gt 1 ]; then
-		tst_resm TFAIL "The timestamp is wrong, it must be earlier \
-			than the current time we got.(sec_atime: $sec_atime, \
-			sec_mtime: $sec_mtime, sec_ctime: $sec_ctime, \
-			cur_time[s]: $sec)"
-		tst_umount mnt_point
-		return
-	fi
-
-	tst_umount mnt_point
-
-	# Test mount to ext3 and then mount back to ext4
-	mount -t ext3 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount to ext3"
-		return
-	fi
-	tst_umount mnt_point
-
-	mount -t ext4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount back to ext4"
-		return
-	fi
-
-	nsec_atime2=`ext4_file_time mnt_point/tmp_file atime nsec`
-	nsec_mtime2=`ext4_file_time mnt_point/tmp_file mtime nsec`
-	nsec_ctime2=`ext4_file_time mnt_point/tmp_file ctime nsec`
-
-	if [ $nsec_atime -ne $nsec_atime2 -o $nsec_ctime -ne $nsec_ctime2 -o \
-	     $nsec_mtime -ne $nsec_mtime2 ]; then
-		tst_resm TFAIL "File nanosecond timestamp has changed \
-			unexpected. Before[atime mtime ctime]: $nsec_atime \
-			$nsec_mtime $nsec_ctime, After[atime mtime ctime]: \
-			$nsec_atime2 $nsec_mtime2 $nsec_ctime2)"
-		tst_umount mnt_point
-		return
-	fi
-
-	tst_umount mnt_point
-	tst_resm TPASS "Ext4 nanosecond timestamps test with 256 inode size pass"
-}
-
-# main
-ext4_setup
-
-ext4_test_sec_timestamps
-ext4_test_nsec_timestamps
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-online-defrag/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-online-defrag/Makefile
deleted file mode 100644
index 6b8aabb..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-online-defrag/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, FUJITSU LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += -lm
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-online-defrag/ext4_online_defrag_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-online-defrag/ext4_online_defrag_test.sh
deleted file mode 100755
index 11261e4..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-online-defrag/ext4_online_defrag_test.sh
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/bin/bash
-
-################################################################################
-#                                                                              #
-# Copyright (c) 2009 FUJITSU LIMITED                                           #
-#                                                                              #
-# 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      #
-#                                                                              #
-################################################################################
-
-export TCID="ext4-online-defrag"
-export TST_TOTAL=18
-
-. ext4_funcs.sh
-
-# How to age filesystem
-EMPTY=1
-SMALL=2
-LARGE=3
-
-# Defrag what
-FILE=1
-DIR=2
-FILESYSTEM=3
-
-tst_test_cmds e4defrag
-E4DEFRAG=`which e4defrag`
-
-age_filesystem()
-{
-	local dirId=
-	local idx=
-	rm -rf mnt_point/*
-	if [ $1 -eq $EMPTY ]; then
-		if [ $2 -eq $FILE -o $2 -eq $FILESYSTEM ]; then
-			touch mnt_point/tmp_file
-			echo "abc" > mnt_point/tmp_file
-		elif [ $2 -eq $DIR ]; then
-			mkdir mnt_point/tmp_dir
-			echo "abc" > mnt_point/tmp_dir/tmp_file
-		fi
-	elif [ $1 -eq $SMALL ]; then
-
-		dd if=/dev/zero of=mnt_point/occupy bs=1M count=40
-
-		# age filesystem from 0.0 to 0.2 -> 0.4 -> 0.6 -> 0.8 -> 1.0
-		for ((idx = 3; idx < 8; idx++))
-		{
-			ffsb ffsb-config$idx > /dev/null
-			dirId=$((idx - 3))
-			mv mnt_point/data mnt_point/data$dirId
-		}
-
-		rm mnt_point/occupy
-
-		df
-	else
-		rm -rf mnt_point/*
-		if [ $2 -eq $DIR ]; then
-			mkdir mnt_point/tmp_dir
-			dest=mnt_point/tmp_dir/tmp_file
-		else
-			dest=mnt_point/tmp_file
-		fi
-
-		bsize=`dumpe2fs -h $EXT4_DEV | grep 'Block size'`
-		bsize=`echo $bsize | awk '{ print $NF }'`
-		bcount=`dumpe2fs -h $EXT4_DEV | grep 'Free blocks'`
-		bcount=`echo $bcount | awk '{ print $NF }'`
-		bcount=$(( $bcount / 2 - 100 ))
-		dd if=/dev/zero of=$dest bs=$bsize count=$bcount
-
-	fi
-}
-
-my_e4defrag()
-{
-	if [ $1 -eq $FILE ]; then
-		if [ $2 -eq $SMALL ]; then
-			$E4DEFRAG -v mnt_point/data0/
-			return $?
-		# EMPTY or LARGE
-		else
-			$E4DEFRAG -v mnt_point/tmp_file
-			return $?
-		fi
-	elif [ $1 -eq $DIR ]; then
-		if [ $2 -eq $SMALL ]; then
-			$E4DEFRAG -v mnt_point/data0/
-			return $?
-		else
-			$E4DEFRAG -v mnt_point/tmp_dir
-			return $?
-		fi
-	else
-		$E4DEFRAG -v $EXT4_DEV
-		return $?
-	fi
-}
-
-# Test online defragmentation feature
-# $1: defrag type
-# $2: 1 - empty, 2 - full with small files, 3 - full with large files
-# $3: block size
-ext4_test_online_defrag()
-{
-	echo Test $TST_COUNT start >> ext4_online_defrag_result.txt
-
-	tst_resm TINFO "defrag type: $1, defrag obj: $2, block size: $3"
-
-	mkfs.ext4 -m 0 -b $3 -O ^flex_bg $EXT4_DEV >> ext4_online_defrag_result.txt 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	tune2fs -O extents $EXT4_DEV >> ext4_online_defrag_result.txt 2>&1
-
-	mount -t ext4 -o nodelalloc $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL"failed to mount ext4 filesystem"
-		return
-	fi
-
-	age_filesystem $2 $1 >> ext4_online_defrag_result.txt 2>&1
-
-	my_e4defrag $1 $2 >> ext4_online_defrag_result.txt
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "e4defrag returned failure"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	e2fsck -p $EXT4_DEV >> ext4_online_defrag_result.txt 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck returned failure"
-		return
-	fi
-
-	tst_resm TPASS "ext4 online defrag test pass"
-}
-
-# main
-ext4_setup
-
-tst_test_cmds ffsb
-
-DEFRAG=( $FILE $DIR $FILESYSTEM )
-AGING=( $EMPTY $SMALL $LARGE )
-BLOCK_SIZE=( 1024 4096 )
-
-for ((i = 0; i < 2; i++))
-{
-	for ((j = 0; j < 3; j++))
-	{
-		for ((k = 0; k < 3; k++))
-		{
-			ext4_test_online_defrag ${DEFRAG[$j]} ${AGING[$k]} \
-						${BLOCK_SIZE[$i]}
-		}
-	}
-}
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/Makefile
deleted file mode 100644
index 1980349..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, Fujitsu LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-MAKE_TARGETS		:=
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
deleted file mode 100755
index 2a4b699..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-persist-prealloc/ext4_persist_prealloc_test.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2009 FUJITSU LIMITED                                         ##
-##                                                                            ##
-## 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           ##
-##                                                                            ##
-## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
-##         Miao Xie <miaox@cn.fujitsu.com>                                    ##
-##                                                                            ##
-################################################################################
-
-export TCID="ext4-persistent-preallocation"
-export TST_TOTAL=2
-
-. ext4_funcs.sh
-
-# Use ltp's syscall/fallocate to test this feature
-# $1: 1024 or 4096
-ext4_test_persist_prealloc()
-{
-	mkfs.ext4 -I 256 -b $1 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	mount -t ext4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	for ((i = 1; i <= 3; i++))
-	{
-		if ! command -v fallocate0${i} > /dev/null 2>&1; then
-			tst_resm TFAIL "file - fallocate0${i} doesn't exist. Please \
-				check whether it was compiled and installed.\
-				(Path: LTPROOT/testcases/kernel/syscalls/fallocate)"
-			umount mnt_point
-			return
-		fi
-
-		temp_tmpdir=$TMPDIR
-		TMPDIR=${PWD}/mnt_point; fallocate0${i} > /dev/null 2>&1
-		ret=$?
-		TMPDIR=$temp_tmpdir
-
-		if [ $ret -ne 0 ]; then
-			tst_resm TFAIL "fallocate's return value is not expected"
-			umount mnt_point
-			return
-		fi
-	}
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	e2fsck -p $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck returned failure"
-		return
-	fi
-
-	tst_resm TPASS "ext4 persistent preallocation test pass"
-}
-
-# main
-ext4_setup
-
-ext4_test_persist_prealloc 1024
-ext4_test_persist_prealloc 4096
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/Makefile
deleted file mode 100644
index 6b8aabb..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, FUJITSU LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS += -lm
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_long_dirs.c b/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_long_dirs.c
deleted file mode 100644
index fc9221a..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_long_dirs.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/******************************************************************************/
-/*                                                                            */
-/* Copyright (c) 2009 FUJITSU LIMITED                                         */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/* Author: Li Zefan <lizf@cn.fujitsu.com>                                     */
-/*                                                                            */
-/******************************************************************************/
-
-#define _ATFILE_SOURCE
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <fcntl.h>
-#include <sys/types.h>
-//#define __USE_ATFILE
-#include <sys/stat.h>
-#include "config.h"
-
-#define NAME_LEN	255
-#define NCHARS		62
-#define MAX_LEN1	62
-#define MAX_LEN2	(62 * 62)
-#define MAX_LEN3	(62 * 62 * 62)
-
-/* valid characters for the directory name */
-char chars[NCHARS + 1] =
-    "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
-
-/* to store the generated directory name */
-char name[NAME_LEN + 1];
-int names;
-int parent_fd;
-
-/*
- * init_name - initialize the directory name
- *
- * Generate a randomized directory name, and then we generate more
- * directory names based on it.
- */
-void init_name(void)
-{
-	int i;
-
-	srand(time(NULL));
-
-	for (i = 0; i < NAME_LEN; i++)
-		name[i] = chars[rand() % 62];
-}
-
-void create_dir(void)
-{
-#ifdef HAVE_MKDIRAT
-	if (mkdirat(parent_fd, name, S_IRWXU)) {
-		perror("mkdir");
-		exit(1);
-	}
-#else
-	fprintf(stderr, "System lacks mkdirat() call.\n");
-	exit(1);
-#endif
-}
-
-/*
- * create_dirs - create @names directory names
- * @n: how many names to be created
- *
- * if n <= 62,       we need to modify 1 char of the name
- * if n <= 62*62,    we need to modify 2 chars
- * if n <= 62*62*62, we need to modify 3 chars
- */
-void create_dirs(int n)
-{
-	int i, j, k;
-	int depth;
-
-	if (n <= MAX_LEN1)
-		depth = 1;
-	else if (n <= MAX_LEN2)
-		depth = 2;
-	else
-		depth = 3;
-
-	for (i = 0; i < NCHARS; i++) {
-		name[0] = chars[i];
-		if (depth == 1) {
-			create_dir();
-			if (--n == 0)
-				return;
-			continue;
-		}
-
-		for (j = 0; j < NCHARS; j++) {
-			name[1] = chars[j];
-			if (depth == 2) {
-				create_dir();
-				if (--n == 0)
-					return;
-				continue;
-			}
-
-			for (k = 0; k < NCHARS; k++) {
-				name[2] = chars[k];
-				create_dir();
-				if (--n == 0)
-					return;
-			}
-		}
-	}
-}
-
-void usage()
-{
-	fprintf(stderr, "Usage: create_long_dirs nr_dirs parent_dir\n");
-}
-
-/*
- * Create long-name directories
- * @argv[1]: directory number
- * @argv[2]: parent directory
- */
-int main(int argc, char *argv[])
-{
-	if (argc != 3) {
-		usage();
-		return 1;
-	}
-
-	names = atoi(argv[1]);
-	if (names > MAX_LEN3 || names <= 0) {
-		usage();
-		return 1;
-	}
-
-	parent_fd = open(argv[2], O_RDONLY);
-	if (parent_fd == -1) {
-		perror("open parent dir failed");
-		return 1;
-	}
-
-	init_name();
-
-	create_dirs(names);
-
-	return 0;
-}
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_short_dirs.c b/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_short_dirs.c
deleted file mode 100644
index cb67dbd..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/create_short_dirs.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/******************************************************************************/
-/*                                                                            */
-/* Copyright (c) 2009 FUJITSU LIMITED                                         */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/* Author: Li Zefan <lizf@cn.fujitsu.com>                                     */
-/*                                                                            */
-/******************************************************************************/
-
-#define _ATFILE_SOURCE
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include "config.h"
-
-/* valid characters for a directory name */
-char chars[] = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
-
-/* to store the generated directory name */
-char name[10];
-int names;
-int parent_fd;
-
-/* NCHARS = 10 + 26 + 26 = 62 */
-#define NCHARS		62
-#define MAX_LEN1	62
-#define MAX_LEN2	(62 * 62)
-#define MAX_LEN3	(62 * 62 * 62)
-#define MAX_NAMES	(MAX_LEN1 + MAX_LEN2 + MAX_LEN3)
-
-void create_dir(void)
-{
-#ifdef HAVE_MKDIRAT
-	if (mkdirat(parent_fd, name, S_IRWXU)) {
-		perror("mkdir");
-		exit(1);
-	}
-#else
-	fprintf(stderr, "System lacks mkdirat() call.\n");
-	exit(1);
-#endif
-}
-
-/*
- * create_1 - create length-1 directory names
- * @n: how name names to be created
- */
-void create_1(int n)
-{
-	int i;
-
-	name[1] = '\0';
-	for (i = 0; i < NCHARS; i++) {
-		name[0] = chars[i];
-		create_dir();
-		if (--n == 0)
-			return;
-	}
-}
-
-/*
- * create_2 - generate length-2 directory names
- * @n: how many names to be created
- */
-void create_2(int n)
-{
-	int i, j;
-
-	name[2] = '\0';
-	for (i = 0; i < NCHARS; i++) {
-		name[0] = chars[i];
-		for (j = 0; j < NCHARS; j++) {
-			name[1] = chars[j];
-			create_dir();
-			if (--n == 0)
-				return;
-		}
-	}
-}
-
-/*
- * create_3 - generate length-3 directory names
- * @n: how many names to be created
- */
-void create_3(int n)
-{
-	int i, j, k;
-
-	name[3] = '\0';
-	for (i = 0; i < NCHARS; i++) {
-		name[0] = chars[i];
-		for (j = 0; j < NCHARS; j++) {
-			name[1] = chars[j];
-			for (k = 0; k < NCHARS; k++) {
-				name[2] = chars[k];
-				create_dir();
-				if (--n == 0)
-					return;
-			}
-		}
-	}
-}
-
-void usage()
-{
-	fprintf(stderr, "Usage: create_short_dirs nr_dirs parent_dir\n");
-}
-
-/*
- * Create short-name directoriess
- * @argv[1]: director number
- * @argv[2]: the parent directory
- */
-int main(int argc, char *argv[])
-{
-	if (argc != 3) {
-		usage();
-		return 1;
-	}
-
-	names = atoi(argv[1]);
-	if (names > MAX_NAMES || names <= 0) {
-		usage();
-		return 1;
-	}
-
-	parent_fd = open(argv[2], O_RDONLY);
-	if (parent_fd == -1) {
-		perror("open parent dir");
-		return 1;
-	}
-
-	create_1(names);
-	if (names <= MAX_LEN1)
-		return 0;
-
-	names -= MAX_LEN1;
-	create_2(names);
-	if (names <= MAX_LEN2)
-		return 0;
-
-	names -= MAX_LEN2;
-	create_3(names);
-
-	return 0;
-}
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh
deleted file mode 100755
index 5cc0523..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-subdir-limit/ext4_subdir_limit_test.sh
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/bin/bash
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2009 FUJITSU LIMITED                                         ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
-##         Miao Xie <miaox@cn.fujitsu.com>                                    ##
-##                                                                            ##
-################################################################################
-
-
-export TCID="ext4-subdir-limit"
-export TST_TOTAL=10
-
-. ext4_funcs.sh
-
-SHORT_DIR=1
-LONG_DIR=2
-
-FAIL=1
-PASS=0
-
-prev_block_size=-1
-prev_result=$FAIL
-
-# Run a test case
-# $1: Number of directories to create
-# $2: create short dir or long dir
-# $3: parent directory
-# $4: filesystem block size
-ext4_run_case()
-{
-	local dir_name_len=
-
-	if [ $2 -eq $SHORT_DIR ]; then
-		dir_name_len="short name"
-	else
-		dir_name_len="long name"
-	fi
-
-	tst_resm TINFO "Num of dirs to create: $1, Dir name len: $dir_name_len, " \
-			"Parent dir: $3, Block size: $4"
-
-	# only mkfs if block size has been changed,
-	# or previous case failed
-	if [ $prev_result -ne $PASS -o $4 -ne $prev_block_size ]; then
-		mkfs.ext4 -b $4 -I 256 $EXT4_DEV >/dev/null 2>&1
-		if [ $? -ne 0 ]; then
-			tst_resm TFAIL "failed to create ext4 filesystem"
-			return
-		fi
-		prev_block_size=$4
-
-		tune2fs -O extents $EXT4_DEV >/dev/null 2>&1
-	fi
-
-	prev_result=$FAIL
-
-	# mount ext4 filesystem
-	mount -t ext4 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	# create directories
-	mkdir -p $3 2> /dev/null
-
-	if [ $2 -eq $SHORT_DIR ]; then
-		create_short_dirs $1 $3
-	else
-		create_long_dirs $1 $3
-	fi
-
-	if [ $? -ne 0 ]; then
-		nr_dirs=`ls $3 | wc -l`
-		tst_resm TFAIL "failed to create directories - $nr_dirs"
-		umount mnt_point
-		return
-	fi
-
-	# delete directories
-	cd $3
-	ls | xargs rmdir
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to remove directories"
-		cd -
-		umount mnt_point
-		return
-	fi
-	cd -
-
-	# unmount ext4 filesystem
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	# run fsck to make sure the filesystem has no errors
-	e2fsck -p $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck: the filesystem has errors"
-		return
-	fi
-
-	# check dir_nlink is set
-	dumpe2fs $EXT4_DEV 2> /dev/null | grep '^Filesystem features' | grep -q dir_nlink
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "feature dir_nlink is not set"
-		return
-	fi
-
-	prev_result=$PASS
-	tst_resm TPASS "ext4 subdir limit test pass"
-}
-
-# main
-ext4_setup
-
-DIR_LEN=( $SHORT_DIR $LONG_DIR )
-PARENT_DIR=( "mnt_point" "mnt_point/sub" )
-BLOCK_SIZE=( 1024 2048 4096 )
-
-for ((i = 0; i < 3; i++))
-{
-	for ((j = 0; j < 2; j++))
-	{
-		for ((k = 0; k < 2; k++))
-		{
-			if [ ${DIR_LEN[$k]} -eq $LONG_DIR -a \
-				${BLOCK_SIZE[$i]} -eq 1024 ]; then
-				continue
-			fi
-			ext4_run_case 65537 ${DIR_LEN[$k]} ${PARENT_DIR[$j]} \
-					${BLOCK_SIZE[$i]}
-		}
-	}
-}
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/Makefile b/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/Makefile
deleted file mode 100644
index 1980349..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-#    Copyright (C) 2009, Fujitsu LIMITED
-#
-#    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.
-#
-
-top_srcdir              ?= ../../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-MAKE_TARGETS		:=
-INSTALL_TARGETS		?= *.sh
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh
deleted file mode 100755
index d39afae..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/bin/bash
-
-################################################################################
-#                                                                              #
-# Copyright (c) 2009 FUJITSU LIMITED                                           #
-#                                                                              #
-# 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      #
-#                                                                              #
-################################################################################
-
-export TCID="ext4-uninit-groups"
-export TST_TOTAL=24
-
-. ext4_funcs.sh
-
-# How to age filesystem
-EMPTY=1
-SMALL=2
-LARGE=3
-
-age_filesystem()
-{
-	if [ $1 -eq $EMPTY ]; then
-		# aging, then del
-		ffsb ffsb-config3 > /dev/null
-		rm -rf mnt_point/*
-	elif [ $1 -eq $SMALL ]; then
-		# age filesystem from 0.0 to 0.2 -> 0.4 -> 0.6 -> 0.8 -> 1.0
-		for ((n = 3; n < 8; n++))
-		{
-			ffsb ffsb-config$n > /dev/null
-			mv mnt_point/data mnt_point/data$n
-		}
-	elif [ $1 -eq $LARGE ]; then
-		rm -rf mnt_point/*
-		bsize=`dumpe2fs -h $EXT4_DEV 2> /dev/null | grep 'Block size'`
-		bsize=`echo $bsize | awk '{ print $3 }'`
-		bcount=`dumpe2fs -h $EXT4_DEV 2> /dev/null | grep 'Free blocks'`
-		bcount=`echo $bcount | awk '{ print $3 }'`
-		dd if=/dev/zero of=mnt_point/tmp_dir bs=$bsize count=$bcount
-	else
-		return 1
-	fi
-
-	return 0
-}
-
-# Test uninitialized groups
-# $1: orlov, oldalloc
-# $2: delalloc
-# $3: flex_bg
-# $4: age filesystem: $EMPTY, $SMALL, $LARGE
-ext4_test_uninit_groups()
-{
-	echo "Test $TST_COUNT" >> ext4_uninit_groups_result.txt
-
-	mkfs.ext4 -I 256 -m 0 $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to create ext4 filesystem"
-		return
-	fi
-
-	if [ "$3" = "no_flex_bg" ]; then
-		flag=""
-	else
-		flag=$3
-	fi
-
-	tune2fs -O extents,uninit_groups,$flag $EXT4_DEV >/dev/null 2>&1
-
-	# Must run fsck after setting uninit_groups
-	fsck -p $EXT4_DEV >/dev/null 2>&1
-
-	mount -t ext4 -o $1,$2 $EXT4_DEV mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount ext4 filesystem"
-		return
-	fi
-
-	age_filesystem $4 >> ext4_uninit_groups_result.txt 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "age filesystem failed"
-		umount mnt_point
-		return
-	fi
-
-	umount mnt_point
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to umount ext4 filesystem"
-		return
-	fi
-
-	fsck -p $EXT4_DEV >/dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "fsck returned failure"
-		return
-	fi
-
-	tst_resm TPASS "ext4 uninit groups test pass"
-}
-
-# main
-ext4_setup
-
-tst_test_cmds ffsb
-
-ORLOV=( "orlov" "oldalloc" )
-DELALLOC=( "delalloc" "nodelalloc" )
-FLEX_BG=( "flex_bg" "no_flex_bg" )
-AGING=( $EMPTY $SMALL $LARGE )
-
-
-for ((i = 0; i < 2; i++))
-{
-	for ((j = 0; j < 2; j++))
-	{
-		for ((k = 0; k < 2; k++))
-		{
-			for ((l = 0; l < 3; l++))
-			{
-				ext4_test_uninit_groups ${ORLOV[$i]} \
-							${DELALLOC[$j]} \
-							${FLEX_BG[$k]} \
-							${AGING[$l]}
-			}
-		}
-	}
-}
-
-tst_exit
diff --git a/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh b/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh
deleted file mode 100755
index 340b2db..0000000
--- a/testcases/kernel/fs/ext4-new-features/ext4_funcs.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) 2009 FUJITSU LIMITED                                         ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
-##         Miao Xie <miaox@cn.fujitsu.com>                                    ##
-##                                                                            ##
-################################################################################
-
-. test.sh
-
-ext4_setup()
-{
-	if tst_kvcmp -lt "2.6.31"; then
-		tst_brkm TCONF "kernel is below 2.6.31"
-	fi
-
-	tst_require_root
-
-	EXT4_KERNEL_SUPPORT=`grep -w ext4 /proc/filesystems | cut -f2`
-	if [ "$EXT4_KERNEL_SUPPORT" != "ext4" ]; then
-		modprobe ext4 > /dev/null 2>&1
-		if [ $? -ne 0 ]; then
-			tst_brkm TCONF "Ext4 is not supported"
-		fi
-	fi
-
-	if [ -z "$LTP_BIG_DEV" ];then
-		tst_brkm TCONF "tests need a big block device(5G-10G)"
-	else
-		export EXT4_DEV=$LTP_BIG_DEV
-		if mount | cut -d' ' -f1 | grep -q ^$EXT4_DEV$; then
-			tst_brkm TBROK "$EXT4_DEV should be umounted before test"
-		fi
-	fi
-
-	tst_tmpdir
-	TST_CLEANUP=ext4_cleanup
-
-	mkdir mnt_point
-}
-
-ext4_cleanup()
-{
-	rm -rf mnt_point
-	tst_rmdir
-}
diff --git a/testcases/kernel/fs/fs_fill/fs_fill.c b/testcases/kernel/fs/fs_fill/fs_fill.c
index bb07ede..66b3974 100644
--- a/testcases/kernel/fs/fs_fill/fs_fill.c
+++ b/testcases/kernel/fs/fs_fill/fs_fill.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -122,7 +110,6 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
diff --git a/testcases/kernel/fs/ftest/ftest06.c b/testcases/kernel/fs/ftest/ftest06.c
index b434067..c3aebe5 100644
--- a/testcases/kernel/fs/ftest/ftest06.c
+++ b/testcases/kernel/fs/ftest/ftest06.c
@@ -25,7 +25,7 @@
  * 	this is the same as ftest2, except that it uses lseek64
  *
  * CALLS
- *	open, close,  read, write, llseek,
+ *	open, close,  read, write, lseek64,
  *	unlink, chdir
  *
  *
diff --git a/testcases/kernel/fs/ftest/ftest07.c b/testcases/kernel/fs/ftest/ftest07.c
index e5998b5..3b5b2a4 100644
--- a/testcases/kernel/fs/ftest/ftest07.c
+++ b/testcases/kernel/fs/ftest/ftest07.c
@@ -23,7 +23,7 @@
  *	ftest07.c -- test file I/O with readv and writev (ported from SPIE,
  *		    section2/filesuite/ftest9.c
  *
- * 	this is the same as ftest4, except that it uses lseek64
+ * 	this is the same as ftest3, except that it uses lseek64
  *
  * CALLS
  *	lseek64, readv, writev,
diff --git a/testcases/kernel/fs/ftest/ftest08.c b/testcases/kernel/fs/ftest/ftest08.c
index 5e46248..e7fb56f 100644
--- a/testcases/kernel/fs/ftest/ftest08.c
+++ b/testcases/kernel/fs/ftest/ftest08.c
@@ -23,7 +23,7 @@
  *	ftest08.c -- test single file io (tsfio.c by rbk) (ported from SPIE,
  *		     section2/filesuite/ftest10.c, by Airong Zhang)
  *
- * 	this is the same as ftest5, except that it uses lseek64
+ * 	this is the same as ftest4, except that it uses lseek64
  *
  * CALLS
  *	fsync, sync, lseek64, read, write
diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
index 71eb35b..9de3f7c 100755
--- a/testcases/kernel/fs/iso9660/isofs.sh
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -1,161 +1,88 @@
 #!/bin/sh
-#
-# Copyright (c) International Business Machines  Corp., 2003
-#
-# 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.
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2003
 # Written by Prakash Narayana (prakashn@us.ibm.com)
 # and Michael Reed (mreed10@us.ibm.com)
+# Copyright (c) Linux Test Project, 2016-2019
 #
-# A script that will test isofs on Linux system.
+# Test isofs on Linux system.
 # It makes ISO9660 file system with different options and also
-# mounts the ISO9660 file system with different mount options.
-#
+# mounts ISO9660 file system with different mount options.
 
-TCID=isofs
-TST_TOTAL=77
-. test.sh
+TST_NEEDS_CMDS="mkisofs"
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=do_test
+. tst_test.sh
 
-NO_CLEANUP=""
-
-usage()
-{
-	echo "USAGE: $0 <optional> -n -h"
-	exit
-}
-
-cleanup()
-{
-	if [ "$NO_CLEANUP" = "no" ]; then
-		tst_resm TINFO "Temporary directory $PWD was not removed"
-	else
-		tst_rmdir
-	fi
-}
-
-max_depth=3
-max_dirs=4
+MAX_DEPTH=3
+MAX_DIRS=4
 
 gen_fs_tree()
 {
 	local cur_path="$1"
 	local cur_depth="$2"
+	local new_path
 
-	if [ "$cur_depth" -gt "$max_depth" ]; then
-		return
-	fi
+	[ "$cur_depth" -gt "$MAX_DEPTH" ] && return
 
-	for i in $(seq 1 $max_dirs); do
-		local new_path="$cur_path/subdir_$i"
-
+	for i in $(seq 1 $MAX_DIRS); do
+		new_path="$cur_path/subdir_$i"
 		mkdir -p "$new_path"
-
-		dd if=/dev/urandom of="$new_path/file" bs=1024 count=100 >/dev/null 2>&1
-
+		ROD_SILENT dd if=/dev/urandom of="$new_path/file" bs=1024 count=100
 		gen_fs_tree "$new_path" $((cur_depth + 1))
 	done
 }
 
-while getopts :hnd: arg; do
-	case $arg in
-	h)
-		echo ""
-		echo "n - The directories created will not be removed"
-		echo "h - Help options"
-		echo ""
-		usage
-		echo ""
-		;;
-	n)
-		NO_CLEANUP="no"
-		;;
-	esac
-done
+do_test() {
+	local mnt_point="$PWD/mnt"
+	local make_file_sys_dir="$PWD/files"
 
-tst_require_root
+	mkdir -p -m 777 $mnt_point
+	mkdir -p $make_file_sys_dir
 
-tst_tmpdir
-TST_CLEANUP=cleanup
+	# Generated directories and files
+	mkdir -p $make_file_sys_dir
+	gen_fs_tree "$make_file_sys_dir" 1
 
-MNT_POINT="$PWD/mnt"
-MAKE_FILE_SYS_DIR="$PWD/files"
-
-mkdir -p -m 777 $MNT_POINT
-mkdir -p $MAKE_FILE_SYS_DIR
-
-# Generated directories and files
-mkdir -p $MAKE_FILE_SYS_DIR
-gen_fs_tree "$MAKE_FILE_SYS_DIR" 1
-
-# Make ISO9660 file system with different options.
-# Mount the ISO9660 file system with different mount options.
-
-tst_test_cmds mkisofs
-
-for mkisofs_opt in \
-	" " \
-	"-J" \
-	"-hfs -D" \
-	" -R " \
-	"-R -J" \
-	"-f -l -D -J -allow-leading-dots -R" \
-	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -allow-leading-dots -R"
-do
-	rm -f isofs.iso
-	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
-	if [ $? -eq 0 ]; then
-		tst_resm TPASS \
-			"mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
-	else
-		tst_resm TFAIL \
-			tst_resm TFAIL "mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
-		continue
-	fi
-
-	for mount_opt in \
-		"loop" \
-		"loop,norock" \
-		"loop,nojoliet" \
-		"loop,block=512,unhide" \
-		"loop,block=1024,cruft" \
-		"loop,block=2048,nocompress" \
-		"loop,check=strict,map=off,gid=bin,uid=bin" \
-		"loop,check=strict,map=acorn,gid=bin,uid=bin" \
-		"loop,check=relaxed,map=normal" \
-		"loop,block=512,unhide,session=2"
-		# "loop,sbsector=32"
+	# Make ISO9660 file system with different options.
+	# Mount the ISO9660 file system with different mount options.
+	for mkisofs_opt in \
+		" " \
+		"-J" \
+		"-hfs -D" \
+		" -R " \
+		"-R -J" \
+		"-f -l -D -J -allow-leading-dots -R" \
+		"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -allow-leading-dots -R"
 	do
-		mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
-		if [ $? -ne 0 ]; then
-			tst_resm TFAIL \
-				"mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT"
-			continue
-		fi
+		rm -f isofs.iso
+		EXPECT_PASS mkisofs -o isofs.iso -quiet $mkisofs_opt $make_file_sys_dir 2\> /dev/null \
+			|| continue
 
-		ls -lR $MNT_POINT > /dev/null
-		if [ $? -ne 0 ]; then
-			tst_resm TFAIL "ls -lR $MNT_POINT"
-		fi
+		for mount_opt in \
+			"loop" \
+			"loop,norock" \
+			"loop,nojoliet" \
+			"loop,block=512,unhide" \
+			"loop,block=1024,cruft" \
+			"loop,block=2048,nocompress" \
+			"loop,check=strict,map=off,gid=bin,uid=bin" \
+			"loop,check=strict,map=acorn,gid=bin,uid=bin" \
+			"loop,check=relaxed,map=normal" \
+			"loop,block=512,unhide,session=2"
+		do
+			mount -t iso9660 -o $mount_opt isofs.iso $mnt_point
+			if [ $? -ne 0 ]; then
+				tst_res TFAIL "mount -t iso9660 -o $mount_opt isofs.iso $mnt_point"
+				continue
+			fi
 
-		umount $MNT_POINT
-		if [ $? -ne 0 ]; then
-			tst_brkm TFAIL "umount $MNT_POINT"
-		fi
+			ls -lR $mnt_point > /dev/null || tst_res TFAIL "ls -lR $mnt_point"
+			umount $mnt_point || tst_brk TFAIL "umount $mnt_point"
 
-		tst_resm TPASS "mount/umount with \"$mount_opt\" options"
+			tst_res TPASS "mount/umount with \"$mount_opt\" options"
+		done
 	done
-done
+}
 
-tst_exit
+tst_run
diff --git a/testcases/kernel/fs/linktest/linktest.sh b/testcases/kernel/fs/linktest/linktest.sh
index bc78f1e..9d8c8b9 100755
--- a/testcases/kernel/fs/linktest/linktest.sh
+++ b/testcases/kernel/fs/linktest/linktest.sh
@@ -1,79 +1,75 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2000
+# Copyright (c) Linux Test Project, 2012-2019
+# Regression test for max links per file
+# linktest.sh <number of symlinks> <number of hardlinks>
+# Author: Ngie Cooper <yaneurabeya@gmail.com>
 
-#   Copyright (c) International Business Machines  Corp., 2000
-#
-#   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
+TST_NEEDS_TMPDIR=1
+TST_POS_ARGS=2
+TST_TESTFUNC=do_test
 
-
-#
-#  FILE(s)     : linktest.sh README
-#  DESCRIPTION : Regression test for max links per file
-#  USE         : linktest.sh <number of symlinks> <number of hardlinks>
-#  AUTHOR      : Ngie Cooper (yaneurabeya@gmail.com)
-#  HISTORY     :
-#	A rewrite of testcases/kernel/fs/linktest.pl
-
-export TCID=linker01
-export TST_TOTAL=2
-export TST_COUNT=1
-. test.sh
+. tst_test.sh
 
 if [ $# -ne 2 ]; then
-	tst_resm TBROK "usage: $0 {softlink count} {hardlink count}"
+	tst_res TBROK "usage: $0 {softlink count} {hardlink count}"
 	exit 1
 fi
 
-tst_tmpdir
+validate_parameter()
+{
+	if ! tst_is_int "$2"; then
+		tst_brk TBROK "$1 must be integer"
+	fi
 
-mkdir hlink.$$ slink.$$ && touch hlink.$$/hfile slink.$$/sfile
+	if [ "$2" -lt 0 ]; then
+		tst_brk TBROK "$1 must be >= 0"
+	fi
+}
 
-do_link() {
-	pfix=$1
-	ln_opts=$2
-	limit=$3
-	prefix_msg=$4
+validate_parameter "softlink count" $1
+validate_parameter "hardlink count" $2
 
-	lerrors=0
+soft_links=$1
+hard_links=$2
 
-	i=0
+do_link()
+{
+	local prefix="$1"
+	local ln_opts="$2"
+	local limit="$3"
+	local prefix_msg="$4"
 
-	cd "${pfix}link.$$"
+	local lerrors=0
+	local i=0
+	local rtype="TFAIL"
+
+	cd "${prefix}link.$$"
 	while [ $i -lt $limit ]; do
-		if ! ln ${ln_opts} "$PWD/${pfix}file" ${pfix}file${i}; then
-			: $(( lerrors += 1 ))
+		if ! ln ${ln_opts} "$PWD/${prefix}file" ${prefix}file${i}; then
+			lerrors=$((lerrors + 1))
 		fi
-		: $(( i+= 1 ))
+		i=$((i + 1))
 	done
 	cd ..
 
 	if [ $lerrors -eq 0 ]; then
-		RTYPE=TPASS
-	else
-		RTYPE=TFAIL
+		rtype=TPASS
 	fi
 
-	tst_resm $RTYPE "$prefix_msg Link Errors: $lerrors"
-
-	: $(( TST_COUNT += 1 ))
-
+	tst_res $rtype "$prefix_msg link errors: $lerrors"
 }
 
-do_link s "-s" ${1} "Symbolic"
-do_link h   "" ${2} "Hard"
+do_test()
+{
+	mkdir hlink.$$ slink.$$
+	touch hlink.$$/hfile slink.$$/sfile
 
-rm -Rf hlink.$$ slink.$$
+	do_link s "-s" $soft_links "symbolic"
+	do_link h   "" $hard_links "hard"
 
-tst_rmdir
-tst_exit
+	rm -rf hlink.$$ slink.$$
+}
+
+tst_run
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 1f0b315..47f8532 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Perform a small read on every file in a directory tree.
@@ -43,6 +31,7 @@
 #include <lapi/fnmatch.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <dirent.h>
 #include <errno.h>
 #include <unistd.h>
@@ -83,7 +72,6 @@
 static char *verbose;
 static char *quiet;
 static char *root_dir;
-static char *exclude;
 static char *str_reads;
 static int reads = 1;
 static char *str_worker_count;
@@ -93,6 +81,12 @@
 static struct worker *workers;
 static char *drop_privs;
 
+static char *blacklist[] = {
+	NULL, /* reserved for -e parameter */
+	"/sys/power/wakeup_count",
+	"/sys/kernel/debug/*",
+};
+
 static struct tst_option options[] = {
 	{"v", &verbose,
 	 "-v       Print information about successful reads."},
@@ -100,7 +94,7 @@
 	 "-q       Don't print file read or open errors."},
 	{"d:", &root_dir,
 	 "-d path  Path to the directory to read from, defaults to /sys."},
-	{"e:", &exclude,
+	{"e:", &blacklist[0],
 	 "-e pattern Ignore files which match an 'extended' pattern, see fnmatch(3)."},
 	{"r:", &str_reads,
 	 "-r count The number of times to schedule a file for reading."},
@@ -127,12 +121,12 @@
 
 		if (++j >= BUFFER_SIZE - 1)
 			tst_brk(TBROK, "Buffer is too small for path");
-		if (++i >= QUEUE_SIZE)
-			i = 0;
+
+		 i = (i + 1) % QUEUE_SIZE;
 	}
 
 	buf[j] = '\0';
-	tst_atomic_store(i + 1, &q->front);
+	tst_atomic_store((i + 1) % QUEUE_SIZE, &q->front);
 
 	return 1;
 }
@@ -145,8 +139,8 @@
 	do {
 		q->data[i] = buf[j];
 
-		if (++i >= QUEUE_SIZE)
-			i = 0;
+		i = (i + 1) % QUEUE_SIZE;
+
 		if (i == front)
 			return 0;
 
@@ -194,17 +188,29 @@
 		strcpy(buf + MAX_DISPLAY, "...");
 }
 
+static int is_blacklisted(const char *path)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(blacklist); i++) {
+		if (blacklist[i] && !fnmatch(blacklist[i], path, FNM_EXTMATCH)) {
+			if (verbose)
+				tst_res(TINFO, "Ignoring %s", path);
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
 static void read_test(const char *path)
 {
 	char buf[BUFFER_SIZE];
 	int fd;
 	ssize_t count;
 
-	if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
-		if (verbose)
-			tst_res(TINFO, "Ignoring %s", path);
+	if (is_blacklisted(path))
 		return;
-	}
 
 	if (verbose)
 		tst_res(TINFO, "%s(%s)", __func__, path);
@@ -282,7 +288,7 @@
 	int i;
 	struct worker *wa = workers;
 
-	bzero(workers, worker_count * sizeof(*workers));
+	memset(workers, 0, worker_count * sizeof(*workers));
 
 	for (i = 0; i < worker_count; i++) {
 		wa[i].q = queue_init();
@@ -294,6 +300,35 @@
 	}
 }
 
+static void work_push_retry(int worker, const char *buf)
+{
+	int i, ret, worker_min, worker_max, usleep_time = 100;
+
+	if (worker < 0) {
+		/* pick any, try -worker first */
+		worker_min = worker * (-1);
+		worker_max = worker_count;
+	} else {
+		/* keep trying worker */
+		worker_min = worker;
+		worker_max = worker + 1;
+	}
+	i = worker_min;
+
+	for (;;) {
+		ret = queue_push(workers[i].q, buf);
+		if (ret == 1)
+			break;
+
+		if (++i >= worker_max) {
+			i = worker_min;
+			if (usleep_time < 100000)
+				usleep_time *= 2;
+			usleep(usleep_time);
+		}
+	}
+}
+
 static void stop_workers(void)
 {
 	const char stop_code[1] = { '\0' };
@@ -304,7 +339,7 @@
 
 	for (i = 0; i < worker_count; i++) {
 		if (workers[i].q)
-			TST_RETRY_FUNC(queue_push(workers[i].q, stop_code), 1);
+			work_push_retry(i, stop_code);
 	}
 
 	for (i = 0; i < worker_count; i++) {
@@ -322,7 +357,7 @@
 	for (i = j = 0; i < rep; i++, j++) {
 		if (j >= worker_count)
 			j = 0;
-		TST_RETRY_FUNC(queue_push(workers[j].q, path), 1);
+		work_push_retry(-j, path);
 	}
 }
 
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
index 9bafcd1..1ba937c 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug01.sh
@@ -109,7 +109,7 @@
 
 LOOP_COUNT=1
 
-tst_test_cmds perl
+tst_require_cmds perl
 
 if [ $(get_present_cpus_num) -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
index 2828da5..95a8f4a 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug05.sh
@@ -59,7 +59,7 @@
 
 LOOP_COUNT=1
 
-tst_test_cmds sar
+tst_require_cmds sar
 
 if [ $(get_present_cpus_num) -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
diff --git a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
index 18a1119..2a62225 100755
--- a/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
+++ b/testcases/kernel/hotplug/cpu_hotplug/functional/cpuhotplug06.sh
@@ -49,6 +49,10 @@
 
 LOOP_COUNT=1
 
+if top -v | grep -q htop; then
+	tst_brkm TCONF "htop is used instead of top (workaround: alias top='/path/to/real/top')"
+fi
+
 if [ $(get_present_cpus_num) -lt 2 ]; then
 	tst_brkm TCONF "system doesn't have required CPU hotplug support"
 fi
diff --git a/testcases/kernel/hotplug/memory_hotplug/memtoy.c b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
index 0707a9c..8ac9600 100644
--- a/testcases/kernel/hotplug/memory_hotplug/memtoy.c
+++ b/testcases/kernel/hotplug/memory_hotplug/memtoy.c
@@ -367,7 +367,7 @@
 void init_glctx(glctx_t * gcp)
 {
 
-	bzero(gcp, sizeof(glctx_t));
+	memset(gcp, 0, sizeof(glctx_t));
 
 	gcp->pagesize = (size_t) sysconf(_SC_PAGESIZE);
 
diff --git a/testcases/kernel/include/ksm_helper.h b/testcases/kernel/include/ksm_helper.h
index 0b35218..d4a6d5c 100644
--- a/testcases/kernel/include/ksm_helper.h
+++ b/testcases/kernel/include/ksm_helper.h
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
  * Author(s): Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef KSM_HELPER_H
diff --git a/testcases/kernel/io/direct_io/diotest4.c b/testcases/kernel/io/direct_io/diotest4.c
index e4616e4..bf200cd 100644
--- a/testcases/kernel/io/direct_io/diotest4.c
+++ b/testcases/kernel/io/direct_io/diotest4.c
@@ -352,18 +352,14 @@
 	total++;
 
 	/* Test-10: read, write to a mmaped file */
-	shm_base = (char *)(((long)sbrk(0) + (shmsz - 1)) & ~(shmsz - 1));
-	if (shm_base == NULL) {
-		tst_brkm(TBROK, cleanup, "sbrk failed: %s", strerror(errno));
-	}
 	offset = 4096;
 	count = bufsize;
 	if ((fd = open(filename, O_DIRECT | O_RDWR)) < 0) {
 		tst_brkm(TBROK, cleanup, "can't open %s: %s",
 			 filename, strerror(errno));
 	}
-	shm_base = mmap(shm_base, 0x100000, PROT_READ | PROT_WRITE,
-			MAP_SHARED | MAP_FIXED, fd, 0);
+	shm_base = mmap(0, 0x100000, PROT_READ | PROT_WRITE,
+			MAP_SHARED, fd, 0);
 	if (shm_base == (caddr_t) - 1) {
 		tst_brkm(TBROK, cleanup, "can't mmap file: %s",
 			 strerror(errno));
diff --git a/testcases/kernel/io/disktest/CHANGELOG b/testcases/kernel/io/disktest/CHANGELOG
index ca72897..827f1c9 100644
--- a/testcases/kernel/io/disktest/CHANGELOG
+++ b/testcases/kernel/io/disktest/CHANGELOG
@@ -128,7 +128,7 @@
     cycle function and writes and read to random LBAs for each seek, use -pR.
 
     Added a delay time option, -t <delay>.  This will allow a user to specify,
-    in miliseconds, the amount of time for each thread to delay before
+    in milliseconds, the amount of time for each thread to delay before
     performing each IO operation.  The default is to not delay.
 
     Added a LBA alignement offset option, -o <offset>.  This option allows a
diff --git a/testcases/kernel/io/disktest/man1/disktest.1 b/testcases/kernel/io/disktest/man1/disktest.1
index cac3abb..e1c174a 100644
--- a/testcases/kernel/io/disktest/man1/disktest.1
+++ b/testcases/kernel/io/disktest/man1/disktest.1
@@ -477,7 +477,7 @@
 
 disktest -K8 -t500:15000:120s ./testfile
 
-This will start eight read threads, with a minimum read delay of 500 miliseconds, and a maximum of 15 seconds.
+This will start eight read threads, with a minimum read delay of 500 milliseconds, and a maximum of 15 seconds.
 
 disktest -w -Is200 -R3:60000 -Ac -PRTX -B128k -T10 -pr ./afile
 
diff --git a/testcases/kernel/io/disktest/man1/disktest_manual.html b/testcases/kernel/io/disktest/man1/disktest_manual.html
index edb850d..ecb9618 100644
--- a/testcases/kernel/io/disktest/man1/disktest_manual.html
+++ b/testcases/kernel/io/disktest/man1/disktest_manual.html
@@ -624,7 +624,7 @@
 <P>
 disktest -K8 -t500:15000:120s ./testfile
 <P>
-This will start eight read threads, with a minimum read delay of 500 miliseconds, and a maximum of 15 seconds.
+This will start eight read threads, with a minimum read delay of 500 milliseconds, and a maximum of 15 seconds.
 <P>
 disktest -w -Is200 -R3:60000 -Ac -PRTX -B128k -T10 -pr ./afile
 <P>
diff --git a/testcases/kernel/io/stress_floppy/stress_floppy b/testcases/kernel/io/stress_floppy/stress_floppy
index deb9390..7510f08 100755
--- a/testcases/kernel/io/stress_floppy/stress_floppy
+++ b/testcases/kernel/io/stress_floppy/stress_floppy
@@ -40,7 +40,7 @@
 {
 	tst_tmpdir
 
-	tst_test_cmds fdformat tar dump cpio dd mkfs mkdosfs
+	tst_require_cmds fdformat tar dump cpio dd mkfs mkdosfs
 
 	TCtmp=$(pwd)
 }
diff --git a/testcases/kernel/lib/ksm_helper.c b/testcases/kernel/lib/ksm_helper.c
index eba28d4..586a0d1 100644
--- a/testcases/kernel/lib/ksm_helper.c
+++ b/testcases/kernel/lib/ksm_helper.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
  * Author(s): Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/logging/kmsg/kmsg01.c b/testcases/kernel/logging/kmsg/kmsg01.c
index 1c0095b..57eee94 100644
--- a/testcases/kernel/logging/kmsg/kmsg01.c
+++ b/testcases/kernel/logging/kmsg/kmsg01.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2013 Linux Test Project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it
- * is free of the rightful claim of any third person regarding
- * infringement or the like.  Any license provided herein, whether
- * implied or otherwise, applies only to this software file.  Patent
- * licenses, if any, provided herein do not apply to combinations of
- * this program with other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  */
 /*
  * Test /dev/kmsg based on kernel doc: Documentation/ABI/testing/dev-kmsg
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
index 445b05f..d80a636 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2010-2017  Red Hat, Inc.
  *
- * 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.
- * overcommit hugetlbfs and check the statistics.
- *
- * Description:
- *
  * hugetlbfs allows to overcommit hugepages and there are tunables in
  * sysfs and procfs. The test here want to ensure it is possible to
  * overcommit by either mmap or shared memory. Also ensure those
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
index a230bb7..d661834 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
@@ -22,10 +22,10 @@
  *   the region structure, so it can be modified by two processes concurrently.
  *
  *   This bug was fixed on stable kernel by commits:
- *       f522c3ac00(mm, hugetlb: change variable name reservations to resv)
- *       9119a41e90(mm, hugetlb: unify region structure handling)
- *       7b24d8616b(mm, hugetlb: fix race in region tracking)
- *       1406ec9ba6(mm, hugetlb: improve, cleanup resv_map parameters)
+ *       f522c3ac00a4(mm, hugetlb: change variable name reservations to resv)
+ *       9119a41e9091(mm, hugetlb: unify region structure handling)
+ *       7b24d8616be3(mm, hugetlb: fix race in region tracking)
+ *       1406ec9ba6c6(mm, hugetlb: improve, cleanup resv_map parameters)
  *
  * AUTHOR:
  *    Herton R. Krzesinski <herton@redhat.com>
@@ -147,4 +147,11 @@
 	.test = do_mmap,
 	.setup = setup,
 	.cleanup = cleanup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "f522c3ac00a4"},
+		{"linux-git", "9119a41e9091"},
+		{"linux-git", "7b24d8616be3"},
+		{"linux-git", "1406ec9ba6c6"},
+		{}
+	}
 };
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
index d375810..c76e416 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -38,7 +38,7 @@
 static long huge_free;
 static long huge_free2;
 static long hugepages;
-static long orig_shmmax, new_shmmax;
+static long orig_shmmax = -1, new_shmmax;
 
 static void shared_hugepage(void);
 
@@ -106,7 +106,8 @@
 static void cleanup(void)
 {
 	restore_nr_hugepages();
-	SAFE_FILE_PRINTF(PATH_SHMMAX, "%ld", orig_shmmax);
+	if (orig_shmmax != -1)
+		SAFE_FILE_PRINTF(PATH_SHMMAX, "%ld", orig_shmmax);
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
index a587391..587110a 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
@@ -24,11 +24,11 @@
  *	This bug is present in all RHEL6 versions, but not in RHEL7. It looks
  *	like this was fixed in mainline kernel > v3.3 by the following patches:
  *
- *	091d0d5 (shm: fix null pointer deref when userspace specifies
+ *	091d0d55b286 (shm: fix null pointer deref when userspace specifies
  *		 invalid hugepage size)
- *	af73e4d (hugetlbfs: fix mmap failure in unaligned size request)
- *	42d7395 (mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB)
- *	40716e2 (hugetlbfs: fix alignment of huge page requests)
+ *	af73e4d9506d (hugetlbfs: fix mmap failure in unaligned size request)
+ *	42d7395feb56 (mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB)
+ *	40716e29243d (hugetlbfs: fix alignment of huge page requests)
  *
  * AUTHORS
  *	Vladislav Dronov <vdronov@redhat.com>
@@ -109,4 +109,11 @@
 	.test_all = test_hugeshmat,
 	.setup = setup,
 	.cleanup = cleanup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "091d0d55b286"},
+		{"linux-git", "af73e4d9506d"},
+		{"linux-git", "42d7395feb56"},
+		{"linux-git", "40716e29243d"},
+		{}
+	}
 };
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
index 9353564..f7ac881 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl01.c
@@ -333,7 +333,6 @@
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
-	.needs_tmpdir = 1,
 	.options = options,
 	.setup = setup,
 	.cleanup = cleanup,
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
index d525522..f2ecc46 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
@@ -39,7 +39,7 @@
 static int shm_id_arr[MAXIDS];
 
 static long hugepages = 128;
-static long orig_shmmni;
+static long orig_shmmni = -1;
 static struct tst_option options[] = {
 	{"s:", &nr_opt, "-s   num  Set the number of the been allocated hugepages"},
 	{NULL, NULL, NULL}
@@ -105,7 +105,8 @@
 	for (i = 0; i < num_shms; i++)
 		rm_shm(shm_id_arr[i]);
 
-	FILE_PRINTF(PATH_SHMMNI, "%ld", orig_shmmni);
+	if (orig_shmmni != -1)
+		FILE_PRINTF(PATH_SHMMNI, "%ld", orig_shmmni);
 	restore_nr_hugepages();
 }
 
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index baf643d..66ad324 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
- *   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
+ *   Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/mem/ksm/ksm05.c b/testcases/kernel/mem/ksm/ksm05.c
index f715dc5..ca08f50 100644
--- a/testcases/kernel/mem/ksm/ksm05.c
+++ b/testcases/kernel/mem/ksm/ksm05.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011-2017  Red Hat, Inc.
  *
- * 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.
- *
  * KSM - NULL pointer dereference in ksm_do_scan() (CVE-2011-2183)
  *
  * This is a testcase from upstream commit:
diff --git a/testcases/kernel/mem/ksm/ksm_common.h b/testcases/kernel/mem/ksm/ksm_common.h
index a6e0747..4cb569b 100644
--- a/testcases/kernel/mem/ksm/ksm_common.h
+++ b/testcases/kernel/mem/ksm/ksm_common.h
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017  Red Hat, Inc.
- *
- * 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.
  */
 
  /*
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index a0c1b9b..4562597 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -482,8 +482,11 @@
 	stop_ksm_children(child, num);
 
 	tst_res(TINFO, "KSM merging...");
-	if (access(PATH_KSM "max_page_sharing", F_OK) == 0)
+	if (access(PATH_KSM "max_page_sharing", F_OK) == 0) {
+		SAFE_FILE_PRINTF(PATH_KSM "run", "2");
 		SAFE_FILE_PRINTF(PATH_KSM "max_page_sharing", "%ld", size * pages * num);
+	}
+
 	SAFE_FILE_PRINTF(PATH_KSM "run", "1");
 	SAFE_FILE_PRINTF(PATH_KSM "pages_to_scan", "%ld", size * pages * num);
 	SAFE_FILE_PRINTF(PATH_KSM "sleep_millisecs", "0");
@@ -571,16 +574,16 @@
 	SAFE_FILE_PRINTF(PATH_KSM "sleep_millisecs", "0");
 	SAFE_FILE_PRINTF(PATH_KSM "pages_to_scan", "%ld",
 			 nr_pages * num_nodes);
-	if (access(PATH_KSM "max_page_sharing", F_OK) == 0)
-		SAFE_FILE_PRINTF(PATH_KSM "max_page_sharing",
-			"%ld", nr_pages * num_nodes);
 	/*
-	 * merge_across_nodes setting can be changed only when there
-	 * are no ksm shared pages in system, so set run 2 to unmerge
-	 * pages first, then to 1 after changing merge_across_nodes,
+	 * merge_across_nodes and max_page_sharing setting can be changed
+	 * only when there are no ksm shared pages in system, so set run 2
+	 * to unmerge pages first, then to 1 after changing merge_across_nodes,
 	 * to remerge according to the new setting.
 	 */
 	SAFE_FILE_PRINTF(PATH_KSM "run", "2");
+	if (access(PATH_KSM "max_page_sharing", F_OK) == 0)
+		SAFE_FILE_PRINTF(PATH_KSM "max_page_sharing",
+			"%ld", nr_pages * num_nodes);
 	tst_res(TINFO, "Start to test KSM with merge_across_nodes=1");
 	SAFE_FILE_PRINTF(PATH_KSM "merge_across_nodes", "1");
 	SAFE_FILE_PRINTF(PATH_KSM "run", "1");
diff --git a/testcases/kernel/mem/mmapstress/mmapstress04.c b/testcases/kernel/mem/mmapstress/mmapstress04.c
index 3925f48..ceede7e 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress04.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress04.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Red Hat, Inc.
  * 01/02/2003	Port to LTP avenkat@us.ibm.com
  * 06/30/2001	Port to Linux	nsharoff@us.ibm.com
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Mmap parts of a file, and then write to the file causing single
diff --git a/testcases/kernel/mem/mtest01/mtest01.c b/testcases/kernel/mem/mtest01/mtest01.c
index eaf1026..446d268 100644
--- a/testcases/kernel/mem/mtest01/mtest01.c
+++ b/testcases/kernel/mem/mtest01/mtest01.c
@@ -33,7 +33,7 @@
 
 #define FIVE_HUNDRED_MB         (500ULL*1024*1024)
 
-#if defined(_s390_)
+#if defined(__s390__) || defined(__s390x__)
 #define ALLOC_THRESHOLD		FIVE_HUNDRED_MB
 #elif defined(TST_ABI32)
 #define ALLOC_THRESHOLD		(2*FIVE_HUNDRED_MB)
@@ -58,7 +58,7 @@
 static struct tst_option mtest_options[] = {
 	{"c:", &opt_chunksize,	"-c  size of chunk in bytes to malloc on each pass"},
 	{"b:", &opt_maxbytes,	"-b  maximum number of bytes to allocate before stopping"},
-	{"p:", &opt_maxpercent, "-u  percent of total memory used at which the program stops"},
+	{"p:", &opt_maxpercent, "-p  percent of total memory used at which the program stops"},
 	{"w",  &dowrite,   	"-w  write to the memory after allocating"},
 	{"v",  &verbose,     	"-v  verbose"},
 	{NULL, NULL, 		NULL}
@@ -216,11 +216,16 @@
 	if (children_done < pid_cntr) {
 		tst_res(TFAIL, "kbytes allocated %sless than expected %llu",
 				write_msg, alloc_maxbytes / 1024);
-	} else {
-		tst_res(TPASS, "%llu kbytes allocated %s",
-				alloc_maxbytes / 1024, write_msg);
+
+		for (i = 0; i < pid_cntr; i++)
+			kill(pid_list[i], SIGKILL);
+
+		return;
 	}
 
+	tst_res(TPASS, "%llu kbytes allocated %s",
+			alloc_maxbytes / 1024, write_msg);
+
 	for (i = 0; i < pid_cntr; i++) {
 		TST_PROCESS_STATE_WAIT(pid_list[i], 'T');
 		kill(pid_list[i], SIGCONT);
diff --git a/testcases/kernel/mem/mtest06/mmap1.c b/testcases/kernel/mem/mtest06/mmap1.c
index b7b7426..c541744 100644
--- a/testcases/kernel/mem/mtest06/mmap1.c
+++ b/testcases/kernel/mem/mtest06/mmap1.c
@@ -12,8 +12,14 @@
  * between mmap/munmap worked, then its value must match expected
  * value.
  *
- * Can trigger panics/stalls since at least 4.14 on some arches. See:
+ * Can trigger panics/stalls since at least 4.14 on some arches:
  *   fc8efd2ddfed ("mm/memory.c: do_fault: avoid usage of stale vm_area_struct")
+ * Can trigger user-space stalls on aarch64:
+ *   7a30df49f63a ("mm: mmu_gather: remove __tlb_reset_range() for force flush")
+ *   https://lore.kernel.org/linux-mm/1817839533.20996552.1557065445233.JavaMail.zimbra@redhat.com
+ * Can trigger "still mapped when deleted" BUG at mm/filemap.c:171, on aarch64 since 4.20
+ *   e1b98fa31664 ("locking/rwsem: Add missing ACQUIRE to read_slowpath exit when queue is empty")
+ *   99143f82a255 ("lcoking/rwsem: Add missing ACQUIRE to read_slowpath sleep loop")
  */
 #include <errno.h>
 #include <float.h>
@@ -22,10 +28,15 @@
 #include <setjmp.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "lapi/abisize.h"
 #include "tst_test.h"
 #include "tst_safe_pthread.h"
 
-#define DISTANT_MMAP_SIZE (64*1024*1024)
+#ifdef TST_ABI32
+#  define DISTANT_MMAP_SIZE (256*1024*1024)
+#else
+#  define DISTANT_MMAP_SIZE (2L*1024*1024*1024)
+#endif
 #define TEST_FILENAME "ashfile"
 
 /* seconds remaining before reaching timeout */
@@ -211,9 +222,9 @@
 static void run(void)
 {
 	pthread_t thid[2];
-	int remaining = tst_timeout_remaining();
-	int elapsed = 0;
+	int start, last_update;
 
+	start = last_update = tst_timeout_remaining();
 	while (tst_timeout_remaining() > STOP_THRESHOLD) {
 		int fd = mkfile(file_size);
 
@@ -229,14 +240,15 @@
 
 		close(fd);
 
-		if (remaining - tst_timeout_remaining() > PROGRESS_SEC) {
-			remaining = tst_timeout_remaining();
-			elapsed += PROGRESS_SEC;
-			tst_res(TINFO, "[%d] mapped: %lu, sigsegv hit: %lu, "
-				"threads spawned: %lu",	elapsed, map_count,
-				mapped_sigsegv_count, threads_spawned);
-			tst_res(TINFO, "[%d] repeated_reads: %ld, "
-				"data_matched: %lu", elapsed, repeated_reads,
+		if (last_update - tst_timeout_remaining() >= PROGRESS_SEC) {
+			last_update = tst_timeout_remaining();
+			tst_res(TINFO, "[%03d] mapped: %lu, sigsegv hit: %lu, "
+				"threads spawned: %lu",
+				start - tst_timeout_remaining(),
+				map_count, mapped_sigsegv_count,
+				threads_spawned);
+			tst_res(TINFO, "      repeated_reads: %ld, "
+				"data_matched: %lu", repeated_reads,
 				data_matched);
 		}
 	}
diff --git a/testcases/kernel/mem/mtest06/mmap3.c b/testcases/kernel/mem/mtest06/mmap3.c
index d314ff8..c83dd6f 100644
--- a/testcases/kernel/mem/mtest06/mmap3.c
+++ b/testcases/kernel/mem/mtest06/mmap3.c
@@ -1,26 +1,9 @@
-/******************************************************************************
- *									      *
- * Copyright (c) International Business Machines  Corp., 2001		      *
- *  2001 Created by Manoj Iyer, IBM Austin TX <manjo@austin.ibm.com>          *
- * Copyright (C) 2016 Cyril Hrubis <chrubis@suse.cz>                          *
- *									      *
- * 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           *
- *									      *
- ******************************************************************************/
-
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (C) 2016 Cyril Hrubis <chrubis@suse.cz>
+ * Author: Manoj Iyer, IBM Austin TX <manjo@austin.ibm.com>, 2001
+ *
  * Tests the LINUX memory manager. The program is aimed at stressing the memory
  * manager by repeaded map/write/unmap of file/memory of random size (maximum
  * 1GB) this is done by multiple threads.
diff --git a/testcases/kernel/mem/mtest07/mallocstress.c b/testcases/kernel/mem/mtest07/mallocstress.c
index 70b614b..83a216d 100644
--- a/testcases/kernel/mem/mtest07/mallocstress.c
+++ b/testcases/kernel/mem/mtest07/mallocstress.c
@@ -1,66 +1,12 @@
-/******************************************************************************/
-/*									      */
-/* 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    */
-/*									      */
-/******************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) International Business Machines Corp., 2001
+ * Author: Manoj Iyer, IBM Austin TX <manjo@austin.ibm.com>, 2001
+ *
+ * Stress the VMM and C library by spawning N threads which malloc
+ * blocks of increasing size until malloc returns NULL.
+ */
 
-/******************************************************************************/
-/*                                                                            */
-/* History:     Nov - 04 - 2001 Created - Manoj Iyer, IBM Austin TX.          */
-/*                               email:manjo@austin.ibm.com                   */
-/*                                                                            */
-/*		Nov - 06 - 2001 Modified - Manoj Iyer, IBM Austin TX.         */
-/*				- added function alloc_mem()                  */
-/*    								              */
-/*		Nov - 08 - 2001 Modified - Manoj Iyer, IBM Austin TX.         */
-/*				- added logic to allocate memory in the size  */
-/*				  of fibanocci numbers.                       */
-/*				- fixed segmetation fault.                    */
-/*									      */
-/*		Nov - 09 - 2001 Modified - Manoj Iyer, IBM Austin TX.         */
-/*				- separated alocation logic to allocate_free()*/
-/*				  function.                                   */
-/*				- introduced logic to randomly pick allocation*/
-/*				  scheme. size = fibannoci number, pow of 2 or*/
-/*				  power of 3.                                 */
-/*				- changed comments.                           */
-/*				- Added test to LTP.                          */
-/*                                                                            */
-/*		Nov - 09 - 2001 Modified - Manoj Iyer,IBM Austin TX.	      */
-/*				- Removed compile errors.                     */
-/*				- too many missing arguments.                 */
-/*								              */
-/*		Nov - 19 - 2001 Modified - Manoj Iyer, IBM Austin TX.	      */
-/*				- fixed segmentation fault. 		      */
-/*				  changed variable th_status from dynamic to  */
-/*				  static array.			              */
-/*                                                                            */
-/*		May - 15 - 2002 Dan Kegel (dank@kegel.com)                    */
-/*		                - Fixed crash on > 30 threads                 */
-/*		                - Cleaned up, fixed compiler warnings         */
-/*		                - Removed mallocs that could fail             */
-/*		                - Note that pthread_create fails with EINTR   */
-/*                                                                            */
-/* File:	mallocstress.c						      */
-/*									      */
-/* Description:	This program stresses the VMM and C library                   */
-/*              by spawning N threads which                                   */
-/*              malloc blocks of increasing size until malloc returns NULL.   */
-/******************************************************************************/
 #include <stdio.h>
 #include <pthread.h>
 #include <stdlib.h>
diff --git a/testcases/kernel/mem/mtest07/shm_test.c b/testcases/kernel/mem/mtest07/shm_test.c
index de91b74..6d4d016 100644
--- a/testcases/kernel/mem/mtest07/shm_test.c
+++ b/testcases/kernel/mem/mtest07/shm_test.c
@@ -81,8 +81,16 @@
 
 #define MAXT	30		/* default number of threads to create.               */
 #define MAXR	1000		/* default number of repatetions to execute           */
-#define WRITER  0		/* cause thread function to shmat and write           */
-#define READER  1		/* cause thread function to shmat and read            */
+
+struct child_args
+{
+	pthread_t threadid;
+	int num_reps;
+	int shmkey;
+	int map_size;
+	int is_reader;
+};
+
 
 /******************************************************************************/
 /*								 	      */
@@ -166,28 +174,25 @@
 /* Return:	exits with -1 on error, 0 on success                          */
 /*									      */
 /******************************************************************************/
-static void *shmat_rd_wr(void *args)
+static void *shmat_rd_wr(void *vargs)
 {				/* arguments to the thread function             */
 	int shmndx = 0;		/* index to the number of attach and detach   */
 	int index = 0;		/* index to the number of blocks touched      */
-	int reader = 0;		/* this thread is a reader thread if set to 1 */
 	key_t shm_id = 0;	/* shared memory id                           */
-	long *locargs =		/* local pointer to arguments                 */
-	    (long *)args;
+	struct child_args *args = vargs;
 	volatile int exit_val = 0;	/* exit value of the pthread                  */
 	char *read_from_mem;	/* ptr to touch each (4096) block in memory   */
 	char *write_to_mem;	/* ptr to touch each (4096) block in memory   */
 	char *shmat_addr;	/* address of the attached memory             */
 	char buff;		/* temporary buffer                           */
 
-	reader = (int)locargs[3];
-	while (shmndx++ < (int)locargs[0]) {
+	while (shmndx++ < args->num_reps) {
 		dprt("pid[%d]: shmat_rd_wr(): locargs[1] = %#x\n",
-		     getpid(), (int)locargs[1]);
+		     getpid(), args->shmkey);
 
 		/* get shared memory id */
 		if ((shm_id =
-		     shmget((int)locargs[1], (int)locargs[2], IPC_CREAT | 0666))
+		     shmget(args->shmkey, args->map_size, IPC_CREAT | 0666))
 		    == -1) {
 			dprt("pid[%d]: shmat_rd_wr(): shmget failed\n",
 			     getpid());
@@ -213,11 +218,11 @@
 			"pid[%d]: do_shmat_shmadt(): got shmat address = %#lx\n",
 			getpid(), (long)shmat_addr);
 
-		if (!reader) {
+		if (args->is_reader) {
 			/* write character 'Y' to that memory area */
 			index = 0;
 			write_to_mem = shmat_addr;
-			while (index < (int)locargs[2]) {
+			while (index < args->map_size) {
 				dprt("pid[%d]: do_shmat_shmatd(): write_to_mem = %#x\n", getpid(), write_to_mem);
 				*write_to_mem = 'Y';
 				index++;
@@ -228,7 +233,7 @@
 			/* read from the memory area */
 			index = 0;
 			read_from_mem = shmat_addr;
-			while (index < (int)locargs[2]) {
+			while (index < args->map_size) {
 				buff = *read_from_mem;
 				index++;
 				read_from_mem++;
@@ -272,12 +277,11 @@
 	int c;			/* command line options                       */
 	int num_thrd = MAXT;	/* number of threads to create                */
 	int num_reps = MAXR;	/* number of repatitions the test is run      */
-	int thrd_ndx;		/* index into the array of thread ids         */
+	int i;
 	void *th_status;	/* exit status of LWP's                       */
 	int map_size;		/* size of the file mapped.                   */
 	int shmkey = 1969;	/* key used to generate shmid by shmget()     */
-	pthread_t thrdid[30];	/* maxinum of 30 threads allowed              */
-	long chld_args[4];	/* arguments to the thread function           */
+	struct child_args chld_args[30];	/* arguments to the thread function */
 	char *map_address = NULL;
 	/* address in memory of the mapped file       */
 	extern int optopt;	/* options to the program                     */
@@ -299,7 +303,7 @@
 		case 't':
 			if ((num_thrd = atoi(optarg)) == 0)
 				OPT_MISSING(argv[0], optopt);
-			else if (num_thrd < 0) {
+			else if (num_thrd < 0 || num_thrd > MAXT) {
 				fprintf(stdout,
 					"WARNING: bad argument. Using default\n");
 				num_thrd = MAXT;
@@ -311,31 +315,27 @@
 		}
 	}
 
-	chld_args[0] = num_reps;
-
-	for (thrd_ndx = 0; thrd_ndx < num_thrd; thrd_ndx += 2) {
+	for (i = 0; i < num_thrd; i += 2) {
 		srand(time(NULL) % 100);
-		map_size =
-		    (1 + (int)(1000.0 * rand() / (RAND_MAX + 1.0))) * 4096;
-
-		chld_args[1] = shmkey++;
-		chld_args[2] = map_size;
+		map_size = (1 + (int)(1000.0 * rand() / (RAND_MAX + 1.0))) * 4096;
 
 		dprt("main(): thrd_ndx = %d map_address = %#x map_size = %d\n",
-		     thrd_ndx, map_address, map_size);
+		     i, map_address, map_size);
 
-		chld_args[3] = WRITER;
-
+		chld_args[i].num_reps = num_reps;
+		chld_args[i].map_size = map_size;
+		chld_args[i].shmkey = shmkey++;
+		chld_args[i].is_reader = 0;
 		if (pthread_create
-		    (&thrdid[thrd_ndx], NULL, shmat_rd_wr, chld_args)) {
+		    (&chld_args[i].threadid, NULL, shmat_rd_wr, &chld_args[i])) {
 			perror("shmat_rd_wr(): pthread_create()");
 			exit(-1);
 		}
 
-		chld_args[3] = READER;
-
+		chld_args[i + 1] = chld_args[i];
+		chld_args[i + 1].is_reader = 1;
 		if (pthread_create
-		    (&thrdid[thrd_ndx + 1], NULL, shmat_rd_wr, chld_args)) {
+		    (&chld_args[i + 1].threadid, NULL, shmat_rd_wr, &chld_args[i + 1])) {
 			perror("shmat_rd_wr(): pthread_create()");
 			exit(-1);
 		}
@@ -343,8 +343,8 @@
 
 	sync();
 
-	for (thrd_ndx = 0; thrd_ndx < num_thrd; thrd_ndx++) {
-		if (pthread_join(thrdid[thrd_ndx], &th_status) != 0) {
+	for (i = 0; i < num_thrd; i++) {
+		if (pthread_join(chld_args[i].threadid, &th_status) != 0) {
 			perror("shmat_rd_wr(): pthread_join()");
 			exit(-1);
 		} else {
@@ -352,7 +352,7 @@
 			if (th_status == (void *)-1) {
 				fprintf(stderr,
 					"thread [%ld] - process exited with errors\n",
-					(long)thrdid[thrd_ndx]);
+					(long)chld_args[i].threadid);
 				exit(-1);
 			}
 		}
diff --git a/testcases/kernel/mem/thp/thp01.c b/testcases/kernel/mem/thp/thp01.c
index b2ad921..db72560 100644
--- a/testcases/kernel/mem/thp/thp01.c
+++ b/testcases/kernel/mem/thp/thp01.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011-2017  Red Hat, Inc.
- *
- * 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.
  */
 
 /* Description:
diff --git a/testcases/kernel/mem/thp/thp02.c b/testcases/kernel/mem/thp/thp02.c
index 6502210..c0c8b9c 100644
--- a/testcases/kernel/mem/thp/thp02.c
+++ b/testcases/kernel/mem/thp/thp02.c
@@ -47,46 +47,62 @@
 #ifdef HAVE_MREMAP_FIXED
 static int ps;
 static long hps, size;
-static void *p, *p2, *p3, *p4;
+
+/*
+ * Will try to do the following 4 mremaps cases:
+ *   mremap(p, size-ps, size-ps, flag, p2);
+ *   mremap(p, size-ps, size-ps, flag, p2+ps);
+ *   mremap(p+ps, size-ps, size-ps, flag, p2);
+ *   mremap(p+ps, size-ps, size-ps, flag, p2+ps);
+ */
+static void do_child(int i)
+{
+	long j, remap_size;
+	unsigned char *p1, *p2, *ret, *old_addr, *new_addr;
+
+	p1 = SAFE_MEMALIGN(hps, size);
+	p2 = SAFE_MEMALIGN(hps, size);
+
+	memset(p1, 0xff, size);
+	memset(p2, 0x77, size);
+
+	old_addr = p1 + ps * (i >> 1);
+	new_addr = p2 + ps * (i & 1);
+	remap_size = size - ps;
+
+	tst_res(TINFO, "mremap (%p-%p) to (%p-%p)",
+		old_addr, old_addr + remap_size,
+		new_addr, new_addr + remap_size);
+
+	ret = mremap(old_addr, remap_size, remap_size,
+		    MREMAP_FIXED | MREMAP_MAYMOVE, new_addr);
+	if (ret == MAP_FAILED)
+		tst_brk(TBROK | TERRNO, "mremap");
+
+	for (j = 0; j < remap_size; j++) {
+		if (ret[j] != 0xff)
+			tst_brk(TBROK, "mremap bug");
+	}
+
+	exit(0);
+}
 
 static void do_mremap(void)
 {
 	int i;
-	void *old_addr, *new_addr;
 
 	for (i = 0; i < 4; i++) {
-		p = SAFE_MEMALIGN(hps, size);
-		p2 = SAFE_MEMALIGN(hps, size);
-		p3 = SAFE_MEMALIGN(hps, size);
-
-		memset(p, 0xff, size);
-		memset(p2, 0xff, size);
-		memset(p3, 0x77, size);
-
-		/*
-		 * Will try to do the following 4 mremaps cases:
-		 *   mremap(p, size-ps, size-ps, flag, p3);
-		 *   mremap(p, size-ps, size-ps, flag, p3+ps);
-		 *   mremap(p+ps, size-ps, size-ps, flag, p3);
-		 *   mremap(p+ps, size-ps, size-ps, flag, p3+ps);
-		 */
-		old_addr = p + ps * (i >> 1);
-		new_addr = p3 + ps * (i & 1);
-		tst_res(TINFO, "mremap %p to %p", old_addr, new_addr);
-
-		p4 = mremap(old_addr, size - ps, size - ps,
-			    MREMAP_FIXED | MREMAP_MAYMOVE, new_addr);
-		if (p4 == MAP_FAILED)
-			tst_brk(TBROK | TERRNO, "mremap");
-		if (memcmp(p4, p2, size - ps))
-			tst_brk(TBROK, "mremap bug");
+		if (SAFE_FORK() == 0)
+			do_child(i);
+		tst_reap_children();
 	}
-
 	tst_res(TPASS, "Still alive.");
 }
 
 static void setup(void)
 {
+	long memfree;
+
 	if (access(PATH_THP, F_OK) == -1)
 		tst_brk(TCONF, "THP not enabled in kernel?");
 
@@ -95,12 +111,17 @@
 	ps = sysconf(_SC_PAGESIZE);
 	hps = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
 	size = hps * 4;
+
+	memfree = (SAFE_READ_MEMINFO("MemFree:") * 1024 +
+		SAFE_READ_MEMINFO("Cached:") * 1024);
+	if (memfree < size * 2)
+		tst_brk(TCONF, "not enough memory");
 }
 
 static struct tst_test test = {
-	.needs_root = 1,
 	.setup = setup,
 	.test_all = do_mremap,
+	.forks_child = 1,
 };
 
 #else
diff --git a/testcases/kernel/mem/tunable/overcommit_memory.c b/testcases/kernel/mem/tunable/overcommit_memory.c
index 555298f..345764d 100644
--- a/testcases/kernel/mem/tunable/overcommit_memory.c
+++ b/testcases/kernel/mem/tunable/overcommit_memory.c
@@ -36,11 +36,10 @@
  *
  * The program is designed to test the two tunables:
  *
- * When overcommit_memory = 0, allocatable memory can't overextends
- * the amount of free memory. I choose the three cases:
+ * When overcommit_memory = 0, allocatable memory can't overextend
+ * the amount of total memory:
  * a. less than free_total:    free_total / 2, alloc should pass.
- * b. greater than free_total: free_total * 2, alloc should fail.
- * c. equal to sum_total:      sum_tatal,      alloc should fail
+ * b. greater than sum_total:   sum_total * 2, alloc should fail.
  *
  * When overcommit_memory = 1, it can alloc enough much memory, I
  * choose the three cases:
@@ -164,9 +163,7 @@
 
 	update_mem();
 	alloc_and_check(free_total / 2, EXPECT_PASS);
-	update_mem();
-	alloc_and_check(free_total * 2, EXPECT_FAIL);
-	alloc_and_check(sum_total, EXPECT_FAIL);
+	alloc_and_check(sum_total * 2, EXPECT_FAIL);
 
 	/* start to test overcommit_memory=1 */
 	set_sys_tune("overcommit_memory", 1, 1);
diff --git a/testcases/kernel/mem/vma/vma05.sh b/testcases/kernel/mem/vma/vma05.sh
index d96d391..82f877b 100755
--- a/testcases/kernel/mem/vma/vma05.sh
+++ b/testcases/kernel/mem/vma/vma05.sh
@@ -1,38 +1,20 @@
 #!/bin/sh
-
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (C) 2017 Red Hat, Inc.
+# Regression test if the vsyscall and vdso VMA regions are reported correctly.
 #
-# 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.
+# While [vsyscall] is mostly deprecated with newer systems, there is
+# still plenty of kernels compiled with CONFIG_LEGACY_VSYSCALL_NATIVE and
+# CONFIG_LEGACY_VSYSCALL_EMULATE (see linux/arch/x86/Kconfig for option
+# descriptions). First part of the test will check eligible kernels for
+# regression for a bug fixed by commit 103efcd9aac1 (fix perms/range of
+# vsyscall vma in /proc/*/maps).
 #
-# 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, see <http://www.gnu.org/licenses/>.
-
-# Test description: [regression] Check if the vsyscall and vdso VMA regions are
-#                   reported correctly.
-#
-#       While [vsyscall] is mostly deprecated with newer systems, there is
-#       still plenty of kernels compiled with CONFIG_LEGACY_VSYSCALL_NATIVE and
-#       CONFIG_LEGACY_VSYSCALL_EMULATE (see linux/arch/x86/Kconfig for option
-#       descriptions). First part of the test will check eligible kernels for
-#       regression for a bug fixed by commit 103efcd9aac1 (fix perms/range of
-#       vsyscall vma in /proc/*/maps).
-#
-#       Second part of test checks [vdso] VMA permissions (fixed with commits
-#       b6558c4a2378 (fix [vdso] page permissions) and e5b97dde514f (Add
-#       VM_ALWAYSDUMP)). As a consequence of this bug, VMAs were not included
-#       in core dumps which resulted in eg. incomplete backtraces and invalid
-#       core dump files created by gdb.
-
-# Usage
-# ./vma05.sh
+# Second part of test checks [vdso] VMA permissions (fixed with commits
+# b6558c4a2378 (fix [vdso] page permissions) and e5b97dde514f (Add
+# VM_ALWAYSDUMP)). As a consequence of this bug, VMAs were not included
+# in core dumps which resulted in eg. incomplete backtraces and invalid
+# core dump files created by gdb.
 
 TST_SETUP=setup
 TST_CLEANUP=cleanup
diff --git a/testcases/kernel/numa/numa01.sh b/testcases/kernel/numa/numa01.sh
index 33393ac..1d62632 100755
--- a/testcases/kernel/numa/numa01.sh
+++ b/testcases/kernel/numa/numa01.sh
@@ -1,38 +1,20 @@
 #!/bin/sh
-##############################################################################
-#                                                                            #
-# Copyright (c) International Business Machines  Corp., 2007                 #
-#               Sivakumar Chinnaiah, Sivakumar.C@in.ibm.com                  #
-# Copyright (c) Linux Test Project, 2016                                     #
-#                                                                            #
-# 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 3 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, see <http://www.gnu.org/licenses/>.       #
-#                                                                            #
-##############################################################################
-#                                                                            #
-# Description:  Test Basic functionality of numactl command.                 #
-#               Test #1: Verifies cpunodebind and membind                    #
-#               Test #2: Verifies preferred node bind for memory allocation  #
-#               Test #3: Verifies memory interleave on all nodes             #
-#               Test #4: Verifies physcpubind                                #
-#               Test #5: Verifies localalloc                                 #
-#               Test #6: Verifies memhog                                     #
-#               Test #7: Verifies numa_node_size api                         #
-#               Test #8:Verifies Migratepages                                #
-#               Test #9:Verifies hugepage alloacted on specified node        #
-#               Test #10:Verifies THP memory allocated on preferred node     #
-#                                                                            #
-##############################################################################
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2007
+# Copyright (c) Linux Test Project, 2016
+# Author: Sivakumar Chinnaiah <Sivakumar.C@in.ibm.com>
+#
+# Test Basic functionality of numactl command.
+# Test #1: Verifies cpunodebind and membind
+# Test #2: Verifies preferred node bind for memory allocation
+# Test #3: Verifies memory interleave on all nodes
+# Test #4: Verifies physcpubind
+# Test #5: Verifies localalloc
+# Test #6: Verifies memhog
+# Test #7: Verifies numa_node_size api
+# Test #8:Verifies Migratepages
+# Test #9:Verifies hugepage alloacted on specified node
+# Test #10:Verifies THP memory allocated on preferred node
 
 TST_CNT=10
 TST_SETUP=setup
@@ -43,12 +25,9 @@
 
 . tst_test.sh
 
-#
 # Extracts the value of given numa node from the `numastat -p` output.
-#
 # $1 - Pid number.
 # $2 - Node number.
-#
 extract_numastat_p()
 {
 	local pid=$1
diff --git a/testcases/kernel/power_management/runpwtests03.sh b/testcases/kernel/power_management/runpwtests03.sh
index 1119793..3fb85d2 100755
--- a/testcases/kernel/power_management/runpwtests03.sh
+++ b/testcases/kernel/power_management/runpwtests03.sh
@@ -25,8 +25,7 @@
 . pm_include.sh
 
 check_cpufreq_sysfs_files() {
-	total_cpus=$(tst_ncpus)
-	(( total_cpus-=1 ))
+	total_cpus=`expr $(tst_ncpus) - 1`
 	RC=0
 
 	for cpu in $(seq 0 "${total_cpus}" )
@@ -51,8 +50,7 @@
 change_govr() {
 	available_govr=$(get_supporting_govr)
 
-	total_cpus=$(tst_ncpus)
-	(( total_cpus-=1 ))
+	total_cpus=`expr $(tst_ncpus) - 1`
 	RC=0
 
 	for cpu in $(seq 0 "${total_cpus}" )
@@ -79,8 +77,7 @@
 	available_govr=$(get_supporting_govr)
 	RC=0
 
-	total_cpus=$(tst_ncpus)
-	(( total_cpus-=1 ))
+	total_cpus=`expr $(tst_ncpus) - 1`
 
 	if ( echo ${available_govr} | grep -i "userspace" \
 		>/dev/null 2>&1 ); then
diff --git a/testcases/kernel/power_management/runpwtests05.sh b/testcases/kernel/power_management/runpwtests05.sh
index 8a7d0f6..1c87d8d 100755
--- a/testcases/kernel/power_management/runpwtests05.sh
+++ b/testcases/kernel/power_management/runpwtests05.sh
@@ -35,7 +35,7 @@
 	max_sched_smt=1
 fi
 
-tst_test_cmds python
+tst_require_cmds python3
 
 if ! grep sched_debug -qw /proc/cmdline ; then
 	tst_brkm TCONF "Kernel cmdline parameter 'sched_debug' needed," \
diff --git a/testcases/kernel/power_management/runpwtests_exclusive01.sh b/testcases/kernel/power_management/runpwtests_exclusive01.sh
index ec78319..3a824e5 100755
--- a/testcases/kernel/power_management/runpwtests_exclusive01.sh
+++ b/testcases/kernel/power_management/runpwtests_exclusive01.sh
@@ -35,7 +35,7 @@
 	max_sched_smt=1
 fi
 
-tst_test_cmds python
+tst_require_cmds python3
 
 hyper_threaded=$(is_hyper_threaded)
 multi_socket=$(is_multi_socket)
diff --git a/testcases/kernel/power_management/runpwtests_exclusive02.sh b/testcases/kernel/power_management/runpwtests_exclusive02.sh
index e107fce..fa44518 100755
--- a/testcases/kernel/power_management/runpwtests_exclusive02.sh
+++ b/testcases/kernel/power_management/runpwtests_exclusive02.sh
@@ -33,7 +33,7 @@
 	max_sched_smt=1
 fi
 
-tst_test_cmds python
+tst_require_cmds python3
 
 hyper_threaded=$(is_hyper_threaded)
 multi_socket=$(is_multi_socket)
diff --git a/testcases/kernel/power_management/runpwtests_exclusive03.sh b/testcases/kernel/power_management/runpwtests_exclusive03.sh
index 490344b..0d57248 100755
--- a/testcases/kernel/power_management/runpwtests_exclusive03.sh
+++ b/testcases/kernel/power_management/runpwtests_exclusive03.sh
@@ -35,7 +35,7 @@
 	max_sched_smt=1
 fi
 
-tst_test_cmds python
+tst_require_cmds python3
 
 hyper_threaded=$(is_hyper_threaded)
 multi_socket=$(is_multi_socket)
diff --git a/testcases/kernel/power_management/runpwtests_exclusive04.sh b/testcases/kernel/power_management/runpwtests_exclusive04.sh
index 978ca02..15e031a 100755
--- a/testcases/kernel/power_management/runpwtests_exclusive04.sh
+++ b/testcases/kernel/power_management/runpwtests_exclusive04.sh
@@ -27,7 +27,7 @@
 # Checking test environment
 check_kervel_arch
 
-tst_test_cmds python
+tst_require_cmds python3
 
 hyper_threaded=$(is_hyper_threaded)
 multi_socket=$(is_multi_socket)
diff --git a/testcases/kernel/power_management/runpwtests_exclusive05.sh b/testcases/kernel/power_management/runpwtests_exclusive05.sh
index a0dad58..9d4e016 100755
--- a/testcases/kernel/power_management/runpwtests_exclusive05.sh
+++ b/testcases/kernel/power_management/runpwtests_exclusive05.sh
@@ -35,7 +35,7 @@
 	max_sched_smt=1
 fi
 
-tst_test_cmds python
+tst_require_cmds python3
 
 hyper_threaded=$(is_hyper_threaded)
 multi_socket=$(is_multi_socket)
diff --git a/testcases/kernel/pty/pty02.c b/testcases/kernel/pty/pty02.c
index 3f34704..fc60b62 100644
--- a/testcases/kernel/pty/pty02.c
+++ b/testcases/kernel/pty/pty02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -71,4 +59,8 @@
 
 static struct tst_test test = {
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "966031f34018"},
+		{}
+	}
 };
diff --git a/testcases/kernel/sched/autogroup/autogroup01.c b/testcases/kernel/sched/autogroup/autogroup01.c
index 9c4e911..f14f28f 100644
--- a/testcases/kernel/sched/autogroup/autogroup01.c
+++ b/testcases/kernel/sched/autogroup/autogroup01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  * Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -92,4 +80,8 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "18f649ef3441"},
+		{}
+	}
 };
diff --git a/testcases/kernel/security/Makefile b/testcases/kernel/security/Makefile
index 0b4b98b..eea794a 100644
--- a/testcases/kernel/security/Makefile
+++ b/testcases/kernel/security/Makefile
@@ -24,10 +24,6 @@
 
 include	$(top_srcdir)/include/mk/env_pre.mk
 
-ifneq ($(HAVE_SECUREBITS),yes)
-FILTER_OUT_DIRS		+= securebits
-endif
-
 OPT_CFLAGS		+= -O
 DEBUG_LDFLAGS		+= -s
 
diff --git a/testcases/kernel/security/cap_bound/exec_with_inh.c b/testcases/kernel/security/cap_bound/exec_with_inh.c
index dd9ddb5..1381479 100644
--- a/testcases/kernel/security/cap_bound/exec_with_inh.c
+++ b/testcases/kernel/security/cap_bound/exec_with_inh.c
@@ -41,6 +41,7 @@
 int main(int argc, char *argv[])
 {
 #if HAVE_SYS_CAPABILITY_H
+#if HAVE_DECL_PR_CAPBSET_DROP
 #ifdef HAVE_LIBCAP
 	int ret = 1;
 	cap_flag_value_t f;
@@ -84,6 +85,9 @@
 #else /* HAVE_LIBCAP */
 	tst_resm(TCONF, "System doesn't have POSIX capabilities.");
 #endif
+#else /* HAVE_DECL_PR_CAPBSET_DROP*/
+	tst_resm(TCONF, "System doesn't have CAPBSET prctls");
+#endif
 #else /* HAVE_SYS_CAPABILITY_H */
 	tst_resm(TCONF, "System doesn't have sys/capability.h.");
 #endif
diff --git a/testcases/kernel/security/cap_bound/exec_without_inh.c b/testcases/kernel/security/cap_bound/exec_without_inh.c
index 29b3123..0d13d48 100644
--- a/testcases/kernel/security/cap_bound/exec_without_inh.c
+++ b/testcases/kernel/security/cap_bound/exec_without_inh.c
@@ -41,6 +41,7 @@
 int main(int argc, char *argv[])
 {
 #if HAVE_SYS_CAPABILITY_H
+#if HAVE_DECL_PR_CAPBSET_DROP
 #ifdef HAVE_LIBCAP
 	int ret = 1;
 	cap_flag_value_t f;
@@ -81,6 +82,9 @@
 #else /* libcap */
 	tst_resm(TCONF, "System doesn't have POSIX capabilities.");
 #endif
+#else /* HAVE_DECL_PR_CAPBSET_DROP */
+	tst_resm(TCONF, "System doesn't have CAPBSET prctls");
+#endif
 #else /* capability_h */
 	tst_resm(TCONF, "System doesn't have sys/capability.h.");
 #endif
diff --git a/testcases/kernel/security/dirtyc0w/dirtyc0w.c b/testcases/kernel/security/dirtyc0w/dirtyc0w.c
index 3da40a9..a0a81b6 100644
--- a/testcases/kernel/security/dirtyc0w/dirtyc0w.c
+++ b/testcases/kernel/security/dirtyc0w/dirtyc0w.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -104,10 +92,14 @@
 }
 
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.needs_checkpoints = 1,
 	.forks_child = 1,
 	.needs_root = 1,
 	.setup = setup,
 	.test_all = dirtyc0w_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "4ceb5db9757a"},
+		{"linux-git", "9be0eaffa3ac"},
+		{}
+	}
 };
diff --git a/testcases/kernel/security/dirtyc0w/dirtyc0w_child.c b/testcases/kernel/security/dirtyc0w/dirtyc0w_child.c
index bb93c62..5b68c0e 100644
--- a/testcases/kernel/security/dirtyc0w/dirtyc0w_child.c
+++ b/testcases/kernel/security/dirtyc0w/dirtyc0w_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
  *  Based on: https://github.com/dirtycow/dirtycow.github.io
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/mman.h>
diff --git a/testcases/kernel/security/filecaps/verify_caps_exec.c b/testcases/kernel/security/filecaps/verify_caps_exec.c
index 090ac5c..3e67941 100644
--- a/testcases/kernel/security/filecaps/verify_caps_exec.c
+++ b/testcases/kernel/security/filecaps/verify_caps_exec.c
@@ -226,7 +226,12 @@
 	int num_caps;
 
 	for (num_caps = 0;; num_caps++) {
+#if HAVE_DECL_PR_CAPBSET_READ
 		ret = prctl(PR_CAPBSET_READ, num_caps);
+#else
+		tst_resm(TCONF, "System doesn't have CAPBSET prctls");
+		ret = -1;
+#endif
 		/*
 		 * Break from the loop in this manner to avoid incrementing,
 		 * then having to decrement value.
diff --git a/testcases/kernel/security/integrity/ima/src/ima_mmap.c b/testcases/kernel/security/integrity/ima/src/ima_mmap.c
index 5bc688b..0875aae 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_mmap.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_mmap.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2009
+ * Copyright (c) International Business Machines Corp., 2009
  *
  * Authors:
  * Mimi Zohar <zohar@us.ibm.com>
- *
- * 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, version 2 of the
- * License.
- *
- * File: ima_mmap.c
- *
- * Open and mmap a file and sleep. Another process will open the
- * mmapped file in read mode, resulting in a open_writer violation.
  */
 
 #include "tst_test.h"
diff --git a/testcases/kernel/security/integrity/ima/tests/README.md b/testcases/kernel/security/integrity/ima/tests/README.md
new file mode 100644
index 0000000..16a1f48
--- /dev/null
+++ b/testcases/kernel/security/integrity/ima/tests/README.md
@@ -0,0 +1,82 @@
+IMA + EVM testing
+=================
+
+IMA tests
+---------
+
+`ima_measurements.sh` require builtin IMA tcb policy to be loaded
+(`ima_policy=tcb` kernel parameter).
+Although a custom policy, loaded via dracut, systemd or manually from user
+space, may contain equivalent measurement tcb rules, detecting them would
+require `IMA_READ_POLICY=y` therefore ignore this option.
+
+Mandatory kernel configuration for IMA:
+```
+CONFIG_INTEGRITY=y
+CONFIG_IMA=y
+```
+
+EVM tests
+---------
+
+`evm_overlay.sh` requires a builtin IMA appraise tcb policy (e.g. `ima_policy=appraise_tcb`
+kernel parameter) which appraises the integrity of all files owned by root and EVM setup.
+Again, for simplicity ignore possibility to load requires rules via custom policy.
+
+Mandatory kernel configuration for IMA & EVM:
+```
+CONFIG_INTEGRITY=y
+CONFIG_INTEGRITY_SIGNATURE=y
+CONFIG_IMA=y
+CONFIG_IMA_APPRAISE=y
+CONFIG_EVM=y
+CONFIG_KEYS=y
+CONFIG_TRUSTED_KEYS=y
+CONFIG_ENCRYPTED_KEYS=y
+```
+
+Example of installing IMA + EVM on openSUSE:
+
+* Boot install system with `ima_policy=tcb|appraise_tcb ima_appraise=fix evm=fix` kernel parameters
+  (for IMA measurement, IMA appraisal and EVM protection)
+* Proceed with installation until summary screen, but do not start the installation yet
+* Select package `dracut-ima` (required for early boot EVM support) for installation
+  (Debian based distros already contain IMA + EVM support in `dracut` package)
+* Change to a console window and run commands to generate keys required by EVM:
+```
+# mkdir /etc/keys
+# user_key=$(keyctl add user kmk-user "`dd if=/dev/urandom bs=1 count=32 2>/dev/null`" @u)
+# keyctl pipe "$user_key" > /etc/keys/kmk-user.blob
+# evm_key=$(keyctl add encrypted evm-key "new user:kmk-user 64" @u)
+# keyctl pipe "$evm_key" >/etc/keys/evm.blob
+# cat <<END >/etc/sysconfig/masterkey
+MASTERKEYTYPE="user"
+MASTERKEY="/etc/keys/kmk-user.blob"
+END
+# cat <<END >/etc/sysconfig/evm
+EVMKEY="/etc/keys/evm.blob"
+END
+# mount -t securityfs security /sys/kernel/security
+# echo 1 >/sys/kernel/security/evm
+```
+
+* Go back to the installation summary screen and start the installation
+* During the installation execute the following commands from the console:
+```
+# cp -r /etc/keys /mnt/etc/ # Debian based distributions: use /target instead of /mnt
+# cp /etc/sysconfig/{evm,masterkey} /mnt/etc/sysconfig/
+```
+
+This should work on any distribution using dracut.
+Loading EVM keys is also possible with initramfs-tools (Debian based distributions).
+
+Of course it's possible to install OS usual way, add keys later and fix missing xattrs with:
+```
+evmctl -r ima_fix /
+```
+
+or with `find` if evmctl is not available:
+```
+find / \( -fstype rootfs -o -fstype ext4 -o -fstype btrfs -o -fstype xfs \) -exec sh -c "< '{}'" \;
+```
+Again, fixing requires `ima_policy=tcb|appraise_tcb ima_appraise=fix evm=fix` kernel parameters.
diff --git a/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh b/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh
new file mode 100755
index 0000000..ac209e4
--- /dev/null
+++ b/testcases/kernel/security/integrity/ima/tests/evm_overlay.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Based on reproducer and further discussion with Ignaz Forster <iforster@suse.de>
+# Reproducer for not upstreamed patchset [1] and previous report [2].
+# [1] https://www.spinics.net/lists/linux-integrity/msg05926.html
+# [2] https://www.spinics.net/lists/linux-integrity/msg03593.html
+
+TST_SETUP="setup"
+TST_CLEANUP="cleanup"
+TST_NEEDS_DEVICE=1
+TST_CNT=4
+. ima_setup.sh
+
+setup()
+{
+	EVM_FILE="/sys/kernel/security/evm"
+
+	[ -f "$EVM_FILE" ] || tst_brk TCONF "EVM not enabled in kernel"
+	[ $(cat $EVM_FILE) -eq 1 ] || tst_brk TCONF "EVM not enabled for this boot"
+
+	check_ima_policy "appraise_tcb"
+
+	lower="$TST_MNTPOINT/lower"
+	upper="$TST_MNTPOINT/upper"
+	work="$TST_MNTPOINT/work"
+	merged="$TST_MNTPOINT/merged"
+	mkdir -p $lower $upper $work $merged
+
+	device_backup="$TST_DEVICE"
+	TST_DEVICE="overlay"
+
+	fs_type_backup="$TST_FS_TYPE"
+	TST_FS_TYPE="overlay"
+
+	mntpoint_backup="$TST_MNTPOINT"
+	TST_MNTPOINT="$merged"
+
+	params_backup="$TST_MNT_PARAMS"
+	TST_MNT_PARAMS="-o lowerdir=$lower,upperdir=$upper,workdir=$work"
+
+	tst_mount
+	mounted=1
+}
+
+test1()
+{
+	local file="foo1.txt"
+
+	tst_res TINFO "overwrite file in overlay"
+	EXPECT_PASS echo lower \> $lower/$file
+	EXPECT_PASS echo overlay \> $merged/$file
+}
+
+test2()
+{
+	local file="foo2.txt"
+
+	tst_res TINFO "append file in overlay"
+	EXPECT_PASS echo lower \> $lower/$file
+	EXPECT_PASS echo overlay \>\> $merged/$file
+}
+
+test3()
+{
+	local file="foo3.txt"
+
+	tst_res TINFO "create a new file in overlay"
+	EXPECT_PASS echo overlay \> $merged/$file
+}
+
+test4()
+{
+	local f
+
+	tst_res TINFO "read all created files"
+	for f in $(find $TST_MNTPOINT -type f); do
+		EXPECT_PASS cat $f \> /dev/null 2\> /dev/null
+	done
+}
+
+cleanup()
+{
+	[ -n "$mounted" ] || return 0
+
+	tst_umount $TST_DEVICE
+
+	TST_DEVICE="$device_backup"
+	TST_FS_TYPE="$fs_type_backup"
+	TST_MNTPOINT="$mntpoint_backup"
+	TST_MNT_PARAMS="$params_backup"
+}
+
+tst_run
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
index 328affc..714d699 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_measurements.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
-# Author: Mimi Zohar, zohar@ibm.vnet.ibm.com
+# Copyright (c) 2018-2019 Petr Vorel <pvorel@suse.cz>
+# Author: Mimi Zohar <zohar@linux.ibm.com>
 #
 # Verify that measurements are added to the measurement list based on policy.
 
@@ -28,16 +15,17 @@
 
 setup()
 {
-	TEST_FILE="$PWD/test.txt"
+	check_ima_policy "tcb"
 
+	TEST_FILE="$PWD/test.txt"
 	POLICY="$IMA_DIR/policy"
 	[ -f "$POLICY" ] || tst_res TINFO "not using default policy"
-
 	DIGEST_INDEX=
 
 	local template="$(tail -1 $ASCII_MEASUREMENTS | cut -d' ' -f 3)"
 	local i
 
+	# parse digest index
 	# https://www.kernel.org/doc/html/latest/security/IMA-templates.html#use
 	case "$template" in
 	ima|ima-ng|ima-sig) DIGEST_INDEX=4 ;;
@@ -56,8 +44,6 @@
 
 	[ -z "$DIGEST_INDEX" ] && tst_brk TCONF \
 		"Cannot find digest index (template: '$template')"
-
-	tst_res TINFO "IMA measurement tests assume tcb policy to be loaded (ima_policy=tcb)"
 }
 
 # TODO: find support for rmd128 rmd256 rmd320 wp256 wp384 tgr128 tgr160
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_policy.sh b/testcases/kernel/security/integrity/ima/tests/ima_policy.sh
index a0c7869..c115a5a 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_policy.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_policy.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2009 IBM Corporation
 # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
-# Author: Mimi Zohar, zohar@ibm.vnet.ibm.com
+# Author: Mimi Zohar <zohar@linux.ibm.com>
 #
 # Test replacing the default integrity measurement policy.
 
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
index 5255119..422ec0b 100644
--- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
@@ -1,27 +1,14 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2009 IBM Corporation
-# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
-# Author: Mimi Zohar, zohar@ibm.vnet.ibm.com
+# Copyright (c) 2018-2019 Petr Vorel <pvorel@suse.cz>
+# Author: Mimi Zohar <zohar@linux.ibm.com>
 
 TST_TESTFUNC="test"
 TST_SETUP_CALLER="$TST_SETUP"
 TST_SETUP="ima_setup"
-TST_CLEANUP="${TST_CLEANUP:-ima_cleanup}"
-TST_NEEDS_TMPDIR=1
+TST_CLEANUP_CALLER="$TST_CLEANUP"
+TST_CLEANUP="ima_cleanup"
 TST_NEEDS_ROOT=1
 
 . tst_test.sh
@@ -30,6 +17,20 @@
 UMOUNT=
 TST_FS_TYPE="ext3"
 
+check_ima_policy()
+{
+	local policy="$1"
+	local i
+
+	grep -q "ima_$policy" /proc/cmdline && return
+	for i in $(cat /proc/cmdline); do
+		if echo "$i" | grep -q '^ima_policy='; then
+			echo "$i" | grep -q -e "|[ ]*$policy" -e "$policy[ ]*|" -e "=$policy" && return
+		fi
+	done
+	tst_brk TCONF "IMA measurement tests require builtin IMA $policy policy (e.g. ima_policy=$policy kernel parameter)"
+}
+
 mount_helper()
 {
 	local type="$1"
@@ -63,14 +64,14 @@
 	local config="/boot/config-$(uname -r)"
 	local i
 
-	tst_res TINFO "/proc/cmdline: $(cat /proc/cmdline)"
-
 	if [ -r "$config" ]; then
 		tst_res TINFO "IMA kernel config:"
 		for i in $(grep ^CONFIG_IMA $config); do
 			tst_res TINFO "$i"
 		done
 	fi
+
+	tst_res TINFO "/proc/cmdline: $(cat /proc/cmdline)"
 }
 
 ima_setup()
@@ -95,13 +96,16 @@
 ima_cleanup()
 {
 	local dir
+
+	[ -n "$TST_CLEANUP_CALLER" ] && $TST_CLEANUP_CALLER
+
 	for dir in $UMOUNT; do
 		umount $dir
 	done
 
 	if [ "$TST_NEEDS_DEVICE" = 1 ]; then
 		cd $TST_TMPDIR
-		tst_umount $TST_DEVICE
+		tst_umount
 	fi
 }
 
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh b/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
index 0ffc3c0..b378ec3 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2009 IBM Corporation
 # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
-# Author: Mimi Zohar, zohar@ibm.vnet.ibm.com
+# Author: Mimi Zohar <zohar@linux.ibm.com>
 #
 # Verify the boot and PCR aggregates.
 
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
index 74223c2..77ea494 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2009 IBM Corporation
 # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
-# Author: Mimi Zohar, zohar@ibm.vnet.ibm.com
+# Author: Mimi Zohar <zohar@linux.ibm.com>
 #
 # Test whether ToMToU and open_writer violations invalidatethe PCR and are logged.
 
@@ -51,8 +38,6 @@
 {
 	[ "$PRINTK_RATE_LIMIT" != "0" ] && \
 		sysctl -wq kernel.printk_ratelimit=$PRINTK_RATE_LIMIT
-
-	ima_cleanup
 }
 
 open_file_read()
diff --git a/testcases/kernel/security/umip/umip_basic_test.c b/testcases/kernel/security/umip/umip_basic_test.c
index c34d4a1..1baa26c 100644
--- a/testcases/kernel/security/umip/umip_basic_test.c
+++ b/testcases/kernel/security/umip/umip_basic_test.c
@@ -47,7 +47,7 @@
 	unsigned char val[IDT_LEN];
 
 	memset(val, 0, sizeof(val));
-	tst_res(TINFO, "TEST sidt, sidt result save at [%p]\n", val);
+	tst_res(TINFO, "TEST sidt, sidt result save at [%p]", val);
 	asm volatile("sidt %0\n" : "=m" (val));
 	exit(0);
 }
@@ -56,7 +56,7 @@
 {
 	unsigned long val;
 
-	tst_res(TINFO, "TEST sldt, sldt result save at [%p]\n", &val);
+	tst_res(TINFO, "TEST sldt, sldt result save at [%p]", &val);
 	asm volatile("sldt %0\n" : "=m" (val));
 	exit(0);
 }
@@ -65,7 +65,7 @@
 {
 	unsigned long val;
 
-	tst_res(TINFO, "TEST smsw, smsw result save at [%p]\n", &val);
+	tst_res(TINFO, "TEST smsw, smsw result save at [%p]", &val);
 	asm volatile("smsw %0\n" : "=m" (val));
 	exit(0);
 }
@@ -74,7 +74,7 @@
 {
 	unsigned long val;
 
-	tst_res(TINFO, "TEST str, str result save at [%p]\n", &val);
+	tst_res(TINFO, "TEST str, str result save at [%p]", &val);
 	asm volatile("str %0\n" : "=m" (val));
 	exit(0);
 }
@@ -86,6 +86,8 @@
 
 	pid = SAFE_FORK();
 	if (pid == 0) {
+		tst_no_corefile(0);
+
 		switch (n) {
 		case 0:
 			asm_sgdt();
@@ -110,6 +112,25 @@
 
 	SAFE_WAITPID(pid, &status, 0);
 
+	switch (n) {
+	case 0:
+	case 1:
+	case 3:
+		/* after linux kernel v5.4 mainline, 64bit SGDT SIDT SMSW will return
+		   dummy value and not trigger SIGSEGV due to kernel code change */
+		if ((tst_kvercmp(5, 4, 0)) >= 0) {
+			tst_res(TINFO, "Linux kernel version is v5.4 or after than v5.4");
+			if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
+				tst_res(TFAIL, "Got SIGSEGV");
+				return;
+			}
+			tst_res(TPASS, "Didn't receive SIGSEGV, child exited with %s",
+				tst_strstatus(status));
+			return;
+		} else
+			tst_res(TINFO, "Linux kernel version is before than v5.4");
+	}
+
 	if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
 		tst_res(TPASS, "Got SIGSEGV");
 		return;
diff --git a/testcases/kernel/sound/.gitignore b/testcases/kernel/sound/.gitignore
new file mode 100644
index 0000000..33692e6
--- /dev/null
+++ b/testcases/kernel/sound/.gitignore
@@ -0,0 +1 @@
+snd_timer01
diff --git a/testcases/kernel/sound/Makefile b/testcases/kernel/sound/Makefile
new file mode 100644
index 0000000..9abcc2b
--- /dev/null
+++ b/testcases/kernel/sound/Makefile
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+top_srcdir		:= ../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+CPPFLAGS		+= -D_GNU_SOURCE
+
+snd_timer01: CFLAGS+=-pthread
+snd_timer01: LDLIBS+=-lrt
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/sound/snd_timer01.c b/testcases/kernel/sound/snd_timer01.c
new file mode 100644
index 0000000..e339ec8
--- /dev/null
+++ b/testcases/kernel/sound/snd_timer01.c
@@ -0,0 +1,149 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/* Copyright (c) 2019 Michael Moese <mmoese@suse.com>
+ * Regression test for CVE-2017-1000380 based on the original PoC exploit
+ * by Alexander Potapenko <glider@google.com>
+ *
+ * Be careful! This test may crash your kernel!
+ *
+ * The test performs several ioctl() parallel with readv() on the same
+ * file descriptor to /dev/snd/timer. A buggy kernel will leak memory
+ * to the process, which may contain information from the the kernel or
+ * any other process on the system.
+ *
+ * The issue was fixed with
+ *   http://git.kernel.org/linus/d11662f4f798b50d8c8743f433842c3e40fe3378
+ *   http://git.kernel.org/linus/ba3021b2c79b2fa9114f92790a99deb27a65b728
+ */
+
+#include "config.h"
+#include "tst_test.h"
+#include "tst_taint.h"
+#include "tst_fuzzy_sync.h"
+#include "tst_safe_macros.h"
+#include "tst_safe_pthread.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/uio.h>
+#include <sys/ioctl.h>
+#include <sound/asound.h>
+
+#define MAX_BUFSIZE 1024
+
+static int snd_fd;
+static struct tst_fzsync_pair fzsync_pair;
+
+static void *ioctl_thread(void *unused)
+{
+	int tread_arg = 1;
+	struct snd_timer_select ts;
+	struct snd_timer_params tp;
+
+	memset(&ts, 0, sizeof(ts));
+	ts.id.dev_class = 1;
+
+	memset(&tp, 0, sizeof(tp));
+	tp.ticks = 1;
+	tp.filter = 0xf;
+
+	while (tst_fzsync_run_b(&fzsync_pair)) {
+
+		ioctl(snd_fd, SNDRV_TIMER_IOCTL_TREAD, &tread_arg);
+
+		ioctl(snd_fd, SNDRV_TIMER_IOCTL_SELECT, &ts);
+
+		ioctl(snd_fd, SNDRV_TIMER_IOCTL_PARAMS, &tp);
+
+		ioctl(snd_fd, SNDRV_TIMER_IOCTL_START, 0);
+
+		tst_fzsync_end_race_b(&fzsync_pair);
+	}
+	return unused;
+}
+
+static void setup(void)
+{
+	if(access("/dev/snd/timer", F_OK))
+		tst_brk(TCONF, "The file '/dev/snd/timer' is not exist");
+
+	tst_fzsync_pair_init(&fzsync_pair);
+	tst_taint_init(TST_TAINT_W | TST_TAINT_D);
+	snd_fd = SAFE_OPEN("/dev/snd/timer",
+			O_RDONLY|O_CREAT|O_NOCTTY|O_SYNC|O_LARGEFILE, 0);
+}
+
+static void cleanup(void)
+{
+	if (snd_fd > 0)
+		SAFE_CLOSE(snd_fd);
+}
+
+static void run(void)
+{
+	size_t len;
+	int size;
+	struct iovec iov;
+	pthread_t th;
+	char read_buf[MAX_BUFSIZE];
+	int i, nz;
+	pthread_attr_t thread_attr;
+
+	pthread_attr_init(&thread_attr);
+	pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+	SAFE_PTHREAD_CREATE(&th, &thread_attr, ioctl_thread, NULL);
+
+	iov.iov_base = read_buf;
+	iov.iov_len = sizeof(read_buf) - 1;
+
+	tst_fzsync_pair_reset(&fzsync_pair, NULL);
+	while (tst_fzsync_run_a(&fzsync_pair)) {
+		nz = 0;
+		memset(read_buf, 0, sizeof(read_buf));
+		size = readv(snd_fd, &iov, 1);
+
+		tst_fzsync_end_race_a(&fzsync_pair);
+
+		/* check if it could be a valid ioctl result */
+		if (size == 0)
+			continue;
+
+		/* check if the buffer is non-empty */
+		for (i = 0; i < size; i++) {
+			if (read_buf[i]) {
+				nz = 1;
+				break;
+			}
+		}
+		if (!nz)
+			continue;
+
+		len = strlen(read_buf);
+		/* the kernel's struct snd_timer_read is two unsigned integers*/
+		if (len <= 2 * sizeof(unsigned int))
+			continue;
+
+		tst_res(TFAIL, "kernel seems vulnerable");
+		return;
+	}
+
+	if (tst_taint_check() != 0)
+		tst_res(TFAIL, "kernel seems vulnerable");
+	else
+		tst_res(TPASS, "kernel seems not vulnerable");
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.setup = setup,
+	.cleanup = cleanup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "d11662f4f798"},
+		{"linux-git", "ba3021b2c79b"},
+		{"CVE", "2017-1000380"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/accept/.gitignore b/testcases/kernel/syscalls/accept/.gitignore
index 1f6f8ad..5b14626 100644
--- a/testcases/kernel/syscalls/accept/.gitignore
+++ b/testcases/kernel/syscalls/accept/.gitignore
@@ -1 +1,2 @@
 /accept01
+/accept02
diff --git a/testcases/kernel/syscalls/accept/Makefile b/testcases/kernel/syscalls/accept/Makefile
index bd617d8..0910871 100644
--- a/testcases/kernel/syscalls/accept/Makefile
+++ b/testcases/kernel/syscalls/accept/Makefile
@@ -21,3 +21,5 @@
 include $(top_srcdir)/include/mk/testcases.mk
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+accept02: CFLAGS += -pthread
diff --git a/testcases/kernel/syscalls/accept/accept02.c b/testcases/kernel/syscalls/accept/accept02.c
new file mode 100644
index 0000000..37ab8b6
--- /dev/null
+++ b/testcases/kernel/syscalls/accept/accept02.c
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+/* Test for CVE-2017-8890
+ *
+ * In Kernels up to 4.10.15 missing commit 657831ff the multicast
+ * group information of a socket gets copied over to a newly created
+ * socket when using the accept() syscall. This will cause a double free
+ * when closing the original and the cloned socket.
+ *
+ * WARNING:
+ * There is a high chance that this test will cause an unstable system
+ * if it does not succeed!
+ *
+ * For more information about this CVE see:
+ * https://www.suse.com/security/cve/CVE-2017-8890/
+ */
+
+#include <errno.h>
+#include <sys/socket.h>
+#include "tst_test.h"
+#include "tst_safe_net.h"
+#include "tst_safe_pthread.h"
+
+#define MULTICASTIP "224.0.0.0"
+#define LOCALHOSTIP "127.0.0.1"
+
+static int server_sockfd;
+static int clone_server_sockfd;
+static int client_sockfd;
+static int server_port;
+static socklen_t addr_len;
+
+static struct sockaddr_in *server_addr;
+static struct sockaddr_in *client_addr;
+static struct group_req *mc_group;
+
+static void *server_thread(void *arg)
+{
+	int op, op_len, mc_group_len;
+
+	op = 1;
+	op_len = sizeof(op);
+	mc_group_len = sizeof(*mc_group);
+
+	server_sockfd = SAFE_SOCKET(AF_INET, SOCK_STREAM, 0);
+
+	SAFE_SETSOCKOPT(server_sockfd, SOL_SOCKET, SO_REUSEADDR, &op, op_len);
+	SAFE_SETSOCKOPT(server_sockfd, SOL_IP, MCAST_JOIN_GROUP,
+			mc_group, mc_group_len);
+
+	SAFE_BIND(server_sockfd, (struct sockaddr *)server_addr, addr_len);
+	SAFE_LISTEN(server_sockfd, 1);
+
+	TST_CHECKPOINT_WAKE(0);
+
+	TEST(accept(server_sockfd, (struct sockaddr *)client_addr, &addr_len));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "Could not accept connection");
+
+	clone_server_sockfd = TST_RET;
+
+	TEST(setsockopt(clone_server_sockfd, SOL_IP, MCAST_LEAVE_GROUP,
+			mc_group, mc_group_len));
+
+	if (TST_RET != -1)
+		tst_res(TFAIL, "Multicast group was copied!");
+	else if (TST_ERR == EADDRNOTAVAIL)
+		tst_res(TPASS | TTERRNO, "Multicast group was not copied");
+	else
+		tst_brk(TBROK | TTERRNO, "setsockopt() failed unexpectedly");
+
+	SAFE_CLOSE(server_sockfd);
+	return arg;
+}
+
+static void *client_thread(void *arg)
+{
+	client_sockfd = SAFE_SOCKET(AF_INET, SOCK_STREAM, 0);
+	SAFE_BIND(client_sockfd, (struct sockaddr *)client_addr, addr_len);
+
+	SAFE_CONNECT(client_sockfd, (struct sockaddr *)server_addr, addr_len);
+
+	SAFE_CLOSE(client_sockfd);
+	return arg;
+}
+
+static void run(void)
+{
+	pthread_t server_thr, client_thr;
+
+	server_addr->sin_port = server_port;
+	client_addr->sin_port = htons(0);
+
+	SAFE_PTHREAD_CREATE(&server_thr, NULL, server_thread, NULL);
+	TST_CHECKPOINT_WAIT(0);
+	SAFE_PTHREAD_CREATE(&client_thr, NULL, client_thread, NULL);
+
+	SAFE_PTHREAD_JOIN(server_thr, NULL);
+	SAFE_PTHREAD_JOIN(client_thr, NULL);
+}
+
+static void setup(void)
+{
+	struct sockaddr_in *mc_group_addr;
+
+	server_addr = tst_alloc(sizeof(*server_addr));
+	client_addr = tst_alloc(sizeof(*client_addr));
+	mc_group = tst_alloc(sizeof(*mc_group));
+
+	mc_group->gr_interface = 0;
+	mc_group_addr = (struct sockaddr_in *) &mc_group->gr_group;
+	mc_group_addr->sin_family = AF_INET;
+	inet_aton(MULTICASTIP, &mc_group_addr->sin_addr);
+
+	server_addr->sin_family = AF_INET;
+	inet_aton(LOCALHOSTIP, &server_addr->sin_addr);
+
+	client_addr->sin_family = AF_INET;
+	client_addr->sin_addr.s_addr = htons(INADDR_ANY);
+
+	addr_len = sizeof(struct sockaddr_in);
+
+	server_port = TST_GET_UNUSED_PORT(AF_INET, SOCK_STREAM);
+	tst_res(TINFO, "Starting listener on port: %d", ntohs(server_port));
+}
+
+static void cleanup(void)
+{
+	if (clone_server_sockfd > 0)
+		SAFE_CLOSE(clone_server_sockfd);
+	if (client_sockfd > 0)
+		SAFE_CLOSE(client_sockfd);
+	if (server_sockfd > 0)
+		SAFE_CLOSE(server_sockfd);
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_checkpoints = 1,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-8890"},
+		{"linux-git", "657831ff"},
+		{},
+	}
+};
diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c
index dd289cf..29e18f2 100644
--- a/testcases/kernel/syscalls/accept4/accept4_01.c
+++ b/testcases/kernel/syscalls/accept4/accept4_01.c
@@ -35,7 +35,7 @@
 #define USE_SOCKETCALL 1
 #endif
 
-static struct sockaddr_in conn_addr;
+static struct sockaddr_in *conn_addr, *accept_addr;
 static int listening_fd;
 
 #if !(__GLIBC_PREREQ(2, 10))
@@ -80,10 +80,10 @@
 
 static void setup(void)
 {
-	memset(&conn_addr, 0, sizeof(struct sockaddr_in));
-	conn_addr.sin_family = AF_INET;
-	conn_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-	conn_addr.sin_port = htons(PORT_NUM);
+	memset(conn_addr, 0, sizeof(*conn_addr));
+	conn_addr->sin_family = AF_INET;
+	conn_addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+	conn_addr->sin_port = htons(PORT_NUM);
 
 	listening_fd = create_listening_socket();
 }
@@ -108,18 +108,17 @@
 	struct test_case *tcase = &tcases[nr];
 	int connfd, acceptfd;
 	int fdf, flf, fdf_pass, flf_pass, fd_cloexec, fd_nonblock;
-	struct sockaddr_in claddr;
 	socklen_t addrlen;
 
 	connfd = SAFE_SOCKET(AF_INET, SOCK_STREAM, 0);
-	SAFE_CONNECT(connfd, (struct sockaddr *)&conn_addr, sizeof(conn_addr));
-	addrlen = sizeof(claddr);
+	SAFE_CONNECT(connfd, (struct sockaddr *)conn_addr, sizeof(*conn_addr));
+	addrlen = sizeof(*accept_addr);
 
 #if !(__GLIBC_PREREQ(2, 10))
-	TEST(accept4_01(listening_fd, (struct sockaddr *)&claddr, &addrlen,
+	TEST(accept4_01(listening_fd, (struct sockaddr *)accept_addr, &addrlen,
 				tcase->cloexec | tcase->nonblock));
 #else
-	TEST(accept4(listening_fd, (struct sockaddr *)&claddr, &addrlen,
+	TEST(accept4(listening_fd, (struct sockaddr *)accept_addr, &addrlen,
 				tcase->cloexec | tcase->nonblock));
 #endif
 	if (TST_RET == -1) {
@@ -163,4 +162,9 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test = verify_accept4,
+	.bufs = (struct tst_buffers []) {
+		{&conn_addr, .size = sizeof(*conn_addr)},
+		{&accept_addr, .size = sizeof(*accept_addr)},
+		{},
+	}
 };
diff --git a/testcases/kernel/syscalls/access/access01.c b/testcases/kernel/syscalls/access/access01.c
index f36a9d2..1b73058 100644
--- a/testcases/kernel/syscalls/access/access01.c
+++ b/testcases/kernel/syscalls/access/access01.c
@@ -1,26 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *   AUTHOR		: William Roske
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 /*
  * Basic test for access(2) using F_OK, R_OK, W_OK and X_OK
diff --git a/testcases/kernel/syscalls/access/access02.c b/testcases/kernel/syscalls/access/access02.c
index 5030288..db1d350 100644
--- a/testcases/kernel/syscalls/access/access02.c
+++ b/testcases/kernel/syscalls/access/access02.c
@@ -1,20 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   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
+ *   Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
@@ -28,7 +14,7 @@
  *  As well as verify that, these test files can be
  *  stat/read/written/executed indeed as root and nobody respectively.
  *
- *	07/2001 Ported by Wayne Boyera
+ * Ported to LTP: Wayne Boyer
  *	06/2016 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
  */
 
diff --git a/testcases/kernel/syscalls/access/access03.c b/testcases/kernel/syscalls/access/access03.c
index 13ee15f..612256c 100644
--- a/testcases/kernel/syscalls/access/access03.c
+++ b/testcases/kernel/syscalls/access/access03.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 /*
diff --git a/testcases/kernel/syscalls/access/access04.c b/testcases/kernel/syscalls/access/access04.c
index 401a348..328be1b 100644
--- a/testcases/kernel/syscalls/access/access04.c
+++ b/testcases/kernel/syscalls/access/access04.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2013 Fujitsu Ltd.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -31,7 +19,7 @@
  *  6) access() fails with -1 return value and sets errno to EROFS
  *     if write permission was requested for files on a read-only file system.
  *
- *  07/2001 Ported by Wayne Boyer
+ * Ported to LTP: Wayne Boyer
  *  11/2013 Ported by Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
  *  11/2016 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
  */
@@ -122,7 +110,6 @@
 
 static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(tcases),
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.forks_child = 1,
 	.needs_rofs = 1,
diff --git a/testcases/kernel/syscalls/acct/.gitignore b/testcases/kernel/syscalls/acct/.gitignore
index c2fb156..08a8975 100644
--- a/testcases/kernel/syscalls/acct/.gitignore
+++ b/testcases/kernel/syscalls/acct/.gitignore
@@ -1 +1,3 @@
 /acct01
+/acct02
+/acct02_helper
diff --git a/testcases/kernel/syscalls/acct/acct01.c b/testcases/kernel/syscalls/acct/acct01.c
index f58e025..c161d2a 100644
--- a/testcases/kernel/syscalls/acct/acct01.c
+++ b/testcases/kernel/syscalls/acct/acct01.c
@@ -91,12 +91,6 @@
 	memset(nametoolong, 'a', PATH_MAX+1);
 }
 
-static void cleanup(void)
-{
-	SAFE_UNLINK(TEST_TMPFILE);
-	SAFE_UNLINK(TEST_ELOOP);
-}
-
 static void verify_acct(unsigned int nr)
 {
 	struct test_case *tcase = &tcases[nr];
@@ -126,11 +120,9 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.mntpoint = "mntpoint",
 	.needs_rofs = 1,
 	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
-	.cleanup = cleanup,
 	.test = verify_acct,
 };
diff --git a/testcases/kernel/syscalls/acct/acct02.c b/testcases/kernel/syscalls/acct/acct02.c
new file mode 100644
index 0000000..2f1290f
--- /dev/null
+++ b/testcases/kernel/syscalls/acct/acct02.c
@@ -0,0 +1,269 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ *  Copyright (c) SUSE LLC, 2019
+ *  Author: Christian Amann <camann@suse.com>
+ */
+/*
+ * This tests if the kernel writes correct data to the
+ * process accounting file.
+ *
+ * First, system-wide process accounting is turned on and the output gets
+ * directed to a defined file. After that a dummy program is run in order
+ * to generate data and the process accounting gets turned off again.
+ *
+ * To verify the written data, the entries of the accounting file get
+ * parsed into the corresponding acct structure. Since it cannot be guaranteed
+ * that only the command issued by this test gets written into the accounting
+ * file, the contents get parsed until the correct entry is found, or EOF
+ * is reached.
+ *
+ * This is also accidental regression test for:
+ * 4d9570158b626 kernel/acct.c: fix the acct->needcheck check in check_free_space()
+ */
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include "tst_kconfig.h"
+#include "tst_test.h"
+#include "lapi/acct.h"
+
+#define COMMAND		"acct02_helper"
+#define OUTPUT_FILE	"acct_file"
+
+#define UNPACK(x) ((x & 0x1fff) << (((x >> 13) & 0x7) * 3))
+#define ACCT_MEMBER(x) (v3 ? ((struct acct_v3 *)acc)->x : ((struct acct *)acc)->x)
+#define ACCT_MEMBER_V3(x) (((struct acct_v3 *)acc)->x)
+
+static int fd;
+static int v3;
+static int acct_size;
+static int clock_ticks;
+static unsigned int rc;
+static unsigned int start_time;
+
+static union acct_union {
+	struct acct	v0;
+	struct acct_v3	v3;
+} acct_struct;
+
+static int acct_version_is_3(void)
+{
+	const char *kconfig_acct_v3[] = {
+		"CONFIG_BSD_PROCESS_ACCT_V3",
+		NULL
+	};
+
+	struct tst_kconfig_res results[1];
+
+	tst_kconfig_read(kconfig_acct_v3, results, 1);
+
+	return results[0].match == 'y';
+}
+
+static void run_command(void)
+{
+	const char *const cmd[] = {COMMAND, NULL};
+
+	rc = tst_run_cmd(cmd, NULL, NULL, 1) << 8;
+}
+
+static int verify_acct(void *acc, int elap_time)
+{
+	int sys_time  = UNPACK(ACCT_MEMBER(ac_stime));
+	int user_time = UNPACK(ACCT_MEMBER(ac_stime));
+	unsigned int btime_diff;
+	int ret = 0;
+	float tmp2;
+
+	if (strcmp(ACCT_MEMBER(ac_comm), COMMAND)) {
+		tst_res(TINFO, "ac_comm != '%s' ('%s')", COMMAND,
+			ACCT_MEMBER(ac_comm));
+		ret = 1;
+	}
+
+	if (start_time > ACCT_MEMBER(ac_btime))
+		btime_diff = start_time - ACCT_MEMBER(ac_btime);
+	else
+		btime_diff = ACCT_MEMBER(ac_btime) - start_time;
+
+	if (btime_diff > 7200) {
+		tst_res(TINFO, "ac_btime_diff %u", btime_diff);
+		ret = 1;
+	}
+
+	if (ACCT_MEMBER(ac_uid) != getuid()) {
+		tst_res(TINFO, "ac_uid != %d (%d)", getuid(),
+			ACCT_MEMBER(ac_uid));
+		ret = 1;
+	}
+
+	if (ACCT_MEMBER(ac_gid) != getgid()) {
+		tst_res(TINFO, "ac_gid != %d (%d)", getgid(),
+			ACCT_MEMBER(ac_gid));
+		ret = 1;
+	}
+
+	tmp2 = user_time/clock_ticks;
+	if (tmp2 > 1) {
+		tst_res(TINFO, "user_time/clock_ticks > 1 (%d/%d: %.2f)",
+			user_time, clock_ticks, tmp2);
+		ret = 1;
+	}
+
+	tmp2 = sys_time/clock_ticks;
+	if (tmp2 > 1) {
+		tst_res(TINFO, "sys_time/clock_ticks > 1 (%d/%d: %.2f)",
+			sys_time, clock_ticks, tmp2);
+		ret = 1;
+	}
+
+	tmp2 = elap_time/clock_ticks;
+	if (tmp2 >= 2) {
+		tst_res(TINFO, "elap_time/clock_ticks >= 2 (%d/%d: %.2f)",
+			elap_time, clock_ticks, tmp2);
+		ret = 1;
+	}
+
+	if (ACCT_MEMBER(ac_exitcode) != rc) {
+		tst_res(TINFO, "ac_exitcode != %d (%d)", rc,
+			ACCT_MEMBER(ac_exitcode));
+		ret = 1;
+	}
+	if (!v3)
+		return ret;
+
+	if (ACCT_MEMBER_V3(ac_ppid) != (uint32_t)getpid()) {
+		tst_res(TINFO, "ac_ppid != %d (%d)", (uint32_t)getpid(),
+			ACCT_MEMBER_V3(ac_ppid));
+		ret = 1;
+	}
+
+	if (ACCT_MEMBER_V3(ac_version) != (3 | ACCT_BYTEORDER)) {
+		tst_res(TINFO, "ac_version != 3 (%d)",
+			ACCT_MEMBER_V3(ac_version));
+		ret = 1;
+	}
+
+	if (ACCT_MEMBER_V3(ac_pid) < 1) {
+		tst_res(TINFO, "ac_pid < 1 (%d)", ACCT_MEMBER_V3(ac_pid));
+		ret = 1;
+	}
+	return ret;
+}
+
+static void run(void)
+{
+	int read_bytes, ret;
+	int entry_count = 0, i = 0;
+
+	fd = SAFE_OPEN(OUTPUT_FILE, O_RDWR | O_CREAT, 0644);
+
+	TEST(acct(OUTPUT_FILE));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "Could not set acct output file");
+
+	start_time = time(NULL);
+	run_command();
+	acct(NULL);
+
+	do {
+		read_bytes = SAFE_READ(0, fd, &acct_struct, acct_size);
+
+		if (i == 0 && read_bytes == 0) {
+			tst_res(TFAIL, "acct file is empty");
+			goto exit;
+		}
+
+		if (read_bytes == 0) {
+			tst_res(TFAIL, "end of file reached");
+			goto exit;
+		}
+
+		if (read_bytes != acct_size) {
+			tst_res(TFAIL, "incomplete read %i bytes, expected %i",
+			        read_bytes, acct_size);
+			goto exit;
+		}
+
+		tst_res(TINFO, "== entry %d ==", ++i);
+
+		if (v3)
+			ret = verify_acct(&acct_struct.v3, acct_struct.v3.ac_etime);
+		else
+			ret = verify_acct(&acct_struct.v0, UNPACK(acct_struct.v0.ac_etime));
+
+		if (read_bytes)
+			entry_count++;
+	} while (read_bytes == acct_size && ret);
+
+	tst_res(TINFO, "Number of accounting file entries tested: %d",
+			entry_count);
+
+	if (ret)
+		tst_res(TFAIL, "acct() wrote incorrect file contents!");
+	else
+		tst_res(TPASS, "acct() wrote correct file contents!");
+
+exit:
+	SAFE_CLOSE(fd);
+}
+
+static void setup(void)
+{
+	struct statfs buf;
+
+	clock_ticks = SAFE_SYSCONF(_SC_CLK_TCK);
+
+	SAFE_STATFS(".", &buf);
+
+	float avail = (100.00 * buf.f_bavail) / buf.f_blocks;
+
+	/* The accounting data are silently discarded on nearly FS */
+	if (avail < 4.1) {
+		tst_brk(TCONF,
+			"Less than 4.1%% (%.2f) of free space on filesystem",
+			avail);
+	}
+
+	TEST(acct(NULL));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO,
+			"acct() system call returned with error");
+
+	v3 = acct_version_is_3();
+	if (v3) {
+		tst_res(TINFO, "Verifying using 'struct acct_v3'");
+		acct_size = sizeof(struct acct_v3);
+	} else {
+		tst_res(TINFO, "Verifying using 'struct acct'");
+		acct_size = sizeof(struct acct);
+	}
+}
+
+static void cleanup(void)
+{
+	if (fd > 0)
+		SAFE_CLOSE(fd);
+	acct(NULL);
+}
+
+static const char *kconfigs[] = {
+	"CONFIG_BSD_PROCESS_ACCT",
+	NULL
+};
+
+static struct tst_test test = {
+	.test_all = run,
+	.needs_kconfigs = kconfigs,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "4d9570158b626"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/acct/acct02_helper.c b/testcases/kernel/syscalls/acct/acct02_helper.c
new file mode 100644
index 0000000..66017cb
--- /dev/null
+++ b/testcases/kernel/syscalls/acct/acct02_helper.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ *  Copyright (c) SUSE LLC, 2019
+ *  Author: Christian Amann <camann@suse.com>
+ */
+/*
+ * Dummy program used in acct02
+ */
+
+#include <unistd.h>
+
+int main(void)
+{
+	sleep(1);
+	return 128;
+}
diff --git a/testcases/kernel/syscalls/add_key/add_key01.c b/testcases/kernel/syscalls/add_key/add_key01.c
index e19cfe7..4fe97da 100644
--- a/testcases/kernel/syscalls/add_key/add_key01.c
+++ b/testcases/kernel/syscalls/add_key/add_key01.c
@@ -1,27 +1,10 @@
-/******************************************************************************
- * Copyright (c) Crackerjack Project., 2007				      *
- *									      *
- * 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           *
- *									      *
- ******************************************************************************/
-
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Basic test for the add_key() syscall.
+ * Copyright (c) Crackerjack Project., 2007
+ * Porting from Crackerjack to LTP is done by
+ * Manas Kumar Nayak maknayak@in.ibm.com>
  *
- * History:   Porting from Crackerjack to LTP is done by
- *	      Manas Kumar Nayak maknayak@in.ibm.com>
+ * Basic test for the add_key() syscall.
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/add_key/add_key02.c b/testcases/kernel/syscalls/add_key/add_key02.c
index 6d19ff2..159234f 100644
--- a/testcases/kernel/syscalls/add_key/add_key02.c
+++ b/testcases/kernel/syscalls/add_key/add_key02.c
@@ -1,24 +1,8 @@
-/******************************************************************************
- * Copyright (c) Crackerjack Project., 2007				      *
- * Copyright (c) 2017 Google, Inc.                                            *
- *									      *
- * 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           *
- *									      *
- ******************************************************************************/
-
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
+ * Copyright (c) Crackerjack Project., 2007
+ * Copyright (c) 2017 Google, Inc.
+ *
  * Test that the add_key() syscall correctly handles a NULL payload with nonzero
  * length.  Specifically, it should fail with EFAULT rather than oopsing the
  * kernel with a NULL pointer dereference or failing with EINVAL, as it did
@@ -99,4 +83,9 @@
 static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(tcases),
 	.test = verify_add_key,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "5649645d725c"},
+		{"CVE", "2017-15274"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/add_key/add_key03.c b/testcases/kernel/syscalls/add_key/add_key03.c
index 95ac2ee..d26912c 100644
--- a/testcases/kernel/syscalls/add_key/add_key03.c
+++ b/testcases/kernel/syscalls/add_key/add_key03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -95,4 +83,8 @@
 static struct tst_test test = {
 	.test_all = do_test,
 	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "237bbd29f7a0"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/add_key/add_key04.c b/testcases/kernel/syscalls/add_key/add_key04.c
index 1872cd5..aa02fdd 100644
--- a/testcases/kernel/syscalls/add_key/add_key04.c
+++ b/testcases/kernel/syscalls/add_key/add_key04.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -44,6 +32,10 @@
 
 #define ASSOC_ARRAY_FAN_OUT 16
 
+#define PAYLOAD "payload"
+
+static char *payload;
+
 static void do_test(void)
 {
 	int status;
@@ -54,7 +46,6 @@
 
 	if (SAFE_FORK() == 0) {
 		char description[32];
-		const char payload[] = "payload";
 		int i;
 
 		for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) {
@@ -67,7 +58,7 @@
 			}
 		}
 
-		TEST(add_key("user", "userkey", payload, sizeof(payload),
+		TEST(add_key("user", "userkey", payload, sizeof(PAYLOAD),
 			     KEY_SPEC_SESSION_KEYRING));
 		if (TST_RET < 0)
 			tst_brk(TBROK | TTERRNO, "unable to create user key");
@@ -84,7 +75,18 @@
 		tst_brk(TBROK, "Child %s", tst_strstatus(status));
 }
 
+static void setup(void)
+{
+	payload = tst_strdup(PAYLOAD);
+}
+
 static struct tst_test test = {
+	.setup = setup,
 	.test_all = do_test,
 	.forks_child = 1,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-12193"},
+		{"linux-git", "ea6789980fda"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/adjtimex/adjtimex01.c b/testcases/kernel/syscalls/adjtimex/adjtimex01.c
index 295ed6d..60b3544 100644
--- a/testcases/kernel/syscalls/adjtimex/adjtimex01.c
+++ b/testcases/kernel/syscalls/adjtimex/adjtimex01.c
@@ -1,112 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0
+
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
 
-/*
-  AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
-  EXECUTED BY: root / superuser
-
-  TEST ITEMS:
-   1. Check to see if adjtimex succeed with mode combination :
-      ADJ_OFFSET | ADJ_FREQUENCY | ADJ_MAXERROR | ADJ_ESTERROR |
-      ADJ_STATUS | ADJ_TIMECONST | ADJ_TICK
-   2. Check to see if adjtimex succeed with mode ADJ_OFFSET_SINGLESHOT
-*/
-
-#if defined UCLINUX && !__THROW
-/* workaround for libc bug causing failure in sys/timex.h */
-#define __THROW
-#endif
-
 #include <errno.h>
 #include <sys/timex.h>
-#include "test.h"
+#include "tst_test.h"
 
 #define SET_MODE (ADJ_OFFSET | ADJ_FREQUENCY | ADJ_MAXERROR | ADJ_ESTERROR | \
 	ADJ_STATUS | ADJ_TIMECONST | ADJ_TICK)
 
-static void setup(void);
-static void cleanup(void);
+static struct timex *tim_save;
+static struct timex *buf;
 
-char *TCID = "adjtimex01";
-int TST_TOTAL = 2;
-
-static struct timex tim_save;
-
-int main(int ac, char **av)
+void verify_adjtimex(void)
 {
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/* Call adjtimex(2) */
-		tim_save.modes = SET_MODE;
-
-		TEST(adjtimex(&tim_save));
-
-		if ((TEST_RETURN >= 0) && (TEST_RETURN <= 5)) {
-			tst_resm(TPASS, "adjtimex() with mode %u returned %ld",
-				 SET_MODE, TEST_RETURN);
-		} else {
-			tst_resm(TFAIL | TTERRNO,
-				"Test Failed, adjtimex() with mode %u "
-				"returned %ld", SET_MODE, TEST_RETURN);
-		}
-
-		/* Call adjtimex(2) */
-		tim_save.modes = ADJ_OFFSET_SINGLESHOT;
-
-		TEST(adjtimex(&tim_save));
-
-		if ((TEST_RETURN >= 0) && (TEST_RETURN <= 5)) {
-			tst_resm(TPASS, "adjtimex() with mode %u returned %ld",
-				 ADJ_OFFSET_SINGLESHOT, TEST_RETURN);
-		} else {
-			tst_resm(TFAIL | TTERRNO,
-				"Test Failed, adjtimex() with mode %u returned "
-				"%ld", ADJ_OFFSET_SINGLESHOT, TEST_RETURN);
-		}
+	*buf = *tim_save;
+	buf->modes = SET_MODE;
+	TEST(adjtimex(buf));
+	if ((TST_RET >= TIME_OK) && (TST_RET <= TIME_ERROR)) {
+		tst_res(TPASS, "adjtimex() with mode 0x%x ", SET_MODE);
+	} else {
+		tst_res(TFAIL | TTERRNO, "adjtimex() with mode 0x%x ",
+				SET_MODE);
 	}
 
-	cleanup();
-
-	tst_exit();
+	buf->modes = ADJ_OFFSET_SINGLESHOT;
+	TEST(adjtimex(buf));
+	if ((TST_RET >= TIME_OK) && (TST_RET <= TIME_ERROR)) {
+		tst_res(TPASS, "adjtimex() with mode 0x%x ",
+				ADJ_OFFSET_SINGLESHOT);
+	} else {
+		tst_res(TFAIL | TTERRNO,
+				"adjtimex() with mode 0x%x ",
+				ADJ_OFFSET_SINGLESHOT);
+	}
 }
 
 static void setup(void)
 {
-	tst_require_root();
+	tim_save->modes = 0;
 
-	tim_save.modes = 0;
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	/* Save current parameters in tim_save */
-	if ((adjtimex(&tim_save)) == -1)
-		tst_brkm(TBROK | TERRNO, cleanup,
-			 "failed to save current parameters");
+	/* Save current parameters */
+	if ((adjtimex(tim_save)) == -1) {
+		tst_brk(TBROK | TERRNO,
+			"adjtimex(): failed to save current params");
+	}
 }
 
-static void cleanup(void)
-{
-}
+static struct tst_test test = {
+	.needs_root = 1,
+	.setup = setup,
+	.test_all = verify_adjtimex,
+	.bufs = (struct tst_buffers []) {
+		{&buf, .size = sizeof(*buf)},
+		{&tim_save, .size = sizeof(*tim_save)},
+		{},
+	}
+};
diff --git a/testcases/kernel/syscalls/adjtimex/adjtimex02.c b/testcases/kernel/syscalls/adjtimex/adjtimex02.c
index 492225f..19ee971 100644
--- a/testcases/kernel/syscalls/adjtimex/adjtimex02.c
+++ b/testcases/kernel/syscalls/adjtimex/adjtimex02.c
@@ -1,274 +1,124 @@
+// SPDX-License-Identifier: GPL-2.0
+
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ *  AUTHOR : Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: adjtimex02
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: Tests for error conditions
- *
- *    TEST CASE TOTAL	: 6
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	Verify that
- *	1) adjtimex(2) fails with errno set to EFAULT if buf does
- *	   not point to writable memory
- *	2) adjtimex(2) fails with errno set to EINVAL if an attempt
- *	   is  made  to set buf.tick to a value < 900000/HZ
- *	3) adjtimex(2) fails with errno set to EINVAL if an attempt
- *	   is  made  to set buf.tick to a value > 1100000/HZ
- *	4) adjtimex(2) fails with errno set to EINVAL if an attempt
- *	   is  made  to set buf.offset to a value > 512000L
- *	   (This test case will be executed only if the kernel version
- *	    is 2.6.25 or below)
- *	5) adjtimex(2) fails with errno set to EINVAL if an attempt
- *	   is  made  to set buf.offset to a value < 512000L
- *	   (This test case will be executed only if the kernel version
- *	    is 2.6.25 or below)
- *	6) adjtimex(2) fails with errno set to EPERM if buf.mode is
- *	   non-zero and the user is not super-user.
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *	  Save current parameters in tim_save
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	  Call test case specific setup if needed
- * 	  call adjtimex with saved timex structure
- *	  Check return value is between 0 & 5
- *		Test passed
- *	  Otherwise
- *		Test failed
- *	  Call test case specific cleanup if needed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * adjtimex02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- *
- ****************************************************************/
-
-#if defined UCLINUX && !__THROW
-/* workaround for libc bug causing failure in sys/timex.h */
-#define __THROW
-#endif
 
 #include <errno.h>
 #include <sys/timex.h>
 #include <unistd.h>
 #include <pwd.h>
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
 #define SET_MODE ( ADJ_OFFSET | ADJ_FREQUENCY | ADJ_MAXERROR | ADJ_ESTERROR | \
 	ADJ_STATUS | ADJ_TIMECONST | ADJ_TICK )
 
-static void setup(void);
-static int setup2(void);
-static int setup3(void);
-static int setup4(void);
-static int setup5(void);
-static int setup6(void);
-static void cleanup(void);
-static void cleanup6(void);
-
-char *TCID = "adjtimex02";
-
 static int hz;			/* HZ from sysconf */
 
-static struct timex tim_save;
-static struct timex buff;
+static struct timex *tim_save;
+static struct timex *buf;
 
-static char nobody_uid[] = "nobody";
-struct passwd *ltpuser;
+static struct passwd *ltpuser;
 
-struct test_cases_t {
-	struct timex *buffp;
-	int (*setup) ();
-	void (*cleanup) ();
-	int exp_errno;
-} test_cases[] = {
-#ifndef UCLINUX
-	/* Skip since uClinux does not implement memory protection */
-	{
-	(struct timex *)-1, NULL, NULL, EFAULT},
-#endif
-	{
-	&buff, setup2, NULL, EINVAL}, {
-	&buff, setup3, NULL, EINVAL}, {
-	&buff, setup4, NULL, EINVAL}, {
-	&buff, setup5, NULL, EINVAL}, {
-	&buff, setup6, cleanup6, EPERM}
-};
-
-int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-
-int main(int ac, char **av)
+static void verify_adjtimex(unsigned int nr)
 {
+	struct timex *bufp;
+	int expected_errno = 0;
 
-	int lc, i;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; ++i) {
-			/*
-			 * since Linux 2.6.26, if buf.offset value is outside
-			 * the acceptable range, it is simply normalized instead
-			 * of letting the syscall fail. so just skip this test
-			 * case.
-			 */
-			if ((i == 3 || i == 4) && tst_kvercmp(2, 6, 25) > 0) {
-				tst_resm(TCONF, "this kernel normalizes buf."
-					 "offset value if it is outside"
-					 " the acceptable range.");
-				continue;
-			}
-
-			buff = tim_save;
-			buff.modes = SET_MODE;
-			if ((test_cases[i].setup) && (test_cases[i].setup())) {
-				tst_resm(TWARN, "setup() failed, skipping"
-					 " this test case");
-				continue;
-			}
-
-			/* Call adjtimex(2) */
-			TEST(adjtimex(test_cases[i].buffp));
-
-			if ((TEST_RETURN == -1) && (TEST_ERRNO ==
-						    test_cases[i].exp_errno)) {
-				tst_resm(TPASS | TTERRNO,
-					 "Test Passed, adjtimex() returned -1");
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "Test Failed, adjtimex() returned %ld",
-					 TEST_RETURN);
-			}
-			if (test_cases[i].cleanup) {
-				test_cases[i].cleanup();
-			}
-		}
+	/*
+	 * since Linux 2.6.26, if buf.offset value is outside
+	 * the acceptable range, it is simply normalized instead
+	 * of letting the syscall fail. so just skip this test
+	 * case.
+	 */
+	if (nr > 3 && (tst_kvercmp(2, 6, 25) > 0)) {
+		tst_res(TCONF, "this kernel normalizes buf."
+				"offset value if it is outside"
+				" the acceptable range.");
+		return;
 	}
 
-	/* cleanup and exit */
-	cleanup();
+	*buf = *tim_save;
+	buf->modes = SET_MODE;
+	bufp = buf;
+	switch (nr) {
+	case 0:
+		bufp = (struct timex *)-1;
+		expected_errno = EFAULT;
+		break;
+	case 1:
+		buf->tick = 900000 / hz - 1;
+		expected_errno = EINVAL;
+		break;
+	case 2:
+		buf->tick = 1100000 / hz + 1;
+		expected_errno = EINVAL;
+		break;
+	case 3:
+		/* Switch to nobody user for correct error code collection */
+		ltpuser = SAFE_GETPWNAM("nobody");
+		SAFE_SETEUID(ltpuser->pw_uid);
+		expected_errno = EPERM;
+		break;
+	case 4:
+		buf->offset = 512000L + 1;
+		expected_errno = EINVAL;
+		break;
+	case 5:
+		buf->offset = (-1) * (512000L) - 1;
+		expected_errno = EINVAL;
+		break;
+	default:
+		tst_brk(TFAIL, "Invalid test case %u ", nr);
+	}
 
-	tst_exit();
+	TEST(adjtimex(bufp));
+	if ((TST_RET == -1) && (TST_ERR == expected_errno)) {
+		tst_res(TPASS | TTERRNO,
+				"adjtimex() error %u ", expected_errno);
+	} else {
+		tst_res(TFAIL | TTERRNO,
+				"Test Failed, adjtimex() returned %ld",
+				TST_RET);
+	}
 
+	/* clean up after ourselves */
+	if (nr == 3)
+		SAFE_SETEUID(0);
 }
 
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
+static void setup(void)
 {
-	tst_require_root();
-
-	tim_save.modes = 0;
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
+	tim_save->modes = 0;
 
 	/* set the HZ from sysconf */
-	hz = SAFE_SYSCONF(NULL, _SC_CLK_TCK);
+	hz = SAFE_SYSCONF(_SC_CLK_TCK);
 
-	TEST_PAUSE;
-
-	/* Save current parameters in tim_save */
-	if ((adjtimex(&tim_save)) == -1) {
-		tst_brkm(TBROK, NULL, "Failed to save current parameters");
-	}
+	/* Save current parameters */
+	if ((adjtimex(tim_save)) == -1)
+		tst_brk(TBROK | TERRNO,
+			"adjtimex(): failed to save current params");
 }
 
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
+static void cleanup(void)
 {
+	tim_save->modes = SET_MODE;
 
-	tim_save.modes = SET_MODE;
 	/* Restore saved parameters */
-	if ((adjtimex(&tim_save)) == -1) {
-		tst_resm(TWARN, "Failed to restore saved parameters");
+	if ((adjtimex(tim_save)) == -1)
+		tst_res(TWARN, "Failed to restore saved parameters");
+}
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.tcnt = 6,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_adjtimex,
+	.bufs = (struct tst_buffers []) {
+		{&buf, .size = sizeof(*buf)},
+		{&tim_save, .size = sizeof(*tim_save)},
+		{},
 	}
-}
-
-int setup2(void)
-{
-	buff.tick = 900000 / hz - 1;
-	return 0;
-}
-
-int setup3(void)
-{
-	buff.tick = 1100000 / hz + 1;
-	return 0;
-}
-
-int setup4(void)
-{
-	buff.offset = 512000L + 1;
-	return 0;
-}
-
-int setup5(void)
-{
-	buff.offset = (-1) * (512000L) - 1;
-	return 0;
-}
-
-int setup6(void)
-{
-	/* Switch to nobody user for correct error code collection */
-	if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
-		tst_brkm(TBROK, NULL, "\"nobody\" user not present");
-	}
-	if (seteuid(ltpuser->pw_uid) == -1) {
-		tst_resm(TWARN | TERRNO, "seteuid(%d) failed", ltpuser->pw_uid);
-		return 1;
-	}
-	return 0;
-}
-
-void cleanup6(void)
-{
-	/* Set effective user id back to root */
-	SAFE_SETEUID(cleanup, 0);
-}
+};
diff --git a/testcases/kernel/syscalls/alarm/alarm05.c b/testcases/kernel/syscalls/alarm/alarm05.c
index acb43c9..c60f989 100644
--- a/testcases/kernel/syscalls/alarm/alarm05.c
+++ b/testcases/kernel/syscalls/alarm/alarm05.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001,2005
- *	07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001,2005
+ * Ported to LTP: Wayne Boyer
  *	06/2005 Test for alarm cleanup by Amos Waterland
  *
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/alarm/alarm06.c b/testcases/kernel/syscalls/alarm/alarm06.c
index b9e0f83..eee9429 100644
--- a/testcases/kernel/syscalls/alarm/alarm06.c
+++ b/testcases/kernel/syscalls/alarm/alarm06.c
@@ -1,33 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
- * Test Description:
- *  Check the functionality of the Alarm system call when the time input
- *  parameter is zero.
+ * Check the functionality of the Alarm system call when the time input
+ * parameter is zero.
  *
  * Expected Result:
- *  The previously specified alarm request should be cancelled and the
- *  SIGALRM should not be received.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
+ * The previously specified alarm request should be cancelled and the
+ * SIGALRM should not be received.
  */
 
 #include <stdio.h>
diff --git a/testcases/kernel/syscalls/asyncio/.gitignore b/testcases/kernel/syscalls/asyncio/.gitignore
deleted file mode 100644
index 35f65a6..0000000
--- a/testcases/kernel/syscalls/asyncio/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/asyncio02
diff --git a/testcases/kernel/syscalls/asyncio/Makefile b/testcases/kernel/syscalls/asyncio/Makefile
deleted file mode 100644
index bd617d8..0000000
--- a/testcases/kernel/syscalls/asyncio/Makefile
+++ /dev/null
@@ -1,23 +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 St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/asyncio/asyncio02.c b/testcases/kernel/syscalls/asyncio/asyncio02.c
deleted file mode 100644
index e532cc2..0000000
--- a/testcases/kernel/syscalls/asyncio/asyncio02.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id: asyncio02.c,v 1.6 2009/08/28 11:17:39 vapier Exp $ */
-/************************************************************
- * OS Test - Silicon Graphics, Inc.
- * Mendota Heights, Minnesota
- *
- * TEST IDENTIFIER:  aiotcs02:  write/close flushes data to the file
- *
- * PARENT DOCUMENT:  aiotds01:  kernel i/o
- *
- * AUTHOR: Barrie Kletscher
- *
- * CO-PILOT: Dave Baumgartner
- *
- * TEST ITEMS:
- * 	for each open flags set used:
- * 	1. Multiple writes to a file work as specified for
- * 	   more than BUFSIZ bytes.
- * 	2. Multiple writes to a file work as specified for
- * 	   BUFSIZ bytes.
- * 	3. Multiple writes to a file work as specified for
- * 	   lower than BUFSIZ bytes.
- *
- * INPUT SPECIFICATIONS:
- * 	Standard parse_opts supported options.
- *$
- * OUTPUT SPECIFICATIONS
- * 	Standard tst_res output format
- *
- * ENVIRONMENTAL NEEDS:
- * 	This program uses the environment variable TMPDIR for the location
- * 	of the temporary directory.
- *
- *
- * SPECIAL PROCEDURAL REQUIREMENTS:
- * 	The program must be linked with tst_*.o and parse_opts.o.
- *
- * INTERCASE DEPENDENCIES:
- * 	NONE.
- *
- * DETAILED DESCRIPTION:
- * 	Attempt to get some memory to work with.
- * 	Call testrun writing (BUFSIZ + 1) bytes
- * 	Call testrun writing BUFSIZ bytes
- * 	Repeated call to testrun() with decreasing write sizes
- * 		less than BUFSIZ
- * 	End
- *
- * 	Start testrun()
- * 	Attempt to open a temporary file.
- * 	Write the memory to the file.
- * 	Attempt to close the file which also flushes the buffers.
- * 	Now check to see if the number of bytes written is the
- * 		same as the number of bytes in the file.
- * 	Cleanup
- *
- * BUGS:
- * 	NONE.
- *
-************************************************************/
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/signal.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "test.h"
-#include "safe_macros.h"
-
-#define FLAG O_RDWR | O_CREAT | O_TRUNC	/* Flags used when opening temp tile */
-#define MODE  0777		/* Mode to open file with */
-#define WRITES 10		/* Number of times buffer is written */
-#define DECR 1000		/* Number of bytes decremented between */
-					/* Calls to testrun() */
-#define OK -1			/* Return value from testrun() */
-
-#define FNAME1	"aio02.1"
-#define FNAME2	"aio02.2"
-#define FNAME3	"aio02.3"
-
-#define ERR_MSG1 "Bytes in file not equal to bytes written."
-#define ERR_MSG2 "Bytes in file (%d) not equal to bytes written (%d)."
-
-char *dp;			/* pointer to area of memory */
-
-void setup();
-void cleanup();
-int testrun(int flag, int bytes, int ti);
-
-char *TCID = "asyncio02";
-int TST_TOTAL = 6;
-
-char *filename;			/* name of the temporary file */
-
-char *Progname;
-int Open_flags;
-
-int Flags[] = {
-	O_RDWR | O_CREAT | O_TRUNC,
-	O_RDWR | O_CREAT | O_TRUNC
-};
-
-int Num_flags;
-
-/***********************************************************************
- * MAIN
- ***********************************************************************/
-int main(int ac, char **av)
-{
-
-	int i;
-	int ret_val;
-	int eok;		/* everything is ok flag */
-	int lc;
-	int flag_cnt;
-
-	Num_flags = sizeof(Flags) / sizeof(int);
-	TST_TOTAL = 3 * Num_flags;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (flag_cnt = 0; flag_cnt < Num_flags; flag_cnt++) {
-
-			/*
-			 * call testrun writing (BUFSIZ + 1) byte chunks
-			 */
-
-			filename = FNAME1;
-			if (testrun(Flags[flag_cnt], BUFSIZ + 1, 1) != OK) {
-				tst_resm(TFAIL, ERR_MSG1);
-			} else {
-				tst_resm(TPASS,
-					 "More than BUFSIZE bytes multiple synchronous writes to a file check out ok");
-			}
-
-			/*
-			 * call testrun writing BUFSIZ byte chunks
-			 */
-
-			filename = FNAME2;
-			if (testrun(Flags[flag_cnt], BUFSIZ, 2) != OK) {
-				tst_resm(TFAIL, ERR_MSG1);
-			} else {
-				tst_resm(TPASS,
-					 "BUFSIZE bytes multiple synchronous writes to a file checks out ok");
-			}
-
-			/*
-			 * while the byte chunks are greater than 0
-			 *      call testrun() with decreasing chunk sizes
-			 */
-
-			filename = FNAME3;
-			eok = 1;
-			for (i = BUFSIZ - 1; i >= 0; i -= DECR) {
-				if ((ret_val =
-				     testrun(Flags[flag_cnt], i, 3)) != OK) {
-					tst_resm(TFAIL, ERR_MSG2, ret_val,
-						 i * WRITES);
-				}
-			}
-
-			if (eok) {
-				tst_resm(TPASS,
-					 "Less than BUFSIZE bytes multiple synchronous writes to a file checks out ok");
-			}
-		}
-	}
-	cleanup();
-	tst_exit();
-}				/* end main() */
-
-int testrun(int flag, int bytes, int ti)
-{
-
-	int fildes, i, ret;
-
-	struct stat buffer;	/* buffer of memory required for stat command */
-
-	/*
-	 *      Attempt to open a temporary file.
-	 */
-
-	if ((fildes = open(filename, flag, MODE)) == -1) {
-		tst_brkm(TBROK | TERRNO, cleanup, "open(%s) failed", filename);
-	}
-
-	/*
-	 *      Write the memory to the file.
-	 */
-
-	for (i = 0; i < WRITES; i++) {
-		TEST(write(fildes, dp, (unsigned)bytes));
-
-		if (TEST_RETURN == -1) {
-			tst_brkm(TBROK | TTERRNO, cleanup, "write() failed");
-		}
-	}			/* end for () */
-
-	/*
-	 *      Attempt to close the file which also flushes the buffers.
-	 */
-
-	SAFE_CLOSE(cleanup, fildes);
-
-	ret = OK;
-
-	/*
-	 *  Now check to see if the number of bytes written is the
-	 *  same as the number of bytes in the file.
-	 */
-
-	SAFE_STAT(cleanup, filename, &buffer);
-
-	if (buffer.st_size != (off_t) (bytes * WRITES)) {
-		ret = (int)buffer.st_size;
-	}
-
-	SAFE_UNLINK(cleanup, filename);
-
-	return ret;
-
-}				/* end testrun() */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void setup(void)
-{
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	/* create a temporary directory and go to it */
-	tst_tmpdir();
-
-	/*
-	 *  Attempt to get some memory to work with.
-	 */
-
-	if ((dp = malloc((unsigned)BUFSIZ + 1)) == NULL) {
-		tst_brkm(TBROK | TERRNO, cleanup, "malloc() failed");
-	}
-
-}
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- *              completion or premature exit.
- ***************************************************************/
-void cleanup(void)
-{
-
-	tst_rmdir();
-}
diff --git a/testcases/kernel/syscalls/bdflush/.gitignore b/testcases/kernel/syscalls/bdflush/.gitignore
deleted file mode 100644
index 54601ec..0000000
--- a/testcases/kernel/syscalls/bdflush/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bdflush01
diff --git a/testcases/kernel/syscalls/bdflush/Makefile b/testcases/kernel/syscalls/bdflush/Makefile
deleted file mode 100644
index 2ef86f0..0000000
--- a/testcases/kernel/syscalls/bdflush/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#  Copyright (c) International Business Machines  Corp., 2009
-#
-#  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 St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/bdflush/bdflush01.c b/testcases/kernel/syscalls/bdflush/bdflush01.c
deleted file mode 100644
index 1323cc4..0000000
--- a/testcases/kernel/syscalls/bdflush/bdflush01.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/******************************************************************************/
-/* Copyright (c) Crackerjack Project., 2007				   */
-/*									    */
-/* 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    */
-/*									    */
-/******************************************************************************/
-/******************************************************************************/
-/*									    */
-/* File:	bdflush01.c					    */
-/*									    */
-/* Description: bdflush() starts, flushes, or tunes the buffer-dirty-flush    */
-/*		daemon. Only a privileged process (one with the CAP_SYS_ADMIN */
-/*		capability) may call bdflush().				      */
-/*									      */
-/*		If func is negative or 0, and no daemon has been started,     */
-/*		then bdflush() enters the daemon code and never returns.      */
-/*									      */
-/*		If func is 1, some dirty buffers are written to disk.	      */
-/*		If func is 2 or more and is even (low bit is 0), then address */
-/*		is the address of a long word, and the tuning parameter       */
-/*		numbered (func-2)/2 is returned to the caller in that address.*/
-/*									      */
-/*		If func is 3 or more and is odd (low bit is 1), then data is  */
-/*		a long word, and the kernel sets tuning parameter numbered    */
-/*		(func-3)/2 to that value.				      */
-/*		    							      */
-/*		The set of parameters, their values, and their legal ranges   */
-/*		are defined in the kernel source file fs/buffer.c. 	      */
-/*									      */
-/*		Return Value:						      */
-/*		If func is negative or 0 and the daemon successfully starts,  */
-/*		bdflush() never returns. Otherwise, the return value is 0 on  */
-/*		success and -1 on failure, with errno set to indicate the     */
-/*		error.							      */
-/*									      */
-/*		Errors:							      */
-/*			EBUSY						      */
-/*			    An attempt was made to enter the daemon code after*/
-/*			    another process has already entered. 	      */
-/*			EFAULT						      */
-/*			   address points outside your accessible address     */
-/*			   space. 					      */
-/*			EINVAL						      */
-/*			    An attempt was made to read or write an invalid   */
-/*			    parameter number, or to write an invalid value to */
-/*			    a parameter. 				      */
-/*			EPERM						      */
-/*			    Caller does not have the CAP_SYS_ADMIN capability.*/
-/*									      */
-/* Usage:  <for command-line>						 */
-/* bdflush01 [-c n] [-e][-i n] [-I x] [-p x] [-t]		      */
-/*      where,  -c n : Run n copies concurrently.			     */
-/*	      -e   : Turn on errno logging.				 */
-/*	      -i n : Execute test n times.				  */
-/*	      -I x : Execute test for x seconds.			    */
-/*	      -P x : Pause for x seconds between iterations.		*/
-/*	      -t   : Turn on syscall timing.				*/
-/*									    */
-/* Total Tests: 1							     */
-/*									    */
-/* Test Name:   bdflush01					      */
-/* History:     Porting from Crackerjack to LTP is done by		    */
-/*	      Manas Kumar Nayak maknayak@in.ibm.com>			*/
-/******************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "lapi/syscalls.h"
-
-char *TCID = "bdflush01";
-int testno;
-int TST_TOTAL = 1;
-
-void cleanup(void)
-{
-	tst_rmdir();
-}
-
-void setup(void)
-{
-	TEST_PAUSE;
-	tst_tmpdir();
-}
-
-int main(int ac, char **av)
-{
-	long data;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	/*
-	 * TODO (garrcoop): add more functional testcases; there are a ton
-	 * missing.
-	 */
-	data = 0;
-	tst_count = 1;
-	for (testno = 0; testno < TST_TOTAL; ++testno) {
-		TEST(ltp_syscall(__NR_bdflush, 3, data));
-		if (TEST_RETURN == -1)
-			tst_brkm(TFAIL | TTERRNO, cleanup, "bdflush failed");
-		else
-			tst_resm(TPASS, "bdflush() = %ld", TEST_RETURN);
-	}
-	cleanup();
-	tst_exit();
-}
diff --git a/testcases/kernel/syscalls/bind/bind01.c b/testcases/kernel/syscalls/bind/bind01.c
index d2f50e8..2054996 100644
--- a/testcases/kernel/syscalls/bind/bind01.c
+++ b/testcases/kernel/syscalls/bind/bind01.c
@@ -1,43 +1,7 @@
-/*
- *
- *   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
- */
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
- * Test Name: bind01
- *
- * Test Description:
- *  Verify that bind() returns the proper errno for various failure cases
- *
- * Usage:  <for command-line>
- *  bind01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *	       -i n : Execute test n times.
- *	       -I x : Execute test for x seconds.
- *	       -P x : Pause for x seconds between iterations.
- *	       -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS:
- *  None.
- *
+ * Copyright (c) International Business Machines  Corp., 2001
  */
 
 #include <stdio.h>
@@ -51,108 +15,55 @@
 
 #include <netinet/in.h>
 
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
-char *TCID = "bind01";
-int testno;
+int inet_socket;
+int dev_null;
 
-int s;				/* socket descriptor */
 struct sockaddr_in sin1, sin2, sin3;
-struct sockaddr_un sun1;
+struct sockaddr_un sun;
 
-void setup(void), setup0(void), setup1(void), setup2(void),
-cleanup(void), cleanup0(void), cleanup1(void);
-
-struct test_case_t {		/* test case structure */
-	int domain;		/* PF_INET, PF_UNIX, ... */
-	int type;		/* SOCK_STREAM, SOCK_DGRAM ... */
-	int proto;		/* protocol number (usually 0 = default) */
-	struct sockaddr *sockaddr;	/* socket address buffer */
-	int salen;		/* bind's 3rd argument */
-	int retval;		/* syscall return value */
-	int experrno;		/* expected errno */
-	void (*setup) (void);
-	void (*cleanup) (void);
+static struct test_case {
+	int *socket_fd;
+	struct sockaddr *sockaddr;
+	socklen_t salen;
+	int retval;
+	int experrno;
 	char *desc;
-} tdat[] = {
-#ifndef UCLINUX
-/* Skip since uClinux does not implement memory protection */
-	{
-	PF_INET, SOCK_STREAM, 0, (struct sockaddr *)-1,
-		    sizeof(struct sockaddr_in), -1, EFAULT, setup0,
-		    cleanup0, "invalid sockaddr"},
-#endif
-	{
-	PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&sin1,
-		    3, -1, EINVAL, setup0, cleanup0, "invalid salen"}, {
-	0, 0, 0, (struct sockaddr *)&sin1,
-		    sizeof(sin1), -1, ENOTSOCK, setup1, cleanup1,
-		    "invalid socket"}
-	, {
-	PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&sin2,
-		    sizeof(sin2), 0, 0, setup0, cleanup0, "INADDR_ANYPORT"}
-	, {
-	PF_UNIX, SOCK_STREAM, 0, (struct sockaddr *)&sun1,
-		    sizeof(sun1), -1, EADDRINUSE, setup0, cleanup0,
-		    "UNIX-domain of current directory"}
-	, {
-	PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&sin3,
-		    sizeof(sin3), -1, EADDRNOTAVAIL, setup0, cleanup0,
-		    "non-local address"}
-,};
+} tcases[] = {
+	{ &inet_socket, (struct sockaddr *)&sin1, 3, -1,
+	  EINVAL, "invalid salen" },
+	{ &dev_null, (struct sockaddr *)&sin1, sizeof(sin1), -1,
+	  ENOTSOCK, "invalid socket" },
+	{ &inet_socket, (struct sockaddr *)&sin2, sizeof(sin2), 0,
+	  0, "INADDR_ANYPORT"},
+	{ &inet_socket, (struct sockaddr *)&sun, sizeof(sun), -1,
+	  EAFNOSUPPORT, "UNIX-domain of current directory" },
+	{ &inet_socket, (struct sockaddr *)&sin3, sizeof(sin3), -1,
+	  EADDRNOTAVAIL, "non-local address" },
+};
 
-int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
-
-int main(int argc, char *argv[])
+void verify_bind(unsigned int nr)
 {
-	int lc;
+	struct test_case *tcase = &tcases[nr];
 
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); ++lc) {
-		tst_count = 0;
-
-		for (testno = 0; testno < TST_TOTAL; ++testno) {
-			tdat[testno].setup();
-
-			TEST(bind
-			     (s, tdat[testno].sockaddr, tdat[testno].salen));
-			if (TEST_RETURN > 0) {
-				TEST_RETURN = 0;
-			} else {
-			}
-			if (TEST_RETURN != tdat[testno].retval ||
-			    (TEST_RETURN < 0 &&
-			     TEST_ERRNO != tdat[testno].experrno)) {
-				tst_resm(TFAIL, "%s ; returned"
-					 " %ld (expected %d), errno %d (expected"
-					 " %d)", tdat[testno].desc,
-					 TEST_RETURN, tdat[testno].retval,
-					 TEST_ERRNO, tdat[testno].experrno);
-			} else {
-				tst_resm(TPASS, "%s successful",
-					 tdat[testno].desc);
-			}
-			tdat[testno].cleanup();
-		}
+	TEST(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen));
+	if (TST_RET != tcase->retval && TST_ERR != tcase->experrno) {
+		tst_res(TFAIL, "%s ; returned"
+			" %ld (expected %d), errno %d (expected"
+			" %d)", tcase->desc, TST_RET, tcase->retval,
+			TST_ERR, tcase->experrno);
+	} else {
+		tst_res(TPASS, "%s successful", tcase->desc);
 	}
-	cleanup();
-
-	tst_exit();
 }
 
-void setup(void)
+void test_setup(void)
 {
-
-	TEST_PAUSE;		/* if -p option specified */
-
 	/* initialize sockaddr's */
 	sin1.sin_family = AF_INET;
 	/* this port must be unused! */
-	sin1.sin_port = TST_GET_UNUSED_PORT(NULL, AF_INET, SOCK_STREAM);
+	sin1.sin_port = TST_GET_UNUSED_PORT(AF_INET, SOCK_STREAM);
 	sin1.sin_addr.s_addr = INADDR_ANY;
 
 	sin2.sin_family = AF_INET;
@@ -164,35 +75,22 @@
 	/* assumes 10.255.254.253 is not a local interface address! */
 	sin3.sin_addr.s_addr = htonl(0x0AFFFEFD);
 
-	sun1.sun_family = AF_UNIX;
-	strncpy(sun1.sun_path, ".", sizeof(sun1.sun_path));
+	sun.sun_family = AF_UNIX;
+	strncpy(sun.sun_path, ".", sizeof(sun.sun_path));
 
+	inet_socket = SAFE_SOCKET(PF_INET, SOCK_STREAM, 0);
+	dev_null = SAFE_OPEN("/dev/null", O_WRONLY);
 }
 
-void cleanup(void)
+void test_cleanup(void)
 {
+	SAFE_CLOSE(inet_socket);
+	SAFE_CLOSE(dev_null);
 }
 
-void setup0(void)
-{
-	s = SAFE_SOCKET(cleanup, tdat[testno].domain, tdat[testno].type,
-		        tdat[testno].proto);
-}
-
-void cleanup0(void)
-{
-	(void)close(s);
-}
-
-void setup1(void)
-{
-	/* setup for the "not a socket" case */
-	if ((s = open("/dev/null", O_WRONLY)) == -1)
-		tst_brkm(TBROK | TERRNO, cleanup, "open(/dev/null) failed");
-
-}
-
-void cleanup1(void)
-{
-	s = -1;
-}
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = test_setup,
+	.cleanup = test_cleanup,
+	.test = verify_bind,
+};
diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c
index 90b0e9d..65944cb 100644
--- a/testcases/kernel/syscalls/bind/bind02.c
+++ b/testcases/kernel/syscalls/bind/bind02.c
@@ -1,146 +1,69 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
  *   Copyright (c) International Business Machines  Corp., 2004
- *
- *   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
- */
-
-/*
- * Test Name: bind02
- *
- * Test Description:
- *  Make sure bind() gives EACCESS error for (non-root) users.
- *
- * Usage:  <for command-line>
- *  bind01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
- *
- * HISTORY
  *      07/2004 Written by Dan Jones
  *      07/2004 Ported to LTP format by Robbie Williamson
- *
- * RESTRICTIONS:
- *  None.
- *
+ *   Copyright (c) 2019 Martin Doucha <mdoucha@suse.cz>
  */
 
-#include <stdio.h>
-#include <stdlib.h>
+/*
+ * Test Description:
+ *  Make sure bind() of privileged port gives EACCESS error for non-root users.
+ */
+
+#include <string.h>
 #include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
 #include <pwd.h>
 #include <grp.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/un.h>
-
 #include <netinet/in.h>
 
-#include "test.h"
+#include "tst_test.h"
 
-char *TCID = "bind02";
-int testno;
-int TST_TOTAL = 1;
+/* This port needs to be a privileged port */
+#define TCP_PRIVILEGED_PORT 463
+#define TEST_USERNAME "nobody"
 
-/* This port needs to be a Privledged port */
-#define TCP_PRIVLEGED_COM_PORT 463
-
-struct passwd *pw;
-struct group *gr;
-
-uid_t uid;
-gid_t gid;
-
-int rc;
-
-void try_bind(void)
+static void run(void)
 {
 	struct sockaddr_in servaddr;
-	int sockfd, r_value;
+	int sockfd;
 
-	// Set effective user/group
-	if ((rc = setegid(gid)) == -1) {
-		tst_brkm(TBROK | TERRNO, 0, "setegid(%u) failed", gid);
-	}
-	if ((rc = seteuid(uid)) == -1) {
-		tst_brkm(TBROK | TERRNO, 0, "seteuid(%u) failed", uid);
-	}
-
-	if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-		tst_brkm(TBROK | TERRNO, 0, "socket() failed");
-	}
-
+	sockfd = SAFE_SOCKET(AF_INET, SOCK_STREAM, 0);
 	memset(&servaddr, 0, sizeof(servaddr));
 	servaddr.sin_family = AF_INET;
-	servaddr.sin_port = htons(TCP_PRIVLEGED_COM_PORT);
+	servaddr.sin_port = htons(TCP_PRIVILEGED_PORT);
 	servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
-	r_value = bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
-	if (r_value) {
-		if (errno == EACCES) {
-			tst_resm(TPASS, "correct error");
-		} else {
-			tst_resm(TFAIL, "incorrect error, %d", r_value);
-		}
+	TEST(bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)));
+	SAFE_CLOSE(sockfd);
+
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "bind() returned %li, expected -1", TST_RET);
+	} else if (TST_ERR == EACCES) {
+		tst_res(TPASS | TTERRNO, "bind() failed as expected");
 	} else {
-		tst_resm(TFAIL, "user was able to bind successfully");
+		tst_res(TFAIL | TTERRNO, "Unexpected error");
 	}
-
-	close(sockfd);
-
-	// Set effective user/group
-	if ((rc = setegid(0)) == -1) {
-		tst_brkm(TBROK | TERRNO, 0, "setegid(0) reset failed");
-	}
-	if ((rc = seteuid(uid)) == -1) {
-		/* XXX: is this seteuid() correct !?  it isnt a reset if we
-		 *      made the same exact call above ...
-		 */
-		tst_brkm(TBROK | TERRNO, 0, "seteuid(%u) reset failed", uid);
-	}
-
 }
 
-int main(int argc, char *argv[])
+static void setup(void)
 {
-	char *username = "nobody";
+	struct passwd *pw;
+	struct group *gr;
 
-	tst_parse_opts(argc, argv, NULL, NULL);
+	pw = SAFE_GETPWNAM(TEST_USERNAME);
+	gr = SAFE_GETGRGID(pw->pw_gid);
 
-	tst_require_root();
-
-	if ((pw = getpwnam(username)) == NULL) {
-		tst_brkm(TBROK, 0, "Username - %s - not found", username);
-	}
-
-	if ((gr = getgrgid(pw->pw_gid)) == NULL) {
-		tst_brkm(TBROK | TERRNO, 0, "getgrgid(%u) failed", pw->pw_gid);
-	}
-
-	uid = pw->pw_uid;
-	gid = gr->gr_gid;
-
-	tst_resm(TINFO, "Socket will try to be bind by user: %s, group: %s",
-		 pw->pw_name, gr->gr_name);
-
-	try_bind();
-	tst_exit();
+	tst_res(TINFO, "Switching credentials to user: %s, group: %s",
+		pw->pw_name, gr->gr_name);
+	SAFE_SETEGID(gr->gr_gid);
+	SAFE_SETEUID(pw->pw_uid);
 }
+
+static struct tst_test test = {
+	.test_all = run,
+	.needs_root = 1,
+	.setup = setup,
+};
diff --git a/testcases/kernel/syscalls/bpf/.gitignore b/testcases/kernel/syscalls/bpf/.gitignore
new file mode 100644
index 0000000..3c33a84
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/.gitignore
@@ -0,0 +1,4 @@
+bpf_map01
+bpf_prog01
+bpf_prog02
+bpf_prog03
diff --git a/testcases/kernel/syscalls/bpf/Makefile b/testcases/kernel/syscalls/bpf/Makefile
new file mode 100644
index 0000000..990c8c8
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Linux Test Project
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+CFLAGS			+= -D_GNU_SOURCE
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/bpf/bpf_common.h b/testcases/kernel/syscalls/bpf/bpf_common.h
new file mode 100644
index 0000000..f700bed
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/bpf_common.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Linux Test Project
+ */
+
+#ifndef LTP_BPF_COMMON_H
+#define LTP_BPF_COMMON_H
+
+#define BPF_MEMLOCK_ADD (256*1024)
+
+void rlimit_bump_memlock(void)
+{
+	struct rlimit memlock_r;
+
+	SAFE_GETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
+	memlock_r.rlim_cur += BPF_MEMLOCK_ADD;
+	tst_res(TINFO, "Raising RLIMIT_MEMLOCK to %ld",
+		(long)memlock_r.rlim_cur);
+
+	if (memlock_r.rlim_cur <= memlock_r.rlim_max) {
+		SAFE_SETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
+	} else if ((geteuid() == 0)) {
+		memlock_r.rlim_max += BPF_MEMLOCK_ADD;
+		SAFE_SETRLIMIT(RLIMIT_MEMLOCK, &memlock_r);
+	} else {
+		tst_res(TINFO, "Can't raise RLIMIT_MEMLOCK, test may fail "
+			"due to lack of max locked memory");
+	}
+}
+
+int bpf_map_create(union bpf_attr *attr)
+{
+	TEST(bpf(BPF_MAP_CREATE, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		if (TST_ERR == EPERM) {
+			tst_res(TCONF, "Hint: check also /proc/sys/kernel/unprivileged_bpf_disabled");
+			tst_brk(TCONF | TTERRNO,
+				"bpf() requires CAP_SYS_ADMIN on this system");
+		} else {
+			tst_brk(TBROK | TTERRNO, "Failed to create array map");
+		}
+	}
+
+	return TST_RET;
+}
+
+#endif
diff --git a/testcases/kernel/syscalls/bpf/bpf_map01.c b/testcases/kernel/syscalls/bpf/bpf_map01.c
new file mode 100644
index 0000000..69473cd
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/bpf_map01.c
@@ -0,0 +1,155 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * Trivial Extended Berkeley Packet Filter (eBPF) test.
+ *
+ * Sanity check creating and updating maps.
+ */
+/*
+ * If test is executed in a loop and limit for locked memory (ulimit -l) is
+ * too low bpf() call can fail with EPERM due to deffered freeing.
+ */
+
+#include <limits.h>
+#include <string.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/bpf.h"
+#include "bpf_common.h"
+
+#define VAL_SZ 1024
+
+static void *key4;
+static void *key8;
+static char *val_set;
+static char *val_get;
+static union bpf_attr *attr;
+
+struct map_type {
+	uint32_t id;
+	char *name;
+	int key_size;
+	void **key;
+};
+
+static const struct map_type map_types[] = {
+	{BPF_MAP_TYPE_HASH, "hash", 8, &key8},
+	{BPF_MAP_TYPE_ARRAY, "array", 4, &key4}
+};
+
+void run(unsigned int n)
+{
+	int fd, i;
+	void *key = *map_types[n].key;
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_type = map_types[n].id;
+	attr->key_size = map_types[n].key_size;
+	attr->value_size = VAL_SZ;
+	attr->max_entries = 1;
+
+	fd = bpf_map_create(attr);
+	tst_res(TPASS, "Created %s map", map_types[n].name);
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = fd;
+	attr->key = ptr_to_u64(key);
+	attr->value = ptr_to_u64(val_get);
+
+	memset(val_get, 'x', VAL_SZ);
+
+	TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+
+	switch (map_types[n].id) {
+	case BPF_MAP_TYPE_HASH:
+		if (TST_RET != -1 || TST_ERR != ENOENT) {
+			tst_res(TFAIL | TTERRNO,
+				"Empty hash map lookup should fail with ENOENT");
+		} else {
+			tst_res(TPASS | TTERRNO, "Empty hash map lookup");
+		}
+	break;
+	case BPF_MAP_TYPE_ARRAY:
+		if (TST_RET != -1) {
+			for (i = 0; i < VAL_SZ; i++) {
+				if (val_get[i] != 0) {
+					tst_res(TFAIL,
+						"Preallocated array map val not zero");
+					break;
+				}
+			}
+			if (i < VAL_SZ)
+				tst_res(TPASS, "Preallocated array map lookup");
+		} else {
+			tst_res(TFAIL | TERRNO, "Prellocated array map lookup");
+		}
+	break;
+	}
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = fd;
+	attr->key = ptr_to_u64(key);
+	attr->value = ptr_to_u64(val_set);
+	attr->flags = BPF_ANY;
+
+	TEST(bpf(BPF_MAP_UPDATE_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		tst_brk(TFAIL | TTERRNO,
+			"Update %s map element",
+			map_types[n].name);
+	} else {
+		tst_res(TPASS,
+			"Update %s map element",
+			map_types[n].name);
+	}
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = fd;
+	attr->key = ptr_to_u64(key);
+	attr->value = ptr_to_u64(val_get);
+
+	TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO,
+			"%s map lookup missing",
+			map_types[n].name);
+	} else if (memcmp(val_set, val_get, (size_t) VAL_SZ)) {
+		tst_res(TFAIL,
+			"%s map lookup returned different value",
+			map_types[n].name);
+	} else {
+		tst_res(TPASS, "%s map lookup", map_types[n].name);
+	}
+
+	SAFE_CLOSE(fd);
+}
+
+static void setup(void)
+{
+	unsigned int i;
+
+	rlimit_bump_memlock();
+
+	memcpy(key8, "12345678", 8);
+	memset(key4, 0, 4);
+
+	for (i = 0; i < VAL_SZ; i++)
+		val_set[i] = i % 256;
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(map_types),
+	.test = run,
+	.setup = setup,
+	.min_kver = "3.19",
+	.bufs = (struct tst_buffers []) {
+		{&key4, .size = 4},
+		{&key8, .size = 8},
+		{&val_set, .size = VAL_SZ},
+		{&val_get, .size = VAL_SZ},
+		{&attr, .size = sizeof(*attr)},
+		{},
+	},
+};
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog01.c b/testcases/kernel/syscalls/bpf/bpf_prog01.c
new file mode 100644
index 0000000..46a909f
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/bpf_prog01.c
@@ -0,0 +1,169 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * Trivial Extended Berkeley Packet Filter (eBPF) test.
+ *
+ * Sanity check loading and running bytecode.
+ *
+ * Test flow:
+ * 1. Create array map
+ * 2. Load eBPF program
+ * 3. Attach program to socket
+ * 4. Send packet on socket
+ * 5. This should trigger eBPF program which writes to array map
+ * 6. Verify array map was written to
+ */
+/*
+ * If test is executed in a loop and limit for locked memory (ulimit -l) is
+ * too low bpf() call can fail with EPERM due to deffered freeing.
+ */
+
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/socket.h"
+#include "lapi/bpf.h"
+#include "bpf_common.h"
+
+const char MSG[] = "Ahoj!";
+static char *msg;
+
+/*
+ * The following is a byte code template. We copy it to a guarded buffer and
+ * substitute the runtime value of our map file descriptor.
+ *
+ * r0 - r10 = registers 0 to 10
+ * r0 = return code
+ * r1 - r5 = scratch registers, used for function arguments
+ * r6 - r9 = registers preserved across function calls
+ * fp/r10 = stack frame pointer
+ */
+const struct bpf_insn PROG[] = {
+	/* Load the map FD into r1 (place holder) */
+	BPF_LD_MAP_FD(BPF_REG_1, 0),
+	/* Put (key = 0) on stack and key ptr into r2 */
+	BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),   /* r2 = fp */
+	BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),  /* r2 = r2 - 8 */
+	BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0),    /* *r2 = 0 */
+	/* r0 = bpf_map_lookup_elem(r1, r2) */
+	BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
+	/* if r0 == 0 goto exit */
+	BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 3),
+	/* Set map[0] = 1 */
+	BPF_MOV64_REG(BPF_REG_1, BPF_REG_0),     /* r1 = r0 */
+	BPF_ST_MEM(BPF_DW, BPF_REG_1, 0, 1),     /* *r1 = 1 */
+	BPF_MOV64_IMM(BPF_REG_0, 0),             /* r0 = 0 */
+	BPF_EXIT_INSN(),		         /* return r0 */
+};
+
+static struct bpf_insn *prog;
+static char *log;
+static union bpf_attr *attr;
+
+int load_prog(int fd)
+{
+	prog[0] = BPF_LD_MAP_FD(BPF_REG_1, fd);
+
+	memset(attr, 0, sizeof(*attr));
+	attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+	attr->insns = ptr_to_u64(prog);
+	attr->insn_cnt = ARRAY_SIZE(PROG);
+	attr->license = ptr_to_u64("GPL");
+	attr->log_buf = ptr_to_u64(log);
+	attr->log_size = BUFSIZ;
+	attr->log_level = 1;
+
+	TEST(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		if (log[0] != 0) {
+			tst_brk(TFAIL | TTERRNO,
+				"Failed verification: %s",
+				log);
+		} else {
+			tst_brk(TFAIL | TTERRNO, "Failed to load program");
+		}
+	} else {
+		tst_res(TPASS, "Loaded program");
+	}
+
+	return TST_RET;
+}
+
+void setup(void)
+{
+	rlimit_bump_memlock();
+
+	memcpy(prog, PROG, sizeof(PROG));
+	memcpy(msg, MSG, sizeof(MSG));
+}
+
+void run(void)
+{
+	int map_fd, prog_fd;
+	int sk[2];
+	uint32_t key = 0;
+	uint64_t val;
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_type = BPF_MAP_TYPE_ARRAY;
+	attr->key_size = 4;
+	attr->value_size = 8;
+	attr->max_entries = 1;
+
+	TEST(bpf(BPF_MAP_CREATE, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		if (TST_ERR == EPERM) {
+			tst_brk(TCONF | TTERRNO,
+				"bpf() requires CAP_SYS_ADMIN on this system");
+		} else {
+			tst_brk(TBROK | TTERRNO, "Failed to create array map");
+		}
+	}
+	map_fd = TST_RET;
+
+	prog_fd = load_prog(map_fd);
+
+	SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
+	SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
+			&prog_fd, sizeof(prog_fd));
+
+	SAFE_WRITE(1, sk[0], msg, sizeof(MSG));
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = map_fd;
+	attr->key = ptr_to_u64(&key);
+	attr->value = ptr_to_u64(&val);
+
+	TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "array map lookup");
+	} else if (val != 1) {
+		tst_res(TFAIL,
+			"val = %lu, but should be val = 1",
+			val);
+        } else {
+	        tst_res(TPASS, "val = 1");
+	}
+
+	SAFE_CLOSE(prog_fd);
+	SAFE_CLOSE(map_fd);
+	SAFE_CLOSE(sk[0]);
+	SAFE_CLOSE(sk[1]);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+	.min_kver = "3.19",
+	.bufs = (struct tst_buffers []) {
+		{&log, .size = BUFSIZ},
+		{&prog, .size = sizeof(PROG)},
+		{&attr, .size = sizeof(*attr)},
+		{&msg, .size = sizeof(MSG)},
+		{},
+	}
+};
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog02.c b/testcases/kernel/syscalls/bpf/bpf_prog02.c
new file mode 100644
index 0000000..acff188
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/bpf_prog02.c
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ *
+ * Check if eBPF can do arithmetic with 64bits. This targets a specific
+ * regression which only effects unprivileged users who are subject to extra
+ * pointer arithmetic checks during verification.
+ *
+ * Fixed by commit 3612af783cf52c74a031a2f11b82247b2599d3cd.
+ * https://new.blog.cloudflare.com/ebpf-cant-count/
+ *
+ * This test is very similar in structure to bpf_prog01 which is better
+ * annotated.
+ */
+
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+#include <inttypes.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "tst_capability.h"
+#include "lapi/socket.h"
+#include "lapi/bpf.h"
+#include "bpf_common.h"
+
+#define A64INT (((uint64_t)1) << 60)
+
+const char MSG[] = "Ahoj!";
+static char *msg;
+
+static char *log;
+static uint32_t *key;
+static uint64_t *val;
+static union bpf_attr *attr;
+
+static int load_prog(int fd)
+{
+	static struct bpf_insn *prog;
+	struct bpf_insn insn[] = {
+		BPF_MOV64_IMM(BPF_REG_6, 1),            /* 0: r6 = 1 */
+
+		BPF_LD_MAP_FD(BPF_REG_1, fd),	        /* 1: r1 = &fd */
+		BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),   /* 3: r2 = fp */
+		BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4),  /* 4: r2 = r2 - 4 */
+		BPF_ST_MEM(BPF_W, BPF_REG_2, 0, 0),     /* 5: *r2 = 0 */
+		BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),/* 6: map_lookup_elem */
+		BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 17), /* 7: if(!r0) goto 25 */
+		BPF_MOV64_REG(BPF_REG_3, BPF_REG_0),    /* 8: r3 = r0 */
+		BPF_LD_IMM64(BPF_REG_4, A64INT),        /* 9: r4 = 2^61 */
+		BPF_ALU64_REG(BPF_ADD, BPF_REG_4, BPF_REG_6), /* 11: r4 += r6 */
+		BPF_STX_MEM(BPF_DW, BPF_REG_3, BPF_REG_4, 0), /* 12: *r3 = r4 */
+
+		BPF_LD_MAP_FD(BPF_REG_1, fd),	        /* 13: r1 = &fd */
+		BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),   /* 15: r2 = fp */
+		BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4),  /* 16: r2 = r2 - 4 */
+		BPF_ST_MEM(BPF_W, BPF_REG_2, 0, 1),     /* 17: *r2 = 1 */
+		BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),/* 18: map_lookup_elem */
+		BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 5),  /* 19: if(!r0) goto 25 */
+		BPF_MOV64_REG(BPF_REG_3, BPF_REG_0),    /* 20: r3 = r0 */
+		BPF_LD_IMM64(BPF_REG_4, A64INT),        /* 21: r4 = 2^60 */
+		BPF_ALU64_REG(BPF_SUB, BPF_REG_4, BPF_REG_6), /* 23: r4 -= r6 */
+		BPF_STX_MEM(BPF_DW, BPF_REG_3, BPF_REG_4, 0), /* 24: *r3 = r4 */
+
+		BPF_MOV64_IMM(BPF_REG_0, 0),            /* 25: r0 = 0 */
+		BPF_EXIT_INSN(),		        /* 26: return r0 */
+	};
+
+	if (!prog)
+		prog = tst_alloc(sizeof(insn));
+	memcpy(prog, insn, sizeof(insn));
+
+	memset(attr, 0, sizeof(*attr));
+	attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+	attr->insns = ptr_to_u64(prog);
+	attr->insn_cnt = ARRAY_SIZE(insn);
+	attr->license = ptr_to_u64("GPL");
+	attr->log_buf = ptr_to_u64(log);
+	attr->log_size = BUFSIZ;
+	attr->log_level = 1;
+
+	TEST(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		if (log[0] != 0) {
+			tst_res(TINFO, "Verification log:");
+			fputs(log, stderr);
+			tst_brk(TBROK | TTERRNO, "Failed verification");
+		} else {
+			tst_brk(TBROK | TTERRNO, "Failed to load program");
+		}
+	}
+
+	return TST_RET;
+}
+
+static void setup(void)
+{
+	rlimit_bump_memlock();
+	memcpy(msg, MSG, sizeof(MSG));
+}
+
+static void run(void)
+{
+	int map_fd, prog_fd;
+	int sk[2];
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_type = BPF_MAP_TYPE_ARRAY;
+	attr->key_size = 4;
+	attr->value_size = 8;
+	attr->max_entries = 2;
+
+	map_fd = bpf_map_create(attr);
+
+	prog_fd = load_prog(map_fd);
+
+	SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
+	SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
+			&prog_fd, sizeof(prog_fd));
+
+	SAFE_WRITE(1, sk[0], msg, sizeof(MSG));
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = map_fd;
+	attr->key = ptr_to_u64(key);
+	attr->value = ptr_to_u64(val);
+	*key = 0;
+
+	TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "array map lookup");
+		goto exit;
+	}
+
+	if (*val != A64INT + 1) {
+		tst_res(TFAIL,
+			"val = %"PRIu64", but should be val = %"PRIu64" + 1",
+			*val, A64INT);
+		goto exit;
+	}
+
+	tst_res(TPASS, "val = %"PRIu64" + 1", A64INT);
+
+	*key = 1;
+
+	TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "array map lookup");
+		goto exit;
+	}
+
+	if (*val != A64INT - 1) {
+		tst_res(TFAIL,
+			"val = %"PRIu64", but should be val = %"PRIu64" - 1",
+			*val, A64INT);
+		goto exit;
+	}
+
+	tst_res(TPASS, "val = %"PRIu64" - 1", A64INT);
+
+exit:
+	SAFE_CLOSE(prog_fd);
+	SAFE_CLOSE(map_fd);
+	SAFE_CLOSE(sk[0]);
+	SAFE_CLOSE(sk[1]);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+	.min_kver = "3.18",
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
+		{}
+	},
+	.bufs = (struct tst_buffers []) {
+		{&key, .size = sizeof(*key)},
+		{&val, .size = sizeof(*val)},
+		{&log, .size = BUFSIZ},
+		{&attr, .size = sizeof(*attr)},
+		{&msg, .size = sizeof(MSG)},
+		{},
+	},
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "3612af783cf5"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/bpf/bpf_prog03.c b/testcases/kernel/syscalls/bpf/bpf_prog03.c
new file mode 100644
index 0000000..d798159
--- /dev/null
+++ b/testcases/kernel/syscalls/bpf/bpf_prog03.c
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
+ * Original byte code was provided by jannh@google.com
+ *
+ * Check for the bug fixed by 95a762e2c8c942780948091f8f2a4f32fce1ac6f
+ * "bpf: fix incorrect sign extension in check_alu_op()"
+ * CVE-2017-16995
+ *
+ * This test is very similar to the reproducer found here:
+ * https://bugs.chromium.org/p/project-zero/issues/detail?id=1454
+ *
+ * However it has been modified to try to corrupt the map struct instead of
+ * writing to a noncanonical pointer. This appears to be more reliable at
+ * producing stack traces and confirms we would be able to overwrite the ops
+ * function pointers, as suggested by Jan.
+ *
+ * If the eBPF code is loaded then this is considered a failure regardless of
+ * whether it is able to cause any visible damage.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <inttypes.h>
+
+#include "config.h"
+#include "tst_test.h"
+#include "tst_capability.h"
+#include "lapi/socket.h"
+#include "lapi/bpf.h"
+#include "bpf_common.h"
+
+#define LOG_SIZE (1024 * 1024)
+
+static const char MSG[] = "Ahoj!";
+static char *msg;
+
+static char *log;
+static uint32_t *key;
+static uint64_t *val;
+static union bpf_attr *attr;
+
+static int load_prog(int fd)
+{
+	static struct bpf_insn *prog;
+	struct bpf_insn insn[] = {
+		BPF_LD_MAP_FD(BPF_REG_1, fd),
+
+		// fill r0 with pointer to map value
+		BPF_MOV64_REG(BPF_REG_8, BPF_REG_10),
+		BPF_ALU64_IMM(BPF_ADD, BPF_REG_8, -4), // allocate 4 bytes stack
+		BPF_MOV32_IMM(BPF_REG_2, 0),
+		BPF_STX_MEM(BPF_W, BPF_REG_8, BPF_REG_2, 0),
+		BPF_MOV64_REG(BPF_REG_2, BPF_REG_8),
+		BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
+		BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 2),
+		BPF_MOV64_REG(BPF_REG_0, 0), // prepare exit
+		BPF_EXIT_INSN(), // exit
+
+		// r1 = 0xffff'ffff, mistreated as 0xffff'ffff'ffff'ffff
+		BPF_MOV32_IMM(BPF_REG_1, -1),
+		// r1 = 0x1'0000'0000, mistreated as 0
+		BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 1),
+		// r1 = 64, mistreated as 0
+		BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 26),
+
+		// Write actual value of r1 to map for debugging this test
+		BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, 0),
+
+		// Corrupt the map meta-data which comes before the map data
+		BPF_MOV64_REG(BPF_REG_2, BPF_REG_0),
+		BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1),
+
+		BPF_MOV64_IMM(BPF_REG_3, 0xdeadbeef),
+		BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, 0),
+		BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1),
+		BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, 0),
+		BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1),
+		BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, 0),
+		BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1),
+		BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_3, 0),
+
+		// terminate to make the verifier happy
+		BPF_MOV32_IMM(BPF_REG_0, 0),
+		BPF_EXIT_INSN()
+	};
+
+	if (!prog)
+		prog = tst_alloc(sizeof(insn));
+	memcpy(prog, insn, sizeof(insn));
+
+	memset(attr, 0, sizeof(*attr));
+	attr->prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+	attr->insns = ptr_to_u64(prog);
+	attr->insn_cnt = ARRAY_SIZE(insn);
+	attr->license = ptr_to_u64("GPL");
+	attr->log_buf = ptr_to_u64(log);
+	attr->log_size = LOG_SIZE;
+	attr->log_level = 1;
+
+	TEST(bpf(BPF_PROG_LOAD, attr, sizeof(*attr)));
+	if (TST_RET == -1) {
+		if (log[0] != 0)
+			tst_res(TPASS | TTERRNO, "Failed verification");
+		else
+			tst_brk(TBROK | TTERRNO, "Failed to load program");
+	} else {
+		tst_res(TINFO, "Verification log:");
+		fputs(log, stderr);
+	}
+
+	return TST_RET;
+}
+
+static void setup(void)
+{
+	rlimit_bump_memlock();
+	memcpy(msg, MSG, sizeof(MSG));
+}
+
+static void run(void)
+{
+	int map_fd, prog_fd;
+	int sk[2];
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_type = BPF_MAP_TYPE_ARRAY;
+	attr->key_size = 4;
+	attr->value_size = 8;
+	attr->max_entries = 32;
+
+	map_fd = bpf_map_create(attr);
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = map_fd;
+	attr->key = ptr_to_u64(key);
+	attr->value = ptr_to_u64(val);
+	attr->flags = BPF_ANY;
+
+	TEST(bpf(BPF_MAP_UPDATE_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "Failed to lookup map element");
+
+	prog_fd = load_prog(map_fd);
+	if (prog_fd == -1)
+		goto exit;
+
+	tst_res(TFAIL, "Loaded bad eBPF, now we will run it and maybe crash");
+
+	SAFE_SOCKETPAIR(AF_UNIX, SOCK_DGRAM, 0, sk);
+	SAFE_SETSOCKOPT(sk[1], SOL_SOCKET, SO_ATTACH_BPF,
+			&prog_fd, sizeof(prog_fd));
+
+	SAFE_WRITE(1, sk[0], msg, sizeof(MSG));
+
+	memset(attr, 0, sizeof(*attr));
+	attr->map_fd = map_fd;
+	attr->key = ptr_to_u64(key);
+	attr->value = ptr_to_u64(val);
+	*key = 0;
+
+	TEST(bpf(BPF_MAP_LOOKUP_ELEM, attr, sizeof(*attr)));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO, "array map lookup");
+	else
+		tst_res(TINFO, "Pointer offset was 0x%"PRIx64, *val);
+
+	SAFE_CLOSE(sk[0]);
+	SAFE_CLOSE(sk[1]);
+	SAFE_CLOSE(prog_fd);
+exit:
+	SAFE_CLOSE(map_fd);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+	.min_kver = "3.18",
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
+		{}
+	},
+	.bufs = (struct tst_buffers []) {
+		{&key, .size = sizeof(*key)},
+		{&val, .size = sizeof(*val)},
+		{&log, .size = LOG_SIZE},
+		{&attr, .size = sizeof(*attr)},
+		{&msg, .size = sizeof(MSG)},
+		{},
+	},
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "95a762e2c8c9"},
+		{"CVE", "2017-16995"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/brk/brk01.c b/testcases/kernel/syscalls/brk/brk01.c
index aee340e..c50791d 100644
--- a/testcases/kernel/syscalls/brk/brk01.c
+++ b/testcases/kernel/syscalls/brk/brk01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <unistd.h>
diff --git a/testcases/kernel/syscalls/capget/capget01.c b/testcases/kernel/syscalls/capget/capget01.c
index 8a2a892..f376759 100644
--- a/testcases/kernel/syscalls/capget/capget01.c
+++ b/testcases/kernel/syscalls/capget/capget01.c
@@ -1,127 +1,67 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ *  Author: Saji Kumar.V.R <saji.kumar@wipro.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Description:
+ * This case tests capget() syscall whether works well on three versions.
+ * Also, it checks the results buffer.
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: capget01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for capget(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This is a Phase I test for the capget(2) system call.
- *	It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  call capget()
- *	  if return value == 0
- *		Test passed
- *	  Otherwise
- *		Test failed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * capget01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- ****************************************************************/
-
-#include <errno.h>
-#include <unistd.h>
-#include "test.h"
+#include <sys/types.h>
+#include "tst_test.h"
 #include "lapi/syscalls.h"
-
 #include <linux/capability.h>
 
-static void setup();
-static void cleanup();
+static pid_t pid;
+static struct __user_cap_header_struct *hdr;
+static struct __user_cap_data_struct *data;
 
-char *TCID = "capget01";
-int TST_TOTAL = 1;
+static struct tcase {
+	int version;
+	char *message;
+} tcases[] = {
+	{0x19980330, "Test on LINUX_CAPABILITY_VERSION_1"},
+	{0x20071026, "Test on LINUX_CAPABILITY_VERSION_2"},
+	{0x20080522, "Test on LINUX_CAPABILITY_VERSION_3"},
+};
 
-static struct __user_cap_header_struct header;	/* cap_user_header_t is a pointer
-						   to __user_cap_header_struct */
-
-static struct __user_cap_data_struct data;	/* cap_user_data_t is a pointer to
-						   __user_cap_data_struct */
-
-int main(int ac, char **av)
+static void verify_capget(unsigned int n)
 {
+	struct tcase *tc = &tcases[n];
 
-	int lc;
+	tst_res(TINFO, "%s", tc->message);
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	hdr->version = tc->version;
+	hdr->pid = pid;
+	TEST(tst_syscall(__NR_capget, hdr, data));
+	if (TST_RET == 0)
+		tst_res(TPASS, "capget() returned %ld", TST_RET);
+	else
+		tst_res(TFAIL | TTERRNO, "Test Failed, capget() returned %ld",
+				TST_RET);
 
-	setup();
+	if (data[0].effective & 1 << CAP_NET_RAW)
+		tst_res(TFAIL, "capget() gets CAP_NET_RAW unexpectedly in pE");
+	else
+		tst_res(TPASS, "capget() doesn't get CAP_NET_RAW as expected in PE");
+}
 
-	/* header.version must be _LINUX_CAPABILITY_VERSION */
-	header.version = _LINUX_CAPABILITY_VERSION;
+static void setup(void)
+{
+	pid = getpid();
+}
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		TEST(ltp_syscall(__NR_capget, &header, &data));
-
-		if (TEST_RETURN == 0) {
-			tst_resm(TPASS, "capget() returned %ld", TEST_RETURN);
-		} else {
-			tst_resm(TFAIL | TTERRNO,
-				 "Test Failed, capget() returned %ld",
-				 TEST_RETURN);
-		}
+static struct tst_test test = {
+	.setup = setup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_capget,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_DROP, CAP_NET_RAW),
+		{}
+	},
+	.bufs = (struct tst_buffers []) {
+		{&hdr, .size = sizeof(*hdr)},
+		{&data, .size = 2 * sizeof(*data)},
+		{},
 	}
-
-	cleanup();
-
-	tst_exit();
-}
-
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-}
-
-void cleanup(void)
-{
-}
+};
diff --git a/testcases/kernel/syscalls/capget/capget02.c b/testcases/kernel/syscalls/capget/capget02.c
index e8d2377..e770ea0 100644
--- a/testcases/kernel/syscalls/capget/capget02.c
+++ b/testcases/kernel/syscalls/capget/capget02.c
@@ -1,199 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Tests basic error handling of the capget syscall.
+ * 1) capget() fails with errno set to EFAULT if an invalid address
+ * is given for header.
+ * 2) capget() fails with errno set to EFAULT if an invalid address
+ * is given for data
+ * 3) capget() fails with errno set to EINVAL if an invalid value
+ * is given for header->version
+ * 4) capget() fails with errno set to EINVAL if header->pid < 0
+ * 5) capget() fails with errno set to ESRCH if the process with
+ *  pid, header->pid does not exist.
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: capget02
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Tests for error conditions.
- *
- *    TEST CASE TOTAL	: 5
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	Verify that
- *	1) capget() fails with errno set to EFAULT if an invalid address
- *	   is given for header
- *	2) capget() fails with errno set to EFAULT if an invalid address
- *	   is given for data
- *	3) capget() fails with errno set to EINVAL if an invalid value
- *	   is given for header->version
- *	4) capget() fails with errno set to EINVAL if header->pid < 0
- *	5) capget() fails with errno set to ESRCH if the process with
- *	   pid, header->pid does not exit
- *
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  call capget with proper arguments
- *	  if capget() fails with expected errno
- *		Test passed
- *	  Otherwise
- *		Test failed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * capget02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- *
- ****************************************************************/
 
-#include <errno.h>
-#include "test.h"
+#include <sys/types.h>
+#include "tst_test.h"
 #include "lapi/syscalls.h"
-
-/**************************************************************************/
-/*                                                                        */
-/*   Some archs do not have the manpage documented sys/capability.h file, */
-/*   and require the use of the line below                                */
-
 #include <linux/capability.h>
 
-/*   If you are having issues with including this file and have the sys/  */
-/*   version, then you may want to try switching to it. -Robbie W.        */
-/**************************************************************************/
+static pid_t unused_pid;
+static struct __user_cap_header_struct *header;
+static struct __user_cap_data_struct *data, *bad_data;
 
-static void setup();
-static void cleanup();
-static void test_setup(int);
-
-char *TCID = "capget02";
-
-static struct __user_cap_header_struct header;
-static struct __user_cap_data_struct data;
-
-struct test_case_t {
-	cap_user_header_t headerp;
-	cap_user_data_t datap;
-	int exp_errno;
-	char *errdesc;
-} test_cases[] = {
-#ifndef UCLINUX
-	/* Skip since uClinux does not implement memory protection */
-	{
-	(cap_user_header_t) - 1, &data, EFAULT, "EFAULT"}, {
-	&header, (cap_user_data_t) - 1, EFAULT, "EFAULT"},
-#endif
-	{
-	&header, &data, EINVAL, "EINVAL"}, {
-	&header, &data, EINVAL, "EINVAL"}, {
-	&header, &data, ESRCH, "ESRCH"}
+static struct tcase {
+	int version;
+	int pid;
+	int exp_err;
+	int flag;
+	char *message;
+} tcases[] = {
+	{0x20080522, 0, EFAULT, 1, "Test bad address header"},
+	{0x20080522, 0, EFAULT, 2, "Test bad address data"},
+	{0, 0, EINVAL, 0, "Test bad version"},
+	{0x20080522, -1, EINVAL, 0, "Test bad pid"},
+	{0x20080522, 1, ESRCH, 0, "Test unused pid"},
 };
 
-int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-
-int main(int ac, char **av)
+static void verify_capget(unsigned int n)
 {
+	struct tcase *tc = &tcases[n];
 
-	int lc, i;
+	header->version = tc->version;
+	if (tc->pid == 1)
+		header->pid = unused_pid;
+	else
+		header->pid = tc->pid;
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	tst_res(TINFO, "%s", tc->message);
 
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; ++i) {
-			test_setup(i);
-			TEST(ltp_syscall(__NR_capget, test_cases[i].headerp,
-				     test_cases[i].datap));
-
-			if (TEST_RETURN == -1 &&
-			    TEST_ERRNO == test_cases[i].exp_errno) {
-				tst_resm(TPASS | TTERRNO,
-					 "capget failed as expected");
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "capget failed unexpectedly (%ld)",
-					 TEST_RETURN);
-			}
-		}
+	/*
+	 * header must not be NULL. data may be NULL only when the user is
+	 * trying to determine the preferred capability version format
+	 * supported by the kernel. So use tst_get_bad_addr() to get
+	 * this error.
+	 */
+	TEST(tst_syscall(__NR_capget, tc->flag - 1 ? header : NULL,
+				tc->flag - 2 ? data : bad_data));
+	if (TST_RET == 0) {
+		tst_res(TFAIL, "capget() succeed unexpectedly");
+		return;
 	}
+	if (TST_ERR == tc->exp_err)
+		tst_res(TPASS | TTERRNO, "capget() failed as expected");
+	else
+		tst_res(TFAIL | TTERRNO, "capget() expected %s got ",
+			tst_strerrno(tc->exp_err));
 
-	cleanup();
-
-	tst_exit();
-
+	/*
+	 * When an unsupported version value is specified, it will
+	 * return the kernel preferred value of _LINUX_CAPABILITY_VERSION_?.
+	 * Since linux 2.6.26, version 3 is default. We use it.
+	 */
+	if (header->version != 0x20080522)
+		tst_res(TFAIL, "kernel doesn't return preferred linux"
+			" capability version when using bad version");
 }
 
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
+static void setup(void)
 {
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
+	unused_pid = tst_get_unused_pid();
+	bad_data = tst_get_bad_addr(NULL);
 }
 
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-}
-
-void test_setup(int i)
-{
-#ifdef UCLINUX
-	i = i + 2;
-#endif
-	switch (i) {
-
-	case 0:
-		break;
-	case 1:
-		header.version = _LINUX_CAPABILITY_VERSION;
-		header.pid = getpid();
-		break;
-	case 2:
-		header.version = 0;
-		header.pid = getpid();
-		break;
-	case 3:
-		header.version = _LINUX_CAPABILITY_VERSION;
-		header.pid = -1;
-		break;
-	case 4:
-		header.version = _LINUX_CAPABILITY_VERSION;
-		header.pid = tst_get_unused_pid(cleanup);
-		break;
+static struct tst_test test = {
+	.setup = setup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_capget,
+	.bufs = (struct tst_buffers []) {
+		{&header, .size = sizeof(*header)},
+		{&data, .size = 2 * sizeof(*data)},
+		{&bad_data, .size = 2 * sizeof(*data)},
+		{},
 	}
-}
+};
diff --git a/testcases/kernel/syscalls/capset/.gitignore b/testcases/kernel/syscalls/capset/.gitignore
index 004ce7b..d0a7a13 100644
--- a/testcases/kernel/syscalls/capset/.gitignore
+++ b/testcases/kernel/syscalls/capset/.gitignore
@@ -1,2 +1,4 @@
 /capset01
 /capset02
+/capset03
+/capset04
diff --git a/testcases/kernel/syscalls/capset/capset01.c b/testcases/kernel/syscalls/capset/capset01.c
index 9c61773..f854053 100644
--- a/testcases/kernel/syscalls/capset/capset01.c
+++ b/testcases/kernel/syscalls/capset/capset01.c
@@ -1,142 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: capset01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for capset(2)
- *
- *    TEST CASE TOTAL	: 1
- *
  *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
  *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This is a Phase I test for the capset(2) system call.
- *	It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *	  call capget() to save the current capability data
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  call capset() with the saved data
- *	  if return value == 0
- *		Test passed
- *	  Otherwise
- *		Test failed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * capset01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- *
  * CHANGES:
  *  2005/01/01: add an hint to a possible solution when test fails
  *              - Ricky Ng-Adam <rngadam@yahoo.com>
- ****************************************************************/
+ */
+#include <sys/types.h>
 #include <unistd.h>
-#include <errno.h>
-#include "test.h"
+#include "tst_test.h"
 #include "lapi/syscalls.h"
-
-/**************************************************************************/
-/*                                                                        */
-/*   Some archs do not have the manpage documented sys/capability.h file, */
-/*   and require the use of the line below                                */
-
 #include <linux/capability.h>
 
-/*   If you are having issues with including this file and have the sys/  */
-/*   version, then you may want to try switching to it. -Robbie W.        */
-/**************************************************************************/
+static pid_t pid;
+static struct __user_cap_header_struct *header;
+static struct __user_cap_data_struct *data;
+static struct tcase {
+	int version;
+	char *message;
+} tcases[] = {
+	{0x19980330, "Test on LINUX_CAPABILITY_VERSION_1"},
+	{0x20071026, "Test on LINUX_CAPABILITY_VERSION_2"},
+	{0x20080522, "Test on LINUX_CAPABILITY_VERSION_3"},
+};
 
-static void setup();
-static void cleanup();
-
-char *TCID = "capset01";
-int TST_TOTAL = 1;
-
-static struct __user_cap_header_struct header;	/* cap_user_header_t is a pointer
-						   to __user_cap_header_struct */
-
-static struct __user_cap_data_struct data;	/* cap_user_data_t is a pointer to
-						   __user_cap_data_struct */
-
-int main(int ac, char **av)
+static void verify_capset(unsigned int n)
 {
+	struct tcase *tc = &tcases[n];
 
-	int lc;
+	tst_res(TINFO, "%s", tc->message);
+	header->version = tc->version;
+	header->pid = pid;
 
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		TEST(ltp_syscall(__NR_capset, &header, &data));
-
-		if (TEST_RETURN == 0) {
-			tst_resm(TPASS, "capset() returned %ld", TEST_RETURN);
-		} else {
-			tst_resm(TFAIL | TTERRNO,
-				 "Test Failed, capset() returned %ld"
-				 " Maybe you need to do `modprobe capability`?",
-				 TEST_RETURN);
-		}
+	if (tst_syscall(__NR_capget, header, data) == -1) {
+		tst_res(TFAIL | TTERRNO, "capget() failed");
+		return;
 	}
 
-	cleanup();
-
-	tst_exit();
+	TEST(tst_syscall(__NR_capset, header, data));
+	if (TST_RET == 0)
+		tst_res(TPASS, "capset() returned %ld", TST_RET);
+	else
+		tst_res(TFAIL | TTERRNO, "Test Failed, capset() returned %ld", TST_RET);
 }
 
-void setup(void)
+static void setup(void)
 {
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	header.version = _LINUX_CAPABILITY_VERSION;
-	header.pid = 0;
-	if (ltp_syscall(__NR_capget, &header, &data) == -1)
-		tst_brkm(TBROK | TERRNO, NULL, "capget() failed");
+	pid = getpid();
 }
 
-void cleanup(void)
-{
-}
+static struct tst_test test = {
+	.setup = setup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_capset,
+	.bufs = (struct tst_buffers []) {
+		{&header, .size = sizeof(*header)},
+		{&data, .size = 2 * sizeof(*data)},
+		{},
+	}
+};
diff --git a/testcases/kernel/syscalls/capset/capset02.c b/testcases/kernel/syscalls/capset/capset02.c
index aece295..a6c4f29 100644
--- a/testcases/kernel/syscalls/capset/capset02.c
+++ b/testcases/kernel/syscalls/capset/capset02.c
@@ -1,261 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Tests basic error handling of the capset syscall.
+ * 1) capset() fails with errno set to EFAULT if an invalid address
+ * is given for header.
+ * 2) capset() fails with errno set to EFAULT if an invalid address
+ * is given for data.
+ * 3) capset() fails with errno set to EINVAL if an invalid value
+ * is given for header->version.
+ * 4) capset() fails with errno set to EPERM if the new_Effective is
+ * not a subset of the new_Permitted.
+ * 5) capset() fails with errno set to EPERM if the new_Permitted is
+ * not a subset of the old_Permitted.
+ * 6) capset() fails with errno set ot EPERM if the new_Inheritable is
+ * not a subset of  the old_Inheritable and bounding set.
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: capset02
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Tests for error conditions.
- *
- *    TEST CASE TOTAL	: 4
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	Verify that
- *	1) capset() fails with errno set to EFAULT if an invalid address
- *	   is given for header
- *	2) capset() fails with errno set to EFAULT if an invalid address
- *	   is given for data
- *	3) capset() fails with errno set to EINVAL if an invalid value
- *	   is given for header->version
- *	4) capset() fails with errno set to EPERM the process does not
- *	   have enough privilege to set capabilities
- *
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *	  Call capget() to save current capability data
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	  do test specific setup.
- * 	  call capset with proper arguments
- *	  if capset() fails with expected errno
- *		Test passed
- *	  Otherwise
- *		Test failed
- *	  do test specific cleanup
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * capset02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- *
- ****************************************************************/
+#include <stdlib.h>
 #include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <pwd.h>
-#include <signal.h>
-#include <string.h>
 #include <unistd.h>
-#include "test.h"
-#include "safe_macros.h"
+#include <sys/prctl.h>
+#include "tst_test.h"
 #include "lapi/syscalls.h"
-
-/**************************************************************************/
-/*                                                                        */
-/*   Some archs do not have the manpage documented sys/capability.h file, */
-/*   and require the use of the line below                                */
-
 #include <linux/capability.h>
 
-/*   If you are having issues with including this file and have the sys/  */
-/*   version, then you may want to try switching to it. -Robbie W.        */
-/**************************************************************************/
+#define CAP1 (1 << CAP_NET_RAW | 1 << CAP_CHOWN  | 1 << CAP_SETPCAP)
+#define CAP2 (CAP1 | 1 << CAP_KILL)
 
-#define INVALID_VERSION 0
+static struct __user_cap_header_struct *header;
+static struct __user_cap_data_struct *data;
 
-static void setup(void);
-static void cleanup(void);
-static void test_setup(int, char *);
-static void child_func(void);
+static void *bad_addr;
 
-static pid_t child_pid = -1;
+static struct tcase {
+	int version;
+	int pid;
+	int effective;
+	int permitted;
+	int inheritable;
+	int exp_err;
+	int flag;
+	char *message;
+} tcases[] = {
+	{0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 1, "Test bad address header"},
+	{0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 2, "Test bad address data"},
+	{0, 0, CAP1, CAP1, CAP1, EINVAL, 0, "Test bad version"},
+	{0x20080522, 0, CAP2, CAP1, CAP1, EPERM, 0, "Test bad value data(when pE is not in pP)"},
+	{0x20080522, 0, CAP1, CAP2, CAP1, EPERM, 0, "Test bad value data(when pP is not in old pP)"},
+	{0x20080522, 0, CAP1, CAP1, CAP2, EPERM, 0, "Test bad value data(when pI is not in bounding set or old pI)"},
+};
 
-char *TCID = "capset02";
-
-static struct __user_cap_header_struct header;
-static struct __user_cap_data_struct data;
-
-struct test_case_t {
-	cap_user_header_t headerp;
-	cap_user_data_t datap;
-	int exp_errno;
-	char *errdesc;
-} test_cases[] = {
-#ifndef UCLINUX
-	/* Skip since uClinux does not implement memory protection */
-	{
-	(cap_user_header_t) - 1, &data, EFAULT, "EFAULT"}, {
-	&header, (cap_user_data_t) - 1, EFAULT, "EFAULT"},
-#endif
-	{
-	&header, &data, EINVAL, "EINVAL"}, {
-&header, &data, EPERM, "EPERM"},};
-
-int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-
-int main(int ac, char **av)
+static void verify_capset(unsigned int n)
 {
+	struct tcase *tc = &tcases[n];
 
-	int lc, i;
+	header->version = tc->version;
+	header->pid = tc->pid;
 
-	tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
-	maybe_run_child(&child_func, "");
-#endif
+	data->effective = tc->effective;
+	data->permitted = tc->permitted;
+	data->inheritable = tc->inheritable;
 
-	setup();
+	tst_res(TINFO, "%s", tc->message);
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-#ifdef UCLINUX
-		i = 2;
-#else
-		i = 0;
-#endif
-
-		for (; i < TST_TOTAL; i++) {
-
-			test_setup(i, av[0]);
-			TEST(ltp_syscall(__NR_capset, test_cases[i].headerp,
-				     test_cases[i].datap));
-
-			if (TEST_RETURN == -1 &&
-			    TEST_ERRNO == test_cases[i].exp_errno) {
-				tst_resm(TPASS, "capset() returned -1,"
-					 " errno: %s", test_cases[i].errdesc);
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "Test Failed, capset() returned %ld",
-					 TEST_RETURN);
-			}
-		}
+	TEST(tst_syscall(__NR_capset, tc->flag - 1 ? header : bad_addr,
+				tc->flag - 2 ? data : bad_addr));
+	if (TST_RET == 0) {
+		tst_res(TFAIL, "capset() succeed unexpectedly");
+		return;
 	}
-
-	cleanup();
-
-	tst_exit();
-
-}
-
-void setup(void)
-{
-	tst_require_root();
-
-	TEST_PAUSE;
-
+	if (TST_ERR == tc->exp_err)
+		tst_res(TPASS | TTERRNO, "capset() failed as expected");
+	else
+		tst_res(TFAIL | TTERRNO, "capset() expected %s got ",
+			tst_strerrno(tc->exp_err));
 	/*
-	 * Save current capability data.
-	 * header.version must be _LINUX_CAPABILITY_VERSION
+	 * When an unsupported version value is specified, it will
+	 * return the kernel preferred value of _LINUX_CAPABILITY_VERSION_?.
+	 * Since linux 2.6.26, version 3 is default. We use it.
 	 */
-	header.version = _LINUX_CAPABILITY_VERSION;
-	if (ltp_syscall(__NR_capget, &header, &data) == -1)
-		tst_brkm(TBROK | TERRNO, NULL, "capget failed");
+	if (header->version != 0x20080522)
+		tst_res(TFAIL, "kernel doesn't return preferred linux"
+			" capability version when using bad version");
 }
 
-void cleanup(void)
+static void setup(void)
 {
-	if (0 < child_pid) {
-		kill(child_pid, SIGTERM);
-		wait(NULL);
-	}
+	header->version = 0x20080522;
+	data->effective = CAP1;
+	data->permitted = CAP1;
+	data->inheritable = CAP1;
+
+	TEST(tst_syscall(__NR_capset, header, data));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "capset data failed");
+
+	TEST(prctl(PR_CAPBSET_DROP, CAP_KILL));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "drop CAP_KILL failed");
+
+	bad_addr = tst_get_bad_addr(NULL);
 }
 
-void child_func(void)
-{
-	for (;;) {
-		sleep(10);
+static struct tst_test test = {
+	.setup = setup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_capset,
+	.needs_root = 1,
+	.bufs = (struct tst_buffers []) {
+		{&header, .size = sizeof(*header)},
+		{&data, .size = 2 * sizeof(*data)},
+		{},
 	}
-}
-
-void test_setup(int i, char *argv0)
-{
-	char nobody_uid[] = "nobody";
-	struct passwd *ltpuser;
-
-	switch (i) {
-	case 0:
-		break;
-
-	case 1:
-		header.version = _LINUX_CAPABILITY_VERSION;
-		header.pid = 0;
-		break;
-
-	case 2:
-		header.version = INVALID_VERSION;
-		header.pid = 0;
-		break;
-
-	case 3:
-		header.version = _LINUX_CAPABILITY_VERSION;
-		/*
-		 * when a non-zero pid is specified, process should have
-		 * CAP_SETPCAP capability to change capabilities.
-		 * by default, CAP_SETPCAP is not enabled. So giving
-		 * a non-zero pid results in capset() failing with
-		 * errno EPERM
-		 *
-		 * Note: this seems to have changed with recent kernels
-		 * => create a child and try to set its capabilities
-		 */
-		child_pid = FORK_OR_VFORK();
-		if (child_pid == -1)
-			tst_brkm(TBROK | TERRNO, cleanup, "fork failed");
-		else if (child_pid == 0) {
-#ifdef UCLINUX
-			if (self_exec(argv0, "") < 0) {
-				perror("self_exec failed");
-				exit(1);
-			}
-#else
-			child_func();
-#endif
-		} else {
-			header.pid = child_pid;
-			ltpuser = getpwnam(nobody_uid);
-			if (ltpuser == NULL)
-				tst_brkm(TBROK | TERRNO, cleanup,
-					 "getpwnam failed");
-			SAFE_SETEUID(cleanup, ltpuser->pw_uid);
-
-		}
-		break;
-
-	}
-}
+};
diff --git a/testcases/kernel/syscalls/capset/capset03.c b/testcases/kernel/syscalls/capset/capset03.c
new file mode 100644
index 0000000..d575475
--- /dev/null
+++ b/testcases/kernel/syscalls/capset/capset03.c
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com
+ *
+ * capset() fails with errno set or EPERM if the new_Inheritable is
+ * not a subset of old_Inheritable and old_Permitted without CAP_SETPCAP.
+ */
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include <linux/capability.h>
+
+#define CAP1 (1 << CAP_KILL)
+#define CAP2 (CAP1 | 1 << CAP_NET_RAW)
+
+static struct __user_cap_header_struct *header;
+static struct __user_cap_data_struct *data;
+
+static void verify_capset(void)
+{
+	tst_res(TINFO, "Test bad value data(when pI is not old pP or old pI without CAP_SETPCAP)");
+	data[0].inheritable = CAP2;
+	TEST(tst_syscall(__NR_capset, header, data));
+	if (TST_RET == 0) {
+		tst_res(TFAIL, "capset succeed unexpectedly");
+		return;
+	}
+	if (TST_ERR == EPERM)
+		tst_res(TPASS | TTERRNO, "capset() failed as expected");
+	else
+		tst_res(TFAIL | TTERRNO, "capset expected EPERM, bug got");
+}
+
+static void setup(void)
+{
+	header->version = 0x20080522;
+
+	data[0].effective = CAP1;
+	data[0].permitted = CAP1;
+	data[0].inheritable = CAP1;
+
+	TEST(tst_syscall(__NR_capset, header, data));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "capset data failed");
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = verify_capset,
+	.needs_root = 1,
+	.bufs = (struct tst_buffers []) {
+		{&header, .size = sizeof(*header)},
+		{&data, .size = 2 * sizeof(*data)},
+		{},
+	}
+};
diff --git a/testcases/kernel/syscalls/capset/capset04.c b/testcases/kernel/syscalls/capset/capset04.c
new file mode 100644
index 0000000..81ad7a3
--- /dev/null
+++ b/testcases/kernel/syscalls/capset/capset04.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
+ *
+ * Tests whether we can use capset() to modify the capabilities of a thread
+ * other than itself. Now, most linux distributions with kernel supporting
+ * VFS capabilities, this should be never permitted.
+ */
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include <linux/capability.h>
+
+static struct __user_cap_header_struct *header;
+static struct __user_cap_data_struct *data;
+static pid_t child_pid;
+
+static void verify_capset(void)
+{
+	child_pid = SAFE_FORK();
+	if (!child_pid)
+		pause();
+
+	header->pid = child_pid;
+
+	TEST(tst_syscall(__NR_capset, header, data));
+	if (TST_RET == 0) {
+		tst_res(TFAIL, "capset succeed unexpectedly");
+		return;
+	}
+
+	if (TST_ERR == EPERM)
+		tst_res(TPASS, "capset can't modify other process capabilities");
+	else
+		tst_res(TFAIL | TTERRNO, "capset expected EPERM, bug got");
+
+	SAFE_KILL(child_pid, SIGTERM);
+	SAFE_WAIT(NULL);
+}
+
+static void setup(void)
+{
+	header->version = 0x20080522;
+	TEST(tst_syscall(__NR_capget, header, data));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "capget data failed");
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = verify_capset,
+	.forks_child = 1,
+	.bufs = (struct tst_buffers []) {
+		{&header, .size = sizeof(*header)},
+		{&data, .size = 2 * sizeof(*data)},
+		{},
+	}
+};
diff --git a/testcases/kernel/syscalls/chdir/chdir03.c b/testcases/kernel/syscalls/chdir/chdir03.c
index d5f3819..5beabdb 100644
--- a/testcases/kernel/syscalls/chdir/chdir03.c
+++ b/testcases/kernel/syscalls/chdir/chdir03.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/chdir/chdir04.c b/testcases/kernel/syscalls/chdir/chdir04.c
index 9e0a9e9..f0420e4 100644
--- a/testcases/kernel/syscalls/chdir/chdir04.c
+++ b/testcases/kernel/syscalls/chdir/chdir04.c
@@ -83,14 +83,12 @@
 	     */
 	{
 	noexist_dir, ENOENT},
-#ifndef UCLINUX
 	    /*
 	     * to test whether chdir() is setting EFAULT if the
 	     * directory is an invalid address.
 	     */
 	{
 	(void *)-1, EFAULT}
-#endif
 };
 
 int TST_TOTAL = ARRAY_SIZE(TC);
diff --git a/testcases/kernel/syscalls/chmod/chmod06.c b/testcases/kernel/syscalls/chmod/chmod06.c
index e5bb58f..d6b86af 100644
--- a/testcases/kernel/syscalls/chmod/chmod06.c
+++ b/testcases/kernel/syscalls/chmod/chmod06.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2014-2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
index 6eac1f2..1262d34 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
@@ -58,6 +58,7 @@
 
 static long hz;
 static struct timex saved, ttxc;
+static int supported;
 
 struct test_case {
 	unsigned int modes;
@@ -168,6 +169,7 @@
 	int rval;
 
 	rval = SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
+	supported = 1;
 
 	if (rval != TIME_OK && rval != TIME_ERROR) {
 		timex_show("SAVE_STATUS", saved);
@@ -197,6 +199,9 @@
 
 static void cleanup(void)
 {
+	if (supported == 0)
+		return;
+
 	saved.modes = ADJ_ALL;
 
 	/* restore clock resolution based on original status flag */
diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
index 1ce936f..ba8eae5 100644
--- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
+++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c
@@ -59,6 +59,7 @@
 
 static long hz;
 static struct timex saved, ttxc;
+static int supported;
 
 static void cleanup(void);
 
@@ -176,6 +177,7 @@
 	int rval;
 
 	rval = SAFE_CLOCK_ADJTIME(CLOCK_REALTIME, &saved);
+	supported = 1;
 
 	if (rval != TIME_OK && rval != TIME_ERROR) {
 		timex_show("SAVE_STATUS", saved);
@@ -197,6 +199,9 @@
 
 static void cleanup(void)
 {
+	if (supported == 0)
+		return;
+
 	saved.modes = ADJ_ALL;
 
 	/* restore clock resolution based on original status flag */
diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
index da37b8a..fcdf53b 100644
--- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
+++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
@@ -1,63 +1,65 @@
-/******************************************************************************
- * Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd                *
- *   Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,               *
- *              Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,                 *
- *              Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>                  *
- *   LTP authors:                                                             *
- *              Manas Kumar Nayak maknayak@in.ibm.com>                        *
- *              Zeng Linggang <zenglg.jy@cn.fujitsu.com>                      *
- *              Cyril Hrubis <chrubis@suse.cz>                                *
- *                                                                            *
- * 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           *
- *                                                                            *
- ******************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Description: This tests the clock_getres() syscall
+ * Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd
+ * Authors: Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
+ *              Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
+ *              Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
+ * LTP authors:
+ *              Manas Kumar Nayak maknayak@in.ibm.com>
+ *              Zeng Linggang <zenglg.jy@cn.fujitsu.com>
+ *              Cyril Hrubis <chrubis@suse.cz>
  */
 
 #include <errno.h>
 
 #include "tst_test.h"
+#include "lapi/syscalls.h"
 #include "lapi/posix_clocks.h"
 
-static struct timespec res;
+static struct timespec *res;
 
 static struct test_case {
 	char *name;
 	clockid_t clk_id;
-	struct timespec *res;
 	int ret;
 	int err;
 } tcase[] = {
-	{"REALTIME", CLOCK_REALTIME, &res, 0, 0},
-	{"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
-	{"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
-	{"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
-	{"REALTIME", CLOCK_REALTIME, NULL, 0, 0},
-	{"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, &res, 0, 0,},
-	{"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, &res, 0, 0,},
-	{"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, &res, 0, 0,},
-	{"CLOCK_BOOTTIME", CLOCK_BOOTTIME, &res, 0, 0,},
-	{"CLOCK_REALTIME_ALARM", CLOCK_REALTIME_ALARM, &res, 0, 0,},
-	{"CLOCK_BOOTTIME_ALARM", CLOCK_BOOTTIME_ALARM, &res, 0, 0,},
-	{"-1", -1, &res, -1, EINVAL},
+	{"REALTIME", CLOCK_REALTIME, 0, 0},
+	{"MONOTONIC", CLOCK_MONOTONIC, 0, 0},
+	{"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, 0, 0},
+	{"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, 0, 0},
+	{"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, 0, 0,},
+	{"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, 0, 0,},
+	{"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, 0, 0,},
+	{"CLOCK_BOOTTIME", CLOCK_BOOTTIME, 0, 0,},
+	{"CLOCK_REALTIME_ALARM", CLOCK_REALTIME_ALARM, 0, 0,},
+	{"CLOCK_BOOTTIME_ALARM", CLOCK_BOOTTIME_ALARM, 0, 0,},
+	{"-1", -1, -1, EINVAL},
 };
 
+static const char *variant_desc[] = {
+	"default (vdso or syscall)",
+	"syscall",
+	"syscall with NULL res parameter" };
+
+static void setup(void)
+{
+	tst_res(TINFO, "Testing variant: %s", variant_desc[tst_variant]);
+}
+
 static void do_test(unsigned int i)
 {
-	TEST(clock_getres(tcase[i].clk_id, tcase[i].res));
+	switch (tst_variant) {
+	case 0:
+		TEST(clock_getres(tcase[i].clk_id, res));
+		break;
+	case 1:
+		TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id, res));
+		break;
+	case 2:
+		TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id, NULL));
+		break;
+	}
 
 	if (TST_RET != tcase[i].ret) {
 		if (TST_ERR == EINVAL) {
@@ -82,4 +84,10 @@
 static struct tst_test test = {
 	.test = do_test,
 	.tcnt = ARRAY_SIZE(tcase),
+	.test_variants = 3,
+	.setup = setup,
+	.bufs = (struct tst_buffers []) {
+		{&res, .size = sizeof(*res)},
+		{},
+	}
 };
diff --git a/testcases/kernel/syscalls/clock_gettime/.gitignore b/testcases/kernel/syscalls/clock_gettime/.gitignore
index 0f9b24a..ba471c8 100644
--- a/testcases/kernel/syscalls/clock_gettime/.gitignore
+++ b/testcases/kernel/syscalls/clock_gettime/.gitignore
@@ -1,2 +1,3 @@
 clock_gettime01
 clock_gettime02
+leapsec01
diff --git a/testcases/kernel/syscalls/clock_gettime/leapsec01.c b/testcases/kernel/syscalls/clock_gettime/leapsec01.c
new file mode 100644
index 0000000..73078fb
--- /dev/null
+++ b/testcases/kernel/syscalls/clock_gettime/leapsec01.c
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Red Hat, Inc., 2012.
+ * Copyright (c) Linux Test Project, 2019
+ *
+ * Author:	Lingzhu Xiang <lxiang@redhat.com>
+ *
+ * Ported to new library:
+ * 07/2019	Christian Amann <camann@suse.com>
+ */
+/*
+ * Regression test for hrtimer early expiration during and after leap seconds
+ *
+ * A bug in the hrtimer subsystem caused all TIMER_ABSTIME CLOCK_REALTIME
+ * timers to expire one second early during leap second.
+ * See http://lwn.net/Articles/504658/.
+ *
+ * This is a regression test for the bug.
+ *
+ * Note: running this test simultaneously with a timesync daemon
+ * (e.g. systemd-timesyncd) can cause this test to fail.
+ */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <stdio.h>
+#include <time.h>
+#include "tst_test.h"
+#include "tst_safe_clocks.h"
+#include "lapi/common_timers.h"
+
+#define SECONDS_BEFORE_LEAP 2
+#define SECONDS_AFTER_LEAP 2
+
+static int errors;
+
+static const char *strtime(const struct timespec *now)
+{
+	static char fmt[256], buf[256];
+
+	if (snprintf(fmt, sizeof(fmt), "%%T.%09ld", now->tv_nsec) < 0) {
+		buf[0] = '\0';
+		return buf;
+	}
+	if (!strftime(buf, sizeof(buf), fmt, localtime(&now->tv_sec))) {
+		buf[0] = '\0';
+		return buf;
+	}
+	return buf;
+}
+
+static inline int in_order(struct timespec a, struct timespec b)
+{
+	if (a.tv_sec < b.tv_sec)
+		return 1;
+	if (a.tv_sec > b.tv_sec)
+		return 0;
+	if (a.tv_nsec > b.tv_nsec)
+		return 0;
+	return 1;
+}
+
+static void adjtimex_status(struct timex *tx, int status)
+{
+	const char *const msgs[6] = {
+		"clock synchronized",
+		"insert leap second",
+		"delete leap second",
+		"leap second in progress",
+		"leap second has occurred",
+		"clock not synchronized",
+	};
+
+	int ret;
+	struct timespec now;
+
+	tx->modes = ADJ_STATUS;
+	tx->status = status;
+	ret = adjtimex(tx);
+	now.tv_sec = tx->time.tv_sec;
+	now.tv_nsec = tx->time.tv_usec * 1000;
+
+	if ((tx->status & status) != status)
+		tst_brk(TBROK, "adjtimex status %d not set", status);
+	else if (ret < 0)
+		tst_brk(TBROK | TERRNO, "adjtimex");
+	else if (ret < 6)
+		tst_res(TINFO, "%s adjtimex: %s", strtime(&now), msgs[ret]);
+	else
+		tst_res(TINFO, "%s adjtimex: clock state %d",
+			 strtime(&now), ret);
+}
+
+static void test_hrtimer_early_expiration(void)
+{
+	struct timespec now, target;
+	int ret;
+
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &now);
+	tst_res(TINFO, "now is     %s", strtime(&now));
+
+	target = now;
+	target.tv_sec++;
+	tst_res(TINFO, "sleep until %s", strtime(&target));
+	ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &target, NULL);
+	if (ret < 0) {
+		tst_res(TINFO | TERRNO, "clock_nanosleep");
+		return;
+	}
+
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &now);
+	tst_res(TINFO, "now is     %s", strtime(&now));
+
+	if (in_order(target, now)) {
+		tst_res(TINFO, "hrtimer early expiration is not detected.");
+	} else {
+		tst_res(TFAIL, "hrtimer early expiration is detected.");
+		errors++;
+	}
+}
+
+static void run_leapsec(void)
+{
+	const struct timespec sleeptime = { 0, NSEC_PER_SEC / 2 };
+	struct timespec now, leap, start;
+	struct timex tx;
+
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &now);
+	start = now;
+	tst_res(TINFO, "test start at %s", strtime(&now));
+
+	test_hrtimer_early_expiration();
+
+	/* calculate the next leap second */
+	now.tv_sec += 86400 - now.tv_sec % 86400;
+	now.tv_nsec = 0;
+	leap = now;
+	tst_res(TINFO, "scheduling leap second %s", strtime(&leap));
+
+	/* start before the leap second */
+	now.tv_sec -= SECONDS_BEFORE_LEAP;
+	SAFE_CLOCK_SETTIME(CLOCK_REALTIME, &now);
+
+	tst_res(TINFO, "setting time to        %s", strtime(&now));
+
+	/* reset NTP time state */
+	adjtimex_status(&tx, STA_PLL);
+	adjtimex_status(&tx, 0);
+
+	/* set the leap second insert flag */
+	adjtimex_status(&tx, STA_INS);
+
+	/* reliably sleep until after the leap second */
+	while (tx.time.tv_sec < leap.tv_sec + SECONDS_AFTER_LEAP) {
+		adjtimex_status(&tx, tx.status);
+		clock_nanosleep(CLOCK_MONOTONIC, 0, &sleeptime, NULL);
+	}
+
+	test_hrtimer_early_expiration();
+
+	adjtimex_status(&tx, STA_PLL);
+	adjtimex_status(&tx, 0);
+
+	/* recover from timer expiring state and restore time */
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &now);
+	start.tv_sec += now.tv_sec - (leap.tv_sec - SECONDS_BEFORE_LEAP);
+	start.tv_nsec += now.tv_nsec;
+	start.tv_sec += start.tv_nsec / NSEC_PER_SEC;
+	start.tv_nsec = start.tv_nsec % NSEC_PER_SEC;
+	tst_res(TINFO, "restoring time to %s", strtime(&start));
+	/* calls clock_was_set() in kernel to revert inconsistency */
+	SAFE_CLOCK_SETTIME(CLOCK_REALTIME, &start);
+
+	test_hrtimer_early_expiration();
+
+	if (!errors)
+		tst_res(TPASS, "No errors were reported during this test!");
+	else
+		tst_res(TFAIL, "Got %d errors during this test!", errors);
+
+}
+
+static void setup(void)
+{
+	errors = 0;
+}
+
+static void cleanup(void)
+{
+	struct timespec now;
+
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &now);
+	/* Calls clock_was_set() in the kernel to revert inconsistencies.
+	 * The only possible error EPERM doesn't matter here. */
+	SAFE_CLOCK_SETTIME(CLOCK_REALTIME, &now);
+}
+
+static struct tst_test test = {
+	.test_all = run_leapsec,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
index 2be211b..d1fb0ee 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd
  *          Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
  *		       Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
  *		       Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <limits.h>
diff --git a/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c b/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
index 244508e..d82d74d 100644
--- a/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
@@ -1,25 +1,9 @@
-/******************************************************************************
- * Copyright (c) M. Koehrer <mathias_koehrer@arcor.de>, 2009                  *
- * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>                          *
- *                                                                            *
- * 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           *
- *                                                                            *
- ******************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * This tests the clock_nanosleep2() syscall.
+ * Copyright (c) M. Koehrer <mathias_koehrer@arcor.de>, 2009
+ * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
  */
+
 #include <stdio.h>
 #include <time.h>
 #include <unistd.h>
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime01.c b/testcases/kernel/syscalls/clock_settime/clock_settime01.c
index c68fe59..62d3491 100644
--- a/testcases/kernel/syscalls/clock_settime/clock_settime01.c
+++ b/testcases/kernel/syscalls/clock_settime/clock_settime01.c
@@ -23,23 +23,24 @@
 #define DELTA_US (long long) (DELTA_SEC * 1000000)
 #define DELTA_EPS (long long) (DELTA_US * 0.1)
 
+static struct timespec *begin, *change, *end;
+
 static void verify_clock_settime(void)
 {
 	long long elapsed;
-	struct timespec begin, change, end;
 
 	/* test 01: move forward */
 
-	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &begin);
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, begin);
 
-	change = tst_timespec_add_us(begin, DELTA_US);
+	*change = tst_timespec_add_us(*begin, DELTA_US);
 
-	if (clock_settime(CLOCK_REALTIME, &change) != 0)
+	if (clock_settime(CLOCK_REALTIME, change) != 0)
 		tst_brk(TBROK | TTERRNO, "could not set realtime change");
 
-	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &end);
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, end);
 
-	elapsed = tst_timespec_diff_us(end, begin);
+	elapsed = tst_timespec_diff_us(*end, *begin);
 
 	if (elapsed >= DELTA_US && elapsed < (DELTA_US + DELTA_EPS))
 		tst_res(TPASS, "clock_settime(2): was able to advance time");
@@ -48,16 +49,16 @@
 
 	/* test 02: move backward */
 
-	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &begin);
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, begin);
 
-	change = tst_timespec_sub_us(begin, DELTA_US);
+	*change = tst_timespec_sub_us(*begin, DELTA_US);
 
-	if (clock_settime(CLOCK_REALTIME, &change) != 0)
+	if (clock_settime(CLOCK_REALTIME, change) != 0)
 		tst_brk(TBROK | TTERRNO, "could not set realtime change");
 
-	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, &end);
+	SAFE_CLOCK_GETTIME(CLOCK_REALTIME, end);
 
-	elapsed = tst_timespec_diff_us(end, begin);
+	elapsed = tst_timespec_diff_us(*end, *begin);
 
 	if (~(elapsed) <= DELTA_US && ~(elapsed) > (DELTA_US - DELTA_EPS))
 		tst_res(TPASS, "clock_settime(2): was able to recede time");
@@ -69,4 +70,10 @@
 	.test_all = verify_clock_settime,
 	.needs_root = 1,
 	.restore_wallclock = 1,
+	.bufs = (struct tst_buffers []) {
+		{&begin, .size = sizeof(*begin)},
+		{&change, .size = sizeof(*change)},
+		{&end, .size = sizeof(*end)},
+		{},
+	}
 };
diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
index a567340..aace308 100644
--- a/testcases/kernel/syscalls/clone/clone08.c
+++ b/testcases/kernel/syscalls/clone/clone08.c
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
  * Copyright (c) 2013 Fujitsu Ltd.
  * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/clone/clone09.c b/testcases/kernel/syscalls/clone/clone09.c
index b133c66..e9e5845 100644
--- a/testcases/kernel/syscalls/clone/clone09.c
+++ b/testcases/kernel/syscalls/clone/clone09.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Oracle and/or its affiliates. All Rights Reserved.
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/copy_file_range/.gitignore b/testcases/kernel/syscalls/copy_file_range/.gitignore
index 6807420..e9e35f6 100644
--- a/testcases/kernel/syscalls/copy_file_range/.gitignore
+++ b/testcases/kernel/syscalls/copy_file_range/.gitignore
@@ -1 +1,3 @@
 /copy_file_range01
+/copy_file_range02
+/copy_file_range03
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range.h b/testcases/kernel/syscalls/copy_file_range/copy_file_range.h
new file mode 100644
index 0000000..1d80ab0
--- /dev/null
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range.h
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+
+#ifndef __COPY_FILE_RANGE_H__
+#define __COPY_FILE_RANGE_H__
+
+#include <stdio.h>
+#include "lapi/syscalls.h"
+#include "lapi/fs.h"
+
+#define TEST_VARIANTS	2
+
+#define MNTPOINT	"mnt_point"
+#define FILE_SRC_PATH   "file_src"
+#define FILE_DEST_PATH  "file_dest"
+#define FILE_RDONL_PATH "file_rdonl"
+#define FILE_DIR_PATH	"file_dir"
+#define FILE_MNTED_PATH  MNTPOINT"/file_mnted"
+#define FILE_IMMUTABLE_PATH "file_immutable"
+#define FILE_SWAP_PATH "file_swap"
+#define FILE_CHRDEV    "/dev/null"
+#define FILE_FIFO      "file_fifo"
+#define FILE_COPY_PATH  "file_copy"
+
+#define CONTENT		"ABCDEFGHIJKLMNOPQRSTUVWXYZ12345\n"
+#define CONTSIZE	(sizeof(CONTENT) - 1)
+#define MIN_OFF   65537
+
+static void syscall_info(void)
+{
+	switch (tst_variant) {
+	case 0:
+		tst_res(TINFO, "Testing libc copy_file_range()");
+		break;
+	case 1:
+		tst_res(TINFO, "Testing __NR_copy_file_range syscall");
+	}
+}
+
+static int sys_copy_file_range(int fd_in, loff_t *off_in,
+		int fd_out, loff_t *off_out, size_t len, unsigned int flags)
+{
+	switch (tst_variant) {
+
+	case 0:
+#ifdef HAVE_COPY_FILE_RANGE
+		return copy_file_range(fd_in, off_in,
+				fd_out, off_out, len, flags);
+#else
+		tst_brk(TCONF, "libc copy_file_range() not supported");
+#endif
+		break;
+	case 1:
+		return tst_syscall(__NR_copy_file_range, fd_in, off_in, fd_out,
+				off_out, len, flags);
+	}
+	return -1;
+}
+
+static inline int verify_cross_fs_copy_support(const char *path_in, const char *path_out)
+{
+	int i, fd, fd_test;
+
+	fd = SAFE_OPEN(path_in, O_RDWR | O_CREAT, 0664);
+	/* Writing page_size * 4 of data into test file */
+	for (i = 0; i < (int)(getpagesize() * 4); i++)
+		SAFE_WRITE(1, fd, CONTENT, CONTSIZE);
+
+	fd_test = SAFE_OPEN(path_out, O_RDWR | O_CREAT, 0664);
+	TEST(sys_copy_file_range(fd, 0, fd_test, 0, CONTSIZE, 0));
+
+	SAFE_CLOSE(fd_test);
+	remove(FILE_MNTED_PATH);
+	SAFE_CLOSE(fd);
+
+	return TST_ERR == EXDEV ? 0 : 1;
+}
+
+#endif /* __COPY_FILE_RANGE_H__ */
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
index 61a6042..7d27007 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
@@ -1,66 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) Linux Test Project, 2017
+ * Copyright (c) Linux Test Project, 2019
+ */
+
+/*
+ * This tests the fundamental functionalities of the copy_file_range
+ * syscall. It does so by copying the contents of one file into
+ * another using various different combinations for length and
+ * input/output offsets.
  *
- * 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.
+ * After a copy is done this test checks if the contents of both files
+ * are equal at the given offsets. It is also inspected if the offsets
+ * of the file descriptors are advanced correctly.
  */
 
 #define _GNU_SOURCE
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
+
 #include "tst_test.h"
 #include "tst_safe_stdio.h"
-#include "lapi/syscalls.h"
+#include "copy_file_range.h"
 
-#define TEST_FILE_1 "copy_file_range_ltp01.txt"
-#define TEST_FILE_2 "copy_file_range_ltp02.txt"
-#define STR "abcdefghijklmnopqrstuvwxyz12345\n"
+static int page_size;
+static int errcount, numcopies;
+static int fd_in, fd_out, cross_sup;
 
-#define verbose 0
-
-static size_t *len_arr;
-static loff_t **off_arr;
-static int len_sz, off_sz;
-
-static void setup(void)
-{
-	int i, fd, page_size;
-
-	page_size = getpagesize();
-
-	fd = SAFE_OPEN(TEST_FILE_1, O_RDWR | O_CREAT, 0664);
-	/* Writing page_size * 4 of data into test file */
-	for (i = 0; i < (int)(page_size * 4); i++)
-		SAFE_WRITE(1, fd, STR, strlen(STR));
-	SAFE_CLOSE(fd);
-
-	len_sz = 4;
-	len_arr = malloc(sizeof(size_t) * len_sz);
-	len_arr[0] = 11;
-	len_arr[1] = page_size - 1;
-	len_arr[2] = page_size;
-	len_arr[3] = page_size + 1;
-
-	off_sz = 6;
-	off_arr = malloc(sizeof(loff_t *) * off_sz);
-	for (i = 1; i < off_sz; i++)
-		off_arr[i] = malloc(sizeof(loff_t));
-
-	off_arr[0] = NULL;
-	*off_arr[1] = 0;
-	*off_arr[2] = 17;
-	*off_arr[3] = page_size - 1;
-	*off_arr[4] = page_size;
-	*off_arr[5] = page_size + 1;
-}
+static struct tcase {
+	char    *path;
+	int     flags;
+	char    *message;
+} tcases[] = {
+	{FILE_DEST_PATH,  0, "non cross-device"},
+	{FILE_MNTED_PATH, 1, "cross-device"},
+};
 
 static int check_file_content(const char *fname1, const char *fname2,
 	loff_t *off1, loff_t *off2, size_t len)
@@ -90,130 +61,175 @@
 }
 
 static int check_file_offset(const char *m, int fd, loff_t len,
-	loff_t *off_ori, loff_t *off_after)
+		loff_t *off_before, loff_t *off_after)
 {
+	loff_t fd_off = SAFE_LSEEK(fd, 0, SEEK_CUR);
 	int ret = 0;
 
-	if (off_ori) {
-		/* FD should stay untouched, and off_in/out is updated */
-		loff_t fd_off = SAFE_LSEEK(fd, 0, SEEK_CUR);
-
-		if (fd_off == 0) {
-			if (verbose)
-				tst_res(TPASS, "%s FD offset unchanged", m);
-		} else {
-			tst_res(TFAIL, "%s FD offset changed: %ld",
+	if (off_before) {
+		/*
+		 * copy_file_range offset is given:
+		 * - fd offset should stay 0,
+		 * - copy_file_range offset is updated
+		 */
+		if (fd_off != 0) {
+			tst_res(TFAIL,
+				"%s fd offset unexpectedly changed: %ld",
 				m, (long)fd_off);
 			ret = 1;
-		}
 
-		if (!off_after) {
-			tst_res(TFAIL, "%s offset is NULL", m);
-			ret = 1;
-		}
-
-		if ((off_after) && (*off_ori + len == *off_after)) {
-			if (verbose) {
-				tst_res(TPASS, "%s offset advanced as"
-					" expected: %ld", m, (long)*off_after);
-			}
-		} else {
+		} else if (*off_before + len != *off_after) {
 			tst_res(TFAIL, "%s offset unexpected value: %ld",
 				m, (long)*off_after);
 			ret = 1;
 		}
-	} else {
-		/* FD offset is advanced by len */
-		loff_t fd_off = SAFE_LSEEK(fd, 0, SEEK_CUR);
-
-		if (fd_off == len) {
-			if (verbose) {
-				tst_res(TPASS, "%s FD offset changed as"
-					" expected: %ld", m, (long)fd_off);
-			}
-		} else {
-			tst_res(TFAIL, "%s FD offset unexpected value: %ld",
+	}
+	/*
+	 * no copy_file_range offset given:
+	 * - fd offset advanced by length
+	 */
+	else if (fd_off != len) {
+		tst_res(TFAIL, "%s fd offset unexpected value: %ld",
 				m, (long)fd_off);
-			ret = 1;
-		}
+		ret = 1;
 	}
 
 	return ret;
 }
 
-static void test_one(size_t len, loff_t *off_in, loff_t *off_out)
+static void test_one(size_t len, loff_t *off_in, loff_t *off_out, char *path)
 {
+	int ret;
 	size_t to_copy = len;
-	int fd_in, fd_out, ret;
-	loff_t *off_in_ori = off_in;
-	loff_t *off_out_ori = off_out;
-	loff_t off_in_copy;
-	loff_t off_out_copy;
+	loff_t off_in_value_copy, off_out_value_copy;
+	loff_t *off_new_in  = &off_in_value_copy;
+	loff_t *off_new_out = &off_out_value_copy;
 	char str_off_in[32], str_off_out[32];
 
 	if (off_in) {
-		off_in_copy = *off_in;
-		off_in = &off_in_copy;
+		off_in_value_copy = *off_in;
 		sprintf(str_off_in, "%ld", (long)*off_in);
 	} else {
+		off_new_in = NULL;
 		strcpy(str_off_in, "NULL");
 	}
 
 	if (off_out) {
-		off_out_copy = *off_out;
-		off_out = &off_out_copy;
+		off_out_value_copy = *off_out;
 		sprintf(str_off_out, "%ld", (long)*off_out);
 	} else {
+		off_new_out = NULL;
 		strcpy(str_off_out, "NULL");
 	}
 
-	fd_in = SAFE_OPEN(TEST_FILE_1, O_RDONLY);
-	fd_out = SAFE_OPEN(TEST_FILE_2, O_CREAT | O_WRONLY | O_TRUNC, 0644);
-
 	/*
 	 * copy_file_range() will return the number of bytes copied between
 	 * files. This could be less than the length originally requested.
 	 */
 	do {
-		TEST(tst_syscall(__NR_copy_file_range, fd_in, off_in, fd_out,
-			off_out, to_copy, 0));
+		TEST(sys_copy_file_range(fd_in, off_new_in, fd_out,
+				off_new_out, to_copy, 0));
 		if (TST_RET == -1) {
 			tst_res(TFAIL | TTERRNO, "copy_file_range() failed");
-			SAFE_CLOSE(fd_in);
-			SAFE_CLOSE(fd_out);
+			errcount++;
 			return;
 		}
 
 		to_copy -= TST_RET;
 	} while (to_copy > 0);
 
-	ret = check_file_content(TEST_FILE_1, TEST_FILE_2,
-		off_in_ori, off_out_ori, len);
-	if (ret)
+	ret = check_file_content(FILE_SRC_PATH, path,
+		off_in, off_out, len);
+	if (ret) {
 		tst_res(TFAIL, "file contents do not match");
+		errcount++;
+		return;
+	}
 
-	ret |= check_file_offset("(in)", fd_in, len, off_in_ori, off_in);
-	ret |= check_file_offset("(out)", fd_out, len, off_out_ori, off_out);
+	ret |= check_file_offset("(in)", fd_in, len, off_in, off_new_in);
+	ret |= check_file_offset("(out)", fd_out, len, off_out, off_new_out);
 
-	tst_res(ret == 0 ? TPASS : TFAIL, "off_in: %s, off_out: %s, len: %ld",
-			str_off_in, str_off_out, (long)len);
-
-	SAFE_CLOSE(fd_in);
-	SAFE_CLOSE(fd_out);
+	if (ret != 0) {
+		tst_res(TFAIL, "off_in: %s, off_out: %s, len: %ld",
+				str_off_in, str_off_out, (long)len);
+		errcount++;
+	}
 }
 
-static void copy_file_range_verify(void)
+static void open_files(char *path)
+{
+	fd_in  = SAFE_OPEN(FILE_SRC_PATH, O_RDONLY);
+	fd_out = SAFE_OPEN(path, O_CREAT | O_WRONLY | O_TRUNC, 0644);
+}
+
+static void close_files(void)
+{
+	if (fd_out > 0)
+		SAFE_CLOSE(fd_out);
+	if (fd_in  > 0)
+		SAFE_CLOSE(fd_in);
+}
+
+static void copy_file_range_verify(unsigned int n)
 {
 	int i, j, k;
+	struct tcase *tc = &tcases[n];
 
-	for (i = 0; i < len_sz; i++)
-		for (j = 0; j < off_sz; j++)
-			for (k = 0; k < off_sz; k++)
-				test_one(len_arr[i], off_arr[j], off_arr[k]);
+	if (tc->flags && !cross_sup) {
+		tst_res(TCONF,
+			"copy_file_range() doesn't support cross-device, skip it");
+		return;
+	}
+
+	errcount = numcopies = 0;
+	size_t len_arr[]	= {11, page_size-1, page_size, page_size+1};
+	loff_t off_arr_values[]	= {0, 17, page_size-1, page_size, page_size+1};
+
+	int num_offsets = ARRAY_SIZE(off_arr_values) + 1;
+	loff_t *off_arr[num_offsets];
+
+	off_arr[0] = NULL;
+	for (i = 1; i < num_offsets; i++)
+		off_arr[i] = &off_arr_values[i-1];
+
+	/* Test all possible cobinations of given lengths and offsets */
+	for (i = 0; i < (int)ARRAY_SIZE(len_arr); i++)
+		for (j = 0; j < num_offsets; j++)
+			for (k = 0; k < num_offsets; k++) {
+				open_files(tc->path);
+				test_one(len_arr[i], off_arr[j], off_arr[k], tc->path);
+				close_files();
+				numcopies++;
+			}
+
+	if (errcount == 0)
+		tst_res(TPASS,
+			"%s copy_file_range completed all %d copy jobs successfully!",
+			tc->message, numcopies);
+	else
+		tst_res(TFAIL, "%s copy_file_range failed %d of %d copy jobs.",
+			tc->message, errcount, numcopies);
+}
+
+static void setup(void)
+{
+	syscall_info();
+	page_size = getpagesize();
+	cross_sup = verify_cross_fs_copy_support(FILE_SRC_PATH, FILE_MNTED_PATH);
+}
+
+static void cleanup(void)
+{
+	close_files();
 }
 
 static struct tst_test test = {
 	.setup = setup,
-	.needs_tmpdir = 1,
-	.test_all = copy_file_range_verify,
+	.cleanup = cleanup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.all_filesystems = 1,
+	.test = copy_file_range_verify,
+	.test_variants = TEST_VARIANTS,
 };
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
new file mode 100644
index 0000000..c09766f
--- /dev/null
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
@@ -0,0 +1,252 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+
+/*
+ * Tests basic error handling of the
+ * copy_file_range syscall
+ *
+ * 1) Try to copy contents to file open as readonly
+ *    -> EBADF
+ * 2) Try to copy contents to directory -> EISDIR
+ * 3) Try to copy contents to a file opened with the
+ *    O_APPEND flag -> EBADF
+ * 4) Try to copy contents to closed file descriptor
+ *    -> EBADF
+ * 5) Try to copy contents with invalid 'flags' value
+ *    -> EINVAL
+ * 6) Try to copy contents to a file chattred with +i
+ *    flag -> EPERM
+ * 7) Try to copy contents to a swapfile ->ETXTBSY
+ * 8) Try to copy contents to the same file with overlapping
+ *    ->EINVAL
+ * 9) Try to copy contents to a blkdev ->EINVAL
+ * 10) Try to copy contents to a chardev ->EINVAL
+ * 11) Try to copy contents to a FIFO ->EINVAL
+ * 12) Try to copy contenst to a PIPE ->EINVAL
+ * 13) Try to copy contents to a file with length beyond
+ *     16EiB wraps around 0 -> EOVERFLOW
+ * 14) Try to copy contents to a file with target file range
+ *     beyond maximum supported file size ->EFBIG
+ */
+
+#define _GNU_SOURCE
+
+#include "tst_test.h"
+#include "copy_file_range.h"
+
+static int fd_src;
+static int fd_dest;
+static int fd_rdonly;
+static int fd_dir;
+static int fd_closed;
+static int fd_append;
+static int fd_immutable;
+static int fd_swapfile;
+static int fd_dup;
+static int fd_blkdev;
+static int fd_chrdev;
+static int fd_fifo;
+static int fd_pipe[2];
+static int fd_copy;
+static int need_unlink;
+
+static int chattr_i_nsup;
+static int swap_nsup;
+static int cross_sup;
+static int loop_devn;
+
+static struct tcase {
+	int	*copy_to_fd;
+	int	flags;
+	int	exp_err;
+	loff_t     len;
+	const char *tname;
+	int     new_error;
+} tcases[] = {
+	{&fd_rdonly,	0,	EBADF,		CONTSIZE,	"readonly file",	0},
+	{&fd_dir,	0,	EISDIR,		CONTSIZE,	"directory",	0},
+	{&fd_append,	0,	EBADF,		CONTSIZE,	"append to file",	0},
+	{&fd_closed,	0,	EBADF,		CONTSIZE,	"closed file descriptor",	0},
+	{&fd_dest,	-1,	EINVAL,		CONTSIZE,	"invalid flags",	0},
+	{&fd_immutable,	0,	EPERM,		CONTSIZE,	"immutable file",	1},
+	{&fd_swapfile,	0,	ETXTBSY,	CONTSIZE,	"swap file",	1},
+	{&fd_dup,	0,	EINVAL,		CONTSIZE/2,	"overlaping range",	1},
+	{&fd_blkdev,	0,	EINVAL,		CONTSIZE,	"block device", 	0},
+	{&fd_chrdev,	0,	EINVAL,		CONTSIZE,	"char device",	0},
+	{&fd_fifo,	0,	EINVAL,		CONTSIZE,	"fifo", 	0},
+	{&fd_pipe[0],	0,	EINVAL,		CONTSIZE,	"pipe", 	0},
+	{&fd_copy,	0,	EOVERFLOW,	ULLONG_MAX,	"max length lenght", 	1},
+	{&fd_copy,	0,	EFBIG,		MIN_OFF,	"max file size", 	1},
+};
+
+static int run_command(char *command, char *option, char *file)
+{
+	const char *const cmd[] = {command, option, file, NULL};
+	int ret;
+
+	ret = tst_run_cmd(cmd, NULL, NULL, 1);
+	switch (ret) {
+	case 0:
+	return 0;
+	case 255:
+		tst_res(TCONF, "%s binary not installed or failed", command);
+	return 1;
+	default:
+		tst_res(TCONF, "%s exited with %i", command, ret);
+	return 2;
+	}
+}
+
+static void verify_copy_file_range(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+	loff_t dst = 0;
+
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+
+	if (tc->new_error && !cross_sup) {
+		tst_res(TCONF,
+			"copy_file_range() doesn't support cross-device, skip it");
+		return;
+	}
+	if (tc->copy_to_fd == &fd_immutable && chattr_i_nsup) {
+		tst_res(TCONF, "filesystem doesn't support chattr +i, skip it");
+		return;
+	}
+	if (tc->copy_to_fd == &fd_swapfile && swap_nsup) {
+		tst_res(TCONF, "filesystem doesn't support swapfile, skip it");
+		return;
+	}
+	if (tc->copy_to_fd == &fd_blkdev && loop_devn == -1) {
+		tst_res(TCONF, "filesystem doesn't have free loopdev, skip it");
+		return;
+	}
+
+	if (tc->copy_to_fd == &fd_copy)
+		dst = tst_max_lfs_filesize();
+
+	TEST(sys_copy_file_range(fd_src, 0, *tc->copy_to_fd,
+				&dst, tc->len, tc->flags));
+
+	if (TST_RET == -1) {
+		if (tc->exp_err == TST_ERR) {
+			tst_res(TPASS | TTERRNO,
+					"copy_file_range failed as expected");
+		} else {
+			tst_res(TFAIL | TTERRNO,
+				"copy_file_range failed unexpectedly; expected %s, but got",
+				tst_strerrno(tc->exp_err));
+			return;
+		}
+	} else {
+		tst_res(TFAIL,
+			"copy_file_range returned wrong value: %ld", TST_RET);
+	}
+}
+
+static void cleanup(void)
+{
+	if (fd_append > 0)
+		SAFE_CLOSE(fd_append);
+	if (fd_dir > 0)
+		SAFE_CLOSE(fd_dir);
+	if (fd_rdonly > 0)
+		SAFE_CLOSE(fd_rdonly);
+	if (fd_dest > 0)
+		SAFE_CLOSE(fd_dest);
+	if (fd_src > 0)
+		SAFE_CLOSE(fd_src);
+	if (fd_immutable > 0) {
+		run_command("chattr", "-i", FILE_IMMUTABLE_PATH);
+		SAFE_CLOSE(fd_immutable);
+	}
+	if (fd_swapfile > 0) {
+		run_command("swapoff", FILE_SWAP_PATH, NULL);
+		SAFE_CLOSE(fd_swapfile);
+	}
+	if (fd_dup > 0)
+		SAFE_CLOSE(fd_dup);
+	if (fd_copy > 0)
+		SAFE_CLOSE(fd_copy);
+	if (need_unlink > 0)
+		SAFE_UNLINK(FILE_FIFO);
+
+	if (fd_pipe[0] > 0) {
+		SAFE_CLOSE(fd_pipe[0]);
+		SAFE_CLOSE(fd_pipe[1]);
+	}
+}
+
+static void setup(void)
+{
+	syscall_info();
+	char dev_path[1024];
+
+	cross_sup = verify_cross_fs_copy_support(FILE_SRC_PATH, FILE_MNTED_PATH);
+
+	if (access(FILE_DIR_PATH, F_OK) == -1)
+		SAFE_MKDIR(FILE_DIR_PATH, 0777);
+	/*
+	 * call tst_find_free_loopdev(), avoid overwriting its
+	 * content on used loopdev.
+	 */
+	loop_devn = tst_find_free_loopdev(dev_path, sizeof(dev_path));
+
+	SAFE_MKNOD(FILE_FIFO, S_IFIFO | 0777, 0);
+	need_unlink = 1;
+
+	fd_src    = SAFE_OPEN(FILE_SRC_PATH, O_RDWR | O_CREAT, 0664);
+	fd_dest   = SAFE_OPEN(FILE_DEST_PATH, O_RDWR | O_CREAT, 0664);
+	fd_rdonly = SAFE_OPEN(FILE_RDONL_PATH, O_RDONLY | O_CREAT, 0664);
+	fd_dir    = SAFE_OPEN(FILE_DIR_PATH, O_DIRECTORY);
+	fd_closed = -1;
+	fd_append = SAFE_OPEN(FILE_DEST_PATH,
+			O_RDWR | O_CREAT | O_APPEND, 0664);
+	fd_immutable = SAFE_OPEN(FILE_IMMUTABLE_PATH, O_RDWR | O_CREAT, 0664);
+	fd_swapfile = SAFE_OPEN(FILE_SWAP_PATH, O_RDWR | O_CREAT, 0600);
+
+	if (loop_devn != -1)
+		fd_blkdev = SAFE_OPEN(dev_path, O_RDWR, 0600);
+
+	fd_chrdev = SAFE_OPEN(FILE_CHRDEV, O_RDWR, 0600);
+	fd_fifo = SAFE_OPEN(FILE_FIFO, O_RDWR, 0600);
+
+	SAFE_PIPE(fd_pipe);
+
+	SAFE_WRITE(1, fd_src, CONTENT, CONTSIZE);
+	close(fd_src);
+	fd_src = SAFE_OPEN(FILE_SRC_PATH, O_RDONLY, 0664);
+	fd_dup = SAFE_OPEN(FILE_SRC_PATH, O_WRONLY|O_CREAT, 0666);
+
+	fd_copy = SAFE_OPEN(FILE_COPY_PATH, O_RDWR | O_CREAT | O_TRUNC, 0664);
+	chattr_i_nsup = run_command("chattr", "+i", FILE_IMMUTABLE_PATH);
+
+	if (!tst_fs_has_free(".", sysconf(_SC_PAGESIZE) * 10, TST_BYTES)) {
+		tst_res(TCONF, "Insufficient disk space to create swap file");
+		swap_nsup = 3;
+		return;
+	}
+
+	if (tst_fill_file(FILE_SWAP_PATH, 0, sysconf(_SC_PAGESIZE), 10) != 0) {
+		tst_res(TCONF, "Failed to create swapfile");
+		swap_nsup = 4;
+		return;
+	}
+
+	swap_nsup = run_command("mkswap", FILE_SWAP_PATH, NULL);
+	swap_nsup = run_command("swapon", FILE_SWAP_PATH, NULL);
+}
+
+static struct tst_test test = {
+	.test = verify_copy_file_range,
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+	.cleanup = cleanup,
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.needs_root = 1,
+	.test_variants = TEST_VARIANTS,
+};
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range03.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range03.c
new file mode 100644
index 0000000..253eb57
--- /dev/null
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range03.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+
+/*
+ * Copies the contents of one file into another and
+ * checks if the timestamp gets updated in the process.
+ */
+
+#define _GNU_SOURCE
+
+#include "tst_test.h"
+#include "copy_file_range.h"
+
+static int fd_src;
+static int fd_dest;
+
+unsigned long get_timestamp(int fd)
+{
+	struct stat filestat;
+
+	fstat(fd, &filestat);
+	return filestat.st_mtime;
+}
+
+static void verify_copy_file_range_timestamp(void)
+{
+	loff_t offset;
+	unsigned long timestamp, updated_timestamp;
+
+	timestamp = get_timestamp(fd_dest);
+	usleep(1000000);
+
+	offset = 0;
+	TEST(sys_copy_file_range(fd_src, &offset,
+			fd_dest, 0, CONTSIZE, 0));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO,
+				"copy_file_range unexpectedly failed");
+
+	updated_timestamp = get_timestamp(fd_dest);
+
+	if (timestamp == updated_timestamp)
+		tst_brk(TFAIL, "copy_file_range did not update timestamp.");
+
+	tst_res(TPASS, "copy_file_range sucessfully updated the timestamp");
+}
+
+static void cleanup(void)
+{
+	if (fd_dest > 0)
+		SAFE_CLOSE(fd_dest);
+	if (fd_src  > 0)
+		SAFE_CLOSE(fd_src);
+}
+
+static void setup(void)
+{
+	syscall_info();
+
+	fd_dest = SAFE_OPEN(FILE_DEST_PATH, O_RDWR | O_CREAT, 0664);
+	fd_src  = SAFE_OPEN(FILE_SRC_PATH,  O_RDWR | O_CREAT, 0664);
+	SAFE_WRITE(1, fd_src,  CONTENT,  CONTSIZE);
+	SAFE_CLOSE(fd_src);
+	fd_src = SAFE_OPEN(FILE_SRC_PATH, O_RDONLY);
+}
+
+
+static struct tst_test test = {
+	.test_all = verify_copy_file_range_timestamp,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+	.test_variants = TEST_VARIANTS,
+};
diff --git a/testcases/kernel/syscalls/creat/creat01.c b/testcases/kernel/syscalls/creat/creat01.c
index 5d0ffc6..6bd2c59 100644
--- a/testcases/kernel/syscalls/creat/creat01.c
+++ b/testcases/kernel/syscalls/creat/creat01.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
- *
- * 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
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
diff --git a/testcases/kernel/syscalls/creat/creat03.c b/testcases/kernel/syscalls/creat/creat03.c
index f095fb6..7580e58 100644
--- a/testcases/kernel/syscalls/creat/creat03.c
+++ b/testcases/kernel/syscalls/creat/creat03.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
- *
- * 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
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
diff --git a/testcases/kernel/syscalls/creat/creat04.c b/testcases/kernel/syscalls/creat/creat04.c
index 623ede0..043bd45 100644
--- a/testcases/kernel/syscalls/creat/creat04.c
+++ b/testcases/kernel/syscalls/creat/creat04.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
- *
- * 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
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
diff --git a/testcases/kernel/syscalls/creat/creat05.c b/testcases/kernel/syscalls/creat/creat05.c
index 037a113..bf40994 100644
--- a/testcases/kernel/syscalls/creat/creat05.c
+++ b/testcases/kernel/syscalls/creat/creat05.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
- *
- * 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
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
diff --git a/testcases/kernel/syscalls/creat/creat06.c b/testcases/kernel/syscalls/creat/creat06.c
index 146d518..5c82e47 100644
--- a/testcases/kernel/syscalls/creat/creat06.c
+++ b/testcases/kernel/syscalls/creat/creat06.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *    Ported by Wayne Boyer
- *
- * 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
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
@@ -166,7 +153,6 @@
 	.test = verify_creat,
 	.needs_root = 1,
 	.needs_rofs = 1,
-	.needs_tmpdir = 1,
 	.mntpoint = "mntpoint",
 	.setup = setup,
 };
diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
index 435e5d5..1e97794 100644
--- a/testcases/kernel/syscalls/creat/creat07.c
+++ b/testcases/kernel/syscalls/creat/creat07.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2012-2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/creat/creat07_child.c b/testcases/kernel/syscalls/creat/creat07_child.c
index 802dde4..2e36c40 100644
--- a/testcases/kernel/syscalls/creat/creat07_child.c
+++ b/testcases/kernel/syscalls/creat/creat07_child.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2012 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 #include <unistd.h>
diff --git a/testcases/kernel/syscalls/dup2/dup201.c b/testcases/kernel/syscalls/dup2/dup201.c
index 4507ac1..4fa3446 100644
--- a/testcases/kernel/syscalls/dup2/dup201.c
+++ b/testcases/kernel/syscalls/dup2/dup201.c
@@ -75,9 +75,6 @@
 int goodfd = 5;
 int badfd = -1;
 int mystdout = 0;
-int fd, fd1;
-int mypid;
-char fname[20];
 
 struct test_case_t {
 	int *ofd;
@@ -86,22 +83,19 @@
 	void (*setupfunc) ();
 } TC[] = {
 	/* First fd argument is less than 0 - EBADF */
-	{
-	&badfd, &goodfd, EBADF, NULL},
+	{&badfd, &goodfd, EBADF, NULL},
 	    /* First fd argument is getdtablesize() - EBADF */
-	{
-	&maxfd, &goodfd, EBADF, NULL},
+	{&maxfd, &goodfd, EBADF, NULL},
 	    /* Second fd argument is less than 0 - EBADF */
-	{
-	&mystdout, &badfd, EBADF, NULL},
+	{&mystdout, &badfd, EBADF, NULL},
 	    /* Second fd argument is getdtablesize() - EBADF */
-	{
-&mystdout, &maxfd, EBADF, NULL},};
+	{&mystdout, &maxfd, EBADF, NULL},
+};
 
 int main(int ac, char **av)
 {
 	int lc;
-	int i, j;
+	int i;
 
 	tst_parse_opts(ac, av, NULL, NULL);
 
@@ -137,12 +131,6 @@
 					 strerror(TC[i].error));
 			}
 		}
-		/* cleanup things in case we are looping */
-		for (j = fd1; j < maxfd; j++) {
-			sprintf(fname, "dup201.%d.%d", j, mypid);
-			(void)close(j);
-			(void)unlink(fname);
-		}
 	}
 	cleanup();
 
@@ -163,7 +151,6 @@
 
 	/* get some test specific values */
 	maxfd = getdtablesize();
-	mypid = getpid();
 }
 
 /*
@@ -172,6 +159,5 @@
  */
 void cleanup(void)
 {
-
 	tst_rmdir();
 }
diff --git a/testcases/kernel/syscalls/epoll_create1/epoll_create1_01.c b/testcases/kernel/syscalls/epoll_create1/epoll_create1_01.c
index 85f14c4..41aa634 100644
--- a/testcases/kernel/syscalls/epoll_create1/epoll_create1_01.c
+++ b/testcases/kernel/syscalls/epoll_create1/epoll_create1_01.c
@@ -1,24 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Ulrich Drepper <drepper@redhat.com>
- * Copyright (c) International Business Machines  Corp., 2009
+ * Copyright (c) International Business Machines Corp., 2009
  *
- * 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;
- *
- * Test:        epoll_create1_01.c
- *
- * Description: This Program tests the new system call introduced in 2.6.27.
- *              Ulrich´s comment as in:
+ * Test system call introduced in 2.6.27.
  * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a0998b50c3f0b8fdd265c63e0032f86ebe377dbf
  *
  * This patch adds the new epoll_create1 syscall.  It extends the old
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
index 4df55b5..e199ac6 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * alone with this program.
  */
 
 /*
@@ -31,7 +21,7 @@
 
 #include <sys/epoll.h>
 #include <poll.h>
-#include <strings.h>
+#include <string.h>
 #include <errno.h>
 #include "tst_test.h"
 
@@ -98,7 +88,7 @@
 
 	while (events) {
 		int events_matched = 0;
-		bzero(res_evs, sizeof(res_evs));
+		memset(res_evs, 0, sizeof(res_evs));
 
 		res = epoll_wait(epfd, res_evs, 2, -1);
 		if (res <= 0) {
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c
index ce9b55e..280fd67 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * alone with this program.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
index 1d2906a..f9fd065 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Fujitsu Ltd.
  * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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.
  */
 
 /*
@@ -26,7 +14,6 @@
 #include <sys/epoll.h>
 #include <poll.h>
 #include <string.h>
-#include <strings.h>
 #include <errno.h>
 
 #include "tst_test.h"
@@ -191,7 +178,7 @@
 	while (events) {
 		int events_matched = 0;
 
-		bzero(ret_evs, sizeof(ret_evs));
+		memset(ret_evs, 0, sizeof(ret_evs));
 		TEST(epoll_wait(epfd, ret_evs, 2, -1));
 
 		if (TST_RET <= 0) {
diff --git a/testcases/kernel/syscalls/execl/execl01.c b/testcases/kernel/syscalls/execl/execl01.c
index c81a194..4ec94b5 100644
--- a/testcases/kernel/syscalls/execl/execl01.c
+++ b/testcases/kernel/syscalls/execl/execl01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/execl/execl01_child.c b/testcases/kernel/syscalls/execl/execl01_child.c
index 8a6e512..fe96b33 100644
--- a/testcases/kernel/syscalls/execl/execl01_child.c
+++ b/testcases/kernel/syscalls/execl/execl01_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis chrubis@suse.cz
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/syscalls/execle/execle01.c b/testcases/kernel/syscalls/execle/execle01.c
index 0099789..8df1cc6 100644
--- a/testcases/kernel/syscalls/execle/execle01.c
+++ b/testcases/kernel/syscalls/execle/execle01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/execle/execle01_child.c b/testcases/kernel/syscalls/execle/execle01_child.c
index 0ebfaa8..5846ca4 100644
--- a/testcases/kernel/syscalls/execle/execle01_child.c
+++ b/testcases/kernel/syscalls/execle/execle01_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis chrubis@suse.cz
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/syscalls/execlp/execlp01.c b/testcases/kernel/syscalls/execlp/execlp01.c
index 50ee872..61a81c6 100644
--- a/testcases/kernel/syscalls/execlp/execlp01.c
+++ b/testcases/kernel/syscalls/execlp/execlp01.c
@@ -1,24 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/execlp/execlp01_child.c b/testcases/kernel/syscalls/execlp/execlp01_child.c
index 8a6e512..fe96b33 100644
--- a/testcases/kernel/syscalls/execlp/execlp01_child.c
+++ b/testcases/kernel/syscalls/execlp/execlp01_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis chrubis@suse.cz
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/syscalls/execv/execv01.c b/testcases/kernel/syscalls/execv/execv01.c
index 5fa5b89..58c61a3 100644
--- a/testcases/kernel/syscalls/execv/execv01.c
+++ b/testcases/kernel/syscalls/execv/execv01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/execv/execv01_child.c b/testcases/kernel/syscalls/execv/execv01_child.c
index 307810c..1beda70 100644
--- a/testcases/kernel/syscalls/execv/execv01_child.c
+++ b/testcases/kernel/syscalls/execv/execv01_child.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/syscalls/execve/execve01.c b/testcases/kernel/syscalls/execve/execve01.c
index c342eba..9331c94 100644
--- a/testcases/kernel/syscalls/execve/execve01.c
+++ b/testcases/kernel/syscalls/execve/execve01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/execve/execve01_child.c b/testcases/kernel/syscalls/execve/execve01_child.c
index 0ebfaa8..5846ca4 100644
--- a/testcases/kernel/syscalls/execve/execve01_child.c
+++ b/testcases/kernel/syscalls/execve/execve01_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis chrubis@suse.cz
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/syscalls/execve/execve02.c b/testcases/kernel/syscalls/execve/execve02.c
index 5b2a3a2..d9fb5b9 100644
--- a/testcases/kernel/syscalls/execve/execve02.c
+++ b/testcases/kernel/syscalls/execve/execve02.c
@@ -1,23 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (c) 2015 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *
- *  07/2001 Ported by Wayne Boyer
+ * Ported to LTP: Wayne Boyer
  *  21/04/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/execve/execve03.c b/testcases/kernel/syscalls/execve/execve03.c
index 0cb8699..3d73265 100644
--- a/testcases/kernel/syscalls/execve/execve03.c
+++ b/testcases/kernel/syscalls/execve/execve03.c
@@ -1,29 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
- * Copyright (c) International Business Machines  Corp., 2001
- *
- *  07/2001 Ported by Wayne Boyer
- *  21/04/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
- *
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
+ * Copyright (c) Renaud Lottiaux <Renaud.Lottiaux@kerlabs.com>
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
- * NAME
- *	execve03.c
- *
- * DESCRIPTION
  *	Testcase to check execve sets the following errnos correctly:
  *	1.	ENAMETOOLONG
  *	2.	ENOENT
@@ -50,9 +33,6 @@
  *
  *	6.	Attempt to execve(2) a zero length file with executable
  *		permissions - fails with ENOEXEC.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
  */
 
 #ifndef _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/execve/execve04.c b/testcases/kernel/syscalls/execve/execve04.c
index e3138f2..c7b8c16 100644
--- a/testcases/kernel/syscalls/execve/execve04.c
+++ b/testcases/kernel/syscalls/execve/execve04.c
@@ -1,23 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (c) 2015 Cyril Hrubis <chrubis@suse.cz>
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *
- *  07/2001 Ported by Wayne Boyer
+ * Ported to LTP: Wayne Boyer
  *  04/2008 Roy Lee <roylee@andestech.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/execve/execve05.c b/testcases/kernel/syscalls/execve/execve05.c
index d396129..63e597f 100644
--- a/testcases/kernel/syscalls/execve/execve05.c
+++ b/testcases/kernel/syscalls/execve/execve05.c
@@ -1,22 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *
- *  07/2001 Ported by Wayne Boyer
+ * Ported to LTP: Wayne Boyer
  *  21/04/2008 Renaud Lottiaux (Renaud.Lottiaux@kerlabs.com)
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/execve/execve_child.c b/testcases/kernel/syscalls/execve/execve_child.c
index bcf8ccc..1317511 100644
--- a/testcases/kernel/syscalls/execve/execve_child.c
+++ b/testcases/kernel/syscalls/execve/execve_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/execveat/execveat03.c b/testcases/kernel/syscalls/execveat/execveat03.c
index def3392..27247e6 100644
--- a/testcases/kernel/syscalls/execveat/execveat03.c
+++ b/testcases/kernel/syscalls/execveat/execveat03.c
@@ -1,41 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2018 MediaTek Inc.  All Rights Reserved.
+ * Author: Eddie Horng <eddie.horng@mediatek.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 or any later of the GNU General Public License
- * as published by the Free Software Foundation.
+ * Check if an unlinked executable can run in overlayfs mount.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * The regression is introduced from 8db6c34f1dbc ("Introduce v3
+ * namespaced file capabilities"). in security/commoncap.c,
+ * cap_inode_getsecurity() use d_find_alias() cause unhashed dentry
+ * can't be found. The solution could use d_find_any_alias() instead
+ * of d_find_alias().
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
+ * Starting with kernel 4.14, this case fails, execveat shall returns EINVAL.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Started by Eddie Horng <eddie.horng@mediatek.com>
- *
- * DESCRIPTION
- *     Check if an unlinked executable can run in overlayfs mount.
- *     The regression is introduced from 8db6c34f1dbc ("Introduce v3
- *     namespaced file capabilities"). in security/commoncap.c,
- *     cap_inode_getsecurity() use d_find_alias() cause unhashed dentry
- *     can't be found. The solution could use d_find_any_alias() instead of
- *     d_find_alias().
- *
- *     Starting with kernel 4.14, this case fails, execveat shall
- *     returns EINVAL.
- *
- *     This has been fixed by:
- *       355139a8dba4 ("cap_inode_getsecurity: use d_find_any_alias()
- *                      instead of d_find_alias()")
+ * This has been fixed by:
+ * 355139a8dba4 ("cap_inode_getsecurity: use d_find_any_alias()
+ * instead of d_find_alias()")
  */
 
 #define _GNU_SOURCE
@@ -55,11 +35,10 @@
 #include "lapi/fcntl.h"
 #include "execveat.h"
 
-#define OVL_MNT "ovl"
 #define TEST_APP "execveat_child"
 #define TEST_FILE_PATH OVL_MNT"/"TEST_APP
 
-static int ovl_mounted;
+static const char mntpoint[] = OVL_BASE_MNTPOINT;
 
 static void do_child(void)
 {
@@ -86,31 +65,7 @@
 
 static void setup(void)
 {
-	int ret;
-
 	check_execveat();
-
-	/* Setup an overlay mount with lower file */
-	SAFE_MKDIR("lower", 0755);
-	SAFE_MKDIR("upper", 0755);
-	SAFE_MKDIR("work", 0755);
-	SAFE_MKDIR(OVL_MNT, 0755);
-	ret = mount("overlay", OVL_MNT, "overlay", 0,
-		    "lowerdir=lower,upperdir=upper,workdir=work");
-	if (ret < 0) {
-		if (errno == ENODEV) {
-			tst_brk(TCONF,
-				"overlayfs is not configured in this kernel.");
-		}
-		tst_brk(TBROK | TERRNO, "overlayfs mount failed");
-	}
-	ovl_mounted = 1;
-}
-
-static void cleanup(void)
-{
-	if (ovl_mounted)
-		SAFE_UMOUNT(OVL_MNT);
 }
 
 static const char *const resource_files[] = {
@@ -120,11 +75,17 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
+	.mount_device = 1,
+	.needs_overlay = 1,
+	.mntpoint = mntpoint,
 	.forks_child = 1,
 	.child_needs_reinit = 1,
 	.setup = setup,
-	.cleanup = cleanup,
 	.test_all = verify_execveat,
 	.resource_files = resource_files,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "8db6c34f1dbc"},
+		{"linux-git", "355139a8dba4"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/execveat/execveat_child.c b/testcases/kernel/syscalls/execveat/execveat_child.c
index 93bcd71..d66e627 100644
--- a/testcases/kernel/syscalls/execveat/execveat_child.c
+++ b/testcases/kernel/syscalls/execveat/execveat_child.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2018 MediaTek Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 or any later of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 
 /*
diff --git a/testcases/kernel/syscalls/execvp/execvp01.c b/testcases/kernel/syscalls/execvp/execvp01.c
index 6489f7b..09f488f 100644
--- a/testcases/kernel/syscalls/execvp/execvp01.c
+++ b/testcases/kernel/syscalls/execvp/execvp01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *    DATE STARTED	: 06/01/02
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/execvp/execvp01_child.c b/testcases/kernel/syscalls/execvp/execvp01_child.c
index 8a6e512..fe96b33 100644
--- a/testcases/kernel/syscalls/execvp/execvp01_child.c
+++ b/testcases/kernel/syscalls/execvp/execvp01_child.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Linux Test Project
  * Copyright (C) 2015 Cyril Hrubis chrubis@suse.cz
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/kernel/syscalls/exit/exit02.c b/testcases/kernel/syscalls/exit/exit02.c
index fa96397..826ab1f 100644
--- a/testcases/kernel/syscalls/exit/exit02.c
+++ b/testcases/kernel/syscalls/exit/exit02.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *    07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  * Fork a process that creates a file and writes a few bytes, and
diff --git a/testcases/kernel/syscalls/fadvise/posix_fadvise01.c b/testcases/kernel/syscalls/fadvise/posix_fadvise01.c
index 2af0408..71e6454 100644
--- a/testcases/kernel/syscalls/fadvise/posix_fadvise01.c
+++ b/testcases/kernel/syscalls/fadvise/posix_fadvise01.c
@@ -20,7 +20,6 @@
  *	None
  */
 
-#define _XOPEN_SOURCE 600
 #include <fcntl.h>
 
 #include <unistd.h>
diff --git a/testcases/kernel/syscalls/fadvise/posix_fadvise02.c b/testcases/kernel/syscalls/fadvise/posix_fadvise02.c
index d533a79..303f776 100644
--- a/testcases/kernel/syscalls/fadvise/posix_fadvise02.c
+++ b/testcases/kernel/syscalls/fadvise/posix_fadvise02.c
@@ -20,7 +20,6 @@
  *	None
  */
 
-#define _XOPEN_SOURCE 600
 #include <fcntl.h>
 #include <unistd.h>
 #include <signal.h>
diff --git a/testcases/kernel/syscalls/fadvise/posix_fadvise03.c b/testcases/kernel/syscalls/fadvise/posix_fadvise03.c
index 5bada5f..98d8d29 100644
--- a/testcases/kernel/syscalls/fadvise/posix_fadvise03.c
+++ b/testcases/kernel/syscalls/fadvise/posix_fadvise03.c
@@ -20,7 +20,6 @@
  *	None
  */
 
-#define _XOPEN_SOURCE 600
 #include <fcntl.h>
 #include <unistd.h>
 #include <signal.h>
diff --git a/testcases/kernel/syscalls/fadvise/posix_fadvise04.c b/testcases/kernel/syscalls/fadvise/posix_fadvise04.c
index d8d8fb6..f389a21 100644
--- a/testcases/kernel/syscalls/fadvise/posix_fadvise04.c
+++ b/testcases/kernel/syscalls/fadvise/posix_fadvise04.c
@@ -20,7 +20,6 @@
  *	None
  */
 
-#define _XOPEN_SOURCE 600
 #include <fcntl.h>
 #include <unistd.h>
 #include <signal.h>
diff --git a/testcases/kernel/syscalls/fallocate/fallocate04.c b/testcases/kernel/syscalls/fallocate/fallocate04.c
index e576d72..1901502 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate04.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate04.c
@@ -1,24 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+ * Author: Alexey Kodanev <alexey.kodanev@oracle.com>
  *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
- *
- * Description:
  * Test allocates a file with specified size then tests the following modes:
  * FALLOC_FL_PUNCH_HOLE, FALLOC_FL_ZERO_RANGE and FALLOC_FL_COLLAPSE_RANGE.
- *
- * Author: Alexey Kodanev <alexey.kodanev@oracle.com>
  */
 
 #define _GNU_SOURCE
@@ -324,6 +310,5 @@
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 };
diff --git a/testcases/kernel/syscalls/fallocate/fallocate05.c b/testcases/kernel/syscalls/fallocate/fallocate05.c
index 49dc44b..00a1d38 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate05.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate05.c
@@ -1,105 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
  */
 
 /*
  * Tests that writing to fallocated file works when filesystem is full.
+ * Test scenario:
+ * - fallocate() some empty blocks
+ * - fill the filesystem
+ * - write() into the preallocated space
+ * - try to fallocate() more blocks until we get ENOSPC
+ * - write() into the extra allocated space
+ * - deallocate part of the file
+ * - write() to the end of file to check that some blocks were freed
  */
 
 #define _GNU_SOURCE
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <errno.h>
+#include <string.h>
 #include <fcntl.h>
 #include "tst_test.h"
 #include "lapi/fallocate.h"
 
 #define MNTPOINT "mntpoint"
-#define FALLOCATE_SIZE 8192
+#define FALLOCATE_BLOCKS 16
+#define DEALLOCATE_BLOCKS 4
 #define TESTED_FLAGS "fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)"
 
 static int fd;
+static char *buf;
+static blksize_t blocksize;
+static long bufsize;
 
-static void run(void)
+static void setup(void)
 {
-	char buf[FALLOCATE_SIZE];
-	ssize_t ret;
+	struct stat statbuf;
 
 	fd = SAFE_OPEN(MNTPOINT "/test_file", O_WRONLY | O_CREAT);
 
-	if (fallocate(fd, 0, 0, FALLOCATE_SIZE)) {
-		if (errno == EOPNOTSUPP) {
-			tst_res(TCONF | TERRNO, "fallocate() not supported");
-			SAFE_CLOSE(fd);
-			return;
-		}
+	/*
+	 * Use real FS block size, otherwise fallocate() call will test
+	 * different things on different platforms
+	 */
+	SAFE_FSTAT(fd, &statbuf);
+	blocksize = statbuf.st_blksize;
+	bufsize = FALLOCATE_BLOCKS * blocksize;
+	buf = SAFE_MALLOC(bufsize);
+}
 
-		tst_brk(TBROK | TERRNO,
-			"fallocate(fd, 0, 0, %i)", FALLOCATE_SIZE);
+static void run(void)
+{
+	long extsize, tmp;
+
+	TEST(fallocate(fd, 0, 0, bufsize));
+
+	if (TST_RET) {
+		if (TST_ERR == ENOTSUP)
+			tst_brk(TCONF | TTERRNO, "fallocate() not supported");
+
+		tst_brk(TBROK | TTERRNO, "fallocate(fd, 0, 0, %ld)", bufsize);
 	}
 
 	tst_fill_fs(MNTPOINT, 1);
 
-	ret = write(fd, buf, sizeof(buf));
+	TEST(write(fd, buf, bufsize));
 
-	if (ret < 0)
-		tst_res(TFAIL | TERRNO, "write() failed unexpectedly");
+	if (TST_RET < 0)
+		tst_res(TFAIL | TTERRNO, "write() failed unexpectedly");
+	else if (TST_RET != bufsize)
+		tst_res(TFAIL, "Short write(): %ld bytes (expected %zu)",
+			TST_RET, bufsize);
 	else
-		tst_res(TPASS, "write() wrote %zu bytes", ret);
+		tst_res(TPASS, "write() wrote %ld bytes", TST_RET);
 
-	ret = fallocate(fd, 0, FALLOCATE_SIZE, FALLOCATE_SIZE);
-	if (ret != -1)
-		tst_brk(TFAIL, "fallocate() succeeded unexpectedly");
+	/*
+	 * Some file systems may still have a few extra blocks that can be
+	 * allocated.
+	 */
+	for (TST_RET = 0, extsize = 0; !TST_RET; extsize += blocksize)
+		TEST(fallocate(fd, 0, bufsize + extsize, blocksize));
 
-	if (errno != ENOSPC)
-		tst_brk(TFAIL | TERRNO, "fallocate() should fail with ENOSPC");
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "Invalid fallocate() return value %ld", TST_RET);
+		return;
+	}
 
-	tst_res(TPASS | TERRNO, "fallocate() on full FS");
+	if (TST_ERR != ENOSPC) {
+		tst_res(TFAIL | TTERRNO, "fallocate() should fail with ENOSPC");
+		return;
+	}
 
-	ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, FALLOCATE_SIZE);
-	if (ret == -1) {
-		if (errno == EOPNOTSUPP)
+	/* The loop above always counts 1 more block than it should. */
+	extsize -= blocksize;
+	tst_res(TINFO, "fallocate()d %ld extra blocks on full FS",
+		extsize / blocksize);
+
+	for (tmp = extsize; tmp > 0; tmp -= TST_RET) {
+		TEST(write(fd, buf, MIN(bufsize, tmp)));
+
+		if (TST_RET <= 0) {
+			tst_res(TFAIL | TTERRNO, "write() failed unexpectedly");
+			return;
+		}
+	}
+
+	tst_res(TPASS, "fallocate() on full FS");
+
+	/* Btrfs deallocates only complete extents, not individual blocks */
+	if (!strcmp(tst_device->fs_type, "btrfs"))
+		tmp = bufsize + extsize;
+	else
+		tmp = DEALLOCATE_BLOCKS * blocksize;
+
+	TEST(fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, tmp));
+
+	if (TST_RET == -1) {
+		if (TST_ERR == ENOTSUP)
 			tst_brk(TCONF, TESTED_FLAGS);
 
-		tst_brk(TBROK | TERRNO, TESTED_FLAGS);
+		tst_brk(TBROK | TTERRNO, TESTED_FLAGS);
 	}
 	tst_res(TPASS, TESTED_FLAGS);
 
-	ret = write(fd, buf, 10);
-	if (ret == -1)
-		tst_res(TFAIL | TERRNO, "write()");
+	TEST(write(fd, buf, 10));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO, "write()");
 	else
 		tst_res(TPASS, "write()");
 
-	SAFE_CLOSE(fd);
+	/* TODO: wipe the test device here to allow looping with -i/-I */
 }
 
 static void cleanup(void)
 {
 	if (fd > 0)
 		SAFE_CLOSE(fd);
+
+	free(buf);
 }
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.mount_device = 1,
+	.dev_min_size = 512,
 	.mntpoint = MNTPOINT,
 	.all_filesystems = 1,
+	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = run,
 };
diff --git a/testcases/kernel/syscalls/fanotify/.gitignore b/testcases/kernel/syscalls/fanotify/.gitignore
index 4256b8c..68e4cc7 100644
--- a/testcases/kernel/syscalls/fanotify/.gitignore
+++ b/testcases/kernel/syscalls/fanotify/.gitignore
@@ -10,4 +10,7 @@
 /fanotify10
 /fanotify11
 /fanotify12
+/fanotify13
+/fanotify14
+/fanotify15
 /fanotify_child
diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 14654b7..6da7e76 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -1,34 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * fanotify testcase common definitions.
- *
  * Copyright (c) 2012 Linux Test Project.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Jan Kara, November 2013
+ * Author: Jan Kara, November 2013
  */
 
 #ifndef	__FANOTIFY_H__
 #define	__FANOTIFY_H__
 
 #include "config.h"
+#include <sys/statfs.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
 
 #if defined(HAVE_SYS_FANOTIFY_H)
 
@@ -57,9 +41,6 @@
 #ifndef FAN_REPORT_TID
 #define FAN_REPORT_TID		0x00000100
 #endif
-#ifndef FAN_REPORT_FID
-#define FAN_REPORT_FID		0x00000200
-#endif
 
 #ifndef FAN_MARK_INODE
 #define FAN_MARK_INODE		0
@@ -67,6 +48,31 @@
 #ifndef FAN_MARK_FILESYSTEM
 #define FAN_MARK_FILESYSTEM	0x00000100
 #endif
+/* New dirent event masks */
+#ifndef FAN_ATTRIB
+#define FAN_ATTRIB		0x00000004
+#endif
+#ifndef FAN_MOVED_FROM
+#define FAN_MOVED_FROM		0x00000040
+#endif
+#ifndef FAN_MOVED_TO
+#define FAN_MOVED_TO		0x00000080
+#endif
+#ifndef FAN_CREATE
+#define FAN_CREATE		0x00000100
+#endif
+#ifndef FAN_DELETE
+#define FAN_DELETE		0x00000200
+#endif
+#ifndef FAN_DELETE_SELF
+#define FAN_DELETE_SELF		0x00000400
+#endif
+#ifndef FAN_MOVE_SELF
+#define FAN_MOVE_SELF		0x00000800
+#endif
+#ifndef FAN_MOVE
+#define FAN_MOVE		(FAN_MOVED_FROM | FAN_MOVED_TO)
+#endif
 #ifndef FAN_OPEN_EXEC
 #define FAN_OPEN_EXEC		0x00001000
 #endif
@@ -74,6 +80,10 @@
 #define FAN_OPEN_EXEC_PERM	0x00040000
 #endif
 
+#ifndef FAN_REPORT_FID
+#define FAN_REPORT_FID		0x00000200
+#endif
+
 /*
  * FAN_ALL_PERM_EVENTS has been deprecated, so any new permission events
  * are not to be added to it. To cover the instance where a new permission
@@ -89,6 +99,64 @@
 	const char * name;
 };
 
+#ifndef __kernel_fsid_t
+typedef struct {
+	int	val[2];
+} lapi_fsid_t;
+#define __kernel_fsid_t lapi_fsid_t
+#endif /* __kernel_fsid_t */
+
+#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER
+struct fanotify_event_info_header {
+	uint8_t info_type;
+	uint8_t pad;
+	uint16_t len;
+};
+#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER */
+
+#ifndef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID
+struct fanotify_event_info_fid {
+	struct fanotify_event_info_header hdr;
+	__kernel_fsid_t fsid;
+	unsigned char handle[0];
+};
+#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID */
+
+/* NOTE: only for struct fanotify_event_info_fid */
+#ifdef HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL
+# define FSID_VAL_MEMBER(fsid, i) (fsid.__val[i])
+#else
+# define FSID_VAL_MEMBER(fsid, i) (fsid.val[i])
+#endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */
+
+#ifdef HAVE_NAME_TO_HANDLE_AT
+/*
+ * Helper function used to obtain fsid and file_handle for a given path.
+ * Used by test files correlated to FAN_REPORT_FID functionality.
+ */
+static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid,
+				    struct file_handle *handle)
+{
+	int mount_id;
+	struct statfs stats;
+
+	if (statfs(path, &stats) == -1)
+		tst_brk(TBROK | TERRNO,
+			"statfs(%s, ...) failed", path);
+	memcpy(fsid, &stats.f_fsid, sizeof(stats.f_fsid));
+
+	if (name_to_handle_at(AT_FDCWD, path, handle, &mount_id, 0) == -1) {
+		if (errno == EOPNOTSUPP) {
+			tst_brk(TCONF,
+				"filesystem %s does not support file handles",
+				tst_device->fs_type);
+		}
+		tst_brk(TBROK | TERRNO,
+			"name_to_handle_at(AT_FDCWD, %s, ...) failed", path);
+	}
+}
+#endif /* HAVE_NAME_TO_HANDLE_AT */
+
 #define INIT_FANOTIFY_MARK_TYPE(t) \
 	{ FAN_MARK_ ## t, "FAN_MARK_" #t }
 
diff --git a/testcases/kernel/syscalls/fanotify/fanotify01.c b/testcases/kernel/syscalls/fanotify/fanotify01.c
index 44966dc..03e453f 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify01.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify01.c
@@ -379,7 +379,6 @@
 	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
 	.cleanup = cleanup,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.mount_device = 1,
 	.mntpoint = MOUNT_PATH,
diff --git a/testcases/kernel/syscalls/fanotify/fanotify05.c b/testcases/kernel/syscalls/fanotify/fanotify05.c
index de72e34..e53cc33 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify05.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify05.c
@@ -11,6 +11,7 @@
  *     Generate enough events without reading them and check that overflow
  *     event is generated.
  */
+#define _GNU_SOURCE
 #include "config.h"
 
 #include <stdio.h>
@@ -126,7 +127,6 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.mount_device = 1,
 	.mntpoint = MOUNT_PATH,
 };
diff --git a/testcases/kernel/syscalls/fanotify/fanotify06.c b/testcases/kernel/syscalls/fanotify/fanotify06.c
index 6a2e249..99e312a 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify06.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify06.c
@@ -15,6 +15,14 @@
  *  Date:   Thu Nov 13 15:19:33 2014 -0800
  *
  *      fanotify: fix notification of groups with inode & mount marks
+ *
+ * The overlayfs test case is a regression test for:
+ *
+ *  commit d989903058a83e8536cc7aadf9256a47d5c173fe
+ *  Author: Amir Goldstein <amir73il@gmail.com>
+ *  Date:   Wed Apr 24 19:39:50 2019 +0300
+ *
+ *      ovl: do not generate duplicate fsnotify events for "fake" path
  */
 #define _GNU_SOURCE
 #include "config.h"
@@ -54,8 +62,18 @@
 
 static char event_buf[EVENT_BUF_LEN];
 
-#define MOUNT_NAME "mntpoint"
-static int mount_created;
+static const char mntpoint[] = OVL_BASE_MNTPOINT;
+
+static int ovl_mounted;
+
+static struct tcase {
+	const char *tname;
+	const char *mnt;
+	int use_overlay;
+} tcases[] = {
+	{ "Fanotify merge mount mark", mntpoint, 0 },
+	{ "Fanotify merge overlayfs mount mark", OVL_MNT, 1 },
+};
 
 static void create_fanotify_groups(void)
 {
@@ -72,12 +90,12 @@
 			ret = fanotify_mark(fd_notify[p][i],
 					    FAN_MARK_ADD | FAN_MARK_MOUNT,
 					    FAN_MODIFY,
-					    AT_FDCWD, ".");
+					    AT_FDCWD, fname);
 			if (ret < 0) {
 				tst_brk(TBROK | TERRNO,
 					"fanotify_mark(%d, FAN_MARK_ADD | "
 					"FAN_MARK_MOUNT, FAN_MODIFY, AT_FDCWD,"
-					" '.') failed", fd_notify[p][i]);
+					" %s) failed", fd_notify[p][i], fname);
 			}
 			/* Add ignore mark for groups with higher priority */
 			if (p == 0)
@@ -130,11 +148,34 @@
 	}
 }
 
-void test01(void)
+/* Close all file descriptors of read events */
+static void close_events_fd(struct fanotify_event_metadata *event, int buflen)
+{
+	while (buflen >= (int)FAN_EVENT_METADATA_LEN) {
+		if (event->fd != FAN_NOFD)
+			SAFE_CLOSE(event->fd);
+		buflen -= (int)FAN_EVENT_METADATA_LEN;
+		event++;
+	}
+}
+
+void test_fanotify(unsigned int n)
 {
 	int ret;
 	unsigned int p, i;
 	struct fanotify_event_metadata *event;
+	struct tcase *tc = &tcases[n];
+
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+
+	if (tc->use_overlay && !ovl_mounted) {
+		tst_res(TCONF,
+		        "overlayfs is not configured in this kernel.");
+		return;
+	}
+
+	sprintf(fname, "%s/tfile_%d", tc->mnt, getpid());
+	SAFE_TOUCH(fname, 0644, NULL);
 
 	create_fanotify_groups();
 
@@ -168,17 +209,16 @@
 		} else {
 			verify_event(i, event);
 		}
-		if (event->fd != FAN_NOFD)
-			SAFE_CLOSE(event->fd);
+		close_events_fd(event, ret);
 	}
+
 	for (p = 1; p < FANOTIFY_PRIORITIES; p++) {
 		for (i = 0; i < GROUPS_PER_PRIO; i++) {
 			ret = read(fd_notify[p][i], event_buf, EVENT_BUF_LEN);
 			if (ret > 0) {
 				tst_res(TFAIL, "group %d got event",
 					p*GROUPS_PER_PRIO + i);
-				if (event->fd != FAN_NOFD)
-					SAFE_CLOSE(event->fd);
+				close_events_fd((void *)event_buf, ret);
 			} else if (ret == 0) {
 				tst_brk(TBROK, "zero length "
 					"read from fanotify fd");
@@ -196,31 +236,30 @@
 
 static void setup(void)
 {
-	SAFE_MKDIR(MOUNT_NAME, 0755);
-	SAFE_MOUNT(MOUNT_NAME, MOUNT_NAME, "none", MS_BIND, NULL);
-	mount_created = 1;
-	SAFE_CHDIR(MOUNT_NAME);
-
-	sprintf(fname, "tfile_%d", getpid());
-	SAFE_FILE_PRINTF(fname, "1");
+	ovl_mounted = TST_MOUNT_OVERLAY();
 }
 
 static void cleanup(void)
 {
 	cleanup_fanotify_groups();
 
-	SAFE_CHDIR("../");
-
-	if (mount_created && tst_umount(MOUNT_NAME) < 0)
-		tst_brk(TBROK | TERRNO, "umount failed");
+	if (ovl_mounted)
+		SAFE_UMOUNT(OVL_MNT);
 }
 
 static struct tst_test test = {
-	.test_all = test01,
+	.test = test_fanotify,
+	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
 	.cleanup = cleanup,
-	.needs_tmpdir = 1,
-	.needs_root = 1
+	.needs_root = 1,
+	.mount_device = 1,
+	.mntpoint = mntpoint,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "8edc6e1688fc"},
+		{"linux-git", "d989903058a8"},
+		{}
+	}
 };
 
 #else
diff --git a/testcases/kernel/syscalls/fanotify/fanotify09.c b/testcases/kernel/syscalls/fanotify/fanotify09.c
index 0f926c4..0f6a9e8 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify09.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify09.c
@@ -264,7 +264,12 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.needs_tmpdir = 1,
-	.needs_root = 1
+	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "54a307ba8d3c"},
+		{"linux-git", "b469e7e47c8a"},
+		{}
+	}
 };
 
 #else
diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c
index 43465b8..ef08077 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify10.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
@@ -440,10 +440,13 @@
 	.cleanup = cleanup,
 	.mount_device = 1,
 	.mntpoint = MOUNT_PATH,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.forks_child = 1,
-	.resource_files = resource_files
+	.resource_files = resource_files,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "9bdda4e9cf2d"},
+		{}
+	}
 };
 
 #else
diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c
new file mode 100644
index 0000000..3d8de60
--- /dev/null
+++ b/testcases/kernel/syscalls/fanotify/fanotify13.c
@@ -0,0 +1,339 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
+ *
+ * Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
+ *
+ * DESCRIPTION
+ *	Validate that the values returned within an event when
+ *	FAN_REPORT_FID is specified matches those that are obtained via
+ *	explicit invocation to system calls statfs(2) and
+ *	name_to_handle_at(2).
+ *
+ * This is also regression test for:
+ *     c285a2f01d69 ("fanotify: update connector fsid cache on add mark")
+ */
+#define _GNU_SOURCE
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/statfs.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include "tst_test.h"
+#include "fanotify.h"
+
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
+#define PATH_LEN 128
+#define BUF_SIZE 256
+#define DIR_ONE "dir_one"
+#define FILE_ONE "file_one"
+#define FILE_TWO "file_two"
+#define MOUNT_PATH "mntpoint"
+#define EVENT_MAX ARRAY_SIZE(objects)
+#define DIR_PATH_ONE MOUNT_PATH"/"DIR_ONE
+#define FILE_PATH_ONE MOUNT_PATH"/"FILE_ONE
+#define FILE_PATH_TWO MOUNT_PATH"/"FILE_TWO
+
+#if defined(HAVE_NAME_TO_HANDLE_AT)
+struct event_t {
+	unsigned long long expected_mask;
+	__kernel_fsid_t fsid;
+	struct file_handle handle;
+	char buf[MAX_HANDLE_SZ];
+};
+
+static struct object_t {
+	const char *path;
+	int is_dir;
+} objects[] = {
+	{FILE_PATH_ONE, 0},
+	{FILE_PATH_TWO, 0},
+	{DIR_PATH_ONE, 1}
+};
+
+static struct test_case_t {
+	struct fanotify_mark_type mark;
+	unsigned long long mask;
+} test_cases[] = {
+	{
+		INIT_FANOTIFY_MARK_TYPE(INODE),
+		FAN_OPEN | FAN_CLOSE_NOWRITE
+	},
+	{
+		INIT_FANOTIFY_MARK_TYPE(INODE),
+		FAN_OPEN | FAN_CLOSE_NOWRITE | FAN_ONDIR
+	},
+	{
+		INIT_FANOTIFY_MARK_TYPE(MOUNT),
+		FAN_OPEN | FAN_CLOSE_NOWRITE
+	},
+	{
+		INIT_FANOTIFY_MARK_TYPE(MOUNT),
+		FAN_OPEN | FAN_CLOSE_NOWRITE | FAN_ONDIR
+	},
+	{
+		INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
+		FAN_OPEN | FAN_CLOSE_NOWRITE
+	},
+	{
+		INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
+		FAN_OPEN | FAN_CLOSE_NOWRITE | FAN_ONDIR
+	}
+};
+
+static int nofid_fd;
+static int fanotify_fd;
+static char events_buf[BUF_SIZE];
+static struct event_t event_set[EVENT_MAX];
+
+static void create_objects(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(objects); i++) {
+		if (objects[i].is_dir)
+			SAFE_MKDIR(objects[i].path, 0755);
+		else
+			SAFE_FILE_PRINTF(objects[i].path, "0");
+	}
+}
+
+static void get_object_stats(void)
+{
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(objects); i++) {
+		event_set[i].handle.handle_bytes = MAX_HANDLE_SZ;
+		fanotify_get_fid(objects[i].path, &event_set[i].fsid,
+				&event_set[i].handle);
+	}
+}
+
+static int setup_marks(unsigned int fd, struct test_case_t *tc)
+{
+	unsigned int i;
+	struct fanotify_mark_type *mark = &tc->mark;
+
+	for (i = 0; i < ARRAY_SIZE(objects); i++) {
+		if (fanotify_mark(fd, FAN_MARK_ADD | mark->flag, tc->mask,
+					AT_FDCWD, objects[i].path) == -1) {
+			if (errno == EINVAL &&
+				mark->flag & FAN_MARK_FILESYSTEM) {
+				tst_res(TCONF,
+					"FAN_MARK_FILESYSTEM not supported by "
+					"kernel");
+				return 1;
+			} else if (errno == ENODEV &&
+					!event_set[i].fsid.val[0] &&
+					!event_set[i].fsid.val[1]) {
+				tst_res(TCONF,
+					"FAN_REPORT_FID not supported on "
+					"filesystem type %s",
+					tst_device->fs_type);
+				return 1;
+			}
+			tst_brk(TBROK | TERRNO,
+				"fanotify_mark(%d, FAN_MARK_ADD, FAN_OPEN, "
+				"AT_FDCWD, %s) failed",
+				fanotify_fd, objects[i].path);
+		}
+
+		/* Setup the expected mask for each generated event */
+		event_set[i].expected_mask = tc->mask;
+		if (!objects[i].is_dir)
+			event_set[i].expected_mask &= ~FAN_ONDIR;
+	}
+	return 0;
+}
+
+static void do_test(unsigned int number)
+{
+	unsigned int i;
+	int len, fds[ARRAY_SIZE(objects)];
+
+	struct file_handle *event_file_handle;
+	struct fanotify_event_metadata *metadata;
+	struct fanotify_event_info_fid *event_fid;
+	struct test_case_t *tc = &test_cases[number];
+	struct fanotify_mark_type *mark = &tc->mark;
+
+	tst_res(TINFO,
+		"Test #%d: FAN_REPORT_FID with mark flag: %s",
+		number, mark->name);
+
+	fanotify_fd = fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_FID, O_RDONLY);
+	if (fanotify_fd == -1) {
+		if (errno == EINVAL) {
+			tst_res(TCONF,
+				"FAN_REPORT_FID not supported by kernel");
+			return;
+		}
+		tst_brk(TBROK | TERRNO,
+			"fanotify_init(FAN_CLASS_NOTIF | FAN_REPORT_FID, "
+			"O_RDONLY) failed");
+	}
+
+	/*
+	 * Place marks on a set of objects and setup the expected masks
+	 * for each event that is expected to be generated.
+	 */
+	if (setup_marks(fanotify_fd, tc) != 0)
+		goto out;
+
+	/* Generate sequence of FAN_OPEN events on objects */
+	for (i = 0; i < ARRAY_SIZE(objects); i++)
+		fds[i] = SAFE_OPEN(objects[i].path, O_RDONLY);
+
+	/*
+	 * Generate sequence of FAN_CLOSE_NOWRITE events on objects. Each
+	 * FAN_CLOSE_NOWRITE event is expected to be merged with its
+	 * respective FAN_OPEN event that was performed on the same object.
+	 */
+	for (i = 0; i < ARRAY_SIZE(objects); i++) {
+		if (fds[i] > 0)
+			SAFE_CLOSE(fds[i]);
+	}
+
+	/* Read events from event queue */
+	len = SAFE_READ(0, fanotify_fd, events_buf, BUF_SIZE);
+
+	/* Iterate over event queue */
+	for (i = 0, metadata = (struct fanotify_event_metadata *) events_buf;
+		FAN_EVENT_OK(metadata, len);
+		metadata = FAN_EVENT_NEXT(metadata, len), i++) {
+		event_fid = (struct fanotify_event_info_fid *) (metadata + 1);
+		event_file_handle = (struct file_handle *) event_fid->handle;
+
+		/* File descriptor is redundant with FAN_REPORT_FID */
+		if (metadata->fd != FAN_NOFD)
+			tst_res(TFAIL,
+				"Unexpectedly received file descriptor %d in "
+				"event. Expected to get FAN_NOFD(%d)",
+				metadata->fd, FAN_NOFD);
+
+		/* Ensure that the correct mask has been reported in event */
+		if (metadata->mask != event_set[i].expected_mask)
+			tst_res(TFAIL,
+				"Unexpected mask received: %llx (expected: "
+				"%llx) in event",
+				metadata->mask,
+				event_set[i].expected_mask);
+
+		/* Verify handle_bytes returned in event */
+		if (event_file_handle->handle_bytes
+				!= event_set[i].handle.handle_bytes) {
+			tst_res(TFAIL,
+				"handle_bytes (%x) returned in event does not "
+				"equal to handle_bytes (%x) returned in "
+				"name_to_handle_at(2)",
+				event_file_handle->handle_bytes,
+				event_set[i].handle.handle_bytes);
+			continue;
+		}
+
+		/* Verify handle_type returned in event */
+		if (event_file_handle->handle_type !=
+				event_set[i].handle.handle_type) {
+			tst_res(TFAIL,
+				"handle_type (%x) returned in event does not "
+				"equal to handle_type (%x) returned in "
+				"name_to_handle_at(2)",
+				event_file_handle->handle_type,
+				event_set[i].handle.handle_type);
+			continue;
+		}
+
+		/* Verify file identifier f_handle returned in event */
+		if (memcmp(event_file_handle->f_handle,
+				event_set[i].handle.f_handle,
+				event_set[i].handle.handle_bytes) != 0) {
+			tst_res(TFAIL,
+				"event_file_handle->f_handle does not match "
+				"event_set[i].handle.f_handle returned in "
+				"name_to_handle_at(2)");
+			continue;
+		}
+
+		/* Verify filesystem ID fsid  returned in event */
+		if (memcmp(&event_fid->fsid, &event_set[i].fsid,
+				sizeof(event_set[i].fsid)) != 0) {
+			tst_res(TFAIL,
+				"event_fid.fsid != stat.f_fsid that was "
+				"obtained via statfs(2)");
+			continue;
+		}
+
+		tst_res(TPASS,
+			"got event: mask=%llx, pid=%d, fid=%x.%x.%lx values "
+			"returned in event match those returned in statfs(2) "
+			"and name_to_handle_at(2)",
+			metadata->mask,
+			getpid(),
+			FSID_VAL_MEMBER(event_fid->fsid, 0),
+			FSID_VAL_MEMBER(event_fid->fsid, 1),
+			*(unsigned long *) event_file_handle->f_handle);
+	}
+out:
+	SAFE_CLOSE(fanotify_fd);
+}
+
+static void do_setup(void)
+{
+	/* Check for kernel fanotify support */
+	nofid_fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
+
+	/* Create file and directory objects for testing */
+	create_objects();
+
+	/*
+	 * Create a mark on first inode without FAN_REPORT_FID, to test
+	 * uninitialized connector->fsid cache. This mark remains for all test
+	 * cases and is not expected to get any events (no writes in this test).
+	 */
+	if (fanotify_mark(nofid_fd, FAN_MARK_ADD, FAN_CLOSE_WRITE, AT_FDCWD,
+			  FILE_PATH_ONE) == -1) {
+		tst_brk(TBROK | TERRNO,
+			"fanotify_mark(%d, FAN_MARK_ADD, FAN_CLOSE_WRITE, "
+			"AT_FDCWD, "FILE_PATH_ONE") failed",
+			nofid_fd);
+	}
+
+	/* Get the filesystem fsid and file handle for each created object */
+	get_object_stats();
+}
+
+static void do_cleanup(void)
+{
+	SAFE_CLOSE(nofid_fd);
+	if (fanotify_fd > 0)
+		SAFE_CLOSE(fanotify_fd);
+}
+
+static struct tst_test test = {
+	.test = do_test,
+	.tcnt = ARRAY_SIZE(test_cases),
+	.setup = do_setup,
+	.cleanup = do_cleanup,
+	.needs_root = 1,
+	.needs_tmpdir = 1,
+	.mount_device = 1,
+	.mntpoint = MOUNT_PATH,
+	.all_filesystems = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "c285a2f01d69"},
+		{}
+	}
+};
+
+#else
+	TST_TEST_TCONF("System does not have required name_to_handle_at() support");
+#endif
+#else
+	TST_TEST_TCONF("System does not have required fanotify support");
+#endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
new file mode 100644
index 0000000..3ca38d1
--- /dev/null
+++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
@@ -0,0 +1,176 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018 Matthew Bobrowski. All Rights Reserved.
+ *
+ * Started by Matthew Bobrowski <mbobrowski@mbobrowski.org>
+ *
+ * DESCRIPTION
+ *	This test file has been designed to ensure that the fanotify
+ *	system calls fanotify_init(2) and fanotify_mark(2) return the
+ *	correct error code to the calling process when an invalid flag or
+ *	mask value has been specified in conjunction with FAN_REPORT_FID.
+ */
+#define _GNU_SOURCE
+#include "tst_test.h"
+#include "fanotify.h"
+
+#include <errno.h>
+
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
+#define MNTPOINT "mntpoint"
+#define FILE1 MNTPOINT"/file1"
+
+/*
+ * List of inode events that are only available when notification group is
+ * set to report fid.
+ */
+#define INODE_EVENTS (FAN_ATTRIB | FAN_CREATE | FAN_DELETE | FAN_MOVE | \
+		      FAN_DELETE_SELF | FAN_MOVE_SELF)
+
+static int fanotify_fd;
+
+/*
+ * Each test case has been designed in a manner whereby the values defined
+ * within should result in the interface to return an error to the calling
+ * process.
+ */
+static struct test_case_t {
+	unsigned int init_flags;
+	unsigned int mark_flags;
+	unsigned long long mask;
+} test_cases[] = {
+	{
+		FAN_CLASS_CONTENT | FAN_REPORT_FID, 0, 0
+	},
+	{
+		FAN_CLASS_PRE_CONTENT | FAN_REPORT_FID, 0, 0
+	},
+	{
+		FAN_CLASS_NOTIF, 0, INODE_EVENTS
+	},
+	{
+		FAN_CLASS_NOTIF | FAN_REPORT_FID, FAN_MARK_MOUNT, INODE_EVENTS
+	}
+};
+
+static void do_test(unsigned int number)
+{
+	int ret;
+	struct test_case_t *tc = &test_cases[number];
+
+	fanotify_fd = fanotify_init(tc->init_flags, O_RDONLY);
+	if (fanotify_fd < 0) {
+		/*
+		 * EINVAL is to be returned to the calling process when
+		 * an invalid notification class is specified in
+		 * conjunction with FAN_REPORT_FID.
+		 */
+		if (errno == EINVAL) {
+			tst_res(TPASS,
+				"fanotify_fd=%d, fanotify_init(%x, O_RDONLY) "
+				"failed with error EINVAL as expected",
+				fanotify_fd,
+				tc->init_flags);
+			return;
+		}
+		tst_brk(TBROK | TERRNO,
+			"fanotify_fd=%d, fanotify_init(%x, O_RDONLY) failed",
+			fanotify_fd,
+			tc->init_flags);
+	}
+
+	/*
+	 * A test case with a mask set to zero indicate that they've been
+	 * specifically designed to test and fail on the fanotify_init()
+	 * system call.
+	 */
+	if (tc->mask == 0) {
+		tst_res(TFAIL,
+			"fanotify_fd=%d fanotify_init(%x, O_RDONLY) "
+			"unexpectedly succeeded when tests with mask 0 are"
+			"expected to fail when calling fanotify_init()",
+			fanotify_fd,
+			tc->init_flags);
+		goto out;
+	}
+
+	ret = fanotify_mark(fanotify_fd, FAN_MARK_ADD | tc->mark_flags,
+				tc->mask, AT_FDCWD, FILE1);
+	if (ret < 0) {
+		/*
+		 * EINVAL is to be returned to the calling process when
+		 * attempting to use INODE_EVENTS without FAN_REPORT_FID
+		 * specified on the notification group, or using
+		 * INODE_EVENTS with mark type FAN_MARK_MOUNT.
+		 */
+		if (errno == EINVAL) {
+			tst_res(TPASS,
+				"ret=%d, fanotify_mark(%d, FAN_MARK_ADD | %x, "
+				"%llx, AT_FDCWD, %s) failed with error EINVAL "
+				"as expected",
+				ret,
+				fanotify_fd,
+				tc->mark_flags,
+				tc->mask,
+				FILE1);
+			goto out;
+		}
+		tst_brk(TBROK | TERRNO,
+			"ret=%d, fanotify_mark(%d, FAN_MARK_ADD | %x, %llx, "
+			"AT_FDCWD, %s) failed",
+			ret,
+			fanotify_fd,
+			tc->mark_flags,
+			tc->mask,
+			FILE1);
+	}
+
+	tst_res(TFAIL,
+		"fanotify_fd=%d, ret=%d, fanotify_init(%x, O_RDONLY) and "
+		"fanotify_mark(%d, FAN_MARK_ADD | %x, %llx, AT_FDCWD, %s) did "
+		"not return any errors as expected",
+		fanotify_fd,
+		ret,
+		tc->init_flags,
+		fanotify_fd,
+		tc->mark_flags,
+		tc->mask,
+		FILE1);
+out:
+	SAFE_CLOSE(fanotify_fd);
+}
+
+static void do_setup(void)
+{
+	int fd;
+
+	/* Check for kernel fanotify support */
+	fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
+	SAFE_CLOSE(fd);
+
+	/* Create temporary test file to place marks on */
+	SAFE_FILE_PRINTF(FILE1, "0");
+}
+
+static void do_cleanup(void)
+{
+	if (fanotify_fd > 0)
+		SAFE_CLOSE(fanotify_fd);
+}
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.test = do_test,
+	.tcnt = ARRAY_SIZE(test_cases),
+	.setup = do_setup,
+	.cleanup = do_cleanup,
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.all_filesystems = 1
+};
+
+#else
+	TST_TEST_TCONF("System does not have required fanotify support");
+#endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify15.c b/testcases/kernel/syscalls/fanotify/fanotify15.c
new file mode 100644
index 0000000..e0d5130
--- /dev/null
+++ b/testcases/kernel/syscalls/fanotify/fanotify15.c
@@ -0,0 +1,249 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 CTERA Networks. All Rights Reserved.
+ *
+ * Started by Amir Goldstein <amir73il@gmail.com>
+ * Modified by Matthew Bobrowski <mbobrowski@mbobrowski.org>
+ *
+ * DESCRIPTION
+ *	Test file that has been purposely designed to verify
+ *	FAN_REPORT_FID functionality while using newly defined dirent
+ *	events.
+ */
+#define _GNU_SOURCE
+#include "config.h"
+
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/statfs.h>
+#include <sys/types.h>
+
+#include "tst_test.h"
+#include "fanotify.h"
+
+#if defined(HAVE_SYS_FANOTIFY_H)
+#include <sys/fanotify.h>
+
+#define BUF_SIZE 256
+#define EVENT_MAX 256
+
+#define MOUNT_POINT "mntpoint"
+#define TEST_DIR MOUNT_POINT"/test_dir"
+#define DIR1 TEST_DIR"/dir1"
+#define DIR2 TEST_DIR"/dir2"
+#define FILE1 TEST_DIR"/file1"
+#define FILE2 TEST_DIR"/file2"
+
+#if defined(HAVE_NAME_TO_HANDLE_AT)
+struct event_t {
+	unsigned long long mask;
+	__kernel_fsid_t fsid;
+	struct file_handle handle;
+	char buf[MAX_HANDLE_SZ];
+};
+
+static int fanotify_fd;
+static char events_buf[BUF_SIZE];
+static struct event_t event_set[EVENT_MAX];
+
+static void do_test(void)
+{
+	int i, fd, len, count = 0;
+
+	struct file_handle *event_file_handle;
+	struct fanotify_event_metadata *metadata;
+	struct fanotify_event_info_fid *event_fid;
+
+	if (fanotify_mark(fanotify_fd, FAN_MARK_ADD | FAN_MARK_FILESYSTEM,
+				FAN_CREATE | FAN_DELETE | FAN_ATTRIB |
+				FAN_MOVED_FROM | FAN_MOVED_TO |
+				FAN_DELETE_SELF | FAN_ONDIR,
+				AT_FDCWD, TEST_DIR) == -1) {
+		if (errno == ENODEV)
+			tst_brk(TCONF,
+				"FAN_REPORT_FID not supported on %s "
+				"filesystem", tst_device->fs_type);
+		tst_brk(TBROK | TERRNO,
+			"fanotify_mark(%d, FAN_MARK_ADD, FAN_CREATE | "
+			"FAN_DELETE | FAN_MOVED_FROM | FAN_MOVED_TO | "
+			"FAN_DELETE_SELF | FAN_ONDIR, AT_FDCWD, %s) failed",
+			fanotify_fd, TEST_DIR);
+	}
+
+	/* Generate a sequence of events */
+	event_set[count].mask = FAN_CREATE | FAN_MOVED_FROM | FAN_MOVED_TO | \
+				FAN_DELETE;
+	event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+	fanotify_get_fid(TEST_DIR, &event_set[count].fsid,
+			 &event_set[count].handle);
+	count++;
+
+	fd = SAFE_CREAT(FILE1, 0644);
+	SAFE_CLOSE(fd);
+
+	SAFE_RENAME(FILE1, FILE2);
+
+	event_set[count].mask = FAN_ATTRIB | FAN_DELETE_SELF;
+	event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+	fanotify_get_fid(FILE2, &event_set[count].fsid,
+			 &event_set[count].handle);
+	count++;
+
+	SAFE_UNLINK(FILE2);
+
+	/*
+	 * Generate a sequence of events on a directory. Subsequent events
+	 * are merged, so it's required that we set FAN_ONDIR once in
+	 * order to acknowledge that changes related to a subdirectory
+	 * took place. Events on subdirectories are not merged with events
+	 * on non-subdirectories.
+	 */
+	event_set[count].mask = FAN_ONDIR | FAN_CREATE | FAN_MOVED_FROM | \
+				FAN_MOVED_TO | FAN_DELETE;
+	event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+	fanotify_get_fid(TEST_DIR, &event_set[count].fsid,
+			 &event_set[count].handle);
+	count++;
+
+	SAFE_MKDIR(DIR1, 0755);
+
+	SAFE_RENAME(DIR1, DIR2);
+
+	event_set[count].mask = FAN_ONDIR | FAN_DELETE_SELF;
+	event_set[count].handle.handle_bytes = MAX_HANDLE_SZ;
+	fanotify_get_fid(DIR2, &event_set[count].fsid,
+			 &event_set[count].handle);
+	count++;
+
+	SAFE_RMDIR(DIR2);
+
+	/* Read events from the event queue */
+	len = SAFE_READ(0, fanotify_fd, events_buf, BUF_SIZE);
+
+	/* Process each event in buffer */
+	for (i = 0, metadata = (struct fanotify_event_metadata *) events_buf;
+		FAN_EVENT_OK(metadata, len);
+		metadata = FAN_EVENT_NEXT(metadata,len), i++) {
+		event_fid = (struct fanotify_event_info_fid *) (metadata + 1);
+		event_file_handle = (struct file_handle *) event_fid->handle;
+
+		if (i >= count) {
+			tst_res(TFAIL,
+				"got unnecessary event: mask=%llx "
+				"pid=%u fd=%d",
+				(unsigned long long) metadata->mask,
+				metadata->pid,
+				metadata->fd);
+			metadata->mask = 0;
+		} else if (metadata->fd != FAN_NOFD) {
+			tst_res(TFAIL,
+				"Received unexpected file descriptor %d in "
+				"event. Expected to get FAN_NOFD(%d)",
+				metadata->fd, FAN_NOFD);
+		} else if (metadata->mask != event_set[i].mask) {
+			tst_res(TFAIL,
+				"Got event: mask=%llx (expected %llx) "
+				"pid=%u fd=%d",
+				(unsigned long long) metadata->mask,
+				event_set[i].mask,
+				(unsigned) metadata->pid,
+				metadata->fd);
+		} else if (metadata->pid != getpid()) {
+			tst_res(TFAIL,
+				"Got event: mask=%llx pid=%u "
+				"(expected %u) fd=%d",
+				(unsigned long long) metadata->mask,
+				(unsigned) metadata->pid,
+				(unsigned) getpid(),
+				metadata->fd);
+		} else if (event_file_handle->handle_bytes !=
+				event_set[i].handle.handle_bytes) {
+			tst_res(TFAIL,
+				"Got event: handle_bytes (%x) returned in "
+				"event does not equal handle_bytes (%x) "
+				"retunred in name_to_handle_at(2)",
+				event_file_handle->handle_bytes,
+				event_set[i].handle.handle_bytes);
+		} else if (event_file_handle->handle_type !=
+				event_set[i].handle.handle_type) {
+			tst_res(TFAIL,
+				"handle_type (%x) returned in event does not "
+				"equal to handle_type (%x) returned in "
+				"name_to_handle_at(2)",
+				event_file_handle->handle_type,
+				event_set[i].handle.handle_type);
+		} else if (memcmp(event_file_handle->f_handle,
+					event_set[i].handle.f_handle,
+					event_set[i].handle.handle_bytes)
+					!= 0) {
+			tst_res(TFAIL,
+				"event_file_handle->f_handle does not match "
+				"handle.f_handle returned in "
+				"name_to_handle_at(2)");
+		} else if (memcmp(&event_fid->fsid, &event_set[i].fsid,
+					sizeof(event_set[i].fsid)) != 0) {
+			tst_res(TFAIL,
+				"event_fid->fsid != stats.f_fsid that was "
+				"obtained via statfs(2)");
+		} else {
+			tst_res(TPASS,
+				"Got event: mask=%llx, pid=%u, "
+				"fid=%x.%x.%lx values",
+				metadata->mask,
+				getpid(),
+				FSID_VAL_MEMBER(event_fid->fsid, 0),
+				FSID_VAL_MEMBER(event_fid->fsid, 1),
+				*(unsigned long *)
+				event_file_handle->f_handle);
+		}
+	}
+
+	for (; i < count; i++)
+		tst_res(TFAIL,
+			"Didn't receive event: mask=%llx",
+			event_set[i].mask);
+}
+
+static void do_setup(void)
+{
+	int fd;
+
+	/* Check kernel for fanotify support */
+	fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF, O_RDONLY);
+	SAFE_CLOSE(fd);
+
+	fanotify_fd = fanotify_init(FAN_REPORT_FID, O_RDONLY);
+	if (fanotify_fd == -1) {
+		if (errno == EINVAL)
+			tst_brk(TCONF,
+				"FAN_REPORT_FID not supported in kernel");
+		tst_brk(TBROK | TERRNO,
+			"fanotify_init(FAN_REPORT_FID, O_RDONLY) failed");
+	}
+
+	SAFE_MKDIR(TEST_DIR, 0755);
+}
+
+static void do_cleanup(void)
+{
+	if (fanotify_fd > 0)
+		SAFE_CLOSE(fanotify_fd);
+}
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.mount_device = 1,
+	.mntpoint = MOUNT_POINT,
+	.all_filesystems = 1,
+	.test_all = do_test,
+	.setup = do_setup,
+	.cleanup = do_cleanup
+};
+
+#else
+	TST_TEST_TCONF("System does not have required name_to_handle_at() support");
+#endif
+#else
+	TST_TEST_TCONF("System does not have required fanotify support");
+#endif
diff --git a/testcases/kernel/syscalls/fchdir/fchdir03.c b/testcases/kernel/syscalls/fchdir/fchdir03.c
index dd610e5..b09b842 100644
--- a/testcases/kernel/syscalls/fchdir/fchdir03.c
+++ b/testcases/kernel/syscalls/fchdir/fchdir03.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) Bull S.A. 2001
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/fchmod/fchmod06.c b/testcases/kernel/syscalls/fchmod/fchmod06.c
index 02d5f90..446865b 100644
--- a/testcases/kernel/syscalls/fchmod/fchmod06.c
+++ b/testcases/kernel/syscalls/fchmod/fchmod06.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Author: Wayne Boyer
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  * Test that fchmod() fails and sets the proper errno values.
diff --git a/testcases/kernel/syscalls/fcntl/fcntl02.c b/testcases/kernel/syscalls/fcntl/fcntl02.c
index 6d0d5a7..673c691 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl02.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl02.c
@@ -1,35 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
  */
  /*
   * Basic test for fcntl(2) using F_DUPFD argument.
diff --git a/testcases/kernel/syscalls/fcntl/fcntl03.c b/testcases/kernel/syscalls/fcntl/fcntl03.c
index b2476bf..5cb7697 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl03.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl03.c
@@ -1,35 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
  */
  /*
   * Basic test for fcntl(2) using F_GETFD argument.
diff --git a/testcases/kernel/syscalls/fcntl/fcntl04.c b/testcases/kernel/syscalls/fcntl/fcntl04.c
index 1fb978f..3fff2e8 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl04.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl04.c
@@ -1,35 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
  */
  /*
   * Basic test for fcntl(2) using F_GETFL argument.
diff --git a/testcases/kernel/syscalls/fcntl/fcntl24.c b/testcases/kernel/syscalls/fcntl/fcntl24.c
index dff4009..63c716f 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl24.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl24.c
@@ -145,7 +145,7 @@
 		if (TEST_RETURN == -1) {
 			if (type == TST_OVERLAYFS_MAGIC && TEST_ERRNO == EAGAIN) {
 				tst_resm(TINFO | TTERRNO,
-					 "fcntl(F_SETLEASE, F_WRLCK) failed on overlapfs as expected");
+					 "fcntl(F_SETLEASE, F_WRLCK) failed on overlayfs as expected");
 			} else {
 				tst_resm(TFAIL,
 					"fcntl(%s, F_SETLEASE, F_WRLCK) Failed, errno=%d : %s",
diff --git a/testcases/kernel/syscalls/fcntl/fcntl25.c b/testcases/kernel/syscalls/fcntl/fcntl25.c
index 1592ed3..4917584 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl25.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl25.c
@@ -146,7 +146,7 @@
 		if (TEST_RETURN == -1) {
 			if (type == TST_OVERLAYFS_MAGIC && TEST_ERRNO == EAGAIN) {
 				tst_resm(TINFO | TTERRNO,
-					 "fcntl(F_SETLEASE, F_WRLCK) failed on overlapfs as expected");
+					 "fcntl(F_SETLEASE, F_WRLCK) failed on overlayfs as expected");
 			} else {
 				tst_resm(TFAIL,
 					 "fcntl(%s, F_SETLEASE, F_WRLCK) Failed, errno=%d : %s",
diff --git a/testcases/kernel/syscalls/fcntl/fcntl26.c b/testcases/kernel/syscalls/fcntl/fcntl26.c
index 28be4c3..ac74b55 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl26.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl26.c
@@ -146,7 +146,7 @@
 		if (TEST_RETURN == -1) {
 			if (type == TST_OVERLAYFS_MAGIC && TEST_ERRNO == EAGAIN) {
 				tst_resm(TINFO | TTERRNO,
-					 "fcntl(F_SETLEASE, F_WRLCK) failed on overlapfs as expected");
+					 "fcntl(F_SETLEASE, F_WRLCK) failed on overlayfs as expected");
 			} else {
 				tst_resm(TFAIL,
 					"fcntl(%s, F_SETLEASE, F_WRLCK) Failed, errno=%d : %s",
diff --git a/testcases/kernel/syscalls/fcntl/fcntl33.c b/testcases/kernel/syscalls/fcntl/fcntl33.c
index 43dc5a2..70d5ec5 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl33.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl33.c
@@ -117,10 +117,11 @@
 	if (TST_RET == -1) {
 		if (type == TST_OVERLAYFS_MAGIC && TST_ERR == EAGAIN) {
 			tst_res(TINFO | TTERRNO,
-				"fcntl(F_SETLEASE, F_WRLCK) failed on overlapfs as expected");
+				"fcntl(F_SETLEASE, F_WRLCK) failed on overlayfs as expected");
 		} else {
 			tst_res(TFAIL | TTERRNO, "fcntl() failed to set lease");
 		}
+		TST_CHECKPOINT_WAKE(0);
 		goto exit;
 	}
 
@@ -225,7 +226,6 @@
 static struct tst_test test = {
 	.forks_child = 1,
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.needs_checkpoints = 1,
 	.tcnt = ARRAY_SIZE(test_cases),
 	.setup = setup,
diff --git a/testcases/kernel/syscalls/fcntl/fcntl34.c b/testcases/kernel/syscalls/fcntl/fcntl34.c
index 6c7dd8c..3a68b51 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl34.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl34.c
@@ -1,21 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
- *
  * Author: Alexey Kodanev <alexey.kodanev@oracle.com>
- *
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/fcntl/fcntl35.c b/testcases/kernel/syscalls/fcntl/fcntl35.c
index 675da71..c5a071d 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl35.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl35.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.*
  */
 
 /*
@@ -132,5 +120,9 @@
 	.tcnt = ARRAY_SIZE(tcases),
 	.setup = setup,
 	.cleanup = cleanup,
-	.test = do_test
+	.test = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "086e774a57fb"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c
index 58a37e7..1d187c2 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl36.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl36.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
- *
  * Author: Xiong Zhou <xzhou@redhat.com>
  *
  * This is testing OFD locks racing with POSIX locks:
@@ -29,19 +16,17 @@
  *
  * For example:
  *
- *	Init an file with preset values.
+ * Init an file with preset values.
  *
- *	Threads acquire OFD READ  locks to read  a 4k section start from 0;
- *		checking data read back, there should not be any surprise
- *		values and data should be consistent in a 1k block.
+ * Threads acquire OFD READ  locks to read  a 4k section start from 0;
+ * checking data read back, there should not be any surprise
+ * values and data should be consistent in a 1k block.
  *
- *	Threads acquire OFD WRITE locks to write a 4k section start from 1k,
- *		writing different values in different threads.
+ * Threads acquire OFD WRITE locks to write a 4k section start from 1k,
+ * writing different values in different threads.
  *
- *	Check file data after racing, there should not be any surprise values
- *		and data should be consistent in a 1k block.
- *
- *
+ * Check file data after racing, there should not be any surprise values
+ * and data should be consistent in a 1k block.
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync03.c b/testcases/kernel/syscalls/fdatasync/fdatasync03.c
index ee50e75..263175b 100644
--- a/testcases/kernel/syscalls/fdatasync/fdatasync03.c
+++ b/testcases/kernel/syscalls/fdatasync/fdatasync03.c
@@ -32,6 +32,7 @@
 
 	fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
 
+	tst_dev_sync(fd);
 	tst_dev_bytes_written(tst_device->dev);
 
 	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
diff --git a/testcases/kernel/syscalls/fgetxattr/fgetxattr01.c b/testcases/kernel/syscalls/fgetxattr/fgetxattr01.c
index 227e090..35c46a1 100644
--- a/testcases/kernel/syscalls/fgetxattr/fgetxattr01.c
+++ b/testcases/kernel/syscalls/fgetxattr/fgetxattr01.c
@@ -141,7 +141,6 @@
 	.mntpoint = MNTPOINT,
 	.mount_device = 1,
 	.all_filesystems = 1,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 };
 
diff --git a/testcases/kernel/syscalls/flistxattr/flistxattr01.c b/testcases/kernel/syscalls/flistxattr/flistxattr01.c
index 278616e..98a6fa2 100644
--- a/testcases/kernel/syscalls/flistxattr/flistxattr01.c
+++ b/testcases/kernel/syscalls/flistxattr/flistxattr01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 *  Copyright (c) 2016 RT-RK Institute for Computer Based Systems
 *  Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
-*
-*  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.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/flistxattr/flistxattr02.c b/testcases/kernel/syscalls/flistxattr/flistxattr02.c
index 0b81b51..13aa0b7 100644
--- a/testcases/kernel/syscalls/flistxattr/flistxattr02.c
+++ b/testcases/kernel/syscalls/flistxattr/flistxattr02.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2016 RT-RK Institute for Computer Based Systems
 * Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/flistxattr/flistxattr03.c b/testcases/kernel/syscalls/flistxattr/flistxattr03.c
index b9f75a8..49b4634 100644
--- a/testcases/kernel/syscalls/flistxattr/flistxattr03.c
+++ b/testcases/kernel/syscalls/flistxattr/flistxattr03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 *  Copyright (c) 2016 RT-RK Institute for Computer Based Systems
 *  Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
-*
-*  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.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/flock/flock03.c b/testcases/kernel/syscalls/flock/flock03.c
index 57dcc5f..92e21a6 100644
--- a/testcases/kernel/syscalls/flock/flock03.c
+++ b/testcases/kernel/syscalls/flock/flock03.c
@@ -92,7 +92,6 @@
 static struct tst_test test = {
 	.test_all = verify_flock,
 	.needs_checkpoints = 1,
-	.needs_tmpdir = 1,
 	.forks_child = 1,
 	.setup = setup,
 };
diff --git a/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c b/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c
index a3ea1aa..907d210 100644
--- a/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c
+++ b/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c
@@ -89,7 +89,6 @@
 	.mntpoint = MNTPOINT,
 	.mount_device = 1,
 	.all_filesystems = 1,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 };
 
diff --git a/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c b/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c
index 534179e..eb106a8 100644
--- a/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c
+++ b/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c
@@ -112,7 +112,6 @@
 	.mntpoint = MNTPOINT,
 	.mount_device = 1,
 	.all_filesystems = 1,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 };
 
diff --git a/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c b/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c
index b37dba5..ffec810 100644
--- a/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c
+++ b/testcases/kernel/syscalls/fsetxattr/fsetxattr01.c
@@ -221,7 +221,6 @@
 	.mntpoint = MNTPOINT,
 	.mount_device = 1,
 	.all_filesystems = 1,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 };
 
diff --git a/testcases/kernel/syscalls/fstat/.gitignore b/testcases/kernel/syscalls/fstat/.gitignore
index cf5205d..9b10894 100644
--- a/testcases/kernel/syscalls/fstat/.gitignore
+++ b/testcases/kernel/syscalls/fstat/.gitignore
@@ -1,8 +1,4 @@
-/fstat01
-/fstat01_64
 /fstat02
 /fstat02_64
 /fstat03
 /fstat03_64
-/fstat05
-/fstat05_64
diff --git a/testcases/kernel/syscalls/fstat/fstat01.c b/testcases/kernel/syscalls/fstat/fstat01.c
deleted file mode 100644
index a5940c6..0000000
--- a/testcases/kernel/syscalls/fstat/fstat01.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id: fstat01.c,v 1.6 2009/08/28 12:51:34 vapier Exp $ */
-/**********************************************************
- *
- *    OS Test - Silicon Graphics, Inc.
- *
- *    TEST IDENTIFIER	: fstat01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for fstat(2)
- *
- *    PARENT DOCUMENT	: usctpl01
- *
- *    TEST CASE TOTAL	: 1
- *
- *    WALL CLOCK TIME	: 1
- *
- *    CPU TYPES		: ALL
- *
- *    AUTHOR		: William Roske
- *
- *    CO-PILOT		: Dave Fenner
- *
- *    DATE STARTED	: 03/30/92
- *
- *    INITIAL RELEASE	: UNICOS 7.0
- *
- *    TEST CASES
- *
- *	1.) fstat(2) returns...(See Description)
- *
- *    INPUT SPECIFICATIONS
- *	The standard options for system call tests are accepted.
- *	(See the parse_opts(3) man page).
- *
- *    OUTPUT SPECIFICATIONS
- *
- *    DURATION
- *	Terminates - with frequency and infinite modes.
- *
- *    SIGNALS
- *	Uses SIGUSR1 to pause before test if option set.
- *	(See the parse_opts(3) man page).
- *
- *    RESOURCES
- *	None
- *
- *    ENVIRONMENTAL NEEDS
- *      No run-time environmental needs.
- *
- *    SPECIAL PROCEDURAL REQUIREMENTS
- *	None
- *
- *    INTERCASE DEPENDENCIES
- *	None
- *
- *    DETAILED DESCRIPTION
- *	This is a Phase I test for the fstat(2) system call.  It is intended
- *	to provide a limited exposure of the system call, for now.  It
- *	should/will be extended when full functional tests are written for
- *	fstat(2).
- *
- *	Setup:
- *	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- *	Test:
- *	 Loop if the proper options are given.
- *	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	  Otherwise, Issue a PASS message.
- *
- *	Cleanup:
- *	  Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "safe_macros.h"
-
-void setup();
-void cleanup();
-
-char *TCID = "fstat01";
-int TST_TOTAL = 1;
-
-char fname[255];
-int fd;
-struct stat statter;
-
-int main(int ac, char **av)
-{
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		TEST(fstat(fd, &statter));
-
-		if (TEST_RETURN == -1)
-			tst_resm(TFAIL | TTERRNO, "fstat failed");
-		else
-			tst_resm(TPASS, "fstat returned %ld", TEST_RETURN);
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	sprintf(fname, "tfile_%d", getpid());
-	fd = SAFE_OPEN(cleanup, fname, O_RDWR | O_CREAT, 0700);
-}
-
-void cleanup(void)
-{
-	if (close(fd) == -1)
-		tst_resm(TWARN | TERRNO, "close(%s) failed", fname);
-
-	tst_rmdir();
-
-}
diff --git a/testcases/kernel/syscalls/fstat/fstat02.c b/testcases/kernel/syscalls/fstat/fstat02.c
index 21ef166..4744560 100644
--- a/testcases/kernel/syscalls/fstat/fstat02.c
+++ b/testcases/kernel/syscalls/fstat/fstat02.c
@@ -1,152 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) International Business Machines  Corp., 2001
  *  07/2001 Ported by Wayne Boyer
- *
- * 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
+ *  05/2019 Ported to new library: Christian Amann <camann@suse.com>
  */
 /*
- * fstat() should return value 0 on success and the stat structure elements
- * should be filled with specified 'file' information.
+ * Tests if fstat() returns correctly and reports correct file information
+ * using the stat structure.
  */
-#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/stat.h>
+
 #include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <pwd.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "tst_test.h"
+#include "tst_safe_macros.h"
 
-#include "test.h"
-#include "safe_macros.h"
-
-#define FILE_MODE	0644
-#define TESTFILE	"testfile"
+#define TESTFILE        "test_file"
 #define FILE_SIZE       1024
-#define BUF_SIZE	256
-#define MASK		0777
+#define FILE_MODE	0644
 
-char *TCID = "fstat02";
-int TST_TOTAL = 1;
+static struct stat stat_buf;
 static uid_t user_id;
 static gid_t group_id;
 static int fildes;
 
-static void setup(void);
-static void cleanup(void);
-
-static void verify(void)
+static void run(void)
 {
-	struct stat stat_buf;
 	int fail = 0;
 
 	TEST(fstat(fildes, &stat_buf));
 
-	if (TEST_RETURN == -1) {
-		tst_resm(TFAIL | TTERRNO, "fstat(%s) failed", TESTFILE);
+	if (TST_RET != 0) {
+		tst_res(TFAIL | TTERRNO, "fstat() failed");
 		return;
 	}
 
+	fail = 0;
 	if (stat_buf.st_uid != user_id) {
-		tst_resm(TINFO, "stat_buf.st_uid = %i expected %i",
-		         stat_buf.st_uid, user_id);
+		tst_res(TFAIL, "stat_buf.st_uid = %i expected %i",
+			stat_buf.st_uid, user_id);
 		fail++;
 	}
 
 	if (stat_buf.st_gid != group_id) {
-		tst_resm(TINFO, "stat_buf.st_gid = %i expected %i",
-		         stat_buf.st_gid, group_id);
+		tst_res(TFAIL, "stat_buf.st_gid = %i expected %i",
+			stat_buf.st_gid, group_id);
 		fail++;
 	}
 
 	if (stat_buf.st_size != FILE_SIZE) {
-		tst_resm(TINFO, "stat_buf.st_size = %li expected %i",
-		         (long)stat_buf.st_size, FILE_SIZE);
+		tst_res(TFAIL, "stat_buf.st_size = %li expected %i",
+			(long)stat_buf.st_size, FILE_SIZE);
 		fail++;
 	}
 
-        if ((stat_buf.st_mode & MASK) != FILE_MODE) {
-		tst_resm(TINFO, "stat_buf.st_mode = %o expected %o",
-		         (stat_buf.st_mode & MASK), FILE_MODE);
+	if ((stat_buf.st_mode & 0777) != FILE_MODE) {
+		tst_res(TFAIL, "stat_buf.st_mode = %o expected %o",
+			(stat_buf.st_mode & 0777), FILE_MODE);
 		fail++;
 	}
 
-	if (fail) {
-		tst_resm(TFAIL, "functionality of fstat incorrect");
+	if (fail)
 		return;
-	}
 
-	tst_resm(TPASS, "functionality of fstat correct");
-}
-
-int main(int ac, char **av)
-{
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++)
-		verify();
-
-	cleanup();
-	tst_exit();
+	tst_res(TPASS, "fstat() reported correct values.");
 }
 
 static void setup(void)
 {
-	struct passwd *ltpuser;
-	char tst_buff[BUF_SIZE];
-	int wbytes;
-	int write_len = 0;
-
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	ltpuser = SAFE_GETPWNAM(NULL, "nobody");
-	SAFE_SETUID(NULL, ltpuser->pw_uid);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	umask(022);
-
-	fildes = SAFE_OPEN(tst_rmdir, TESTFILE, O_WRONLY | O_CREAT, FILE_MODE);
-
-	/* Fill the test buffer with the known data */
-	memset(tst_buff, 'a', BUF_SIZE - 1);
-
-	/* Write to the file 1k data from the buffer */
-	while (write_len < FILE_SIZE) {
-		if ((wbytes = write(fildes, tst_buff, sizeof(tst_buff))) <= 0)
-			tst_brkm(TBROK | TERRNO, cleanup, "write failed");
-		else
-			write_len += wbytes;
-	}
-
-	user_id = getuid();
+	user_id  = getuid();
 	group_id = getgid();
+
+	fildes = SAFE_OPEN(TESTFILE, O_WRONLY | O_CREAT, FILE_MODE);
+
+	if (tst_fill_file(TESTFILE, 'a', FILE_SIZE, 1))
+		tst_brk(TBROK, "Could not fill Testfile!");
 }
 
 static void cleanup(void)
 {
-	if (close(fildes) == -1)
-		tst_resm(TWARN | TERRNO, "close failed");
-
-	tst_rmdir();
+	if (fildes > 0)
+		SAFE_CLOSE(fildes);
 }
+
+static struct tst_test test = {
+	.test_all = run,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/fstat/fstat03.c b/testcases/kernel/syscalls/fstat/fstat03.c
index 0fa62b8..68fae43 100644
--- a/testcases/kernel/syscalls/fstat/fstat03.c
+++ b/testcases/kernel/syscalls/fstat/fstat03.c
@@ -1,160 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Test Name: fstat03
+ * Copyright (c) International Business Machines  Corp., 2001
+ *  07/2001 Ported by Wayne Boyer
+ *  05/2019 Ported to new library: Christian Amann <camann@suse.com>
+ */
+/*
+ * Tests different error scenarios:
  *
- * Test Description:
- *   Verify that, fstat(2) returns -1 and sets errno to EBADF if the file
- *   pointed to by file descriptor is not valid.
- *
- * Expected Result:
- *  fstat() should fail with return value -1 and set expected errno.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	if errno set == expected errno
- *		Issue sys call fails with expected return value and errno.
- *	Otherwise,
- *		Issue sys call fails with unexpected errno.
- *   Otherwise,
- *	Issue sys call returns unexpected value.
- *
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory(s)/file(s) created.
- *
- * Usage:  <for command-line>
- *  fstat03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *	       -i n : Execute test n times.
- *	       -I x : Execute test for x seconds.
- *	       -P x : Pause for x seconds between iterations.
- *	       -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS:
- *  This test should be executed by 'non-super-user' only.
- *
+ * 1) Calls fstat() with closed file descriptor
+ *    -> EBADF
+ * 2) Calls fstat() with an invalid address for stat structure
+ *    -> EFAULT (or receive signal SIGSEGV)
  */
 
-#include <stdio.h>
+#include <errno.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
+#include <wait.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include "tst_test.h"
+#include "tst_safe_macros.h"
 
-#include "test.h"
-#include "safe_macros.h"
+#define TESTFILE	"test_file"
 
-#define FILE_MODE	S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define TEST_FILE	"testfile"
+static int fd_ok;
+static int fd_ebadf = -1;
+static struct stat stat_buf;
 
-char *TCID = "fstat03";
-int TST_TOTAL = 1;
+static struct tcase {
+	int *fd;
+	struct stat *stat_buf;
+	int exp_err;
+} tcases[] = {
+	{&fd_ebadf, &stat_buf, EBADF},
+	{&fd_ok, NULL, EFAULT},
+};
 
-int fildes;			/* testfile descriptor */
-
-void setup();			/* Main setup function for the tests */
-void cleanup();			/* cleanup function for the test */
-
-int main(int ac, char **av)
+static void check_fstat(unsigned int tc_num)
 {
-	struct stat stat_buf;	/* stat structure buffer */
-	int lc;
+	struct tcase *tc = &tcases[tc_num];
 
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	/*
-	 * Invoke setup function to create a testfile under temporary
-	 * directory.
-	 */
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-		/*
-		 * Call fstat(2) to get the status information
-		 * of a closed testfile pointed to by 'fd'.
-		 * verify that fstat fails with -1 return value and
-		 * sets appropriate errno.
-		 */
-		TEST(fstat(fildes, &stat_buf));
-
-		/* Check return code from fstat(2) */
-		if (TEST_RETURN == -1) {
-			if (TEST_ERRNO == EBADF) {
-				tst_resm(TPASS,
-					 "fstat() fails with expected error EBADF");
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "fstat() did not fail with EBADF");
-			}
+	TEST(fstat(*tc->fd, tc->stat_buf));
+	if (TST_RET == -1) {
+		if (tc->exp_err == TST_ERR) {
+			tst_res(TPASS,
+				 "fstat() fails with expected error %s",
+				 tst_strerrno(tc->exp_err));
 		} else {
-			tst_resm(TFAIL, "fstat() returned %ld, expected -1",
-				 TEST_RETURN);
+			tst_res(TFAIL | TTERRNO,
+				 "fstat() did not fail with %s, but with",
+				 tst_strerrno(tc->exp_err));
 		}
+	} else {
+		tst_res(TFAIL, "fstat() returned %ld, expected -1",
+			 TST_RET);
+	}
+}
+
+static void run(unsigned int tc_num)
+{
+	pid_t pid;
+	int status;
+
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		check_fstat(tc_num);
+		return;
+	}
+	SAFE_WAITPID(pid, &status, 0);
+
+	if (tcases[tc_num].exp_err == EFAULT && WTERMSIG(status) == SIGSEGV) {
+		tst_res(TPASS, "fstat() failed as expected with SIGSEGV");
+		return;
 	}
 
-	/*
-	 * Invoke cleanup() to delete the test directory/file(s) created
-	 * in the setup().
-	 */
-	cleanup();
+	if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
+		return;
 
-	tst_exit();
+	tst_res(TBROK, "child %s", tst_strstatus(status));
 }
 
-/*
- * void
- * setup(void) - performs all ONE TIME setup for this test.
- *	Exit the test program on receipt of unexpected signals.
- *	Create a temporary directory and change directory to it.
- *      Create a testfile under temporary directory.
- *      Close the testfile.
- */
-void setup(void)
+static void setup(void)
 {
-	/* Capture unexpected signals */
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	/* Make a temp dir and cd to it */
-	tst_tmpdir();
-
-	/* Create a testfile under temporary directory */
-	fildes = SAFE_OPEN(cleanup, TEST_FILE, O_RDWR | O_CREAT, 0666);
-
-	SAFE_CLOSE(cleanup, fildes);
+	fd_ok = SAFE_OPEN(TESTFILE, O_RDWR | O_CREAT, 0644);
 }
 
-/*
- * void
- * cleanup() - Performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- *	Print test timing stats and errno log if test executed with options.
- *	Close the testfile if still opened.
- *	Remove temporary directory and sub-directories/files under it
- *	created during setup().
- *	Exit the test program with normal exit code.
- */
-void cleanup(void)
+static void cleanup(void)
 {
-
-	tst_rmdir();
-
+	if (fd_ok > 0)
+		SAFE_CLOSE(fd_ok);
 }
+
+static struct tst_test test = {
+	.test = run,
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+	.forks_child = 1,
+};
diff --git a/testcases/kernel/syscalls/fstat/fstat05.c b/testcases/kernel/syscalls/fstat/fstat05.c
deleted file mode 100644
index 200de41..0000000
--- a/testcases/kernel/syscalls/fstat/fstat05.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- *
- *   Copyright (C) Bull S.A. 2001
- *   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
- */
-
-/*
- * Test Name: fstat05
- *
- * Test Description:
- *   Verify that,
- *   if buffer points outside user's accessible address space fstat(2)
- *	either returns -1 and sets errno to EFAULT
- *	or SIGSEGV is returned instead of EFAULT
- *
- * Expected Result:
- *   fstat() should fail with return value -1 and set expected errno.
- *    or
- *   fstat() should fail with SIGSEGV returned.
- *   Both results are considered as acceptable.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling SIGSEGV included.
- *   Switch to nobody user.
- *   Pause for SIGUSR1 if option specified.
- *   Create temporary directory.
- *   Create a testfile under temporary directory.
- *
- *  Test:
- *   Buffer points outside user's accessible address space.
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	if errno set == expected errno
- *		Issue sys call fails with expected return value and errno.
- *	Otherwise,
- *		Issue sys call fails with unexpected errno.
- *   Otherwise,
- *	Issue sys call returns unexpected value.
- *
- *  Sighandler:
- *	if signal == SIGSEGV
- *		Issue sys call fails with expected signal
- *      Otherwise,
- *              Issue sys call fails with unexpected signal.
- *
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Close the test file
- *   Delete the temporary directory(s)/file(s) created.
- *
- * Usage:  <for command-line>
- *  fstat05 [-c n] [-e] [-i n] [-I x] [-p x] [-t]
- *	where,  -c n : Run n copies concurrently.
- *		-e   : Turn on errno logging.
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-P x : Pause for x seconds between iterations.
- *		-t   : Turn on syscall timing.
- *
- * History
- *	05/2002 Jacky Malcles
- *		-Ported
- *
- * Restrictions:
- *      This test must be run as root.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pwd.h>
-
-#include "test.h"
-#include "safe_macros.h"
-
-#define TEST_FILE       "testfile"
-
-char nobody_uid[] = "nobody";
-struct passwd *ltpuser;
-
-char *TCID = "fstat05";
-int TST_TOTAL = 1;
-
-int fildes;			/* testfile descriptor */
-
-void setup();			/* Main setup function for the tests */
-void cleanup();			/* cleanup function for the test */
-void sighandler(int sig);	/* signals handler function for the test */
-
-int siglist[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT,
-	SIGBUS, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM,
-	SIGTERM,
-#ifdef SIGSTKFLT
-	SIGSTKFLT,
-#endif
-	SIGCHLD, SIGCONT, SIGTSTP, SIGTTIN,
-	SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF,
-	SIGWINCH, SIGIO, SIGPWR, SIGSYS,
-#ifdef SIGUNUSED
-	SIGUNUSED
-#endif
-};
-
-int SIG_SEEN = sizeof(siglist) / sizeof(int);
-
-#if !defined(UCLINUX)
-
-int main(int ac, char **av)
-{
-	struct stat *ptr_str = tst_get_bad_addr(NULL);
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	/*
-	 * Invoke setup function
-	 */
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call fstat(2).
-		 * verify that it fails with -1 return value and
-		 * sets appropriate errno.
-		 */
-		TEST(fstat(fildes, ptr_str));
-
-		/* Check return code from fstat(2) */
-		if (TEST_RETURN == -1) {
-			if (TEST_ERRNO == EFAULT)
-				tst_resm(TPASS,
-					 "fstat failed with EFAULT as expected");
-			else
-				tst_resm(TFAIL | TTERRNO,
-					 "fstat failed unexpectedly");
-		} else
-			tst_resm(TFAIL, "fstat() returned %ld but we wanted -1",
-				 TEST_RETURN);
-
-	}
-
-	/*
-	 * Invoke cleanup() to delete the test directory/file(s) created
-	 * in the setup().
-	 */
-	cleanup();
-	tst_exit();
-}
-
-#else
-
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "test is not available on uClinux");
-}
-
-#endif /* if !defined(UCLINUX) */
-
-/*
- * void
- * setup(void) - performs all ONE TIME setup for this test.
- *	Exit the test program on receipt of unexpected signals.
- *	Create a temporary directory and change directory to it.
- */
-void setup(void)
-{
-	int i;
-
-	tst_require_root();
-
-	/*
-	 * Capture unexpected signals SIGSEGV included
-	 * SIGSEGV being considered as acceptable as returned value
-	 */
-	for (i = 0; i < SIG_SEEN; i++)
-		signal(siglist[i], &sighandler);
-
-	ltpuser = getpwnam(nobody_uid);
-	SAFE_SETUID(NULL, ltpuser->pw_uid);
-
-	tst_tmpdir();
-
-	/* Create a testfile under temporary directory */
-	fildes = SAFE_OPEN(cleanup, TEST_FILE, O_RDWR | O_CREAT, 0666);
-
-	TEST_PAUSE;
-}
-
-/*
- * void
- * cleanup() - Performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- *	Print test timing stats and errno log if test executed with options.
- *	Remove temporary directory and sub-directories/files under it
- *	created during setup().
- *	Exit the test program with normal exit code.
- */
-void cleanup(void)
-{
-
-	SAFE_CLOSE(cleanup, fildes);
-
-	tst_rmdir();
-
-}
-
-/*
- * sighandler() - handle the signals
- */
-
-void sighandler(int sig)
-{
-	if (sig == SIGSEGV)
-		tst_resm(TPASS, "fstat failed as expected with SIGSEGV");
-	else
-		tst_brkm(TBROK, NULL, "Unexpected signal %d received.", sig);
-	cleanup();
-	tst_exit();
-}
diff --git a/testcases/kernel/syscalls/fsync/fsync01.c b/testcases/kernel/syscalls/fsync/fsync01.c
index f5e1418..4e2281b 100644
--- a/testcases/kernel/syscalls/fsync/fsync01.c
+++ b/testcases/kernel/syscalls/fsync/fsync01.c
@@ -1,36 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  *    AUTHOR		: William Roske
  *    CO-PILOT		: Dave Fenner
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
  */
 
 #include <unistd.h>
@@ -75,7 +47,6 @@
 	.cleanup = cleanup,
 	.setup = setup,
 	.test_all = verify_fsync,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.mount_device = 1,
 	.mntpoint = "mntpoint",
diff --git a/testcases/kernel/syscalls/fsync/fsync03.c b/testcases/kernel/syscalls/fsync/fsync03.c
index 60d15f4..d32c4a3 100644
--- a/testcases/kernel/syscalls/fsync/fsync03.c
+++ b/testcases/kernel/syscalls/fsync/fsync03.c
@@ -1,141 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   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
+ *   Copyright (c) Wayne Boyer, International Business Machines  Corp., 2001
+ *   Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
  */
 
 /*
- * NAME
- *	fsync03.c
- *
- * DESCRIPTION
- *	Testcase to check that fsync(2) sets errno correctly.
- *
- * ALGORITHM
- *	1. Call fsync() with an invalid fd, and test for EBADF.
- *	2. Call fsync() on a pipe(fd), and expect EINVAL.
- *
- * USAGE:  <for command-line>
- *  fsync03 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	NONE
+ * Test Description:
+ *  Testcase to check that fsync(2) sets errno correctly.
+ *  1. Call fsync() on a pipe(fd), and expect EINVAL.
+ *  2. Call fsync() on a socket(fd), and expect EINVAL.
+ *  3. Call fsync() on a closed fd, and test for EBADF.
+ *  4. Call fsync() on an invalid fd, and test for EBADF.
+ *  5. Call fsync() on a fifo(fd), and expect EINVAL.
  */
 
 #include <unistd.h>
 #include <errno.h>
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
-void setup(void);
-void cleanup(void);
+#define FIFO_PATH "fifo"
 
-int fd[2];			/* fd's for the pipe() call in setup()  */
-int pfd;			/* holds the value for fd[1]            */
-int bfd = -1;			/* an invalid fd                        */
+static int fifo_rfd, fifo_wfd;
+static int pipe_fd[2];
+static int sock_fd, bad_fd = -1;
 
-struct test_case_t {
+static const struct test_case {
 	int *fd;
 	int error;
-} TC[] = {
+} testcase_list[] = {
+	/* EINVAL - fsync() on pipe should not succeed. */
+	{&pipe_fd[1], EINVAL},
+	/* EINVAL - fsync() on socket should not succeed. */
+	{&sock_fd, EINVAL},
+	/* EBADF - fd is closed */
+	{&pipe_fd[0], EBADF},
 	/* EBADF - fd is invalid (-1) */
-	{
-	&bfd, EBADF},
-	    /* EINVAL - fsync() on pipe should not succeed. */
-	{
-	&pfd, EINVAL}
+	{&bad_fd, EBADF},
+	/* EINVAL - fsync() on fifo should not succeed. */
+	{&fifo_wfd, EINVAL},
 };
 
-char *TCID = "fsync03";
-int TST_TOTAL = 2;
-
-int main(int ac, char **av)
+static void setup(void)
 {
-	int lc;
-	int i;
+	SAFE_MKFIFO(FIFO_PATH, 0644);
+	SAFE_PIPE(pipe_fd);
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	// FIFO must be opened for reading first, otherwise
+	// open(fifo, O_WRONLY) will block.
+	fifo_rfd = SAFE_OPEN(FIFO_PATH, O_RDONLY | O_NONBLOCK);
+	fifo_wfd = SAFE_OPEN(FIFO_PATH, O_WRONLY);
+	sock_fd = SAFE_SOCKET(AF_UNIX, SOCK_STREAM, 0);
 
-	setup();
+	// Do not open any file descriptors after this line unless you close
+	// them before the next test run.
+	SAFE_CLOSE(pipe_fd[0]);
+}
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
+static void test_fsync(unsigned int n)
+{
+	const struct test_case *tc = testcase_list + n;
 
-		tst_count = 0;
+	TEST(fsync(*tc->fd));
 
-		/* loop through the test cases */
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			TEST(fsync(*(TC[i].fd)));
-
-			if (TEST_RETURN != -1) {
-				tst_resm(TFAIL, "call succeeded unexpectedly");
-				continue;
-			}
-
-			if (TEST_ERRNO == TC[i].error) {
-				tst_resm(TPASS, "expected failure - "
-					 "errno = %d : %s", TEST_ERRNO,
-					 strerror(TEST_ERRNO));
-			} else {
-				tst_resm(TFAIL, "unexpected error - %d : %s - "
-					 "expected %d", TEST_ERRNO,
-					 strerror(TEST_ERRNO), TC[i].error);
-			}
-		}
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "fsync() returned unexpected value %ld",
+			TST_RET);
+	} else if (TST_ERR != tc->error) {
+		tst_res(TFAIL | TTERRNO, "fsync(): unexpected error");
+	} else {
+		tst_res(TPASS | TTERRNO, "fsync() failed as expected");
 	}
-	cleanup();
-
-	tst_exit();
 }
 
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup(void)
+static void cleanup(void)
 {
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	/* make a temporary directory and cd to it */
-	tst_tmpdir();
-
-	SAFE_PIPE(cleanup, fd);
-
-	pfd = fd[1];
+	SAFE_CLOSE(fifo_wfd);
+	SAFE_CLOSE(fifo_rfd);
+	SAFE_CLOSE(pipe_fd[1]);
+	SAFE_CLOSE(sock_fd);
 }
 
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- */
-void cleanup(void)
-{
-
-	/* delete the test directory created in setup() */
-	tst_rmdir();
-
-}
+static struct tst_test test = {
+	.test = test_fsync,
+	.tcnt = ARRAY_SIZE(testcase_list),
+	.needs_tmpdir = 1,
+	.setup = setup,
+	.cleanup = cleanup
+};
diff --git a/testcases/kernel/syscalls/fsync/fsync04.c b/testcases/kernel/syscalls/fsync/fsync04.c
index c67fc56..1e4b875 100644
--- a/testcases/kernel/syscalls/fsync/fsync04.c
+++ b/testcases/kernel/syscalls/fsync/fsync04.c
@@ -32,6 +32,7 @@
 
 	fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
 
+	tst_dev_sync(fd);
 	tst_dev_bytes_written(tst_device->dev);
 
 	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
diff --git a/testcases/kernel/syscalls/ftruncate/.gitignore b/testcases/kernel/syscalls/ftruncate/.gitignore
index 814b707..b08763f 100644
--- a/testcases/kernel/syscalls/ftruncate/.gitignore
+++ b/testcases/kernel/syscalls/ftruncate/.gitignore
@@ -1,7 +1,5 @@
 /ftruncate01
 /ftruncate01_64
-/ftruncate02
-/ftruncate02_64
 /ftruncate03
 /ftruncate03_64
 /ftruncate04
diff --git a/testcases/kernel/syscalls/ftruncate/ftruncate01.c b/testcases/kernel/syscalls/ftruncate/ftruncate01.c
index 3309af5..5ffdd05 100644
--- a/testcases/kernel/syscalls/ftruncate/ftruncate01.c
+++ b/testcases/kernel/syscalls/ftruncate/ftruncate01.c
@@ -1,203 +1,103 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   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
+ * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Wayne Boyer
  */
-
 /*
- * Test Name: ftruncate01
- *
  * Test Description:
- *  Verify that, ftruncate(2) succeeds to truncate a file to a specified
- *  length if the file indicated by file descriptor opened for writing.
- *
- * Expected Result:
- *  ftruncate(2) should return a value 0 and the length of the file after
- *  truncation should be equal to the length it is truncated to.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	Log the errno and Issue a FAIL message.
- *   Otherwise,
- *	Verify the Functionality of system call
- *      if successful,
- *		Issue Functionality-Pass message.
- *      Otherwise,
- *		Issue Functionality-Fail message.
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory created.
- *
- * Usage:  <for command-line>
- *  ftruncate01 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -f   : Turn off functionality Testing.
- *	       -i n : Execute test n times.
- *	       -I x : Execute test for x seconds.
- *	       -P x : Pause for x seconds between iterations.
- *	       -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS:
- *  This test should be run by 'non-super-user' only.
- *
+ *  Verify that, ftruncate() succeeds to truncate a file to a certain length,
+ *  if the file previously is smaller than the truncated size, ftruncate()
+ *  shall increase the size of the file.
  */
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <string.h>
-#include <signal.h>
-#include <inttypes.h>
 
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
-#define TESTFILE	"testfile"	/* file under test */
-#define FILE_MODE	S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define BUF_SIZE	256	/* buffer size */
-#define FILE_SIZE	1024	/* test file size */
-#define TRUNC_LEN	256	/* truncation length */
+#define TESTFILE	"testfile"
 
-TCID_DEFINE(ftruncate01);
-int TST_TOTAL = 1;		/* Total number of test conditions */
-int fildes;			/* file descriptor for test file */
+#define TRUNC_LEN1	256
+#define TRUNC_LEN2	512
+#define FILE_SIZE	1024
 
-void setup();			/* setup function for the test */
-void cleanup();			/* cleanup function for the test */
+static int fd;
 
-int main(int ac, char **av)
+static void check_and_report(off_t offset, char data, off_t trunc_len)
 {
-	struct stat stat_buf;	/* stat(2) struct contents */
-	int lc;
-	off_t file_length;	/* test file length */
+	int i, file_length;
+	char buf[FILE_SIZE];
+	struct stat stat_buf;
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	memset(buf, '*', sizeof(buf));
 
-	setup();
+	SAFE_FSTAT(fd, &stat_buf);
+	file_length = stat_buf.st_size;
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
+	if (file_length != trunc_len) {
+		tst_res(TFAIL, "ftruncate() got incorrected size: %d",
+			file_length);
+		return;
+	}
 
-		tst_count = 0;
+	SAFE_LSEEK(fd, offset, SEEK_SET);
+	SAFE_READ(0, fd, buf, sizeof(buf));
 
-		/*
-		 * Call ftruncate(2) to truncate a test file to a
-		 * specified length.
-		 */
-		TEST(ftruncate(fildes, TRUNC_LEN));
-
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL | TTERRNO, "ftruncate(%s) failed",
-				 TESTFILE);
-			continue;
-		}
-		/*
-		 * Get the testfile information using
-		 * fstat(2).
-		 */
-		if (fstat(fildes, &stat_buf) < 0) {
-			tst_brkm(TFAIL, cleanup,
-				 "stat(2) of %s failed, error:%d",
-				 TESTFILE, errno);
-		}
-		stat_buf.st_mode &= ~S_IFREG;
-		file_length = stat_buf.st_size;
-
-		/*
-		 * Check for expected size of testfile after
-		 * truncate(2) on it.
-		 */
-		if (file_length != TRUNC_LEN) {
-			tst_resm(TFAIL,
-				 "%s: Incorrect file size %" PRId64 ", "
-				 "Expected %d", TESTFILE,
-				 (int64_t) file_length, TRUNC_LEN);
-		} else {
-			tst_resm(TPASS, "Functionality of ftruncate() "
-				 "on %s successful", TESTFILE);
+	for (i = 0; i < TRUNC_LEN1; i++) {
+		if (buf[i] != data) {
+			tst_res(TFAIL,
+				"ftruncate() got incorrect data %i, expected %i",
+				buf[i], data);
+			return;
 		}
 	}
 
-	cleanup();
-	tst_exit();
+	tst_res(TPASS, "ftruncate() succeeded");
 }
 
-/*
- * void
- * setup() - performs all ONE TIME setup for this test.
- *  Create a temporary directory and change directory to it.
- *  Create a test file under temporary directory and write some
- *  data into it.
- */
-void setup(void)
+static void verify_ftruncate(void)
 {
-	int i;
-	int c, c_total = 0;	/* bytes to be written to file */
-	char tst_buff[BUF_SIZE];	/* buffer to hold data */
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	/* Fill the test buffer with the known data */
-	for (i = 0; i < BUF_SIZE; i++) {
-		tst_buff[i] = 'a';
+	tst_res(TINFO, "Truncated length smaller than file size");
+	TEST(ftruncate(fd, TRUNC_LEN1));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "ftruncate() failed");
+		return;
 	}
 
-	/* open a file for reading/writing */
-	fildes = SAFE_OPEN(cleanup, TESTFILE, O_RDWR | O_CREAT, FILE_MODE);
+	check_and_report(0, 'a', TRUNC_LEN1);
 
-	/* Write to the file 1k data from the buffer */
-	while (c_total < FILE_SIZE) {
-		if ((c = write(fildes, tst_buff, sizeof(tst_buff))) <= 0) {
-			tst_brkm(TBROK | TERRNO, cleanup, "write(%s) failed",
-				 TESTFILE);
-		} else {
-			c_total += c;
-		}
+	tst_res(TINFO, "Truncated length exceeds file size");
+	TEST(ftruncate(fd, TRUNC_LEN2));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "ftruncate() failed");
+		return;
 	}
+
+	check_and_report(TRUNC_LEN1, 0, TRUNC_LEN2);
 }
 
-/*
- * void
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- *  Close the temporary file.
- *  Remove the test directory and testfile created in the setup.
- */
-void cleanup(void)
+static void setup(void)
 {
+	if (tst_fill_file(TESTFILE, 'a', FILE_SIZE, 1))
+		tst_brk(TBROK, "Failed to create test file");
 
-	/* Close the testfile after writing data into it */
-	if (close(fildes) == -1)
-		tst_brkm(TFAIL | TERRNO, NULL, "close(%s) failed", TESTFILE);
-
-	tst_rmdir();
-
+	fd = SAFE_OPEN(TESTFILE, O_RDWR);
 }
+
+static void cleanup(void)
+{
+	if (fd > 0)
+		SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+	.test_all = verify_ftruncate,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/ftruncate/ftruncate02.c b/testcases/kernel/syscalls/ftruncate/ftruncate02.c
deleted file mode 100644
index 8ae226a..0000000
--- a/testcases/kernel/syscalls/ftruncate/ftruncate02.c
+++ /dev/null
@@ -1,286 +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
- */
-
-/*
- * Test Name: ftruncate02
- *
- * Test Description:
- *  Verify that, ftruncate(2) succeeds to truncate a file to a certain length,
- *  but the attempt to read past the truncated length will fail.
- *
- * Expected Result:
- *  ftruncate(2) should return a value 0 and the attempt to read past the
- *  truncated length will fail. In case where the file before  truncation was
- *  shorter, the bytes between the old and new should  be all zeroes.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	Log the errno and Issue a FAIL message.
- *   Otherwise,
- *	Verify the Functionality of system call
- *      if successful,
- *		Issue Functionality-Pass message.
- *      Otherwise,
- *		Issue Functionality-Fail message.
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory created.
- *
- * Usage:  <for command-line>
- *  ftruncate02 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -f   : Turn off functionality Testing.
- *	       -i n : Execute test n times.
- *	       -I x : Execute test for x seconds.
- *	       -P x : Pause for x seconds between iterations.
- *	       -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS:
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include "test.h"
-#include "safe_macros.h"
-
-#define TESTFILE	"testfile"	/* file under test */
-#define FILE_MODE	S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define BUF_SIZE	256	/* buffer size */
-#define FILE_SIZE	1024	/* test file size */
-#define TRUNC_LEN1	256	/* truncation length */
-#define TRUNC_LEN2	512	/* truncation length */
-
-TCID_DEFINE(ftruncate02);
-int TST_TOTAL = 1;		/* Total number of test conditions */
-int fd;				/* file descriptor of testfile */
-char tst_buff[BUF_SIZE];	/* buffer to hold testfile contents */
-
-void setup();			/* setup function for the test */
-void cleanup();			/* cleanup function for the test */
-
-int main(int ac, char **av)
-{
-	struct stat stat_buf;	/* stat(2) struct contents */
-	int lc;
-	off_t file_length2;	/* test file length */
-	off_t file_length1;	/* test file length */
-	int rbytes, i;		/* bytes read from testfile */
-	int read_len;		/* total no. of bytes read from testfile */
-	int err_flag = 0;	/* error indicator flag */
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-		read_len = 0;
-
-		/*
-		 * Call ftruncate(2) to truncate a test file to a
-		 * specified length (TRUNC_LEN1).
-		 */
-		TEST(ftruncate(fd, TRUNC_LEN1));
-
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL | TTERRNO,
-				 "ftruncate(%s) to size %d failed", TESTFILE,
-				 TRUNC_LEN1);
-			continue;
-		}
-		/*
-		 * Get the testfile information using
-		 * fstat(2).
-		 */
-		if (fstat(fd, &stat_buf) < 0) {
-			tst_brkm(TFAIL, cleanup, "fstat(2) of %s failed"
-				 " after 1st truncate, error:%d",
-				 TESTFILE, errno);
-		}
-		stat_buf.st_mode &= ~S_IFREG;
-		file_length1 = stat_buf.st_size;
-
-		/*
-		 * Set the file pointer of testfile to the
-		 * beginning of the file.
-		 */
-		if (lseek(fd, 0, SEEK_SET) < 0) {
-			tst_brkm(TFAIL, cleanup, "lseek(2) on %s failed"
-				 " after 1st ftruncate, error:%d",
-				 TESTFILE, errno);
-		}
-
-		/* Read the testfile from the beginning. */
-		while ((rbytes = read(fd, tst_buff,
-				      sizeof(tst_buff))) > 0) {
-			read_len += rbytes;
-		}
-
-		/*
-		 * Execute ftruncate(2) again to truncate
-		 * testfile to a size TRUNC_LEN2.
-		 */
-		TEST(ftruncate(fd, TRUNC_LEN2));
-
-		/*
-		 * Get the testfile information using
-		 * fstat(2)
-		 */
-		if (fstat(fd, &stat_buf) < 0) {
-			tst_brkm(TFAIL, cleanup, "fstat(2) of %s failed"
-				 " after 2nd truncate, error:%d",
-				 TESTFILE, errno);
-		}
-		stat_buf.st_mode &= ~S_IFREG;
-		file_length2 = stat_buf.st_size;
-
-		/*
-		 * Set the file pointer of testfile to the
-		 * offset TRUNC_LEN1 of testfile.
-		 */
-		if (lseek(fd, TRUNC_LEN1, SEEK_SET) < 0) {
-			tst_brkm(TFAIL, cleanup, "lseek(2) on %s failed"
-				 " after 2nd ftruncate, error:%d",
-				 TESTFILE, errno);
-		}
-
-		/* Read the testfile contents till EOF */
-		while ((rbytes = read(fd, tst_buff,
-				      sizeof(tst_buff))) > 0) {
-			for (i = 0; i < rbytes; i++) {
-				if (tst_buff[i] != 0) {
-					err_flag++;
-				}
-			}
-		}
-
-		/*
-		 * Check for expected size of testfile after
-		 * issuing ftruncate(2) on it. If the ftruncate(2)
-		 * to a smaller file passed, then check to see
-		 * if file size was increased. If the ftruncate(2)
-		 * to a smaller file failed, then don't check.
-		 * Both results are allowed according to the SUS.
-		 */
-
-		if (TEST_RETURN != -1) {
-			if ((file_length1 != TRUNC_LEN1) ||
-			    (file_length2 != TRUNC_LEN2) ||
-			    (read_len != TRUNC_LEN1) ||
-			    (err_flag != 0)) {
-				tst_resm(TFAIL,
-					 "Functionality of ftruncate(2) "
-					 "on %s Failed", TESTFILE);
-			} else {
-				tst_resm(TPASS,
-					 "Functionality of ftruncate(2) "
-					 "on %s successful", TESTFILE);
-			}
-		}
-		if (TEST_RETURN == -1) {
-			if ((file_length1 != TRUNC_LEN1) ||
-			    (read_len != TRUNC_LEN1) ||
-			    (err_flag != 0)) {
-				tst_resm(TFAIL,
-					 "Functionality of ftruncate(2) "
-					 "on %s Failed", TESTFILE);
-			} else {
-				tst_resm(TPASS,
-					 "Functionality of ftruncate(2) "
-					 "on %s successful", TESTFILE);
-			}
-		}
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/*
- * void
- * setup() - performs all ONE TIME setup for this test.
- *  Create a temporary directory and change directory to it.
- *  Create a test file under temporary directory and write some
- *  data into it.
- */
-void setup(void)
-{
-	int i;
-	int wbytes;		/* bytes written to testfile */
-	int write_len = 0;	/* total no. of bytes written to testfile */
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	/* Fill the test buffer with the known data */
-	for (i = 0; i < BUF_SIZE; i++) {
-		tst_buff[i] = 'a';
-	}
-	/* open a file for reading/writing */
-	fd = SAFE_OPEN(cleanup, TESTFILE, O_RDWR | O_CREAT, FILE_MODE);
-
-	/* Write to the file 1k data from the buffer */
-	while (write_len < FILE_SIZE) {
-		if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) {
-			tst_brkm(TBROK, cleanup, "write(%s) failed", TESTFILE);
-		} else {
-			write_len += wbytes;
-		}
-	}
-}
-
-/*
- * void
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- *  Close the testfile.
- *  Remove the test directory and testfile created in the setup.
- */
-void cleanup(void)
-{
-
-	/* Close the testfile after writing data into it */
-	if (close(fd) == -1)
-		tst_brkm(TFAIL | TERRNO, NULL, "close(%s) failed", TESTFILE);
-
-	tst_rmdir();
-
-}
diff --git a/testcases/kernel/syscalls/ftruncate/ftruncate03.c b/testcases/kernel/syscalls/ftruncate/ftruncate03.c
index bb4dd1e..95c3304 100644
--- a/testcases/kernel/syscalls/ftruncate/ftruncate03.c
+++ b/testcases/kernel/syscalls/ftruncate/ftruncate03.c
@@ -1,188 +1,92 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
+ * Copyright (c) International Business Machines  Corp., 2002
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
  *
- *   Copyright (c) International Business Machines  Corp., 2002
- *
- *   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
+ * Jay Huie
+ * Robbie Williamson
  */
-
 /*
- * Test Name: ftruncate03
- *
  * Test Description:
  *  Verify that,
- *  1) ftruncate(2) returns -1 and sets errno to EINVAL if the specified
- *     socket is invalid.
- *  2) ftruncate(2) returns -1 and sets errno to EINVAL if the specified
- *     file descriptor has an attempt to write, when open for read only.
- *  3) ftruncate(2) returns -1 and sets errno to EBADF if the file descriptor
- *     of the specified file is not valid.
- *
- * Expected Result:
- *  ftruncate() should fail with return value -1 and set expected errno.
- *
- * HISTORY
- *      02/2002 Written by Jay Huie
- *	02/2002 Adapted for and included into the LTP by Robbie Williamson
- *
- * RESTRICTIONS:
- *  This test should be run by 'non-super-user' only.
- *
+ *  1)ftruncate() fails with EINVAL if the file is a socket.
+ *  2)ftruncate() fails with EINVAL if the file descriptor opens with O_RDONLY.
+ *  3)ftruncate() fails with EINVAL if the length is negative.
+ *  4)ftruncate() fails with EBADF if the file descriptor is invalid.
  */
 
-#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
-#include <inttypes.h>
-#include <sys/types.h>
 #include <sys/socket.h>
-#include <fcntl.h>
 
-#include "test.h"
+#include "tst_test.h"
 
-#define TESTFILE	"ftruncate03_tst_file"
+#define TESTFILE1	"testfile1"
+#define TESTFILE2	"testfile2"
 
-TCID_DEFINE(ftruncate03);
-int TST_TOTAL = 3;
+static int sock_fd, read_fd, fd;
+static int bad_fd = -1;
 
-int main(void)
+static struct tcase {
+	int *fd;
+	off_t length;
+	int exp_errno;
+} tcases[] = {
+	{&sock_fd, 4, EINVAL},
+	{&read_fd, 4, EINVAL},
+	{&fd, -1, EINVAL},
+	{&bad_fd, 4, EBADF},
+};
+
+static void verify_ftruncate(unsigned int n)
 {
-	int wjh_ret = -1, wjh_f = -1, count = 0;
-	//used for the 2nd test
-	//make str > trunc_size characters long
-	char str[] = "THIS IS JAYS TEST FILE DATA";
-	int trunc_size = 4;
-	int flag = O_RDONLY;
+	struct tcase *tc = &tcases[n];
 
-#ifdef DEBUG
-	printf("Starting test, possible errnos are; EBADF(%d) EINVAL(%d)\n",
-	       EBADF, EINVAL);
-	printf("\t\tENOENT(%d) EACCES(%d) EPERM(%d)\n\n", ENOENT, EACCES,
-	       EPERM);
-#endif
+	TEST(ftruncate(*tc->fd, tc->length));
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "ftruncate() succeeded unexpectedly and got %ld",
+			TST_RET);
+		return;
+	}
 
-	tst_tmpdir();
-
-//TEST1: ftruncate on a socket is not valid, should fail w/ EINVAL
-
-#ifdef DEBUG
-	printf("Starting test1\n");
-#endif
-	wjh_f = socket(PF_INET, SOCK_STREAM, 0);
-	wjh_ret = ftruncate(wjh_f, 1);
-#ifdef DEBUG
-	printf("DEBUG: fd: %d ret: %d errno(%d) %s\n",
-	       wjh_f, wjh_ret, errno, strerror(errno));
-#endif
-	if (wjh_ret == -1 && errno == EINVAL) {
-		tst_resm(TPASS, "Test Passed");
+	if (TST_ERR == tc->exp_errno) {
+		tst_res(TPASS | TTERRNO, "ftruncate() failed expectedly");
 	} else {
-		tst_resm(TFAIL,
-			 "ftruncate(socket)=%i (wanted -1), errno=%i (wanted EINVAL %i)",
-			 wjh_ret, errno, EINVAL);
+		tst_res(TFAIL | TTERRNO,
+			"ftruncate() failed unexpectedly, got %s, expected",
+			tst_strerrno(tc->exp_errno));
 	}
-	close(wjh_f);
-	errno = 0;
-	wjh_ret = 0;
-	wjh_f = -1;
-
-//TEST2: ftruncate on fd not open for writing should be EINVAL
-
-#ifdef DEBUG
-	printf("\nStarting test2\n");
-#endif
-	//create a file and fill it so we can truncate it in ReadOnly mode
-	//delete it first, ignore if it doesn't exist
-	unlink(TESTFILE);
-	errno = 0;
-	wjh_f = open(TESTFILE, O_RDWR | O_CREAT, 0644);
-	if (wjh_f == -1) {
-		tst_brkm(TFAIL | TERRNO, tst_rmdir, "open(%s) failed",
-			 TESTFILE);
-	}
-	while (count < strlen(str)) {
-		if ((count += write(wjh_f, str, strlen(str))) == -1) {
-			tst_resm(TFAIL | TERRNO, "write() failed");
-			close(wjh_f);
-			tst_rmdir();
-			tst_exit();
-		}
-	}
-	close(wjh_f);
-	errno = 0;
-
-//Uncomment below if you want it to succeed, O_RDWR => success
-// flag = O_RDWR;
-#ifdef DEBUG
-	if (flag == O_RDWR) {
-		printf("\tLooks like it should succeed!\n");
-	}
-#endif
-
-	wjh_f = open(TESTFILE, flag);
-	if (wjh_f == -1) {
-		tst_brkm(TFAIL | TERRNO, tst_rmdir, "open(%s) failed",
-			 TESTFILE);
-	}
-	wjh_ret = ftruncate(wjh_f, trunc_size);
-#ifdef DEBUG
-	printf("DEBUG: fd: %d ret: %d @ errno(%d) %s\n",
-	       wjh_f, wjh_ret, errno, strerror(errno));
-#endif
-	if ((flag == O_RDONLY) && (wjh_ret == -1) && (errno == EINVAL)) {
-		tst_resm(TPASS, "Test Passed");
-	} else if ((flag == O_RDWR)) {
-		if (wjh_ret == 0) {
-			tst_resm(TPASS, "Test Succeeded!");
-		} else {
-			tst_resm(TFAIL | TERRNO,
-				 "ftruncate(%s) should have succeeded, but didn't! ret="
-				 "%d (wanted 0)", TESTFILE, wjh_ret);
-		}
-	} else			//flag was O_RDONLY but return codes wrong
-	{
-		tst_resm(TFAIL,
-			 "ftruncate(rd_only_fd)=%i (wanted -1), errno=%i (wanted %i EINVAL)",
-			 wjh_ret, errno, EINVAL);
-	}
-	close(wjh_f);
-	errno = 0;
-	wjh_ret = 0;
-	wjh_f = -1;
-
-//TEST3: invalid socket descriptor should fail w/ EBADF
-
-#ifdef DEBUG
-	printf("\nStarting test3\n");
-#endif
-	wjh_f = -999999;	//should be a bad file descriptor
-	wjh_ret = ftruncate(wjh_f, trunc_size);
-#ifdef DEBUG
-	printf("DEBUG: fd: %d ret: %d @ errno(%d) %s\n",
-	       wjh_f, wjh_ret, errno, strerror(errno));
-#endif
-	if (wjh_ret != -1 || errno != EBADF) {
-		tst_resm(TFAIL | TERRNO,
-			 "ftruncate(invalid_fd)=%d (wanted -1 and EBADF)",
-			 wjh_ret);
-	} else {
-		tst_resm(TPASS, "Test Passed");
-	}
-
-	tst_rmdir();
-
-//Done Testing
-	tst_exit();
 }
+
+static void setup(void)
+{
+	sock_fd = SAFE_SOCKET(PF_INET, SOCK_STREAM, 0);
+
+	read_fd = SAFE_OPEN(TESTFILE1, O_RDONLY | O_CREAT, 0644);
+
+	fd = SAFE_OPEN(TESTFILE2, O_RDWR | O_CREAT, 0644);
+}
+
+static void cleanup(void)
+{
+	if (sock_fd > 0)
+		SAFE_CLOSE(sock_fd);
+
+	if (read_fd > 0)
+		SAFE_CLOSE(read_fd);
+
+	if (fd > 0)
+		SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_ftruncate,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/ftruncate/ftruncate04.c b/testcases/kernel/syscalls/ftruncate/ftruncate04.c
index a1080be..ad5c7bb 100644
--- a/testcases/kernel/syscalls/ftruncate/ftruncate04.c
+++ b/testcases/kernel/syscalls/ftruncate/ftruncate04.c
@@ -1,26 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+ /*
+  * Copyright (c) International Business Machines  Corp., 2002
+  * Copyright (c) 2015 Cyril Hrubis <chrubis@suse.cz>
+  * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+  *
+  * Robbie Williamson <robbiew@us.ibm.com>
+  * Roy Lee <roylee@andestech.com>
+  */
 /*
- * Copyright (c) International Business Machines  Corp., 2002
- * Copyright (c) 2015 Cyril Hrubis <chrubis@suse.cz>
+ * Test Description:
  *
- *  Robbie Williamson <robbiew@us.ibm.com>
- *  Roy Lee <roylee@andestech.com>
- *
- * 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
- */
-
-/*
  * Tests truncate and mandatory record locking.
  *
  * Parent creates a file, child locks a region and sleeps.
@@ -31,111 +20,44 @@
  * Parent wakes up child, child exits, lock is unlocked.
  *
  * Parent checks that ftruncate now works in all cases.
+ *
  */
 
-#include <signal.h>
-#include <fcntl.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <errno.h>
-#include <sys/wait.h>
-#include <inttypes.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/statvfs.h>
 
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
 #define RECLEN	100
-#define MOUNT_DIR "dir/"
-
-const char *TCID = "ftruncate04";
-int TST_TOTAL = 6;
+#define MNTPOINT	"mntpoint"
+#define TESTFILE	MNTPOINT"/testfile"
 
 static int len = 8 * 1024;
-static char filename[80];
-
-static int recstart;
-static int reclen;
-
-static const char *device;
-static const char *fs_type;
-static int mount_flag;
-
-static void dochild(void);
-static void doparent(void);
-static void setup(void);
-static void cleanup(void);
-
-int main(int ac, char **av)
-{
-	int lc, pid;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-#ifdef UCLINUX
-	maybe_run_child(&dochild, "sdd", filename, &recstart, &reclen);
-#endif
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		sprintf(filename, MOUNT_DIR"%s.%d.%d\n", TCID, getpid(), lc);
-
-		if (tst_fill_file(filename, 0, 1024, 8)) {
-			tst_brkm(TBROK, cleanup,
-			         "Failed to create test file '%s'", filename);
-		}
-
-		SAFE_CHMOD(cleanup, filename, 02666);
-
-		reclen = RECLEN;
-		/*
-		 * want at least RECLEN bytes BEFORE AND AFTER the
-		 * record lock.
-		 */
-		recstart = RECLEN + rand() % (len - 3 * RECLEN);
-
-		if ((pid = FORK_OR_VFORK()) < 0)
-			tst_brkm(TBROK | TERRNO, cleanup, "fork() failed");
-
-		if (pid == 0) {
-#ifdef UCLINUX
-			if (self_exec(av[0], "sdd", filename, recstart,
-			              reclen) < -1) {
-				tst_brkm(TBROK, cleanup, "self_exec() failed");
-			}
-#else
-			dochild();
-#endif
-		}
-
-		doparent();
-	}
-
-	cleanup();
-	tst_exit();
-}
+static int recstart, reclen;
 
 static void ftruncate_expect_fail(int fd, off_t offset, const char *msg)
 {
 	TEST(ftruncate(fd, offset));
 
-	if (TEST_RETURN == 0) {
-		tst_resm(TFAIL, "ftruncate() %s succeeded unexpectedly", msg);
+	if (TST_RET == 0) {
+		tst_res(TFAIL, "ftruncate() %s succeeded unexpectedly", msg);
 		return;
 	}
 
-	if (TEST_ERRNO != EAGAIN) {
-		tst_resm(TFAIL | TTERRNO,
-		         "ftruncate() %s failed unexpectedly, expected EAGAIN",
-			 msg);
+	if (TST_ERR != EAGAIN) {
+		tst_res(TFAIL | TTERRNO,
+			"ftruncate() %s failed unexpectedly, expected EAGAIN",
+			msg);
 		return;
 	}
 
-	tst_resm(TPASS, "ftruncate() %s failed with EAGAIN", msg);
+	tst_res(TPASS, "ftruncate() %s failed with EAGAIN", msg);
 }
 
 static void ftruncate_expect_success(int fd, off_t offset, const char *msg)
@@ -144,46 +66,44 @@
 
 	TEST(ftruncate(fd, offset));
 
-	if (TEST_RETURN != 0) {
-		tst_resm(TFAIL | TTERRNO,
-		         "ftruncate() %s failed unexpectedly", msg);
+	if (TST_RET != 0) {
+		tst_res(TFAIL | TTERRNO,
+			"ftruncate() %s failed unexpectedly", msg);
 		return;
 	}
 
-	SAFE_FSTAT(cleanup, fd, &sb);
+	SAFE_FSTAT(fd, &sb);
 
 	if (sb.st_size != offset) {
-		tst_resm(TFAIL,
-			 "ftruncate() to %li bytes succeded but fstat() reports size %li",
-			 (long)offset, (long)sb.st_size);
+		tst_res(TFAIL,
+			"ftruncate() to %li bytes succeded but fstat() reports size %li",
+			(long)offset, (long)sb.st_size);
 		return;
 	}
 
-	tst_resm(TPASS, "ftruncate() %s succeded", msg);
+	tst_res(TPASS, "ftruncate() %s succeded", msg);
 }
 
 static void doparent(void)
 {
 	int fd;
 
-	/* Wait for child lock */
-	TST_SAFE_CHECKPOINT_WAIT(cleanup, 0);
+	TST_CHECKPOINT_WAIT(0);
 
-	fd = SAFE_OPEN(cleanup, filename, O_RDWR | O_NONBLOCK);
+	fd = SAFE_OPEN(TESTFILE, O_RDWR | O_NONBLOCK);
 
 	ftruncate_expect_fail(fd, RECLEN, "offset before lock");
 	ftruncate_expect_fail(fd, recstart + RECLEN/2, "offset in lock");
 	ftruncate_expect_success(fd, recstart + RECLEN, "offset after lock");
 
-	/* wake child and wait for it to exit (to free record lock) */
-	TST_SAFE_CHECKPOINT_WAKE(cleanup, 0);
-	SAFE_WAIT(NULL, NULL);
+	TST_CHECKPOINT_WAKE(0);
+	SAFE_WAIT(NULL);
 
 	ftruncate_expect_success(fd, recstart + RECLEN/2, "offset in lock");
 	ftruncate_expect_success(fd, recstart, "offset before lock");
 	ftruncate_expect_success(fd, recstart + RECLEN, "offset after lock");
 
-	SAFE_CLOSE(NULL, fd);
+	SAFE_CLOSE(fd);
 }
 
 void dochild(void)
@@ -191,81 +111,68 @@
 	int fd;
 	struct flock flocks;
 
-#ifdef UCLINUX
-	TST_CHECKPOINT_INIT(NULL);
-#endif
+	fd = SAFE_OPEN(TESTFILE, O_RDWR);
 
-	fd = SAFE_OPEN(NULL, filename, O_RDWR);
-
-	tst_resm(TINFO, "Child locks file");
+	tst_res(TINFO, "Child locks file");
 
 	flocks.l_type = F_WRLCK;
 	flocks.l_whence = SEEK_CUR;
 	flocks.l_start = recstart;
 	flocks.l_len = reclen;
 
-	if (fcntl(fd, F_SETLKW, &flocks) < 0)
-		tst_brkm(TFAIL, NULL, "child fcntl failed");
+	SAFE_FCNTL(fd, F_SETLKW, &flocks);
 
-	TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0);
+	TST_CHECKPOINT_WAKE_AND_WAIT(0);
 
-	tst_resm(TINFO, "Child unlocks file");
+	tst_res(TINFO, "Child unlocks file");
 
-	tst_exit();
+	exit(0);
+}
+
+static void verify_ftruncate(void)
+{
+	int pid;
+
+	if (tst_fill_file(TESTFILE, 0, 1024, 8))
+		tst_brk(TBROK, "Failed to create test file");
+
+	SAFE_CHMOD(TESTFILE, 02666);
+
+	reclen = RECLEN;
+	recstart = RECLEN + rand() % (len - 3 * RECLEN);
+
+	pid = SAFE_FORK();
+
+	if (pid == 0)
+		dochild();
+
+	doparent();
 }
 
 static void setup(void)
 {
-	struct statvfs fs;
-
-	srand(getpid());
-
-	tst_tmpdir();
-
-	SAFE_MKDIR(tst_rmdir, MOUNT_DIR, 0777);
-
-	TST_CHECKPOINT_INIT(tst_rmdir);
-
-	if (statvfs(".", &fs) == -1)
-		tst_brkm(TFAIL | TERRNO, tst_rmdir, "statvfs failed");
-
-	if ((fs.f_flag & MS_MANDLOCK))
-		return;
-
-	tst_resm(TINFO, "TMPDIR does not support mandatory locks");
-
-	fs_type = tst_dev_fs_type();
-	device = tst_acquire_device(cleanup);
-
-	if (!device)
-		tst_brkm(TCONF, cleanup, "Failed to obtain block device");
-
-	/* the kernel returns EPERM when CONFIG_MANDATORY_FILE_LOCKING is not
-	 * supported - to avoid false negatives, mount the fs first without
-	 * flags and then remount it as MS_MANDLOCK */
-
-	tst_mkfs(cleanup, device, fs_type, NULL, NULL);
-	SAFE_MOUNT(cleanup, device, MOUNT_DIR, fs_type, 0, NULL);
-	mount_flag = 1;
-
-	if (mount(NULL, MOUNT_DIR, NULL, MS_REMOUNT|MS_MANDLOCK, NULL) == -1) {
+	 /*
+	  * Kernel returns EPERM when CONFIG_MANDATORY_FILE_LOCKING is not
+	  * supported - to avoid false negatives, mount the fs first without
+	  * flags and then remount it as MS_MANDLOCK
+	  */
+	if (mount(NULL, MNTPOINT, NULL, MS_REMOUNT|MS_MANDLOCK, NULL) == -1) {
 		if (errno == EPERM) {
-			tst_brkm(TCONF, cleanup, "Mandatory locking (likely) "
-				 "not supported by this system");
+			tst_brk(TCONF,
+				"Mandatory lock not supported by this system");
 		} else {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "Remount with MS_MANDLOCK failed");
+			tst_brk(TBROK | TTERRNO,
+				"Remount with MS_MANDLOCK failed");
 		}
 	}
 }
 
-static void cleanup(void)
-{
-	if (mount_flag && tst_umount(MOUNT_DIR))
-		tst_resm(TWARN | TERRNO, "umount(%s) failed", device);
-
-	if (device)
-		tst_release_device(device);
-
-	tst_rmdir();
-}
+static struct tst_test test = {
+	.test_all = verify_ftruncate,
+	.setup = setup,
+	.needs_checkpoints = 1,
+	.forks_child = 1,
+	.mount_device = 1,
+	.needs_root = 1,
+	.mntpoint = MNTPOINT,
+};
diff --git a/testcases/kernel/syscalls/futex/.gitignore b/testcases/kernel/syscalls/futex/.gitignore
index dbc2d52..68bc202 100644
--- a/testcases/kernel/syscalls/futex/.gitignore
+++ b/testcases/kernel/syscalls/futex/.gitignore
@@ -1,3 +1,5 @@
+/futex_cmp_requeue01
+/futex_cmp_requeue02
 /futex_wait01
 /futex_wait02
 /futex_wait03
diff --git a/testcases/kernel/syscalls/futex/Makefile b/testcases/kernel/syscalls/futex/Makefile
index 6e72daf..1a0c008 100644
--- a/testcases/kernel/syscalls/futex/Makefile
+++ b/testcases/kernel/syscalls/futex/Makefile
@@ -18,6 +18,8 @@
 
 top_srcdir		?= ../../../..
 
+futex_cmp_requeue01: LDLIBS+=-lrt
+futex_cmp_requeue02: LDLIBS+=-lrt
 futex_wait02: LDLIBS+=-lrt
 futex_wake03: LDLIBS+=-lrt
 futex_wait03: CFLAGS+=-pthread
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
new file mode 100644
index 0000000..a2e899b
--- /dev/null
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Xiao Yang <ice_yangxiao@163.com>
+ *
+ * Description:
+ * Testcase to check the basic functionality of futex(FUTEX_CMP_REQUEUE).
+ * futex(FUTEX_CMP_REQUEUE) can wake up the number of waiters specified
+ * by val argument and then requeue the number of waiters limited by val2
+ * argument(i.e. move some remaining waiters from uaddr to uaddr2 address).
+ */
+
+#include <errno.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <linux/futex.h>
+#include <sys/time.h>
+
+#include "tst_timer_test.h"
+#include "tst_test.h"
+#include "futextest.h"
+
+struct shared_data {
+	futex_t futexes[2];
+	int spurious;
+	int test_done;
+};
+
+static struct shared_data *sd;
+static int max_sleep_ms;
+
+static struct tcase {
+	int num_waiters;
+	int set_wakes;
+	int set_requeues;
+} tcases[] = {
+	{10, 3, 7},
+	{10, 0, 10},
+	{10, 2, 6},
+	{100, 50, 50},
+	{100, 0, 70},
+	{1000, 100, 900},
+	{1000, 300, 500},
+};
+
+static void do_child(void)
+{
+	int slept_for_ms = 0;
+	struct timespec usec = tst_ms_to_timespec(max_sleep_ms);
+	int pid = getpid();
+	int ret = 0;
+
+	if (futex_wait(&sd->futexes[0], sd->futexes[0], &usec, 0) == -1) {
+		if (errno == EAGAIN) {
+			/* spurious wakeup or signal */
+			tst_atomic_inc(&sd->spurious);
+		} else {
+			tst_res(TFAIL | TERRNO, "process %d wasn't woken up",
+				pid);
+			ret = 1;
+		}
+	}
+
+	/* make sure TST_PROCESS_STATE_WAIT() can always succeed */
+	while (!tst_atomic_load(&sd->test_done)
+		&& (slept_for_ms < max_sleep_ms)) {
+		usleep(50000);
+		slept_for_ms += 50;
+	}
+
+	exit(ret);
+}
+
+static void verify_futex_cmp_requeue(unsigned int n)
+{
+	int num_requeues = 0, num_waits = 0, num_total = 0;
+	int i, status, spurious, woken_up;
+	struct tcase *tc = &tcases[n];
+	int pid[tc->num_waiters];
+	int exp_ret = tc->set_wakes + tc->set_requeues;
+
+	tst_atomic_store(0, &sd->spurious);
+	tst_atomic_store(0, &sd->test_done);
+	for (i = 0; i < tc->num_waiters; i++) {
+		pid[i] = SAFE_FORK();
+		if (!pid[i])
+			do_child();
+	}
+
+	for (i = 0; i < tc->num_waiters; i++)
+		TST_PROCESS_STATE_WAIT(pid[i], 'S');
+
+	tst_res(TINFO, "Test %d: waiters: %d, wakes: %d, requeues: %d",
+		n, tc->num_waiters, tc->set_wakes, tc->set_requeues);
+
+	/*
+	 * change futex value, so any spurious wakeups or signals after
+	 * this point get bounced back to userspace.
+	 */
+	sd->futexes[0]++;
+	sd->futexes[1]++;
+
+	/*
+	 * Wakes up a maximum of tc->set_wakes waiters. tc->set_requeues
+	 * specifies an upper limit on the number of waiters that are requeued.
+	 * Returns the total number of waiters that were woken up or requeued.
+	 */
+	TEST(futex_cmp_requeue(&sd->futexes[0], sd->futexes[0], &sd->futexes[1],
+		tc->set_wakes, tc->set_requeues, 0));
+
+	/* Fail if more than requested wakes + requeues were returned */
+	if (TST_RET > exp_ret) {
+		tst_res(TFAIL, "futex_cmp_requeue() returned %ld, expected <= %d",
+			TST_RET, exp_ret);
+	} else {
+		tst_res(TINFO, "futex_cmp_requeue() returned %ld", TST_RET);
+	}
+
+	num_requeues = futex_wake(&sd->futexes[1], tc->num_waiters, 0);
+	num_waits = futex_wake(&sd->futexes[0], tc->num_waiters, 0);
+
+	tst_atomic_store(1, &sd->test_done);
+	for (i = 0; i < tc->num_waiters; i++) {
+		SAFE_WAITPID(pid[i], &status, 0);
+		if (WIFEXITED(status) && !WEXITSTATUS(status))
+			num_total++;
+	}
+
+	spurious = tst_atomic_load(&sd->spurious);
+	tst_res(TINFO, "children woken, futex0: %d, futex1: %d, "
+		"spurious wakeups: %d",
+		num_waits, num_requeues, spurious);
+
+	/* Fail if any waiter timed out */
+	if (num_total != tc->num_waiters) {
+		tst_res(TFAIL, "%d waiters were not woken up normally",
+			tc->num_waiters - num_total);
+		return;
+	}
+
+	/*
+	 * num_requeues should be in range:
+	 *     (tc->set_requeues - spurious, tc->set_requeues)
+	 *
+	 * Fewer processes than requested can be requeued at futex1
+	 * if some woke up spuriously. Finding more processes than
+	 * requested at futex1 is always a failure.
+	 */
+	if ((num_requeues < tc->set_requeues - spurious)
+		|| (num_requeues > tc->set_requeues)) {
+		tst_res(TFAIL,
+			"requeued %d waiters, expected range: (%d, %d)",
+			num_requeues, tc->set_requeues - spurious,
+			tc->set_requeues);
+		return;
+	}
+
+	/*
+	 * woken_up = (TST_RET - num_requeues) should be in range:
+	 *     (tc->set_wakes - spurious, tc->set_wakes + spurious)
+	 *
+	 * Fewer processes than requested can be woken up, if some of
+	 * them woke up spuriously before requeue. More processes than
+	 * requested may appear to be woken up, if some woke up
+	 * spuriously after requeue.
+	 */
+	woken_up = TST_RET - num_requeues;
+	if ((woken_up < tc->set_wakes - spurious)
+		|| (woken_up > tc->set_wakes + spurious)) {
+		tst_res(TFAIL,
+			"woken up %d, expected range (%d, %d)",
+			woken_up, tc->set_wakes - spurious,
+			tc->set_wakes + spurious);
+		return;
+	}
+
+	tst_res(TPASS, "futex_cmp_requeue()");
+}
+
+static void setup(void)
+{
+	max_sleep_ms = tst_multiply_timeout(5000);
+
+	sd = SAFE_MMAP(NULL, sizeof(*sd), PROT_READ | PROT_WRITE,
+			    MAP_ANONYMOUS | MAP_SHARED, -1, 0);
+
+	sd->futexes[0] = FUTEX_INITIALIZER;
+	sd->futexes[1] = FUTEX_INITIALIZER + 1000;
+}
+
+static void cleanup(void)
+{
+	if (sd)
+		SAFE_MUNMAP((void *)sd, sizeof(*sd));
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_futex_cmp_requeue,
+	.forks_child = 1,
+};
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
new file mode 100644
index 0000000..228d8cf
--- /dev/null
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Xiao Yang <ice_yangxiao@163.com>
+ *
+ * Description:
+ * Check various errnos for futex(FUTEX_CMP_REQUEUE).
+ * 1) futex(FUTEX_CMP_REQUEUE) with invalid val returns EINVAL.
+ * 2) futex(FUTEX_CMP_REQUEUE) with invalid val2 returns EINVAL.
+ * 3) futex(FUTEX_CMP_REQUEUE) with mismatched val3 returns EAGAIN.
+ *
+ * It's also a regression test for CVE-2018-6927:
+ * fbe0e839d1e2 ("futex: Prevent overflow by strengthen input validation")
+ */
+
+#include <errno.h>
+#include <linux/futex.h>
+#include <sys/time.h>
+
+#include "tst_test.h"
+#include "futextest.h"
+
+static futex_t *futexes;
+
+static struct tcase {
+	int set_wakes;
+	int set_requeues;
+	int exp_val;
+	int exp_errno;
+} tcases[] = {
+	{1, -1, FUTEX_INITIALIZER, EINVAL},
+	{-1, 1, FUTEX_INITIALIZER, EINVAL},
+	{1, 1, FUTEX_INITIALIZER + 1, EAGAIN},
+};
+
+static void verify_futex_cmp_requeue(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+
+	TEST(futex_cmp_requeue(&futexes[0], tc->exp_val, &futexes[1],
+	     tc->set_wakes, tc->set_requeues, 0));
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "futex_cmp_requeue() succeeded unexpectedly");
+		return;
+	}
+
+	if (TST_ERR != tc->exp_errno) {
+		tst_res(TFAIL | TTERRNO,
+			"futex_cmp_requeue() failed unexpectedly, expected %s",
+			tst_strerrno(tc->exp_errno));
+		return;
+	}
+
+	tst_res(TPASS | TTERRNO, "futex_cmp_requeue() failed as expected");
+}
+
+static void setup(void)
+{
+	futexes = SAFE_MMAP(NULL, sizeof(futex_t) * 2, PROT_READ | PROT_WRITE,
+			    MAP_ANONYMOUS | MAP_SHARED, -1, 0);
+
+	futexes[0] = FUTEX_INITIALIZER;
+	futexes[1] = FUTEX_INITIALIZER + 1;
+}
+
+static void cleanup(void)
+{
+	if (futexes)
+		SAFE_MUNMAP((void *)futexes, sizeof(futex_t) * 2);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_futex_cmp_requeue,
+	.tcnt = ARRAY_SIZE(tcases),
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2018-6927"},
+		{"linux-git", "fbe0e839d1e2"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/futex/futex_common.h b/testcases/kernel/syscalls/futex/futex_common.h
deleted file mode 100644
index 231fdc6..0000000
--- a/testcases/kernel/syscalls/futex/futex_common.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
- *
- * Licensed under the GNU GPLv2 or later.
- * 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
- */
-
- /*
-  * Setups futex in shared memory needed for synchronization between multiple
-  * processes.
-  */
-
-static futex_t *futex;
-
-static void setup(void)
-{
-	int fd;
-
-	fd = shm_open("/LTP_futex_wait", O_RDWR | O_CREAT | O_EXCL, 0);
-
-	if (fd < 0) {
-		tst_brkm(TBROK | TERRNO, NULL,
-		         "shm_open(/LTP_futex_wait,O_RDWR|O_CREAT|O_EXCL,775)");
-	}
-	if (shm_unlink("/LTP_futex_wait"))
-		tst_brkm(TBROK | TERRNO, NULL, "shm_unlink(/LTP_futex_wait)");
-
-	futex = SAFE_MMAP(NULL, NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
-			  MAP_ANONYMOUS | MAP_SHARED, fd, 0);
-
-	SAFE_CLOSE(NULL, fd);
-
-	*futex = FUTEX_INITIALIZER;
-}
diff --git a/testcases/kernel/syscalls/futex/futex_wait02.c b/testcases/kernel/syscalls/futex/futex_wait02.c
index 2b863fe..1ca1df4 100644
--- a/testcases/kernel/syscalls/futex/futex_wait02.c
+++ b/testcases/kernel/syscalls/futex/futex_wait02.c
@@ -29,11 +29,12 @@
 #include "test.h"
 #include "safe_macros.h"
 #include "futextest.h"
-#include "futex_common.h"
 
 const char *TCID="futex_wait02";
 const int TST_TOTAL=1;
 
+static futex_t *futex;
+
 static void do_child(void)
 {
 	int ret;
@@ -81,6 +82,14 @@
 		tst_resm(TFAIL, "child failed");
 }
 
+static void setup(void)
+{
+	futex = SAFE_MMAP(NULL, NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
+			  MAP_ANONYMOUS | MAP_SHARED, -1, 0);
+
+	*futex = FUTEX_INITIALIZER;
+}
+
 int main(int argc, char *argv[])
 {
 	int lc;
diff --git a/testcases/kernel/syscalls/futex/futex_wake03.c b/testcases/kernel/syscalls/futex/futex_wake03.c
index 523f328..d6e5e54 100644
--- a/testcases/kernel/syscalls/futex/futex_wake03.c
+++ b/testcases/kernel/syscalls/futex/futex_wake03.c
@@ -27,11 +27,12 @@
 #include "test.h"
 #include "safe_macros.h"
 #include "futextest.h"
-#include "futex_common.h"
 
 const char *TCID="futex_wake03";
 const int TST_TOTAL=11;
 
+static futex_t *futex;
+
 static void do_child(void)
 {
 	futex_wait(futex, *futex, NULL, 0);
@@ -103,6 +104,14 @@
 	}
 }
 
+static void setup(void)
+{
+	futex = SAFE_MMAP(NULL, NULL, sizeof(*futex), PROT_READ | PROT_WRITE,
+			  MAP_ANONYMOUS | MAP_SHARED, -1, 0);
+
+	*futex = FUTEX_INITIALIZER;
+}
+
 int main(int argc, char *argv[])
 {
 	int lc;
diff --git a/testcases/kernel/syscalls/getcwd/getcwd01.c b/testcases/kernel/syscalls/getcwd/getcwd01.c
index c1d8cb9..65d8278 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd01.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getcwd/getcwd02.c b/testcases/kernel/syscalls/getcwd/getcwd02.c
index 1a2d308..e843a48 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd02.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getcwd/getcwd03.c b/testcases/kernel/syscalls/getcwd/getcwd03.c
index 2711a2d..97f4f3a 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd03.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getcwd/getcwd04.c b/testcases/kernel/syscalls/getcwd/getcwd04.c
index ba8c358..2fa65fb 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd04.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd04.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getdents/getdents.h b/testcases/kernel/syscalls/getdents/getdents.h
index 702b0bd..a20b181 100644
--- a/testcases/kernel/syscalls/getdents/getdents.h
+++ b/testcases/kernel/syscalls/getdents/getdents.h
@@ -23,7 +23,7 @@
 #include <stdint.h>
 #include "test.h"
 #include "lapi/syscalls.h"
-
+#include "config.h"
 /*
  * See fs/compat.c struct compat_linux_dirent
  */
@@ -34,12 +34,17 @@
 	char            d_name[];
 };
 
+#if HAVE_GETDENTS
+#include <unistd.h>
+#else
 static inline int
 getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
 {
 	return ltp_syscall(__NR_getdents, fd, dirp, size);
 }
 
+#endif /* HAVE_GETDENTS */
+
 struct linux_dirent64 {
 	uint64_t	d_ino;
 	int64_t		d_off;
@@ -48,10 +53,14 @@
 	char		d_name[];
 };
 
+#if HAVE_GETDENTS64
+#include <dirent.h>
+#include <unistd.h>
+#else
 static inline int
 getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
 {
 	return ltp_syscall(__NR_getdents64, fd, dirp64, size);
 }
-
+#endif /* HAVE_GETDENTS64 */
 #endif /* GETDENTS_H */
diff --git a/testcases/kernel/syscalls/getdents/getdents01.c b/testcases/kernel/syscalls/getdents/getdents01.c
index 3962d96..eca572d 100644
--- a/testcases/kernel/syscalls/getdents/getdents01.c
+++ b/testcases/kernel/syscalls/getdents/getdents01.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/getpriority/getpriority01.c b/testcases/kernel/syscalls/getpriority/getpriority01.c
index c7cccbc..422df17 100644
--- a/testcases/kernel/syscalls/getpriority/getpriority01.c
+++ b/testcases/kernel/syscalls/getpriority/getpriority01.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  *  11/2016 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getpriority/getpriority02.c b/testcases/kernel/syscalls/getpriority/getpriority02.c
index b771780..6b161dc 100644
--- a/testcases/kernel/syscalls/getpriority/getpriority02.c
+++ b/testcases/kernel/syscalls/getpriority/getpriority02.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  *  11/2016 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getrandom/getrandom01.c b/testcases/kernel/syscalls/getrandom/getrandom01.c
index d449fbd..ccbd286 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom01.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom01.c
@@ -1,29 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (C) 2015 Cedric Hnyda ced.hnyda@gmail.com
+ * Copyright (C) 2015 Cedric Hnyda <ced.hnyda@gmail.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- */
-
-/*
- * AUTHOR   : Cédric Hnyda
- * DATE STARTED : 06/13/2015
- *
- *  Calls getrandom(2) with a NULL buffer and expects failure.
- *
+ * Calls getrandom(2) with a NULL buffer and expects failure.
  */
 
 #include "lapi/getrandom.h"
diff --git a/testcases/kernel/syscalls/getrandom/getrandom02.c b/testcases/kernel/syscalls/getrandom/getrandom02.c
index e7d03e7..ee0193d 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom02.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom02.c
@@ -1,30 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (C) 2015 Cedric Hnyda ced.hnyda@gmail.com
+ * Copyright (C) 2015 Cedric Hnyda <ced.hnyda@gmail.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- */
-
-/*
- * AUTHOR   : Cédric Hnyda
- * DATE STARTED : 06/13/2015
- *
- *  Calls getrandom(2), checks that the buffer is filled with random bytes
- *  and expects success.
- *
+ * Calls getrandom(2), checks that the buffer is filled with random bytes
+ * and expects success.
  */
 
 #include "lapi/getrandom.h"
diff --git a/testcases/kernel/syscalls/getrandom/getrandom03.c b/testcases/kernel/syscalls/getrandom/getrandom03.c
index d7081fe..705f9b2 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom03.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom03.c
@@ -1,33 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (C) 2015 Cedric Hnyda ced.hnyda@gmail.com
+ * Copyright (C) 2015 Cedric Hnyda <ced.hnyda@gmail.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-/*
- * AUTHOR	: Cédric Hnyda
- * DATE STARTED	: 06/13/2015
- *
- *  Calls getrandom(2), check that the return value is equal to the
- *  number of bytes required and expects success.
+ * Calls getrandom(2), check that the return value is equal to the
+ * number of bytes required and expects success.
  */
 
 #include "lapi/getrandom.h"
diff --git a/testcases/kernel/syscalls/getrandom/getrandom04.c b/testcases/kernel/syscalls/getrandom/getrandom04.c
index 26df423..465e353 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom04.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom04.c
@@ -1,33 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (C) 2015 Cedric Hnyda ced.hnyda@gmail.com
+ * Copyright (C) 2015 Cedric Hnyda <ced.hnyda@gmail.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-/*
- * AUTHOR   : Cédric Hnyda
- * DATE STARTED : 06/13/2015
- *
- *  Calls getrandom(2) after having limited the number of available file
- *  descriptors to 3 and expects success.
+ * Calls getrandom(2) after having limited the number of available file
+ * descriptors to 3 and expects success.
  */
 
 #include <sys/resource.h>
diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
index e4d56c4..319bc49 100644
--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
@@ -26,6 +26,7 @@
 
 #include "tst_test.h"
 #include "lapi/syscalls.h"
+#include "lapi/abisize.h"
 
 /**
  * Linux provides an "old" getrlimit syscall handler that uses signed long,
@@ -61,7 +62,12 @@
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+
+#if defined(__mips__) && defined(TST_ABI32)
+	const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
+	const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
 
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
diff --git a/testcases/kernel/syscalls/getsockopt/getsockopt02.c b/testcases/kernel/syscalls/getsockopt/getsockopt02.c
index edf9dd8..47aef32 100644
--- a/testcases/kernel/syscalls/getsockopt/getsockopt02.c
+++ b/testcases/kernel/syscalls/getsockopt/getsockopt02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Red Hat, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
index 8c221a2..1d60f44 100644
--- a/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
+++ b/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2002 Andi Kleen
  * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/getxattr/getxattr01.c b/testcases/kernel/syscalls/getxattr/getxattr01.c
index be410a5..54ca653 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr01.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr01.c
@@ -121,7 +121,14 @@
 			}
 		}
 
-		if (strcmp(tc[i - 1].value, XATTR_TEST_VALUE))
+		if (TEST_RETURN != XATTR_TEST_VALUE_SIZE) {
+			tst_resm(TFAIL,
+				 "getxattr() returned wrong size %ld expected %d",
+				 TEST_RETURN, XATTR_TEST_VALUE_SIZE);
+			continue;
+		}
+
+		if (memcmp(tc[i - 1].value, XATTR_TEST_VALUE, XATTR_TEST_VALUE_SIZE))
 			tst_resm(TFAIL, "Wrong value, expect \"%s\" got \"%s\"",
 				 XATTR_TEST_VALUE, tc[i - 1].value);
 		else
diff --git a/testcases/kernel/syscalls/getxattr/getxattr04.c b/testcases/kernel/syscalls/getxattr/getxattr04.c
index 1dcb14d..e64f2a1 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr04.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr04.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.*
  */
 
 /*
@@ -118,14 +106,17 @@
 }
 
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.mount_device = 1,
 	.dev_fs_type = "xfs",
 	.mntpoint = MNTPOINT,
 	.forks_child = 1,
 	.test_all = verify_getxattr,
-	.setup = setup
+	.setup = setup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "5a93790d4e2d"},
+		{}
+	}
 };
 
 #else /* HAVE_SYS_XATTR_H */
diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
index 31b985e..c0d339f 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr05.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
@@ -37,11 +37,13 @@
 #if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LIBACL)
 
 #define TEST_FILE	"testfile"
+#define SELF_USERNS	"/proc/self/ns/user"
 #define MAX_USERNS	"/proc/sys/user/max_user_namespaces"
 #define UID_MAP	"/proc/self/uid_map"
 
 static acl_t acl;
 static int orig_max_userns = -1;
+static int user_ns_supported = 1;
 
 static struct tcase {
 	/* 0: without userns, 1: with userns */
@@ -110,6 +112,11 @@
 	struct tcase *tc = &tcases[n];
 	pid_t pid;
 
+	if (tc->set_userns && !user_ns_supported) {
+		tst_res(TCONF, "user namespace not available");
+		return;
+	}
+
 	pid = SAFE_FORK();
 	if (!pid) {
 		if (tc->set_userns)
@@ -144,10 +151,13 @@
 	/* The default value of max_user_namespaces is set to 0 on some distros,
 	 * We need to change the default value to call unshare().
 	 */
-	if (!access(MAX_USERNS, F_OK)) {
+	if (access(SELF_USERNS, F_OK) != 0) {
+		user_ns_supported = 0;
+	} else if (!access(MAX_USERNS, F_OK)) {
 		SAFE_FILE_SCANF(MAX_USERNS, "%d", &orig_max_userns);
 		SAFE_FILE_PRINTF(MAX_USERNS, "%d", 10);
 	}
+
 }
 
 static void cleanup(void)
diff --git a/testcases/kernel/syscalls/inotify/inotify.h b/testcases/kernel/syscalls/inotify/inotify.h
index 0298ca7..dbf8149 100644
--- a/testcases/kernel/syscalls/inotify/inotify.h
+++ b/testcases/kernel/syscalls/inotify/inotify.h
@@ -1,27 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * inotify testcase common definitions.
  *
- * Copyright (c) 2012 Linux Test Project.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Copyright (c) 2012-2019 Linux Test Project.  All Rights Reserved.
  * Ngie Cooper, April 2012
  */
 
@@ -33,20 +14,54 @@
 /* inotify(7) wrappers */
 
 #if __NR_inotify_init != __LTP__NR_INVALID_SYSCALL
-#define	myinotify_init() \
+#define myinotify_init() \
 	tst_syscall(__NR_inotify_init)
 #else
-#define	myinotify_init() \
+#define myinotify_init() \
 	tst_syscall(__NR_inotify_init1, 0)
 #endif
 
 #define myinotify_init1(flags) \
 	tst_syscall(__NR_inotify_init1, flags)
 
-#define	myinotify_add_watch(fd, pathname, mask)	\
+#define myinotify_add_watch(fd, pathname, mask)	\
 	tst_syscall(__NR_inotify_add_watch, fd, pathname, mask)
 
-#define	myinotify_rm_watch(fd, wd) \
+#define myinotify_rm_watch(fd, wd) \
 	tst_syscall(__NR_inotify_rm_watch, fd, wd)
 
+static inline int safe_myinotify_init(const char *file, const int lineno, int fd)
+{
+	if (fd < 0) {
+		if (errno == ENOSYS) {
+			tst_brk(TCONF,
+				"%s:%d: inotify is not configured in this kernel",
+				file, lineno);
+		} else {
+			tst_brk(TBROK | TERRNO, "%s:%d: inotify_init failed",
+				file, lineno);
+		}
+	}
+	return fd;
+}
+
+#define SAFE_MYINOTIFY_INIT() \
+	safe_myinotify_init(__FILE__, __LINE__, myinotify_init())
+
+#define SAFE_MYINOTIFY_INIT1(flags) \
+	safe_myinotify_init(__FILE__, __LINE__, myinotify_init1(flags))
+
+static inline int safe_myinotify_watch(const char *file, const int lineno, int wd, int fd, const char* fname, const char* mask)
+{
+	if (wd < 0) {
+		tst_brk(TBROK | TERRNO,
+			"%s:%d: inotify_add_watch (%d, %s, %s) failed",
+			file, lineno, fd, fname, mask);
+	}
+	return wd;
+}
+
+#define SAFE_MYINOTIFY_ADD_WATCH(fd, pathname, mask)	\
+	safe_myinotify_watch(__FILE__, __LINE__, myinotify_add_watch(fd, pathname, mask), fd, pathname, #mask)
+
 #endif /* _INOTIFY_H */
diff --git a/testcases/kernel/syscalls/inotify/inotify01.c b/testcases/kernel/syscalls/inotify/inotify01.c
index f0cf512..8f1547d 100644
--- a/testcases/kernel/syscalls/inotify/inotify01.c
+++ b/testcases/kernel/syscalls/inotify/inotify01.c
@@ -1,26 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2007 SWSoft.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Started by Andrew Vagin <avagin@sw.ru>
+ * Author: Andrew Vagin <avagin@sw.ru>
  *
  * DESCRIPTION
  *     Check that inotify work for a file
@@ -167,23 +148,10 @@
 
 	SAFE_FILE_PRINTF(fname, "%s", fname);
 
-	if ((fd_notify = myinotify_init()) < 0) {
-		if (errno == ENOSYS) {
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"inotify_init failed");
-		}
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT();
 
-	if ((wd = myinotify_add_watch(fd_notify, fname, IN_ALL_EVENTS)) < 0) {
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch (%d, %s, IN_ALL_EVENTS) failed",
-			fd_notify, fname);
-		reap_wd = 1;
-	};
-
+	wd = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, fname, IN_ALL_EVENTS);
+	reap_wd = 1;
 }
 
 static void cleanup(void)
diff --git a/testcases/kernel/syscalls/inotify/inotify02.c b/testcases/kernel/syscalls/inotify/inotify02.c
index 02eb857..32855e0 100644
--- a/testcases/kernel/syscalls/inotify/inotify02.c
+++ b/testcases/kernel/syscalls/inotify/inotify02.c
@@ -1,26 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2007 SWSoft.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Started by Andrew Vagin <avagin@sw.ru>
+ * Author: Andrew Vagin <avagin@sw.ru>
  *
  * DESCRIPTION
  *     Check that inotify work for a directory
@@ -234,22 +215,10 @@
 
 static void setup(void)
 {
-	if ((fd_notify = myinotify_init()) < 0) {
-		if (errno == ENOSYS) {
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"inotify_init () failed");
-		}
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT();
 
-	if ((wd = myinotify_add_watch(fd_notify, ".", IN_ALL_EVENTS)) < 0) {
-		tst_brk(TBROK | TERRNO,
-			 "inotify_add_watch (%d, \".\", IN_ALL_EVENTS) failed",
-			 fd_notify);
-		reap_wd = 1;
-	};
+	wd = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, ".", IN_ALL_EVENTS);
+	reap_wd = 1;
 }
 
 static void cleanup(void)
@@ -257,7 +226,6 @@
 	if (reap_wd && myinotify_rm_watch(fd_notify, wd) < 0) {
 		tst_res(TWARN,
 			"inotify_rm_watch (%d, %d) failed,", fd_notify, wd);
-
 	}
 
 	if (fd_notify > 0)
diff --git a/testcases/kernel/syscalls/inotify/inotify03.c b/testcases/kernel/syscalls/inotify/inotify03.c
index ff74199..01a1155 100644
--- a/testcases/kernel/syscalls/inotify/inotify03.c
+++ b/testcases/kernel/syscalls/inotify/inotify03.c
@@ -1,26 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2008 Parallels.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Started by Andrew Vagin <avagin@gmail.com>
+ * Author: Andrew Vagin <avagin@gmail.com>
  *
  * DESCRIPTION
  *	Check that inotify get IN_UNMOUNT event and
@@ -28,8 +9,8 @@
  *
  * ALGORITHM
  *	Execute sequence file's operation and check return events
- *
  */
+
 #include "config.h"
 
 #include <stdio.h>
@@ -77,12 +58,7 @@
 	SAFE_MOUNT(tst_device->dev, mntpoint, tst_device->fs_type, 0, NULL);
 	mount_flag = 1;
 
-	wd = myinotify_add_watch(fd_notify, fname, IN_ALL_EVENTS);
-	if (wd < 0) {
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch (%d, %s, IN_ALL_EVENTS) failed.",
-			fd_notify, fname);
-	}
+	wd = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, fname, IN_ALL_EVENTS);
 
 	event_set[test_cnt] = IN_UNMOUNT;
 	test_cnt++;
@@ -171,15 +147,7 @@
 	/* close the file we have open */
 	SAFE_CLOSE(fd);
 
-	fd_notify = myinotify_init();
-	if (fd_notify < 0) {
-		if (errno == ENOSYS)
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		else
-			tst_brk(TBROK | TERRNO,
-				"inotify_init failed");
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT();
 
 	tst_umount(mntpoint);
 	mount_flag = 0;
@@ -200,7 +168,6 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
diff --git a/testcases/kernel/syscalls/inotify/inotify04.c b/testcases/kernel/syscalls/inotify/inotify04.c
index 36673d6..fb9f5c2 100644
--- a/testcases/kernel/syscalls/inotify/inotify04.c
+++ b/testcases/kernel/syscalls/inotify/inotify04.c
@@ -1,29 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2012 Linux Test Project.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  * Ngie Cooper, April 2012
- */
-
-/****************************************************************************
+ *
  * DESCRIPTION
  *     verify that IN_DELETE_SELF functions as expected
  *
@@ -34,8 +13,7 @@
  *
  *     Because of how the inotify(7) API is designed, we also need to catch the
  *     IN_ATTRIB and IN_IGNORED events.
- *
- ****************************************************************************/
+ */
 
 #include "config.h"
 
@@ -95,16 +73,7 @@
 
 static void setup(void)
 {
-	fd_notify = myinotify_init();
-	if (fd_notify == -1) {
-		if (errno == ENOSYS) {
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"inotify_init failed");
-		}
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT();
 }
 
 void verify_inotify(void)
@@ -115,19 +84,10 @@
 	SAFE_MKDIR(TEST_DIR, 00700);
 	close(SAFE_CREAT(TEST_FILE, 00600));
 
-	wd_dir = myinotify_add_watch(fd_notify, TEST_DIR, IN_ALL_EVENTS);
-	if (wd_dir == -1) {
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch(%d, \"%s\", IN_ALL_EVENTS) [1] failed",
-			fd_notify, TEST_DIR);
-	}
+	wd_dir = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, TEST_DIR, IN_ALL_EVENTS);
 	reap_wd_dir = 1;
 
-	wd_file = myinotify_add_watch(fd_notify, TEST_FILE, IN_ALL_EVENTS);
-	if (wd_file == -1)
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch(%d, \"%s\", IN_ALL_EVENTS) [2] failed",
-			fd_notify, TEST_FILE);
+	wd_file = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, TEST_FILE, IN_ALL_EVENTS);
 	reap_wd_file = 1;
 
 	SAFE_RMDIR(TEST_DIR);
diff --git a/testcases/kernel/syscalls/inotify/inotify05.c b/testcases/kernel/syscalls/inotify/inotify05.c
index 2d8897e..15dc5b5 100644
--- a/testcases/kernel/syscalls/inotify/inotify05.c
+++ b/testcases/kernel/syscalls/inotify/inotify05.c
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 SUSE Linux.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * Started by Jan Kara <jack@suse.cz>
+ * Author: Jan Kara <jack@suse.cz>
  *
  * DESCRIPTION
  *     Check that inotify overflow event is properly generated
@@ -143,23 +128,9 @@
 	SAFE_WRITE(1, fd, buf, BUF_SIZE);
 	SAFE_CLOSE(fd);
 
-	fd_notify = myinotify_init1(O_NONBLOCK);
-	if (fd_notify < 0) {
-		if (errno == ENOSYS) {
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"inotify_init failed");
-		}
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT1(O_NONBLOCK);
 
-	wd = myinotify_add_watch(fd_notify, fname, IN_ALL_EVENTS);
-	if (wd < 0) {
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch (%d, %s, IN_ALL_EVENTS) failed",
-			fd_notify, fname);
-	};
+	wd = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, fname, IN_ALL_EVENTS);
 
 	SAFE_FILE_SCANF("/proc/sys/fs/inotify/max_queued_events",
 			"%d", &max_events);
@@ -170,7 +141,6 @@
 	if (fd_notify > 0 && myinotify_rm_watch(fd_notify, wd) == -1) {
 		tst_res(TWARN | TERRNO, "inotify_rm_watch (%d, %d) failed",
 			fd_notify, wd);
-
 	}
 
 	if (fd_notify > 0)
diff --git a/testcases/kernel/syscalls/inotify/inotify06.c b/testcases/kernel/syscalls/inotify/inotify06.c
index 4475f5e..96189b0 100644
--- a/testcases/kernel/syscalls/inotify/inotify06.c
+++ b/testcases/kernel/syscalls/inotify/inotify06.c
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 SUSE Linux.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * Started by Jan Kara <jack@suse.cz>
+ * Author: Jan Kara <jack@suse.cz>
  *
  * DESCRIPTION
  * Test for inotify mark destruction race.
@@ -82,9 +67,7 @@
 	}
 
 	for (tests = 0; tests < TEARDOWNS; tests++) {
-		inotify_fd = myinotify_init1(O_NONBLOCK);
-		if (inotify_fd < 0)
-			tst_brk(TBROK | TERRNO, "inotify_init failed");
+		inotify_fd = SAFE_MYINOTIFY_INIT1(O_NONBLOCK);
 
 		for (i = 0; i < FILES; i++) {
 			/*
diff --git a/testcases/kernel/syscalls/inotify/inotify07.c b/testcases/kernel/syscalls/inotify/inotify07.c
index 96370b5..a496489 100644
--- a/testcases/kernel/syscalls/inotify/inotify07.c
+++ b/testcases/kernel/syscalls/inotify/inotify07.c
@@ -1,26 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 CTERA Networks.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 or any later of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Started by Amir Goldstein <amir73il@gmail.com>
+ * Author: Amir Goldstein <amir73il@gmail.com>
  *
  * DESCRIPTION
  *     Check that inotify work for an overlayfs directory after copy up and
@@ -73,16 +54,13 @@
 	unsigned int mask;
 };
 
-#define OVL_MNT "ovl"
 #define DIR_NAME "test_dir"
 #define DIR_PATH OVL_MNT"/"DIR_NAME
 #define FILE_NAME "test_file"
 #define FILE_PATH OVL_MNT"/"DIR_NAME"/"FILE_NAME
 
-static int ovl_mounted;
-
+static const char mntpoint[] = OVL_BASE_MNTPOINT;
 static struct event_t event_set[EVENT_MAX];
-
 static char event_buf[EVENT_BUF_LEN];
 
 void verify_inotify(void)
@@ -161,46 +139,18 @@
 static void setup(void)
 {
 	struct stat buf;
-	int ret;
 
 	/* Setup an overlay mount with lower dir and file */
-	SAFE_MKDIR("lower", 0755);
-	SAFE_MKDIR("lower/"DIR_NAME, 0755);
-	SAFE_TOUCH("lower/"DIR_NAME"/"FILE_NAME, 0644, NULL);
-	SAFE_MKDIR("upper", 0755);
-	SAFE_MKDIR("work", 0755);
-	SAFE_MKDIR(OVL_MNT, 0755);
-	ret = mount("overlay", OVL_MNT, "overlay", 0,
-		    "lowerdir=lower,upperdir=upper,workdir=work");
-	if (ret < 0) {
-		if (errno == ENODEV) {
-			tst_brk(TCONF,
-				"overlayfs is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"overlayfs mount failed");
-		}
-	}
-	ovl_mounted = 1;
+	SAFE_UMOUNT(OVL_MNT);
+	SAFE_MKDIR(OVL_LOWER"/"DIR_NAME, 0755);
+	SAFE_TOUCH(OVL_LOWER"/"DIR_NAME"/"FILE_NAME, 0644, NULL);
+	SAFE_MOUNT_OVERLAY();
 
-	fd_notify = myinotify_init1(O_NONBLOCK);
-	if (fd_notify < 0) {
-		if (errno == ENOSYS) {
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"inotify_init () failed");
-		}
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT1(O_NONBLOCK);
 
 	/* Setup a watch on an overlayfs lower directory */
-	if ((wd = myinotify_add_watch(fd_notify, DIR_PATH, IN_ALL_EVENTS)) < 0) {
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch (%d, " DIR_PATH ", IN_ALL_EVENTS) failed",
-			fd_notify);
-		reap_wd = 1;
-	};
+	wd = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, DIR_PATH, IN_ALL_EVENTS);
+	reap_wd = 1;
 
 	SAFE_STAT(DIR_PATH, &buf);
 	tst_res(TINFO, DIR_PATH " ino=%lu", buf.st_ino);
@@ -221,19 +171,17 @@
 	if (reap_wd && myinotify_rm_watch(fd_notify, wd) < 0) {
 		tst_res(TWARN,
 			"inotify_rm_watch (%d, %d) failed,", fd_notify, wd);
-
 	}
 
 	if (fd_notify > 0)
 		SAFE_CLOSE(fd_notify);
-
-	if (ovl_mounted)
-		SAFE_UMOUNT(OVL_MNT);
 }
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
+	.mount_device = 1,
+	.needs_overlay = 1,
+	.mntpoint = mntpoint,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_inotify,
diff --git a/testcases/kernel/syscalls/inotify/inotify08.c b/testcases/kernel/syscalls/inotify/inotify08.c
index acdb953..6a4278c 100644
--- a/testcases/kernel/syscalls/inotify/inotify08.c
+++ b/testcases/kernel/syscalls/inotify/inotify08.c
@@ -1,26 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 CTERA Networks.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 or any later of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Started by Amir Goldstein <amir73il@gmail.com>
+ * Author: Amir Goldstein <amir73il@gmail.com>
  *
  * DESCRIPTION
  *     Check that inotify work for an overlayfs file after copy up and
@@ -33,7 +14,6 @@
  *     The problem has been fixed by commit:
  *       764baba80168 "ovl: hash non-dir by lower inode for fsnotify"
  *
- *
  * ALGORITHM
  *     Add watch on an overlayfs lower file then chmod file and drop dentry
  *     and inode caches. Execute operations on file and expect events to be
@@ -74,14 +54,11 @@
 	unsigned int mask;
 };
 
-#define OVL_MNT "ovl"
 #define FILE_NAME "test_file"
 #define FILE_PATH OVL_MNT"/"FILE_NAME
 
-static int ovl_mounted;
-
+static const char mntpoint[] = OVL_BASE_MNTPOINT;
 static struct event_t event_set[EVENT_MAX];
-
 static char event_buf[EVENT_BUF_LEN];
 
 void verify_inotify(void)
@@ -104,8 +81,8 @@
 	test_cnt++;
 
 	/* Make sure events on upper/lower do not show in overlay watch */
-	SAFE_TOUCH("lower/"FILE_NAME, 0644, NULL);
-	SAFE_TOUCH("upper/"FILE_NAME, 0644, NULL);
+	SAFE_TOUCH(OVL_LOWER"/"FILE_NAME, 0644, NULL);
+	SAFE_TOUCH(OVL_UPPER"/"FILE_NAME, 0644, NULL);
 
 	int len = read(fd_notify, event_buf, EVENT_BUF_LEN);
 	if (len == -1 && errno != EAGAIN) {
@@ -154,47 +131,18 @@
 static void setup(void)
 {
 	struct stat buf;
-	int ret;
 
 	/* Setup an overlay mount with lower file */
-	SAFE_MKDIR("lower", 0755);
-	SAFE_TOUCH("lower/"FILE_NAME, 0644, NULL);
-	SAFE_MKDIR("upper", 0755);
-	SAFE_MKDIR("work", 0755);
-	SAFE_MKDIR(OVL_MNT, 0755);
-	ret = mount("overlay", OVL_MNT, "overlay", 0,
-		    "lowerdir=lower,upperdir=upper,workdir=work");
-	if (ret < 0) {
-		if (errno == ENODEV) {
-			tst_brk(TCONF,
-				"overlayfs is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"overlayfs mount failed");
-		}
-	}
-	ovl_mounted = 1;
+	SAFE_UMOUNT(OVL_MNT);
+	SAFE_TOUCH(OVL_LOWER"/"FILE_NAME, 0644, NULL);
+	SAFE_MOUNT_OVERLAY();
 
-	fd_notify = myinotify_init1(O_NONBLOCK);
-	if (fd_notify < 0) {
-		if (errno == ENOSYS) {
-			tst_brk(TCONF,
-				"inotify is not configured in this kernel.");
-		} else {
-			tst_brk(TBROK | TERRNO,
-				"inotify_init () failed");
-		}
-	}
+	fd_notify = SAFE_MYINOTIFY_INIT1(O_NONBLOCK);
 
 	/* Setup a watch on an overlayfs lower file */
-	if ((wd = myinotify_add_watch(fd_notify, FILE_PATH,
-				IN_ATTRIB | IN_OPEN | IN_CLOSE_WRITE)) < 0) {
-		tst_brk(TBROK | TERRNO,
-			"inotify_add_watch (%d, " FILE_PATH ", "
-			"IN_ATTRIB | IN_OPEN | IN_CLOSE_WRITE) failed",
-			fd_notify);
-		reap_wd = 1;
-	};
+	wd = SAFE_MYINOTIFY_ADD_WATCH(fd_notify, FILE_PATH,
+				IN_ATTRIB | IN_OPEN | IN_CLOSE_WRITE);
+	reap_wd = 1;
 
 	SAFE_STAT(FILE_PATH, &buf);
 	tst_res(TINFO, FILE_PATH " ino=%lu, dev=%u:%u", buf.st_ino,
@@ -217,19 +165,17 @@
 	if (reap_wd && myinotify_rm_watch(fd_notify, wd) < 0) {
 		tst_res(TWARN,
 			"inotify_rm_watch (%d, %d) failed,", fd_notify, wd);
-
 	}
 
 	if (fd_notify > 0)
 		SAFE_CLOSE(fd_notify);
-
-	if (ovl_mounted)
-		SAFE_UMOUNT(OVL_MNT);
 }
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
+	.mount_device = 1,
+	.needs_overlay = 1,
+	.mntpoint = mntpoint,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_inotify,
diff --git a/testcases/kernel/syscalls/inotify/inotify09.c b/testcases/kernel/syscalls/inotify/inotify09.c
index f587a3a..ff73792 100644
--- a/testcases/kernel/syscalls/inotify/inotify09.c
+++ b/testcases/kernel/syscalls/inotify/inotify09.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 SUSE Linux.  All Rights Reserved.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Started by Jan Kara <jack@suse.cz>
+ * Author: Jan Kara <jack@suse.cz>
  * Chnaged to use fzsync library by Cyril Hrubis <chrubis@suse.cz>
  *
  * DESCRIPTION
@@ -85,15 +72,11 @@
 	int inotify_fd;
 	int wd;
 
-	inotify_fd = myinotify_init1(0);
-	if (inotify_fd < 0)
-		tst_brk(TBROK | TERRNO, "inotify_init failed");
+	inotify_fd = SAFE_MYINOTIFY_INIT1(0);
 
 	tst_fzsync_pair_reset(&fzsync_pair, write_seek);
 	while (tst_fzsync_run_a(&fzsync_pair)) {
-		wd = myinotify_add_watch(inotify_fd, FNAME, IN_MODIFY);
-		if (wd < 0)
-			tst_brk(TBROK | TERRNO, "inotify_add_watch() failed.");
+		wd = SAFE_MYINOTIFY_ADD_WATCH(inotify_fd, FNAME, IN_MODIFY);
 
 		tst_fzsync_start_race_a(&fzsync_pair);
 		wd = myinotify_rm_watch(inotify_fd, wd);
diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy01.c b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
index e5ab188..560d7b3 100644
--- a/testcases/kernel/syscalls/io_destroy/io_destroy01.c
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *   Copyright (c) Crackerjack Project., 2007
  *   Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
  *   Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- *   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
  */
 
 /* Porting from Crackerjack to LTP is done
diff --git a/testcases/kernel/syscalls/io_setup/io_setup01.c b/testcases/kernel/syscalls/io_setup/io_setup01.c
index 617689b..4693f8f 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup01.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *   Copyright (c) Crackerjack Project., 2007
  *   Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
  *   Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- *   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
  */
 
 /* Porting from Crackerjack to LTP is done
diff --git a/testcases/kernel/syscalls/io_submit/io_submit01.c b/testcases/kernel/syscalls/io_submit/io_submit01.c
index f4f9933..afa077c 100644
--- a/testcases/kernel/syscalls/io_submit/io_submit01.c
+++ b/testcases/kernel/syscalls/io_submit/io_submit01.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007
  * Copyright (c) 2011-2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /* Porting from Crackerjack to LTP is done
diff --git a/testcases/kernel/syscalls/ioctl/ioctl01.c b/testcases/kernel/syscalls/ioctl/ioctl01.c
index ceb54aa..7fb8d41 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl01.c
@@ -1,26 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   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
+ * Copyright (c) International Business Machines  Corp., 2001
+ *  07/2001 Ported by Wayne Boyer
+ *  04/2002 Fixes by wjhuie
  */
-
 /*
- * NAME
- *	ioctl01.c
- *
  * DESCRIPTION
  *	Testcase to check the errnos set by the ioctl(2) system call.
  *
@@ -31,22 +15,6 @@
  *	4. ENOTTY: Pass an non-streams fd in ioctl(fd, cmd, arg)
  *	5. EFAULT: Pass a NULL address for termio
  *
- * USAGE:  <for command-line>
- *  ioctl01 -D /dev/tty[0-9] [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *	04/2002 Fixes by wjhuie
- *
- * RESTRICTIONS
- *      test must be run with the -D option
- *      test may have to be run as root depending on the tty permissions
  */
 
 #include <errno.h>
@@ -54,128 +22,94 @@
 #include <stdio.h>
 #include <termio.h>
 #include <termios.h>
-#include "test.h"
-#include "safe_macros.h"
-
-char *TCID = "ioctl01";
-int TST_TOTAL = 5;
+#include "tst_test.h"
 
 #define	INVAL_IOCTL	9999999
 
-static void setup(void);
-static void cleanup(void);
-static void help(void);
-
-static int fd, fd1;
+static int fd, fd_file;
 static int bfd = -1;
 
 static struct termio termio;
 
-static struct test_case_t {
+static struct tcase {
 	int *fd;
 	int request;
 	struct termio *s_tio;
 	int error;
-} TC[] = {
+} tcases[] = {
 	/* file descriptor is invalid */
-	{
-	&bfd, TCGETA, &termio, EBADF},
-	    /* termio address is invalid */
-	{
-	&fd, TCGETA, (struct termio *)-1, EFAULT},
-	    /* command is invalid */
-	    /* This errno value was changed from EINVAL to ENOTTY
-	     * by kernel commit 07d106d0 and bbb63c51
-	     */
-	{
-	&fd, INVAL_IOCTL, &termio, ENOTTY},
-	    /* file descriptor is for a regular file */
-	{
-	&fd1, TCGETA, &termio, ENOTTY},
-	    /* termio is NULL */
-	{
-	&fd, TCGETA, NULL, EFAULT}
+	{&bfd, TCGETA, &termio, EBADF},
+	/* termio address is invalid */
+	{&fd, TCGETA, (struct termio *)-1, EFAULT},
+	/* command is invalid */
+	/* This errno value was changed from EINVAL to ENOTTY
+	 * by kernel commit 07d106d0 and bbb63c51
+	 */
+	{&fd, INVAL_IOCTL, &termio, ENOTTY},
+	/* file descriptor is for a regular file */
+	{&fd_file, TCGETA, &termio, ENOTTY},
+	/* termio is NULL */
+	{&fd, TCGETA, NULL, EFAULT}
 };
 
-static int Devflag;
-static char *devname;
+static char *device;
 
-static option_t options[] = {
-	{"D:", &Devflag, &devname},
-	{NULL, NULL, NULL}
-};
-
-int main(int ac, char **av)
+static void verify_ioctl(unsigned int i)
 {
-	int lc;
-	int i;
+	TEST(ioctl(*(tcases[i].fd), tcases[i].request, tcases[i].s_tio));
 
-	tst_parse_opts(ac, av, options, &help);
-
-	if (!Devflag)
-		tst_brkm(TBROK, NULL, "You must specify a tty device with "
-			 "the -D option.");
-
-	tst_require_root();
-
-	setup();
-
-	fd = SAFE_OPEN(cleanup, devname, O_RDWR, 0777);
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/* loop through the test cases */
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			TEST(ioctl(*(TC[i].fd), TC[i].request, TC[i].s_tio));
-
-			if (TEST_RETURN != -1) {
-				tst_resm(TFAIL, "call succeeded unexpectedly");
-				continue;
-			}
-
-			if (TEST_ERRNO == TC[i].error)
-				tst_resm(TPASS | TTERRNO, "failed as expected");
-			else
-				tst_resm(TFAIL | TTERRNO,
-					 "failed unexpectedly; expected %d - %s",
-					 TC[i].error, strerror(TC[i].error));
-		}
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "call succeeded unexpectedly");
+		return;
 	}
-	cleanup();
 
-	tst_exit();
-}
+	if (TST_ERR != tcases[i].error) {
+		tst_res(TFAIL | TTERRNO,
+			"failed unexpectedly; expected %s",
+		        tst_strerrno(tcases[i].error));
+		return;
+	}
 
-static void help(void)
-{
-	printf("  -D <tty device> : for example, /dev/tty[0-9]\n");
+	tst_res(TPASS | TTERRNO, "failed as expected");
 }
 
 static void setup(void)
 {
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
+	unsigned int i;
 
-	TEST_PAUSE;
+	if (!device)
+		tst_brk(TBROK, "You must specify a tty device with -D option");
 
-	/* make a temporary directory and cd to it */
-	tst_tmpdir();
+	fd = SAFE_OPEN(device, O_RDWR, 0777);
 
 	if (tst_kvercmp(3, 7, 0) < 0) {
-		TC[2].error = EINVAL;
+		for (i = 0; i < ARRAY_SIZE(tcases); i++) {
+			if (tcases[i].request == INVAL_IOCTL)
+				tcases[i].error = EINVAL;
+		}
 	}
 
-	/* create a temporary file */
-	fd1 = open("x", O_CREAT, 0777);
-	if (fd1 == -1)
-		tst_resm(TFAIL | TERRNO, "Could not open test file");
+	fd_file = SAFE_OPEN("x", O_CREAT, 0777);
 }
 
 static void cleanup(void)
 {
-	close(fd1);
+	if (fd > 0)
+		SAFE_CLOSE(fd);
 
-	tst_rmdir();
+	if (fd_file > 0)
+		SAFE_CLOSE(fd_file);
 }
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.needs_tmpdir = 1,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_ioctl,
+	.tcnt = ARRAY_SIZE(tcases),
+	.options = (struct tst_option[]) {
+		{"D:", &device, "-D <tty device> : for example, /dev/tty[0-9]"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/ioctl/ioctl03.c b/testcases/kernel/syscalls/ioctl/ioctl03.c
index bf3107f..3d4ac3e 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl03.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl03.c
@@ -1,35 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2008
+ * Copyright (c) International Business Machines Corp., 2008
  * Copyright (c) Linux Test Project, 2017-2019
- *
- * 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, see <http://www.gnu.org/licenses/>.
+ * Author: Rusty Russell <rusty@rustcorp.com.au>
+ * Ported to LTP: subrata <subrata@linux.vnet.ibm.com>
  */
 
 /*
- * File:        ioctl03.c
- *
- * Description: This program tests whether all the valid IFF flags are
- *              returned properly by implementation of TUNGETFEATURES ioctl
- *              on kernel 2.6.27
- *
- * Test Name:   ioctl03
- *
- * Author:      Rusty Russell <rusty@rustcorp.com.au>
- *
- * history:     created - nov 28 2008 - rusty russell <rusty@rustcorp.com.au>
- *              ported to ltp
- *                      - nov 28 2008 - subrata <subrata@linux.vnet.ibm.com>
+ * This program tests whether all the valid IFF flags are
+ * returned properly by implementation of TUNGETFEATURES ioctl
+ * on kernel 2.6.27
  */
 
 #include <sys/types.h>
diff --git a/testcases/kernel/syscalls/ioctl/ioctl04.c b/testcases/kernel/syscalls/ioctl/ioctl04.c
index 2a70055..353114c 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl04.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl04.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Basic test for the BLKROSET and BLKROGET ioctls.
@@ -93,7 +81,6 @@
 }
 
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.format_device = 1,
 	.needs_root = 1,
 	.setup = setup,
diff --git a/testcases/kernel/syscalls/ioctl/ioctl05.c b/testcases/kernel/syscalls/ioctl/ioctl05.c
index 459efdb..a53e8ad 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl05.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl05.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Basic test for the BLKGETSIZE and BLKGETSIZE64 ioctls.
diff --git a/testcases/kernel/syscalls/ioctl/ioctl06.c b/testcases/kernel/syscalls/ioctl/ioctl06.c
index 6fc6443..6e56bee 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl06.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Basic test for the BLKRASET and BLKRAGET ioctls.
diff --git a/testcases/kernel/syscalls/ioctl/ioctl07.c b/testcases/kernel/syscalls/ioctl/ioctl07.c
index fb11178..c1de713 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl07.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl07.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Carlo Marcelo Arenas Belón <carenas@gmail.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Very basic test for the RND* ioctls.
diff --git a/testcases/kernel/syscalls/ioctl/ioctl08.c b/testcases/kernel/syscalls/ioctl/ioctl08.c
index 8de8004..dca898a 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl08.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl08.c
@@ -112,6 +112,11 @@
 			sizeof(struct file_dedupe_range_info));
 }
 
+static const char *const needed_drivers[] = {
+	"btrfs",
+	NULL,
+};
+
 static struct tst_test test = {
 	.test = verify_ioctl,
 	.tcnt = ARRAY_SIZE(tcases),
@@ -122,6 +127,7 @@
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
 	.dev_fs_type = "btrfs",
+	.needs_drivers = needed_drivers,
 };
 #else
 	TST_TEST_TCONF(
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
index dfde4da..36d2b3b 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
@@ -17,13 +17,14 @@
 
 #include <errno.h>
 #include <sched.h>
+#include <stdlib.h>
 #include "tst_test.h"
 #include "lapi/ioctl_ns.h"
 #include "lapi/namespaces_constants.h"
 
 #define STACK_SIZE (1024 * 1024)
 
-static char child_stack[STACK_SIZE];
+static char *child_stack;
 
 static void setup(void)
 {
@@ -31,6 +32,15 @@
 
 	if (exists < 0)
 		tst_res(TCONF, "namespace not available");
+
+	child_stack = ltp_alloc_stack(STACK_SIZE);
+	if (!child_stack)
+		tst_brk(TBROK|TERRNO, "stack alloc");
+}
+
+static void cleanup(void)
+{
+	free(child_stack);
 }
 
 static void test_ns_get_parent(void)
@@ -53,7 +63,7 @@
 	}
 }
 
-static int child(void *arg)
+static int child(void *arg LTP_ATTRIBUTE_UNUSED)
 {
 	test_ns_get_parent();
 	return 0;
@@ -63,8 +73,9 @@
 {
 	test_ns_get_parent();
 
-	ltp_clone(CLONE_NEWPID, &child, 0,
-		STACK_SIZE, child_stack);
+	if (ltp_clone(CLONE_NEWPID | SIGCHLD, &child, 0,
+		STACK_SIZE, child_stack) == -1)
+		tst_brk(TBROK | TERRNO, "ltp_clone failed");
 }
 
 static struct tst_test test = {
@@ -72,5 +83,6 @@
 	.forks_child = 1,
 	.needs_root = 1,
 	.min_kver = "4.9",
-	.setup = setup
+	.setup = setup,
+	.cleanup = cleanup,
 };
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
index a8dee07..a67ddbe 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns05.c
@@ -16,13 +16,14 @@
 #include <errno.h>
 #include <stdio.h>
 #include <sched.h>
+#include <stdlib.h>
 #include "tst_test.h"
 #include "lapi/ioctl_ns.h"
 #include "lapi/namespaces_constants.h"
 
 #define STACK_SIZE (1024 * 1024)
 
-static char child_stack[STACK_SIZE];
+static char *child_stack;
 
 static void setup(void)
 {
@@ -30,9 +31,18 @@
 
 	if (exists < 0)
 		tst_res(TCONF, "namespace not available");
+
+	child_stack = ltp_alloc_stack(STACK_SIZE);
+	if (!child_stack)
+		tst_brk(TBROK|TERRNO, "stack alloc");
 }
 
-static int child(void *arg)
+static void cleanup(void)
+{
+	free(child_stack);
+}
+
+static int child(void *arg LTP_ATTRIBUTE_UNUSED)
 {
 	if (getpid() != 1)
 		tst_res(TFAIL, "child should think its pid is 1");
@@ -44,8 +54,10 @@
 
 static void run(void)
 {
-	pid_t pid = ltp_clone(CLONE_NEWPID, &child, 0,
+	pid_t pid = ltp_clone(CLONE_NEWPID | SIGCHLD, &child, 0,
 		STACK_SIZE, child_stack);
+	if (pid == -1)
+		tst_brk(TBROK | TERRNO, "ltp_clone failed");
 
 	char child_namespace[20];
 	int my_fd, child_fd, parent_fd;
@@ -89,5 +101,6 @@
 	.needs_root = 1,
 	.needs_checkpoints = 1,
 	.min_kver = "4.9",
-	.setup = setup
+	.setup = setup,
+	.cleanup = cleanup,
 };
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
index 805a0a0..b6ac802 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns06.c
@@ -17,13 +17,14 @@
 #include <errno.h>
 #include <stdio.h>
 #include <sched.h>
+#include <stdlib.h>
 #include "tst_test.h"
 #include "lapi/ioctl_ns.h"
 #include "lapi/namespaces_constants.h"
 
 #define STACK_SIZE (1024 * 1024)
 
-static char child_stack[STACK_SIZE];
+static char *child_stack;
 
 static void setup(void)
 {
@@ -31,9 +32,18 @@
 
 	if (exists < 0)
 		tst_res(TCONF, "namespace not available");
+
+	child_stack = ltp_alloc_stack(STACK_SIZE);
+	if (!child_stack)
+		tst_brk(TBROK|TERRNO, "stack alloc");
 }
 
-static int child(void *arg)
+static void cleanup(void)
+{
+	free(child_stack);
+}
+
+static int child(void *arg LTP_ATTRIBUTE_UNUSED)
 {
 	TST_CHECKPOINT_WAIT(0);
 	return 0;
@@ -41,10 +51,13 @@
 
 static void run(void)
 {
-	pid_t pid = ltp_clone(CLONE_NEWUSER, &child, 0,
-		STACK_SIZE, child_stack);
 	char child_namespace[20];
 
+	pid_t pid = ltp_clone(CLONE_NEWUSER | SIGCHLD, &child, 0,
+		STACK_SIZE, child_stack);
+	if (pid == -1)
+		tst_brk(TBROK | TERRNO, "ltp_clone failed");
+
 	sprintf(child_namespace, "/proc/%i/ns/user", pid);
 	int my_fd, child_fd, parent_fd;
 
@@ -84,5 +97,6 @@
 	.needs_root = 1,
 	.needs_checkpoints = 1,
 	.min_kver = "4.9",
-	.setup = setup
+	.setup = setup,
+	.cleanup = cleanup,
 };
diff --git a/testcases/kernel/syscalls/ioprio/.gitignore b/testcases/kernel/syscalls/ioprio/.gitignore
new file mode 100644
index 0000000..373079b
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/.gitignore
@@ -0,0 +1,4 @@
+ioprio_get01
+ioprio_set01
+ioprio_set02
+ioprio_set03
diff --git a/testcases/kernel/syscalls/ioprio/Makefile b/testcases/kernel/syscalls/ioprio/Makefile
new file mode 100644
index 0000000..5ea7d67
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ioprio/ioprio.h b/testcases/kernel/syscalls/ioprio/ioprio.h
new file mode 100644
index 0000000..c743804
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/ioprio.h
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2019 Linus Walleij <linus.walleij@linaro.org>
+ */
+
+#ifndef LTP_IOPRIO_H
+#define LTP_IOPRIO_H
+
+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,
+};
+
+/* The I/O scheduler classes have 8 priorities 0..7 except for the IDLE class */
+#define IOPRIO_PRIO_NUM		8
+
+#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_LEVEL(data)	((data) & IOPRIO_PRIO_MASK)
+#define IOPRIO_PRIO_VALUE(class, data)	(((class) << IOPRIO_CLASS_SHIFT) | data)
+
+static const char * const to_class_str[] = {
+	[IOPRIO_CLASS_NONE] = "NONE",
+	[IOPRIO_CLASS_RT]   = "REALTIME",
+	[IOPRIO_CLASS_BE]   = "BEST-EFFORT",
+	[IOPRIO_CLASS_IDLE] = "IDLE"
+};
+
+static inline int sys_ioprio_get(int which, int who)
+{
+	return tst_syscall(__NR_ioprio_get, which, who);
+}
+
+static inline int sys_ioprio_set(int which, int who, int ioprio)
+{
+	return tst_syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+/* Priority range from 0 (highest) to 7 (lowest) */
+static inline int prio_in_range(int prio)
+{
+	if ((prio < 0) || (prio > 7))
+		return 0;
+	return 1;
+}
+
+/* Priority range from 0 to 3 using the enum */
+static inline int class_in_range(int class)
+{
+	if ((class < IOPRIO_CLASS_NONE) || (class > IOPRIO_CLASS_IDLE))
+		return 0;
+	return 1;
+}
+
+static inline void ioprio_check_setting(int class, int prio, int report)
+{
+	int res;
+	int newclass, newprio;
+
+	res = sys_ioprio_get(IOPRIO_WHO_PROCESS, 0);
+	if (res == -1) {
+		tst_res(TFAIL | TTERRNO,
+			 "reading back prio failed");
+		return;
+	}
+
+	newclass = IOPRIO_PRIO_CLASS(res);
+	newprio = IOPRIO_PRIO_LEVEL(res);
+	if (newclass != class)
+		tst_res(TFAIL,
+			"wrong class after setting, expected %s got %s",
+			to_class_str[class],
+			to_class_str[newclass]);
+	else if (newprio != prio)
+		tst_res(TFAIL,
+			"wrong prio after setting, expected %d got %d",
+			prio, newprio);
+	else if (report)
+		tst_res(TPASS, "ioprio_set new class %s, new prio %d",
+			to_class_str[newclass],
+			newprio);
+}
+
+#endif
diff --git a/testcases/kernel/syscalls/ioprio/ioprio_get01.c b/testcases/kernel/syscalls/ioprio/ioprio_get01.c
new file mode 100644
index 0000000..6e82243
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/ioprio_get01.c
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Linus Walleij <linus.walleij@linaro.org>
+ *
+ * Description:
+ * Basic ioprio_get() test. Gets the current process I/O priority and
+ * checks that the values are sane.
+ */
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include "ioprio.h"
+
+static void run(void)
+{
+	int prio, class;
+
+	/* Get the I/O priority for the current process */
+	TEST(sys_ioprio_get(IOPRIO_WHO_PROCESS, 0));
+
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "ioprio_get failed");
+		return;
+	}
+
+	class = IOPRIO_PRIO_CLASS(TST_RET);
+	prio = IOPRIO_PRIO_LEVEL(TST_RET);
+
+	if (!prio_in_range(prio)) {
+		tst_res(TFAIL, "ioprio out of range (%d)", prio);
+		return;
+	}
+
+	if (!class_in_range(class)) {
+		tst_res(TFAIL, "ioprio class of range (%d)", class);
+		return;
+	}
+
+	tst_res(TPASS, "ioprio_get returned class %s prio %d",
+		to_class_str[class], prio);
+}
+
+static struct tst_test test = {
+	.test_all = run,
+};
diff --git a/testcases/kernel/syscalls/ioprio/ioprio_set01.c b/testcases/kernel/syscalls/ioprio/ioprio_set01.c
new file mode 100644
index 0000000..19953ba
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/ioprio_set01.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Linus Walleij <linus.walleij@linaro.org>
+ *
+ * Description:
+ * Basic ioprio_set() test. Gets the current process I/O priority and
+ * bumps it up one notch, then down two notches and checks that the
+ * new priority is reported back correctly.
+ */
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include "ioprio.h"
+
+static int orig_class;
+static int orig_prio;
+
+static void run(void)
+{
+	int class = orig_class, prio = orig_prio;
+
+	/* Bump prio to what it was + 1 */
+	class = IOPRIO_CLASS_BE;
+	prio = prio + 1;
+	if (!prio_in_range(prio)) {
+		tst_res(TCONF, "ioprio increase out of range (%d)", prio);
+		goto second;
+	}
+
+	TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+			    IOPRIO_PRIO_VALUE(class, prio)));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO, "ioprio_set failed");
+	else
+		ioprio_check_setting(class, prio, 1);
+
+second:
+	/* Bump prio down two notches */
+	prio = prio - 2;
+	if (!prio_in_range(prio)) {
+		tst_res(TCONF, "ioprio decrease out of range (%d)", prio);
+		return;
+	}
+
+	TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+			    IOPRIO_PRIO_VALUE(class, prio)));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO, "ioprio_set failed");
+	else
+		ioprio_check_setting(class, prio, 1);
+}
+
+static void setup(void)
+{
+	/* Get the I/O priority for the current process */
+	TEST(sys_ioprio_get(IOPRIO_WHO_PROCESS, 0));
+	if (TST_RET == -1)
+		tst_brk(TBROK | TTERRNO, "ioprio_get failed");
+
+	orig_class = IOPRIO_PRIO_CLASS(TST_RET);
+	orig_prio = IOPRIO_PRIO_LEVEL(TST_RET);
+
+	tst_res(TINFO, "ioprio_get returned class %s prio %d",
+		to_class_str[orig_class], orig_prio);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = run,
+};
diff --git a/testcases/kernel/syscalls/ioprio/ioprio_set02.c b/testcases/kernel/syscalls/ioprio/ioprio_set02.c
new file mode 100644
index 0000000..328a130
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/ioprio_set02.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Linus Walleij <linus.walleij@linaro.org>
+ *
+ * Description:
+ * Extended ioprio_set() test.
+ * Tests to set all 8 priority levels for best effort priority, then
+ * switches to test all 8 priority levels for idle priority.
+ */
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include "ioprio.h"
+
+static void run(void)
+{
+	int class, prio;
+	int fail_in_loop;
+
+	/* Bump to best effort scheduling, all 8 priorities */
+	class = IOPRIO_CLASS_BE;
+
+	fail_in_loop = 0;
+	for (prio = 0; prio < IOPRIO_PRIO_NUM; prio++) {
+		TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+				    IOPRIO_PRIO_VALUE(class, prio)));
+		if (TST_RET == -1) {
+			tst_res(TFAIL | TTERRNO, "ioprio_set IOPRIO_CLASS_BE prio %d failed", prio);
+			fail_in_loop = 1;
+		}
+	}
+	if (!fail_in_loop)
+		tst_res(TPASS, "tested all prios in class %s",
+			 to_class_str[class]);
+
+	/* Bump down to idle scheduling */
+	class = IOPRIO_CLASS_IDLE;
+
+	fail_in_loop = 0;
+	for (prio = 0; prio < IOPRIO_PRIO_NUM; prio++) {
+		TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+				    IOPRIO_PRIO_VALUE(class, prio)));
+		if (TST_RET == -1) {
+			tst_res(TFAIL | TTERRNO, "ioprio_set IOPRIO_CLASS_IDLE prio %d failed", prio);
+			fail_in_loop = 1;
+		}
+	}
+	if (!fail_in_loop)
+		tst_res(TPASS, "tested all prios in class %s",
+			 to_class_str[class]);
+
+	/* Test NONE scheduling */
+	class = IOPRIO_CLASS_NONE;
+	TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+			    IOPRIO_PRIO_VALUE(class, 0)));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO, "ioprio_set IOPRIO_CLASS_NONE failed");
+	else
+		ioprio_check_setting(class, 0, 1);
+}
+
+static struct tst_test test = {
+	.test_all = run,
+};
diff --git a/testcases/kernel/syscalls/ioprio/ioprio_set03.c b/testcases/kernel/syscalls/ioprio/ioprio_set03.c
new file mode 100644
index 0000000..b2c962a
--- /dev/null
+++ b/testcases/kernel/syscalls/ioprio/ioprio_set03.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Linus Walleij <linus.walleij@linaro.org>
+ *
+ * Description:
+ * Negative ioprio_set() test. Test some non-working priorities to make
+ * sure they don't work.
+ */
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include "ioprio.h"
+
+static void run(void)
+{
+	int class;
+
+	class = IOPRIO_CLASS_BE;
+
+	/*
+	 * Test to fail with prio 8, first set prio 4 so we know what it
+	 * should still be after failure, i.e. we check that the priority
+	 * didn't change as a side effect of setting an invalid priority.
+	 */
+	sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+		       IOPRIO_PRIO_VALUE(class, 4));
+	TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+			    IOPRIO_PRIO_VALUE(class, 8)));
+	if (TST_RET == -1) {
+		ioprio_check_setting(class, 4, 1);
+		if (errno == EINVAL)
+			tst_res(TPASS | TTERRNO, "returned correct error for wrong prio");
+		else
+			tst_res(TFAIL, "ioprio_set returns wrong errno %d",
+				TST_ERR);
+	} else {
+		tst_res(TFAIL, "ioprio_set IOPRIO_CLASS_BE prio 8 should not work");
+	}
+
+	/* Any other prio than 0 should not work with NONE */
+	class = IOPRIO_CLASS_NONE;
+	TEST(sys_ioprio_set(IOPRIO_WHO_PROCESS, 0,
+			    IOPRIO_PRIO_VALUE(class, 4)));
+	if (TST_RET == -1) {
+		tst_res(TINFO, "tested illegal priority with class %s",
+			to_class_str[class]);
+		if (errno == EINVAL)
+			tst_res(TPASS | TTERRNO, "returned correct error for wrong prio");
+		else
+			tst_res(TFAIL, "ioprio_set returns wrong errno %d",
+				TST_ERR);
+	} else {
+		tst_res(TFAIL, "ioprio_set IOPRIO_CLASS_NONE should fail");
+	}
+}
+
+static struct tst_test test = {
+	.test_all = run,
+};
diff --git a/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c b/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c
index 0369add..b909cb7 100644
--- a/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c
+++ b/testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
index df14264..75adcb2 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *	03/2001 - Written by Wayne Boyer
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
index fca49f3..1ace62f 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *    03/2001 - Written by Wayne Boyer
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  * Create a message queue, then issue the IPC_SET command to lower the
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
index 707fe2b..cc7abd4 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.
  */
 /*
  * DESCRIPTION
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
index 8e4af83..900b222 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *    03/2001 - Written by Wayne Boyer
  *    12/03/2008 Matthieu Fertré (Matthieu.Fertre@irisa.fr)
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  * Test for EACCES, EFAULT and EINVAL errors using a variety of incorrect
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c
index 403a57e..73eead7 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c
@@ -1,18 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.
  */
 /*
  * msgctl12 - test for IPC_INFO MSG_INFO and MSG_STAT.
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget01.c b/testcases/kernel/syscalls/ipc/msgget/msgget01.c
index ae9e0ac..5b7c6e3 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget01.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget02.c b/testcases/kernel/syscalls/ipc/msgget/msgget02.c
index 00f7fa8..a8fac93 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget02.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget03.c b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
index c117710..8fa6208 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget03.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
index e05df01..fca7c67 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
index 1b5f2e3..24ef6c5 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
index afadb1e..e169831 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
index 56f75eb..e7855e8 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat01.c b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
index b46ba68..f759147 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat01.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
@@ -72,19 +59,9 @@
 
 static void do_child(int *in_addr, int expect_crash)
 {
-	if (expect_crash) {
-		/*
-		 * Crash is expected, avoid dumping corefile.
-		 * 1 is a special value, that disables core-to-pipe.
-		 * At the same time it is small enough value for
-		 * core-to-file, so it skips creating cores as well.
-		*/
-		struct rlimit r;
+	if (expect_crash)
+		tst_no_corefile(1);
 
-		r.rlim_cur = 1;
-		r.rlim_max = 1;
-		SAFE_SETRLIMIT(RLIMIT_CORE, &r);
-	}
 	*in_addr = 10;
 
 	exit(0);
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat02.c b/testcases/kernel/syscalls/ipc/shmat/shmat02.c
index 046a940..08bb122 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat02.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat03.c b/testcases/kernel/syscalls/ipc/shmat/shmat03.c
index 0834626..dfa427a 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat03.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat03.c
@@ -1,41 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
  * Copyright (c) 2017 Fujitsu Ltd. (Xiao Yang <yangx.jy@cn.fujitsu.com>)
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
- * Test for CVE-2017-5669 which allows us to map the nil page using shmat.
+ * Originated as a test for CVE-2017-5669 but as it turns out the CVE was bogus
+ * to begin with and the test was changed into a regression test for commit:
  *
- * When the bug is present shmat(..., (void *)1, SHM_RND) will round address
- * 0x1 down to zero and give us the (nil/null) page. With the current bug fix
- * in place, shmat it will return EINVAL instead. We also check to see if the
- * returned address is outside the nil page in case an alternative fix has
- * been applied.
+ * commit 8f89c007b6dec16a1793cb88de88fcc02117bbbc
+ * Author: Davidlohr Bueso <dave@stgolabs.net>
+ * Date:   Fri May 25 14:47:30 2018 -0700
  *
- * In any case we manage to map some memory we also try to write to it. This
- * is just to see if we get an access error or some other unexpected behaviour.
+ *  ipc/shm: fix shmat() nil address after round-down when remapping
  *
- * See commit 95e91b831f (ipc/shm: Fix shmat mmap nil-page protection)
+ * Which makes sure that SHM_REMAP forbids NULL address consistently for
+ * SHM_RND as well.
  *
- * The commit above disallowed SHM_RND maps to zero (and rounded) entirely and
- * that broke userland for cases like Xorg. New behavior disallows REMAPs to
- * lower addresses (0<=PAGESIZE).
+ * The timeline went as:
  *
- * See commit a73ab244f0da (Revert "ipc/shm: Fix shmat mmap nil-page protect...)
- * See commit 8f89c007b6de (ipc/shm: fix shmat() nil address after round-dow...)
- * See https://github.com/linux-test-project/ltp/issues/319
+ * 95e91b831f87 (ipc/shm: Fix shmat mmap nil-page protection)
+ * a73ab244f0da (Revert "ipc/shm: Fix shmat mmap nil-page protect...)
+ * 8f89c007b6de (ipc/shm: fix shmat() nil address after round-dow...)
+ *
+ * The original commit disallowed SHM_RND maps to zero (and rounded) entirely
+ * and that broke userland for cases like Xorg.
+ *
+ * See also https://github.com/linux-test-project/ltp/issues/319
  *
  * This test needs root permissions or else security_mmap_addr(), from
  * get_unmapped_area(), will cause permission errors when trying to mmap lower
@@ -110,4 +100,10 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "95e91b831f87"},
+		{"linux-git", "a73ab244f0da"},
+		{"linux-git", "8f89c007b6de"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index 1b46977..52bf23a 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -79,6 +79,7 @@
 
 /* Check routine for SHM_STAT */
 static void func_sstat(int ret);
+static void func_sstat_setup(void);
 
 /* Check routine for SHM_LOCK */
 static void func_lock(int ret);
@@ -110,7 +111,7 @@
 #endif
 	{&shm_id_1, IPC_SET, &buf, func_set, set_setup},
 	{&shm_id_1, IPC_INFO, (struct shmid_ds *) &info, func_info, NULL},
-	{&shm_index, SHM_STAT, &buf, func_sstat, NULL},
+	{&shm_index, SHM_STAT, &buf, func_sstat, func_sstat_setup},
 	{&shm_id_1, SHM_LOCK, NULL, func_lock, NULL},
 	{&shm_id_1, SHM_UNLOCK, NULL, func_unlock, NULL},
 	{&shm_id_1, IPC_RMID, NULL, func_rmid, NULL},
@@ -407,9 +408,23 @@
 static void func_sstat(int ret)
 {
 	if (ret >= 0)
-		tst_resm(TPASS, "get correct shared memory id");
+		tst_resm(TPASS, "get correct shared memory id for index: %d",
+			shm_index);
 	else
-		tst_resm(TFAIL, "shared memory id is incorrect");
+		tst_resm(TFAIL, "shared memory id is incorrect, index: %d",
+			shm_index);
+}
+
+static void func_sstat_setup(void)
+{
+	struct shm_info tmp;
+	int ret;
+
+	ret = shmctl(shm_id_1, SHM_INFO, (void *)&tmp);
+	if (ret < 0)
+		tst_resm(TFAIL|TERRNO, "shmctl(SHM_INFO)");
+	else
+		shm_index = ret;
 }
 
 static void func_lock(int ret)
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
index ecae202..50196ae 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -108,4 +96,8 @@
 	.setup = setup,
 	.test_all = do_test,
 	.cleanup = cleanup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "3f05317d9889"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/kcmp/kcmp01.c b/testcases/kernel/syscalls/kcmp/kcmp01.c
index f37fff1..31c2ef3 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp01.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp01.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 Cedric Hnyda <chnyda@suse.com>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
  /* Description:
diff --git a/testcases/kernel/syscalls/kcmp/kcmp02.c b/testcases/kernel/syscalls/kcmp/kcmp02.c
index 189518f..1885dc9 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp02.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp02.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 Cedric Hnyda <chnyda@suse.com>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
  /* Description:
diff --git a/testcases/kernel/syscalls/kcmp/kcmp03.c b/testcases/kernel/syscalls/kcmp/kcmp03.c
index a115489..30ac3ec 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp03.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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 would 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.
  */
 
  /*
diff --git a/testcases/kernel/syscalls/keyctl/keyctl01.c b/testcases/kernel/syscalls/keyctl/keyctl01.c
index d826a8c..55e069c 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl01.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007
  * Copyright (c) 2017 Fujitsu Ltd.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/keyctl/keyctl02.c b/testcases/kernel/syscalls/keyctl/keyctl02.c
index be5ad85..f4ee03f 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl02.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl02.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  *  Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -148,4 +136,8 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "b4a1b4f5047e"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/keyctl/keyctl03.c b/testcases/kernel/syscalls/keyctl/keyctl03.c
index 90e00f8..9d7b9a0 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl03.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  *  Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -53,4 +41,8 @@
 
 static struct tst_test test = {
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "f05819df10d7"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/keyctl/keyctl04.c b/testcases/kernel/syscalls/keyctl/keyctl04.c
index 6e1b4b3..1fed23c 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl04.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl04.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -55,4 +43,9 @@
 
 static struct tst_test test = {
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-7472"},
+		{"linux-git", "c9f838d104fe"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/keyctl/keyctl05.c b/testcases/kernel/syscalls/keyctl/keyctl05.c
index e2ed8ad..c592eb4 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl05.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl05.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -219,4 +207,8 @@
 	.tcnt = 3,
 	.test = do_test,
 	.forks_child = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "63a0b0509e70"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/keyctl/keyctl06.c b/testcases/kernel/syscalls/keyctl/keyctl06.c
index bab26ee..f76a85f 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl06.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl06.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -74,4 +62,9 @@
 
 static struct tst_test test = {
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "e645016abc80"},
+		{"linux-git", "3239b6f29bdf"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/keyctl/keyctl07.c b/testcases/kernel/syscalls/keyctl/keyctl07.c
index e067ac0..875ef0b 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl07.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl07.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -115,4 +103,9 @@
 static struct tst_test test = {
 	.test_all = do_test,
 	.forks_child = 1,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-12912"},
+		{"linux-git", "37863c43b2c6"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/keyctl/keyctl08.c b/testcases/kernel/syscalls/keyctl/keyctl08.c
index fca5c34..bc01192 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl08.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl08.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /* Check for CVE-2016-9604; that keys beginning with "." are disallowed.
  *
@@ -41,4 +29,9 @@
 	.test_all = run,
 	.needs_root = 1,
 	.min_kver = "2.6.13",
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2016-9604"},
+		{"linux-git", "ee8f844e3c5a"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c b/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c
index 1165db0..b9669b2 100644
--- a/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c
+++ b/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2016 Fujitsu Ltd.
 * Author: Jinbao Huang <huangjb.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY;  without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c b/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c
index c29d5c0..183239a 100644
--- a/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c
+++ b/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2016 Fujitsu Ltd.
 * Author: Jinbao Huang <huangjb.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
-*
 */
 
 /*
diff --git a/testcases/kernel/syscalls/link/link08.c b/testcases/kernel/syscalls/link/link08.c
index 775c0c2..d3e33d0 100644
--- a/testcases/kernel/syscalls/link/link08.c
+++ b/testcases/kernel/syscalls/link/link08.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
- *
- * 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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 /*
  * Test Description:
diff --git a/testcases/kernel/syscalls/listxattr/listxattr01.c b/testcases/kernel/syscalls/listxattr/listxattr01.c
index a59547b..62198b2 100644
--- a/testcases/kernel/syscalls/listxattr/listxattr01.c
+++ b/testcases/kernel/syscalls/listxattr/listxattr01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 *  Copyright (c) 2016 RT-RK Institute for Computer Based Systems
 *  Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
-*
-*  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.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/listxattr/listxattr02.c b/testcases/kernel/syscalls/listxattr/listxattr02.c
index 33f57d5..98a0985 100644
--- a/testcases/kernel/syscalls/listxattr/listxattr02.c
+++ b/testcases/kernel/syscalls/listxattr/listxattr02.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 *  Copyright (c) 2016 RT-RK Institute for Computer Based Systems
 *  Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
-*
-*  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.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/listxattr/listxattr03.c b/testcases/kernel/syscalls/listxattr/listxattr03.c
index dcfb6b1..4c1e7f1 100644
--- a/testcases/kernel/syscalls/listxattr/listxattr03.c
+++ b/testcases/kernel/syscalls/listxattr/listxattr03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 *  Copyright (c) 2016 RT-RK Institute for Computer Based Systems
 *  Author: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
-*
-*  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.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/llistxattr/llistxattr01.c b/testcases/kernel/syscalls/llistxattr/llistxattr01.c
index 98c1bdf..f594132 100644
--- a/testcases/kernel/syscalls/llistxattr/llistxattr01.c
+++ b/testcases/kernel/syscalls/llistxattr/llistxattr01.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2016 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/llistxattr/llistxattr02.c b/testcases/kernel/syscalls/llistxattr/llistxattr02.c
index d239e97..6974f01 100644
--- a/testcases/kernel/syscalls/llistxattr/llistxattr02.c
+++ b/testcases/kernel/syscalls/llistxattr/llistxattr02.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2016 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/llistxattr/llistxattr03.c b/testcases/kernel/syscalls/llistxattr/llistxattr03.c
index a62bc21..940851f 100644
--- a/testcases/kernel/syscalls/llistxattr/llistxattr03.c
+++ b/testcases/kernel/syscalls/llistxattr/llistxattr03.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2016 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/llseek/llseek01.c b/testcases/kernel/syscalls/llseek/llseek01.c
index 9ae8218..50f3549 100644
--- a/testcases/kernel/syscalls/llseek/llseek01.c
+++ b/testcases/kernel/syscalls/llseek/llseek01.c
@@ -1,211 +1,80 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
  *   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
+ *   07/2001 Ported by Wayne Boyer
  */
-
 /*
- * Test Name: llseek01
- *
- * Test Description:
- *  Verify that, llseek() call succeeds to set the file pointer position
- *  to an offset larger than file size. Also, verify that any attempt
- *  to write to this location fails.
- *
- * Expected result:
- *  llseek() should return the offset from the beginning of the file measured
- *  in bytes. Attempt to write to the location ( > file size) should fail.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	Log the errno and Issue a FAIL message.
- *   Otherwise,
- *	Verify the Functionality of system call
- *      if successful,
- *		Issue Functionality-Pass message.
- *      Otherwise,
- *		Issue Functionality-Fail message.
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory created.
- *
- * Usage:  <for command-line>
- *  llseek01 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -f   : Turn off functionality Testing.
- *	       -i n : Execute test n times.
- *	       -I x : Execute test for x seconds.
- *	       -P x : Pause for x seconds between iterations.
- *	       -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS:
- *  None.
+ * Verify that lseek64() call succeeds to set the file pointer position to an
+ * offset larger than file size limit (RLIMIT_FSIZE). Also, verify that any
+ * attempt to write to this location fails.
  */
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
 
-#include <unistd.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
 #include <sys/types.h>
-#include <inttypes.h>
+#include <unistd.h>
+#include <stdio.h>
 
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
 #define TEMP_FILE	"tmp_file"
 #define FILE_MODE	0644
 
-char *TCID = "llseek01";
-int TST_TOTAL = 1;
-char write_buff[BUFSIZ];	/* buffer to hold data */
-int fildes;			/* file handle for temp file */
+static char write_buff[BUFSIZ];
+static int fildes;
 
-void setup();			/* Main setup function of test */
-void cleanup();			/* cleanup function for the test */
-
-int main(int ac, char **av)
+static void verify_llseek(void)
 {
-	int lc;
-	loff_t offset;		/* Ret value from llseek */
+	TEST(lseek64(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET));
+	if (TST_RET == (80 * BUFSIZ))
+		tst_res(TPASS, "lseek64() can set file pointer position larger than file size limit");
+	else
+		tst_res(TFAIL, "lseek64() returned wrong value %ld when write past file size", TST_RET);
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	if (write(fildes, write_buff, BUFSIZ) == -1)
+		tst_res(TPASS,"write failed after file size limit");
+	else
+		tst_brk(TFAIL, "write successful after file size limit");
 
-	offset = -1;
+	TEST(lseek64(fildes, (loff_t) BUFSIZ, SEEK_SET));
+	if (TST_RET == BUFSIZ)
+		tst_res(TPASS,"lseek64() can set file pointer position under filer size limit");
+	else
+		tst_brk(TFAIL,"lseek64() returns wrong value %ld when write under file size", TST_RET);
 
-	setup();
+	if (write(fildes, write_buff, BUFSIZ) != -1)
+		tst_res(TPASS, "write succcessfully under file size limit");
+	else
+		tst_brk(TFAIL, "write failed under file size limit");
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * set file size limit, seek to a file using llseek.
-		 */
-		TEST(lseek64(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET));
-
-		if (TEST_RETURN == (loff_t) - 1) {
-			tst_resm(TFAIL, "llseek on (%s) Failed, errno=%d : %s",
-				 TEMP_FILE, TEST_ERRNO, strerror(TEST_ERRNO));
-			continue;
-		}
-
-		if (TEST_RETURN != (loff_t) (80 * BUFSIZ)) {
-			tst_resm(TFAIL, "llseek() returned incorrect "
-				 "value %" PRId64 ", expected %d",
-				 (int64_t) offset, BUFSIZ);
-			continue;
-		}
-
-		/*
-		 * llseek() successful.  Now attempt to write past
-		 * file size limit.
-		 */
-		if (write(fildes, write_buff, BUFSIZ) != -1) {
-			tst_brkm(TFAIL, cleanup, "write successful "
-				 "after file size limit");
-		}
-
-		/* Seeking to end of last valid write */
-		offset = lseek64(fildes, (loff_t) BUFSIZ, SEEK_SET);
-		if (offset != (loff_t) BUFSIZ) {
-			tst_brkm(TFAIL, cleanup,
-				 "llseek under file size limit");
-		}
-
-		/*
-		 * llseek() successful.  Now, attempt to write to
-		 * file size limit.
-		 */
-		if (write(fildes, write_buff, BUFSIZ) != BUFSIZ) {
-			tst_brkm(TFAIL, cleanup, "write failed to "
-				 "write to file size limit");
-		}
-
-		/*
-		 * Again, attempt to write past file size limit.
-		 */
-		if (write(fildes, write_buff, BUFSIZ) != -1) {
-			tst_brkm(TFAIL, cleanup, "write past file "
-				 "size limit successful");
-		}
-
-		tst_resm(TPASS, "Functionality of llseek() on %s "
-			 "successful", TEMP_FILE);
-	}
-
-	cleanup();
-	tst_exit();
+	if (write(fildes, write_buff, BUFSIZ) == -1)
+		tst_res(TPASS, "write failed after file size limit");
+	else
+		tst_brk(TFAIL, "write successfully after file size limit");
 }
 
-void setup(void)
+static void setup(void)
 {
-	struct sigaction act;	/* struct. to hold signal */
-	struct rlimit rlp;	/* resource for file size limit */
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
+	struct sigaction act;
+	struct rlimit rlp;
 
 	act.sa_handler = SIG_IGN;
 	act.sa_flags = 0;
 	sigemptyset(&act.sa_mask);
-	if (sigaction(SIGXFSZ, &act, NULL) == -1) {
-		tst_brkm(TFAIL, NULL, "sigaction() Failed to ignore SIGXFSZ");
-	}
+	SAFE_SIGACTION(SIGXFSZ, &act, NULL);
 
-	tst_tmpdir();
-
-	/* Set limit low, argument is # bytes */
 	rlp.rlim_cur = rlp.rlim_max = 2 * BUFSIZ;
+	SAFE_SETRLIMIT(RLIMIT_FSIZE, &rlp);
 
-	SAFE_SETRLIMIT(cleanup, RLIMIT_FSIZE, &rlp);
+	fildes = SAFE_OPEN(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE);
 
-	/* Creat/open a temporary file under above directory */
-	if ((fildes = open(TEMP_FILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
-		tst_brkm(TBROK, cleanup,
-			 "open(%s, O_RDWR|O_CREAT, 0644) Failed, errno=%d :%s",
-			 TEMP_FILE, errno, strerror(errno));
-	}
-
-	SAFE_WRITE(cleanup, 1, fildes, write_buff, BUFSIZ);
+	SAFE_WRITE(1, fildes, write_buff, BUFSIZ);
 }
 
-void cleanup(void)
-{
-	SAFE_CLOSE(NULL, fildes);
-
-	tst_rmdir();
-}
+static struct tst_test test = {
+	.setup = setup,
+	.needs_tmpdir = 1,
+	.test_all = verify_llseek,
+};
diff --git a/testcases/kernel/syscalls/llseek/llseek02.c b/testcases/kernel/syscalls/llseek/llseek02.c
index 5f2e398..3d9c21f 100644
--- a/testcases/kernel/syscalls/llseek/llseek02.c
+++ b/testcases/kernel/syscalls/llseek/llseek02.c
@@ -1,70 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
  *   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
+ *   07/2001 Ported by Wayne Boyer
  */
-
 /*
- * Test Name: llseek02
- * Note that glibc exports the llseek syscall as lseek64.
- *
- * Test Description:
- *  Verify that,
- *  1. llseek() returns -1 and sets errno to EINVAL, if the 'Whence' argument
- *     is not a proper value.
- *  2. llseek() returns -1 and sets errno to EBADF, if the file handle of
- *     the specified file is not valid.
- *
- * Expected Result:
- *  llseek() should fail with return value -1 and set expected errno.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Create temporary directory.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	if errno set == expected errno
- *		Issue sys call fails with expected return value and errno.
- *	Otherwise,
- *		Issue sys call fails with unexpected errno.
- *   Otherwise,
- *	Issue sys call returns unexpected value.
- *
- *  Cleanup:
- *   Print errno log and/or timing stats if options given
- *   Delete the temporary directory(s)/file(s) created.
- *
- * Usage:  <for command-line>
- *  llseek02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *	       -i n : Execute test n times.
- *	       -I x : Execute test for x seconds.
- *	       -P x : Pause for x seconds between iterations.
- *	       -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS:
- *  None.
+ * Description:
+ * 1) lseek64(2) fails and sets errno to EINVAL when whence is invalid.
+ * 2) lseek64(2) fails ans sets errno to EBADF when fd is not an open
+ * file descriptor.
  */
 
 #ifndef _GNU_SOURCE
@@ -72,204 +15,56 @@
 #endif
 
 #include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <signal.h>
+#include "tst_test.h"
 
-#include "test.h"
-#include "safe_macros.h"
+#define TEMP_FILE1 "tmp_file1"
+#define TEMP_FILE2 "tmp_file2"
 
-#define TEMP_FILE1	"tmp_file1"
-#define TEMP_FILE2	"tmp_file2"
-#define FILE_MODE	S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define SEEK_TOP	10
+#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#define SEEK_TOP 10
 
-char *TCID = "llseek02";
-int TST_TOTAL = 2;
+static int fd1;
+static int fd2;
 
-int no_setup();
-int setup1();			/* setup function to test llseek() for EINVAL */
-int setup2();			/* setup function to test llseek() for EBADF */
-
-int fd1;			/* file handle for testfile1  */
-int fd2;			/* file handle for testfile2  */
-
-struct test_case_t {		/* test case struct. to hold ref. test cond's */
-	int fd;
-	int Whence;
-	char *desc;
-	int exp_errno;
-	int (*setupfunc) ();
-} Test_cases[] = {
-	{
-	1, SEEK_TOP, "'whence' argument is not valid", EINVAL, setup1}, {
-	2, SEEK_SET, "'fd' is not an open file descriptor", EBADF, setup2},
-	{
-	0, 0, NULL, 0, no_setup}
+static struct tcase {
+	int *fd;
+	int whence;
+	int exp_err;
+} tcases[] = {
+	{&fd1, SEEK_TOP, EINVAL},
+	{&fd2, SEEK_SET, EBADF},
 };
 
-void setup();			/* Main setup function of test */
-void cleanup();			/* cleanup function for the test */
-
-int main(int ac, char **av)
+static void verify_llseek(unsigned int n)
 {
-	int lc;
-	int fildes;		/* file handle for testfile */
-	int whence;		/* position of file handle in the file */
-	char *test_desc;	/* test specific error message */
-	int ind;		/* counter to test different test conditions */
+	struct tcase *tc = &tcases[n];
 
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
-			fildes = Test_cases[ind].fd;
-			test_desc = Test_cases[ind].desc;
-			whence = Test_cases[ind].Whence;
-
-			/* Assign the 'fd' values appropriatly */
-			if (fildes == 1) {
-				fildes = fd1;
-			} else {
-				fildes = fd2;
-			}
-
-			/*
-			 * Invoke llseek(2) to test different test conditions.
-			 * Verify that it fails with -1 return value and
-			 * sets appropriate errno.
-			 */
-			TEST(lseek64(fildes, (loff_t) 0, whence));
-
-			if (TEST_RETURN != (loff_t) - 1) {
-				tst_resm(TFAIL,
-					 "llseek() returned %ld, expected"
-					 " -1, errno:%d", TEST_RETURN,
-					 Test_cases[ind].exp_errno);
-				continue;
-			}
-			if (TEST_ERRNO == Test_cases[ind].exp_errno) {
-				tst_resm(TPASS, "llseek() fails, %s, errno:%d",
-					 test_desc, TEST_ERRNO);
-			} else {
-				tst_resm(TFAIL, "llseek() fails, %s, errno:%d, "
-					 "expected errno:%d", test_desc,
-					 TEST_ERRNO, Test_cases[ind].exp_errno);
-			}
-		}
+	TEST(lseek64(*tc->fd, (loff_t) 1, tc->whence));
+	if (TST_RET != (off_t) -1) {
+		tst_res(TFAIL, "lseek64(%d, 1, %d) succeeded unexpectedly (%ld)",
+			*tc->fd, tc->whence, TST_RET);
+		return;
 	}
-
-	cleanup();
-
-	tst_exit();
-}
-
-/*
- * setup() - performs all ONE TIME setup for this test.
- *           Create a temporary directory and change directory to it.
- *           Invoke individual test setup functions according to the order
- *           set in test struct. definition.
- */
-void setup(void)
-{
-	int ind;
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	/* call individual setup functions */
-	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
-		Test_cases[ind].setupfunc();
+	if (TST_ERR == tc->exp_err) {
+		tst_res(TPASS | TTERRNO, "lseek64(%d, 1, %d) failed as expected",
+			*tc->fd, tc->whence);
+	} else {
+		tst_res(TFAIL | TTERRNO, "lseek64(%d, 1, %d) failed "
+		        "unexpectedly, expected %s", *tc->fd, tc->whence,
+		        tst_strerrno(tc->exp_err));
 	}
 }
 
-/*
- * no_setup() - This is a dummy function which simply returns 0.
- */
-int no_setup(void)
+static void setup(void)
 {
-	return 0;
+	fd1 = SAFE_OPEN(TEMP_FILE1, O_RDWR | O_CREAT, FILE_MODE);
+	fd2 = SAFE_OPEN(TEMP_FILE2, O_RDWR | O_CREAT, FILE_MODE);
+	close(fd2);
 }
 
-/*
- * setup1() - setup function for a test condition for which llseek(2)
- *            returns -1 and sets errno to EINVAL.
- *            Creat a temporary file for reading/writing and write some data
- *            into it.
- *            This function returns 0 on success.
- */
-int setup1(void)
-{
-	char write_buff[BUFSIZ];	/* buffer to hold data */
-
-	/* Get the data to be written to temporary file */
-	strcpy(write_buff, "abcdefg");
-
-	/* Creat/open a temporary file under above directory */
-	if ((fd1 = open(TEMP_FILE1, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
-		tst_brkm(TBROK, cleanup,
-			 "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s",
-			 TEMP_FILE1, FILE_MODE, errno, strerror(errno));
-	}
-
-	/* Write data into temporary file */
-	if (write(fd1, write_buff, sizeof(write_buff)) <= 0) {
-		tst_brkm(TBROK, cleanup, "write(2) on %s Failed, errno=%d : %s",
-			 TEMP_FILE1, errno, strerror(errno));
-	}
-
-	return 0;
-}
-
-/*
- * setup2() - setup function for a test condition for which llseek(2)
- *            returns -1 and sets errno to EBADF.
- *            Creat a temporary file for reading/writing and close it.
- *            This function returns 0 on success.
- */
-int setup2(void)
-{
-	/* Creat/open a temporary file under above directory */
-	if ((fd2 = open(TEMP_FILE2, O_RDWR | O_CREAT, FILE_MODE)) == -1) {
-		tst_brkm(TBROK, cleanup,
-			 "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d :%s",
-			 TEMP_FILE2, FILE_MODE, errno, strerror(errno));
-	}
-
-	/* Close the temporary file created above */
-	SAFE_CLOSE(cleanup, fd2);
-
-	return 0;
-}
-
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- *             Close the temporary file.
- *             Remove the test directory and testfile created in the setup.
- */
-void cleanup(void)
-{
-
-	/* Close the temporary file(s) created in setup1/setup2 */
-	if (close(fd1) < 0) {
-		tst_brkm(TFAIL, NULL, "close(%s) Failed, errno=%d : %s:",
-			 TEMP_FILE1, errno, strerror(errno));
-	}
-
-	tst_rmdir();
-
-}
+static struct tst_test test = {
+	.setup = setup ,
+	.needs_tmpdir = 1 ,
+	.test = verify_llseek,
+	.tcnt = ARRAY_SIZE(tcases),
+};
diff --git a/testcases/kernel/syscalls/llseek/llseek03.c b/testcases/kernel/syscalls/llseek/llseek03.c
index 4c08a8e..d780f2a 100644
--- a/testcases/kernel/syscalls/llseek/llseek03.c
+++ b/testcases/kernel/syscalls/llseek/llseek03.c
@@ -1,178 +1,126 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-
 /*
  * Description:
- * Verify that,
- *    1. llseek() succeeds to set the file pointer position to the current
- *  specified location, when 'whence' value is set to SEEK_CUR and the data
- *  read from the specified location should match the expected data.
- *    2. llseek() succeeds to set the file pointer position to the end of
- *  the file when 'whence' value set to SEEK_END and any attempts to read
- *  from that position should return 0.
  *
+ * For each of SEEK_SET, SEEK_CUR and SEEK_END verify that,
+ *
+ *   1. llseek() succeeds to set file position in the middle of the data. The
+ *      file offset is checked by reading from a file and comparing the data.
+ *
+ *   2. llseek() succeeds to set file postion to the end of the data, reading
+ *      this postion returns 0.
+ *
+ *   3. llseek() succeeds to set file position after the end of the data,
+ *      reading from this postion returns 0 as well.
  */
-
 #define _GNU_SOURCE
 
-#include <unistd.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
 #define TEST_FILE "testfile"
-
-static void setup(void);
-static void cleanup(void);
-
-static void testfunc_seekcur(void);
-static void testfunc_seekend(void);
-
-static void (*testfunc[])(void) = { testfunc_seekcur, testfunc_seekend };
-
-char *TCID = "llseek03";
-int TST_TOTAL = 2;
-
-static size_t file_size;
-
-int main(int ac, char **av)
-{
-	int i, lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++)
-			(*testfunc[i])();
-	}
-
-	cleanup();
-	tst_exit();
-}
+#define STR "abcdefgh"
 
 static void setup(void)
 {
 	int fd;
-	struct stat stat_buf;
 
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
+	fd = SAFE_CREAT(TEST_FILE, 0644);
 
-	tst_tmpdir();
+	SAFE_WRITE(1, fd, STR, sizeof(STR) - 1);
 
-	TEST_PAUSE;
-
-	fd = SAFE_CREAT(cleanup, TEST_FILE, 0644);
-
-	#define STR "abcdefgh"
-	SAFE_WRITE(cleanup, 1, fd, STR, sizeof(STR) - 1);
-
-	SAFE_FSTAT(cleanup, fd, &stat_buf);
-
-	SAFE_CLOSE(cleanup, fd);
-
-	file_size = stat_buf.st_size;
+	SAFE_CLOSE(fd);
 }
 
-static void testfunc_seekcur(void)
+static struct tcase {
+	int whence;
+	int off;
+	int ret;
+	int read;
+	const char *str;
+} tcases[] = {
+	/* Seek somewhere in the middle of data */
+	{SEEK_SET, 1, 1, 3, "bcd"},
+	{SEEK_CUR, 1, 5, 3, "fgh"},
+	{SEEK_END, -1, 7, 1, "h"},
+
+	/* Seek to the end of data */
+	{SEEK_SET, 8, 8, 0, NULL},
+	{SEEK_CUR, 4, 8, 0, NULL},
+	{SEEK_END, 0, 8, 0, NULL},
+
+	/* Seek after the end of data */
+	{SEEK_SET, 10, 10, 0, NULL},
+	{SEEK_CUR, 8, 12, 0, NULL},
+	{SEEK_END, 4, 12, 0, NULL},
+};
+
+static const char *str_whence(int whence)
 {
-	int fd;
-	static char read_buf[BUFSIZ];
-
-	/* reopen TEST_FILE and file offset will be 0 */
-	fd = SAFE_OPEN(cleanup, TEST_FILE, O_RDONLY);
-
-	/* after read, file offset will be 4 */
-	SAFE_READ(cleanup, 1, fd, read_buf, 4);
-
-	TEST(lseek64(fd, (loff_t) 1, SEEK_CUR));
-
-	if (TEST_RETURN == (loff_t) -1) {
-		tst_resm(TFAIL | TTERRNO, "llseek failed on %s ", TEST_FILE);
-		goto cleanup_seekcur;
+	switch (whence) {
+	case SEEK_SET:
+		return "SEEK_SET";
+	case SEEK_CUR:
+		return "SEEK_CUR";
+	case SEEK_END:
+		return "SEEK_END";
+	default:
+		return "INVALID";
 	}
-
-	if (TEST_RETURN != 5) {
-		tst_resm(TFAIL, "llseek return a incorrect file offset");
-		goto cleanup_seekcur;
-	}
-
-	memset(read_buf, 0, sizeof(read_buf));
-
-	/* the expected characters are "fgh" */
-	SAFE_READ(cleanup, 1, fd, read_buf, 3);
-
-	if (strcmp(read_buf, "fgh"))
-		tst_resm(TFAIL, "Read wrong bytes after llseek");
-	else
-		tst_resm(TPASS, "test SEEK_SET for llseek success");
-
-cleanup_seekcur:
-	SAFE_CLOSE(cleanup, fd);
 }
 
-
-static void testfunc_seekend(void)
+static void verify_lseek64(unsigned int n)
 {
-	int fd;
-	ssize_t nread;
-	static char read_buf[BUFSIZ];
+	struct tcase *tc = &tcases[n];
+	char read_buf[128];
+	int fd, ret;
 
-	/* reopen TEST_FILE and file offset will be 0 */
-	fd = SAFE_OPEN(cleanup, TEST_FILE, O_RDONLY);
+	fd = SAFE_OPEN(TEST_FILE, O_RDONLY);
 
-	TEST(lseek64(fd, (loff_t) 0, SEEK_END));
+	SAFE_READ(1, fd, read_buf, 4);
 
-	if (TEST_RETURN == (loff_t) -1) {
-		tst_resm(TFAIL | TTERRNO, "llseek failed on %s ", TEST_FILE);
-		goto cleanup_seekend;
+	TEST(lseek64(fd, tc->off, tc->whence));
+
+	if (TST_RET == -1) {
+                tst_res(TFAIL | TTERRNO, "llseek failed on %s ", TEST_FILE);
+                goto exit;
+        }
+
+	if (TST_RET != tc->ret) {
+                tst_res(TFAIL, "llseek returned %li expected %i", TST_RET, tc->ret);
+                goto exit;
+        } else {
+		tst_res(TPASS, "llseek returned %i", tc->ret);
 	}
 
-	if (TEST_RETURN != (long)file_size) {
-		tst_resm(TFAIL, "llseek return a incorrect file offset");
-		goto cleanup_seekend;
+        memset(read_buf, 0, sizeof(read_buf));
+
+        ret = SAFE_READ(0, fd, read_buf, tc->read);
+
+	if (!tc->read) {
+		if (ret != 0)
+			tst_res(TFAIL, "Read bytes after llseek to end of file");
+		else
+			tst_res(TPASS, "%s read returned 0", str_whence(tc->whence));
+
+		goto exit;
 	}
 
-	memset(read_buf, 0, sizeof(read_buf));
+        if (strcmp(read_buf, tc->str))
+                tst_res(TFAIL, "Read wrong bytes after llseek");
+        else
+                tst_res(TPASS, "%s for llseek", str_whence(tc->whence));
 
-	nread = SAFE_READ(cleanup, 0, fd, read_buf, file_size);
-	if (nread > 0)
-		tst_resm(TFAIL, "Read bytes after llseek to end of file");
-	else
-		tst_resm(TPASS, "test SEEK_END for llseek success");
-
-cleanup_seekend:
-	SAFE_CLOSE(cleanup, fd);
+exit:
+        SAFE_CLOSE(fd);
 }
 
-static void cleanup(void)
-{
-	tst_rmdir();
-}
+static struct tst_test test = {
+	.needs_tmpdir = 1,
+	.setup = setup,
+	.test = verify_lseek64,
+	.tcnt = ARRAY_SIZE(tcases),
+};
diff --git a/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c b/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c
index 26194f1..0c19c62 100644
--- a/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c
+++ b/testcases/kernel/syscalls/lremovexattr/lremovexattr01.c
@@ -121,7 +121,6 @@
 	.mntpoint = MNTPOINT,
 	.mount_device = 1,
 	.all_filesystems = 1,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 };
 
diff --git a/testcases/kernel/syscalls/lseek/lseek01.c b/testcases/kernel/syscalls/lseek/lseek01.c
index e7753fd..22d9fbf 100644
--- a/testcases/kernel/syscalls/lseek/lseek01.c
+++ b/testcases/kernel/syscalls/lseek/lseek01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * 06/2017 modified by Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/lseek/lseek02.c b/testcases/kernel/syscalls/lseek/lseek02.c
index 0387d63..e651d58 100644
--- a/testcases/kernel/syscalls/lseek/lseek02.c
+++ b/testcases/kernel/syscalls/lseek/lseek02.c
@@ -1,24 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  * 06/2017 modified by Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/lseek/lseek07.c b/testcases/kernel/syscalls/lseek/lseek07.c
index 5073285..ae6f48f 100644
--- a/testcases/kernel/syscalls/lseek/lseek07.c
+++ b/testcases/kernel/syscalls/lseek/lseek07.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * 06/2017 modified by Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/lseek/lseek11.c b/testcases/kernel/syscalls/lseek/lseek11.c
index 54d5da6..14435f6 100644
--- a/testcases/kernel/syscalls/lseek/lseek11.c
+++ b/testcases/kernel/syscalls/lseek/lseek11.c
@@ -1,39 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (C) 2017 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2017 Red Hat, Inc.  All rights reserved.
+ * Author: Zorro Lang <zlang@redhat.com>
  *
- *   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.
+ *  Test functional SEEK_HOLE and SEEK_DATA of lseek(2).
  *
- *   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.
+ *  Since version 3.1, Linux supports the following additional values for
+ *  whence:
  *
- *   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
+ *  SEEK_DATA
+ *       Adjust the file offset to the next location in the file greater than
+ *       or  equal  to  offset  containing data.  If offset points to data,
+ *       then the file offset is set to offset.
  *
- *   AUTHOR: Zorro Lang <zlang@redhat.com>
- *
- *   DESCRIPTION
- *     This case does functional SEEK_HOLE and SEEK_DATA of lseek(2) testing.
- *
- *     Since version 3.1, Linux supports the following additional values for
- *     whence:
- *
- *     SEEK_DATA
- *         Adjust the file offset to the next location in the file greater than
- *         or  equal  to  offset  containing data.  If offset points to data,
- *         then the file offset is set to offset.
- *
- *     SEEK_HOLE
- *         Adjust the file offset to the next hole in the file greater than or
- *         equal to offset.  If offset points into the middle of a hole, then
- *         the file offset is set to offset. If there is no hole past offset,
- *         then the file offset is adjusted to the end of the file (i.e., there
- *         is an implicit hole at the end of any file).
+ *  SEEK_HOLE
+ *       Adjust the file offset to the next hole in the file greater than or
+ *       equal to offset.  If offset points into the middle of a hole, then
+ *       the file offset is set to offset. If there is no hole past offset,
+ *       then the file offset is adjusted to the end of the file (i.e., there
+ *       is an implicit hole at the end of any file).
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/lstat/.gitignore b/testcases/kernel/syscalls/lstat/.gitignore
index 72cba87..a497a44 100644
--- a/testcases/kernel/syscalls/lstat/.gitignore
+++ b/testcases/kernel/syscalls/lstat/.gitignore
@@ -2,5 +2,3 @@
 /lstat01_64
 /lstat02
 /lstat02_64
-/lstat03
-/lstat03_64
diff --git a/testcases/kernel/syscalls/lstat/lstat01.c b/testcases/kernel/syscalls/lstat/lstat01.c
index 45a6176..becfe62 100644
--- a/testcases/kernel/syscalls/lstat/lstat01.c
+++ b/testcases/kernel/syscalls/lstat/lstat01.c
@@ -1,218 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ *  Authors:	William Roske, Dave Fenner
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
+ *  06/2019 Ported to new library:
+ *		Christian Amann <camann@suse.com>
  */
-/* $Id: lstat01.c,v 1.7 2009/10/26 14:55:48 subrata_modak Exp $ */
-/**********************************************************
+/*
+ * Basic test for lstat():
  *
- *    OS Test - Silicon Graphics, Inc.
- *
- *    TEST IDENTIFIER	: lstat01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for lstat(2)
- *
- *    PARENT DOCUMENT	: usctpl01
- *
- *    TEST CASE TOTAL	: 1
- *
- *    WALL CLOCK TIME	: 1
- *
- *    CPU TYPES		: ALL
- *
- *    AUTHOR		: William Roske
- *
- *    CO-PILOT		: Dave Fenner
- *
- *    DATE STARTED	: 03/30/92
- *
- *    INITIAL RELEASE	: UNICOS 7.0
- *
- *    TEST CASES
- *
- * 	1.) lstat(2) returns...(See Description)
- *
- *    INPUT SPECIFICATIONS
- * 	The standard options for system call tests are accepted.
- *	(See the parse_opts(3) man page).
- *
- *    OUTPUT SPECIFICATIONS
- *$
- *    DURATION
- * 	Terminates - with frequency and infinite modes.
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    RESOURCES
- * 	None
- *
- *    ENVIRONMENTAL NEEDS
- *      No run-time environmental needs.
- *
- *    SPECIAL PROCEDURAL REQUIREMENTS
- * 	None
- *
- *    INTERCASE DEPENDENCIES
- * 	None
- *
- *    DETAILED DESCRIPTION
- *	This is a Phase I test for the lstat(2) system call.  It is intended
- *	to provide a limited exposure of the system call, for now.  It
- *	should/will be extended when full functional tests are written for
- *	lstat(2).
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	  Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
+ * Tests if lstat() writes correct information about a symlink
+ * into the stat structure.
+ */
 
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/stat.h>
 #include <errno.h>
 #include <string.h>
-#include <signal.h>
-#include "test.h"
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "tst_test.h"
 
-void setup();
-void cleanup();
+#define TESTFILE        "tst_file"
+#define TESTSYML        "tst_syml"
 
-char *TCID = "lstat01";
-int TST_TOTAL = 1;
+static uid_t user_id;
+static gid_t group_id;
 
-char fname[255], lname[255], symlnk[255], buf[255];
-int fd;
-struct stat statter;
-
-int main(int ac, char **av)
+static void run(void)
 {
-	int lc;
+	struct stat stat_buf;
 
-    /***************************************************************
-     * parse standard options
-     ***************************************************************/
-	tst_parse_opts(ac, av, NULL, NULL);
+	memset(&stat_buf, 0, sizeof(stat_buf));
 
-    /***************************************************************
-     * perform global setup for test
-     ***************************************************************/
-	setup();
+	TEST(lstat(TESTSYML, &stat_buf));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO, "Calling lstat() failed");
 
-    /***************************************************************
-     * check looping state if -c option given
-     ***************************************************************/
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 *  Call lstat(2)
-		 */
-		TEST(lstat(symlnk, &statter));
-
-		/* check return code */
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL,
-				 "lstat(%s, &statter) Failed, errno=%d : %s",
-				 symlnk, TEST_ERRNO, strerror(TEST_ERRNO));
-		} else {
-			tst_resm(TPASS,
-				 "lstat(%s, &statter) returned %ld",
-				 symlnk, TEST_RETURN);
-		}
-
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void setup(void)
-{
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	sprintf(fname, "tfile_%d", getpid());
-	if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1) {
-		tst_brkm(TBROK, cleanup,
-			 "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
-			 fname, errno, strerror(errno));
-	} else if (close(fd) == -1) {
-		tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
-			 fname, errno, strerror(errno));
-	}
-
-	sprintf(symlnk, "lnfile_%d", getpid());
-	if (symlink(fname, symlnk) == -1) {
-		tst_resm(TWARN, "symlink(%s, %s) Failed, errno=%d : %s",
-			 fname, symlnk, errno, strerror(errno));
-	} else if (readlink(symlnk, buf, 255) == -1) {
-		tst_resm(TWARN, "readlink(%s, buf, 255) Failed, errno=%d : %s",
-			 symlnk, errno, strerror(errno));
-	} else if (strcmp(buf, fname) != 0) {
-		tst_resm(TWARN,
-			 "Setup Failure : Expected symbolic link contents of %s : Actual is %s",
-			 fname, buf);
+	if ((stat_buf.st_mode & S_IFMT) != S_IFLNK ||
+	    stat_buf.st_uid != user_id ||
+	    stat_buf.st_gid != group_id) {
+/*
+ * b/148414662 b/150467619
+ * Symlinks normally have a size equal to the path length but this is not true
+ * for symlinks encrypted by per-file encryption.
+ * 	    stat_buf.st_size != strlen(TESTFILE)) {
+ */
+		tst_res(TFAIL,
+			"lstat() reported incorrect values for the symlink!");
+	} else {
+		tst_res(TPASS,
+			"lstat() reported correct values for the symlink!");
 	}
 }
 
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- ***************************************************************/
-void cleanup(void)
+static void setup(void)
 {
+	user_id  = getuid();
+	group_id = getgid();
 
-	tst_rmdir();
-
+	SAFE_TOUCH(TESTFILE, 0644, NULL);
+	SAFE_SYMLINK(TESTFILE, TESTSYML);
 }
+
+static void cleanup(void)
+{
+	SAFE_UNLINK(TESTSYML);
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/lstat/lstat02.c b/testcases/kernel/syscalls/lstat/lstat02.c
index 7748670..69d6070 100644
--- a/testcases/kernel/syscalls/lstat/lstat02.c
+++ b/testcases/kernel/syscalls/lstat/lstat02.c
@@ -1,24 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *   Copyright (c) International Business Machines  Corp., 2001
  *   07/2001 Ported by Wayne Boyer
- *
- *   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
+ *   06/2019 Ported to new library: Christian Amann <camann@suse.com>
  */
 /*
- * Test Description:
- *   Verify that,
+ * This test verifies that:
+ *
  *   1) lstat(2) returns -1 and sets errno to EACCES if search permission is
  *	denied on a component of the path prefix.
  *   2) lstat(2) returns -1 and sets errno to ENOENT if the specified file
@@ -33,70 +21,60 @@
  *	many symbolic links encountered while traversing.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
 #include <errno.h>
+#include <pwd.h>
+#include <stdlib.h>
 #include <string.h>
-#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
-#include <pwd.h>
+#include "tst_test.h"
 
-#include "test.h"
-#include "safe_macros.h"
-
-#define MODE_RWX	S_IRWXU | S_IRWXG | S_IRWXO
-#define FILE_MODE	S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+#define MODE_RWX	0777
+#define MODE_RW0	0666
 #define TEST_DIR	"test_dir"
-#define TEST_EACCES	TEST_DIR"/test_eacces"
-#define TEST_ENOENT	""
-#define TEST_ENOTDIR	"test_file/test_enotdir"
+#define TEST_FILE	"test_file"
+
 #define TEST_ELOOP	"/test_eloop"
+#define TEST_ENOENT	""
+#define TEST_EACCES	TEST_DIR"/test_eacces"
+#define TEST_ENOTDIR	TEST_FILE"/test_enotdir"
 
 static char longpathname[PATH_MAX + 2];
-static char elooppathname[sizeof(TEST_ELOOP) * 43] = ".";
-
-static void setup(void);
-static void lstat_verify(int);
-static void cleanup(void);
-static void bad_addr_setup(int);
+static char elooppathname[sizeof(TEST_ELOOP) * 43];
+static struct stat stat_buf;
 
 static struct test_case_t {
 	char *pathname;
 	int exp_errno;
-	void (*setup) ();
 } test_cases[] = {
-	{TEST_EACCES, EACCES, NULL},
-	{TEST_ENOENT, ENOENT, NULL},
-	{NULL, EFAULT, bad_addr_setup},
-	{longpathname, ENAMETOOLONG, NULL},
-	{TEST_ENOTDIR, ENOTDIR, NULL},
-	{elooppathname, ELOOP, NULL},
+	{TEST_EACCES, EACCES},
+	{TEST_ENOENT, ENOENT},
+	{NULL, EFAULT},
+	{longpathname, ENAMETOOLONG},
+	{TEST_ENOTDIR, ENOTDIR},
+	{elooppathname, ELOOP},
 };
 
-char *TCID = "lstat02";
-int TST_TOTAL = ARRAY_SIZE(test_cases);
-
-int main(int ac, char **av)
+static void run(unsigned int n)
 {
-	int lc;
-	int i;
+	struct test_case_t *tc = &test_cases[n];
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	TEST(lstat(tc->pathname, &stat_buf));
 
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-		for (i = 0; i < TST_TOTAL; i++)
-			lstat_verify(i);
+	if (TST_RET != -1) {
+		tst_res(TFAIL | TTERRNO, "lstat() returned %ld, expected -1",
+			TST_RET);
+		return;
 	}
 
-	cleanup();
-	tst_exit();
+	if (tc->exp_errno == TST_ERR) {
+		tst_res(TPASS | TTERRNO, "lstat() failed as expected");
+	} else {
+		tst_res(TFAIL | TTERRNO,
+			"lstat() failed unexpectedly; expected: %s - got",
+			tst_strerrno(tc->exp_errno));
+	}
 }
 
 static void setup(void)
@@ -104,71 +82,40 @@
 	int i;
 	struct passwd *ltpuser;
 
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	ltpuser = SAFE_GETPWNAM(cleanup, "nobody");
-	SAFE_SETEUID(cleanup, ltpuser->pw_uid);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	SAFE_MKDIR(cleanup, TEST_DIR, MODE_RWX);
-	SAFE_TOUCH(cleanup, TEST_EACCES, 0666, NULL);
-	SAFE_CHMOD(cleanup, TEST_DIR, FILE_MODE);
-
-	SAFE_TOUCH(cleanup, "test_file", MODE_RWX, NULL);
+	/* Drop privileges for EACCES test */
+	if (geteuid() == 0) {
+		ltpuser = SAFE_GETPWNAM("nobody");
+		SAFE_SETEUID(ltpuser->pw_uid);
+	}
 
 	memset(longpathname, 'a', PATH_MAX+1);
+	longpathname[PATH_MAX+1] = '\0';
 
-	SAFE_MKDIR(cleanup, "test_eloop", MODE_RWX);
-	SAFE_SYMLINK(cleanup, "../test_eloop", "test_eloop/test_eloop");
+	SAFE_MKDIR(TEST_DIR, MODE_RWX);
+	SAFE_TOUCH(TEST_EACCES, MODE_RWX, NULL);
+	SAFE_TOUCH(TEST_FILE, MODE_RWX, NULL);
+	SAFE_CHMOD(TEST_DIR, MODE_RW0);
+
+	SAFE_MKDIR("test_eloop", MODE_RWX);
+	SAFE_SYMLINK("../test_eloop", "test_eloop/test_eloop");
 	/*
-	 * NOTE: the ELOOP test is written based on that the consecutive
-	 * symlinks limits in kernel is hardwired to 40.
+	 * NOTE: The ELOOP test is written based on the fact that the
+	 * consecutive symlinks limit in the kernel is hardwired to 40.
 	 */
+	elooppathname[0] = '.';
 	for (i = 0; i < 43; i++)
 		strcat(elooppathname, TEST_ELOOP);
-
-	for (i = 0; i < TST_TOTAL; i++) {
-		if (test_cases[i].setup)
-			test_cases[i].setup(i);
-	}
-}
-
-static void bad_addr_setup(int i)
-{
-	test_cases[i].pathname = tst_get_bad_addr(cleanup);
-}
-
-static void lstat_verify(int i)
-{
-	struct stat stat_buf;
-
-	TEST(lstat(test_cases[i].pathname, &stat_buf));
-
-	if (TEST_RETURN != -1) {
-		tst_resm(TFAIL, "lstat() returned %ld, expected -1, errno=%d",
-			 TEST_RETURN, test_cases[i].exp_errno);
-		return;
-	}
-
-	if (TEST_ERRNO == test_cases[i].exp_errno) {
-		tst_resm(TPASS | TTERRNO, "lstat() failed as expected");
-	} else {
-		tst_resm(TFAIL | TTERRNO,
-			 "lstat() failed unexpectedly; expected: %d - %s",
-			 test_cases[i].exp_errno,
-			 strerror(test_cases[i].exp_errno));
-	}
 }
 
 static void cleanup(void)
 {
-	if (seteuid(0))
-		tst_resm(TINFO | TERRNO, "Failet to seteuid(0) before cleanup");
-
-	tst_rmdir();
+	SAFE_CHMOD(TEST_DIR, MODE_RWX);
 }
+
+static struct tst_test test = {
+	.test = run,
+	.tcnt = ARRAY_SIZE(test_cases),
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/lstat/lstat03.c b/testcases/kernel/syscalls/lstat/lstat03.c
deleted file mode 100644
index f222812..0000000
--- a/testcases/kernel/syscalls/lstat/lstat03.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
- *
- * 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
- */
-
-/*
- * Test Name: lstat03
- *
- * Test Description:
- *  Verify that, lstat(2) succeeds to get the status of a file pointed to by
- *  symlink and fills the stat structure elements.
- *
- * Expected Result:
- *  lstat() should return value 0 on success and the stat structure elements
- *  should be filled with the symlink file information.
- */
-#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <pwd.h>
-
-#include "test.h"
-#include "safe_macros.h"
-
-#define FILE_MODE	S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
-#define TESTFILE	"testfile"
-#define SFILE		"sfile"
-#define FILE_SIZE       1024
-#define BUF_SIZE	256
-#define PERMS		0644
-
-char *TCID = "lstat03";
-int TST_TOTAL = 1;
-static uid_t user_id;
-static gid_t group_id;
-
-static char nobody_uid[] = "nobody";
-static struct passwd *ltpuser;
-
-static void setup(void);
-static void cleanup(void);
-
-int main(int ac, char **av)
-{
-	struct stat stat_buf;
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		TEST(lstat(SFILE, &stat_buf));
-
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL | TTERRNO, "lstat(%s) failed", SFILE);
-			continue;
-		}
-
-		if ((stat_buf.st_uid != user_id) ||
-		    (stat_buf.st_gid != group_id) ||
-		    ((stat_buf.st_mode & S_IFMT) != S_IFLNK) ||
-		    (stat_buf.st_size != strlen(TESTFILE))) {
-			tst_resm(TFAIL, "Functionality of lstat(2) on "
-				 "'%s' Failed", SFILE);
-		} else {
-			tst_resm(TPASS, "Functionality of lstat(2) on "
-				 "'%s' Succcessful", SFILE);
-		}
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-static void setup(void)
-{
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	tst_require_root();
-
-	ltpuser = SAFE_GETPWNAM(NULL, nobody_uid);
-	SAFE_SETUID(NULL, ltpuser->pw_uid);
-
-	TEST_PAUSE;
-
-	tst_tmpdir();
-
-	if (tst_fill_file(TESTFILE, 'a', 1024, 1))
-		tst_brkm(TBROK, cleanup, "Failed to create " TESTFILE);
-
-	SAFE_SYMLINK(cleanup, TESTFILE, SFILE);
-
-	user_id = getuid();
-	group_id = getgid();
-}
-
-static void cleanup(void)
-{
-	tst_rmdir();
-}
diff --git a/testcases/kernel/syscalls/madvise/madvise01.c b/testcases/kernel/syscalls/madvise/madvise01.c
index ae08db6..de5daf3 100644
--- a/testcases/kernel/syscalls/madvise/madvise01.c
+++ b/testcases/kernel/syscalls/madvise/madvise01.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *  Copyright (c) International Business Machines  Corp., 2004
+ *  Copyright (c) International Business Machines Corp., 2004
  *  Copyright (c) Linux Test Project, 2013-2016
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/madvise/madvise02.c b/testcases/kernel/syscalls/madvise/madvise02.c
index f0c1af9..bbc99e8 100644
--- a/testcases/kernel/syscalls/madvise/madvise02.c
+++ b/testcases/kernel/syscalls/madvise/madvise02.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *  Copyright (c) International Business Machines  Corp., 2004
+ *  Copyright (c) International Business Machines Corp., 2004
  *  Copyright (c) Linux Test Project, 2013-2016
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/madvise/madvise05.c b/testcases/kernel/syscalls/madvise/madvise05.c
index b38a12f..3ab4a87 100644
--- a/testcases/kernel/syscalls/madvise/madvise05.c
+++ b/testcases/kernel/syscalls/madvise/madvise05.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  Copyright (c) Linux Test Project, 2014
- *
- *  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 Library General Public License for more details.
  */
 /*
  * This is a regression test for madvise(2) system call. It tests kernel
@@ -57,4 +48,8 @@
 static struct tst_test test = {
 	.min_kver = "3.9.0",
 	.test_all = verify_madvise,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "ee53664bda16"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/madvise/madvise06.c b/testcases/kernel/syscalls/madvise/madvise06.c
index c40aef8..f76f3f6 100644
--- a/testcases/kernel/syscalls/madvise/madvise06.c
+++ b/testcases/kernel/syscalls/madvise/madvise06.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Red Hat, Inc.
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -61,7 +49,6 @@
 
 	pg_sz = getpagesize();
 
-	check_path(drop_caches_fname);
 	tst_res(TINFO, "dropping caches");
 	sync();
 	SAFE_FILE_PRINTF(drop_caches_fname, "3");
@@ -185,4 +172,8 @@
 	.min_kver = "3.10.0",
 	.needs_tmpdir = 1,
 	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "55231e5c898c"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/madvise/madvise07.c b/testcases/kernel/syscalls/madvise/madvise07.c
index 170642a..ca76d23 100644
--- a/testcases/kernel/syscalls/madvise/madvise07.c
+++ b/testcases/kernel/syscalls/madvise/madvise07.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Richard Palethorpe <richiejp@f-m.fm>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/madvise/madvise08.c b/testcases/kernel/syscalls/madvise/madvise08.c
index a6fd967..a2245b2 100644
--- a/testcases/kernel/syscalls/madvise/madvise08.c
+++ b/testcases/kernel/syscalls/madvise/madvise08.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Richard Palethorpe <richiejp@f-m.fm>
  * Copyright (c) 2017 SUSE LLC
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Check that memory marked with MADV_DONTDUMP is not included in a core dump
@@ -53,8 +41,11 @@
 
 static int dfd;
 static void *fmem;
-static char cpattern[CORENAME_MAX_SIZE];
-static int restore_cpattern;
+
+static const char * const save_restore[] = {
+	CORE_PATTERN,
+	NULL,
+};
 
 static void setup(void)
 {
@@ -82,10 +73,6 @@
 	if (!(0x1 & filter))
 		tst_brk(TCONF, "Anonymous private memory is not dumpable.");
 
-	SAFE_FILE_SCANF(CORE_PATTERN, "%s[^\n]", cpattern);
-	restore_cpattern = 1;
-	tst_res(TINFO, "System core pattern is '%s'", cpattern);
-
 	SAFE_GETCWD(cwd, sizeof(cwd));
 	snprintf(tmpcpattern, sizeof(tmpcpattern), "%s/dump-%%p", cwd);
 	tst_res(TINFO, "Temporary core pattern is '%s'", tmpcpattern);
@@ -111,9 +98,6 @@
 
 static void cleanup(void)
 {
-	if (restore_cpattern)
-		SAFE_FILE_PRINTF(CORE_PATTERN, "%s", cpattern);
-
 	if (fmem)
 		SAFE_MUNMAP(fmem, FMEMSIZE);
 
@@ -233,5 +217,6 @@
 	.min_kver = "3.4.0",
 	.needs_tmpdir = 1,
 	.needs_root = 1,
-	.forks_child = 1
+	.forks_child = 1,
+	.save_restore = save_restore
 };
diff --git a/testcases/kernel/syscalls/madvise/madvise09.c b/testcases/kernel/syscalls/madvise/madvise09.c
index f744405..cd55692 100644
--- a/testcases/kernel/syscalls/madvise/madvise09.c
+++ b/testcases/kernel/syscalls/madvise/madvise09.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -69,7 +57,7 @@
 
 static int swap_accounting_enabled;
 
-#define PAGES 32
+#define PAGES 128
 #define TOUCHED_PAGE1 0
 #define TOUCHED_PAGE2 10
 
diff --git a/testcases/kernel/syscalls/madvise/madvise10.c b/testcases/kernel/syscalls/madvise/madvise10.c
index ca0b9f3..d73d9aa 100644
--- a/testcases/kernel/syscalls/madvise/madvise10.c
+++ b/testcases/kernel/syscalls/madvise/madvise10.c
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 // SPDX-License-Identifier: GPL-2.0 or later
 /*
  *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
  *  Email : code@zilogic.com
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/mbind/.gitignore b/testcases/kernel/syscalls/mbind/.gitignore
index 64139f7..b78d202 100644
--- a/testcases/kernel/syscalls/mbind/.gitignore
+++ b/testcases/kernel/syscalls/mbind/.gitignore
@@ -1 +1,4 @@
 /mbind01
+/mbind02
+/mbind03
+/mbind04
diff --git a/testcases/kernel/syscalls/mbind/Makefile b/testcases/kernel/syscalls/mbind/Makefile
index 1e2f5e4..ebb1207 100644
--- a/testcases/kernel/syscalls/mbind/Makefile
+++ b/testcases/kernel/syscalls/mbind/Makefile
@@ -22,5 +22,8 @@
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
+LDLIBS  += $(NUMA_LIBS) -lltpnuma
+LDFLAGS += -L$(top_builddir)/libs/libltpnuma
+
 include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/mbind/mbind.h b/testcases/kernel/syscalls/mbind/mbind.h
new file mode 100644
index 0000000..62e749b
--- /dev/null
+++ b/testcases/kernel/syscalls/mbind/mbind.h
@@ -0,0 +1,26 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef MBIND_H__
+#define MBIND_H__
+
+static inline const char *mbind_flag_name(unsigned flag)
+{
+	switch (flag) {
+	case 0:
+		return "0";
+	case MPOL_MF_STRICT:
+		return "MPOL_MF_STRICT";
+	case MPOL_MF_MOVE:
+		return "MPOL_MF_MOVE";
+	case MPOL_MF_MOVE_ALL:
+		return "MPOL_MF_MOVE_ALL";
+	default:
+		return "???";
+	}
+}
+
+#endif /* MBIND_H__ */
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index 72345d0..cd1027c 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007-2008, Hitachi, Ltd
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
@@ -6,19 +7,6 @@
  * Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
  * Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
  * Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/mbind/mbind02.c b/testcases/kernel/syscalls/mbind/mbind02.c
new file mode 100644
index 0000000..01b3b3c
--- /dev/null
+++ b/testcases/kernel/syscalls/mbind/mbind02.c
@@ -0,0 +1,118 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * We are testing mbind() EIO error.
+ *
+ * We first fault a allocated page, then attempt to mbind it to a different node.
+ *
+ * This is a regression test for:
+ *
+ * a7f40cfe3b7a mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified
+ *
+ */
+
+#include <errno.h>
+#include "config.h"
+#ifdef HAVE_NUMA_H
+# include <numa.h>
+# include <numaif.h>
+#endif
+#include "tst_test.h"
+#include "tst_numa.h"
+
+#ifdef HAVE_NUMA_V2
+
+static size_t page_size;
+static struct tst_nodemap *nodes;
+
+static void setup(void)
+{
+	page_size = getpagesize();
+
+	nodes = tst_get_nodemap(TST_NUMA_MEM, 2 * page_size / 1024);
+	if (nodes->cnt <= 1)
+		tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
+}
+
+static void cleanup(void)
+{
+	tst_nodemap_free(nodes);
+}
+
+static void verify_policy(int mode)
+{
+	struct bitmask *bm = numa_allocate_nodemask();
+	unsigned int i;
+	void *ptr;
+	unsigned long size = page_size;
+	int node = 0;
+
+	ptr = tst_numa_map(NULL, size);
+	tst_nodemap_reset_counters(nodes);
+	tst_numa_fault(ptr, size);
+	tst_nodemap_count_pages(nodes, ptr, size);
+	tst_nodemap_print_counters(nodes);
+
+	for (i = 0; i < nodes->cnt; i++) {
+		if (!nodes->counters[i]) {
+			node = nodes->map[i];
+			tst_res(TINFO, "Attempting to bind to node %i", node);
+			numa_bitmask_setbit(bm, node);
+			break;
+		}
+	}
+
+	TEST(mbind(ptr, size, mode, bm->maskp, bm->size + 1, MPOL_MF_STRICT));
+
+	tst_numa_unmap(ptr, size);
+	numa_free_nodemask(bm);
+
+	if (TST_RET != -1) {
+		tst_res(TFAIL,
+		        "mbind(%s, MPOL_MF_STRICT) node %u returned %li, expected -1",
+		        tst_numa_mode_name(mode), node, TST_RET);
+		return;
+	}
+
+	if (TST_ERR == EIO) {
+		tst_res(TPASS | TTERRNO,
+		        "mbind(%s, MPOL_MF_STRICT) node %u",
+		        tst_numa_mode_name(mode), node);
+	} else {
+		tst_res(TFAIL | TTERRNO,
+			"mbind(%s, MPOL_MF_STRICT) node %u expected EIO",
+		        tst_numa_mode_name(mode), node);
+	}
+}
+
+static const int modes[] = {
+	MPOL_PREFERRED,
+	MPOL_BIND,
+	MPOL_INTERLEAVE,
+};
+
+static void verify_mbind(unsigned int n)
+{
+	verify_policy(modes[n]);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_mbind,
+	.tcnt = ARRAY_SIZE(modes),
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "a7f40cfe3b7a"},
+		{}
+	}
+};
+
+#else
+
+TST_TEST_TCONF(NUMA_ERROR_MSG);
+
+#endif /* HAVE_NUMA_H */
diff --git a/testcases/kernel/syscalls/mbind/mbind03.c b/testcases/kernel/syscalls/mbind/mbind03.c
new file mode 100644
index 0000000..c0750c8
--- /dev/null
+++ b/testcases/kernel/syscalls/mbind/mbind03.c
@@ -0,0 +1,127 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * We are testing mbind() MPOL_MF_MOVE and MPOL_MF_MOVE_ALL.
+ *
+ * If one of these flags is passed along with the policy kernel attempts to
+ * move already faulted pages to match the requested policy.
+ */
+
+#include <errno.h>
+#include "config.h"
+#ifdef HAVE_NUMA_H
+# include <numa.h>
+# include <numaif.h>
+# include "mbind.h"
+#endif
+#include "tst_test.h"
+#include "tst_numa.h"
+
+#ifdef HAVE_NUMA_V2
+
+static size_t page_size;
+static struct tst_nodemap *nodes;
+
+static void setup(void)
+{
+	page_size = getpagesize();
+
+	nodes = tst_get_nodemap(TST_NUMA_MEM, 2 * page_size / 1024);
+	if (nodes->cnt <= 1)
+		tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
+}
+
+static void cleanup(void)
+{
+	tst_nodemap_free(nodes);
+}
+
+static void verify_policy(int mode, unsigned flag)
+{
+	struct bitmask *bm = numa_allocate_nodemask();
+	unsigned int i;
+	void *ptr;
+	unsigned long size = page_size;
+	unsigned int node = 0;
+
+	ptr = tst_numa_map(NULL, size);
+	tst_nodemap_reset_counters(nodes);
+	tst_numa_fault(ptr, size);
+	tst_nodemap_count_pages(nodes, ptr, size);
+	tst_nodemap_print_counters(nodes);
+
+	for (i = 0; i < nodes->cnt; i++) {
+		if (!nodes->counters[i]) {
+			node = nodes->map[i];
+			tst_res(TINFO, "Attempting to move to node %i", node);
+			numa_bitmask_setbit(bm, node);
+			break;
+		}
+	}
+
+	TEST(mbind(ptr, size, mode, bm->maskp, bm->size + 1, flag));
+
+	if (TST_RET) {
+		tst_res(TFAIL | TTERRNO,
+		        "mbind(%s, %s) node %u",
+		        tst_numa_mode_name(mode), mbind_flag_name(flag), node);
+		goto exit;
+	} else {
+		tst_res(TPASS, "mbind(%s, %s) node %u succeded",
+		        tst_numa_mode_name(mode), mbind_flag_name(flag), node);
+	}
+
+	tst_nodemap_reset_counters(nodes);
+	tst_nodemap_count_pages(nodes, ptr, size);
+
+	for (i = 0; i < nodes->cnt; i++) {
+		if (nodes->map[i] == node) {
+			if (nodes->counters[i] == 1) {
+				tst_res(TPASS, "Node %u allocated %u", node, 1);
+			} else {
+				tst_res(TFAIL, "Node %u allocated %u, expected %u",
+				        node, nodes->counters[i], 0);
+			}
+			continue;
+		}
+
+		if (nodes->counters[i]) {
+			tst_res(TFAIL, "Node %u allocated %u, expected 0",
+			        i, nodes->counters[i]);
+		}
+	}
+
+exit:
+	tst_numa_unmap(ptr, size);
+	numa_free_nodemask(bm);
+}
+
+static const int modes[] = {
+	MPOL_PREFERRED,
+	MPOL_BIND,
+	MPOL_INTERLEAVE,
+};
+
+static void verify_mbind(unsigned int n)
+{
+	verify_policy(modes[n], MPOL_MF_MOVE);
+	verify_policy(modes[n], MPOL_MF_MOVE_ALL);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_mbind,
+	.tcnt = ARRAY_SIZE(modes),
+	.needs_root = 1,
+};
+
+#else
+
+TST_TEST_TCONF(NUMA_ERROR_MSG);
+
+#endif /* HAVE_NUMA_H */
diff --git a/testcases/kernel/syscalls/mbind/mbind04.c b/testcases/kernel/syscalls/mbind/mbind04.c
new file mode 100644
index 0000000..ea99666
--- /dev/null
+++ b/testcases/kernel/syscalls/mbind/mbind04.c
@@ -0,0 +1,142 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * We are testing mbind() with MPOL_BIND, MPOL_PREFERRED and MPOL_INTERLEAVE
+ *
+ * For each node with memory we set its bit in nodemask with set_mempolicy()
+ * and verify that memory has been faulted accordingly.
+ */
+
+#include <errno.h>
+#include "config.h"
+#ifdef HAVE_NUMA_H
+# include <numa.h>
+# include <numaif.h>
+# include "mbind.h"
+#endif
+#include "tst_test.h"
+#include "tst_numa.h"
+
+#ifdef HAVE_NUMA_V2
+
+static size_t page_size;
+static struct tst_nodemap *nodes;
+
+#define PAGES_ALLOCATED 16u
+
+static void setup(void)
+{
+	page_size = getpagesize();
+
+	nodes = tst_get_nodemap(TST_NUMA_MEM, 2 * PAGES_ALLOCATED * page_size / 1024);
+	if (nodes->cnt <= 1)
+		tst_brk(TCONF, "Test requires at least two NUMA memory nodes");
+}
+
+static void cleanup(void)
+{
+	tst_nodemap_free(nodes);
+}
+
+static void verify_policy(unsigned int node, int mode, unsigned flag)
+{
+	struct bitmask *bm = numa_allocate_nodemask();
+	unsigned int i;
+	void *ptr;
+	pid_t pid;
+	unsigned long size = PAGES_ALLOCATED * page_size;
+
+	numa_bitmask_setbit(bm, node);
+
+	ptr = tst_numa_map(NULL, size);
+
+	TEST(mbind(ptr, size, mode, bm->maskp, bm->size + 1, flag));
+
+	numa_free_nodemask(bm);
+
+	if (TST_RET) {
+		tst_res(TFAIL | TTERRNO,
+		        "mbind(%s, %s) node %u",
+		        tst_numa_mode_name(mode), mbind_flag_name(flag), node);
+		return;
+	}
+
+	tst_res(TPASS, "mbind(%s, %s) node %u",
+	        tst_numa_mode_name(mode), mbind_flag_name(flag), node);
+
+	const char *prefix = "child: ";
+
+	pid = SAFE_FORK();
+	if (pid) {
+		prefix = "parent: ";
+		tst_reap_children();
+	}
+
+	tst_nodemap_reset_counters(nodes);
+	tst_numa_fault(ptr, size);
+	tst_nodemap_count_pages(nodes, ptr, size);
+	tst_numa_unmap(ptr, size);
+
+	int fail = 0;
+
+	for (i = 0; i < nodes->cnt; i++) {
+		if (nodes->map[i] == node) {
+			if (nodes->counters[i] == PAGES_ALLOCATED) {
+				tst_res(TPASS, "%sNode %u allocated %u",
+				        prefix, node, PAGES_ALLOCATED);
+			} else {
+				tst_res(TFAIL, "%sNode %u allocated %u, expected %u",
+				        prefix, node, nodes->counters[i],
+				        PAGES_ALLOCATED);
+				fail = 1;
+			}
+			continue;
+		}
+
+		if (nodes->counters[i]) {
+			tst_res(TFAIL, "%sNode %u allocated %u, expected 0",
+			        prefix, i, nodes->counters[i]);
+			fail = 1;
+		}
+	}
+
+	if (fail)
+		tst_nodemap_print_counters(nodes);
+
+	if (!pid)
+		exit(0);
+}
+
+static const int modes[] = {
+	MPOL_PREFERRED,
+	MPOL_BIND,
+	MPOL_INTERLEAVE,
+};
+
+static void verify_mbind(unsigned int n)
+{
+	unsigned int i;
+
+	for (i = 0; i < nodes->cnt; i++) {
+		verify_policy(nodes->map[i], modes[n], 0);
+		verify_policy(nodes->map[i], modes[n], MPOL_MF_STRICT);
+	}
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_mbind,
+	.tcnt = ARRAY_SIZE(modes),
+	.forks_child = 1,
+};
+
+#else
+
+TST_TEST_TCONF(NUMA_ERROR_MSG);
+
+#endif /* HAVE_NUMA_H */
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create01.c b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
index 6a84899..fdd37f6 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create01.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create01.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017  Red Hat, Inc.
- *
- * 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 would 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.
- *
  */
 
 /*
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create02.c b/testcases/kernel/syscalls/memfd_create/memfd_create02.c
index 80cd5c4..f547e14 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create02.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create02.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017  Red Hat, Inc.
- *
- * 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 would 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.
- *
  */
 
  /*
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create03.c b/testcases/kernel/syscalls/memfd_create/memfd_create03.c
index d92033a..0502a2d 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create03.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create03.c
@@ -1,18 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
  *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
  *  Email: code@zilogic.com
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create04.c b/testcases/kernel/syscalls/memfd_create/memfd_create04.c
index cbbdc5f..659431c 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create04.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create04.c
@@ -1,18 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-License-Identifier: GPL-2.0-or-later
 
 /*
  *  Copyright (c) Zilogic Systems Pvt. Ltd., 2018
  *  Email: code@zilogic.com
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
index 7a84eba..a52b02a 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
@@ -1,16 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017  Red Hat, Inc.
- *
- * 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 would 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.
- *
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
index f5623b1..e6e2fdf 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages02.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2012 Linux Test Project, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it
- * is free of the rightful claim of any third person regarding
- * infringement or the like.  Any license provided herein, whether
- * implied or otherwise, applies only to this software file.  Patent
- * licenses, if any, provided herein do not apply to combinations of
- * this program with other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages03.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages03.c
index 7317b11..c6afb4c 100644
--- a/testcases/kernel/syscalls/migrate_pages/migrate_pages03.c
+++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages03.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
  * Author(s): Xiao Yang <yangx.jy@cn.fujitsu.com>
  *            Jie Fei <feij.fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -151,6 +139,10 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = migrate_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "4b0ece6fa016"},
+		{}
+	}
 };
 
 #else
diff --git a/testcases/kernel/syscalls/mkdir/mkdir02.c b/testcases/kernel/syscalls/mkdir/mkdir02.c
index 000cded..f09e3c3 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir02.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*  DESCRIPTION
diff --git a/testcases/kernel/syscalls/mkdir/mkdir03.c b/testcases/kernel/syscalls/mkdir/mkdir03.c
index 8cadf9c..d5141bb 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir03.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir03.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (c) International Business Machines  Corp., 2001
- *	07/2001 Ported by Wayne Boyer
- *
- *   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.
+ *   Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 /*
  * DESCRIPTION
@@ -100,7 +87,6 @@
 
 static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(TC),
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.needs_rofs = 1,
 	.mntpoint = MNT_POINT,
diff --git a/testcases/kernel/syscalls/mkdir/mkdir04.c b/testcases/kernel/syscalls/mkdir/mkdir04.c
index 5b65198..87512a4 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir04.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir04.c
@@ -1,17 +1,5 @@
-/* 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, see <http://www.gnu.org/licenses/>.
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/mkdir/mkdir05.c b/testcases/kernel/syscalls/mkdir/mkdir05.c
index bc029c3..5cd125d 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir05.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir05.c
@@ -1,18 +1,6 @@
-/* Copyright (c) International Business Machines  Corp., 2001
- * 07/2001 Ported by Wayne Boyer
- *
- * 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, see <http://www.gnu.org/licenses/>.
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /* DESCRIPTION
diff --git a/testcases/kernel/syscalls/mkdirat/mkdirat02.c b/testcases/kernel/syscalls/mkdirat/mkdirat02.c
index fbe172e..ebc0ed1 100644
--- a/testcases/kernel/syscalls/mkdirat/mkdirat02.c
+++ b/testcases/kernel/syscalls/mkdirat/mkdirat02.c
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 /*
  * DESCRIPTION
diff --git a/testcases/kernel/syscalls/mmap/mmap12.c b/testcases/kernel/syscalls/mmap/mmap12.c
index 05ace6a..2c0ebfb 100644
--- a/testcases/kernel/syscalls/mmap/mmap12.c
+++ b/testcases/kernel/syscalls/mmap/mmap12.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2013 FNST, DAN LI <li.dan@cn.fujitsu.com>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/move_pages/.gitignore b/testcases/kernel/syscalls/move_pages/.gitignore
index 419829d..2d1785e 100644
--- a/testcases/kernel/syscalls/move_pages/.gitignore
+++ b/testcases/kernel/syscalls/move_pages/.gitignore
@@ -5,7 +5,6 @@
 /move_pages05
 /move_pages06
 /move_pages07
-/move_pages08
 /move_pages09
 /move_pages10
 /move_pages11
diff --git a/testcases/kernel/syscalls/move_pages/move_pages08.c b/testcases/kernel/syscalls/move_pages/move_pages08.c
deleted file mode 100644
index e1bf64b..0000000
--- a/testcases/kernel/syscalls/move_pages/move_pages08.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *   Copyright (c) 2008 Vijay Kumar B. <vijaykumar@bravegnu.org>
- *
- *   Based on testcases/kernel/syscalls/waitpid/waitpid01.c
- *   Original copyright message:
- *
- *   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
- */
-
-/*
- * NAME
- *	move_pages08.c
- *
- * DESCRIPTION
- *      Failure when the no. of pages is ULONG_MAX.
- *
- * ALGORITHM
- *
- *      1. Pass ULONG_MAX pages to move_pages().
- *      2. Check if errno is set to E2BIG.
- *
- * USAGE:  <for command-line>
- *      move_pages08 [-c n] [-i n] [-I x] [-P x] [-t]
- *      where,  -c n : Run n copies concurrently.
- *              -i n : Execute test n times.
- *              -I x : Execute test for x seconds.
- *              -P x : Pause for x seconds between iterations.
- *              -t   : Turn on syscall timing.
- *
- * History
- *	05/2008 Vijay Kumar
- *		Initial Version.
- *
- * Restrictions
- *	kernel < 2.6.29
- */
-
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <errno.h>
-#include <limits.h>
-#include "test.h"
-#include "move_pages_support.h"
-
-#define TEST_PAGES 2
-#define TEST_NODES 2
-
-static void setup(void);
-static void cleanup(void);
-
-char *TCID = "move_pages08";
-int TST_TOTAL = 1;
-
-int main(int argc, char **argv)
-{
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-#ifdef HAVE_NUMA_V2
-	unsigned int i;
-	int lc;
-	unsigned int from_node;
-	unsigned int to_node;
-	int ret;
-
-	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
-	if (ret < 0)
-		tst_brkm(TBROK | TERRNO, cleanup, "get_allowed_nodes: %d", ret);
-
-	/* check for looping state if -i option is given */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		void *pages[TEST_PAGES] = { 0 };
-		int nodes[TEST_PAGES];
-		int status[TEST_PAGES];
-
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		ret = alloc_pages_on_node(pages, TEST_PAGES, from_node);
-		if (ret == -1)
-			continue;
-
-		for (i = 0; i < TEST_PAGES; i++)
-			nodes[i] = to_node;
-
-		ret = numa_move_pages(0, ULONG_MAX, pages, nodes,
-				      status, MPOL_MF_MOVE);
-		if (ret == -1 && errno == E2BIG)
-			tst_resm(TPASS, "move_pages failed with "
-				 "E2BIG as expected");
-		else
-			tst_resm(TFAIL|TERRNO, "move pages did not fail "
-				 "with E2BIG ret: %d", ret);
-
-		free_pages(pages, TEST_PAGES);
-	}
-#else
-	tst_resm(TCONF, NUMA_ERROR_MSG);
-#endif
-
-	cleanup();
-	tst_exit();
-
-}
-
-/*
- * setup() - performs all ONE TIME setup for this test
- */
-static void setup(void)
-{
-	/*
-	 * commit 3140a2273009c01c27d316f35ab76a37e105fdd8
-	 * Author: Brice Goglin <Brice.Goglin@inria.fr>
-	 * Date:   Tue Jan 6 14:38:57 2009 -0800
-	 *     mm: rework do_pages_move() to work on page_sized chunks
-	 *
-	 * reworked do_pages_move() to work by page-sized chunks and removed E2BIG
-	 */
-	if ((tst_kvercmp(2, 6, 29)) >= 0)
-		tst_brkm(TCONF, NULL, "move_pages: E2BIG was removed in "
-			 "commit 3140a227");
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	check_config(TEST_NODES);
-
-	/* Pause if that option was specified
-	 * TEST_PAUSE contains the code to fork the test with the -c option.
-	 */
-	TEST_PAUSE;
-}
-
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at completion
- */
-static void cleanup(void)
-{
-
-}
diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index 04fda8b..c906acb 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -1,35 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) 2016 Fujitsu Ltd.
+ *  Copyright (c) 2016-2019 FUJITSU LIMITED. All rights reserved.
  *  Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
  *  Ported: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
+ *  Ported: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ *  Ported: Yang Xu <xuyang2018.jy@cn.jujitsu.com>
  */
 
 /*
- * This is a regression test for the race condition between move_pages()
- * and freeing hugepages, where move_pages() calls follow_page(FOLL_GET)
- * for hugepages internally and tries to get its refcount without
- * preventing concurrent freeing.
+ * Description:
  *
- * This test can crash the buggy kernel, and the bug was fixed in:
+ * Test #1:
+ *  This is a regression test for the race condition between move_pages()
+ *  and freeing hugepages, where move_pages() calls follow_page(FOLL_GET)
+ *  for hugepages internally and tries to get its refcount without
+ *  preventing concurrent freeing.
  *
- *  commit e66f17ff71772b209eed39de35aaa99ba819c93d
- *  Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
- *  Date:   Wed Feb 11 15:25:22 2015 -0800
+ *  This test can crash the buggy kernel, and the bug was fixed in:
  *
- *  mm/hugetlb: take page table lock in follow_huge_pmd()
+ *   commit e66f17ff71772b209eed39de35aaa99ba819c93d
+ *   Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+ *   Date:   Wed Feb 11 15:25:22 2015 -0800
+ *
+ *   mm/hugetlb: take page table lock in follow_huge_pmd()
+ *
+ *  Test #2:
+ *   #2.1:
+ *   This is a regression test for the race condition, where move_pages()
+ *   and soft offline are called on a single hugetlb page concurrently.
+ *
+ *   This bug can crash the buggy kernel, and was fixed by:
+ *
+ *   commit c9d398fa237882ea07167e23bcfc5e6847066518
+ *   Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+ *   Date:   Fri Mar 31 15:11:55 2017 -0700
+ *
+ *   mm, hugetlb: use pte_present() instead of pmd_present() in
+ *   follow_huge_pmd()
+ *
+ *   #2.2:
+ *   This is also a regression test for an race condition causing SIGBUS
+ *   in hugepage migration/fault.
+ *
+ *   This bug was fixed by:
+ *
+ *   commit 4643d67e8cb0b3536ef0ab5cddd1cedc73fa14ad
+ *   Author: Mike Kravetz <mike.kravetz@oracle.com>
+ *   Date:   Tue Aug 13 15:38:00 2019 -0700
+ *
+ *   hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS
+ *
  */
 
 #include <errno.h>
@@ -49,9 +69,16 @@
 #define PATH_MEMINFO	"/proc/meminfo"
 #define PATH_NR_HUGEPAGES	"/proc/sys/vm/nr_hugepages"
 #define PATH_HUGEPAGES	"/sys/kernel/mm/hugepages/"
-#define TEST_PAGES	2
 #define TEST_NODES	2
 
+static struct tcase {
+	int tpages;
+	int offline;
+} tcases[] = {
+	{2, 0},
+	{2, 1},
+};
+
 static int pgsz, hpsz;
 static long orig_hugepages = -1;
 static char path_hugepages_node1[PATH_MAX];
@@ -61,9 +88,19 @@
 static unsigned int node1, node2;
 static void *addr;
 
-static void do_child(void)
+static int do_soft_offline(int tpgs)
 {
-	int test_pages = TEST_PAGES * hpsz / pgsz;
+	if (madvise(addr, tpgs * hpsz, MADV_SOFT_OFFLINE) == -1) {
+		if (errno != EINVAL && errno != EBUSY)
+			tst_res(TFAIL | TERRNO, "madvise failed");
+		return errno;
+	}
+	return 0;
+}
+
+static void do_child(int tpgs)
+{
+	int test_pages = tpgs * hpsz / pgsz;
 	int i, j;
 	int *nodes, *status;
 	void **pages;
@@ -88,6 +125,9 @@
 		TEST(numa_move_pages(ppid, test_pages,
 			pages, nodes, status, MPOL_MF_MOVE_ALL));
 		if (TST_RET < 0) {
+			if (errno == ENOMEM)
+				continue;
+
 			tst_res(TFAIL | TTERRNO, "move_pages failed");
 			break;
 		}
@@ -96,34 +136,56 @@
 	exit(0);
 }
 
-static void do_test(void)
+static void do_test(unsigned int n)
 {
-	int i;
+	int i, ret;
+	void *ptr;
 	pid_t cpid = -1;
 	int status;
 	unsigned int twenty_percent = (tst_timeout_remaining() / 5);
 
-	addr = SAFE_MMAP(NULL, TEST_PAGES * hpsz, PROT_READ | PROT_WRITE,
+	addr = SAFE_MMAP(NULL, tcases[n].tpages * hpsz, PROT_READ | PROT_WRITE,
 		MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
 
-	SAFE_MUNMAP(addr, TEST_PAGES * hpsz);
+	SAFE_MUNMAP(addr, tcases[n].tpages * hpsz);
 
 	cpid = SAFE_FORK();
 	if (cpid == 0)
-		do_child();
+		do_child(tcases[n].tpages);
 
 	for (i = 0; i < LOOPS; i++) {
-		void *ptr;
+		ptr = mmap(NULL, tcases[n].tpages * hpsz,
+				PROT_READ | PROT_WRITE,
+				MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
+		if (ptr == MAP_FAILED) {
+			if (i == 0)
+				tst_brk(TBROK | TERRNO, "Cannot allocate hugepage");
 
-		ptr = SAFE_MMAP(NULL, TEST_PAGES * hpsz,
-			PROT_READ | PROT_WRITE,
-			MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
+			if (errno == ENOMEM) {
+				usleep(1000);
+				continue;
+			}
+		}
+
 		if (ptr != addr)
 			tst_brk(TBROK, "Failed to mmap at desired addr");
 
-		memset(addr, 0, TEST_PAGES * hpsz);
+		memset(addr, 0, tcases[n].tpages * hpsz);
 
-		SAFE_MUNMAP(addr, TEST_PAGES * hpsz);
+		if (tcases[n].offline) {
+			ret = do_soft_offline(tcases[n].tpages);
+
+			if (ret == EINVAL) {
+				SAFE_KILL(cpid, SIGKILL);
+				SAFE_WAITPID(cpid, &status, 0);
+				SAFE_MUNMAP(addr, tcases[n].tpages * hpsz);
+				tst_res(TCONF,
+					"madvise() didn't support MADV_SOFT_OFFLINE");
+				return;
+			}
+		}
+
+		SAFE_MUNMAP(addr, tcases[n].tpages * hpsz);
 
 		if (tst_timeout_remaining() < twenty_percent)
 			break;
@@ -266,7 +328,14 @@
 	.forks_child = 1,
 	.setup = setup,
 	.cleanup = cleanup,
-	.test_all = do_test,
+	.test = do_test,
+	.tcnt = ARRAY_SIZE(tcases),
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "e66f17ff7177"},
+		{"linux-git", "c9d398fa2378"},
+		{"linux-git", "4643d67e8cb0"},
+		{}
+	}
 };
 
 #else
diff --git a/testcases/kernel/syscalls/mprotect/mprotect04.c b/testcases/kernel/syscalls/mprotect/mprotect04.c
index a014ab6..1a0fa0e 100644
--- a/testcases/kernel/syscalls/mprotect/mprotect04.c
+++ b/testcases/kernel/syscalls/mprotect/mprotect04.c
@@ -128,33 +128,6 @@
 	SAFE_MUNMAP(cleanup, addr, page_sz);
 }
 
-#ifdef __ia64__
-
-static char exec_func[] __attribute__ ((aligned (64))) = {
-	0x11, 0x00, 0x00, 0x00, 0x01, 0x00, /* nop.m 0x0             */
-	0x00, 0x00, 0x00, 0x02, 0x00, 0x80, /* nop.i 0x0             */
-	0x08, 0x00, 0x84, 0x00,             /* br.ret.sptk.many b0;; */
-};
-
-struct func_desc {
-	uint64_t func_addr;
-	uint64_t glob_pointer;
-};
-
-static __attribute__((noinline)) void *get_func(void *mem)
-{
-	static struct func_desc fdesc;
-
-	memcpy(mem, exec_func, sizeof(exec_func));
-
-	fdesc.func_addr = (uint64_t)mem;
-	fdesc.glob_pointer = 0;
-
-	return &fdesc;
-}
-
-#else
-
 static void exec_func(void)
 {
 	return;
@@ -251,8 +224,6 @@
 	return func_copy_start;
 }
 
-#endif
-
 static void testfunc_protexec(void)
 {
 	func_ptr_t func;
diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
index c1d789d..9083e0d 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007-2008, Hitachi, Ltd
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
@@ -6,19 +7,6 @@
  * Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
  * Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
  * Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <limits.h>
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c
index 58067cf..cd2a229 100644
--- a/testcases/kernel/syscalls/mq_open/mq_open01.c
+++ b/testcases/kernel/syscalls/mq_open/mq_open01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd
  *          Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
  *		       Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
  *		       Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c b/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
index 8c9126d..af79d95 100644
--- a/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
+++ b/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd
  *          Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
  *		       Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
  *		       Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/msync/msync04.c b/testcases/kernel/syscalls/msync/msync04.c
index 9dec3c1..dad07b2 100644
--- a/testcases/kernel/syscalls/msync/msync04.c
+++ b/testcases/kernel/syscalls/msync/msync04.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2017 Red Hat, Inc.
  *
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -105,7 +93,6 @@
 	.test_all = test_msync,
 	.setup = setup,
 	.cleanup = cleanup,
-	.needs_tmpdir = 1,
 	.needs_root = 1,
 	.mntpoint = "msync04",
 	.mount_device = 1,
diff --git a/testcases/kernel/syscalls/nanosleep/.gitignore b/testcases/kernel/syscalls/nanosleep/.gitignore
index 11ed6bb..9bf03ea 100644
--- a/testcases/kernel/syscalls/nanosleep/.gitignore
+++ b/testcases/kernel/syscalls/nanosleep/.gitignore
@@ -1,4 +1,3 @@
 /nanosleep01
 /nanosleep02
-/nanosleep03
 /nanosleep04
diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep01.c b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
index 96e1cf1..567be8c 100644
--- a/testcases/kernel/syscalls/nanosleep/nanosleep01.c
+++ b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) International Business Machines  Corp., 2001
  *  07/2001 Ported by Wayne Boyer
  * Copyright (C) 2015-2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
@@ -25,7 +12,6 @@
  */
 
 #include <errno.h>
-
 #include "tst_timer_test.h"
 
 int sample_fn(int clk_id, long long usec)
diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep02.c b/testcases/kernel/syscalls/nanosleep/nanosleep02.c
index 8bd2c44..e72319f 100644
--- a/testcases/kernel/syscalls/nanosleep/nanosleep02.c
+++ b/testcases/kernel/syscalls/nanosleep/nanosleep02.c
@@ -10,6 +10,9 @@
  *  Verify that nanosleep() will be successful to suspend the execution
  *  of a process, returns after the receipt of a signal and writes the
  *  remaining sleep time into the structure.
+ *
+ *  This test also verifies that if the call is interrupted by a signal
+ *  handler, nanosleep() returns -1, sets errno to EINTR.
  */
 
 #include <errno.h>
@@ -39,10 +42,19 @@
 	TEST(nanosleep(&timereq, &timerem));
 	tst_timer_stop();
 
-	if (!TST_RET)
-		tst_brk(TBROK, "nanosleep was not interrupted");
-	if (TST_ERR != EINTR)
-		tst_brk(TBROK | TTERRNO, "nanosleep() failed");
+	if (TST_RET != -1) {
+		tst_res(TFAIL,
+			"nanosleep was not interrupted, returned %ld, expected -1",
+			TST_RET);
+		return;
+	}
+	if (TST_ERR != EINTR) {
+		tst_res(TFAIL | TTERRNO,
+			"nanosleep() failed, expected EINTR, got");
+		return;
+	}
+
+	tst_res(TPASS, "nanosleep() returned -1, set errno to EINTR");
 
 	if (tst_timespec_lt(timereq, tst_timer_elapsed()))
 		tst_brk(TFAIL, "nanosleep() slept more than timereq");
diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep03.c b/testcases/kernel/syscalls/nanosleep/nanosleep03.c
deleted file mode 100644
index 456e140..0000000
--- a/testcases/kernel/syscalls/nanosleep/nanosleep03.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
- *
- * 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
- */
-
-/*
- * Test Description:
- *  Verify that nanosleep() will fail to suspend the execution
- *  of a process for a specified time if interrupted by a non-blocked signal.
- *
- * Expected Result:
- *  nanosleep() should return with -1 value and sets errno to EINTR.
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "safe_macros.h"
-
-char *TCID = "nanosleep03";
-int TST_TOTAL = 1;
-
-static void do_child(void);
-static void setup(void);
-static void sig_handler();
-
-int main(int ac, char **av)
-{
-	int lc;
-	pid_t cpid;
-	int status;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-#ifdef UCLINUX
-	maybe_run_child(&do_child, "dddd", &timereq.tv_sec, &timereq.tv_nsec,
-			&timerem.tv_sec, &timerem.tv_nsec);
-#endif
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		/*
-		 * Creat a child process and suspend its
-		 * execution using nanosleep()
-		 */
-		if ((cpid = FORK_OR_VFORK()) == -1)
-			tst_brkm(TBROK, NULL, "fork() failed");
-
-		if (cpid == 0) {
-#ifdef UCLINUX
-			if (self_exec(av[0], "dddd",
-				      timereq.tv_sec, timereq.tv_nsec,
-				      timerem.tv_sec, timerem.tv_nsec) < 0) {
-				tst_brkm(TBROK, NULL, "self_exec failed");
-			}
-#else
-			do_child();
-#endif
-		}
-
-		sleep(1);
-
-		/* Now send signal to child */
-		SAFE_KILL(NULL, cpid, SIGINT);
-
-		/* Wait for child to execute */
-		wait(&status);
-		if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
-			tst_resm(TPASS, "nanosleep() failed, interrupted"
-				 " by signal (%d) as expected", EINTR);
-		} else {
-			tst_resm(TFAIL, "child process exited abnormally; "
-				 "status = %d", status);
-		}
-	}
-
-	tst_exit();
-}
-
-static void do_child(void)
-{
-	struct timespec timereq = {.tv_sec = 5, .tv_nsec = 9999};
-	struct timespec timerem;
-
-	/*
-	 * Call nanosleep() to suspend child process
-	 * for specified time 'tv_sec'.
-	 * Call should return before suspending execution
-	 * for the specified time due to receipt of signal
-	 * from Parent.
-	 */
-	TEST(nanosleep(&timereq, &timerem));
-
-	if (TEST_RETURN == -1) {
-
-		/* Check for expected errno is set */
-		if (TEST_ERRNO != EINTR) {
-			tst_resm(TFAIL | TTERRNO,
-				 "nanosleep() failed; expected errno: %d",
-				 EINTR);
-			exit(1);
-		}
-	} else {
-		tst_resm(TFAIL, "nanosleep() returns %ld, "
-			 "expected -1, errno:%d", TEST_RETURN, EINTR);
-		exit(1);
-	}
-
-	exit(0);
-}
-
-static void setup(void)
-{
-	tst_sig(FORK, DEF_HANDLER, NULL);
-
-	TEST_PAUSE;
-
-	if (signal(SIGINT, sig_handler) == SIG_ERR) {
-		tst_brkm(TBROK, NULL,
-			 "signal() fails to setup signal handler");
-	}
-
-}
-
-static void sig_handler(void)
-{
-}
diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep04.c b/testcases/kernel/syscalls/nanosleep/nanosleep04.c
index f5108d0..4eed9d0 100644
--- a/testcases/kernel/syscalls/nanosleep/nanosleep04.c
+++ b/testcases/kernel/syscalls/nanosleep/nanosleep04.c
@@ -1,20 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) International Business Machines  Corp., 2001
  *  07/2001 Ported by Wayne Boyer
  *
- * 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
+ * Ported to new library:
+ * 07/2019    Yang Xu <xuyang2018.jy@cn.fujitsu.com>
  */
 
 /*
@@ -27,60 +17,36 @@
  */
 
 #include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/wait.h>
 #include <time.h>
-
-#include "test.h"
+#include "tst_test.h"
 
 static struct timespec tcases[] = {
 	{.tv_sec = -5, .tv_nsec = 9999},
 	{.tv_sec = 0, .tv_nsec = 1000000000},
+	{.tv_sec = 1, .tv_nsec = -100},
 };
 
-char *TCID = "nanosleep04";
-int TST_TOTAL = ARRAY_SIZE(tcases);
-
-static void setup(void);
-
-static void verify_nanosleep(struct timespec *tcase)
+static void verify_nanosleep(unsigned int n)
 {
-	TEST(nanosleep(tcase, NULL));
+	TEST(nanosleep(&tcases[n], NULL));
 
-	if (TEST_RETURN != -1) {
-		tst_resm(TFAIL, "nanosleep() succeded unexpectedly");
+	if (TST_RET != -1) {
+		tst_res(TFAIL,
+		        "nanosleep() returned %ld, expected -1", TST_RET);
 		return;
 	}
 
-	if (TEST_ERRNO != EINVAL) {
-		tst_resm(TFAIL | TTERRNO,
-		         "nanosleep() expected failure with EINVAL");
+	if (TST_ERR != EINVAL) {
+		tst_res(TFAIL | TTERRNO,
+			"nanosleep() failed,expected EINVAL, got");
 		return;
 	}
 
-	tst_resm(TPASS, "nanoslep() failed with EINVAL");
+	tst_res(TPASS, "nanosleep() failed with EINVAL");
 }
 
-int main(int ac, char **av)
-{
-	int lc, i;
+static struct tst_test test = {
+	.test = verify_nanosleep,
+	.tcnt = ARRAY_SIZE(tcases),
+};
 
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		for (i = 0; i < TST_TOTAL; i++)
-			verify_nanosleep(&tcases[i]);
-	}
-
-	tst_exit();
-}
-
-static void setup(void)
-{
-	tst_sig(FORK, DEF_HANDLER, NULL);
-
-	TEST_PAUSE;
-}
diff --git a/testcases/kernel/syscalls/nice/nice01.c b/testcases/kernel/syscalls/nice/nice01.c
index 82791a5..04ca17a 100644
--- a/testcases/kernel/syscalls/nice/nice01.c
+++ b/testcases/kernel/syscalls/nice/nice01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/nice/nice02.c b/testcases/kernel/syscalls/nice/nice02.c
index 03fd171..65c6122 100644
--- a/testcases/kernel/syscalls/nice/nice02.c
+++ b/testcases/kernel/syscalls/nice/nice02.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  *  Verify that any user can successfully increase the nice value of
diff --git a/testcases/kernel/syscalls/nice/nice03.c b/testcases/kernel/syscalls/nice/nice03.c
index 1720017..6047dd4 100644
--- a/testcases/kernel/syscalls/nice/nice03.c
+++ b/testcases/kernel/syscalls/nice/nice03.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  *  Verify that any user can successfully increase the nice value of
diff --git a/testcases/kernel/syscalls/nice/nice04.c b/testcases/kernel/syscalls/nice/nice04.c
index 56d76f8..1d64311 100644
--- a/testcases/kernel/syscalls/nice/nice04.c
+++ b/testcases/kernel/syscalls/nice/nice04.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *  07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  *  Verify that, nice(2) fails when, a non-root user attempts to increase
diff --git a/testcases/kernel/syscalls/open/open01.c b/testcases/kernel/syscalls/open/open01.c
index cecb77e..c689a4b 100644
--- a/testcases/kernel/syscalls/open/open01.c
+++ b/testcases/kernel/syscalls/open/open01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (c) International Business Machines  Corp., 2001
- *    07/2001 Ported by Wayne Boyer
+ *   Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  *    06/2017 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- *   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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/open/open02.c b/testcases/kernel/syscalls/open/open02.c
index 4b1f5b4..7195b1b 100644
--- a/testcases/kernel/syscalls/open/open02.c
+++ b/testcases/kernel/syscalls/open/open02.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *	07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  *	06/2017 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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
  */
 /*
  * DESCRIPTION
diff --git a/testcases/kernel/syscalls/open/open08.c b/testcases/kernel/syscalls/open/open08.c
index fb19a80..29a23c2 100644
--- a/testcases/kernel/syscalls/open/open08.c
+++ b/testcases/kernel/syscalls/open/open08.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *   Copyright (c) 2013 Wanlong Gao <gaowanlong@cn.fujitsu.com>
  *   Copyright (c) 2018 Linux Test Project
- *
- *   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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/pause/pause01.c b/testcases/kernel/syscalls/pause/pause01.c
index 3afa789..d44e797 100644
--- a/testcases/kernel/syscalls/pause/pause01.c
+++ b/testcases/kernel/syscalls/pause/pause01.c
@@ -1,17 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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.
- *
- * Check that pause() returns on signal with errno == EINTR.
  */
 #include <errno.h>
 #include <signal.h>
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
index 95e3051..7fb9183 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -1,137 +1,56 @@
-/******************************************************************************/
-/*                                                                            */
-/* Paul Mackerras <paulus@samba.org>, 2009                                    */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/******************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
-Here's a little test program that checks whether software counters
-(specifically, the task clock counter) work correctly when they're in
-a group with hardware counters.
+ * Copyright (c) 2009 Paul Mackerras <paulus@samba.org>
+ * Copyright (c) 2019 Linux Test Project
+ */
+/*
+ * Here's a little test program that checks whether software counters
+ * (specifically, the task clock counter) work correctly when they're in
+ * a group with hardware counters.
+ *
+ * What it does is to create several groups, each with one hardware
+ * counter, counting instructions, plus a task clock counter.  It needs
+ * to know an upper bound N on the number of hardware counters you have
+ * (N defaults to 8), and it creates N+4 groups to force them to be
+ * multiplexed.  It also creates an overall task clock counter.
+ *
+ * Then it spins for a while, and then stops all the counters and reads
+ * them.  It takes the total of the task clock counters in the groups and
+ * computes the ratio of that total to the overall execution time from
+ * the overall task clock counter.
+ *
+ * That ratio should be equal to the number of actual hardware counters
+ * that can count instructions.  If the task clock counters in the groups
+ * don't stop when their group gets taken off the PMU, the ratio will
+ * instead be close to N+4.  The program will declare that the test fails
+ * if the ratio is greater than N (actually, N + 0.0001 to allow for FP
+ * rounding errors).
+ */
 
-What it does is to create several groups, each with one hardware
-counter, counting instructions, plus a task clock counter.  It needs
-to know an upper bound N on the number of hardware counters you have
-(N defaults to 8), and it creates N+4 groups to force them to be
-multiplexed.  It also creates an overall task clock counter.
-
-Then it spins for a while, and then stops all the counters and reads
-them.  It takes the total of the task clock counters in the groups and
-computes the ratio of that total to the overall execution time from
-the overall task clock counter.
-
-That ratio should be equal to the number of actual hardware counters
-that can count instructions.  If the task clock counters in the groups
-don't stop when their group gets taken off the PMU, the ratio will
-instead be close to N+4.  The program will declare that the test fails
-if the ratio is greater than N (actually, N + 0.0001 to allow for FP
-rounding errors).
-
-Could someone run this on x86 on the latest PCL tree and let me know
-what happens?  I don't have an x86 crash box easily to hand.  On
-powerpc, it passes, but I think that is because I am missing setting
-counter->prev_count in arch/powerpc/kernel/perf_counter.c, and I think
-that means that enabling/disabling a group with a task clock counter
-in it won't work correctly (I'll do a test program for that next).
-
-Usage is: ./performance_counter02  [-v]
-
-The -v flag makes it print out the values of each counter.
-*/
-
-#include <stdio.h>
+#define _GNU_SOURCE
+#include <errno.h>
+#include <inttypes.h>
+#include <sched.h>
+#include <signal.h>
 #include <stddef.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <fcntl.h>
-#include <poll.h>
 #include <unistd.h>
-#include <errno.h>
-#include "config.h"
 #include <sys/prctl.h>
+#include <sys/time.h>
 #include <sys/types.h>
-#include <linux/types.h>
-#include <sched.h>
 
-#if HAVE_PERF_EVENT_ATTR
-# include <linux/perf_event.h>
-#endif
-
-#include "test.h"
-#include "safe_macros.h"
+#include "config.h"
+#include "tst_test.h"
+#include "lapi/cpuset.h"
 #include "lapi/syscalls.h"
 
-char *TCID = "perf_event_open02";
-int TST_TOTAL = 1;
-
 #if HAVE_PERF_EVENT_ATTR
+#include <linux/types.h>
+#include <linux/perf_event.h>
 
 #define MAX_CTRS	1000
-#define LOOPS		100000000
-
-static void setup(void);
-static void verify(void);
-static void cleanup(void);
-static void help(void);
-
-static int n, nhw;
-static int verbose;
-static option_t options[] = {
-	{"v", &verbose, NULL},
-	{NULL, NULL, NULL},
-};
-
-static int tsk0;
-static int hwfd[MAX_CTRS], tskfd[MAX_CTRS];
-
-int main(int ac, char **av)
-{
-	int lc;
-
-	tst_parse_opts(ac, av, options, help);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-		verify();
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-static int perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
-	int cpu, int group_fd, unsigned long flags)
-{
-	int ret;
-
-	ret = ltp_syscall(__NR_perf_event_open, hw_event, pid, cpu,
-			  group_fd, flags);
-	return ret;
-}
-
-
-static void do_work(void)
-{
-	int i;
-
-	for (i = 0; i < LOOPS; ++i)
-		asm volatile (""::"g" (i));
-}
 
 struct read_format {
 	unsigned long long value;
@@ -141,13 +60,96 @@
 	unsigned long long time_running;
 };
 
+static char *verbose;
+static struct tst_option options[] = {
+	{"v", &verbose, "-v\tverbose output"},
+	{NULL, NULL, NULL},
+};
+
+static int ntotal, nhw;
+static int tsk0 = -1, hwfd[MAX_CTRS], tskfd[MAX_CTRS];
+static int volatile work_done;
+static unsigned int est_loops;
+
+static int perf_event_open(struct perf_event_attr *event, pid_t pid,
+	int cpu, int group_fd, unsigned long flags)
+{
+	int ret;
+
+	ret = tst_syscall(__NR_perf_event_open, event, pid, cpu,
+		group_fd, flags);
+
+	if (ret != -1)
+		return ret;
+
+	tst_res(TINFO, "perf_event_open event.type: %"PRIu32
+		", event.config: %"PRIu64, (uint32_t)event->type,
+		(uint64_t)event->config);
+	if (errno == ENOENT || errno == ENODEV) {
+		tst_brk(TCONF | TERRNO,
+			"perf_event_open type/config not supported");
+	}
+	tst_brk(TBROK | TERRNO, "perf_event_open failed");
+
+	/* unreachable */
+	return -1;
+}
+
+static void all_counters_set(int state)
+{
+	if (prctl(state) == -1)
+		tst_brk(TBROK | TERRNO, "prctl(%d) failed", state);
+}
+
+static void alarm_handler(int sig LTP_ATTRIBUTE_UNUSED)
+{
+	work_done = 1;
+}
+
+static void bench_work(int time_ms)
+{
+	unsigned int i;
+	struct itimerval val;
+	struct sigaction sa;
+
+	memset(&sa, 0, sizeof(sa));
+	sa.sa_handler = alarm_handler;
+	sa.sa_flags = SA_RESETHAND;
+	SAFE_SIGACTION(SIGALRM, &sa, NULL);
+
+	work_done = 0;
+	memset(&val, 0, sizeof(val));
+	val.it_value.tv_sec = time_ms / 1000;
+	val.it_value.tv_usec = (time_ms % 1000) * 1000;
+
+	if (setitimer(ITIMER_REAL, &val, NULL))
+		tst_brk(TBROK | TERRNO, "setitimer");
+
+	while (!work_done) {
+		for (i = 0; i < 100000; ++i)
+			asm volatile (""::"g" (i));
+		est_loops++;
+	}
+
+	tst_res(TINFO, "bench_work estimated loops = %u in %d ms", est_loops, time_ms);
+}
+
+static void do_work(int mult)
+{
+	unsigned long i, j, loops = mult * est_loops;
+
+	for (j = 0; j < loops; j++)
+		for (i = 0; i < 100000; i++)
+			asm volatile (""::"g" (i));
+}
+
 #ifndef __s390__
 static int count_hardware_counters(void)
 {
 	struct perf_event_attr hw_event;
 	int i, hwctrs = 0;
 	int fdarry[MAX_CTRS];
-	struct read_format buf;
+	struct read_format buf, buf2, diff;
 
 	memset(&hw_event, 0, sizeof(struct perf_event_attr));
 
@@ -160,37 +162,23 @@
 
 	for (i = 0; i < MAX_CTRS; i++) {
 		fdarry[i] = perf_event_open(&hw_event, 0, -1, -1, 0);
-		if (fdarry[i] == -1) {
-			if (errno == ENOENT || errno == ENODEV) {
-				tst_brkm(TCONF | TERRNO, cleanup,
-				         "PERF_COUNT_HW_INSTRUCTIONS not supported");
-			}
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "perf_event_open failed at iteration:%d", i);
-		}
 
-		if (prctl(PR_TASK_PERF_EVENTS_ENABLE) == -1) {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "prctl(PR_TASK_PERF_EVENTS_ENABLE) failed");
-		}
+		all_counters_set(PR_TASK_PERF_EVENTS_ENABLE);
+		do_work(1);
+		if (read(fdarry[i], &buf, sizeof(buf)) != sizeof(buf))
+			tst_brk(TBROK | TERRNO, "error reading counter(s) #1");
+		do_work(1);
+		all_counters_set(PR_TASK_PERF_EVENTS_DISABLE);
+		if (read(fdarry[i], &buf2, sizeof(buf2)) != sizeof(buf2))
+			tst_brk(TBROK | TERRNO, "error reading counter(s) #2");
 
-		do_work();
+		diff.value = buf2.value - buf.value;
+		diff.time_enabled = buf2.time_enabled - buf.time_enabled;
+		diff.time_running = buf2.time_running - buf.time_running;
 
-		if (prctl(PR_TASK_PERF_EVENTS_DISABLE) == -1) {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "prctl(PR_TASK_PERF_EVENTS_DISABLE) failed");
-		}
-
-		if (read(fdarry[i], &buf, sizeof(buf)) != sizeof(buf)) {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "error reading counter(s)");
-		}
-
-		if (verbose == 1) {
-			printf("at iteration:%d value:%lld time_enabled:%lld "
-			       "time_running:%lld\n", i, buf.value,
-			       buf.time_enabled, buf.time_running);
-		}
+		tst_res(TINFO, "[%d] value:%lld time_enabled:%lld "
+		       "time_running:%lld", i, diff.value,
+		       diff.time_enabled, diff.time_running);
 
 		/*
 		 * Normally time_enabled and time_running are the same value.
@@ -204,36 +192,60 @@
 		 * multiplexing happens and the number of the opened events
 		 * are the number of max available hardware counters.
 		 */
-		if (buf.time_enabled != buf.time_running) {
+		if (diff.time_enabled != diff.time_running) {
 			hwctrs = i;
 			break;
 		}
 	}
 
 	for (i = 0; i <= hwctrs; i++)
-		SAFE_CLOSE(cleanup, fdarry[i]);
+		SAFE_CLOSE(fdarry[i]);
 
 	return hwctrs;
 }
+#endif /* __s390__ */
+
+static void bind_to_current_cpu(void)
+{
+#ifdef HAVE_SCHED_GETCPU
+	int cpu = sched_getcpu();
+	size_t mask_size;
+	cpu_set_t *mask;
+
+	if (cpu == -1)
+		tst_brk(TBROK | TERRNO, "sched_getcpu() failed");
+
+	mask = CPU_ALLOC(cpu + 1);
+	mask_size = CPU_ALLOC_SIZE(cpu + 1);
+	CPU_ZERO_S(mask_size, mask);
+	CPU_SET(cpu, mask);
+	if (sched_setaffinity(0, mask_size, mask) == -1)
+		tst_brk(TBROK | TERRNO, "sched_setaffinity() failed");
+	CPU_FREE(mask);
 #endif
+}
 
 static void setup(void)
 {
 	int i;
 	struct perf_event_attr tsk_event, hw_event;
 
+	for (i = 0; i < MAX_CTRS; i++) {
+		hwfd[i] = -1;
+		tskfd[i] = -1;
+	}
+
+	bench_work(500);
+
 	/*
 	 * According to perf_event_open's manpage, the official way of
 	 * knowing if perf_event_open() support is enabled is checking for
 	 * the existence of the file /proc/sys/kernel/perf_event_paranoid.
 	 */
 	if (access("/proc/sys/kernel/perf_event_paranoid", F_OK) == -1)
-		tst_brkm(TCONF, NULL, "Kernel doesn't have perf_event support");
+		tst_brk(TCONF, "Kernel doesn't have perf_event support");
 
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
+	bind_to_current_cpu();
 #ifdef __s390__
 	/*
 	 * On s390 the "time_enabled" and "time_running" values are always the
@@ -242,10 +254,10 @@
 	 * There are distinct/dedicated counters that can be used independently.
 	 * Use the dedicated counter for instructions here.
 	 */
-	n = nhw = 1;
+	ntotal = nhw = 1;
 #else
 	nhw = count_hardware_counters();
-	n = nhw + 4;
+	ntotal = nhw + 4;
 #endif
 
 	memset(&hw_event, 0, sizeof(struct perf_event_attr));
@@ -262,30 +274,10 @@
 	hw_event.config =  PERF_COUNT_HW_INSTRUCTIONS;
 
 	tsk0 = perf_event_open(&tsk_event, 0, -1, -1, 0);
-	if (tsk0 == -1) {
-		tst_brkm(TBROK | TERRNO, cleanup, "perf_event_open failed");
-	} else {
-		tsk_event.disabled = 0;
-		for (i = 0; i < n; ++i) {
-			hwfd[i] = perf_event_open(&hw_event, 0, -1, -1, 0);
-			if (hwfd[i] == -1) {
-				if (errno == ENOENT || errno == ENODEV) {
-					tst_brkm(TCONF | TERRNO, cleanup,
-						"PERF_COUNT_HW_INSTRUCTIONS not supported");
-				}
-				tst_brkm(TBROK | TERRNO, cleanup,
-					 "perf_event_open failed");
-			}
-			tskfd[i] = perf_event_open(&tsk_event, 0, -1, hwfd[i], 0);
-			if (tskfd[i] == -1) {
-				if (errno == ENOENT || errno == ENODEV) {
-					tst_brkm(TCONF | TERRNO, cleanup,
-						"PERF_COUNT_SW_TASK_CLOCK not supported");
-				}
-				tst_brkm(TBROK | TERRNO, cleanup,
-					 "perf_event_open failed");
-			}
-		}
+	tsk_event.disabled = 0;
+	for (i = 0; i < ntotal; ++i) {
+		hwfd[i] = perf_event_open(&hw_event, 0, -1, -1, 0);
+		tskfd[i] = perf_event_open(&tsk_event, 0, -1, hwfd[i], 0);
 	}
 }
 
@@ -293,15 +285,15 @@
 {
 	int i;
 
-	for (i = 0; i < n; i++) {
-		if (hwfd[i] > 0 && close(hwfd[i]) == -1)
-			tst_resm(TWARN | TERRNO, "close(%d) failed", hwfd[i]);
-		if (tskfd[i] > 0 && close(tskfd[i]) == -1)
-			tst_resm(TWARN | TERRNO, "close(%d) failed", tskfd[i]);
+	for (i = 0; i < ntotal; i++) {
+		if (hwfd[i] != -1)
+			SAFE_CLOSE(hwfd[i]);
+		if (tskfd[i] != -1)
+			SAFE_CLOSE(tskfd[i]);
 	}
 
-	if (tsk0 > 0 && close(tsk0) == -1)
-		tst_resm(TWARN | TERRNO, "close(%d) failed", tsk0);
+	if (tsk0 != -1)
+		SAFE_CLOSE(tsk0);
 }
 
 static void verify(void)
@@ -313,76 +305,66 @@
 	struct sched_param sparam = {.sched_priority = 1};
 
 	if (sched_setscheduler(0, SCHED_FIFO, &sparam)) {
-		tst_brkm(TBROK | TERRNO, cleanup,
-			 "sched_setscheduler(0, SCHED_FIFO, ...) failed");
+		tst_brk(TBROK | TERRNO,
+			"sched_setscheduler(0, SCHED_FIFO, ...) failed");
 	}
 
-	if (prctl(PR_TASK_PERF_EVENTS_ENABLE) == -1) {
-		tst_brkm(TBROK | TERRNO, cleanup,
-			 "prctl(PR_TASK_PERF_EVENTS_ENABLE) failed");
+	all_counters_set(PR_TASK_PERF_EVENTS_ENABLE);
+	do_work(8);
+	/* stop groups with hw counters first before tsk0 */
+	for (i = 0; i < ntotal; i++) {
+		ioctl(hwfd[i], PERF_EVENT_IOC_DISABLE);
+		ioctl(tskfd[i], PERF_EVENT_IOC_DISABLE);
 	}
-
-	do_work();
-
-	if (prctl(PR_TASK_PERF_EVENTS_DISABLE) == -1) {
-		tst_brkm(TBROK | TERRNO, cleanup,
-			 "prctl(PR_TASK_PERF_EVENTS_DISABLE) failed");
-	}
+	all_counters_set(PR_TASK_PERF_EVENTS_DISABLE);
 
 	sparam.sched_priority = 0;
 	if (sched_setscheduler(0, SCHED_OTHER, &sparam)) {
-		tst_brkm(TBROK | TERRNO, cleanup,
-			 "sched_setscheduler(0, SCHED_OTHER, ...) failed");
+		tst_brk(TBROK | TERRNO,
+			"sched_setscheduler(0, SCHED_OTHER, ...) failed");
 	}
 
-	if (read(tsk0, &vt0, sizeof(vt0)) != sizeof(vt0)) {
-		tst_brkm(TBROK | TERRNO, cleanup,
-			 "error reading task clock counter");
-	}
+	if (read(tsk0, &vt0, sizeof(vt0)) != sizeof(vt0))
+		tst_brk(TBROK | TERRNO, "error reading task clock counter");
 
-	for (i = 0; i < n; ++i) {
+	for (i = 0; i < ntotal; ++i) {
 		if (read(tskfd[i], &vt[i], sizeof(vt[i])) != sizeof(vt[i]) ||
-		    read(hwfd[i], &vh[i], sizeof(vh[i])) != sizeof(vh[i])) {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "error reading counter(s)");
-		}
+		    read(hwfd[i], &vh[i], sizeof(vh[i])) != sizeof(vh[i]))
+			tst_brk(TBROK | TERRNO, "error reading counter(s)");
 		vtsum += vt[i];
 		vhsum += vh[i];
 	}
 
-	tst_resm(TINFO, "overall task clock: %llu", vt0);
-	tst_resm(TINFO, "hw sum: %llu, task clock sum: %llu", vhsum, vtsum);
+	tst_res(TINFO, "nhw: %d, overall task clock: %llu", nhw, vt0);
+	tst_res(TINFO, "hw sum: %llu, task clock sum: %llu", vhsum, vtsum);
 
-	if (verbose == 1) {
-		printf("hw counters:");
-		for (i = 0; i < n; ++i)
-			printf(" %llu", vh[i]);
-		printf("\ntask clock counters:");
-		for (i = 0; i < n; ++i)
-			printf(" %llu", vt[i]);
-		printf("\n");
+	if (verbose) {
+		tst_res(TINFO, "hw counters:");
+		for (i = 0; i < ntotal; ++i)
+			tst_res(TINFO, " %llu", vh[i]);
+		tst_res(TINFO, "task clock counters:");
+		for (i = 0; i < ntotal; ++i)
+			tst_res(TINFO, " %llu", vt[i]);
 	}
 
 	ratio = (double)vtsum / vt0;
-	tst_resm(TINFO, "ratio: %lf", ratio);
+	tst_res(TINFO, "ratio: %lf", ratio);
 	if (ratio > nhw + 0.0001) {
-		tst_resm(TFAIL, "test failed (ratio was greater than )");
+		tst_res(TFAIL, "test failed (ratio was greater than %d)", nhw);
 	} else {
-		tst_resm(TPASS, "test passed");
+		tst_res(TPASS, "test passed");
 	}
 }
 
-static void help(void)
-{
-	printf("  -v      Print verbose information\n");
-}
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.options = options,
+	.test_all = verify,
+	.needs_root = 1,
+};
 
-#else
-
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "This system doesn't have "
-		 "header file:<linux/perf_event.h> or "
-		 "no struct perf_event_attr defined");
-}
+#else /* HAVE_PERF_EVENT_ATTR */
+TST_TEST_TCONF("This system doesn't have <linux/perf_event.h> or "
+	"struct perf_event_attr is not defined.");
 #endif
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/.gitignore b/testcases/kernel/syscalls/pidfd_send_signal/.gitignore
new file mode 100644
index 0000000..cba7d50
--- /dev/null
+++ b/testcases/kernel/syscalls/pidfd_send_signal/.gitignore
@@ -0,0 +1,3 @@
+/pidfd_send_signal01
+/pidfd_send_signal02
+/pidfd_send_signal03
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/Makefile b/testcases/kernel/syscalls/pidfd_send_signal/Makefile
new file mode 100644
index 0000000..23e4ec4
--- /dev/null
+++ b/testcases/kernel/syscalls/pidfd_send_signal/Makefile
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#
+#   Copyright (c) 2019 SUSE LLC
+#
+#   Author: Christian Amann <camann@suse.com>
+#
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+pidfd_send_signal01: CFLAGS += -pthread
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal.h b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal.h
new file mode 100644
index 0000000..dc17fe0
--- /dev/null
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal.h
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+
+#ifndef PIDFD_SEND_SIGNAL_H
+#define PIDFD_SEND_SIGNAL_H
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+
+static void check_syscall_support(void)
+{
+	/* allow the tests to fail early */
+	tst_syscall(__NR_pidfd_send_signal);
+}
+
+#ifndef HAVE_PIDFD_SEND_SIGNAL
+static int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
+				 unsigned int flags)
+{
+	tst_res(TINFO, "Testing syscall(__NR_pidfd_send_signal)");
+	return tst_syscall(__NR_pidfd_send_signal, pidfd, sig, info, flags);
+}
+#endif /* HAVE_PIDFD_SEND_SIGNAL */
+
+#endif /* PIDFD_SEND_SIGNAL_H */
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c
new file mode 100644
index 0000000..b529551
--- /dev/null
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal01.c
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+/*
+ * Tests if the pidfd_send_signal syscall behaves
+ * like rt_sigqueueinfo when a pointer to a siginfo_t
+ * struct is passed.
+ */
+
+#define _GNU_SOURCE
+#include <signal.h>
+#include <stdlib.h>
+#include "tst_safe_pthread.h"
+#include "pidfd_send_signal.h"
+
+#define SIGNAL  SIGUSR1
+#define DATA	777
+
+static struct sigaction *sig_action;
+static int sig_rec;
+static siginfo_t *uinfo;
+static int pidfd;
+
+static void received_signal(int sig, siginfo_t *info, void *ucontext)
+{
+	if (info && ucontext) {
+		if (sig == SIGNAL && uinfo->si_value.sival_int == DATA) {
+			tst_res(TPASS, "Received correct signal and data!");
+			sig_rec = 1;
+		} else {
+			tst_res(TFAIL, "Received wrong signal and/or data!");
+		}
+	} else {
+		tst_res(TFAIL, "Signal handling went wrong!");
+	}
+}
+
+static void *handle_thread(void *arg)
+{
+	SAFE_SIGACTION(SIGNAL, sig_action, NULL);
+	TST_CHECKPOINT_WAKE_AND_WAIT(0);
+	return arg;
+}
+
+static void verify_pidfd_send_signal(void)
+{
+	pthread_t thr;
+
+	SAFE_PTHREAD_CREATE(&thr, NULL, handle_thread, NULL);
+
+	TST_CHECKPOINT_WAIT(0);
+
+	TEST(pidfd_send_signal(pidfd, SIGNAL, uinfo, 0));
+	if (TST_RET != 0) {
+		tst_res(TFAIL | TTERRNO, "pidfd_send_signal() failed");
+		return;
+	}
+
+	TST_CHECKPOINT_WAKE(0);
+	SAFE_PTHREAD_JOIN(thr, NULL);
+
+	if (sig_rec) {
+		tst_res(TPASS,
+			"pidfd_send_signal() behaved like rt_sigqueueinfo()");
+	}
+}
+
+static void setup(void)
+{
+	check_syscall_support();
+
+	pidfd = SAFE_OPEN("/proc/self", O_DIRECTORY | O_CLOEXEC);
+
+	sig_action = SAFE_MALLOC(sizeof(struct sigaction));
+
+	memset(sig_action, 0, sizeof(*sig_action));
+	sig_action->sa_sigaction = received_signal;
+	sig_action->sa_flags = SA_SIGINFO;
+
+	uinfo = SAFE_MALLOC(sizeof(siginfo_t));
+
+	memset(uinfo, 0, sizeof(*uinfo));
+	uinfo->si_signo = SIGNAL;
+	uinfo->si_code = SI_QUEUE;
+	uinfo->si_pid = getpid();
+	uinfo->si_uid = getuid();
+	uinfo->si_value.sival_int = DATA;
+}
+
+static void cleanup(void)
+{
+	free(uinfo);
+	free(sig_action);
+	if (pidfd > 0)
+		SAFE_CLOSE(pidfd);
+}
+
+static struct tst_test test = {
+	.test_all = verify_pidfd_send_signal,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_checkpoints = 1,
+};
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c
new file mode 100644
index 0000000..7491452
--- /dev/null
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal02.c
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+/*
+ * Tests basic error handling of the pidfd_send_signal
+ * system call.
+ *
+ * 1) Pass invalid flag value to syscall (value chosen
+ *    to be unlikely to collide with future extensions)
+ *    -> EINVAL
+ * 2) Pass a file descriptor that is corresponding to a
+ *    regular file instead of a pid directory
+ *    -> EBADF
+ * 3) Pass a signal that is different from the one used
+ *    to initialize the siginfo_t struct
+ *    -> EINVAL
+ * 4) Try to send signal to other process (init) with
+ *    missing privileges
+ *    -> EPERM
+ */
+
+#define _GNU_SOURCE
+#include <pwd.h>
+#include <signal.h>
+#include "tst_safe_pthread.h"
+#include "pidfd_send_signal.h"
+
+#define CORRECT_SIGNAL		SIGUSR1
+#define DIFFERENT_SIGNAL	SIGUSR2
+
+static siginfo_t info;
+static int pidfd;
+static int init_pidfd;
+static int dummyfd;
+
+static struct tcase {
+	int		*fd;
+	siginfo_t	*siginf;
+	int		signal;
+	int		flags;
+	int		exp_err;
+} tcases[] = {
+	{&pidfd, &info, CORRECT_SIGNAL, 99999, EINVAL},
+	{&dummyfd, &info, CORRECT_SIGNAL, 0, EBADF},
+	{&pidfd, &info, DIFFERENT_SIGNAL, 0, EINVAL},
+	{&init_pidfd, &info, CORRECT_SIGNAL, 0, EPERM},
+};
+
+static void verify_pidfd_send_signal(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+
+	TEST(pidfd_send_signal(*tc->fd, tc->signal, tc->siginf, tc->flags));
+	if (tc->exp_err != TST_ERR) {
+		tst_res(TFAIL | TTERRNO,
+			"pidfd_send_signal() did not fail with %s but",
+			tst_strerrno(tc->exp_err));
+		return;
+	}
+
+	tst_res(TPASS | TTERRNO,
+		"pidfd_send_signal() failed as expected");
+}
+
+static void setup(void)
+{
+	struct passwd *pw;
+
+	check_syscall_support();
+
+	pidfd = SAFE_OPEN("/proc/self", O_DIRECTORY | O_CLOEXEC);
+	init_pidfd = SAFE_OPEN("/proc/1", O_DIRECTORY | O_CLOEXEC);
+	dummyfd = SAFE_OPEN("dummy_file", O_RDWR | O_CREAT, 0664);
+
+	if (getuid() == 0) {
+		pw = SAFE_GETPWNAM("nobody");
+		SAFE_SETUID(pw->pw_uid);
+	}
+
+	memset(&info, 0, sizeof(info));
+	info.si_signo = CORRECT_SIGNAL;
+	info.si_code = SI_QUEUE;
+	info.si_pid = getpid();
+	info.si_uid = getuid();
+}
+
+static void cleanup(void)
+{
+	if (dummyfd > 0)
+		SAFE_CLOSE(dummyfd);
+	if (init_pidfd > 0)
+		SAFE_CLOSE(init_pidfd);
+	if (pidfd > 0)
+		SAFE_CLOSE(pidfd);
+}
+
+static struct tst_test test = {
+	.test = verify_pidfd_send_signal,
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+};
diff --git a/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c
new file mode 100644
index 0000000..3420afb
--- /dev/null
+++ b/testcases/kernel/syscalls/pidfd_send_signal/pidfd_send_signal03.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+/*
+ * This test checks if the pidfd_send_signal syscall wrongfully sends
+ * a signal to a new process which inherited the PID of the actual
+ * target process.
+ * In order to do so it is necessary to start a process with a pre-
+ * determined PID. This is accomplished by writing to the
+ * /proc/sys/kernel/ns_last_pid file.
+ * By utilizing this, this test forks two children with the same PID.
+ * It is then checked, if the syscall will send a signal to the second
+ * child using the pidfd of the first one.
+ */
+
+#define _GNU_SOURCE
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "pidfd_send_signal.h"
+#include "tst_safe_pthread.h"
+
+#define PIDTRIES	3
+
+static char *last_pid_file;
+static int pidfd, new_pidfd;
+static int old_inode, new_inode;
+
+static int get_inode_number(int fd)
+{
+	struct stat file_stat;
+
+	SAFE_FSTAT(fd, &file_stat);
+	return file_stat.st_ino;
+}
+
+static void verify_pidfd_send_signal(void)
+{
+	pid_t pid, new_pid;
+	char pid_filename[32];
+	char pid_str[16];
+	int i, fail;
+
+	fail = 1;
+	for (i = 0; i < PIDTRIES; i++) {
+		pid = SAFE_FORK();
+		if (pid == 0) {
+			TST_CHECKPOINT_WAIT(0);
+			return;
+		}
+
+		sprintf(pid_filename, "/proc/%d", pid);
+		pidfd = SAFE_OPEN(pid_filename, O_DIRECTORY | O_CLOEXEC);
+		old_inode = get_inode_number(pidfd);
+
+		TST_CHECKPOINT_WAKE(0);
+		tst_reap_children();
+
+		/* Manipulate PID for next process */
+		sprintf(pid_str, "%d", pid - 1);
+		SAFE_FILE_PRINTF(last_pid_file, "%s", pid_str);
+
+		new_pid = SAFE_FORK();
+		if (new_pid == 0) {
+			TST_CHECKPOINT_WAIT(0);
+			return;
+		}
+
+		if (new_pid == pid) {
+			new_pidfd = SAFE_OPEN(pid_filename,
+					O_DIRECTORY | O_CLOEXEC);
+			new_inode = get_inode_number(new_pidfd);
+			SAFE_CLOSE(new_pidfd);
+			fail = 0;
+			break;
+		}
+
+		if (i < PIDTRIES) {
+			tst_res(TINFO,
+				"Failed to set correct PID, trying again...");
+		}
+		SAFE_CLOSE(pidfd);
+		TST_CHECKPOINT_WAKE(0);
+		tst_reap_children();
+	}
+	if (fail) {
+		tst_brk(TBROK,
+			"Could not set new child to same PID as the old one!");
+	}
+	if (old_inode == new_inode) {
+		tst_res(TWARN,
+			"File descriptor of new process points to the inode of the old process!");
+	}
+
+	TEST(pidfd_send_signal(pidfd, SIGUSR1, NULL, 0));
+	if (TST_RET == -1 && TST_ERR == ESRCH) {
+		tst_res(TPASS,
+			"Did not send signal to wrong process with same PID!");
+	} else {
+		tst_res(TFAIL | TTERRNO,
+			"pidf_send_signal() ended unexpectedly - return value: %ld, error",
+			TST_RET);
+	}
+	TST_CHECKPOINT_WAKE(0);
+	tst_reap_children();
+
+	SAFE_CLOSE(pidfd);
+}
+
+static void setup(void)
+{
+	check_syscall_support();
+
+	last_pid_file = "/proc/sys/kernel/ns_last_pid";
+	if (access(last_pid_file, F_OK) == -1) {
+		tst_brk(TCONF, "%s does not exist, cannot set PIDs",
+			last_pid_file);
+	}
+}
+
+static void cleanup(void)
+{
+	tst_reap_children();
+	if (new_pidfd > 0)
+		SAFE_CLOSE(new_pidfd);
+	if (pidfd > 0)
+		SAFE_CLOSE(pidfd);
+}
+
+static struct tst_test test = {
+	.test_all = verify_pidfd_send_signal,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_root = 1,
+	.needs_checkpoints = 1,
+	.forks_child = 1,
+};
diff --git a/testcases/kernel/syscalls/pipe/pipe01.c b/testcases/kernel/syscalls/pipe/pipe01.c
index 0c681b3..8767cf4 100644
--- a/testcases/kernel/syscalls/pipe/pipe01.c
+++ b/testcases/kernel/syscalls/pipe/pipe01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) International Business Machines Corp., 2001
- *
- * This program is free software;  you can rdistribute 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/pipe/pipe02.c b/testcases/kernel/syscalls/pipe/pipe02.c
index 9afb8f8..2040911 100644
--- a/testcases/kernel/syscalls/pipe/pipe02.c
+++ b/testcases/kernel/syscalls/pipe/pipe02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2002
- *
- * 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.
+ * Copyright (c) International Business Machines Corp., 2002
  */
 
 /*
diff --git a/testcases/kernel/syscalls/pipe/pipe03.c b/testcases/kernel/syscalls/pipe/pipe03.c
index 77496b6..89c0911 100644
--- a/testcases/kernel/syscalls/pipe/pipe03.c
+++ b/testcases/kernel/syscalls/pipe/pipe03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2002
- *
- * 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.
+ * Copyright (c) International Business Machines Corp., 2002
  */
 
 /*
diff --git a/testcases/kernel/syscalls/pipe/pipe11.c b/testcases/kernel/syscalls/pipe/pipe11.c
index d71d87a..7717091 100644
--- a/testcases/kernel/syscalls/pipe/pipe11.c
+++ b/testcases/kernel/syscalls/pipe/pipe11.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *    07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/pkeys/.gitignore b/testcases/kernel/syscalls/pkeys/.gitignore
new file mode 100644
index 0000000..6fd5add
--- /dev/null
+++ b/testcases/kernel/syscalls/pkeys/.gitignore
@@ -0,0 +1 @@
+/pkey01
diff --git a/testcases/kernel/syscalls/pkeys/Makefile b/testcases/kernel/syscalls/pkeys/Makefile
new file mode 100644
index 0000000..9ee2c2e
--- /dev/null
+++ b/testcases/kernel/syscalls/pkeys/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Red Hat, Inc.
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/pkeys/pkey.h b/testcases/kernel/syscalls/pkeys/pkey.h
new file mode 100644
index 0000000..6e32326
--- /dev/null
+++ b/testcases/kernel/syscalls/pkeys/pkey.h
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Red Hat, Inc.
+ * Copyright (c) Linux Test Project, 2019
+ */
+
+#ifndef PKEYS_H
+#define PKEYS_H
+
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include "lapi/mmap.h"
+
+#ifndef PKEY_DISABLE_ACCESS
+# define PKEY_DISABLE_ACCESS 0x1
+# define PKEY_DISABLE_WRITE  0x2
+#endif
+
+#ifndef HAVE_PKEY_MPROTECT
+inline int ltp_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
+{
+	return tst_syscall(__NR_pkey_mprotect, addr, len, prot, pkey);
+}
+
+inline int ltp_pkey_alloc(unsigned int flags, unsigned int access_rights)
+{
+	return tst_syscall(__NR_pkey_alloc, flags, access_rights);
+}
+
+inline int ltp_pkey_free(int pkey)
+{
+	return tst_syscall(__NR_pkey_free, pkey);
+}
+#else
+#define ltp_pkey_alloc pkey_alloc
+#define ltp_pkey_free pkey_free
+#define ltp_pkey_mprotect pkey_mprotect
+#endif /* HAVE_PKEY_MPROTECT */
+
+static inline void check_pkey_support(void)
+{
+	int pkey = ltp_pkey_alloc(0, 0);
+
+	if (pkey == -1) {
+		if (errno == ENOSYS)
+			tst_brk(TCONF, "pkey_alloc is not implemented");
+		if (errno == EINVAL)
+			tst_brk(TCONF, "pku is not supported on this CPU");
+		if (errno == ENOSPC)
+			tst_brk(TCONF, "pkeys are not available for test");
+	}
+
+	ltp_pkey_free(pkey);
+}
+
+#endif /* PKEYS_H */
diff --git a/testcases/kernel/syscalls/pkeys/pkey01.c b/testcases/kernel/syscalls/pkeys/pkey01.c
new file mode 100644
index 0000000..fa84e71
--- /dev/null
+++ b/testcases/kernel/syscalls/pkeys/pkey01.c
@@ -0,0 +1,240 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Red Hat, Inc.
+ *
+ * Memory Protection Keys for Userspace (PKU aka PKEYs) is a Skylake-SP
+ * server feature that provides a mechanism for enforcing page-based
+ * protections, but without requiring modification of the page tables
+ * when an application changes protection domains. It works by dedicating
+ * 4 previously ignored bits in each page table entry to a "protection key",
+ * giving 16 possible keys.
+ *
+ * Basic method for PKEYs testing:
+ *    1. test allocates a pkey(e.g. PKEY_DISABLE_ACCESS) via pkey_alloc()
+ *    2. pkey_mprotect() apply this pkey to a piece of memory(buffer)
+ *    3. check if access right of the buffer has been changed and take effect
+ *    4. remove the access right(pkey) from this buffer via pkey_mprotect()
+ *    5. check if buffer area can be read or write after removing pkey
+ *    6. pkey_free() releases the pkey after using it
+ *
+ * Looping around this basic test on diffenrent types of memory.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+
+#include "pkey.h"
+
+#define TEST_FILE "pkey_testfile"
+#define STR "abcdefghijklmnopqrstuvwxyz12345\n"
+#define PATH_VM_NRHPS "/proc/sys/vm/nr_hugepages"
+
+static int size;
+static int no_hugepage;
+
+static const char * const save_restore[] = {
+	"?/proc/sys/vm/nr_hugepages",
+	NULL,
+};
+
+static struct tcase {
+	unsigned long flags;
+	unsigned long access_rights;
+	char *name;
+} tcases[] = {
+	{0, PKEY_DISABLE_ACCESS, "PKEY_DISABLE_ACCESS"},
+	{0, PKEY_DISABLE_WRITE, "PKEY_DISABLE_WRITE"},
+};
+
+static void setup(void)
+{
+	int i, fd;
+
+	if (access("/sys/kernel/mm/hugepages/", F_OK)) {
+		tst_res(TINFO, "Huge page is not supported");
+		size = getpagesize();
+		no_hugepage = 1;
+	} else {
+		int val;
+		SAFE_FILE_PRINTF(PATH_VM_NRHPS, "%d", 1);
+		SAFE_FILE_SCANF(PATH_VM_NRHPS, "%d", &val);
+		if (val != 1)
+			tst_brk(TBROK, "nr_hugepages = %d, but expect %d",
+					val, 1);
+		size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+	}
+
+	check_pkey_support();
+
+	fd = SAFE_OPEN(TEST_FILE, O_RDWR | O_CREAT, 0664);
+	for (i = 0; i < 128; i++)
+		SAFE_WRITE(1, fd, STR, strlen(STR));
+
+	SAFE_CLOSE(fd);
+}
+
+static struct mmap_param {
+	int prot;
+	int flags;
+	int fd;
+} mmap_params[] = {
+	{PROT_READ,  MAP_ANONYMOUS | MAP_PRIVATE, -1},
+	{PROT_READ,  MAP_ANONYMOUS | MAP_SHARED, -1},
+	{PROT_READ,  MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1},
+	{PROT_READ,  MAP_ANONYMOUS | MAP_SHARED  | MAP_HUGETLB, -1},
+	{PROT_READ,  MAP_PRIVATE, 0},
+	{PROT_READ,  MAP_SHARED, 0},
+
+	{PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1},
+	{PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1},
+	{PROT_WRITE, MAP_PRIVATE, 0},
+	{PROT_WRITE, MAP_SHARED, 0},
+	{PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1},
+	{PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED  | MAP_HUGETLB, -1},
+
+	{PROT_EXEC,  MAP_ANONYMOUS | MAP_PRIVATE, -1},
+	{PROT_EXEC,  MAP_ANONYMOUS | MAP_SHARED, -1},
+	{PROT_EXEC,  MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1},
+	{PROT_EXEC,  MAP_ANONYMOUS | MAP_SHARED  | MAP_HUGETLB, -1},
+	{PROT_EXEC,  MAP_PRIVATE, 0},
+	{PROT_EXEC,  MAP_SHARED, 0},
+
+	{PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1},
+	{PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1},
+	{PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1},
+	{PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED  | MAP_HUGETLB, -1},
+	{PROT_READ | PROT_WRITE, MAP_PRIVATE, 0},
+	{PROT_READ | PROT_WRITE, MAP_SHARED, 0},
+
+	{PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1},
+	{PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_SHARED, -1},
+	{PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1},
+	{PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_SHARED  | MAP_HUGETLB, -1},
+	{PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, 0},
+	{PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, 0},
+};
+
+static char *flag_to_str(int flags)
+{
+	switch (flags) {
+	case MAP_PRIVATE:
+		return "MAP_PRIVATE";
+	case MAP_SHARED:
+		return "MAP_SHARED";
+	case MAP_ANONYMOUS | MAP_PRIVATE:
+		return "MAP_ANONYMOUS|MAP_PRIVATE";
+	case MAP_ANONYMOUS | MAP_SHARED:
+		return "MAP_ANONYMOUS|MAP_SHARED";
+	case MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB:
+		return "MAP_ANONYMOUS|MAP_PRIVATE|MAP_HUGETLB";
+	case MAP_ANONYMOUS | MAP_SHARED  | MAP_HUGETLB:
+		return "MAP_ANONYMOUS|MAP_SHARED|MAP_HUGETLB";
+	default:
+		return "UNKNOWN FLAGS";
+	}
+}
+
+static void pkey_test(struct tcase *tc, struct mmap_param *mpa)
+{
+	pid_t pid;
+	char *buffer;
+	int pkey, status;
+	int fd = mpa->fd;
+
+	if (no_hugepage && (mpa->flags & MAP_HUGETLB)) {
+		tst_res(TINFO, "Skip test on (%s) buffer", flag_to_str(mpa->flags));
+		return;
+	}
+
+	if (fd == 0)
+		fd = SAFE_OPEN(TEST_FILE, O_RDWR | O_CREAT, 0664);
+
+	buffer = SAFE_MMAP(NULL, size, mpa->prot, mpa->flags, fd, 0);
+
+	pkey = ltp_pkey_alloc(tc->flags, tc->access_rights);
+	if (pkey == -1)
+		tst_brk(TBROK | TERRNO, "pkey_alloc failed");
+
+	tst_res(TINFO, "Set %s on (%s) buffer", tc->name, flag_to_str(mpa->flags));
+	if (ltp_pkey_mprotect(buffer, size, mpa->prot, pkey) == -1)
+		tst_brk(TBROK | TERRNO, "pkey_mprotect failed");
+
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		tst_no_corefile(0);
+
+		switch (tc->access_rights) {
+		case PKEY_DISABLE_ACCESS:
+			tst_res(TFAIL | TERRNO,
+				"Read buffer success, buffer[0] = %d", *buffer);
+		break;
+		case PKEY_DISABLE_WRITE:
+			*buffer = 'a';
+		break;
+		}
+		exit(0);
+	}
+
+	SAFE_WAITPID(pid, &status, 0);
+
+        if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
+		tst_res(TPASS, "Child ended by %s as expected", tst_strsig(SIGSEGV));
+        else
+                tst_res(TFAIL, "Child: %s", tst_strstatus(status));
+
+	tst_res(TINFO, "Remove %s from the buffer", tc->name);
+	if (ltp_pkey_mprotect(buffer, size, mpa->prot, 0x0) == -1)
+		tst_brk(TBROK | TERRNO, "pkey_mprotect failed");
+
+	switch (mpa->prot) {
+	case PROT_READ:
+		tst_res(TPASS, "Read buffer success, buffer[0] = %d", *buffer);
+	break;
+	case PROT_WRITE:
+		*buffer = 'a';
+	break;
+	case PROT_READ | PROT_WRITE:
+	case PROT_READ | PROT_WRITE | PROT_EXEC:
+		*buffer = 'a';
+		tst_res(TPASS, "Read & Write buffer success, buffer[0] = %d", *buffer);
+	break;
+	}
+
+	if (fd >= 0)
+		SAFE_CLOSE(fd);
+
+	SAFE_MUNMAP(buffer, size);
+
+	if (ltp_pkey_free(pkey) == -1)
+		tst_brk(TBROK | TERRNO, "pkey_free failed");
+}
+
+static void verify_pkey(unsigned int i)
+{
+	long unsigned int j;
+	struct mmap_param *mpa;
+
+	struct tcase *tc = &tcases[i];
+
+	for (j = 0; j < ARRAY_SIZE(mmap_params); j++) {
+		mpa = &mmap_params[j];
+
+		pkey_test(tc, mpa);
+	}
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.needs_root = 1,
+	.needs_tmpdir = 1,
+	.forks_child = 1,
+	.test = verify_pkey,
+	.setup = setup,
+	.save_restore = save_restore,
+};
diff --git a/testcases/kernel/syscalls/poll/poll01.c b/testcases/kernel/syscalls/poll/poll01.c
index 4e82d03..11665c4 100644
--- a/testcases/kernel/syscalls/poll/poll01.c
+++ b/testcases/kernel/syscalls/poll/poll01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *	07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (C) 2015 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/ppoll/ppoll01.c b/testcases/kernel/syscalls/ppoll/ppoll01.c
index 5bfab25..2fadd06 100644
--- a/testcases/kernel/syscalls/ppoll/ppoll01.c
+++ b/testcases/kernel/syscalls/ppoll/ppoll01.c
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007-2008 ,Hitachi, Ltd
  *          Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>,
  *		       Yumiko Sugita <yumiko.sugita.yf@hitachi.com>,
  *		       Satoshi Fujiwara <sa-fuji@sdl.hitachi.co.jp>
  * Copyright (c) 2016 Linux Test Project
- *
- * 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.
  */
 
 #ifndef _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/prctl/.gitignore b/testcases/kernel/syscalls/prctl/.gitignore
index 2f46a9a..0f2c9b1 100644
--- a/testcases/kernel/syscalls/prctl/.gitignore
+++ b/testcases/kernel/syscalls/prctl/.gitignore
@@ -1,3 +1,10 @@
 /prctl01
 /prctl02
 /prctl03
+/prctl04
+/prctl05
+/prctl06
+/prctl06_execve
+/prctl07
+/prctl08
+/prctl09
diff --git a/testcases/kernel/syscalls/prctl/Makefile b/testcases/kernel/syscalls/prctl/Makefile
index bd617d8..c02b6d1 100644
--- a/testcases/kernel/syscalls/prctl/Makefile
+++ b/testcases/kernel/syscalls/prctl/Makefile
@@ -20,4 +20,6 @@
 
 include $(top_srcdir)/include/mk/testcases.mk
 
+prctl07: LDLIBS += $(CAP_LIBS)
+prctl09: LDLIBS += -lrt
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/prctl/prctl02.c b/testcases/kernel/syscalls/prctl/prctl02.c
index a6a8520..93f30b5 100644
--- a/testcases/kernel/syscalls/prctl/prctl02.c
+++ b/testcases/kernel/syscalls/prctl/prctl02.c
@@ -4,32 +4,143 @@
  *
  * 1) prctl() fails with EINVAL when an invalid value is given for option
  * 2) prctl() fails with EINVAL when option is PR_SET_PDEATHSIG & arg2 is
- * not zero or a valid signal number
+ * not zero or a valid signal number.
+ * 3) prctl() fails with EINVAL when option is PR_SET_DUMPABLE & arg2 is
+ * neither SUID_DUMP_DISABLE nor SUID_DUMP_USER.
+ * 4) prctl() fails with EFAULT when arg2 is an invalid address.
+ * 5) prctl() fails with EFAULT when option is PR_SET_SECCOMP & arg2 is
+ * SECCOMP_MODE_FILTER & arg3 is an invalid address.
+ * 6) prctl() fails with EACCES when option is PR_SET_SECCOMP & arg2 is
+ * SECCOMP_MODE_FILTER & the process does not have the CAP_SYS_ADMIN
+ * capability.
+ * 7) prctl() fails with EINVAL when option is PR_SET_TIMING & arg2 is not
+ * not PR_TIMING_STATISTICAL.
+ * 8,9) prctl() fails with EINVAL when option is PR_SET_NO_NEW_PRIVS & arg2
+ * is not equal to 1 or arg3 is nonzero.
+ * 10) prctl() fails with EINVAL when options is PR_GET_NO_NEW_PRIVS & arg2,
+ * arg3, arg4, or arg5 is nonzero.
+ * 11) prctl() fails with EINVAL when options is PR_SET_THP_DISABLE & arg3,
+ * arg4, arg5 is non-zero.
+ * 12) prctl() fails with EINVAL when options is PR_GET_THP_DISABLE & arg2,
+ * arg3, arg4, or arg5 is nonzero.
+ * 13) prctl() fails with EINVAL when options is PR_CAP_AMBIENT & an unused
+ * argument such as arg4 is nonzero.
+ * 14) prctl() fails with EINVAL when option is PR_GET_SPECULATION_CTRL and
+ * unused arguments is nonzero.
+ * 15) prctl() fails with EPERM when option is PR_SET_SECUREBITS and the
+ * caller does not have the CAP_SETPCAP capability.
+ * 16) prctl() fails with EPERM when option is PR_CAPBSET_DROP and the caller
+ * does not have the CAP_SETPCAP capability.
  */
 
 #include <errno.h>
 #include <signal.h>
 #include <sys/prctl.h>
-
+#include <linux/filter.h>
+#include <linux/capability.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include "config.h"
+#include "lapi/prctl.h"
+#include "lapi/seccomp.h"
+#include "lapi/syscalls.h"
 #include "tst_test.h"
+#include "tst_capability.h"
 
 #define OPTION_INVALID 999
-#define INVALID_ARG 999
+#define unsup_string "prctl() doesn't support this option, skip it"
+static const struct sock_filter  strict_filter[] = {
+	BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW)
+};
+
+static const struct sock_fprog strict = {
+	.len = (unsigned short)ARRAY_SIZE(strict_filter),
+	.filter = (struct sock_filter *)strict_filter
+};
+
+static unsigned long strict_addr = (unsigned long)&strict;
+
+static unsigned long bad_addr;
+static unsigned long num_0;
+static unsigned long num_1 = 1;
+static unsigned long num_2 = 2;
+static unsigned long num_invalid = 999;
+static int seccomp_nsup;
+static int nonewprivs_nsup;
+static int thpdisable_nsup;
+static int capambient_nsup;
+static int speculationctrl_nsup;
 
 static struct tcase {
 	int option;
-	unsigned long arg2;
+	unsigned long *arg2;
+	unsigned long *arg3;
 	int exp_errno;
+	char *tname;
 } tcases[] = {
-	{OPTION_INVALID, 0, EINVAL},
-	{PR_SET_PDEATHSIG, INVALID_ARG, EINVAL},
+	{OPTION_INVALID, &num_1, &num_0, EINVAL, "invalid option"},
+	{PR_SET_PDEATHSIG, &num_invalid, &num_0, EINVAL, "PR_SET_PDEATHSIG"},
+	{PR_SET_DUMPABLE, &num_2, &num_0, EINVAL, "PR_SET_DUMPABLE"},
+	{PR_SET_NAME, &bad_addr, &num_0, EFAULT, "PR_SET_NAME"},
+	{PR_SET_SECCOMP, &num_2, &bad_addr, EFAULT, "PR_SET_SECCOMP"},
+	{PR_SET_SECCOMP, &num_2, &strict_addr, EACCES, "PR_SET_SECCOMP"},
+	{PR_SET_TIMING, &num_1, &num_0, EINVAL, "PR_SET_TIMING"},
+	{PR_SET_NO_NEW_PRIVS, &num_0, &num_0, EINVAL, "PR_SET_NO_NEW_PRIVS"},
+	{PR_SET_NO_NEW_PRIVS, &num_1, &num_0, EINVAL, "PR_SET_NO_NEW_PRIVS"},
+	{PR_GET_NO_NEW_PRIVS, &num_1, &num_0, EINVAL, "PR_GET_NO_NEW_PRIVS"},
+	{PR_SET_THP_DISABLE, &num_0, &num_1, EINVAL, "PR_SET_THP_DISABLE"},
+	{PR_GET_THP_DISABLE, &num_1, &num_1, EINVAL, "PR_GET_THP_DISABLE"},
+	{PR_CAP_AMBIENT, &num_2, &num_1, EINVAL, "PR_CAP_AMBIENT"},
+	{PR_GET_SPECULATION_CTRL, &num_1, &num_0, EINVAL, "PR_GET_SPECULATION_CTRL"},
+	{PR_SET_SECUREBITS, &num_0, &num_0, EPERM, "PR_SET_SECUREBITS"},
+	{PR_CAPBSET_DROP, &num_1, &num_0, EPERM, "PR_CAPBSET_DROP"},
 };
 
 static void verify_prctl(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
 
-	TEST(prctl(tc->option, tc->arg2));
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+
+	switch (tc->option) {
+	case PR_SET_SECCOMP:
+		if (seccomp_nsup) {
+			tst_res(TCONF, "%s", unsup_string);
+			return;
+		}
+	break;
+	case PR_GET_NO_NEW_PRIVS:
+	case PR_SET_NO_NEW_PRIVS:
+		if (nonewprivs_nsup) {
+			tst_res(TCONF, "%s", unsup_string);
+			return;
+		}
+	break;
+	case PR_SET_THP_DISABLE:
+	case PR_GET_THP_DISABLE:
+		if (thpdisable_nsup) {
+			tst_res(TCONF, "%s", unsup_string);
+			return;
+		}
+	break;
+	case PR_CAP_AMBIENT:
+		if (capambient_nsup) {
+			tst_res(TCONF, "%s", unsup_string);
+			return;
+		}
+	break;
+	case PR_GET_SPECULATION_CTRL:
+		if (speculationctrl_nsup) {
+			tst_res(TCONF, "%s", unsup_string);
+			return;
+		}
+	break;
+	default:
+	break;
+	}
+
+	TEST(prctl(tc->option, *tc->arg2, *tc->arg3));
 	if (TST_RET == 0) {
 		tst_res(TFAIL, "prctl() succeeded unexpectedly");
 		return;
@@ -38,12 +149,46 @@
 	if (tc->exp_errno == TST_ERR) {
 		tst_res(TPASS | TTERRNO, "prctl() failed as expected");
 	} else {
-		tst_res(TPASS | TTERRNO, "prctl() failed unexpectedly, expected %s",
+		if (tc->option == PR_SET_SECCOMP && TST_ERR == EINVAL)
+			tst_res(TCONF, "current system was not built with CONFIG_SECCOMP_FILTER.");
+		else
+			tst_res(TFAIL | TTERRNO, "prctl() failed unexpectedly, expected %s",
 				tst_strerrno(tc->exp_errno));
 	}
 }
 
+static void setup(void)
+{
+	bad_addr = (unsigned long)tst_get_bad_addr(NULL);
+
+	TEST(prctl(PR_GET_SECCOMP));
+	if (TST_ERR == EINVAL)
+		seccomp_nsup = 1;
+
+	TEST(prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0));
+	if (TST_ERR == EINVAL)
+		nonewprivs_nsup = 1;
+
+	TEST(prctl(PR_GET_THP_DISABLE, 0, 0, 0, 0));
+	if (TST_ERR == EINVAL)
+		thpdisable_nsup = 1;
+
+	TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0, 0));
+	if (TST_ERR == EINVAL)
+		capambient_nsup = 1;
+
+	TEST(prctl(PR_GET_SPECULATION_CTRL, 0, 0, 0, 0));
+	if (TST_ERR == EINVAL)
+		speculationctrl_nsup = 1;
+}
+
 static struct tst_test test = {
+	.setup = setup,
 	.tcnt = ARRAY_SIZE(tcases),
 	.test = verify_prctl,
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
+		TST_CAP(TST_CAP_DROP, CAP_SETPCAP),
+		{}
+	},
 };
diff --git a/testcases/kernel/syscalls/prctl/prctl04.c b/testcases/kernel/syscalls/prctl/prctl04.c
new file mode 100644
index 0000000..585274a
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl04.c
@@ -0,0 +1,231 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * Test PR_GET_SECCOMP and PR_SET_SECCOMP of prctl(2).
+ * 1) If PR_SET_SECCOMP sets the SECCOMP_MODE_STRICT for the calling thread,
+ *    the only system call that the thread is permitted to make are read(2),
+ *    write(2),_exit(2)(but not exit_group(2)), and sigreturn(2).  Other
+ *    system calls result in the delivery of a SIGKILL signal. This operation
+ *    is available only if the kernel is configured with CONFIG_SECCOMP enabled.
+ * 2) If PR_SET_SECCOMP sets the SECCOMP_MODE_FILTER for the calling thread,
+ *    the system calls allowed are defined by a pointer to a Berkeley Packet
+ *    Filter. Other system calls result int the delivery of a SIGSYS signal
+ *    with SECCOMP_RET_KILL. The SECCOMP_SET_MODE_FILTER operation is available
+ *    only if the kernel is configured with CONFIG_SECCOMP_FILTER enabled.
+ * 3) If SECCOMP_MODE_FILTER filters permit fork(2), then the seccomp mode
+ *    is inherited by children created by fork(2).
+ */
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/prctl.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <linux/filter.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include "tst_test.h"
+#include "lapi/syscalls.h"
+#include "lapi/prctl.h"
+#include "config.h"
+#include "lapi/seccomp.h"
+
+#define FNAME "filename"
+
+static const struct sock_filter  strict_filter[] = {
+	BPF_STMT(BPF_LD | BPF_W | BPF_ABS, (offsetof (struct seccomp_data, nr))),
+
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_close, 5, 0),
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_exit,  4, 0),
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_wait4, 3, 0),
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_write, 2, 0),
+	BPF_JUMP(BPF_JMP | BPF_JEQ, __NR_clone, 1, 0),
+
+	BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL),
+	BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW)
+};
+
+static const struct sock_fprog  strict = {
+	.len = (unsigned short)ARRAY_SIZE(strict_filter),
+	.filter = (struct sock_filter *)strict_filter
+};
+
+static void check_strict_mode(int);
+static void check_filter_mode(int);
+
+static struct tcase {
+	void (*func_check)();
+	int pass_flag;
+	int val;
+	int exp_signal;
+	char *message;
+} tcases[] = {
+	{check_strict_mode, 1, 1, SIGKILL,
+	"SECCOMP_MODE_STRICT doesn't permit GET_SECCOMP call"},
+
+	{check_strict_mode, 0, 2, SIGKILL,
+	"SECCOMP_MODE_STRICT doesn't permit read(2) write(2) and _exit(2)"},
+
+	{check_strict_mode, 1, 3, SIGKILL,
+	"SECCOMP_MODE_STRICT doesn't permit close(2)"},
+
+	{check_filter_mode, 1, 1, SIGSYS,
+	"SECCOMP_MODE_FILTER doestn't permit GET_SECCOMP call"},
+
+	{check_filter_mode, 0, 2, SIGSYS,
+	"SECCOMP_MODE_FILTER doesn't permit close(2)"},
+
+	{check_filter_mode, 2, 3, SIGSYS,
+	"SECCOMP_MODE_FILTER doesn't permit exit()"},
+
+	{check_filter_mode, 0, 4, SIGSYS,
+	"SECCOMP_MODE_FILTER doesn't permit exit()"}
+};
+
+static void check_filter_mode_inherit(void)
+{
+	int childpid;
+	int childstatus;
+
+	childpid = SAFE_FORK();
+	if (childpid == 0) {
+		tst_res(TPASS, "SECCOMP_MODE_FILTER permits fork(2)");
+		exit(0);
+	}
+
+	wait4(childpid, &childstatus, 0, NULL);
+	if (WIFSIGNALED(childstatus) && WTERMSIG(childstatus) == SIGSYS)
+		tst_res(TPASS,
+			"SECCOMP_MODE_FILTER has been inherited by child");
+	else
+		tst_res(TFAIL,
+			"SECCOMP_MODE_FILTER isn't been inherited by child");
+}
+
+static void check_strict_mode(int val)
+{
+	int fd;
+	char buf[2];
+
+	fd = SAFE_OPEN(FNAME, O_RDWR | O_CREAT, 0666);
+
+	TEST(prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO,
+			"prctl(PR_SET_SECCOMP) sets SECCOMP_MODE_STRICT failed");
+		return;
+	}
+
+	switch (val) {
+	case 1:
+		tst_res(TPASS,
+			"prctl(PR_SET_SECCOMP) sets SECCOMP_MODE_STRICT succeed");
+		prctl(PR_GET_SECCOMP);
+		tst_res(TFAIL, "prctl(PR_GET_SECCOMP) succeed unexpectedly");
+	break;
+	case 2:
+		SAFE_WRITE(1, fd, "a", 1);
+		SAFE_READ(0, fd, buf, 1);
+		tst_res(TPASS,
+			"SECCOMP_MODE_STRICT permits read(2) write(2) and _exit(2)");
+	break;
+	case 3:
+		close(fd);
+		tst_res(TFAIL,
+			"SECCOMP_MODE_STRICT permits close(2) unexpectdly");
+	break;
+	}
+
+	tst_syscall(__NR_exit, 0);
+}
+
+static void check_filter_mode(int val)
+{
+	int fd;
+
+	fd = SAFE_OPEN(FNAME, O_RDWR | O_CREAT, 0666);
+
+	TEST(prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &strict));
+	if (TST_RET == -1) {
+		if (TST_ERR == EINVAL)
+			tst_res(TCONF,
+				"kernel doesn't support SECCOMP_MODE_FILTER");
+		else
+			tst_res(TFAIL | TERRNO,
+				"prctl(PR_SET_SECCOMP) sets SECCOMP_MODE_FILTER failed");
+		return;
+	}
+
+	switch (val) {
+	case 1:
+		tst_res(TPASS,
+			"prctl(PR_SET_SECCOMP) sets SECCOMP_MODE_FILTER succeed");
+		prctl(PR_GET_SECCOMP);
+		tst_res(TFAIL, "prctl(PR_GET_SECCOMP) succeed unexpectedly");
+	break;
+	case 2:
+		close(fd);
+		tst_res(TPASS, "SECCOMP_MODE_FILTER permits close(2)");
+	break;
+	case 3:
+		exit(0);
+	break;
+	case 4:
+		check_filter_mode_inherit();
+	break;
+	}
+
+	tst_syscall(__NR_exit, 0);
+}
+
+static void verify_prctl(unsigned int n)
+{
+	int pid;
+	int status;
+	struct tcase *tc = &tcases[n];
+
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		tc->func_check(tc->val);
+	} else {
+		SAFE_WAITPID(pid, &status, 0);
+		if (WIFSIGNALED(status) && WTERMSIG(status) == tc->exp_signal) {
+			if (tc->pass_flag)
+				tst_res(TPASS, "%s", tc->message);
+			else
+				tst_res(TFAIL, "%s", tc->message);
+			return;
+		}
+
+		if (tc->pass_flag == 2)
+			tst_res(TFAIL,
+				"SECCOMP_MODE_FILTER permits exit() unexpectedly");
+	}
+}
+
+static void setup(void)
+{
+	TEST(prctl(PR_GET_SECCOMP));
+	if (TST_RET == 0) {
+		tst_res(TINFO, "kernel support PR_GET/SET_SECCOMP");
+		return;
+	}
+
+	if (TST_ERR == EINVAL)
+		tst_brk(TCONF, "kernel doesn't support PR_GET/SET_SECCOMP");
+
+	tst_brk(TBROK | TTERRNO,
+		"current environment doesn't permit PR_GET/SET_SECCOMP");
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test = verify_prctl,
+	.tcnt = ARRAY_SIZE(tcases),
+	.forks_child = 1,
+	.needs_tmpdir = 1,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/prctl/prctl05.c b/testcases/kernel/syscalls/prctl/prctl05.c
new file mode 100644
index 0000000..1f97900
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl05.c
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * Test PR_GET_NAME and PR_SET_NAME of prctl(2).
+ * 1)Set the name of the calling thread, the name can be up to 16 bytes
+ *   long, including the terminating null byte. If exceeds 16 bytes, the
+ *   string is silently truncated.
+ * 2)Return the name of the calling thread, the buffer should allow space
+ *   for up to 16 bytes, the returned string will be null-terminated.
+ * 3)Check /proc/self/task/[tid]/comm and /proc/self/comm name whether
+ *   matches the thread name.
+ */
+
+#include <sys/prctl.h>
+#include <string.h>
+#include <stdio.h>
+#include "lapi/syscalls.h"
+#include "lapi/prctl.h"
+#include "tst_test.h"
+
+static struct tcase {
+	char setname[20];
+	char expname[20];
+} tcases[] = {
+	{"prctl05_test", "prctl05_test"},
+	{"prctl05_test_xxxxx", "prctl05_test_xx"}
+};
+
+static void check_proc_comm(char *path, char *name)
+{
+	char comm_buf[20];
+
+	SAFE_FILE_SCANF(path, "%s", comm_buf);
+	if (strcmp(name, comm_buf))
+		tst_res(TFAIL,
+			"%s has %s, expected %s", path, comm_buf, name);
+	else
+		tst_res(TPASS, "%s sets to %s", path, comm_buf);
+}
+
+static void verify_prctl(unsigned int n)
+{
+	char buf[20];
+	char comm_path[40];
+	pid_t tid;
+	struct tcase *tc = &tcases[n];
+
+	TEST(prctl(PR_SET_NAME, tc->setname));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "prctl(PR_SET_NAME) failed");
+		return;
+	}
+	tst_res(TPASS, "prctl(PR_SET_NAME, '%s') succeeded", tc->setname);
+
+	TEST(prctl(PR_GET_NAME, buf));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "prctl(PR_GET_NAME) failed");
+		return;
+	}
+
+	if (strncmp(tc->expname, buf, sizeof(buf))) {
+		tst_res(TFAIL,
+		        "prctl(PR_GET_NAME) failed, expected %s, got %s",
+		        tc->expname, buf);
+		return;
+	}
+	tst_res(TPASS, "prctl(PR_GET_NAME) succeeded, thread name is %s", buf);
+
+	tid = tst_syscall(__NR_gettid);
+
+	sprintf(comm_path, "/proc/self/task/%d/comm", tid);
+	check_proc_comm(comm_path, tc->expname);
+
+	check_proc_comm("/proc/self/comm", tc->expname);
+}
+
+static struct tst_test test = {
+	.test = verify_prctl,
+	.tcnt = ARRAY_SIZE(tcases),
+};
diff --git a/testcases/kernel/syscalls/prctl/prctl06.c b/testcases/kernel/syscalls/prctl/prctl06.c
new file mode 100644
index 0000000..0e1274a
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl06.c
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * Test PR_GET_NO_NEW_PRIVS and PR_SET_NO_NEW_PRIVS of prctl(2).
+ *
+ * 1)Return the value of the no_new_privs bit for the calling thread.
+ *  A value of 0 indicates the regular execve(2) behavior.  A value of
+ *  1 indicates execve(2) will operate in the privilege-restricting mode.
+ * 2)With no_new_privs set to 1, diables privilege granting operations
+ *  at execve-time. For example, a process will not be able to execute a
+ *  setuid binary to change their uid or gid if this bit is set. The same
+ *  is true for file capabilities.
+ * 3)The setting of this bit is inherited by children created by fork(2),
+ *  and preserved across execve(2). We also check NoNewPrivs field in
+ *  /proc/self/status if it supports.
+ */
+
+#include "prctl06.h"
+
+static uid_t nobody_uid;
+static gid_t nobody_gid;
+
+static void do_prctl(void)
+{
+	char ipc_env_var[1024];
+	char *const argv[] = {BIN_PATH, "After execve, parent process", NULL};
+	char *const childargv[] = {BIN_PATH, "After execve, child process", NULL};
+	char *const envp[] = {ipc_env_var, NULL };
+	int childpid;
+
+	check_no_new_privs(0, "parent");
+
+	TEST(prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "prctl(PR_SET_NO_NEW_PRIVS) failed");
+		return;
+	}
+	tst_res(TPASS, "prctl(PR_SET_NO_NEW_PRIVS) succeeded");
+
+	SAFE_SETGID(nobody_gid);
+	SAFE_SETUID(nobody_uid);
+
+	sprintf(ipc_env_var, IPC_ENV_VAR "=%s", getenv(IPC_ENV_VAR));
+
+	childpid = SAFE_FORK();
+	if (childpid == 0) {
+		check_no_new_privs(1, "After fork, child process");
+		execve(BIN_PATH, childargv, envp);
+		tst_brk(TFAIL | TTERRNO,
+			"child process failed to execute prctl_execve");
+
+	} else {
+		tst_reap_children();
+		check_no_new_privs(1, "parent process");
+		execve(BIN_PATH, argv, envp);
+		tst_brk(TFAIL | TTERRNO,
+			"parent process failed to execute prctl_execve");
+	}
+}
+
+static void verify_prctl(void)
+{
+	int pid;
+
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		do_prctl();
+		exit(0);
+	}
+}
+
+static void setup(void)
+{
+	struct passwd *pw;
+
+	pw = SAFE_GETPWNAM("nobody");
+	nobody_uid = pw->pw_uid;
+	nobody_gid = pw->pw_gid;
+
+	SAFE_CP(TESTBIN, TEST_REL_BIN_DIR);
+
+	SAFE_CHOWN(BIN_PATH, 0, 0);
+	SAFE_CHMOD(BIN_PATH, SUID_MODE);
+
+	TEST(prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0));
+	if (TST_RET == 0) {
+		tst_res(TINFO, "kernel supports PR_GET/SET_NO_NEW_PRIVS");
+		return;
+	}
+
+	if (TST_ERR == EINVAL)
+		tst_brk(TCONF,
+			"kernel doesn't support PR_GET/SET_NO_NEW_PRIVS");
+
+	tst_brk(TBROK | TTERRNO,
+		"current environment doesn't permit PR_GET/SET_NO_NEW_PRIVS");
+}
+
+static const char *const resfile[] = {
+	TESTBIN,
+	NULL,
+};
+
+static struct tst_test test = {
+	.resource_files = resfile,
+	.setup = setup,
+	.test_all = verify_prctl,
+	.forks_child = 1,
+	.needs_root = 1,
+	.mount_device = 1,
+	.mntpoint = MNTPOINT,
+	.child_needs_reinit = 1,
+};
diff --git a/testcases/kernel/syscalls/prctl/prctl06.h b/testcases/kernel/syscalls/prctl/prctl06.h
new file mode 100644
index 0000000..7f5be20
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl06.h
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+#ifndef PRCTL06_H
+#define PRCTL06_H
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/prctl.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <lapi/prctl.h>
+#include "tst_test.h"
+
+#define PROC_STATUS        "/proc/self/status"
+#define IPC_ENV_VAR        "LTP_IPC_PATH"
+#define MNTPOINT           "mntpoint"
+#define TESTBIN            "prctl06_execve"
+#define TEST_REL_BIN_DIR   MNTPOINT"/"
+#define BIN_PATH           MNTPOINT"/"TESTBIN
+#define SUID_MODE          (S_ISUID|S_ISGID|S_IXUSR|S_IXGRP|S_IXOTH)
+
+void check_proc_field(int val, char *name)
+{
+	static int flag = 1;
+	int field = 0;
+
+	if (!flag)
+		return;
+
+	TEST(FILE_LINES_SCANF(PROC_STATUS, "NoNewPrivs:%d", &field));
+	if (TST_RET == 1) {
+		tst_res(TCONF,
+			"%s doesn't support NoNewPrivs field", PROC_STATUS);
+		flag = 0;
+		return;
+	}
+	if (val == field)
+		tst_res(TPASS, "%s %s NoNewPrivs field expected %d got %d",
+			name, PROC_STATUS, val, field);
+	else
+		tst_res(TFAIL, "%s %s NoNewPrivs field expected %d got %d",
+			name, PROC_STATUS, val, field);
+}
+
+void check_no_new_privs(int val, char *name)
+{
+	TEST(prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0));
+	if (TST_RET == val)
+		tst_res(TPASS,
+			"%s prctl(PR_GET_NO_NEW_PRIVS) expected %d got %d",
+			name, val, val);
+	else
+		tst_res(TFAIL,
+			"%s prctl(PR_GET_NO_NEW_PRIVS) expected %d got %ld",
+			name, val, TST_RET);
+
+	check_proc_field(val, name);
+}
+
+#endif
diff --git a/testcases/kernel/syscalls/prctl/prctl06_execve.c b/testcases/kernel/syscalls/prctl/prctl06_execve.c
new file mode 100644
index 0000000..d1e60e6
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl06_execve.c
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * dummy program which is used by prctl06 testcase
+ */
+#define TST_NO_DEFAULT_MAIN
+#include "prctl06.h"
+
+
+int main(int argc, char **argv)
+{
+	struct passwd *pw;
+
+	pw = SAFE_GETPWNAM("nobody");
+
+	tst_reinit();
+	if (argc != 2)
+		tst_brk(TFAIL, "argc is %d, expected 2", argc);
+
+	check_no_new_privs(1, argv[1]);
+
+	TEST(getegid());
+	if (TST_RET == 0)
+		tst_res(TFAIL,
+			"%s getegid() returns 0 unexpectedly, it gains root privileges",
+			argv[1]);
+	if (TST_RET == pw->pw_gid)
+		tst_res(TPASS,
+			"%s getegid() returns nobody, it doesn't gain root privileges",
+			argv[1]);
+
+	TEST(geteuid());
+	if (TST_RET == 0)
+		tst_res(TFAIL,
+			"%s geteuid() returns 0 unexpectedly, it gains root privileges",
+			argv[1]);
+	if (TST_RET == pw->pw_uid)
+		tst_res(TPASS,
+			"%s geteuid() returns nobody, it doesn't gain root privileges",
+			argv[1]);
+
+	return 0;
+}
diff --git a/testcases/kernel/syscalls/prctl/prctl07.c b/testcases/kernel/syscalls/prctl/prctl07.c
new file mode 100644
index 0000000..79f7710
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl07.c
@@ -0,0 +1,195 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * Test the PR_CAP_AMBIENT of prctl(2).
+ * Reads or changes the ambient capability set of the calling thread,
+ * according to the value of arg2, which must be one of the following:
+ * 1)PR_CAP_AMBIENT_RAISE:
+ * The capability specified in arg3 is added to the ambient set.
+ * The specified capability must already be present in both pE and pI.
+ * If we set SECBIT_NO_CAP_AMBIENT_RAISE bit, raise option will be rejected
+ * and retrun EPERM. We also raise a CAP twice.
+ * 2)PR_CAP_AMBIENT_LOWER:
+ * The capability specified in arg3 is removed from the ambient set.
+ * Even though this cap is not in set, it also should return 0.
+ * 3)PR_CAP_AMBIENT_IS_SET:
+ * Returns 1 if the capability in arg3 is in the ambient set and 0 if it
+ * is not.
+ * 4)PR_CAP_AMBIENT_CLEAR_ALL:
+ * All capabilities will be removed from the ambient set. This operation
+ * requires setting arg3 to zero.
+ */
+
+#include <sys/prctl.h>
+#include <stdlib.h>
+#include "config.h"
+#ifdef HAVE_SYS_CAPABILITY_H
+# include <sys/capability.h>
+#endif
+#include "lapi/syscalls.h"
+#include "lapi/prctl.h"
+#include "lapi/securebits.h"
+#include "tst_test.h"
+
+#define PROC_STATUS "/proc/self/status"
+
+#ifdef HAVE_SYS_CAPABILITY_H
+static void check_proc_capamb(char *message, int flag)
+{
+	int cap_num;
+	char CapAmb[20];
+
+	SAFE_FILE_LINES_SCANF(PROC_STATUS, "CapAmb:%s", CapAmb);
+	cap_num = strtol(CapAmb, NULL, 16);
+	if (flag == 2) {
+		if (cap_num == 0)
+			tst_res(TPASS,
+				"%s, %s CapAmb has been clear as %d",
+				message, PROC_STATUS, cap_num);
+		else
+			tst_res(TFAIL,
+				"%s, %s CapAmb has been clear expect 0, got %d",
+				message, PROC_STATUS, cap_num);
+		return;
+	}
+	if (cap_num == (1 << CAP_NET_BIND_SERVICE))
+		tst_res(flag ? TPASS : TFAIL,
+			"%s, CapAmb in %s has CAP_NET_BIND_SERVICE",
+			message, PROC_STATUS);
+	else
+		tst_res(flag ? TFAIL : TPASS,
+			"%s, CapAmb in %s doesn't have CAP_NET_BIND_SERVICE",
+			message, PROC_STATUS);
+}
+#endif
+
+static inline void check_cap_raise(unsigned int cap, char *message, int fail_flag)
+{
+	TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, cap, 0, 0, 0));
+	switch (fail_flag) {
+	case 0:
+	if (TST_RET == 0)
+		tst_res(TPASS, "PR_CAP_AMBIENT_RAISE %s succeeded", message);
+	else
+		tst_res(TFAIL, "PR_CAP_AMBIENT_RAISE %s failed unexpectedly",
+			message);
+	break;
+	case 1:
+	if (TST_RET == 0)
+		tst_res(TFAIL,
+			"PR_CAP_AMBIENT_RAISE succeeded unexpectedly %s",
+			message);
+	else if (TST_ERR == EPERM)
+		tst_res(TPASS,
+			"PR_CAP_AMBIENT_RAISE failed with EPERM %s", message);
+	else
+		tst_res(TFAIL | TTERRNO,
+			"PR_CAP_AMBIENT_RAISE failed %s", message);
+	break;
+	}
+}
+
+static inline void check_cap_is_set(unsigned int cap, char *message, int val)
+{
+	TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, cap, 0, 0, 0));
+	if (TST_RET == 1)
+		tst_res(val ? TPASS : TFAIL,
+			"PR_CAP_AMBIENT_IS_SET %s in AmbientCap", message);
+	else if (TST_RET == 0)
+		tst_res(val ? TFAIL : TPASS,
+			"PR_CAP_AMBIENT_IS_SET %s not in AmbientCap", message);
+	else
+		tst_res(TFAIL | TTERRNO, "PR_CAP_AMBIENT_IS_SET failed");
+}
+
+static inline void check_cap_lower(unsigned int cap, char *message)
+{
+	TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, cap, 0, 0, 0));
+	if (TST_RET == -1)
+		tst_res(TFAIL | TTERRNO,
+			"PR_CAP_AMBIENT_LOWER %s failed", message);
+	else
+		tst_res(TPASS, "PR_CAP_AMBIENT_LOWER %s succeeded", message);
+}
+
+static void verify_prctl(void)
+{
+#ifdef HAVE_LIBCAP
+	cap_t caps = cap_init();
+
+	cap_value_t caplist[3] = {CAP_NET_RAW, CAP_NET_BIND_SERVICE, CAP_SETPCAP};
+	unsigned int numcaps = 3;
+
+	cap_set_flag(caps, CAP_EFFECTIVE, numcaps, caplist, CAP_SET);
+	cap_set_flag(caps, CAP_INHERITABLE, numcaps, caplist, CAP_SET);
+	cap_set_flag(caps, CAP_PERMITTED, numcaps, caplist, CAP_SET);
+	cap_set_proc(caps);
+
+	check_proc_capamb("At the beginning", 0);
+
+	cap_clear_flag(caps, CAP_INHERITABLE);
+	cap_set_proc(caps);
+	check_cap_raise(CAP_NET_BIND_SERVICE, "on non-inheritable cap", 1);
+
+	cap_set_flag(caps, CAP_INHERITABLE, numcaps, caplist, CAP_SET);
+	cap_clear_flag(caps, CAP_PERMITTED);
+	cap_set_proc(caps);
+	check_cap_raise(CAP_NET_RAW, "on non-permitted cap", 1);
+
+	cap_set_flag(caps, CAP_PERMITTED, numcaps, caplist, CAP_SET);
+	cap_set_proc(caps);
+	prctl(PR_SET_SECUREBITS, SECBIT_NO_CAP_AMBIENT_RAISE);
+	check_cap_raise(CAP_NET_BIND_SERVICE, "because of NO_RAISE_SECBIT set", 1);
+	prctl(PR_SET_SECUREBITS, 0);
+
+	check_cap_raise(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERVICE", 0);
+	/*Even this cap has been in ambient set, raise succeeds and return 0*/
+	check_cap_raise(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERIVCE twice", 0);
+
+	check_proc_capamb("After PR_CAP_AMBIENT_RAISE", 1);
+
+	check_cap_is_set(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERVICE was", 1);
+	check_cap_is_set(CAP_NET_RAW, "CAP_NET_RAW was", 0);
+	/*move a cap what was not in ambient set, it also return 0*/
+	check_cap_lower(CAP_NET_RAW, "CAP_NET_RAW(it wasn't in ambient set)");
+	check_cap_lower(CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERVICE(it was in ambient set)");
+	check_proc_capamb("After PR_CAP_AMBIENT_LORWER", 0);
+
+	prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_NET_BIND_SERVICE, 0, 0, 0);
+	tst_res(TINFO, "raise cap for clear");
+	TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0, 0));
+	if (TST_RET == 0)
+		tst_res(TPASS, "PR_CAP_AMBIENT_CLEAR ALL succeeded");
+	else
+		tst_res(TFAIL | TERRNO, "PR_AMBIENT_CLEAR_ALL failed");
+
+	check_proc_capamb("After PR_CAP_AMBIENT_CLEAN_ALL", 2);
+
+	cap_free(caps);
+#else
+	tst_res(TCONF, "libcap devel files missing during compilation");
+#endif
+}
+
+static void setup(void)
+{
+	TEST(prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL, 0, 0, 0, 0));
+	if (TST_RET == 0) {
+		tst_res(TINFO, "kernel supports PR_CAP_AMBIENT");
+		return;
+	}
+
+	if (TST_ERR == EINVAL)
+		tst_brk(TCONF, "kernel doesn't support PR_CAP_AMBIENT");
+
+	tst_brk(TBROK | TERRNO,
+		"current environment doesn't permit PR_CAP_AMBIENT");
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = verify_prctl,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/prctl/prctl08.c b/testcases/kernel/syscalls/prctl/prctl08.c
new file mode 100644
index 0000000..fd8ccb6
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl08.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * Test PR_GET_TIMERSLACK and PR_SET_TIMERSLACK of prctl(2).
+ * 1)Each thread has two associated timer slack values: a "default"
+ *   value, and a "current" value. PR_SET_TIMERSLACK sets the "current"
+ *   timer slack value for the calling thread.
+ * 2)When a new thread is created, the two timer slack values are made
+ *   the same as the "current" value of the creating thread.
+ * 3)The maximum timer slack value is ULONG_MAX. On 32bit machines, it
+ *   is a valid value(about 4s). On 64bit machines, it is about 500 years
+ *   and no person will set this over 4s.  prctl return value is int, so
+ *   we test themaximum value is INT_MAX.
+ * 4)we also check current value via /proc/self/timerslack_ns if it is
+ *  supported.
+ */
+
+#include <sys/prctl.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <linux/limits.h>
+#include "lapi/syscalls.h"
+#include "lapi/prctl.h"
+#include "tst_test.h"
+
+#define PROC_TIMERSLACK_PATH "/proc/self/timerslack_ns"
+
+static void check_reset_timerslack(char *message);
+static void check_get_timerslack(char *message, unsigned long value);
+static void check_inherit_timerslack(char *message, unsigned long value);
+static unsigned long origin_value;
+
+static struct tcase {
+	void (*func_check)();
+	unsigned long setvalue;
+	unsigned long expvalue;
+	char message[50];
+} tcases[] = {
+	{check_reset_timerslack, 0, 50000, "Reset"},
+	{check_get_timerslack, 1, 1, "Min"},
+	{check_get_timerslack, 70000, 70000, "Middle"},
+	{check_get_timerslack, INT_MAX, INT_MAX, "Max"},
+	{check_inherit_timerslack, 70000, 70000, "Child process"},
+};
+
+static int proc_flag = 1;
+
+static void check_reset_timerslack(char *message)
+{
+	check_get_timerslack(message, origin_value);
+}
+
+static void check_proc_timerslack(char *message, unsigned long value)
+{
+	unsigned long proc_value;
+
+	SAFE_FILE_SCANF(PROC_TIMERSLACK_PATH, "%lu", &proc_value);
+	if (proc_value == value)
+		tst_res(TPASS, "%s %s  got %lu expectedly",
+				message, PROC_TIMERSLACK_PATH, proc_value);
+	else
+		tst_res(TFAIL, "%s %s expected %lu got %lu",
+				message, PROC_TIMERSLACK_PATH, value, proc_value);
+}
+
+static void check_get_timerslack(char *message, unsigned long value)
+{
+	TEST(prctl(PR_GET_TIMERSLACK));
+	if ((unsigned long)TST_RET == value)
+		tst_res(TPASS, "%s prctl(PR_GET_TIMERSLACK) got %lu expectedly",
+				message, value);
+	else
+		tst_res(TFAIL, "%s prctl(PR_GET_TIMERSLACK) expected %lu got %lu",
+				message, value, TST_RET);
+
+	if (proc_flag)
+		check_proc_timerslack(message, value);
+
+}
+
+static void check_inherit_timerslack(char *message, unsigned long value)
+{
+	int pid;
+	unsigned long current_value;
+	unsigned long default_value;
+
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		current_value = prctl(PR_GET_TIMERSLACK);
+		prctl(PR_SET_TIMERSLACK, 0);
+		default_value = prctl(PR_GET_TIMERSLACK);
+		if (current_value == value && default_value == value)
+			tst_res(TPASS,
+				"%s two timer slack values are made the same as the current value(%lu) of the creating thread.",
+				message, value);
+		else
+			tst_res(TFAIL,
+				"%s current_value is %lu, default value is %lu, the parent current value is %lu",
+				message, current_value, default_value, value);
+	}
+
+}
+
+static void verify_prctl(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+
+	TEST(prctl(PR_SET_TIMERSLACK, tc->setvalue));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "prctl(PR_SET_TIMERSLACK, %lu) failed",
+					  tc->setvalue);
+		return;
+	}
+
+	tst_res(TPASS, "prctl(PR_SET_TIMERSLACK, %lu) succeed", tc->setvalue);
+	tc->func_check(tc->message, tc->expvalue);
+}
+
+static void setup(void)
+{
+	if (access(PROC_TIMERSLACK_PATH, F_OK) == -1) {
+		tst_res(TCONF, "proc doesn't support timerslack_ns interface");
+		proc_flag = 0;
+	}
+
+	TEST(prctl(PR_GET_TIMERSLACK));
+	origin_value = TST_RET;
+	tst_res(TINFO, "current timerslack value is %lu", origin_value);
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test = verify_prctl,
+	.tcnt = ARRAY_SIZE(tcases),
+	.forks_child = 1,
+};
diff --git a/testcases/kernel/syscalls/prctl/prctl09.c b/testcases/kernel/syscalls/prctl/prctl09.c
new file mode 100644
index 0000000..0d94df7
--- /dev/null
+++ b/testcases/kernel/syscalls/prctl/prctl09.c
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+
+/*
+ * Test Description:
+ *  This is a timer sample test that timer slack is 200us.
+ */
+
+#include <errno.h>
+#include <sys/prctl.h>
+#include "lapi/prctl.h"
+#include "tst_timer_test.h"
+
+int sample_fn(int clk_id, long long usec)
+{
+	struct timespec t = tst_us_to_timespec(usec);
+
+	tst_timer_start(clk_id);
+	TEST(nanosleep(&t, NULL));
+	tst_timer_stop();
+	tst_timer_sample();
+
+	if (TST_RET != 0) {
+		tst_res(TFAIL | TTERRNO,
+			"nanosleep() returned %li", TST_RET);
+		return 1;
+	}
+
+	return 0;
+}
+
+static void setup(void)
+{
+	TEST(prctl(PR_SET_TIMERSLACK, 200000));
+	if (TST_RET != 0)
+		tst_brk(TBROK | TTERRNO,
+			"prctl set timerslack 200us failed");
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.scall = "prctl()",
+	.sample = sample_fn,
+};
diff --git a/testcases/kernel/syscalls/preadv/preadv01.c b/testcases/kernel/syscalls/preadv/preadv01.c
index 2b4ad5e..95431bc 100644
--- a/testcases/kernel/syscalls/preadv/preadv01.c
+++ b/testcases/kernel/syscalls/preadv/preadv01.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2015 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
@@ -34,12 +24,8 @@
 #define CHUNK           64
 
 static int fd;
-static char buf[CHUNK];
 
-static struct iovec rd_iovec[] = {
-	{buf, CHUNK},
-	{NULL, 0},
-};
+static struct iovec *rd_iovec;
 
 static struct tcase {
 	int count;
@@ -121,4 +107,8 @@
 	.test = verify_preadv,
 	.min_kver = "2.6.30",
 	.needs_tmpdir = 1,
+	.bufs = (struct tst_buffers []) {
+		{&rd_iovec, .iov_sizes = (int[]){CHUNK, 0, -1}},
+		{},
+	}
 };
diff --git a/testcases/kernel/syscalls/preadv/preadv02.c b/testcases/kernel/syscalls/preadv/preadv02.c
index 9935e38..12d93da 100644
--- a/testcases/kernel/syscalls/preadv/preadv02.c
+++ b/testcases/kernel/syscalls/preadv/preadv02.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2015-2016 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/preadv/preadv03.c b/testcases/kernel/syscalls/preadv/preadv03.c
index f09325d..c456d41 100644
--- a/testcases/kernel/syscalls/preadv/preadv03.c
+++ b/testcases/kernel/syscalls/preadv/preadv03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/preadv2/.gitignore b/testcases/kernel/syscalls/preadv2/.gitignore
index 759d9ef..98b81ab 100644
--- a/testcases/kernel/syscalls/preadv2/.gitignore
+++ b/testcases/kernel/syscalls/preadv2/.gitignore
@@ -2,3 +2,5 @@
 /preadv201_64
 /preadv202
 /preadv202_64
+/preadv203
+/preadv203_64
diff --git a/testcases/kernel/syscalls/preadv2/Makefile b/testcases/kernel/syscalls/preadv2/Makefile
index fc1fbf3..fbedd02 100644
--- a/testcases/kernel/syscalls/preadv2/Makefile
+++ b/testcases/kernel/syscalls/preadv2/Makefile
@@ -11,4 +11,8 @@
 
 %_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64
 
+preadv203: CFLAGS += -pthread
+preadv203_64: CFLAGS += -pthread
+preadv203_64: LDFLAGS += -pthread
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/preadv2/preadv203.c b/testcases/kernel/syscalls/preadv2/preadv203.c
new file mode 100644
index 0000000..47c46d5
--- /dev/null
+++ b/testcases/kernel/syscalls/preadv2/preadv203.c
@@ -0,0 +1,283 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * This is a basic functional test for RWF_NOWAIT flag, we are attempting to
+ * force preadv2() either to return a short read or EAGAIN with three
+ * concurently running threads:
+ *
+ *  nowait_reader: reads from a random offset from a random file with
+ *                 RWF_NOWAIT flag and expects to get EAGAIN and short
+ *                 read sooner or later
+ *
+ *  writer_thread: rewrites random file in order to keep the underlying device
+ *                 busy so that pages evicted from cache cannot be faulted
+ *                 immediately
+ *
+ *  cache_dropper: attempts to evict pages from a cache in order for reader to
+ *                 hit evicted page sooner or later
+ */
+
+/*
+ * If test fails with EOPNOTSUPP you have likely hit a glibc bug:
+ *
+ * https://sourceware.org/bugzilla/show_bug.cgi?id=23579
+ *
+ * Which can be worked around by calling preadv2() directly by syscall() such as:
+ *
+ * static ssize_t sys_preadv2(int fd, const struct iovec *iov, int iovcnt,
+ *                            off_t offset, int flags)
+ * {
+ *	return syscall(SYS_preadv2, fd, iov, iovcnt, offset, offset>>32, flags);
+ * }
+ *
+ */
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <sys/uio.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <pthread.h>
+
+#include "tst_test.h"
+#include "tst_safe_pthread.h"
+#include "lapi/preadv2.h"
+
+#define CHUNK_SZ 4123
+#define CHUNKS 60
+#define MNTPOINT "mntpoint"
+#define FILES 500
+
+static int fds[FILES];
+
+static volatile int stop;
+
+static void drop_caches(void)
+{
+	SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
+}
+
+/*
+ * All files are divided in chunks each filled with the same bytes starting with
+ * '0' at offset 0 and with increasing value on each next chunk.
+ *
+ * 000....000111....111.......AAA......AAA...
+ * | chunk0 || chunk1 |  ...  |  chunk17 |
+ */
+static int verify_short_read(struct iovec *iov, size_t iov_cnt,
+		             off_t off, size_t size)
+{
+	unsigned int i;
+	size_t j, checked = 0;
+
+	for (i = 0; i < iov_cnt; i++) {
+		char *buf = iov[i].iov_base;
+		for (j = 0; j < iov[i].iov_len; j++) {
+			char exp_val = '0' + (off + checked)/CHUNK_SZ;
+
+			if (exp_val != buf[j]) {
+				tst_res(TFAIL,
+				        "Wrong value read pos %zu size %zu %c (%i) %c (%i)!",
+				        checked, size, exp_val, exp_val,
+					isprint(buf[j]) ? buf[j] : ' ', buf[j]);
+				return 1;
+			}
+
+			if (++checked >= size)
+				return 0;
+		}
+	}
+
+	return 0;
+}
+
+static void *nowait_reader(void *unused LTP_ATTRIBUTE_UNUSED)
+{
+	char buf1[CHUNK_SZ/2];
+	char buf2[CHUNK_SZ];
+	unsigned int full_read_cnt = 0, eagain_cnt = 0;
+	unsigned int short_read_cnt = 0, zero_read_cnt = 0;
+
+	struct iovec rd_iovec[] = {
+		{buf1, sizeof(buf1)},
+		{buf2, sizeof(buf2)},
+	};
+
+	while (!stop) {
+		if (eagain_cnt >= 100 && short_read_cnt >= 10)
+			stop = 1;
+
+		/* Ensure short reads doesn't happen because of tripping on EOF */
+		off_t off = random() % ((CHUNKS - 2) * CHUNK_SZ);
+		int fd = fds[random() % FILES];
+
+		TEST(preadv2(fd, rd_iovec, 2, off, RWF_NOWAIT));
+
+		if (TST_RET < 0) {
+			if (TST_ERR != EAGAIN)
+				tst_brk(TBROK | TTERRNO, "preadv2() failed");
+
+			eagain_cnt++;
+			continue;
+		}
+
+
+		if (TST_RET == 0) {
+			zero_read_cnt++;
+			continue;
+		}
+
+		if (TST_RET != CHUNK_SZ + CHUNK_SZ/2) {
+			verify_short_read(rd_iovec, 2, off, TST_RET);
+			short_read_cnt++;
+			continue;
+		}
+
+		full_read_cnt++;
+	}
+
+	tst_res(TINFO,
+	        "Number of full_reads %u, short reads %u, zero len reads %u, EAGAIN(s) %u",
+		full_read_cnt, short_read_cnt, zero_read_cnt, eagain_cnt);
+
+	return (void*)(long)eagain_cnt;
+}
+
+static void *writer_thread(void *unused)
+{
+	char buf[CHUNK_SZ];
+	unsigned int j, write_cnt = 0;
+
+	struct iovec wr_iovec[] = {
+		{buf, sizeof(buf)},
+	};
+
+	while (!stop) {
+		int fd = fds[random() % FILES];
+
+		for (j = 0; j < CHUNKS; j++) {
+			memset(buf, '0' + j, sizeof(buf));
+
+			off_t off = CHUNK_SZ * j;
+
+			if (pwritev(fd, wr_iovec, 1, off) < 0) {
+				if (errno == EBADF) {
+					tst_res(TINFO | TERRNO, "FDs closed, exiting...");
+					return unused;
+				}
+
+				tst_brk(TBROK | TERRNO, "pwritev()");
+			}
+
+			write_cnt++;
+		}
+	}
+
+	tst_res(TINFO, "Number of writes %u", write_cnt);
+
+	return unused;
+}
+
+static void *cache_dropper(void *unused)
+{
+	unsigned int drop_cnt = 0;
+
+	while (!stop) {
+		drop_caches();
+		drop_cnt++;
+	}
+
+	tst_res(TINFO, "Cache dropped %u times", drop_cnt);
+
+	return unused;
+}
+
+static void verify_preadv2(void)
+{
+	pthread_t reader, dropper, writer;
+	unsigned int max_runtime = 600;
+	void *eagains;
+
+	stop = 0;
+
+	drop_caches();
+
+	SAFE_PTHREAD_CREATE(&dropper, NULL, cache_dropper, NULL);
+	SAFE_PTHREAD_CREATE(&reader, NULL, nowait_reader, NULL);
+	SAFE_PTHREAD_CREATE(&writer, NULL, writer_thread, NULL);
+
+	while (!stop && max_runtime-- > 0)
+		usleep(100000);
+
+	stop = 1;
+
+	SAFE_PTHREAD_JOIN(reader, &eagains);
+	SAFE_PTHREAD_JOIN(dropper, NULL);
+	SAFE_PTHREAD_JOIN(writer, NULL);
+
+	if (eagains)
+		tst_res(TPASS, "Got some EAGAIN");
+	else
+		tst_res(TFAIL, "Haven't got EAGAIN");
+}
+
+static void check_preadv2_nowait(int fd)
+{
+	char buf[1];
+	struct iovec iovec[] = {
+		{buf, sizeof(buf)},
+	};
+
+	TEST(preadv2(fd, iovec, 1, 0, RWF_NOWAIT));
+
+	if (TST_ERR == EOPNOTSUPP)
+		tst_brk(TCONF | TERRNO, "preadv2()");
+}
+
+static void setup(void)
+{
+	char path[1024];
+	char buf[CHUNK_SZ];
+	unsigned int i;
+	char j;
+
+	for (i = 0; i < FILES; i++) {
+		snprintf(path, sizeof(path), MNTPOINT"/file_%i", i);
+
+		fds[i] = SAFE_OPEN(path, O_RDWR | O_CREAT, 0644);
+
+		if (i == 0)
+			check_preadv2_nowait(fds[i]);
+
+		for (j = 0; j < CHUNKS; j++) {
+			memset(buf, '0' + j, sizeof(buf));
+			SAFE_WRITE(1, fds[i], buf, sizeof(buf));
+		}
+	}
+}
+
+static void do_cleanup(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < FILES; i++) {
+		if (fds[i] > 0)
+			SAFE_CLOSE(fds[i]);
+	}
+}
+
+TST_DECLARE_ONCE_FN(cleanup, do_cleanup);
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.test_all = verify_preadv2,
+	.mntpoint = MNTPOINT,
+	.mount_device = 1,
+	.all_filesystems = 1,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/pselect/pselect03.c b/testcases/kernel/syscalls/pselect/pselect03.c
index d93ee5d..b185373 100644
--- a/testcases/kernel/syscalls/pselect/pselect03.c
+++ b/testcases/kernel/syscalls/pselect/pselect03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
  /*
   * This is basic test for pselect() returning without error.
diff --git a/testcases/kernel/syscalls/ptrace/ptrace01.c b/testcases/kernel/syscalls/ptrace/ptrace01.c
index 5a7ed5f..274e538 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace01.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace01.c
@@ -1,286 +1,107 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) 2019 Jorik Cronenberg <jcronenberg@suse.de>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
+ * Ported to new library: Jorik Cronenberg <jcronenberg@suse.de>
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * Test the functionality of ptrace() for PTRACE_TRACEME & PTRACE_KILL requests.
+ * Forked child does ptrace(PTRACE_TRACEME, ...).
+ * Then a signal is delivered to the child and verified that parent
+ * is notified via wait().
+ * After parent does ptrace(PTRACE_KILL, ..) to kill the child
+ * and parent wait() for child to finish.
+ * Test passes if child finished abnormally.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Testing two cases:
+ * 1) child ignore SIGUSR2 signal
+ * 2) using a signal handler for child for SIGUSR2
+ * In both cases, child should stop & notify parent on reception of SIGUSR2.
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: ptrace01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: functionality test for ptrace(2)
- *
- *    TEST CASE TOTAL	: 2
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This test case tests the functionality of ptrace() for
- *	PTRACE_TRACEME & PTRACE_KILL requests.
- *	Here, we fork a child & the child does ptrace(PTRACE_TRACEME, ...).
- *	Then a signal is delivered to the child & verified that parent
- *	is notified via wait(). then parent does ptrace(PTRACE_KILL, ..)
- *	to kill the child. Again parent wait() for child to finish.
- *	If child finished abnormally, test passes.
- *		We test two cases
- * 			1) By telling child to ignore SIGUSR2 signal
- * 			2) By installing a signal handler for child for SIGUSR2
- * 		In both cases, child should stop & notify parent on reception
- * 		of SIGUSR2
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 setup signal handler for SIGUSR2 signal
- *	 fork a child
- *
- *	 CHILD:
- *		setup signal handler for SIGUSR2 signal
- *		call ptrace() with PTRACE_TRACEME request
- *		send SIGUSR2 signal to self
- *	 PARENT:
- *		wait() for child.
- *		if parent is notified when child gets a signal through wait(),
- *		then
- *			do  ptrace(PTRACE_KILL, ..) on child
- * 			wait() for child to finish,
- * 			if child exited abnormaly,
- *				TEST passed
- * 			else
- * 				TEST failed
- *		else
- *			TEST failed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  ptrace01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- *
- ****************************************************************/
 
+#include <stdlib.h>
 #include <errno.h>
 #include <signal.h>
 #include <sys/wait.h>
-
 #include <config.h>
 #include "ptrace.h"
+#include "tst_test.h"
 
-#include "test.h"
+static volatile int got_signal;
 
-static void do_child(void);
-static void setup(void);
-static void cleanup(void);
-static void child_handler();
-static void parent_handler();
-
-static int got_signal = 0;
-
-char *TCID = "ptrace01";
-static int i;			/* loop test case counter, shared with do_child */
-
-int TST_TOTAL = 2;
-
-int main(int ac, char **av)
+static void child_handler(int sig LTP_ATTRIBUTE_UNUSED)
 {
+	SAFE_KILL(getppid(), SIGUSR2);
+}
 
-	int lc;
+static void parent_handler(int sig LTP_ATTRIBUTE_UNUSED)
+{
+	got_signal = 1;
+}
+
+static void do_child(unsigned int i)
+{
+	struct sigaction child_act;
+
+	if (i == 0)
+		child_act.sa_handler = SIG_IGN;
+	else
+		child_act.sa_handler = child_handler;
+
+	child_act.sa_flags = SA_RESTART;
+	sigemptyset(&child_act.sa_mask);
+
+	SAFE_SIGACTION(SIGUSR2, &child_act, NULL);
+
+	if ((ptrace(PTRACE_TRACEME, 0, 0, 0)) == -1) {
+		tst_res(TWARN, "ptrace() failed in child");
+		exit(1);
+	}
+	SAFE_KILL(getpid(), SIGUSR2);
+	exit(1);
+}
+
+static void run(unsigned int i)
+{
 	pid_t child_pid;
 	int status;
 	struct sigaction parent_act;
 
-	tst_parse_opts(ac, av, NULL, NULL);
-#ifdef UCLINUX
-	maybe_run_child(&do_child, "d", &i);
-#endif
+	got_signal = 0;
 
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; ++i) {
-			got_signal = 0;
-
-			/* Setup signal handler for parent */
-			if (i == 1) {
-				parent_act.sa_handler = parent_handler;
-				parent_act.sa_flags = SA_RESTART;
-				sigemptyset(&parent_act.sa_mask);
-
-				if ((sigaction(SIGUSR2, &parent_act, NULL))
-				    == -1) {
-					tst_resm(TWARN, "sigaction() failed"
-						 " in parent");
-					continue;
-				}
-			}
-
-			switch (child_pid = FORK_OR_VFORK()) {
-
-			case -1:
-				/* fork() failed */
-				tst_resm(TFAIL, "fork() failed");
-				continue;
-
-			case 0:
-				/* Child */
-#ifdef UCLINUX
-				if (self_exec(av[0], "d", i) < 0) {
-					tst_resm(TFAIL, "self_exec failed");
-					continue;
-				}
-#else
-				do_child();
-#endif
-
-			default:
-				/* Parent */
-				if ((waitpid(child_pid, &status, 0)) < 0) {
-					tst_resm(TFAIL, "waitpid() failed");
-					continue;
-				}
-
-				/*
-				 * Check the exit status of child. If (it exits
-				 * normally with exit value 1) OR (child came
-				 * through signal handler), Test Failed
-				 */
-
-				if (((WIFEXITED(status)) &&
-				     (WEXITSTATUS(status))) ||
-				    (got_signal == 1)) {
-					tst_resm(TFAIL, "Test Failed");
-					continue;
-				} else {
-					/* Kill child */
-					if ((ptrace(PTRACE_KILL, child_pid,
-						    0, 0)) == -1) {
-						tst_resm(TFAIL, "Test Failed:"
-							 " Parent was not able to kill"
-							 " child");
-						continue;
-					}
-				}
-
-				if ((waitpid(child_pid, &status, 0)) < 0) {
-					tst_resm(TFAIL, "waitpid() failed");
-					continue;
-				}
-
-				if (WIFEXITED(status)) {
-					/* Child exits normally */
-					tst_resm(TFAIL, "Test failed");
-				} else {
-					tst_resm(TPASS, "Test Passed");
-				}
-
-			}
-		}
+	if (i == 1) {
+		parent_act.sa_handler = parent_handler;
+		parent_act.sa_flags = SA_RESTART;
+		sigemptyset(&parent_act.sa_mask);
+		SAFE_SIGACTION(SIGUSR2, &parent_act, NULL);
 	}
 
-	/* cleanup and exit */
-	cleanup();
-	tst_exit();
+	child_pid = SAFE_FORK();
+
+	if (!child_pid)
+		do_child(i);
+
+	SAFE_WAITPID(child_pid, &status, 0);
+
+	if (((WIFEXITED(status)) && (WEXITSTATUS(status)))
+		 || (got_signal == 1))
+		tst_res(TFAIL, "Test Failed");
+	else if ((ptrace(PTRACE_KILL, child_pid, 0, 0)) == -1)
+		tst_res(TFAIL | TERRNO, "ptrace(PTRACE_KILL, %i, 0, 0) failed",
+				child_pid);
+
+	SAFE_WAITPID(child_pid, &status, 0);
+
+	if (WTERMSIG(status) == 9)
+		tst_res(TPASS, "Child %s as expected", tst_strstatus(status));
+	else
+		tst_res(TFAIL, "Child %s unexpectedly", tst_strstatus(status));
 
 }
 
-/* do_child() */
-void do_child(void)
-{
-	struct sigaction child_act;
-
-	/* Setup signal handler for child */
-	if (i == 0) {
-		child_act.sa_handler = SIG_IGN;
-	} else {
-		child_act.sa_handler = child_handler;
-	}
-	child_act.sa_flags = SA_RESTART;
-	sigemptyset(&child_act.sa_mask);
-
-	if ((sigaction(SIGUSR2, &child_act, NULL)) == -1) {
-		tst_resm(TWARN, "sigaction() failed in child");
-		exit(1);
-	}
-
-	if ((ptrace(PTRACE_TRACEME, 0, 0, 0)) == -1) {
-		tst_resm(TWARN, "ptrace() failed in child");
-		exit(1);
-	}
-	/* ensure that child bypasses signal handler */
-	if ((kill(getpid(), SIGUSR2)) == -1) {
-		tst_resm(TWARN, "kill() failed in child");
-		exit(1);
-	}
-	exit(1);
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-}
-
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-
-}
-
-/*
- * child_handler() - Signal handler for child
- */
-void child_handler(void)
-{
-
-	if ((kill(getppid(), SIGUSR2)) == -1) {
-		tst_resm(TWARN, "kill() failed in child_handler()");
-		exit(1);
-	}
-}
-
-/*
- * parent_handler() - Signal handler for parent
- */
-void parent_handler(void)
-{
-
-	got_signal = 1;
-}
+static struct tst_test test = {
+	.test = run,
+	.tcnt = 2,
+	.forks_child = 1,
+};
diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c
index 9cbaefc..9e3f751 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace07.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -190,6 +178,12 @@
 	.test_all = do_test,
 	.forks_child = 1,
 	.needs_checkpoints = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "814fb7bb7db5"},
+		{"CVE", "2017-15537"},
+		{}
+	}
+
 };
 
 #else /* !__x86_64__ */
diff --git a/testcases/kernel/syscalls/pwrite/pwrite02.c b/testcases/kernel/syscalls/pwrite/pwrite02.c
index 57aba43..221904c 100644
--- a/testcases/kernel/syscalls/pwrite/pwrite02.c
+++ b/testcases/kernel/syscalls/pwrite/pwrite02.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
- *   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
+ *   Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
@@ -31,8 +18,6 @@
  *      accessible address space, returns EFAULT.
  */
 
-#define _XOPEN_SOURCE 500
-
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
diff --git a/testcases/kernel/syscalls/pwrite/pwrite03.c b/testcases/kernel/syscalls/pwrite/pwrite03.c
index efc7747..6f53f5c 100644
--- a/testcases/kernel/syscalls/pwrite/pwrite03.c
+++ b/testcases/kernel/syscalls/pwrite/pwrite03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Carlo Marcelo Arenas Belon <carlo@gmail.com>
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Tests for a special case NULL buffer with size 0 is expected to return 0.
diff --git a/testcases/kernel/syscalls/pwritev/pwritev01.c b/testcases/kernel/syscalls/pwritev/pwritev01.c
index 76fcc6e..1ee7838 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev01.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev01.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2015 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/pwritev/pwritev02.c b/testcases/kernel/syscalls/pwritev/pwritev02.c
index 9d8ff87..82792df 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev02.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev02.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) 2015-2016 Fujitsu Ltd.
 * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* You should have received a copy of the GNU General Public License
-* alone with this program.
 */
 
 /*
diff --git a/testcases/kernel/syscalls/pwritev/pwritev03.c b/testcases/kernel/syscalls/pwritev/pwritev03.c
index ad24124..f32c368 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev03.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/quotactl/.gitignore b/testcases/kernel/syscalls/quotactl/.gitignore
index b0ef075..12896d6 100644
--- a/testcases/kernel/syscalls/quotactl/.gitignore
+++ b/testcases/kernel/syscalls/quotactl/.gitignore
@@ -1,3 +1,6 @@
 /quotactl01
 /quotactl02
 /quotactl03
+/quotactl04
+/quotactl05
+/quotactl06
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index 92b654e..ede61d7 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -1,82 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
-* Copyright (c) Crackerjack Project., 2007
-* Copyright (c) 2016 Fujitsu Ltd.
-* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
-*
-* 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.
-*
-* Test Name: quotactl01
-*
-* Description:
-* This testcase checks the basic flag of quotactl(2) for non-XFS filesystems:
-* 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user.
-* 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
-*    for user.
-* 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
-*    for user.
-* 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
-*    flag for user.
-* 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
-*    flag for user.
-* 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user.
-* 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user.
-* 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user.
-* 9) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group.
-* 10) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
-*     for group.
-* 11) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
-*     for group.
-* 12) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
-*     flag for group.
-* 13) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
-*     flag for group.
-* 14) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group.
-* 15) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group.
-* 16) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group.
-*
-*/
+ * Copyright (c) Crackerjack Project., 2007
+ * Copyright (c) 2016-2019 FUJITSU LIMITED. All rights reserved
+ * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
+ *
+ * This testcase checks the basic flag of quotactl(2) for non-XFS filesystems:
+ * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for user.
+ * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
+ *    for user.
+ * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
+ *    for user.
+ * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
+ *    flag for user.
+ * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
+ *    flag for user.
+ * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for user.
+ * 7) quotactl(2) succeeds to update quota usages with Q_SYNC flag for user.
+ * 8) quotactl(2) succeeds to get disk quota limit greater than or equal to
+ *    ID with Q_GETNEXTQUOTA flag for user.
+ * 9) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for user.
+ * 10) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for group.
+ * 11) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
+ *     for group.
+ * 12) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
+ *     for group.
+ * 13) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
+ *     flag for group.
+ * 14) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
+ *     flag for group.
+ * 15) quotactl(2) succeeds to get quota format with Q_GETFMT flag for group.
+ * 16) quotactl(2) succeeds to update quota usages with Q_SYNC flag for group.
+ * 17) quotactl(2) succeeds to get disk quota limit greater than or equal to
+ *     ID with Q_GETNEXTQUOTA flag for group.
+ * 18) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for group.
+ */
 
+#include "config.h"
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdio.h>
-#include "config.h"
-
+#include "lapi/quotactl.h"
 #include "tst_test.h"
 
-#if defined(HAVE_QUOTAV2) || defined(HAVE_QUOTAV1)
-# include <sys/quota.h>
-
-# if defined(HAVE_QUOTAV2)
-#  define _LINUX_QUOTA_VERSION  2
-#  ifndef QFMT_VFS_V0
-#   define QFMT_VFS_V0     2
-#  endif
-#  define USRPATH MNTPOINT "/aquota.user"
-#  define GRPPATH MNTPOINT "/aquota.group"
-#  define FMTID	QFMT_VFS_V0
-# else
-#  define _LINUX_QUOTA_VERSION  1
-#  ifndef QFMT_VFS_OLD
-#   define QFMT_VFS_OLD    1
-#  endif
-#  define USRPATH MNTPOINT "/quota.user"
-#  define GRPPATH MNTPOINT "/quota.group"
-#  define FMTID	QFMT_VFS_OLD
-# endif
-
-# define MNTPOINT	"mntpoint"
+#ifndef QFMT_VFS_V0
+# define QFMT_VFS_V0	2
+#endif
+#define USRPATH MNTPOINT "/aquota.user"
+#define GRPPATH MNTPOINT "/aquota.group"
+#define FMTID	QFMT_VFS_V0
+#define MNTPOINT	"mntpoint"
 
 static int32_t fmt_id = FMTID;
 static int test_id;
@@ -85,14 +58,16 @@
 	.dqb_valid = QIF_BLIMITS
 };
 static struct dqblk res_dq;
-# if defined(HAVE_QUOTAV2)
+
 static struct dqinfo set_qf = {
 	.dqi_bgrace = 80,
 	.dqi_valid = IIF_BGRACE
 };
 static struct dqinfo res_qf;
 static int32_t fmt_buf;
-# endif
+static int getnextquota_nsup;
+
+static struct if_nextdqblk res_ndq;
 
 static struct tcase {
 	int cmd;
@@ -102,84 +77,115 @@
 	void *res_data;
 	int sz;
 	char *des;
+	char *tname;
 } tcases[] = {
 	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH,
-	NULL, NULL, 0, "turn on quota for user"},
+	NULL, NULL, 0, "turn on quota for user",
+	"QCMD(Q_QUOTAON, USRQUOTA)"},
 
 	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq,
-	NULL, NULL, 0, "set disk quota limit for user"},
+	NULL, NULL, 0, "set disk quota limit for user",
+	"QCMD(Q_SETQUOTA, USRQUOTA)"},
 
 	{QCMD(Q_GETQUOTA, USRQUOTA), &test_id, &res_dq,
 	&set_dq.dqb_bsoftlimit, &res_dq.dqb_bsoftlimit,
-	sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for user"},
-# if defined(HAVE_QUOTAV2)
+	sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for user",
+	"QCMD(Q_GETQUOTA, USRQUOTA)"},
+
 	{QCMD(Q_SETINFO, USRQUOTA), &test_id, &set_qf,
-	NULL, NULL, 0, "set information about quotafile for user"},
+	NULL, NULL, 0, "set information about quotafile for user",
+	"QCMD(Q_SETINFO, USRQUOTA)"},
 
 	{QCMD(Q_GETINFO, USRQUOTA), &test_id, &res_qf,
 	&set_qf.dqi_bgrace, &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace),
-	"get information about quotafile for user"},
+	"get information about quotafile for user",
+	"QCMD(Q_GETINFO, USRQUOTA)"},
 
 	{QCMD(Q_GETFMT, USRQUOTA), &test_id, &fmt_buf,
 	&fmt_id, &fmt_buf, sizeof(fmt_buf),
-	"get quota format for user"},
-# endif
+	"get quota format for user",
+	"QCMD(Q_GETFMT, USRQUOTA)"},
+
 	{QCMD(Q_SYNC, USRQUOTA), &test_id, &res_dq,
-	NULL, NULL, 0, "update quota usages for user"},
+	NULL, NULL, 0, "update quota usages for user",
+	"QCMD(Q_SYNC, USRQUOTA)"},
+
+	{QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_id, &res_ndq,
+	&test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id),
+	"get next disk quota limit for user",
+	"QCMD(Q_GETNEXTQUOTA, USRQUOTA)"},
 
 	{QCMD(Q_QUOTAOFF, USRQUOTA), &test_id, USRPATH,
-	NULL, NULL, 0, "turn off quota for user"},
+	NULL, NULL, 0, "turn off quota for user",
+	"QCMD(Q_QUOTAOFF, USRQUOTA)"},
 
 	{QCMD(Q_QUOTAON, GRPQUOTA), &fmt_id, GRPPATH,
-	NULL, NULL, 0, "turn on quota for group"},
+	NULL, NULL, 0, "turn on quota for group",
+	"QCMD(Q_QUOTAON, GRPQUOTA)"},
 
 	{QCMD(Q_SETQUOTA, GRPQUOTA), &test_id, &set_dq,
-	NULL, NULL, 0, "set disk quota limit for group"},
+	NULL, NULL, 0, "set disk quota limit for group",
+	"QCMD(Q_SETQUOTA, GRPQUOTA)"},
 
 	{QCMD(Q_GETQUOTA, GRPQUOTA), &test_id, &res_dq, &set_dq.dqb_bsoftlimit,
 	&res_dq.dqb_bsoftlimit, sizeof(res_dq.dqb_bsoftlimit),
-	"set disk quota limit for group"},
-# if defined(HAVE_QUOTAV2)
+	"set disk quota limit for group",
+	"QCMD(Q_GETQUOTA, GRPQUOTA)"},
+
 	{QCMD(Q_SETINFO, GRPQUOTA), &test_id, &set_qf,
-	NULL, NULL, 0, "set information about quotafile for group"},
+	NULL, NULL, 0, "set information about quotafile for group",
+	"QCMD(Q_SETINFO, GRPQUOTA)"},
 
 	{QCMD(Q_GETINFO, GRPQUOTA), &test_id, &res_qf, &set_qf.dqi_bgrace,
 	&res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace),
-	"get information about quotafile for group"},
+	"get information about quotafile for group",
+	"QCMD(Q_GETINFO, GRPQUOTA)"},
 
 	{QCMD(Q_GETFMT, GRPQUOTA), &test_id, &fmt_buf,
-	&fmt_id, &fmt_buf, sizeof(fmt_buf), "get quota format for group"},
-# endif
+	&fmt_id, &fmt_buf, sizeof(fmt_buf), "get quota format for group",
+	"QCMD(Q_GETFMT, GRPQUOTA)"},
+
 	{QCMD(Q_SYNC, GRPQUOTA), &test_id, &res_dq,
-	NULL, NULL, 0, "update quota usages for group"},
+	NULL, NULL, 0, "update quota usages for group",
+	"QCMD(Q_SYNC, GRPQUOTA)"},
+
+	{QCMD(Q_GETNEXTQUOTA, GRPQUOTA), &test_id, &res_ndq,
+	&test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id),
+	"get next disk quota limit for group",
+	"QCMD(Q_GETNEXTQUOTA, GRPQUOTA)"},
 
 	{QCMD(Q_QUOTAOFF, GRPQUOTA), &test_id, GRPPATH,
-	NULL, NULL, 0, "turn off quota for group"}
+	NULL, NULL, 0, "turn off quota for group",
+	"QCMD(Q_QUOTAOFF, GRPQUOTA)"},
 };
 
 static void setup(void)
 {
-	const char *const cmd[] = {"quotacheck", "-ug", MNTPOINT, NULL};
+	const char *const cmd[] = {"quotacheck", "-ugF", "vfsv0", MNTPOINT, NULL};
 	int ret;
 
-
 	ret = tst_run_cmd(cmd, NULL, NULL, 1);
 	switch (ret) {
+	case 0:
+		break;
 	case 255:
 		tst_brk(TCONF, "quotacheck binary not installed");
+		break;
 	default:
 		tst_brk(TBROK, "quotacheck exited with %i", ret);
-	case 0:
-	break;
 	}
 
 	test_id = geteuid();
-
 	if (access(USRPATH, F_OK) == -1)
 		tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
 
 	if (access(GRPPATH, F_OK) == -1)
 		tst_brk(TFAIL | TERRNO, "group quotafile didn't exist");
+
+	TEST(quotactl(QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev,
+		test_id, (void *) &res_ndq));
+	if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
+		getnextquota_nsup = 1;
 }
 
 static void verify_quota(unsigned int n)
@@ -189,7 +195,15 @@
 	res_dq.dqb_bsoftlimit = 0;
 	res_qf.dqi_igrace = 0;
 	fmt_buf = 0;
+	res_ndq.dqb_id = -1;
 
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+	if ((tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) ||
+		tc->cmd == QCMD(Q_GETNEXTQUOTA, GRPQUOTA)) &&
+		getnextquota_nsup) {
+		tst_res(TCONF, "current system doesn't support this cmd");
+		return;
+	}
 	TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr));
 	if (TST_RET == -1) {
 		tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des);
@@ -206,9 +220,14 @@
 	tst_res(TPASS, "quotactl succeeded to %s", tc->des);
 }
 
+static const char *kconfigs[] = {
+	"CONFIG_QFMT_V2",
+	NULL
+};
+
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.needs_root = 1,
+	.needs_kconfigs = kconfigs,
 	.test = verify_quota,
 	.tcnt = ARRAY_SIZE(tcases),
 	.mount_device = 1,
@@ -217,7 +236,3 @@
 	.mnt_data = "usrquota,grpquota",
 	.setup = setup,
 };
-
-#else
-	TST_TEST_TCONF("This system didn't support quota");
-#endif
diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c
index d8b1784..cd8a0c3 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl02.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.c
@@ -1,187 +1,156 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) 2013 Fujitsu Ltd.
+ * Copyright (c) 2013-2019 FUJITSU LIMITED. All rights reserved
  * Author: DAN LI <li.dan@cn.fujitsu.com>
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*
- * Test Name: quotactl02
- *
- * Description:
  * This testcase checks basic flags of quotactl(2) for an XFS file system:
- * 1) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status.
- * 2) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status.
+ * 1) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status
+ *    for user.
+ * 2) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status
+ *    for usr.
  * 3) quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota
- *    limits.
+ *    limits for user.
  * 4) quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk
- *    quota limits.
+ *    quota limits greater than or equal to ID for user.
+ * 5) quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv
+ *    for user.
+ * 6) quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv
+ *    for user.
+ * 7) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status
+ *    for group.
+ * 8) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status
+ *    for group.
+ * 9) quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota
+ *    limits for group.
+ * 10)quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk
+ *    quota limits for group.
+ * 11)quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv
+ *    for group.
+ * 12)quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv
+ *    for group.
  */
-#define _GNU_SOURCE
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/quota.h>
-#include "config.h"
 
-#if defined(HAVE_QUOTAV2) || defined(HAVE_QUOTAV1)
-# include <sys/quota.h>
-#endif
+#include "quotactl02.h"
 
-#if defined(HAVE_XFS_QUOTA)
-# include <xfs/xqm.h>
-#endif
-
-#include "tst_test.h"
-#include "lapi/quotactl.h"
-
-#if defined(HAVE_XFS_QUOTA) && (defined(HAVE_QUOTAV2) || defined(HAVE_QUOTAV1))
-static void check_qoff(int, char *);
-static void check_qon(int, char *);
-static void check_qlim(int, char *);
-
-static uint32_t test_id;
-static struct fs_disk_quota set_dquota = {
-	.d_rtb_softlimit = 1000,
-	.d_fieldmask = FS_DQ_RTBSOFT
-};
-static uint32_t qflag = XFS_QUOTA_UDQ_ENFD;
-static const char mntpoint[] = "mnt_point";
+#ifdef HAVE_XFS_XQM_H
+static uint32_t qflagu = XFS_QUOTA_UDQ_ENFD;
+static uint32_t qflagg = XFS_QUOTA_GDQ_ENFD;
 
 static struct t_case {
 	int cmd;
 	void *addr;
 	void (*func_check)();
 	int check_subcmd;
+	int flag;
 	char *des;
+	char *tname;
 } tcases[] = {
-	{QCMD(Q_XQUOTAOFF, USRQUOTA), &qflag, check_qoff, Q_XGETQSTAT,
-	"turn off xfs quota and get xfs quota off status"},
-	{QCMD(Q_XQUOTAON, USRQUOTA), &qflag, check_qon, Q_XGETQSTAT,
-	"turn on xfs quota and get xfs quota on status"},
-	{QCMD(Q_XSETQLIM, USRQUOTA), &set_dquota, check_qlim, Q_XGETQUOTA,
-	"Q_XGETQUOTA"},
-	{QCMD(Q_XSETQLIM, USRQUOTA), &set_dquota, check_qlim, Q_XGETNEXTQUOTA,
-	"Q_XGETNEXTQUOTA"},
+	{QCMD(Q_XQUOTAOFF, USRQUOTA), &qflagu, check_qoff,
+	QCMD(Q_XGETQSTAT, USRQUOTA), 1,
+	"turn off xfs quota and get xfs quota off status for user",
+	"QCMD(Q_XGETQSTAT, USRQUOTA) off"},
+
+	{QCMD(Q_XQUOTAON, USRQUOTA), &qflagu, check_qon,
+	QCMD(Q_XGETQSTAT, USRQUOTA), 1,
+	"turn on xfs quota and get xfs quota on status for user",
+	"QCMD(Q_XGETQSTAT, USRQUOTA) on"},
+
+	{QCMD(Q_XSETQLIM, USRQUOTA), &set_dquota, check_qlim,
+	QCMD(Q_XGETQUOTA, USRQUOTA), 0, "Q_XGETQUOTA for user",
+	"QCMD(Q_XGETQUOTA, USRQUOTA) qlim"},
+
+	{QCMD(Q_XSETQLIM, USRQUOTA), &set_dquota, check_qlim,
+	QCMD(Q_XGETNEXTQUOTA, USRQUOTA), 0, "Q_XGETNEXTQUOTA for user",
+	"QCMD(Q_XGETNEXTQUOTA, USRQUOTA)"},
+
+	{QCMD(Q_XQUOTAOFF, USRQUOTA), &qflagu, check_qoffv,
+	QCMD(Q_XGETQSTATV, USRQUOTA), 1,
+	"turn off xfs quota and get xfs quota off statv for user",
+	"QCMD(Q_XGETQSTATV, USRQUOTA) off"},
+
+	{QCMD(Q_XQUOTAON, USRQUOTA), &qflagu, check_qonv,
+	QCMD(Q_XGETQSTATV, USRQUOTA), 1,
+	"turn on xfs quota and get xfs quota on statv for user",
+	"QCMD(Q_XGETQSTATV, USRQUOTA) on"},
+
+	{QCMD(Q_XQUOTAOFF, GRPQUOTA), &qflagg, check_qoff,
+	QCMD(Q_XGETQSTAT, GRPQUOTA), 1,
+	"turn off xfs quota and get xfs quota off status for group",
+	"QCMD(Q_XGETQSTAT, GRPQUOTA) off"},
+
+	{QCMD(Q_XQUOTAON, GRPQUOTA), &qflagg, check_qon,
+	QCMD(Q_XGETQSTAT, GRPQUOTA), 1,
+	"turn on xfs quota and get xfs quota on status for group",
+	"QCMD(Q_XGETQSTAT, GRPQUOTA) on"},
+
+	{QCMD(Q_XSETQLIM, GRPQUOTA), &set_dquota, check_qlim,
+	QCMD(Q_XGETQUOTA, GRPQUOTA), 0, "Q_XGETQUOTA for group",
+	"QCMD(Q_XGETQUOTA, GRPQUOTA) qlim"},
+
+	{QCMD(Q_XSETQLIM, GRPQUOTA), &set_dquota, check_qlim,
+	QCMD(Q_XGETNEXTQUOTA, GRPQUOTA), 0, "Q_XGETNEXTQUOTA for group",
+	"QCMD(Q_XGETNEXTQUOTA, GRPQUOTA)"},
+
+	{QCMD(Q_XQUOTAOFF, GRPQUOTA), &qflagg, check_qoffv,
+	QCMD(Q_XGETQSTATV, GRPQUOTA), 1,
+	"turn off xfs quota and get xfs quota off statv for group",
+	"QCMD(Q_XGETQSTATV, GRPQUOTA) off"},
+
+	{QCMD(Q_XQUOTAON, GRPQUOTA), &qflagg, check_qonv,
+	QCMD(Q_XGETQSTATV, GRPQUOTA), 1,
+	"turn on xfs quota and get xfs quota on statv for group",
+	"QCMD(Q_XGETQSTATV, GRPQUOTA) on"},
 };
 
-static void check_qoff(int subcmd, char *desp)
-{
-	int res;
-	struct fs_quota_stat res_qstat;
-
-	res = quotactl(QCMD(subcmd, USRQUOTA), tst_device->dev,
-	               test_id, (void*) &res_qstat);
-	if (res == -1) {
-		tst_res(TFAIL | TERRNO,
-			"quotactl() failed to get xfs quota off status");
-		return;
-	}
-
-	if (res_qstat.qs_flags & XFS_QUOTA_UDQ_ENFD) {
-		tst_res(TFAIL, "xfs quota enforcement was on unexpectedly");
-		return;
-	}
-
-	tst_res(TPASS, "quoactl() succeeded to %s", desp);
-}
-
-static void check_qon(int subcmd, char *desp)
-{
-	int res;
-	struct fs_quota_stat res_qstat;
-
-	res = quotactl(QCMD(subcmd, USRQUOTA), tst_device->dev,
-	               test_id, (void*) &res_qstat);
-	if (res == -1) {
-		tst_res(TFAIL | TERRNO,
-			"quotactl() failed to get xfs quota on status");
-		return;
-	}
-
-	if (!(res_qstat.qs_flags & XFS_QUOTA_UDQ_ENFD)) {
-		tst_res(TFAIL, "xfs quota enforcement was off unexpectedly");
-		return;
-	}
-
-	tst_res(TPASS, "quoactl() succeeded to %s", desp);
-}
-
-static void check_qlim(int subcmd, char *desp)
-{
-	int res;
-	static struct fs_disk_quota res_dquota;
-
-	res_dquota.d_rtb_softlimit = 0;
-
-	res = quotactl(QCMD(subcmd, USRQUOTA), tst_device->dev,
-	               test_id, (void*) &res_dquota);
-	if (res == -1) {
-		if (errno == EINVAL) {
-			tst_brk(TCONF | TERRNO,
-				"%s wasn't supported in quotactl()", desp);
-		}
-		tst_res(TFAIL | TERRNO,
-			"quotactl() failed to get xfs disk quota limits");
-		return;
-	}
-
-	if (res_dquota.d_id != test_id) {
-		tst_res(TFAIL, "quotactl() got unexpected user id %u,"
-			" expected %u", res_dquota.d_id, test_id);
-		return;
-	}
-
-	if (res_dquota.d_rtb_hardlimit != set_dquota.d_rtb_hardlimit) {
-		tst_res(TFAIL, "quotactl() got unexpected rtb soft limit %llu,"
-			" expected %llu", res_dquota.d_rtb_hardlimit,
-			set_dquota.d_rtb_hardlimit);
-		return;
-	}
-
-	tst_res(TPASS, "quoactl() succeeded to set and use %s to get xfs disk "
-		"quota limits", desp);
-}
-
 static void setup(void)
 {
 	test_id = geteuid();
+	check_support_cmd(USRQUOTA);
+	check_support_cmd(GRPQUOTA);
 }
 
 static void verify_quota(unsigned int n)
 {
 	struct t_case *tc = &tcases[n];
 
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+	if ((tc->check_subcmd == QCMD(Q_XGETNEXTQUOTA, USRQUOTA)
+			|| tc->check_subcmd == QCMD(Q_XGETNEXTQUOTA, GRPQUOTA))
+			&& x_getnextquota_nsup) {
+		tst_res(TCONF, "current system doesn't support this cmd");
+		return;
+	}
+	if ((tc->check_subcmd == QCMD(Q_XGETQSTATV, USRQUOTA)
+			|| tc->check_subcmd == QCMD(Q_XGETQSTATV, GRPQUOTA))
+			&& x_getstatv_nsup) {
+		tst_res(TCONF, "current system doesn't support this cmd");
+		return;
+	}
+
 	TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr));
 	if (TST_RET == -1) {
 		tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des);
 		return;
 	}
 
-	tc->func_check(tc->check_subcmd, tc->des);
+	if (tc->flag)
+		tc->func_check(tc->check_subcmd, tc->des, *(int *)(tc->addr));
+	else
+		tc->func_check(tc->check_subcmd, tc->des);
 }
 
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.needs_root = 1,
+	.needs_kconfigs = kconfigs,
 	.test = verify_quota,
 	.tcnt = ARRAY_SIZE(tcases),
 	.mount_device = 1,
 	.dev_fs_type = "xfs",
 	.mntpoint = mntpoint,
-	.mnt_data = "usrquota",
+	.mnt_data = "usrquota,grpquota",
 	.setup = setup,
 };
 #else
-	TST_TEST_TCONF("This system didn't support quota or xfs quota");
+	TST_TEST_TCONF("System doesn't have <xfs/xqm.h>");
 #endif
diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.h b/testcases/kernel/syscalls/quotactl/quotactl02.h
new file mode 100644
index 0000000..5140a70
--- /dev/null
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.h
@@ -0,0 +1,169 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ */
+
+#ifndef QUOTACTL02_H
+#define QUOTACTL02_H
+
+#define _GNU_SOURCE
+#include "config.h"
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include "tst_test.h"
+#include "lapi/quotactl.h"
+
+#ifdef HAVE_XFS_XQM_H
+# include <xfs/xqm.h>
+
+static struct fs_disk_quota set_dquota = {
+	.d_rtb_softlimit = 1000,
+	.d_fieldmask = FS_DQ_RTBSOFT
+};
+static uint32_t test_id;
+static int x_getnextquota_nsup;
+static int x_getstatv_nsup;
+static const char mntpoint[] = "mnt_point";
+static const char *kconfigs[] = {
+	"CONFIG_XFS_QUOTA",
+	NULL
+};
+
+void check_support_cmd(int quotatype)
+{
+	struct fs_disk_quota resfs_dquota;
+	struct fs_quota_statv resfs_qstatv = {
+		.qs_version = FS_QSTATV_VERSION1
+	};
+
+	x_getnextquota_nsup = 0;
+	x_getstatv_nsup = 0;
+
+	TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, quotatype), tst_device->dev,
+		      test_id, (void *) &resfs_dquota));
+	if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
+		x_getnextquota_nsup = 1;
+
+	TEST(quotactl(QCMD(Q_XGETQSTATV, quotatype), tst_device->dev, test_id,
+		      (void *) &resfs_qstatv));
+	if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
+		x_getstatv_nsup = 1;
+
+}
+void check_qoff(int subcmd, char *desp, int flag)
+{
+	int res;
+	struct fs_quota_stat res_qstat;
+
+	res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstat);
+	if (res == -1) {
+		tst_res(TFAIL | TERRNO,
+			"quotactl() failed to get xfs quota off status");
+		return;
+	}
+
+	if (res_qstat.qs_flags & flag) {
+		tst_res(TFAIL, "xfs quota enforcement was on unexpectedly");
+		return;
+	}
+
+	tst_res(TPASS, "quotactl() succeeded to %s", desp);
+}
+
+void check_qon(int subcmd, char *desp, int flag)
+{
+	int res;
+	struct fs_quota_stat res_qstat;
+
+	res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstat);
+	if (res == -1) {
+		tst_res(TFAIL | TERRNO,
+			"quotactl() failed to get xfs quota on status");
+		return;
+	}
+
+	if (!(res_qstat.qs_flags & flag)) {
+		tst_res(TFAIL, "xfs quota enforcement was off unexpectedly");
+		return;
+	}
+
+	tst_res(TPASS, "quotactl() succeeded to %s", desp);
+}
+
+void check_qoffv(int subcmd, char *desp, int flag)
+{
+	int res;
+	struct fs_quota_statv res_qstatv = {
+		.qs_version = FS_QSTATV_VERSION1,
+	};
+
+	res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstatv);
+	if (res == -1) {
+		tst_res(TFAIL | TERRNO,
+			"quotactl() failed to get xfs quota off stav");
+		return;
+	}
+
+	if (res_qstatv.qs_flags & flag) {
+		tst_res(TFAIL, "xfs quota enforcement was on unexpectedly");
+		return;
+	}
+
+	tst_res(TPASS, "quotactl() succeeded to %s", desp);
+}
+
+void check_qonv(int subcmd, char *desp, int flag)
+{
+	int res;
+	struct fs_quota_statv res_qstatv = {
+		.qs_version = FS_QSTATV_VERSION1
+	};
+
+	res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_qstatv);
+	if (res == -1) {
+		tst_res(TFAIL | TERRNO,
+			"quotactl() failed to get xfs quota on statv");
+		return;
+	}
+
+	if (!(res_qstatv.qs_flags & flag)) {
+		tst_res(TFAIL, "xfs quota enforcement was off unexpectedly");
+		return;
+	}
+
+	tst_res(TPASS, "quotactl() succeeded to %s", desp);
+}
+
+void check_qlim(int subcmd, char *desp)
+{
+	int res;
+	static struct fs_disk_quota res_dquota;
+
+	res_dquota.d_rtb_softlimit = 0;
+
+	res = quotactl(subcmd, tst_device->dev, test_id, (void *) &res_dquota);
+	if (res == -1) {
+		tst_res(TFAIL | TERRNO,
+			"quotactl() failed to get xfs disk quota limits");
+		return;
+	}
+
+	if (res_dquota.d_id != test_id) {
+		tst_res(TFAIL, "quotactl() got unexpected user id %u, expected %u",
+			res_dquota.d_id, test_id);
+		return;
+	}
+
+	if (res_dquota.d_rtb_hardlimit != set_dquota.d_rtb_hardlimit) {
+		tst_res(TFAIL, "quotactl() got unexpected rtb soft limit %llu, expected %llu",
+				res_dquota.d_rtb_hardlimit, set_dquota.d_rtb_hardlimit);
+		return;
+	}
+
+	tst_res(TPASS, "quotactl() succeeded to set and use %s to get xfs disk quota limits",
+			desp);
+}
+#endif /* HAVE_XFS_XQM_H */
+#endif /* QUOTACTL02_H */
diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c
index aea5735..d957195 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl03.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -36,24 +24,17 @@
  */
 
 #define _GNU_SOURCE
+#include "config.h"
 #include <errno.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/quota.h>
-#include "config.h"
-
-#if defined(HAVE_QUOTAV2) || defined(HAVE_QUOTAV1)
-# include <sys/quota.h>
-#endif
-
-#if defined(HAVE_XFS_QUOTA)
-# include <xfs/xqm.h>
-#endif
 
 #include "tst_test.h"
 #include "lapi/quotactl.h"
 
-#if defined(HAVE_XFS_QUOTA) && (defined(HAVE_QUOTAV2) || defined(HAVE_QUOTAV1))
+#ifdef HAVE_XFS_XQM_H
+# include <xfs/xqm.h>
 
 static const char mntpoint[] = "mnt_point";
 static uint32_t test_id = 0xfffffffc;
@@ -67,27 +48,30 @@
 	TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev,
 		test_id, (void *)&res_dquota));
 	if (TST_RET != -1) {
-		tst_res(TFAIL, "quotactl() found the next active ID:"
-			" %u unexpectedly", res_dquota.d_id);
+		tst_res(TFAIL, "quotactl() found the next active ID: %u unexpectedly",
+				res_dquota.d_id);
 		return;
 	}
 
-	if (TST_ERR == EINVAL) {
+	if (TST_ERR == EINVAL)
 		tst_brk(TCONF | TTERRNO,
 			"Q_XGETNEXTQUOTA wasn't supported in quotactl()");
-	}
 
-	if (TST_ERR != ENOENT) {
-		tst_res(TFAIL | TTERRNO, "quotactl() failed unexpectedly with"
-			" %s expected ENOENT", tst_strerrno(TST_ERR));
-	} else {
+	if (TST_ERR != ENOENT)
+		tst_res(TFAIL | TTERRNO, "quotactl() failed unexpectedly with %s expected ENOENT",
+				tst_strerrno(TST_ERR));
+	else
 		tst_res(TPASS, "quotactl() failed with ENOENT as expected");
-	}
 }
 
+static const char *kconfigs[] = {
+	"CONFIG_XFS_QUOTA",
+	NULL
+};
+
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.needs_root = 1,
+	.needs_kconfigs = kconfigs,
 	.test_all = verify_quota,
 	.mount_device = 1,
 	.dev_fs_type = "xfs",
@@ -96,5 +80,5 @@
 };
 
 #else
-	TST_TEST_TCONF("This system didn't support quota or xfs quota");
+	TST_TEST_TCONF("System doesn't have <xfs/xqm.h>");
 #endif
diff --git a/testcases/kernel/syscalls/quotactl/quotactl04.c b/testcases/kernel/syscalls/quotactl/quotactl04.c
new file mode 100644
index 0000000..8dab83d
--- /dev/null
+++ b/testcases/kernel/syscalls/quotactl/quotactl04.c
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * This testcase checks the basic flag of quotactl(2) for project quota on
+ * non-XFS filesystems.
+ *
+ * 1) quotactl(2) succeeds to turn on quota with Q_QUOTAON flag for project.
+ * 2) quotactl(2) succeeds to set disk quota limits with Q_SETQUOTA flag
+ *    for project.
+ * 3) quotactl(2) succeeds to get disk quota limits with Q_GETQUOTA flag
+ *    for project.
+ * 4) quotactl(2) succeeds to set information about quotafile with Q_SETINFO
+ *    flag for project.
+ * 5) quotactl(2) succeeds to get information about quotafile with Q_GETINFO
+ *    flag for project.
+ * 6) quotactl(2) succeeds to get quota format with Q_GETFMT flag for project.
+ * 7) quotactl(2) succeeds to get disk quota limit greater than or equal to
+ *    ID with Q_GETNEXTQUOTA flag for project.
+ * 8) quotactl(2) succeeds to turn off quota with Q_QUOTAOFF flag for project.
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include "config.h"
+#include "lapi/quotactl.h"
+#include "tst_test.h"
+
+#ifndef QFMT_VFS_V1
+# define QFMT_VFS_V1 4
+#endif
+
+#define FMTID QFMT_VFS_V1
+#define MNTPOINT	"mntpoint"
+static int32_t fmt_id = FMTID;
+static int test_id, mount_flag;
+static struct dqblk set_dq = {
+	.dqb_bsoftlimit = 100,
+	.dqb_valid = QIF_BLIMITS
+};
+static struct dqblk res_dq;
+static struct dqinfo set_qf = {
+	.dqi_bgrace = 80,
+	.dqi_valid = IIF_BGRACE
+};
+
+static struct dqinfo res_qf;
+static int32_t fmt_buf;
+
+static struct if_nextdqblk res_ndq;
+
+static struct tcase {
+	int cmd;
+	int *id;
+	void *addr;
+	void *set_data;
+	void *res_data;
+	int sz;
+	char *des;
+	char *tname;
+} tcases[] = {
+	{QCMD(Q_QUOTAON, PRJQUOTA), &fmt_id, NULL,
+	NULL, NULL, 0, "turn on quota for project",
+	"QCMD(Q_QUOTAON, PRJQUOTA)"},
+
+	{QCMD(Q_SETQUOTA, PRJQUOTA), &test_id, &set_dq,
+	NULL, NULL, 0, "set disk quota limit for project",
+	"QCMD(Q_SETQUOTA, PRJQUOTA)"},
+
+	{QCMD(Q_GETQUOTA, PRJQUOTA), &test_id, &res_dq,
+	&set_dq.dqb_bsoftlimit, &res_dq.dqb_bsoftlimit,
+	sizeof(res_dq.dqb_bsoftlimit), "get disk quota limit for project",
+	"QCMD(Q_GETQUOTA, PRJQUOTA)"},
+
+	{QCMD(Q_SETINFO, PRJQUOTA), &test_id, &set_qf,
+	NULL, NULL, 0, "set information about quotafile for project",
+	"QCMD(Q_SETINFO, PRJQUOTA"},
+
+	{QCMD(Q_GETINFO, PRJQUOTA), &test_id, &res_qf,
+	&set_qf.dqi_bgrace, &res_qf.dqi_bgrace, sizeof(res_qf.dqi_bgrace),
+	"get information about quotafile for project",
+	"QCMD(Q_GETINFO, PRJQUOTA"},
+
+	{QCMD(Q_GETFMT, PRJQUOTA), &test_id, &fmt_buf,
+	&fmt_id, &fmt_buf, sizeof(fmt_buf),
+	"get quota format for project", "QCMD(Q_GETFMT, PRJQUOTA)"},
+
+	{QCMD(Q_GETNEXTQUOTA, PRJQUOTA), &test_id, &res_ndq,
+	&test_id, &res_ndq.dqb_id, sizeof(res_ndq.dqb_id),
+	"get next disk quota limit for project",
+	"QCMD(Q_GETNEXTQUOTA, PRJQUOTA)"},
+
+	{QCMD(Q_QUOTAOFF, PRJQUOTA), &test_id, NULL,
+	NULL, NULL, 0, "turn off quota for project",
+	"QCMD(Q_QUOTAOFF, PRJQUOTA)"},
+
+};
+
+static void setup(void)
+{
+	const char *const extra_opts[] = {"-O quota,project", NULL};
+
+	test_id = geteuid();
+	SAFE_MKFS(tst_device->dev, tst_device->fs_type, NULL, extra_opts);
+	SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, "quota");
+	mount_flag = 1;
+}
+
+static void cleanup(void)
+{
+	if (mount_flag && tst_umount(MNTPOINT))
+		tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
+}
+
+static void verify_quota(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+
+	res_dq.dqb_bsoftlimit = 0;
+	res_qf.dqi_igrace = 0;
+	fmt_buf = 0;
+
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+
+	TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des);
+		return;
+	}
+
+	if (memcmp(tc->res_data, tc->set_data, tc->sz)) {
+		tst_res(TFAIL, "quotactl failed to %s", tc->des);
+		tst_res_hexd(TINFO, tc->res_data, tc->sz, "retval:   ");
+		tst_res_hexd(TINFO, tc->set_data, tc->sz, "expected: ");
+		return;
+	}
+
+	tst_res(TPASS, "quotactl succeeded to %s", tc->des);
+}
+
+static const char *kconfigs[] = {
+	"CONFIG_QFMT_V2",
+	NULL
+};
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.needs_kconfigs = kconfigs,
+	.min_kver = "4.10", /* commit 689c958cbe6b (ext4: add project quota support) */
+	.test = verify_quota,
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_device = 1,
+	.dev_fs_type = "ext4",
+	.mntpoint = MNTPOINT,
+};
diff --git a/testcases/kernel/syscalls/quotactl/quotactl05.c b/testcases/kernel/syscalls/quotactl/quotactl05.c
new file mode 100644
index 0000000..af5a164
--- /dev/null
+++ b/testcases/kernel/syscalls/quotactl/quotactl05.c
@@ -0,0 +1,114 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * This testcase checks basic flags of quotactl(2) for project on an XFS file
+ * system:
+ * 1) quotactl(2) succeeds to turn off xfs quota and get xfs quota off status
+ *    for project.
+ * 2) quotactl(2) succeeds to turn on xfs quota and get xfs quota on status
+ *    for project.
+ * 3) quotactl(2) succeeds to set and use Q_XGETQUOTA to get xfs disk quota
+ *    limits for project.
+ * 4) quotactl(2) succeeds to set and use Q_XGETNEXTQUOTA to get xfs disk
+ *    quota limits Cgreater than or equal to ID for project.
+ * 5) quotactl(2) succeeds to turn off xfs quota and get xfs quota off statv
+ *    for project.
+ * 6) quotactl(2) succeeds to turn on xfs quota and get xfs quota on statv
+ *    for project.
+ */
+#include "quotactl02.h"
+#if defined(HAVE_XFS_XQM_H)
+
+static uint32_t qflagp = XFS_QUOTA_PDQ_ENFD;
+static struct t_case {
+	int cmd;
+	void *addr;
+	void (*func_check)();
+	int check_subcmd;
+	int flag;
+	char *des;
+	char *tname;
+} tcases[] = {
+	{QCMD(Q_XQUOTAOFF, PRJQUOTA), &qflagp, check_qoff,
+	QCMD(Q_XGETQSTAT, PRJQUOTA), 1,
+	"turn off xfs quota and get xfs quota off status for project",
+	"QCMD(Q_XGETQSTAT, PRJQUOTA) off"},
+
+	{QCMD(Q_XQUOTAON, PRJQUOTA), &qflagp, check_qon,
+	QCMD(Q_XGETQSTAT, PRJQUOTA), 1,
+	"turn on xfs quota and get xfs quota on status for project",
+	"QCMD(Q_XGETQSTAT, PRJQUOTA) on"},
+
+	{QCMD(Q_XSETQLIM, PRJQUOTA), &set_dquota, check_qlim,
+	QCMD(Q_XGETQUOTA, PRJQUOTA), 0,
+	"Q_XGETQUOTA for project", "QCMD(Q_XGETQUOTA, PRJQUOTA) qlim"},
+
+	{QCMD(Q_XSETQLIM, PRJQUOTA), &set_dquota, check_qlim,
+	QCMD(Q_XGETNEXTQUOTA, PRJQUOTA), 0,
+	"Q_XGETNEXTQUOTA for project", "QCMD(Q_XGETNEXTQUOTA, PRJQUOTA)"},
+
+	{QCMD(Q_XQUOTAOFF, PRJQUOTA), &qflagp, check_qoffv,
+	QCMD(Q_XGETQSTATV, PRJQUOTA), 1,
+	"turn off xfs quota and get xfs quota off statv for project",
+	"QCMD(Q_XGETQSTATV, PRJQUOTA) off"},
+
+	{QCMD(Q_XQUOTAON, PRJQUOTA), &qflagp, check_qonv,
+	QCMD(Q_XGETQSTATV, PRJQUOTA), 1,
+	"turn on xfs quota and get xfs quota on statv for project",
+	"QCMD(Q_XGETQSTATV, PRJQUOTA) on"},
+};
+
+static void setup(void)
+{
+	test_id = geteuid();
+	check_support_cmd(PRJQUOTA);
+}
+
+static void verify_quota(unsigned int n)
+{
+	struct t_case *tc = &tcases[n];
+
+	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
+
+	if ((tc->check_subcmd == QCMD(Q_XGETNEXTQUOTA, PRJQUOTA))
+		&& x_getnextquota_nsup) {
+		tst_res(TCONF,
+			"current system doesn't support this cmd");
+		return;
+	}
+	if ((tc->check_subcmd == QCMD(Q_XGETQSTATV, PRJQUOTA))
+		&& x_getstatv_nsup) {
+		tst_res(TCONF,
+			"current system doesn't support this cmd");
+		return;
+	}
+
+	TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr));
+	if (TST_RET == -1) {
+		tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des);
+		return;
+	}
+
+	if (tc->flag)
+		tc->func_check(tc->check_subcmd, tc->des, *(int *)(tc->addr));
+	else
+		tc->func_check(tc->check_subcmd, tc->des);
+}
+
+static struct tst_test test = {
+	.needs_root = 1,
+	.needs_kconfigs = kconfigs,
+	.test = verify_quota,
+	.tcnt = ARRAY_SIZE(tcases),
+	.mount_device = 1,
+	.dev_fs_type = "xfs",
+	.mntpoint = mntpoint,
+	.mnt_data = "prjquota",
+	.setup = setup,
+};
+
+#else
+	TST_TEST_TCONF("This system didn't have <xfs/xqm.h>");
+#endif
diff --git a/testcases/kernel/syscalls/quotactl/quotactl06.c b/testcases/kernel/syscalls/quotactl/quotactl06.c
new file mode 100644
index 0000000..a3b4517
--- /dev/null
+++ b/testcases/kernel/syscalls/quotactl/quotactl06.c
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
+ * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
+ *
+ * Tests basic error handling of the quotactl syscall.
+ * 1) quotactl fails with EACCES when cmd is Q_QUOTAON and addr
+ * existed but not a regular file.
+ * 2) quotaclt fails with ENOENT when the file specified by special
+ * or addr does not exist.
+ * 3) quotactl fails with EBUSTY when  cmd is Q_QUOTAON and another
+ * Q_QUOTAON had already been performed.
+ * 4) quotactl fails with EFAULT when addr or special is invalid.
+ * 5) quotactl fails with EINVAL when cmd or type is invalid.
+ * 6) quotactl fails with ENOTBLK when special is not a block device.
+ * 7) quotactl fails with ESRCH when no disk quota is found for the
+ * indicated user and quotas have not been turned on for this fs.
+ * 8) quotactl fails with ESRCH when cmd is Q_QUOTAON, but the quota
+ * format was not found.
+ * 9) quotactl fails with ESRCH when cmd is Q_GETNEXTQUOTA, but there
+ * is no ID greater than or equal to id that has an active quota.
+ * 10) quotactl fails with ERANGE when cmd is Q_SETQUOTA, but the
+ * specified limits are out of the range allowed by the quota format.
+ * 11) quotactl fails with EPERM when the caller lacked the required
+ * privilege (CAP_SYS_ADMIN) for the specified operation.
+ */
+
+#include <errno.h>
+#include <sys/quota.h>
+#include "tst_test.h"
+#include "lapi/quotactl.h"
+#include "tst_capability.h"
+
+#define OPTION_INVALID 999
+#define QFMT_VFS_V0     2
+#define USRPATH MNTPOINT "/aquota.user"
+#define FMTID QFMT_VFS_V0
+
+#define MNTPOINT "mntpoint"
+#define TESTDIR1 MNTPOINT "/testdir1"
+#define TESTDIR2 MNTPOINT "/testdir2"
+
+static int32_t fmt_id = FMTID;
+static int32_t fmt_invalid = 999;
+static int test_invalid;
+static int test_id;
+static int getnextquota_nsup;
+
+static struct if_nextdqblk res_ndq;
+static struct dqblk set_dq = {
+	.dqb_bsoftlimit = 100,
+	.dqb_valid = QIF_BLIMITS
+};
+
+static struct dqblk set_dqmax = {
+	.dqb_bsoftlimit = 0x7fffffffffffffffLL,  /* 2^63-1 */
+	.dqb_valid = QIF_BLIMITS
+};
+
+struct tst_cap dropadmin = {
+	.action = TST_CAP_DROP,
+	.id = CAP_SYS_ADMIN,
+	.name = "CAP_SYS_ADMIN",
+};
+
+struct tst_cap needadmin = {
+	.action = TST_CAP_REQ,
+	.id = CAP_SYS_ADMIN,
+	.name = "CAP_SYS_ADMIN",
+};
+
+static struct tcase {
+	int cmd;
+	int *id;
+	void *addr;
+	int exp_err;
+	int on_flag;
+} tcases[] = {
+	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, TESTDIR1, EACCES, 0},
+	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, TESTDIR2, ENOENT, 0},
+	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH, EBUSY, 1},
+	{QCMD(Q_SETQUOTA, USRQUOTA), &fmt_id, NULL, EFAULT, 1},
+	{QCMD(OPTION_INVALID, USRQUOTA), &fmt_id, USRPATH, EINVAL, 0},
+	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH, ENOTBLK, 0},
+	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dq, ESRCH, 0},
+	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_invalid, USRPATH, ESRCH, 0},
+	{QCMD(Q_GETNEXTQUOTA, USRQUOTA), &test_invalid, USRPATH, ESRCH, 0},
+	{QCMD(Q_SETQUOTA, USRQUOTA), &test_id, &set_dqmax, ERANGE, 1},
+	{QCMD(Q_QUOTAON, USRQUOTA), &fmt_id, USRPATH, EPERM, 0},
+};
+
+static void verify_quotactl(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+	int quota_on = 0;
+	int drop_flag = 0;
+
+	if (tc->cmd == QCMD(Q_GETNEXTQUOTA, USRQUOTA) && getnextquota_nsup) {
+		tst_res(TCONF, "current system doesn't support Q_GETNEXTQUOTA");
+		return;
+	}
+
+	if (tc->on_flag) {
+		TEST(quotactl(QCMD(Q_QUOTAON, USRQUOTA), tst_device->dev, FMTID, USRPATH));
+		if (TST_RET == -1)
+			tst_brk(TBROK,
+				"quotactl with Q_QUOTAON returned %ld", TST_RET);
+		quota_on = 1;
+	}
+
+	if (tc->exp_err == EPERM) {
+		tst_cap_action(&dropadmin);
+		drop_flag = 1;
+	}
+
+	if (tc->exp_err == ENOTBLK)
+		TEST(quotactl(tc->cmd, "/dev/null", *tc->id, tc->addr));
+	else
+		TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr));
+	if (TST_RET == -1) {
+		if (tc->exp_err == TST_ERR) {
+			tst_res(TPASS | TTERRNO, "quotactl failed as expected");
+		} else {
+			tst_res(TFAIL | TTERRNO,
+				"quotactl failed unexpectedly; expected %s, but got",
+				tst_strerrno(tc->exp_err));
+		}
+	} else {
+		tst_res(TFAIL, "quotactl returned wrong value: %ld", TST_RET);
+	}
+
+	if (quota_on) {
+		TEST(quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), tst_device->dev, FMTID, USRPATH));
+		if (TST_RET == -1)
+			tst_brk(TBROK,
+				"quotactl with Q_QUOTAOFF returned %ld", TST_RET);
+		quota_on = 0;
+	}
+
+	if (drop_flag) {
+		tst_cap_action(&needadmin);
+		drop_flag = 0;
+	}
+}
+
+static void setup(void)
+{
+	const char *const cmd[] = {"quotacheck", "-uF", "vfsv0", MNTPOINT, NULL};
+	int ret;
+	unsigned int i;
+
+	ret = tst_run_cmd(cmd, NULL, NULL, 1);
+	switch (ret) {
+	case 0:
+		break;
+	case 255:
+		tst_brk(TCONF, "quotacheck binary not installed");
+		break;
+	default:
+		tst_brk(TBROK, "quotacheck exited with %i", ret);
+	}
+
+	if (access(USRPATH, F_OK) == -1)
+		tst_brk(TFAIL | TERRNO, "user quotafile didn't exist");
+
+	SAFE_MKDIR(TESTDIR1, 0666);
+	test_id = geteuid();
+	test_invalid = test_id + 1;
+
+	TEST(quotactl(QCMD(Q_GETNEXTQUOTA, USRQUOTA), tst_device->dev,
+		test_id, (void *) &res_ndq));
+	if (TST_ERR == EINVAL || TST_ERR == ENOSYS)
+		getnextquota_nsup = 1;
+
+	for (i = 0; i < ARRAY_SIZE(tcases); i++) {
+		if (!tcases[i].addr)
+			tcases[i].addr = tst_get_bad_addr(NULL);
+	}
+}
+
+static const char *kconfigs[] = {
+	"CONFIG_QFMT_V2",
+	NULL
+};
+
+static struct tst_test test = {
+	.setup = setup,
+	.needs_kconfigs = kconfigs,
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_quotactl,
+	.dev_fs_type = "ext4",
+	.mntpoint = MNTPOINT,
+	.mount_device = 1,
+	.mnt_data = "usrquota",
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/read/read01.c b/testcases/kernel/syscalls/read/read01.c
index 68aea09..0bae2ee 100644
--- a/testcases/kernel/syscalls/read/read01.c
+++ b/testcases/kernel/syscalls/read/read01.c
@@ -1,34 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  * Copyright (c) 2017 Fujitsu Ltd.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  */
 
 #include <errno.h>
diff --git a/testcases/kernel/syscalls/read/read02.c b/testcases/kernel/syscalls/read/read02.c
index a92f957..9199a95 100644
--- a/testcases/kernel/syscalls/read/read02.c
+++ b/testcases/kernel/syscalls/read/read02.c
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *	07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2017 Fujitsu Ltd.
  *	04/2017 Modified by Jinhui Huang
- *
- * 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
  */
 /*
  * DESCRIPTION
diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
index 39ddbd5..fb06be7 100644
--- a/testcases/kernel/syscalls/readahead/readahead02.c
+++ b/testcases/kernel/syscalls/readahead/readahead02.c
@@ -43,17 +43,11 @@
 static int pagesize;
 static unsigned long cached_max;
 static int ovl_mounted;
-
-#define MNTPOINT        "mntpoint"
-#define OVL_LOWER	MNTPOINT"/lower"
-#define OVL_UPPER	MNTPOINT"/upper"
-#define OVL_WORK	MNTPOINT"/work"
-#define OVL_MNT		MNTPOINT"/ovl"
 static int readahead_length  = 4096;
 static char sys_bdi_ra_path[PATH_MAX];
 static int orig_bdi_limit;
 
-static const char mntpoint[] = MNTPOINT;
+static const char mntpoint[] = OVL_BASE_MNTPOINT;
 
 static struct tst_option options[] = {
 	{"s:", &opt_fsizestr, "-s    testfile size (default 64MB)"},
@@ -132,7 +126,8 @@
 	char *tmp;
 	size_t i;
 
-	sprintf(testfile, "%s/testfile", use_overlay ? OVL_MNT : MNTPOINT);
+	sprintf(testfile, "%s/testfile",
+		use_overlay ? OVL_MNT : OVL_BASE_MNTPOINT);
 	tst_res(TINFO, "creating test file of size: %zu", testfile_size);
 	tmp = SAFE_MALLOC(pagesize);
 
@@ -329,27 +324,6 @@
 	}
 }
 
-static void setup_overlay(void)
-{
-	int ret;
-
-	/* Setup an overlay mount with lower dir and file */
-	SAFE_MKDIR(OVL_LOWER, 0755);
-	SAFE_MKDIR(OVL_UPPER, 0755);
-	SAFE_MKDIR(OVL_WORK, 0755);
-	SAFE_MKDIR(OVL_MNT, 0755);
-	ret = mount("overlay", OVL_MNT, "overlay", 0, "lowerdir="OVL_LOWER
-		    ",upperdir="OVL_UPPER",workdir="OVL_WORK);
-	if (ret < 0) {
-		if (errno == ENODEV) {
-			tst_res(TINFO,
-				"overlayfs is not configured in this kernel.");
-			return;
-		}
-		tst_brk(TBROK | TERRNO, "overlayfs mount failed");
-	}
-	ovl_mounted = 1;
-}
 
 /*
  * We try raising bdi readahead limit as much as we can. We write
@@ -413,7 +387,7 @@
 	setup_readahead_length();
 	tst_res(TINFO, "readahead length: %d", readahead_length);
 
-	setup_overlay();
+	ovl_mounted = TST_MOUNT_OVERLAY();
 }
 
 static void cleanup(void)
@@ -427,7 +401,6 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.mount_device = 1,
 	.mntpoint = mntpoint,
 	.setup = setup,
@@ -435,4 +408,9 @@
 	.options = options,
 	.test = test_readahead,
 	.tcnt = ARRAY_SIZE(tcases),
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "b833a3660394"},
+		{"linux-git", "5b910bd615ba"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/readlink/readlink01.c b/testcases/kernel/syscalls/readlink/readlink01.c
index 0b7f52f..389ba1f 100644
--- a/testcases/kernel/syscalls/readlink/readlink01.c
+++ b/testcases/kernel/syscalls/readlink/readlink01.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *   07/2001 Ported by Wayne Boyer
- *
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
diff --git a/testcases/kernel/syscalls/readlink/readlink03.c b/testcases/kernel/syscalls/readlink/readlink03.c
index d757cf7..01ff304 100644
--- a/testcases/kernel/syscalls/readlink/readlink03.c
+++ b/testcases/kernel/syscalls/readlink/readlink03.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *   07/2001 Ported by Wayne Boyer
- *
- * 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.
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 
 /*
diff --git a/testcases/kernel/syscalls/realpath/realpath01.c b/testcases/kernel/syscalls/realpath/realpath01.c
index fc2af2a..c0381e9 100644
--- a/testcases/kernel/syscalls/realpath/realpath01.c
+++ b/testcases/kernel/syscalls/realpath/realpath01.c
@@ -41,4 +41,8 @@
 	.setup = setup,
 	.needs_root = 1,
 	.needs_tmpdir = 1,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2018-1000001"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/recvmsg/recvmsg02.c b/testcases/kernel/syscalls/recvmsg/recvmsg02.c
index c2c6009..b15b378 100644
--- a/testcases/kernel/syscalls/recvmsg/recvmsg02.c
+++ b/testcases/kernel/syscalls/recvmsg/recvmsg02.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
  * Copyright (c) 2016 Michal Kubecek <mkubecek@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -109,4 +97,8 @@
 	.min_kver = "2.6.27",
 	.test_all = verify_recvmsg,
 	.cleanup = cleanup,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "197c949e7798"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/recvmsg/recvmsg03.c b/testcases/kernel/syscalls/recvmsg/recvmsg03.c
index d85be87..e23a7c3 100644
--- a/testcases/kernel/syscalls/recvmsg/recvmsg03.c
+++ b/testcases/kernel/syscalls/recvmsg/recvmsg03.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright(c) 2016 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * alone with this program.
  */
 
 /*
@@ -158,5 +148,9 @@
 	.forks_child = 1,
 	.needs_checkpoints = 1,
 	.setup = setup,
-	.test_all = verify_recvmsg
+	.test_all = verify_recvmsg,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "06b6a1cf6e77"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/request_key/request_key01.c b/testcases/kernel/syscalls/request_key/request_key01.c
index db7ff15..251534e 100644
--- a/testcases/kernel/syscalls/request_key/request_key01.c
+++ b/testcases/kernel/syscalls/request_key/request_key01.c
@@ -1,19 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Fujitsu Ltd.
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
  *
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * alone with this program.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/request_key/request_key02.c b/testcases/kernel/syscalls/request_key/request_key02.c
index e612301..89a7814 100644
--- a/testcases/kernel/syscalls/request_key/request_key02.c
+++ b/testcases/kernel/syscalls/request_key/request_key02.c
@@ -1,20 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Fujitsu Ltd.
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
  *
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * alone with this program.
-*/
+ */
 
 /*
  * Test Name: request_key02
diff --git a/testcases/kernel/syscalls/request_key/request_key03.c b/testcases/kernel/syscalls/request_key/request_key03.c
index 9996a6f..b508ddc 100644
--- a/testcases/kernel/syscalls/request_key/request_key03.c
+++ b/testcases/kernel/syscalls/request_key/request_key03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -200,4 +188,11 @@
 	.test_all = do_test,
 	.forks_child = 1,
 	.options = options,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-15299"},
+		{"linux-git", "60ff5b2f547a"},
+		{"CVE", "2017-15951"},
+		{"linux-git", "363b02dab09b"},
+		{},
+	}
 };
diff --git a/testcases/kernel/syscalls/request_key/request_key04.c b/testcases/kernel/syscalls/request_key/request_key04.c
index 9e4c0bf..da036bf 100644
--- a/testcases/kernel/syscalls/request_key/request_key04.c
+++ b/testcases/kernel/syscalls/request_key/request_key04.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2018 Google, Inc.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -84,4 +72,9 @@
 
 static struct tst_test test = {
 	.test_all = do_test,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-17807"},
+		{"linux-git", "4dca6ea1d943"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/request_key/request_key05.c b/testcases/kernel/syscalls/request_key/request_key05.c
index 028e25f..a17d1d0 100644
--- a/testcases/kernel/syscalls/request_key/request_key05.c
+++ b/testcases/kernel/syscalls/request_key/request_key05.c
@@ -1,21 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
- * Test for CVE-2016-6951, original reproducer can be found here:
+ * Test for CVE-2017-6951, original reproducer can be found here:
  * http://www.spinics.net/lists/keyrings/msg01845.html
  *
  * request_key() is not in glibc, so we just use the syscall directly instead
@@ -43,4 +31,8 @@
 
 static struct tst_test test = {
 	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-6951"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/rmdir/rmdir01.c b/testcases/kernel/syscalls/rmdir/rmdir01.c
index c8544b7..cf516cb 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir01.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /* DESCRIPTION
diff --git a/testcases/kernel/syscalls/rmdir/rmdir02.c b/testcases/kernel/syscalls/rmdir/rmdir02.c
index 3f36692..cb0aec8 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir02.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir02.c
@@ -1,18 +1,6 @@
-/* Copyright (c) International Business Machines  Corp., 2001
- * 07/2001 Ported by Wayne Boyer
- *
- * 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, see <http://www.gnu.org/licenses/>.
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  */
 /*
  * Description:
diff --git a/testcases/kernel/syscalls/rmdir/rmdir03.c b/testcases/kernel/syscalls/rmdir/rmdir03.c
index d3ad5b5..526cf8e 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir03.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile b/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile
index 2ef86f0..498ba8e 100644
--- a/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile
+++ b/testcases/kernel/syscalls/rt_sigqueueinfo/Makefile
@@ -21,3 +21,5 @@
 include $(top_srcdir)/include/mk/testcases.mk
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+rt_sigqueueinfo01: CFLAGS += -pthread
diff --git a/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h b/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h
new file mode 100644
index 0000000..1489afa
--- /dev/null
+++ b/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo.h
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+
+#ifndef __RT_SIGQUEUEINFO_H__
+#define __RT_SIGQUEUEINFO_H__
+
+#include "lapi/syscalls.h"
+
+static int sys_rt_sigqueueinfo(pid_t tgid, int sig, siginfo_t *uinfo)
+{
+	return tst_syscall(__NR_rt_sigqueueinfo, tgid, sig, uinfo);
+}
+
+#endif /* __RT_SIGQUEUEINFO_H__ */
diff --git a/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c b/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c
index 9d0cff9..5996e99 100644
--- a/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c
+++ b/testcases/kernel/syscalls/rt_sigqueueinfo/rt_sigqueueinfo01.c
@@ -1,102 +1,117 @@
-/******************************************************************************/
-/* Copyright (c) Crackerjack Project., 2007                                   */
-/*                                                                            */
-/* 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    */
-/*                                                                            */
-/******************************************************************************/
-/******************************************************************************/
-/*                                                                            */
-/* File:        rt_sigqueueinfo01.c                                           */
-/*                                                                            */
-/* Description: This tests the rt_sigqueueinfo() syscall.                     */
-/*		rt_sigqueueinfo() Send signal information to a signal	      */
-/*									      */
-/* Usage:  <for command-line>                                                 */
-/* rt_sigqueueinfo01 [-c n] [-e][-i n] [-I x] [-p x] [-t]                     */
-/*      where,  -c n : Run n copies concurrently.                             */
-/*              -e   : Turn on errno logging.                                 */
-/*              -i n : Execute test n times.                                  */
-/*              -I x : Execute test for x seconds.                            */
-/*              -P x : Pause for x seconds between iterations.                */
-/*              -t   : Turn on syscall timing.                                */
-/*                                                                            */
-/* Total Tests: 2                                                             */
-/*                                                                            */
-/* Test Name:   rt_sigqueueinfo01                                              */
-/* History:     Porting from Crackerjack to LTP is done by                    */
-/*              Manas Kumar Nayak maknayak@in.ibm.com>                        */
-/******************************************************************************/
-#include <sys/wait.h>
-#include <stdio.h>
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+
+/*
+ * This tests the rt_sigqueueinfo() syscall.
+ *
+ * It does so by creating a thread which registers the corresponding
+ * signal handler. After that the main thread sends a signal and data
+ * to the handler thread. If the correct signal and data is received,
+ * the test is successful.
+ */
+
 #include <signal.h>
-#include <err.h>
-#include <errno.h>
 #include <stdlib.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <string.h>
+#include "config.h"
+#include "tst_test.h"
+#include "tst_safe_pthread.h"
 
-#include "test.h"
-#include "lapi/syscalls.h"
+#ifdef HAVE_STRUCT_SIGACTION_SA_SIGACTION
+#include "rt_sigqueueinfo.h"
 
-char *TCID = "rt_sigqueueinfo01";
-int testno;
-int TST_TOTAL = 2;
+#define SIGNAL	SIGUSR1
+#define DATA	777
 
-void cleanup(void)
+static struct sigaction *sig_action;
+static int sig_rec;
+static siginfo_t *uinfo;
+static pid_t tid;
+
+static void received_signal(int sig, siginfo_t *info, void *ucontext)
 {
-
-	tst_rmdir();
-
+	if (info && ucontext) {
+		if (sig == SIGNAL && info->si_value.sival_int == DATA) {
+			tst_res(TPASS, "Received correct signal and data!");
+			sig_rec = 1;
+		} else
+			tst_res(TFAIL, "Received wrong signal and/or data!");
+	} else
+		tst_res(TFAIL, "Signal handling went wrong!");
 }
 
-void setup(void)
+static void *handle_thread(void *arg LTP_ATTRIBUTE_UNUSED)
 {
-	TEST_PAUSE;
-	tst_tmpdir();
+	int ret;
+
+	tid = tst_syscall(__NR_gettid);
+
+	ret = sigaction(SIGNAL, sig_action, NULL);
+	if (ret)
+		tst_brk(TBROK, "Failed to set sigaction for handler thread!");
+
+	TST_CHECKPOINT_WAKE(0);
+	TST_CHECKPOINT_WAIT(1);
+	return arg;
 }
 
-int main(void)
+static void verify_sigqueueinfo(void)
 {
-	int status;
-	pid_t pid;
-	pid = getpid();
-	siginfo_t uinfo;
+	pthread_t thr;
 
-	tst_count = 0;
-	for (testno = 0; testno < TST_TOTAL; ++testno) {
-		TEST(pid = fork());
-		setup();
-		if (TEST_RETURN < 0)
-			tst_brkm(TFAIL | TTERRNO, cleanup, "fork failed");
-		else if (TEST_RETURN == 0) {
-			uinfo.si_errno = 0;
-			uinfo.si_code = SI_QUEUE;
-			TEST(ltp_syscall(__NR_rt_sigqueueinfo, getpid(),
-				SIGCHLD, &uinfo));
-			if (TEST_RETURN != 0)
-				err(1, "rt_sigqueueinfo");
-			exit(0);
-		} else {
-			wait(&status);
-			if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
-				tst_resm(TPASS, "Test Succeeded");
-			else
-				tst_resm(TFAIL, "Test Failed");
-		}
-		cleanup();
+	SAFE_PTHREAD_CREATE(&thr, NULL, handle_thread, NULL);
+
+	TST_CHECKPOINT_WAIT(0);
+
+	TEST(sys_rt_sigqueueinfo(tid, SIGNAL, uinfo));
+	if (TST_RET != 0) {
+		tst_res(TFAIL | TTERRNO, "rt_sigqueueinfo() failed");
+		return;
 	}
-	tst_exit();
+
+	TST_CHECKPOINT_WAKE(1);
+	SAFE_PTHREAD_JOIN(thr, NULL);
+
+	if (sig_rec)
+		tst_res(TPASS, "rt_sigqueueinfo() was successful!");
 }
+
+static void setup(void)
+{
+	sig_action = SAFE_MALLOC(sizeof(struct sigaction));
+
+	memset(sig_action, 0, sizeof(*sig_action));
+	sig_action->sa_sigaction = received_signal;
+	sig_action->sa_flags = SA_SIGINFO;
+
+	uinfo = SAFE_MALLOC(sizeof(siginfo_t));
+
+	memset(uinfo, 0, sizeof(*uinfo));
+	uinfo->si_code = SI_QUEUE;
+	uinfo->si_pid = getpid();
+	uinfo->si_uid = getuid();
+	uinfo->si_value.sival_int = DATA;
+
+	sig_rec = 0;
+}
+
+static void cleanup(void)
+{
+	free(uinfo);
+	free(sig_action);
+}
+
+static struct tst_test test = {
+	.test_all = verify_sigqueueinfo,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_checkpoints = 1,
+	.timeout = 20,
+};
+
+#else
+	TST_TEST_TCONF(
+		"This system does not support rt_sigqueueinfo().");
+#endif /* HAVE_STRUCT_SIGACTION_SA_SIGACTION */
diff --git a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
index e577cf2..511d5fc 100644
--- a/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
+++ b/testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
@@ -1,12 +1,8 @@
-/******************************************************************************/
-/* Copyright (c) Crackerjack Project., 2007                                   */
-/*                                                                            */
-/* History:     Porting from Crackerjack to LTP is done by                    */
-/*              Manas Kumar Nayak maknayak@in.ibm.com>                        */
-/******************************************************************************/
-
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Description: This tests the rt_sigsuspend() syscall.
+ * Copyright (c) Crackerjack Project., 2007
+ * Porting from Crackerjack to LTP is done by
+ * Manas Kumar Nayak maknayak@in.ibm.com>
  *
  * Waits for SIGALRM in rt_sigsuspend() then checks that process mask wasn't
  * modified.
diff --git a/testcases/kernel/syscalls/sbrk/sbrk03.c b/testcases/kernel/syscalls/sbrk/sbrk03.c
index 8568624..80d2020 100644
--- a/testcases/kernel/syscalls/sbrk/sbrk03.c
+++ b/testcases/kernel/syscalls/sbrk/sbrk03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project.
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -78,4 +66,8 @@
 
 static struct tst_test test = {
 	.test_all = sbrk_test,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "473a06572fcd"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c b/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
index e9367d6..d9d6530 100644
--- a/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
+++ b/testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity01.c
@@ -1,33 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+ * Copyright (c) 2019 FUJITSU LIMITED.
  *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
+ * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
  */
 
 /*
- * This test verifies sched_setaffinity(2) for all error conditions
- * to occur correctly.
- *
- * sched_setaffinity() returns -1 and sets the error code to:
- *
- * 1) EFAULT, if the supplied memory address is invalid
- * 2) EINVAL, if the mask doesn't contain at least one
- *    permitted cpu
- * 3) ESRCH, if the process whose id is pid could not
- *    be found
- * 4) EPERM, if the calling process doesn't have appropriate
- *    privileges
+ * Description:
+ * Check various errnos for sched_setaffinity():
+ * 1) EFAULT, if the supplied memory address is invalid.
+ * 2) EINVAL, if the mask doesn't contain at least one permitted cpu.
+ * 3) ESRCH, if the process whose id is pid could not be found.
+ * 4) EPERM, if the calling process doesn't have appropriate privileges.
  */
 
 #define _GNU_SOURCE
@@ -36,142 +21,115 @@
 #include <sched.h>
 #include <signal.h>
 #include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "test.h"
-#include "safe_macros.h"
+#include <stdlib.h>
+
+#include "tst_test.h"
+#include "tst_safe_macros.h"
 #include "lapi/cpuset.h"
 #include "lapi/syscalls.h"
 
-char *TCID = "sched_setaffinity01";
-
-#define PID_MAX_PATH "/proc/sys/kernel/pid_max"
-
-static cpu_set_t *mask, *emask;
-static cpu_set_t *fmask = (void *)-1;
+static cpu_set_t *mask, *emask, *fmask;
 static size_t mask_size, emask_size;
 static pid_t self_pid, privileged_pid, free_pid;
-static uid_t uid;
-static const char nobody_uid[] = "nobody";
 static struct passwd *ltpuser;
-static long ncpus;
 
-static struct test_case_t {
+static struct tcase {
 	pid_t *pid;
-	size_t *mask_size;
+	size_t *size;
 	cpu_set_t **mask;
 	int exp_errno;
-} test_cases[] = {
+} tcases[] = {
 	{&self_pid, &mask_size, &fmask, EFAULT},
 	{&self_pid, &emask_size, &emask, EINVAL},
 	{&free_pid, &mask_size, &mask, ESRCH},
 	{&privileged_pid, &mask_size, &mask, EPERM},
 };
 
-int TST_TOTAL = ARRAY_SIZE(test_cases);
-
-static void cleanup(void)
+static void kill_pid(void)
 {
-	if (mask != NULL) {
-		CPU_FREE(mask);
-		mask = NULL;
+	SAFE_KILL(privileged_pid, SIGKILL);
+	SAFE_WAITPID(privileged_pid, NULL, 0);
+	SAFE_SETEUID(0);
+}
+
+static void verify_test(unsigned int n)
+{
+	struct tcase *tc = &tcases[n];
+
+	if (tc->exp_errno == EPERM) {
+		privileged_pid = SAFE_FORK();
+		if (privileged_pid == 0) {
+			pause();
+			exit(0);
+		}
+
+		SAFE_SETEUID(ltpuser->pw_uid);
 	}
 
-	if (emask != NULL) {
-		CPU_FREE(emask);
-		emask = NULL;
+	TEST(tst_syscall(__NR_sched_setaffinity,
+			*tc->pid, *tc->size, *tc->mask));
+
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "sched_setaffinity() succeded unexpectedly");
+		kill_pid();
+		return;
 	}
 
-	SAFE_SETEUID(NULL, uid);
-
-	if (privileged_pid > 0) {
-		kill(privileged_pid, SIGKILL);
-		waitpid(privileged_pid, NULL, 0);
-		privileged_pid = 0;
+	if (TST_ERR != tc->exp_errno) {
+		tst_res(TFAIL | TTERRNO,
+			"sched_setaffinity() should fail with %s, got",
+			tst_strerrno(tc->exp_errno));
+	} else {
+		tst_res(TPASS | TTERRNO, "sched_setaffinity() failed");
 	}
+
+	if (tc->exp_errno == EPERM)
+		kill_pid();
 }
 
 static void setup(void)
 {
-	tst_require_root();
-	uid = geteuid();
+	long ncpus;
 	ncpus = tst_ncpus_max();
+	fmask = tst_get_bad_addr(NULL);
 
-	/* Current mask */
 	mask = CPU_ALLOC(ncpus);
-	if (mask == NULL)
-		tst_brkm(TBROK | TERRNO, cleanup, "CPU_ALLOC(%ld) failed",
-			ncpus);
-	mask_size = CPU_ALLOC_SIZE(ncpus);
-	if (sched_getaffinity(0, mask_size, mask) < 0)
-		tst_brkm(TBROK | TERRNO, cleanup, "sched_getaffinity() failed");
+	if (!mask)
+		tst_brk(TBROK | TTERRNO, "CPU_ALLOC() failed");
 
-	/* Mask with one more cpu than available on the system */
+	mask_size = CPU_ALLOC_SIZE(ncpus);
+
+	if (sched_getaffinity(0, mask_size, mask) < 0)
+		tst_brk(TBROK | TTERRNO, "sched_getaffinity() failed");
+
 	emask = CPU_ALLOC(ncpus + 1);
-	if (emask == NULL)
-		tst_brkm(TBROK | TERRNO, cleanup, "CPU_ALLOC(%ld) failed",
-			ncpus + 1);
+	if (!emask)
+		tst_brk(TBROK | TTERRNO, "CPU_ALLOC() failed");
+
 	emask_size = CPU_ALLOC_SIZE(ncpus + 1);
 	CPU_ZERO_S(emask_size, emask);
 	CPU_SET_S(ncpus, emask_size, emask);
 
-	privileged_pid = tst_fork();
-	if (privileged_pid == 0) {
-		pause();
+	ltpuser = SAFE_GETPWNAM("nobody");
 
-		exit(0);
-	} else if (privileged_pid < 0) {
-		tst_brkm(TBROK | TERRNO, cleanup, "fork() failed");
-	}
-
-	/* Dropping the root privileges */
-	ltpuser = getpwnam(nobody_uid);
-	if (ltpuser == NULL)
-		tst_brkm(TBROK | TERRNO, cleanup,
-			"getpwnam failed for user id %s", nobody_uid);
-
-	SAFE_SETEUID(cleanup, ltpuser->pw_uid);
-
-	/* this pid is not used by the OS */
-	free_pid = tst_get_unused_pid(cleanup);
+	free_pid = tst_get_unused_pid();
 }
 
-int main(int argc, char *argv[])
+static void cleanup(void)
 {
-	int lc;
-	int i;
+	if (mask)
+		CPU_FREE(mask);
 
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-		for (i = 0; i < TST_TOTAL; i++) {
-			/* Avoid calling glibc wrapper function, as it may
-			 * try to read/validate data in cpu mask. This test
-			 * is passing invalid pointer on purpose. */
-			TEST(ltp_syscall(__NR_sched_setaffinity,
-				*(test_cases[i].pid),
-				*(test_cases[i].mask_size),
-				*(test_cases[i].mask)));
-
-			if (TEST_RETURN != -1)
-				tst_resm(TFAIL,
-					"sched_setaffinity() unexpectedly succeded");
-
-			if (TEST_ERRNO == test_cases[i].exp_errno) {
-				tst_resm(TPASS, "expected failure with '%s'",
-					strerror(test_cases[i].exp_errno));
-			} else {
-				tst_resm(TFAIL,
-					"call returned '%s', expected - '%s'",
-					strerror(TEST_ERRNO),
-					strerror(test_cases[i].exp_errno));
-			}
-		}
-	}
-
-	cleanup();
-	tst_exit();
+	if (emask)
+		CPU_FREE(emask);
 }
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = verify_test,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_tmpdir = 1,
+	.forks_child = 1,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
index dd3853b..22f4e34 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
+++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project.
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c b/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
index 7411467..3708410 100644
--- a/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
+++ b/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
@@ -22,35 +22,27 @@
 
 static int send_sockfd;
 static int receive_sockfd;
-static struct mmsghdr msg[VLEN];
-static struct iovec msg1[2], msg2;
+static struct mmsghdr *snd_msg, *rcv_msg;
+static struct iovec *snd1, *snd2, *rcv1, *rcv2;
 
 static void run(void)
 {
-	struct mmsghdr msgs_in[VLEN];
-	struct iovec iovecs[VLEN];
-	char bufs[VLEN][BUFSIZE+1];
 	struct timespec timeout;
-	int i, retval;
+	int retval;
 
-	retval = do_sendmmsg(send_sockfd, msg, VLEN, 0);
-	if (retval < 0 || msg[0].msg_len != 6 || msg[1].msg_len != 5) {
+	retval = do_sendmmsg(send_sockfd, snd_msg, VLEN, 0);
+	if (retval < 0 || snd_msg[0].msg_len != 6 || snd_msg[1].msg_len != 6) {
 		tst_res(TFAIL|TTERRNO, "sendmmsg failed");
 		return;
 	}
 
-	memset(msgs_in, 0, sizeof(msgs_in));
-	for (i = 0; i < VLEN; i++) {
-		iovecs[i].iov_base = bufs[i];
-		iovecs[i].iov_len = BUFSIZE;
-		msgs_in[i].msg_hdr.msg_iov = &iovecs[i];
-		msgs_in[i].msg_hdr.msg_iovlen = 1;
-	}
+	memset(rcv1->iov_base, 0, rcv1->iov_len);
+	memset(rcv2->iov_base, 0, rcv2->iov_len);
 
 	timeout.tv_sec = 1;
 	timeout.tv_nsec = 0;
 
-	retval = do_recvmmsg(receive_sockfd, msgs_in, VLEN, 0, &timeout);
+	retval = do_recvmmsg(receive_sockfd, rcv_msg, VLEN, 0, &timeout);
 
 	if (retval == -1) {
 		tst_res(TFAIL | TTERRNO, "recvmmsg failed");
@@ -62,14 +54,12 @@
 		return;
 	}
 
-	bufs[0][msgs_in[0].msg_len] = 0;
-	if (strcmp(bufs[0], "onetwo"))
+	if (memcmp(rcv1->iov_base, "onetwo", 6))
 		tst_res(TFAIL, "Error in first received message");
 	else
 		tst_res(TPASS, "First message received successfully");
 
-	bufs[1][msgs_in[1].msg_len] = 0;
-	if (strcmp(bufs[1], "three"))
+	if (memcmp(rcv2->iov_base, "three", 5))
 		tst_res(TFAIL, "Error in second received message");
 	else
 		tst_res(TPASS, "Second message received successfully");
@@ -88,24 +78,23 @@
 	addr.sin_port = port;
 
 	SAFE_BIND(receive_sockfd, (struct sockaddr *)&addr, sizeof(addr));
-	SAFE_CONNECT(send_sockfd, (struct sockaddr *) &addr, sizeof(addr));
+	SAFE_CONNECT(send_sockfd, (struct sockaddr *)&addr, sizeof(addr));
 
-	memset(msg1, 0, sizeof(msg1));
-	msg1[0].iov_base = "one";
-	msg1[0].iov_len = 3;
-	msg1[1].iov_base = "two";
-	msg1[1].iov_len = 3;
+	memcpy(snd1[0].iov_base, "one", snd1[0].iov_len);
+	memcpy(snd1[1].iov_base, "two", snd1[1].iov_len);
+	memcpy(snd2->iov_base, "three3", snd2->iov_len);
 
-	memset(&msg2, 0, sizeof(msg2));
-	msg2.iov_base = "three";
-	msg2.iov_len = 5;
+	memset(snd_msg, 0, VLEN * sizeof(*snd_msg));
+	snd_msg[0].msg_hdr.msg_iov = snd1;
+	snd_msg[0].msg_hdr.msg_iovlen = 2;
+	snd_msg[1].msg_hdr.msg_iov = snd2;
+	snd_msg[1].msg_hdr.msg_iovlen = 1;
 
-	memset(msg, 0, sizeof(msg));
-	msg[0].msg_hdr.msg_iov = msg1;
-	msg[0].msg_hdr.msg_iovlen = 2;
-
-	msg[1].msg_hdr.msg_iov = &msg2;
-	msg[1].msg_hdr.msg_iovlen = 1;
+	memset(rcv_msg, 0, VLEN * sizeof(*rcv_msg));
+	rcv_msg[0].msg_hdr.msg_iov = rcv1;
+	rcv_msg[0].msg_hdr.msg_iovlen = 1;
+	rcv_msg[1].msg_hdr.msg_iov = rcv2;
+	rcv_msg[1].msg_hdr.msg_iovlen = 1;
 
 	test_info();
 }
@@ -123,4 +112,13 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_variants = TEST_VARIANTS,
+	.bufs = (struct tst_buffers []) {
+		{&snd1, .iov_sizes = (int[]){3, 3, -1}},
+		{&snd2, .iov_sizes = (int[]){6, -1}},
+		{&rcv1, .iov_sizes = (int[]){6, -1}},
+		{&rcv2, .iov_sizes = (int[]){5, -1}},
+		{&snd_msg, .size = VLEN * sizeof(*snd_msg)},
+		{&rcv_msg, .size = VLEN * sizeof(*rcv_msg)},
+		{},
+	}
 };
diff --git a/testcases/kernel/syscalls/sendto/sendto02.c b/testcases/kernel/syscalls/sendto/sendto02.c
index 5c272d1..7431017 100644
--- a/testcases/kernel/syscalls/sendto/sendto02.c
+++ b/testcases/kernel/syscalls/sendto/sendto02.c
@@ -1,17 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright(c) 2016 Fujitsu Ltd.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * alone with this program.
  */
 
 /*
@@ -87,4 +77,8 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_sendto,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "6e51fe757259"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/setdomainname/setdomainname.h b/testcases/kernel/syscalls/setdomainname/setdomainname.h
new file mode 100644
index 0000000..12c8a08
--- /dev/null
+++ b/testcases/kernel/syscalls/setdomainname/setdomainname.h
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+ */
+
+#ifndef SETDOMAINNAME_H__
+#define SETDOMAINNAME_H__
+
+#include <string.h>
+#include "lapi/utsname.h"
+#include "lapi/syscalls.h"
+#include "tst_test.h"
+
+#define TST_VALID_DOMAIN_NAME "test_dom"
+
+#ifdef TEST_SETHOSTNAME
+# define GET_SYSCALL gethostname
+# define SET_SYSCALL sethostname
+# define SYSCALL_NAME "hostname"
+# define SYSCALL_NR __NR_sethostname
+#else
+# define GET_SYSCALL getdomainname
+# define SET_SYSCALL setdomainname
+# define SYSCALL_NAME "domainname"
+# define SYSCALL_NR __NR_setdomainname
+#endif
+
+static char backup[_UTSNAME_DOMAIN_LENGTH];
+
+#define TEST_VARIANTS 2
+
+static void setdomainname_info(void)
+{
+	switch (tst_variant) {
+	case 0:
+		tst_res(TINFO, "Testing libc set" SYSCALL_NAME "()");
+		break;
+	case 1:
+		tst_res(TINFO, "Testing __NR_set" SYSCALL_NAME " syscall");
+		break;
+	}
+}
+
+static int do_setdomainname(char *new, size_t len)
+{
+	switch (tst_variant) {
+	case 0:
+		return SET_SYSCALL(new, len);
+	break;
+	case 1:
+		return tst_syscall(SYSCALL_NR, new, len);
+	}
+
+	return -1;
+}
+
+static void setup(void)
+{
+	setdomainname_info();
+	if ((GET_SYSCALL(backup, sizeof(backup))) < 0)
+		tst_brk(TBROK | TERRNO, "get" SYSCALL_NAME "() failed");
+}
+
+static void cleanup(void)
+{
+	if ((SET_SYSCALL(backup, strlen(backup))) < 0)
+		tst_res(TWARN | TERRNO, "set" SYSCALL_NAME "() failed ('%s')", backup);
+}
+
+#endif /* SETDOMAINNAME_H__ */
diff --git a/testcases/kernel/syscalls/setdomainname/setdomainname01.c b/testcases/kernel/syscalls/setdomainname/setdomainname01.c
index 7288fca..4c2c531 100644
--- a/testcases/kernel/syscalls/setdomainname/setdomainname01.c
+++ b/testcases/kernel/syscalls/setdomainname/setdomainname01.c
@@ -1,149 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ * Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: setdomainname01
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: Basic test for setdomainame(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This is a Phase I test for the setdomainname(2) system call.
- *	It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *	  Save the current domainname.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	  Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- *	  Restore old domain name.
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  setdomainname01  [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
- *
- ****************************************************************/
 
-#include <errno.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include "test.h"
+#include "setdomainname.h"
 
-#define MAX_NAME_LEN _UTSNAME_DOMAIN_LENGTH
-
-static void setup();
-static void cleanup();
-
-char *TCID = "setdomainname01";
-int TST_TOTAL = 1;
-
-static char *test_domain_name = "test_dom";
-static char old_domain_name[MAX_NAME_LEN];
-
-int main(int ac, char **av)
+static void do_test(void)
 {
+	char *new = TST_VALID_DOMAIN_NAME;
+	static char tmp[_UTSNAME_DOMAIN_LENGTH];
 
-	int lc;
+	TEST(do_setdomainname(new, strlen(new)));
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	if (TST_RET != 0)
+		tst_brk(TFAIL | TTERRNO, "set" SYSCALL_NAME "() failed: %d", TST_ERR);
 
-	setup();
+	if (GET_SYSCALL(tmp, sizeof(tmp)) != 0)
+		tst_brk(TFAIL | TERRNO, "get" SYSCALL_NAME "() failed");
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call setdomainname(2)
-		 */
-		TEST(setdomainname(test_domain_name, sizeof(test_domain_name)));
-
-		/* check return code */
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL, "setdomainname() Failed, errno = %d :"
-				 " %s", TEST_ERRNO, strerror(TEST_ERRNO));
-		} else {
-			tst_resm(TPASS, "setdomainname() returned %ld, "
-				 "Domain name set to \"%s\"", TEST_RETURN,
-				 test_domain_name);
-		}
-
-	}
-
-	/* cleanup and exit */
-	cleanup();
-	tst_exit();
-
+	if (strcmp(tmp, new))
+		tst_res(TFAIL, "get" SYSCALL_NAME "() returned wrong domainname: '%s'", tmp);
+	else
+		tst_res(TPASS, "set" SYSCALL_NAME "() succeed");
 }
 
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	/* Save current domain name */
-	if ((getdomainname(old_domain_name, sizeof(old_domain_name))) < 0) {
-		tst_brkm(TBROK, NULL, "getdomainname() failed while"
-			 " getting current domain name");
-	}
-
-	TEST_PAUSE;
-
-}
-
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-
-	/* Restore domain name */
-	if ((setdomainname(old_domain_name, strlen(old_domain_name))) < 0) {
-		tst_resm(TWARN, "setdomainname() failed while restoring"
-			 " domainname to \"%s\"", old_domain_name);
-	}
-
-}
+static struct tst_test test = {
+	.needs_root = 1,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test_all = do_test,
+	.test_variants = TEST_VARIANTS,
+};
diff --git a/testcases/kernel/syscalls/setdomainname/setdomainname02.c b/testcases/kernel/syscalls/setdomainname/setdomainname02.c
index 6af09ca..875ed0c 100644
--- a/testcases/kernel/syscalls/setdomainname/setdomainname02.c
+++ b/testcases/kernel/syscalls/setdomainname/setdomainname02.c
@@ -1,181 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * 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
- *
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ * Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
- /*******************************************************************
- *
- *    TEST IDENTIFIER   : setdomainname02
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : test for checking error conditions for setdomainame(2)
- *
- *    TEST CASE TOTAL   : 3
- *
- *    AUTHOR            : Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
- *
- * DESCRIPTION
- * 	Verify that,
- *   1) setdomainname(2) returns -1 and sets errno to EINVAL if the parameter,
- *	len is less than zero
- *   2) setdomainname(2) returns -1 and sets errno to EINVAL if value of
- *	len is greater than the maximum allowed value
- *   3) setdomainname(2) returns -1 and sets errno to EFAULT for a bad address
- *	for name
- *
- * ALGORITHM
- * Setup:
- *   Setup signal handling.
- *   Pause for SIGUSR1 if option specified.
- *   Save current domainname
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if (system call failed (return=-1)) &
- *			   (errno set == expected errno)
- *              Issue sys call fails with expected return value and errno.
- *   Otherwise,
- *      Issue sys call returns unexpected value.
- *
- *  Cleanup:
- *        Restore old domain name.
- *        Print errno log and/or timing stats if options given
- *  Side Effects :
- *	 setdomainname() is resetting value to NULL, if an invalid address
- *	 is given for name. So, to overcome this problem, domainname is
- *	 resetting to original value as part of cleanup() routine.
- *
- * USAGE:  <for command-line>
- *  setdomainname02  [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-h   : Show help screen
- *			-f   : Turn off functional testing
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- *********************************************************************/
 
-#include "test.h"
+#include "setdomainname.h"
 
-#include <errno.h>
-#include <sys/utsname.h>
+#define ERRNO_DESC(x) .exp_errno = x, .errno_desc = #x
 
-#define MAX_NAME_LEN _UTSNAME_DOMAIN_LENGTH - 1
+#define MAX_NAME_LENGTH _UTSNAME_DOMAIN_LENGTH - 1
 
-static void cleanup(void);
-static void setup(void);
-
-char *TCID = "setdomainname02";
-int TST_TOTAL = 3;
-
-static char old_domain_name[MAX_NAME_LEN];
-static struct test_case_t {
+struct test_case {
 	char *desc;
 	char *name;
 	int len;
 	int exp_errno;
-	char err_desc[10];
-} test_cases[] = {
-	{
-	"test with len = -1", "test_dom", -1, EINVAL, "EINVAL"}, {
-	"test with len > allowed maximum", "test_dom", MAX_NAME_LEN + 1,
-		    EINVAL, "EINVAL"}, {
-"test with name = NULL", NULL, MAX_NAME_LEN, EFAULT, "EFAULT"},};
+	char *errno_desc;
+} tcases[] = {
+	{ "len == -1", TST_VALID_DOMAIN_NAME, -1, ERRNO_DESC(EINVAL) },
+	{ "len > allowed maximum", TST_VALID_DOMAIN_NAME, MAX_NAME_LENGTH + 1, ERRNO_DESC(EINVAL) },
+	{ "name == NULL", NULL, MAX_NAME_LENGTH, ERRNO_DESC(EFAULT) }
+};
 
-int main(int ac, char **av)
+void verify_setdomainname(unsigned int nr)
 {
-	int lc, ind;
+	struct test_case *tcase = &tcases[nr];
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	TEST(do_setdomainname(tcase->name, (size_t) tcase->len));
 
-	setup();		/* global setup */
-
-	/* The following loop checks looping state if -i option given */
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		for (ind = 0; ind < TST_TOTAL; ind++) {
-
-			/*
-			 * call the system call with the TEST() macro
-			 */
-			TEST(setdomainname(test_cases[ind].name,
-					   (size_t) test_cases[ind].len));
-
-			if ((TEST_RETURN == -1) &&
-			    (TEST_ERRNO == test_cases[ind].exp_errno)) {
-				tst_resm(TPASS, "expected failure; Got %s",
-					 test_cases[ind].err_desc);
-			} else {
-				tst_resm(TFAIL, "Call failed to produce "
-					 "expected error;  Expected errno: %d "
-					 "Got : %d, %s",
-					 test_cases[ind].exp_errno,
-					 TEST_ERRNO, strerror(TEST_ERRNO));
-			}
-		}
+	tst_res(TINFO, "testing %s", tcase->desc);
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "unexpected exit code: %ld", TST_RET);
+		return;
 	}
 
-	cleanup();
-
-	tst_exit();
-
-}
-
-/*
- * setup() - performs all the ONE TIME setup for this test.
- */
-void setup(void)
-{
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	/* Save current domainname */
-	if ((getdomainname(old_domain_name, MAX_NAME_LEN)) < 0) {
-		tst_brkm(TBROK, NULL, "getdomainname() failed while"
-			 " getting current domain name");
+	if (TST_ERR != tcase->exp_errno) {
+		tst_res(TFAIL | TTERRNO, "unexpected errno: %d, expected: %d",
+			TST_ERR, tcase->exp_errno);
+		return;
 	}
 
-	TEST_PAUSE;
-
+	tst_res(TPASS | TTERRNO, "expected failure");
 }
 
-/*
- * cleanup() - performs all the ONE TIME cleanup for this test at completion
- * 	       or premature exit.
- */
-void cleanup(void)
-{
-
-	/* Restore domain name */
-	if ((setdomainname(old_domain_name, sizeof(old_domain_name)))
-	    < 0) {
-		tst_resm(TWARN, "setdomainname() failed while restoring"
-			 " domainname to \"%s\"", old_domain_name);
-	}
-
-}
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.needs_root = 1,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_setdomainname,
+	.test_variants = TEST_VARIANTS,
+};
diff --git a/testcases/kernel/syscalls/setdomainname/setdomainname03.c b/testcases/kernel/syscalls/setdomainname/setdomainname03.c
index 82793b8..b8d17d8 100644
--- a/testcases/kernel/syscalls/setdomainname/setdomainname03.c
+++ b/testcases/kernel/syscalls/setdomainname/setdomainname03.c
@@ -1,185 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * 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
- *
+ * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
+ * Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+ * Author: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER   : setdomainname03
- *
- *    EXECUTED BY       : root / superuser
- *
- *    TEST TITLE        : test for EPERM error value when run as non superuser
- *
- *    TEST CASE TOTAL   : 1
- *
- *    AUTHOR            : Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- * 	Verify that, setdomainname(2) returns -1 and sets errno to EPERM
- * 	if the effective user id of the caller is not super-user.
- *
- * Algorithm:
- *  Setup:
- *   Setup signal handling.
- *   Pause for SIGUSR1 if option specified.
- *   save current domainname
- *   change effective user id to "nobody" user
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, Check return code, if (system call failed (return=-1)) &
- *			(errno set == expected errno)
- *   		Issue sys call fails with expected return value and errno.
- *   	Otherwise,
- *		Issue sys call fails with unexpected errno.
- *   Otherwise,
- *	Issue sys call returns unexpected value.
- *
- *  Cleanup:
- *   Change effective user id to root
- *   Restore old domainname
- *   Print errno log and/or timing stats if options given
- *
- * Usage:  <for command-line>
- *  setdomainname03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *	where,  -c n : Run n copies concurrently.
- *		-e   : Turn on errno logging.
- *		-h   : Show help screen
- *		-f   : Turn off functional testing
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-p   : Pause for SIGUSR1 before starting
- *		-P x : Pause for x seconds between iterations.
- *		-t   : Turn on syscall timing.
- *
- ****************************************************************/
 
-#include <string.h>
 #include <errno.h>
 #include <pwd.h>
-#include <linux/utsname.h>
 
-#include "test.h"
+#include "setdomainname.h"
 
-#define MAX_NAME_LEN __NEW_UTS_LEN
-
-char *TCID = "setdomainname03";
-int TST_TOTAL = 1;
-
-static char nobody_uid[] = "nobody";
 struct passwd *ltpuser;
 
-static char test_domain_name[MAX_NAME_LEN] = "test_dom";
-static char old_domain_name[MAX_NAME_LEN];
-
-static void setup();		/* setup function for the tests */
-static void cleanup();		/* cleanup function for the tests */
-
-int main(int ac, char **av)
+static void do_test(void)
 {
-	int lc;
+	char *new = TST_VALID_DOMAIN_NAME;
 
-	tst_parse_opts(ac, av, NULL, NULL);
+	TEST(do_setdomainname(new, strlen(new)));
 
-	/*
-	 * Invoke setup function to call individual test setup functions
-	 * for the test which run as root/super-user.
-	 */
+	if (TST_RET != -1) {
+		tst_res(TFAIL, "unexpected exit code: %ld", TST_RET);
+		return;
+	}
+
+	if (TST_ERR != EPERM) {
+		tst_res(TFAIL | TTERRNO, "unexpected errno: %d, expected: EPERM",
+			TST_ERR);
+		return;
+	}
+
+	tst_res(TPASS | TTERRNO, "expected failure");
+}
+
+void setup_setuid(void)
+{
+	ltpuser = SAFE_GETPWNAM("nobody");
+	SAFE_SETEUID(ltpuser->pw_uid);
 	setup();
+}
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call setdomainname(2)
-		 */
-		TEST(setdomainname(test_domain_name, MAX_NAME_LEN));
-		if ((TEST_RETURN == -1) && (TEST_ERRNO == EPERM)) {
-			tst_resm(TPASS, "expected failure; Got EPERM");
-		} else {
-			tst_resm(TFAIL, "Call failed to produce "
-				 "expected error;  Expected errno: %d "
-				 "Got : %d, %s", EPERM, TEST_ERRNO,
-				 strerror(TEST_ERRNO));
-		}
-
-	}
-
-	/*
-	 * Invoke cleanup() to delete the test directories created
-	 * in the setup().
-	 */
+static void cleanup_setuid(void)
+{
+	SAFE_SETEUID(0);
 	cleanup();
-	tst_exit();
-
 }
 
-/*
- * setup(void) - performs all ONE TIME setup for this test.
- */
-void setup(void)
-{
-	tst_require_root();
-
-	/* Capture unexpected signals */
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	/* Switch to nobody user for correct error code collection */
-	if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
-		tst_brkm(TBROK, NULL, "\"nobody\" user not present");
-	}
-	if (seteuid(ltpuser->pw_uid) == -1) {
-		tst_resm(TWARN, "seteuid failed to "
-			 "to set the effective uid to %d", ltpuser->pw_uid);
-		perror("seteuid");
-	}
-
-	/* Save current domainname */
-	if ((getdomainname(old_domain_name, MAX_NAME_LEN)) < 0) {
-		tst_brkm(TBROK, NULL, "getdomainname() failed while"
-			 " getting current domain name");
-	}
-
-	TEST_PAUSE;
-
-}
-
-/*
- * cleanup() - Performs all ONE TIME cleanup for this test at
- */
-void cleanup(void)
-{
-
-	/* Set effective user id back to root */
-	if (seteuid(0) == -1) {
-		tst_resm(TWARN, "seteuid failed to "
-			 "to set the effective uid to root");
-		perror("seteuid");
-	}
-
-	/* Restore domain name */
-	if ((setdomainname(old_domain_name, strlen(old_domain_name)))
-	    < 0) {
-		tst_resm(TWARN, "setdomainname() failed while restoring"
-			 " domainname to \"%s\"", old_domain_name);
-	}
-
-}
+static struct tst_test test = {
+	.needs_root = 1,
+	.setup = setup_setuid,
+	.cleanup = cleanup_setuid,
+	.test_all = do_test,
+	.test_variants = TEST_VARIANTS,
+};
diff --git a/testcases/kernel/syscalls/sethostname/Makefile b/testcases/kernel/syscalls/sethostname/Makefile
index bd617d8..71d21c5 100644
--- a/testcases/kernel/syscalls/sethostname/Makefile
+++ b/testcases/kernel/syscalls/sethostname/Makefile
@@ -1,23 +1,22 @@
-#
-#  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 St, Fifth Floor, Boston, MA  02110-1301  USA
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines  Corp., 2001
+# Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
 
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
+CPPFLAGS += -DTEST_SETHOSTNAME
+
+sethostname01: $(abs_srcdir)/../setdomainname/setdomainname01.c
+	$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+sethostname02: $(abs_srcdir)/../setdomainname/setdomainname02.c
+	$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+sethostname03: $(abs_srcdir)/../setdomainname/setdomainname03.c
+	$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) $(OUTPUT_OPTION)
+
+MAKE_TARGETS := sethostname01 sethostname02 sethostname03
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/sethostname/sethostname01.c b/testcases/kernel/syscalls/sethostname/sethostname01.c
deleted file mode 100644
index 5468068..0000000
--- a/testcases/kernel/syscalls/sethostname/sethostname01.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- *
- *   Copyright (c) Wipro Technologies, 2002.  All Rights Reserved.
- *
- *   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
- *
- */
-
-/*********************************************************************
- *    TEST IDENTIFIER	: sethostname01
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: Basic test for sethostname(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Suresh Babu V. <suresh.babu@wipro.com>
- *
- *    SIGNALS
- *	Uses SIGUSR1 to pause before test if option set.
- *	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION$
- *      This is a Phase I test for the sethostname(2) system call.
- *      It is intended to provide a limited exposure of the system call.
- *
- *      Setup:
- *        Setup signal handling.
- *        Save the current hostname.
- *        Pause for SIGUSR1 if option specified.
- *
- *      Test:
- *       Loop if the proper options are given.
- *        Execute system call
- *        Check return code, if system call failed (return=-1)
- *              Log the errno and Issue a FAIL message.
- *        Otherwise, Issue a PASS message.
- *      Cleanup:
- *        Restore old host name.
- *        Print errno log and/or timing stats if options given
- *
- * Usage:  <for command-line>
- *  sethostname01 [-c n] [-i n] [-I x] [-P x] [-p] [-t] [-h]
- *	where,  -c n : Run n copies concurrently.
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-p   : Pause for SIGUSR1 before starting
- *		-P x : Pause for x seconds between iterations.
- *		-t   : Turn on syscall timing.
- *		-h   : Display usage information
- *
- *
- ******************************************************************/
-
-#include <string.h>
-#include <errno.h>
-#include <linux/utsname.h>
-
-#include "test.h"
-
-#define MAX_LENGTH __NEW_UTS_LEN
-
-static void setup();
-static void cleanup();
-
-char *TCID = "sethostname01";
-int TST_TOTAL = 1;
-static char hname[MAX_LENGTH];	/* host name */
-
-int main(int ac, char **av)
-{
-	int lc;
-
-	char ltphost[] = "ltphost";	/* temporary host name to set */
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	/* Do initial setup. */
-	setup();
-
-	/* check -c option for looping. */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/* Call sethostname(2) */
-		TEST(sethostname(ltphost, sizeof(ltphost)));
-
-		/* check return code */
-		if (TEST_RETURN == -1) {
-			tst_resm(TFAIL, "sethostname() failed , errno=%d : %s",
-				 TEST_ERRNO, strerror(TEST_ERRNO));
-		} else {
-			tst_resm(TPASS, "sethostname() returned %ld,"
-				 " Hostname set to \"%s\"", TEST_RETURN,
-				 ltphost);
-		}
-
-	}
-
-	/* cleanup and exit */
-	cleanup();
-	tst_exit();
-
-}
-
-/*
- * setup() - performs all one time setup for this test.
- */
-void setup(void)
-{
-	int ret;
-
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	/* Store the existing hostname to retain it before exiting */
-	if ((ret = gethostname(hname, sizeof(hname))) < 0) {
-		tst_brkm(TBROK, NULL, "gethostname() failed while getting"
-			 " current host name");
-	}
-
-	TEST_PAUSE;
-
-}
-
-/*
- * cleanup() -	performs all one time cleanup for this test
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-	int ret;
-
-	/* Set the host name back to original name */
-	if ((ret = sethostname(hname, strlen(hname))) < 0) {
-		tst_resm(TWARN, "sethostname() failed while restoring"
-			 " hostname to \"%s\": %s", hname, strerror(errno));
-	}
-
-}
diff --git a/testcases/kernel/syscalls/sethostname/sethostname02.c b/testcases/kernel/syscalls/sethostname/sethostname02.c
deleted file mode 100644
index c63e6a0..0000000
--- a/testcases/kernel/syscalls/sethostname/sethostname02.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- *
- *   Copyright (c) Wipro Technologies, 2002. All Rights Reserved.
- *
- *   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
- */
-
-/****************************************************************************
- *
- *    TEST IDENTIFIER	: sethostname02
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: test for checking error conditions for sethostname(2)
- *
- *    TEST CASE TOTAL	: 3
- *
- *    AUTHOR		: Suresh Babu V. <suresh.babu@wipro.com>
- *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
- *
- * DESCRIPTION
- *      Verify that,
- *   1) sethostname(2) returns -1 and sets errno to EINVAL if the parameter,
- *	len is less than zero.
- *   2) sethostname(2) returns -1 and sets errno to EINVAL if len is greater
- *	than the maximum allowed size.
- *   3) sethostname(2) returns -1 and sets errno to EFAULT if an invalid
- *	address is given for name.
- *
- * Setup:
- *   Setup signal handling.
- *   Save current hostname
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed and errno set == expected errno
- *		Issue sys call fails with expected return value and errno.
- *      Otherwise,
- *		Issue sys call failed to produce expected error.
- *
- *   Cleanup:
- *	Restore old hostname.
- *	Print errno log and/or timing stats if options given
- *
- *   Side Effects :
- *	sethostname() is resetting value to NULL, if an invalid address
- *	is given for name. So, to overcome this problem, hostname is
- *	resetting to original value as part of cleanup() routine.
- *
- * USAGE:  <for command-line>
- *  sethostname02 [-c n] [-e] [-i n] [-I x] [-P x] [-p] [-t] [-h]
- *     where,  -c n  : Run n copies concurrently.
- *		-e   : Turn on errno logging.
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-P x : Pause for x seconds between iterations.
- *		-p   : Pause for SIGUSR1 before startingt
- *		-t   : Turn on syscall timing.
- *		-h   : Display usage information.
- *
- ***************************************************************************/
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/utsname.h>
-#include "test.h"
-
-#define LARGE_LENGTH MAX_LENGTH + 1
-#define MAX_LENGTH _UTSNAME_LENGTH - 1
-
-static void cleanup(void);
-static void setup(void);
-
-char *TCID = "sethostname02";
-static char hostname[MAX_LENGTH];
-static char hname[MAX_LENGTH];
-static char largehost[LARGE_LENGTH];
-static struct test_case_t {
-	char *err_desc;		/* error description            */
-	int exp_errno;		/* Expected error no            */
-	char *exp_errval;	/* Expected error value string  */
-	char *name;		/* hostname                     */
-	int len;		/* length                       */
-} testcases[] = {
-	{
-	"Length is -ve", EINVAL, "EINVAL", hostname, -1}, {
-	"Length > max allowed size", EINVAL, "EINVAL", largehost,
-		    sizeof(largehost)}
-	,
-#ifndef UCLINUX
-	    /* Skip since uClinux does not implement memory protection */
-	{
-	"Invalid address ", EFAULT, "EFAULT", (void *)-1,
-		    sizeof(hostname)}
-#endif
-};
-
-int TST_TOTAL = ARRAY_SIZE(testcases);
-
-int main(int ac, char **av)
-{
-	int i;
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	/* Do initial setup */
-	setup();
-
-	/* check for looping state if -i option is given */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; ++i) {
-
-			/*
-			 * Test the system call.
-			 */
-			TEST(sethostname(testcases[i].name, testcases[i].len));
-
-			if ((TEST_RETURN == -1) &&
-			    (TEST_ERRNO == testcases[i].exp_errno)) {
-				tst_resm(TPASS, "expected failure; Got %s",
-					 testcases[i].exp_errval);
-			} else {
-				tst_resm(TFAIL, "call failed to produce "
-					 "expected error;  errno: %d : %s",
-					 TEST_ERRNO, strerror(TEST_ERRNO));
-			}
-		}
-	}
-	/* do cleanup and exit */
-	cleanup();
-
-	tst_exit();
-}
-
-/*
- * setup() - performs all one time setup for this test.
- */
-void setup(void)
-{
-	int ret;
-
-	tst_require_root();
-
-	/* capture the signals */
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	/* Keep the host name before starting the test */
-	if ((ret = gethostname(hname, sizeof(hname))) < 0) {
-		tst_brkm(TBROK, NULL, "gethostname() failed while"
-			 " getting current host name");
-	}
-
-	/* Pause if the option was specified */
-	TEST_PAUSE;
-}
-
-/*
- * cleanup()  - performs all one time cleanup for this test
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-	int ret;
-
-	/* Set the host name back to original name */
-	if ((ret = sethostname(hname, strlen(hname))) < 0) {
-		tst_resm(TWARN, "sethostname() failed while restoring"
-			 " hostname to \"%s\"", hname);
-	}
-
-}
diff --git a/testcases/kernel/syscalls/sethostname/sethostname03.c b/testcases/kernel/syscalls/sethostname/sethostname03.c
deleted file mode 100644
index b5c77ad..0000000
--- a/testcases/kernel/syscalls/sethostname/sethostname03.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *
- *   Copyright (c) Wipro Technologies, 2002.  All Rights Reserved.
- *
- *   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
- */
-
-/****************************************************************************
- *    TEST IDENTIFIER	: sethostname03
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: test for EPERM error value when sethostname(2) is
- *                        called from as non superuser
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Suresh Babu V. <suresh.babu@wipro.com>
- *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *      Verify that, sethostname(2) returns -1 and sets errno to EPERM
- *      if the effective userid id of the caller is not super-user.
- *
- *  Setup:
- *   Setup signal handling.
- *   Save the current host name.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if system call failed (return=-1)
- *	if errno set == expected errno
- *		Issue sys call fails with expected return value and errno.
- *	Otherwise,
- *		Issue sys call fails with unexpected errno.
- *
- *  Cleanup:
- *   Restore old hostname
- *   Print errno log and/or timing stats if options given
- *
- * Usage:  <for command-line>
- *  sethostname03 [-c n] [-e] [-i n] [-I x] [-P x] [-p] [-t]
- *	where,  -c n : Run n copies concurrently.
- *		-e   : Turn on errno logging.
- *		-i n : Execute test n times.
- *		-I x : Execute test for x seconds.
- *		-P x : Pause for x seconds between iterations.
- *		-p   : Pause for SIGUSR1 before starting
- *		-t   : Turn on syscall timing.
- *
- *************************************************************************/
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <pwd.h>
-#include <linux/utsname.h>
-
-#include "test.h"
-
-#define MAX_LENGTH __NEW_UTS_LEN
-
-char *TCID = "sethostname03";
-int TST_TOTAL = 1;
-
-static char ltpthost[] = "ltphost";
-static char hname[MAX_LENGTH];
-
-static char nobody_uid[] = "nobody";
-struct passwd *ltpuser;
-
-static void setup(void);
-static void cleanup(void);
-
-int main(int ac, char **av)
-{
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	/* Do initial setup */
-	setup();
-
-	/* Check for looping state if -i option is given */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/* call sethostname() */
-		TEST(sethostname(ltpthost, sizeof(ltpthost)));
-
-		if ((TEST_RETURN == -1) && (TEST_ERRNO == EPERM)) {
-			tst_resm(TPASS, "Expected Failure; Got EPERM");
-		} else {
-			tst_resm(TFAIL, "call failed to produce "
-				 "expected error;  errno: %d : %s",
-				 TEST_ERRNO, strerror(TEST_ERRNO));
-		}
-
-	}
-
-	/* cleanup and exit */
-	cleanup();
-	tst_exit();
-
-}
-
-/*
- * setup() - performs all one time setup for this test.
- */
-void setup(void)
-{
-	int ret;
-
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	/* Switch to nobody user for correct error code collection */
-	if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
-		tst_brkm(TBROK, NULL, "Required user \"nobody\" not"
-			 " present");
-	}
-
-	if (seteuid(ltpuser->pw_uid) == -1) {
-		tst_resm(TWARN, "seteuid failed to "
-			 "to set the effective uid to %d", ltpuser->pw_uid);
-		perror("seteuid");
-	}
-
-	/* Keep current hostname */
-	if ((ret = gethostname(hname, sizeof(hname))) < 0) {
-		tst_brkm(TBROK, NULL, "gethostname() failed while"
-			 " getting current host name");
-	}
-
-	TEST_PAUSE;
-
-}
-
-/*
- * cleanup()  - performs all one time cleanup for this test
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-	int ret;
-
-	/* Set effective user id back to root/super user */
-	if (seteuid(0) == -1) {
-		tst_resm(TWARN, "seteuid failed to "
-			 "to set the effective uid to root");
-		perror("seteuid");
-	}
-
-	/* Restore host name */
-	if ((ret = sethostname(hname, strlen(hname))) < 0) {
-		tst_resm(TWARN, "sethostname() failed while restoring"
-			 " hostname to \"%s\"", hname);
-	}
-
-}
diff --git a/testcases/kernel/syscalls/setpriority/setpriority01.c b/testcases/kernel/syscalls/setpriority/setpriority01.c
index b93a42a..ffd7499 100644
--- a/testcases/kernel/syscalls/setpriority/setpriority01.c
+++ b/testcases/kernel/syscalls/setpriority/setpriority01.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *  03/2001 Written by Wayne Boyer
  *  11/2016 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setpriority/setpriority02.c b/testcases/kernel/syscalls/setpriority/setpriority02.c
index 01a4c81..85fb0df 100644
--- a/testcases/kernel/syscalls/setpriority/setpriority02.c
+++ b/testcases/kernel/syscalls/setpriority/setpriority02.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *  03/2001 Written by Wayne Boyer
  *  11/2016 Modified by Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit02.c b/testcases/kernel/syscalls/setrlimit/setrlimit02.c
index 77adaf0..260f1e0 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit02.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit02.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
- *	07/2001 Ported by Wayne Boyer
+ * Copyright (c) International Business Machines Corp., 2001
+ * Ported to LTP: Wayne Boyer
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  * Testcase to test the different errnos set by setrlimit(2) system call.
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit03.c b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
index 12455fe..7525b87 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit03.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit04.c b/testcases/kernel/syscalls/setrlimit/setrlimit04.c
index 5b6c958..5648f51 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit04.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit04.c
@@ -1,26 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (C) 2017 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2017 Red Hat, Inc.  All rights reserved.
  *
- *   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.
+ * Attempt to run a trivial binary with stack < 1MB.
  *
- *   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.
- *
- *   DESCRIPTION
- *     Attempt to run a trivial binary with stack < 1MB.
- *
- *     Early patches for stack guard gap caused that gap size was
- *     contributing to stack limit. This caused failures
- *     for new processes (E2BIG) when ulimit was set to anything
- *     lower than size of gap. commit 1be7107fbe18 "mm: larger
- *     stack guard gap, between vmas" sets default gap size to 1M
- *     (for systems with 4k pages), so let's set stack limit to 512kB
- *     and confirm we can still run some trivial binary.
+ * Early patches for stack guard gap caused that gap size was
+ * contributing to stack limit. This caused failures
+ * for new processes (E2BIG) when ulimit was set to anything
+ * lower than size of gap. commit 1be7107fbe18 "mm: larger
+ * stack guard gap, between vmas" sets default gap size to 1M
+ * (for systems with 4k pages), so let's set stack limit to 512kB
+ * and confirm we can still run some trivial binary.
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
index 004a149..077399e 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
  * Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit06.c b/testcases/kernel/syscalls/setrlimit/setrlimit06.c
index 87e6b0e..726b268 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit06.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit06.c
@@ -114,4 +114,8 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.forks_child = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "c3bca5d450b62"},
+		{}
+	}
 };
diff --git a/testcases/kernel/syscalls/setsockopt/.gitignore b/testcases/kernel/syscalls/setsockopt/.gitignore
index d8fb0f3..603e2ad 100644
--- a/testcases/kernel/syscalls/setsockopt/.gitignore
+++ b/testcases/kernel/syscalls/setsockopt/.gitignore
@@ -1,3 +1,4 @@
 /setsockopt01
 /setsockopt02
 /setsockopt03
+/setsockopt04
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt02.c b/testcases/kernel/syscalls/setsockopt/setsockopt02.c
index 474df24..dc9db2d 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt02.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt02.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /* Test for CVE-2017-7308 on a raw socket's ring buffer
  *
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt03.c b/testcases/kernel/syscalls/setsockopt/setsockopt03.c
index 2d99865..14fdf40 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt03.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt03.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
  * Based on repro-compatReleaseEntry.c by NCC group
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Test for CVE-2016-4997
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt04.c b/testcases/kernel/syscalls/setsockopt/setsockopt04.c
new file mode 100644
index 0000000..fda5c6b
--- /dev/null
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt04.c
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Christian Amann <camann@suse.com>
+ */
+/* Test for CVE-2016-9793
+ *
+ * With kernels between version 3.11 and 4.8 missing commit b98b0bc8 it
+ * is possible to pass a very high unsigned integer as send buffer size
+ * to a socket which is then interpreted as a negative value.
+ *
+ * This can be used to escalate privileges by every user that has the
+ * CAP_NET_ADMIN capability.
+ *
+ * For additional information about this CVE see:
+ * https://www.suse.com/security/cve/CVE-2016-9793/
+ */
+
+#include <sys/socket.h>
+#include "tst_test.h"
+#include "tst_safe_net.h"
+
+#define SNDBUF	(0xffffff00)
+
+static int sockfd;
+
+static void run(void)
+{
+	unsigned int sndbuf, rec_sndbuf;
+	socklen_t optlen;
+
+	sndbuf = SNDBUF;
+	rec_sndbuf = 0;
+	optlen = sizeof(sndbuf);
+
+	SAFE_SETSOCKOPT(sockfd, SOL_SOCKET, SO_SNDBUFFORCE, &sndbuf, optlen);
+	SAFE_GETSOCKOPT(sockfd, SOL_SOCKET, SO_SNDBUF, &rec_sndbuf, &optlen);
+
+	tst_res(TINFO, "Try to set send buffer size to: %u", sndbuf);
+	tst_res(TINFO, "Send buffer size was set to: %d", rec_sndbuf);
+
+	if ((int)rec_sndbuf < 0)
+		tst_res(TFAIL, "Was able to set negative send buffer size!");
+	else
+		tst_res(TPASS, "Was unable to set negative send buffer size!");
+}
+
+static void setup(void)
+{
+	sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
+}
+
+static void cleanup(void)
+{
+	if (sockfd > 0)
+		SAFE_CLOSE(sockfd);
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.setup = setup,
+	.cleanup = cleanup,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/setuid/setuid01.c b/testcases/kernel/syscalls/setuid/setuid01.c
index 1b866a5..0a0a03a 100644
--- a/testcases/kernel/syscalls/setuid/setuid01.c
+++ b/testcases/kernel/syscalls/setuid/setuid01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /* DESCRIPTION
diff --git a/testcases/kernel/syscalls/setuid/setuid03.c b/testcases/kernel/syscalls/setuid/setuid03.c
index 8e1bf7d..f2e007f 100644
--- a/testcases/kernel/syscalls/setuid/setuid03.c
+++ b/testcases/kernel/syscalls/setuid/setuid03.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /* DESCRIPTION
diff --git a/testcases/kernel/syscalls/setuid/setuid04.c b/testcases/kernel/syscalls/setuid/setuid04.c
index c37fac8..5f4ee1d 100644
--- a/testcases/kernel/syscalls/setuid/setuid04.c
+++ b/testcases/kernel/syscalls/setuid/setuid04.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setxattr/setxattr01.c b/testcases/kernel/syscalls/setxattr/setxattr01.c
index c1ac848..8b84dfe 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr01.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr01.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it
- * is free of the rightful claim of any third person regarding
- * infringement or the like.  Any license provided herein, whether
- * implied or otherwise, applies only to this software file.  Patent
- * licenses, if any, provided herein do not apply to combinations of
- * this program with other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setxattr/setxattr02.c b/testcases/kernel/syscalls/setxattr/setxattr02.c
index b947990..9796f9a 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr02.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr02.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2011 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it
- * is free of the rightful claim of any third person regarding
- * infringement or the like.  Any license provided herein, whether
- * implied or otherwise, applies only to this software file.  Patent
- * licenses, if any, provided herein do not apply to combinations of
- * this program with other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/setxattr/setxattr03.c b/testcases/kernel/syscalls/setxattr/setxattr03.c
index a2f6cbf..58ee0f8 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr03.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr03.c
@@ -1,25 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2012 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it
- * is free of the rightful claim of any third person regarding
- * infringement or the like.  Any license provided herein, whether
- * implied or otherwise, applies only to this software file.  Patent
- * licenses, if any, provided herein do not apply to combinations of
- * this program with other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
  */
 
 /*
@@ -32,6 +13,7 @@
  *    -1 and set errno to EPERM
  */
 
+#define _GNU_SOURCE
 #include "config.h"
 #include <sys/ioctl.h>
 #include <sys/types.h>
@@ -47,14 +29,11 @@
 #ifdef HAVE_SYS_XATTR_H
 # include <sys/xattr.h>
 #endif
-#include <linux/fs.h>
+#include "lapi/fs.h"
 
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
 
-char *TCID = "setxattr03";
-
-#if defined HAVE_SYS_XATTR_H && defined HAVE_FS_IOC_FLAGS
+#if defined HAVE_SYS_XATTR_H
 #define XATTR_TEST_KEY "user.testkey"
 #define XATTR_TEST_VALUE "this is a test value"
 #define XATTR_TEST_VALUE_SIZE (sizeof(XATTR_TEST_VALUE) - 1)
@@ -85,7 +64,7 @@
 	 .size = XATTR_TEST_VALUE_SIZE,
 	 .flags = XATTR_CREATE,
 	 .exp_err = EPERM,
-	 },
+	},
 	{			/* case 01, set attr to append-only file */
 	 .desc = "Set attr to append-only file",
 	 .fname = APPEND_FILE,
@@ -94,45 +73,29 @@
 	 .size = XATTR_TEST_VALUE_SIZE,
 	 .flags = XATTR_CREATE,
 	 .exp_err = EPERM,
-	 },
+	},
 };
 
-static void setup(void);
-static void cleanup(void);
-
 static int immu_fd;
 static int append_fd;
 
-int TST_TOTAL = sizeof(tc) / sizeof(tc[0]);
-
-int main(int argc, char *argv[])
+static void verify_setxattr(unsigned int i)
 {
-	int lc;
-	int i;
+	TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value, tc[i].size,
+			tc[i].flags));
 
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-			TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value,
-				      tc[i].size, tc[i].flags));
-
-			if (TEST_ERRNO == tc[i].exp_err) {
-				tst_resm(TPASS | TTERRNO, "%s", tc[i].desc);
-			} else {
-				tst_resm(TFAIL | TTERRNO, "%s - expected errno"
-					 " %d - Got", tc[i].desc,
-					 tc[i].exp_err);
-			}
-		}
+	if (!TST_RET) {
+		tst_res(TFAIL, "%s succeeded unexpectedly", tc[i].desc);
+		return;
 	}
 
-	cleanup();
-	tst_exit();
+	if (TST_ERR != tc[i].exp_err) {
+		tst_res(TFAIL | TTERRNO, "%s - expected %s, got", tc[i].desc,
+			tst_strerrno(tc[i].exp_err));
+		return;
+	}
+
+	tst_res(TPASS | TTERRNO, "%s", tc[i].desc);
 }
 
 static int fsetflag(int fd, int on, int immutable)
@@ -163,50 +126,53 @@
 {
 	int fd;
 
-	tst_require_root();
-
-	tst_tmpdir();
-
 	/* Test for xattr support */
-	fd = SAFE_CREAT(cleanup, "testfile", 0644);
-	close(fd);
+	fd = SAFE_CREAT("testfile", 0644);
+	SAFE_CLOSE(fd);
 	if (setxattr("testfile", "user.test", "test", 4, XATTR_CREATE) == -1)
 		if (errno == ENOTSUP)
-			tst_brkm(TCONF, cleanup, "No xattr support in fs or "
+			tst_brk(TCONF, "No xattr support in fs or "
 				 "fs mounted without user_xattr option");
-	unlink("testfile");
+	SAFE_UNLINK("testfile");
 
 	/* Create test files and set file immutable or append-only */
-	immu_fd = SAFE_CREAT(cleanup, IMMU_FILE, 0644);
+	immu_fd = SAFE_CREAT(IMMU_FILE, 0644);
 	if (set_immutable_on(immu_fd))
-		tst_brkm(TBROK | TERRNO, cleanup, "Set %s immutable failed",
+		tst_brk(TBROK | TERRNO, "Set %s immutable failed",
 			 IMMU_FILE);
 
-	append_fd = SAFE_CREAT(cleanup, APPEND_FILE, 0644);
+	append_fd = SAFE_CREAT(APPEND_FILE, 0644);
 	if (set_append_on(append_fd))
-		tst_brkm(TBROK | TERRNO, cleanup, "Set %s append-only failed",
-			 APPEND_FILE);
-
-	TEST_PAUSE;
+		tst_brk(TBROK | TERRNO, "Set %s append-only failed",
+			APPEND_FILE);
 }
 
 static void cleanup(void)
 {
 	if ((immu_fd > 0) && set_immutable_off(immu_fd))
-		tst_resm(TWARN | TERRNO, "Unset %s immutable failed",
+		tst_res(TWARN | TERRNO, "Unset %s immutable failed",
 			 IMMU_FILE);
-	if ((append_fd > 0) && set_append_off(append_fd))
-		tst_resm(TWARN | TERRNO, "Unset %s append-only failed",
-			 APPEND_FILE);
-	close(immu_fd);
-	close(append_fd);
 
-	tst_rmdir();
+	if ((append_fd > 0) && set_append_off(append_fd))
+		tst_res(TWARN | TERRNO, "Unset %s append-only failed",
+			 APPEND_FILE);
+
+	if (immu_fd > 0)
+		SAFE_CLOSE(immu_fd);
+
+	if (append_fd > 0)
+		SAFE_CLOSE(append_fd);
 }
+
+static struct tst_test test = {
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = verify_setxattr,
+	.tcnt = ARRAY_SIZE(tc),
+	.needs_tmpdir = 1,
+	.needs_root = 1,
+};
+
 #else
-int main(void)
-{
-	tst_brkm(TCONF, NULL, "<sys/xattr.h> not present or FS_IOC_FLAGS "
-		 "missing in <linux/fs.h>");
-}
-#endif /* defined HAVE_SYS_XATTR_H && defined HAVE_FS_IOC_FLAGS */
+TST_TEST_TCONF("<sys/xattr.h> does not exist");
+#endif /* defined HAVE_SYS_XATTR_H */
diff --git a/testcases/kernel/syscalls/signalfd/signalfd01.c b/testcases/kernel/syscalls/signalfd/signalfd01.c
index 72901ff..1a62156 100644
--- a/testcases/kernel/syscalls/signalfd/signalfd01.c
+++ b/testcases/kernel/syscalls/signalfd/signalfd01.c
@@ -56,22 +56,13 @@
 #if defined HAVE_SYS_SIGNALFD_H
 #include <sys/signalfd.h>
 #elif defined HAVE_LINUX_SIGNALFD_H
-#if defined HAVE_LINUX_TYPES_H
-#include <linux/types.h>
-#endif
 #include <linux/signalfd.h>
 #define USE_OWNIMPL
-#elif defined HAVE_SIGNALFD_H
-#include <signalfd.h>
 #else
 #define  USE_STUB
 #endif
 
-#if defined HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO
-#define SIGNALFD_PREFIX(FIELD) ssi_##FIELD
-#elif defined HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
-#define SIGNALFD_PREFIX(FIELD) FIELD
-#else
+#ifndef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO
 #define USE_STUB
 #endif
 
@@ -170,14 +161,13 @@
 		goto out;
 	}
 
-	if (fdsi.SIGNALFD_PREFIX(signo) == sig) {
+	if (fdsi.ssi_signo == sig) {
 		tst_resm(TPASS, "got expected signal");
 		sfd_for_next = sfd;
 		goto out;
 	} else {
 		tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
-			 fdsi.SIGNALFD_PREFIX(signo),
-			 strsignal(fdsi.SIGNALFD_PREFIX(signo)));
+			 fdsi.ssi_signo, strsignal(fdsi.ssi_signo));
 		sfd_for_next = -1;
 		close(sfd);
 		goto out;
@@ -254,13 +244,13 @@
 		goto out;
 	}
 
-	if (fdsi.SIGNALFD_PREFIX(signo) == sig) {
+	if (fdsi.ssi_signo == sig) {
 		tst_resm(TPASS, "got expected signal");
 		goto out;
 	} else {
 		tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
-			 fdsi.SIGNALFD_PREFIX(signo),
-			 strsignal(fdsi.SIGNALFD_PREFIX(signo)));
+			 fdsi.ssi_signo),
+			 strsignal(fdsi.ssi_signo);
 		goto out;
 	}
 
diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
index 3978c49..c221be8 100644
--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
@@ -128,9 +128,8 @@
 static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
 			      struct timespec *timeout)
 {
-
-	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64 and 8, resp. */
-	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout, 8);
+	/* _NSIG is always the right number of bits of signal map for all arches */
+	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout, _NSIG/8);
 }
 #endif
 
diff --git a/testcases/kernel/syscalls/socket/socket01.c b/testcases/kernel/syscalls/socket/socket01.c
index 6107274..4671548 100644
--- a/testcases/kernel/syscalls/socket/socket01.c
+++ b/testcases/kernel/syscalls/socket/socket01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
-* 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.
+* Copyright (c) International Business Machines Corp., 2001
 */
 
 /*
diff --git a/testcases/kernel/syscalls/socket/socket02.c b/testcases/kernel/syscalls/socket/socket02.c
index 0584163..afe9dc1 100644
--- a/testcases/kernel/syscalls/socket/socket02.c
+++ b/testcases/kernel/syscalls/socket/socket02.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) Ulrich Drepper <drepper@redhat.com>
-* Copyright (c) International Business Machines  Corp., 2009
-*
-* 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.
+* Copyright (c) International Business Machines Corp., 2009
 */
 
 /*
diff --git a/testcases/kernel/syscalls/socketcall/socketcall01.c b/testcases/kernel/syscalls/socketcall/socketcall01.c
index f7128a7..a8f6649 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall01.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall01.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
  *    AUTHOR : sowmya adiga<sowmya.adiga@wipro.com>
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  */
 /*
  * This is a basic test for the socketcall(2) system call.
diff --git a/testcases/kernel/syscalls/socketpair/socketpair01.c b/testcases/kernel/syscalls/socketpair/socketpair01.c
index a61f268..7c301f6 100644
--- a/testcases/kernel/syscalls/socketpair/socketpair01.c
+++ b/testcases/kernel/syscalls/socketpair/socketpair01.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
-* 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.
+* Copyright (c) International Business Machines Corp., 2001
 */
 
 /*
diff --git a/testcases/kernel/syscalls/socketpair/socketpair02.c b/testcases/kernel/syscalls/socketpair/socketpair02.c
index ca24915..72ca0e8 100644
--- a/testcases/kernel/syscalls/socketpair/socketpair02.c
+++ b/testcases/kernel/syscalls/socketpair/socketpair02.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
 * Copyright (c) Ulrich Drepper <drepper@redhat.com>
-* Copyright (c) International Business Machines  Corp., 2009
-*
-* 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.
+* Copyright (c) International Business Machines Corp., 2009
 */
 
 /*
diff --git a/testcases/kernel/syscalls/splice/splice01.c b/testcases/kernel/syscalls/splice/splice01.c
index a975ccb..e1c60f5 100644
--- a/testcases/kernel/syscalls/splice/splice01.c
+++ b/testcases/kernel/syscalls/splice/splice01.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2006
+ * Copyright (c) International Business Machines Corp., 2006
  *  Author Yi Yang <yyangcdl@cn.ibm.com>
- *
- * 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
  */
 /*
  * DESCRIPTION
diff --git a/testcases/kernel/syscalls/splice/splice02.c b/testcases/kernel/syscalls/splice/splice02.c
index a59703e..b579667 100644
--- a/testcases/kernel/syscalls/splice/splice02.c
+++ b/testcases/kernel/syscalls/splice/splice02.c
@@ -1,26 +1,9 @@
-/******************************************************************************/
-/* Copyright (c) Jens Axboe <axboe@kernel.dk>, 2009                           */
-/*                                                                            */
-/* LKML Reference: http://lkml.org/lkml/2009/4/2/55                           */
-/*                                                                            */
-/* 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           */
-/*                                                                            */
-/******************************************************************************/
-/******************************************************************************/
-/* Description: This tests the splice() syscall                               */
-/******************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Jens Axboe <axboe@kernel.dk>, 2009
+ * http://lkml.org/lkml/2009/4/2/55
+ */
+
 #define _GNU_SOURCE
 
 #include <stdio.h>
diff --git a/testcases/kernel/syscalls/splice/splice03.c b/testcases/kernel/syscalls/splice/splice03.c
index 12326d2..85bc1ba 100644
--- a/testcases/kernel/syscalls/splice/splice03.c
+++ b/testcases/kernel/syscalls/splice/splice03.c
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Xing Gu <gux.fnst@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 /*
  * Description:
diff --git a/testcases/kernel/syscalls/splice/splice04.c b/testcases/kernel/syscalls/splice/splice04.c
index 852dd05..ce38951 100644
--- a/testcases/kernel/syscalls/splice/splice04.c
+++ b/testcases/kernel/syscalls/splice/splice04.c
@@ -1,26 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Red Hat, Inc.
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- *
  * Author: Boyang Xue <bxue@redhat.com>
- */
-
-/*
- * Functional test for splice(2): pipe to pipe
  *
- * This test case tests splice(2) from a pipe to another
+ * Functional test for splice(2): pipe to pipe
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/kernel/syscalls/splice/splice05.c b/testcases/kernel/syscalls/splice/splice05.c
index 3f6e85d..a800adc 100644
--- a/testcases/kernel/syscalls/splice/splice05.c
+++ b/testcases/kernel/syscalls/splice/splice05.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Red Hat, Inc.
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- *
  * Author: Boyang Xue <bxue@redhat.com>
  */
 
diff --git a/testcases/kernel/syscalls/stat/.gitignore b/testcases/kernel/syscalls/stat/.gitignore
index 4a8f618..fa0a4ce 100644
--- a/testcases/kernel/syscalls/stat/.gitignore
+++ b/testcases/kernel/syscalls/stat/.gitignore
@@ -1,4 +1,6 @@
 /stat01
 /stat01_64
+/stat02
+/stat02_64
 /stat03
 /stat03_64
diff --git a/testcases/kernel/syscalls/stat/stat02.c b/testcases/kernel/syscalls/stat/stat02.c
new file mode 100644
index 0000000..c330cfe
--- /dev/null
+++ b/testcases/kernel/syscalls/stat/stat02.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ * AUTHOR: Barrie Kletscher
+ * CO-PILOT: Dave Baumgartner
+ */
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/signal.h>
+#include <errno.h>
+#include <stdlib.h>
+#include "tst_test.h"
+
+/* Temporary file names */
+#define FNAME1	"stat02.1"
+#define FNAME2	"stat02.2"
+
+/* Number of times each buffer is written */
+#define NUM_WRITES	(10)
+#define BUFSIZE		(4096)
+
+char *buffer;
+
+static struct test_case {
+	const char *filename;
+	size_t bytes_to_write;
+	size_t decrement;
+} tcases[] = {
+	/* Write and verify BUFSIZE byte chunks */
+	{ FNAME1, BUFSIZE, BUFSIZE },
+	/* Write and verify decreasing chunk sizes */
+	{ FNAME2, BUFSIZE, 1000 }
+};
+
+void verify(const char *fname, size_t bytes, size_t decrement)
+{
+	struct stat s;
+	int fd, i;
+	size_t bytes_written = 0;
+
+	fd = SAFE_OPEN(fname, O_CREAT | O_TRUNC | O_RDWR, 0777);
+	while (bytes > 0) {
+		for (i = 0; i < NUM_WRITES; i++) {
+			SAFE_WRITE(1, fd, buffer, bytes);
+			bytes_written += bytes;
+		}
+		bytes -= bytes > decrement ? decrement : bytes;
+	}
+
+	SAFE_CLOSE(fd);
+	SAFE_STAT(fname, &s);
+	SAFE_UNLINK(fname);
+
+	/*
+	 *  Now check to see if the number of bytes written was
+	 *  the same as the number of bytes in the file.
+	 */
+	if (s.st_size != (off_t) bytes_written) {
+		tst_res(TFAIL, "file size (%zu) not as expected (%zu) bytes",
+				s.st_size, bytes_written);
+		return;
+	}
+
+	tst_res(TPASS, "File size reported as expected");
+}
+
+void verify_stat_size(unsigned int nr)
+{
+	struct test_case *tcase = &tcases[nr];
+
+	verify(tcase->filename, tcase->bytes_to_write, tcase->decrement);
+}
+
+void setup(void)
+{
+	buffer = SAFE_MALLOC(BUFSIZE);
+}
+
+void cleanup(void)
+{
+	free(buffer);
+}
+
+static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(tcases),
+	.needs_tmpdir = 1,
+	.test = verify_stat_size,
+	.setup = setup,
+	.cleanup = cleanup,
+};
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index c3ba943..4f9d582 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -165,5 +165,4 @@
 	.needs_devfs = 1,
 	.mntpoint = MNTPOINT,
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 };
diff --git a/testcases/kernel/syscalls/statx/statx04.c b/testcases/kernel/syscalls/statx/statx04.c
index 71de734..f8350ed 100644
--- a/testcases/kernel/syscalls/statx/statx04.c
+++ b/testcases/kernel/syscalls/statx/statx04.c
@@ -180,7 +180,6 @@
 	.needs_root = 1,
 	.all_filesystems = 1,
 	.mount_device = 1,
-	.needs_tmpdir = 1,
 	.mntpoint = MOUNT_POINT,
 	.min_kver = "4.11",
 };
diff --git a/testcases/kernel/syscalls/statx/statx05.c b/testcases/kernel/syscalls/statx/statx05.c
index dd77e25..42911fc 100644
--- a/testcases/kernel/syscalls/statx/statx05.c
+++ b/testcases/kernel/syscalls/statx/statx05.c
@@ -88,6 +88,7 @@
 {
 	char opt_bsize[32];
 	const char *const extra_opts[] = {"-O encrypt", opt_bsize, NULL};
+	int ret;
 
 	snprintf(opt_bsize, sizeof(opt_bsize), "-b %i", getpagesize());
 
@@ -98,12 +99,12 @@
 	SAFE_MKDIR(TESTDIR_FLAGGED, 0777);
 	SAFE_MKDIR(TESTDIR_UNFLAGGED, 0777);
 
-	TEST(tst_system("echo qwery | e4crypt add_key "TESTDIR_FLAGGED));
+	ret = tst_system("echo qwery | e4crypt add_key "TESTDIR_FLAGGED);
 
-	if (WEXITSTATUS(TST_RET) == 127)
+	if (WEXITSTATUS(ret) == 127)
 		tst_brk(TCONF, "e4crypt not installed!");
 
-	if (WEXITSTATUS(TST_RET))
+	if (WEXITSTATUS(ret))
 		tst_brk(TCONF, "e4crypt failed (CONFIG_EXT4_ENCRYPTION not set?)");
 }
 
diff --git a/testcases/kernel/syscalls/statx/statx06.c b/testcases/kernel/syscalls/statx/statx06.c
index 831f730..0469d66 100644
--- a/testcases/kernel/syscalls/statx/statx06.c
+++ b/testcases/kernel/syscalls/statx/statx06.c
@@ -169,7 +169,6 @@
 	.test = test_statx,
 	.min_kver = "4.11",
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.mntpoint = MOUNT_POINT,
 	.mount_device = 1,
 	.dev_fs_type = "ext4",
diff --git a/testcases/kernel/syscalls/statx/statx07.c b/testcases/kernel/syscalls/statx/statx07.c
index 997e81a..ec1cdd1 100644
--- a/testcases/kernel/syscalls/statx/statx07.c
+++ b/testcases/kernel/syscalls/statx/statx07.c
@@ -133,8 +133,8 @@
 	snprintf(server_path, sizeof(server_path), ":%s/%s", cwd, SERV_PATH);
 
 	snprintf(cmd, sizeof(cmd),
-		 "exportfs -i -o no_root_squash,rw,sync,no_subtree_check *%.1024s",
-		 server_path);
+		 "exportfs -i -o no_root_squash,rw,sync,no_subtree_check,fsid=%d *%.1024s",
+		 getpid(), server_path);
 	exported = 1;
 
 	ret = tst_system(cmd);
@@ -144,7 +144,8 @@
 		tst_brk(TBROK | TST_ERR, "failed to exportfs");
 
 	if (mount(server_path, CLI_PATH, "nfs", 0, "addr=127.0.0.1")) {
-		if (errno == EOPNOTSUPP || errno == ECONNREFUSED)
+		if (errno == EOPNOTSUPP || errno == ECONNREFUSED
+			|| errno == ETIMEDOUT)
 			tst_brk(TCONF | TERRNO, "nfs server not set up?");
 		tst_brk(TBROK | TERRNO, "mount() nfs failed");
 	}
diff --git a/testcases/kernel/syscalls/swapoff/Makefile b/testcases/kernel/syscalls/swapoff/Makefile
index bd617d8..536b2db 100644
--- a/testcases/kernel/syscalls/swapoff/Makefile
+++ b/testcases/kernel/syscalls/swapoff/Makefile
@@ -19,5 +19,6 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
+include $(abs_srcdir)/./Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
+$(MAKE_TARGETS): %: %.o ../swapon/libswapon.o
diff --git a/testcases/kernel/syscalls/swapoff/Makefile.inc b/testcases/kernel/syscalls/swapoff/Makefile.inc
new file mode 100644
index 0000000..65350cb
--- /dev/null
+++ b/testcases/kernel/syscalls/swapoff/Makefile.inc
@@ -0,0 +1,6 @@
+LIBDIR			+= ../swapon/
+LIBSWAPON		:= $(LIBDIR)/libswapon.o
+$(LIBSWAPON):
+	$(MAKE) -C $(LIBDIR)
+CPPFLAGS		+= -I$(abs_srcdir)/$(LIBDIR)
+LDFLAGS			+= -L$(abs_builddir)/$(LIBDIR)
diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c
index a63e661..e115269 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff01.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff01.c
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include "config.h"
 #include "lapi/syscalls.h"
+#include "../swapon/libswapon.h"
 
 static void setup(void);
 static void cleanup(void);
@@ -86,14 +87,7 @@
 
 	tst_tmpdir();
 
-	switch ((fs_type = tst_fs_type(cleanup, "."))) {
-	case TST_NFS_MAGIC:
-	case TST_TMPFS_MAGIC:
-		tst_brkm(TCONF, cleanup,
-			 "Cannot do swapoff on a file on %s filesystem",
-			 tst_fs_type_name(fs_type));
-	break;
-	}
+	is_swap_supported(cleanup, "./tstswap");
 
 	if (!tst_fs_has_free(NULL, ".", 64, TST_MB)) {
 		tst_brkm(TBROK, cleanup,
diff --git a/testcases/kernel/syscalls/swapoff/swapoff02.c b/testcases/kernel/syscalls/swapoff/swapoff02.c
index b5c6312..8954f97 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff02.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff02.c
@@ -33,6 +33,7 @@
 #include "test.h"
 #include "lapi/syscalls.h"
 #include "safe_macros.h"
+#include "../swapon/libswapon.h"
 
 static void setup(void);
 static void cleanup(void);
@@ -124,7 +125,6 @@
 
 static void setup(void)
 {
-	long type;
 	struct passwd *nobody;
 
 	tst_sig(FORK, DEF_HANDLER, cleanup);
@@ -138,14 +138,7 @@
 
 	tst_tmpdir();
 
-	switch ((type = tst_fs_type(cleanup, "."))) {
-	case TST_NFS_MAGIC:
-	case TST_TMPFS_MAGIC:
-		tst_brkm(TCONF, cleanup,
-			 "Cannot do swapoff on a file on %s filesystem",
-			 tst_fs_type_name(type));
-	break;
-	}
+	is_swap_supported(cleanup, "./tstswap");
 
 	if (!tst_fs_has_free(NULL, ".", 1, TST_KB)) {
 		tst_brkm(TBROK, cleanup,
diff --git a/testcases/kernel/syscalls/swapon/libswapon.c b/testcases/kernel/syscalls/swapon/libswapon.c
index cf6a988..0a4501b 100644
--- a/testcases/kernel/syscalls/swapon/libswapon.c
+++ b/testcases/kernel/syscalls/swapon/libswapon.c
@@ -19,13 +19,15 @@
  *
  */
 
+#include <errno.h>
+#include "lapi/syscalls.h"
 #include "test.h"
 #include "libswapon.h"
 
 /*
  * Make a swap file
  */
-void make_swapfile(void (cleanup)(void), const char *swapfile)
+int make_swapfile(void (cleanup)(void), const char *swapfile, int safe)
 {
 	if (!tst_fs_has_free(NULL, ".", sysconf(_SC_PAGESIZE) * 10,
 	    TST_BYTES)) {
@@ -45,5 +47,44 @@
 	argv[1] = swapfile;
 	argv[2] = NULL;
 
-	tst_run_cmd(cleanup, argv, "/dev/null", "/dev/null", 0);
+	return tst_run_cmd(cleanup, argv, "/dev/null", "/dev/null", safe);
+}
+
+/*
+ * Check swapon/swapoff support status of filesystems or files
+ * we are testing on.
+ */
+void is_swap_supported(void (cleanup)(void), const char *filename)
+{
+	int fibmap = tst_fibmap(filename);
+	long fs_type = tst_fs_type(cleanup, filename);
+	const char *fstype = tst_fs_type_name(fs_type);
+
+	int ret = make_swapfile(NULL, filename, 1);
+	if (ret != 0) {
+		if (fibmap == 1) {
+			tst_brkm(TCONF, cleanup,
+				"mkswap on %s not supported", fstype);
+		} else {
+			tst_brkm(TFAIL, cleanup,
+				"mkswap on %s failed", fstype);
+		}
+	}
+
+	TEST(ltp_syscall(__NR_swapon, filename, 0));
+	if (TEST_RETURN == -1) {
+		if (fibmap == 1 && errno == EINVAL) {
+			tst_brkm(TCONF, cleanup,
+				"Swapfile on %s not implemented", fstype);
+		} else {
+			tst_brkm(TFAIL | TERRNO, cleanup,
+				 "swapon on %s failed", fstype);
+		}
+	}
+
+	TEST(ltp_syscall(__NR_swapoff, filename, 0));
+	if (TEST_RETURN == -1) {
+		tst_brkm(TFAIL | TERRNO, cleanup,
+			"swapoff on %s failed", fstype);
+	}
 }
diff --git a/testcases/kernel/syscalls/swapon/libswapon.h b/testcases/kernel/syscalls/swapon/libswapon.h
index 7f7211e..a51833e 100644
--- a/testcases/kernel/syscalls/swapon/libswapon.h
+++ b/testcases/kernel/syscalls/swapon/libswapon.h
@@ -29,6 +29,11 @@
 /*
  * Make a swap file
  */
-void make_swapfile(void (cleanup)(void), const char *swapfile);
+int make_swapfile(void (cleanup)(void), const char *swapfile, int safe);
 
+/*
+ * Check swapon/swapoff support status of filesystems or files
+ * we are testing on.
+ */
+void is_swap_supported(void (cleanup)(void), const char *filename);
 #endif /* __LIBSWAPON_H__ */
diff --git a/testcases/kernel/syscalls/swapon/swapon01.c b/testcases/kernel/syscalls/swapon/swapon01.c
index 32538f8..f95ce0a 100644
--- a/testcases/kernel/syscalls/swapon/swapon01.c
+++ b/testcases/kernel/syscalls/swapon/swapon01.c
@@ -84,16 +84,9 @@
 
 	tst_tmpdir();
 
-	switch ((fs_type = tst_fs_type(cleanup, "."))) {
-	case TST_NFS_MAGIC:
-	case TST_TMPFS_MAGIC:
-		tst_brkm(TCONF, cleanup,
-			 "Cannot do swapon on a file on %s filesystem",
-			 tst_fs_type_name(fs_type));
-	break;
-	}
+	is_swap_supported(cleanup, "./tstswap");
 
-	make_swapfile(cleanup, "swapfile01");
+	make_swapfile(cleanup, "swapfile01", 0);
 }
 
 static void cleanup(void)
diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c
index 4af5105..3d49d0c 100644
--- a/testcases/kernel/syscalls/swapon/swapon02.c
+++ b/testcases/kernel/syscalls/swapon/swapon02.c
@@ -132,18 +132,11 @@
 
 	tst_tmpdir();
 
-	switch ((fs_type = tst_fs_type(cleanup, "."))) {
-	case TST_NFS_MAGIC:
-	case TST_TMPFS_MAGIC:
-		tst_brkm(TCONF, cleanup,
-			 "Cannot do swapon on a file on %s filesystem",
-			 tst_fs_type_name(fs_type));
-	break;
-	}
+	is_swap_supported(cleanup, "./tstswap");
 
 	SAFE_TOUCH(cleanup, "notswap", 0777, NULL);
-	make_swapfile(cleanup, "swapfile01");
-	make_swapfile(cleanup, "alreadyused");
+	make_swapfile(cleanup, "swapfile01", 0);
+	make_swapfile(cleanup, "alreadyused", 0);
 
 	if (ltp_syscall(__NR_swapon, "alreadyused", 0)) {
 		if (fs_type != TST_BTRFS_MAGIC || errno != EINVAL)
diff --git a/testcases/kernel/syscalls/swapon/swapon03.c b/testcases/kernel/syscalls/swapon/swapon03.c
index 955ac24..cef5715 100644
--- a/testcases/kernel/syscalls/swapon/swapon03.c
+++ b/testcases/kernel/syscalls/swapon/swapon03.c
@@ -153,7 +153,7 @@
 	int j, fd;
 	int status;
 	int res = 0;
-	char filename[15];
+	char filename[FILENAME_MAX];
 	char buf[BUFSIZ + 1];
 
 	/* Find out how many swapfiles (1 line per entry) already exist */
@@ -210,7 +210,7 @@
 			}
 
 			/* Create the swapfile */
-			make_swapfile(cleanup, filename);
+			make_swapfile(cleanup, filename, 0);
 
 			/* turn on the swap file */
 			res = ltp_syscall(__NR_swapon, filename, 0);
@@ -246,7 +246,7 @@
 
 	/* Create all needed extra swapfiles for testing */
 	for (j = 0; j < testfiles; j++)
-		make_swapfile(cleanup, swap_testfiles[j].filename);
+		make_swapfile(cleanup, swap_testfiles[j].filename, 0);
 
 	return 0;
 
@@ -333,14 +333,7 @@
 
 	tst_tmpdir();
 
-	switch ((fs_type = tst_fs_type(cleanup, "."))) {
-	case TST_NFS_MAGIC:
-	case TST_TMPFS_MAGIC:
-		tst_brkm(TCONF, cleanup,
-			 "Cannot do swapon on a file on %s filesystem",
-			 tst_fs_type_name(fs_type));
-	break;
-	}
+	is_swap_supported(cleanup, "./tstswap");
 
 	TEST_PAUSE;
 }
diff --git a/testcases/kernel/syscalls/switch/endian_switch01.c b/testcases/kernel/syscalls/switch/endian_switch01.c
index 777280a..f357ff5 100644
--- a/testcases/kernel/syscalls/switch/endian_switch01.c
+++ b/testcases/kernel/syscalls/switch/endian_switch01.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) International Business Machines Corp., 2008
  * Copyright (c) Paul Mackerras, IBM Corp., 2008
  * Copyright (c) 2018 Linux Test Project
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -31,7 +19,7 @@
 #include <sys/wait.h>
 #include "tst_test.h"
 
-#if defined (__powerpc64__) || (__powerpc__)
+#if defined(__powerpc64__) || defined(__powerpc__)
 # ifndef PPC_FEATURE_TRUE_LE
 # define PPC_FEATURE_TRUE_LE              0x00000002
 # endif
diff --git a/testcases/kernel/syscalls/sync/sync03.c b/testcases/kernel/syscalls/sync/sync03.c
index a6f72d2..c5c02f8 100644
--- a/testcases/kernel/syscalls/sync/sync03.c
+++ b/testcases/kernel/syscalls/sync/sync03.c
@@ -32,6 +32,7 @@
 
 	fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
 
+	tst_dev_sync(fd);
 	tst_dev_bytes_written(tst_device->dev);
 
 	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
index 82d77f7..64d069e 100644
--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
+++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
@@ -22,23 +22,38 @@
 #include "check_sync_file_range.h"
 
 #define MNTPOINT		"mnt_point"
-#define FNAME		MNTPOINT"/test"
-#define FILE_SIZE_MB	32
-#define FILE_SIZE (FILE_SIZE_MB * TST_MB)
+#define FNAME1			MNTPOINT"/test1"
+#define FNAME2			MNTPOINT"/test2"
+#define FNAME3			MNTPOINT"/test3"
+#define FILE_SZ_MB		32
+#define FILE_SZ			(FILE_SZ_MB * TST_MB)
 #define MODE			0644
 
-static void verify_sync_file_range(void)
+struct testcase {
+	char *fname;
+	off64_t sync_off;
+	off64_t sync_size;
+	size_t exp_sync_size;
+	off64_t write_off;
+	size_t write_size_mb;
+	const char *desc;
+};
+
+static void verify_sync_file_range(struct testcase *tc)
 {
 	int fd;
 	unsigned long written;
 
-	fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
+	fd = SAFE_OPEN(tc->fname, O_RDWR|O_CREAT, MODE);
 
+	lseek(fd, tc->write_off, SEEK_SET);
+
+	tst_dev_sync(fd);
 	tst_dev_bytes_written(tst_device->dev);
 
-	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
+	tst_fill_fd(fd, 0, TST_MB, tc->write_size_mb);
 
-	TEST(sync_file_range(fd, 0, FILE_SIZE,
+	TEST(sync_file_range(fd, tc->sync_off, tc->sync_size,
 			     SYNC_FILE_RANGE_WAIT_BEFORE |
 			     SYNC_FILE_RANGE_WRITE |
 			     SYNC_FILE_RANGE_WAIT_AFTER));
@@ -48,25 +63,66 @@
 
 	written = tst_dev_bytes_written(tst_device->dev);
 
+	fsync(fd);
+
 	SAFE_CLOSE(fd);
 
-	if (written >= FILE_SIZE)
-		tst_res(TPASS, "Test file range synced to device");
+	if (written >= tc->exp_sync_size)
+		tst_res(TPASS, "%s", tc->desc);
 	else
-		tst_res(TFAIL, "Synced %li, expected %i", written, FILE_SIZE);
+		tst_res(TFAIL, "%s: Synced %li, expected %li", tc->desc,
+		        written, tc->exp_sync_size);
+}
+
+static struct testcase testcases[] = {
+	{FNAME1,
+	 0, FILE_SZ,
+	 FILE_SZ,
+	 0, FILE_SZ_MB,
+	 "Sync equals write"},
+	{FNAME2,
+	 FILE_SZ/4, FILE_SZ/2,
+	 FILE_SZ/2,
+	 0, FILE_SZ_MB,
+	 "Sync inside of write"},
+	{FNAME3,
+	 FILE_SZ/4, FILE_SZ/2,
+	 FILE_SZ/4,
+	 FILE_SZ/2, FILE_SZ_MB/4,
+	 "Sync overlaps with write"},
+};
+
+static void run(unsigned int i)
+{
+	verify_sync_file_range(&testcases[i]);
 }
 
 static void setup(void)
 {
 	if (!check_sync_file_range())
 		tst_brk(TCONF, "sync_file_range() not supported");
+
+	/*
+	 * Fat does not support sparse files, we have to pre-fill the file so
+	 * that the zero-filled start of the file has been written to disk
+	 * before the test starts.
+	 */
+	if (!strcmp(tst_device->fs_type, "vfat")) {
+		tst_res(TINFO, "Pre-filling file");
+		tst_fill_file(FNAME3, 0, TST_MB, FILE_SZ_MB);
+		int fd = SAFE_OPEN(FNAME3, O_RDONLY);
+		fsync(fd);
+		SAFE_CLOSE(fd);
+	}
 }
 
 static struct tst_test test = {
+	.tcnt = ARRAY_SIZE(testcases),
 	.needs_root = 1,
 	.mount_device = 1,
 	.all_filesystems = 1,
+	.dev_fs_flags = TST_FS_SKIP_FUSE,
 	.mntpoint = MNTPOINT,
 	.setup = setup,
-	.test_all = verify_sync_file_range,
+	.test = run,
 };
diff --git a/testcases/kernel/syscalls/syncfs/syncfs01.c b/testcases/kernel/syscalls/syncfs/syncfs01.c
index 051a19e..333726e 100644
--- a/testcases/kernel/syscalls/syncfs/syncfs01.c
+++ b/testcases/kernel/syscalls/syncfs/syncfs01.c
@@ -33,6 +33,7 @@
 
 	fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE);
 
+	tst_dev_sync(fd);
 	tst_dev_bytes_written(tst_device->dev);
 
 	tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB);
diff --git a/testcases/kernel/syscalls/syscall/syscall01.c b/testcases/kernel/syscalls/syscall/syscall01.c
index 1173c31..167e6ee 100644
--- a/testcases/kernel/syscalls/syscall/syscall01.c
+++ b/testcases/kernel/syscalls/syscall/syscall01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2002
+ * Copyright (c) International Business Machines Corp., 2002
  * 01/02/2003	Port to LTP avenkat@us.ibm.com
  * 06/30/2001	Port to Linux nsharoff@us.ibm.com
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c
index 820ab0b..ea41f9d 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/sysctl/sysctl04.c b/testcases/kernel/syscalls/sysctl/sysctl04.c
index 0593070..9c620fa 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl04.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl04.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 200i1
+ * Copyright (c) International Business Machines Corp., 200i1
  * Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
- *
- * 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.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/syslog/syslog-lib.sh b/testcases/kernel/syscalls/syslog/syslog-lib.sh
index 31266f9..eed501d 100755
--- a/testcases/kernel/syscalls/syslog/syslog-lib.sh
+++ b/testcases/kernel/syscalls/syslog/syslog-lib.sh
@@ -75,19 +75,19 @@
 		#   $ModLoad imjournal
 		#   module(load="imjournal"...)
 		# in rsyslog config, and using those settings.
-		if grep -qri '^[^#].*load.*imjournal' /etc/rsyslog.conf /etc/rsyslog.d/ ; then
-			systemd_journal=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf /etc/rsyslog.d/)
-			RSYSLOG_CONFIG=$(cat <<EOF
-$systemd_journal
-EOF
-)
+		if grep -qri '^[^#]*modload.*imjournal' /etc/rsyslog.conf /etc/rsyslog.d/; then
+			RSYSLOG_CONFIG=$(grep -Ehoi "^[^#].*(imjournal|workdirectory).*" -r /etc/rsyslog.conf /etc/rsyslog.d/;
+				echo '$imjournalRatelimitInterval 0'; \
+				echo '$ImjournalIgnorePreviousMessages on';)
+		elif grep -qri '^[^#]*module.*load="imjournal"' /etc/rsyslog.conf /etc/rsyslog.d/; then
+			RSYSLOG_CONFIG=$(grep -Ehoi "^[^#].*workdirectory.*" -r /etc/rsyslog.conf /etc/rsyslog.d/; \
+				echo 'module(load="imjournal"'; \
+				echo '       StateFile="imjournal.state"'; \
+				echo '       Ratelimit.Interval="0"'; \
+				echo '       IgnorePreviousMessages="on")')
 		else
-			log_socket=$(grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
-			RSYSLOG_CONFIG=$(cat <<EOF
-\$ModLoad imuxsock.so
-$log_socket
-EOF
-)
+			RSYSLOG_CONFIG=$(echo '$ModLoad imuxsock.so'; \
+				grep -ho "^\$SystemLogSocketName .*" -r /etc/rsyslog.conf /etc/rsyslog.d/ | head -1)
 		fi
 	else
 		tst_resm TCONF "Couldn't find syslogd, syslog-ng or rsyslogd"
diff --git a/testcases/kernel/syscalls/tee/tee01.c b/testcases/kernel/syscalls/tee/tee01.c
index 7e64779..db2ac1e 100644
--- a/testcases/kernel/syscalls/tee/tee01.c
+++ b/testcases/kernel/syscalls/tee/tee01.c
@@ -1,28 +1,9 @@
-/****************************************************************************
- *
- * Copyright (c) International Business Machines  Corp., 2006
- *  Author Yi Yang <yyangcdl@cn.ibm.com>
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) International Business Machines Corp., 2006
  * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
- *
- * DESCRIPTION
- *	This test case will verify basic function of tee(2)
- *	added by kernel 2.6.17 or up.
- *
- ***************************************************************************/
+ * Author: Yi Yang <yyangcdl@cn.ibm.com>
+ */
 
 #define _GNU_SOURCE
 
diff --git a/testcases/kernel/syscalls/tee/tee02.c b/testcases/kernel/syscalls/tee/tee02.c
index 744d51a..21296e9 100644
--- a/testcases/kernel/syscalls/tee/tee02.c
+++ b/testcases/kernel/syscalls/tee/tee02.c
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Xing Gu <gux.fnst@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 /*
  * Description:
diff --git a/testcases/kernel/syscalls/tgkill/tgkill03.c b/testcases/kernel/syscalls/tgkill/tgkill03.c
index f5bbdc5..593a217 100644
--- a/testcases/kernel/syscalls/tgkill/tgkill03.c
+++ b/testcases/kernel/syscalls/tgkill/tgkill03.c
@@ -7,6 +7,7 @@
 
 #include <pthread.h>
 #include <pwd.h>
+#include <stdio.h>
 #include <sys/types.h>
 
 #include "tst_safe_pthread.h"
@@ -42,6 +43,7 @@
 {
 	sigset_t sigusr1;
 	pthread_t defunct_thread;
+	char defunct_tid_path[PATH_MAX];
 
 	sigemptyset(&sigusr1);
 	sigaddset(&sigusr1, SIGUSR1);
@@ -55,8 +57,9 @@
 	TST_CHECKPOINT_WAIT(0);
 
 	SAFE_PTHREAD_CREATE(&defunct_thread, NULL, defunct_thread_func, NULL);
-
 	SAFE_PTHREAD_JOIN(defunct_thread, NULL);
+	sprintf(defunct_tid_path, "/proc/%d/task/%d", getpid(), defunct_tid);
+	TST_RETRY_FN_EXP_BACKOFF(access(defunct_tid_path, R_OK), -1, 15);
 }
 
 static void cleanup(void)
@@ -108,4 +111,5 @@
 	.setup = setup,
 	.cleanup = cleanup,
 	.test = run,
+	.timeout = 20,
 };
diff --git a/testcases/kernel/timers/timer_create/.gitignore b/testcases/kernel/syscalls/timer_create/.gitignore
similarity index 66%
rename from testcases/kernel/timers/timer_create/.gitignore
rename to testcases/kernel/syscalls/timer_create/.gitignore
index f8bec56..b70d6cb 100644
--- a/testcases/kernel/timers/timer_create/.gitignore
+++ b/testcases/kernel/syscalls/timer_create/.gitignore
@@ -1,3 +1,3 @@
+/timer_create01
 /timer_create02
 /timer_create03
-/timer_create04
diff --git a/testcases/kernel/timers/timer_create/Makefile b/testcases/kernel/syscalls/timer_create/Makefile
similarity index 100%
rename from testcases/kernel/timers/timer_create/Makefile
rename to testcases/kernel/syscalls/timer_create/Makefile
diff --git a/testcases/kernel/syscalls/timer_create/timer_create01.c b/testcases/kernel/syscalls/timer_create/timer_create01.c
new file mode 100644
index 0000000..1cb9a9f
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_create/timer_create01.c
@@ -0,0 +1,114 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
+ *
+ * Author:	Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * Ported to new library:
+ * 07/2019	Christian Amann <camann@suse.com>
+ */
+/*
+ *
+ * Basic test for timer_create(2):
+ *
+ *	Creates a timer for each available clock using the
+ *	following notification types:
+ *	1) SIGEV_NONE
+ *	2) SIGEV_SIGNAL
+ *	3) SIGEV_THREAD
+ *	4) SIGEV_THREAD_ID
+ *	5) NULL
+ *
+ * This is also regression test for commit:
+ * f18ddc13af98 ("alarmtimer: Use EOPNOTSUPP instead of ENOTSUPP")
+ */
+
+#include <signal.h>
+#include <time.h>
+#include "tst_test.h"
+#include "tst_safe_macros.h"
+#include "lapi/common_timers.h"
+
+static struct notif_type {
+	int		sigev_signo;
+	int		sigev_notify;
+	char		*message;
+} types[] = {
+	{SIGALRM, SIGEV_NONE, "SIGEV_NONE"},
+	{SIGALRM, SIGEV_SIGNAL, "SIGEV_SIGNAL"},
+	{SIGALRM, SIGEV_THREAD, "SIGEV_THREAD"},
+	{SIGALRM, SIGEV_THREAD_ID, "SIGEV_THREAD_ID"},
+	{0, 0, "NULL"},
+};
+
+static void run(unsigned int n)
+{
+	unsigned int i;
+	struct sigevent evp;
+	struct notif_type *nt = &types[n];
+	kernel_timer_t created_timer_id;
+
+	tst_res(TINFO, "Testing notification type: %s", nt->message);
+
+	memset(&evp, 0, sizeof(evp));
+
+	for (i = 0; i < CLOCKS_DEFINED; ++i) {
+		clock_t clock = clock_list[i];
+
+		evp.sigev_value  = (union sigval) 0;
+		evp.sigev_signo  = nt->sigev_signo;
+		evp.sigev_notify = nt->sigev_notify;
+
+		if (clock == CLOCK_PROCESS_CPUTIME_ID ||
+			clock == CLOCK_THREAD_CPUTIME_ID) {
+			/* (PROCESS_CPUTIME_ID &
+			 *  THREAD_CPUTIME_ID)
+			 * is not supported on kernel versions
+			 * lower than 2.6.12
+			 */
+			if (!have_cputime_timers())
+				continue;
+		}
+		if (clock == CLOCK_MONOTONIC_RAW)
+			continue;
+
+		if (nt->sigev_notify == SIGEV_THREAD_ID)
+			evp._sigev_un._tid = getpid();
+
+		TEST(tst_syscall(__NR_timer_create, clock,
+				nt->sigev_notify ? &evp : NULL,
+				&created_timer_id));
+
+		if (TST_RET != 0) {
+			if (possibly_unsupported(clock) &&
+			    (TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
+					get_clock_str(clock));
+			} else {
+				tst_res(TFAIL | TTERRNO,
+					"Failed to create timer for %s",
+					get_clock_str(clock));
+			}
+			continue;
+		}
+
+		tst_res(TPASS, "Timer successfully created for %s",
+					get_clock_str(clock));
+
+		TEST(tst_syscall(__NR_timer_delete, created_timer_id));
+		if (TST_RET != 0) {
+			tst_res(TFAIL | TTERRNO, "Failed to delete timer %s",
+				get_clock_str(clock));
+		}
+	}
+}
+
+static struct tst_test test = {
+	.test = run,
+	.tcnt = ARRAY_SIZE(types),
+	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "f18ddc13af98"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/timer_create/timer_create02.c b/testcases/kernel/syscalls/timer_create/timer_create02.c
new file mode 100644
index 0000000..1920f08
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_create/timer_create02.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
+ *
+ * Author: Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * Ported to new library:
+ * 07/2019      Christian Amann <camann@suse.com>
+ */
+/*
+ * Basic error handling test for timer_create(2):
+ *
+ *	Passes invalid parameters when calling the syscall and checks
+ *	if it fails with EFAULT/EINVAL:
+ *	1) Pass an invalid pointer for the sigevent structure parameter
+ *	2) Pass an invalid pointer for the timer ID parameter
+ *	3) Pass invalid clock type
+ *	4) Pass a sigevent with invalid sigev_notify
+ *	5) Pass a sigevent with invalid sigev_signo
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <time.h>
+#include <signal.h>
+#include "tst_test.h"
+#include "lapi/common_timers.h"
+
+static struct sigevent sig_ev = {
+	.sigev_notify = SIGEV_NONE,
+	.sigev_signo  = SIGALRM,
+};
+
+static struct sigevent sig_ev_inv_not = {
+	.sigev_notify = INT_MAX,
+	.sigev_signo = SIGALRM,
+};
+
+static struct sigevent sig_ev_inv_sig = {
+	.sigev_notify = SIGEV_SIGNAL,
+	.sigev_signo = INT_MAX,
+};
+
+static kernel_timer_t timer_id;
+
+static struct testcase {
+	clock_t clock;
+	struct sigevent	*ev_ptr;
+	kernel_timer_t	*kt_ptr;
+	int		error;
+	char		*desc;
+} tcases[] = {
+	{CLOCK_REALTIME, NULL, &timer_id, EFAULT, "invalid sigevent struct"},
+	{CLOCK_REALTIME, &sig_ev, NULL, EFAULT, "invalid timer ID"},
+	{MAX_CLOCKS, &sig_ev, &timer_id, EINVAL, "invalid clock"},
+	{CLOCK_REALTIME, &sig_ev_inv_not, &timer_id, EINVAL, "wrong sigev_notify"},
+	{CLOCK_REALTIME, &sig_ev_inv_sig, &timer_id, EINVAL, "wrong sigev_signo"},
+};
+
+static void run(unsigned int n)
+{
+	struct testcase *tc = &tcases[n];
+
+	TEST(tst_syscall(__NR_timer_create, tc->clock, tc->ev_ptr, tc->kt_ptr));
+
+	if (TST_RET != -1 || TST_ERR != tc->error) {
+		tst_res(TFAIL | TTERRNO,
+			"%s idn't fail as expected (%s) - Got",
+			tc->desc, tst_strerrno(tc->error));
+		return;
+	}
+
+	tst_res(TPASS | TTERRNO, "%s failed as expected", tc->desc);
+}
+
+static void setup(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(tcases); i++) {
+		if (!tcases[i].ev_ptr)
+			tcases[i].ev_ptr = tst_get_bad_addr(NULL);
+
+		if (!tcases[i].kt_ptr)
+			tcases[i].kt_ptr = tst_get_bad_addr(NULL);
+	}
+}
+
+static struct tst_test test = {
+	.test = run,
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+};
diff --git a/testcases/kernel/syscalls/timer_create/timer_create03.c b/testcases/kernel/syscalls/timer_create/timer_create03.c
new file mode 100644
index 0000000..dd797c3
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_create/timer_create03.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ *
+ * Author:	Christian Amann <camann@suse.com>
+ */
+/*
+ * Regression test for CVE-2017-18344:
+ *
+ * In kernels prior to 4.14.8 sigevent.sigev_notify is not
+ * properly verified when calling timer_create(2) with the
+ * field being set to (SIGEV_SIGNAL | SIGEV_THREAD_ID).
+ * This can be used to read arbitrary kernel memory.
+ *
+ * For more info see: https://nvd.nist.gov/vuln/detail/CVE-2017-18344
+ * or commit: cef31d9af908
+ *
+ * This test uses an unused number instead of SIGEV_THREAD_ID to check
+ * if this field gets verified correctly.
+ */
+
+#include <errno.h>
+#include <signal.h>
+#include <time.h>
+#include "tst_test.h"
+#include "lapi/common_timers.h"
+
+#define RANDOM_UNUSED_NUMBER (54321)
+
+static void run(void)
+{
+	struct sigevent evp;
+	clock_t clock = CLOCK_MONOTONIC;
+	kernel_timer_t created_timer_id;
+
+	memset(&evp, 0, sizeof(evp));
+
+	evp.sigev_signo  = SIGALRM;
+	evp.sigev_notify = SIGEV_SIGNAL | RANDOM_UNUSED_NUMBER;
+	evp._sigev_un._tid = getpid();
+
+	TEST(tst_syscall(__NR_timer_create, clock, &evp, &created_timer_id));
+
+	if (TST_RET != 0) {
+		if (TST_ERR == EINVAL) {
+			tst_res(TPASS | TTERRNO,
+					"timer_create() failed as expected");
+		} else {
+			tst_res(TFAIL | TTERRNO,
+					"timer_create() unexpectedly failed");
+		}
+		return;
+	}
+
+	tst_res(TFAIL,
+		"timer_create() succeeded for invalid notification type");
+
+	TEST(tst_syscall(__NR_timer_delete, created_timer_id));
+	if (TST_RET != 0) {
+		tst_res(TFAIL | TTERRNO, "Failed to delete timer %s",
+			get_clock_str(clock));
+	}
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-18344"},
+		{"linux-git", "cef31d9af908"},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/timer_delete/.gitignore b/testcases/kernel/syscalls/timer_delete/.gitignore
new file mode 100644
index 0000000..2524d36
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_delete/.gitignore
@@ -0,0 +1,2 @@
+/timer_delete01
+/timer_delete02
diff --git a/testcases/kernel/timers/timer_delete/Makefile b/testcases/kernel/syscalls/timer_delete/Makefile
similarity index 100%
rename from testcases/kernel/timers/timer_delete/Makefile
rename to testcases/kernel/syscalls/timer_delete/Makefile
diff --git a/testcases/kernel/syscalls/timer_delete/timer_delete01.c b/testcases/kernel/syscalls/timer_delete/timer_delete01.c
new file mode 100644
index 0000000..962eb56
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_delete/timer_delete01.c
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
+ *
+ * Author:	Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * Ported to new library:
+ * 07/2019      Christian Amann <camann@suse.com>
+ */
+/*
+ * Basic test for timer_delete(2)
+ *
+ *	Creates a timer for each available clock and then tries
+ *	to delete them again.
+ */
+
+#include <errno.h>
+#include <time.h>
+#include "tst_test.h"
+#include "lapi/common_timers.h"
+
+static void run(void)
+{
+	unsigned int i;
+	kernel_timer_t timer_id;
+
+	for (i = 0; i < CLOCKS_DEFINED; ++i) {
+		clock_t clock = clock_list[i];
+
+		if (clock == CLOCK_PROCESS_CPUTIME_ID ||
+			clock == CLOCK_THREAD_CPUTIME_ID) {
+			if (!have_cputime_timers())
+				continue;
+		}
+
+		tst_res(TINFO, "Testing %s", get_clock_str(clock));
+
+		TEST(tst_syscall(__NR_timer_create, clock, NULL, &timer_id));
+		if (TST_RET != 0) {
+			if (possibly_unsupported(clock) &&
+				(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
+					get_clock_str(clock));
+			} else {
+				tst_res(TFAIL | TTERRNO,
+					"Aborting test - timer_create(%s) failed",
+					get_clock_str(clock));
+			}
+			continue;
+		}
+
+		TEST(tst_syscall(__NR_timer_delete, timer_id));
+		if (TST_RET == 0)
+			tst_res(TPASS, "Timer deleted successfully!");
+		else
+			tst_res(TFAIL | TTERRNO, "Timer deletion failed!");
+	}
+}
+
+static struct tst_test test = {
+	.test_all = run,
+	.needs_root = 1,
+};
diff --git a/testcases/kernel/syscalls/timer_delete/timer_delete02.c b/testcases/kernel/syscalls/timer_delete/timer_delete02.c
new file mode 100644
index 0000000..29614f6
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_delete/timer_delete02.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
+ *
+ * Author: Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * Ported to new library:
+ * 07/2019      Christian Amann <camann@suse.com>
+ */
+/*
+ * Basic error handling test for timer_delete(2):
+ *
+ *	This test case checks whether timer_delete(2) returns an appropriate
+ *	error (EINVAL) for an invalid timerid parameter
+ */
+
+#include <errno.h>
+#include <time.h>
+#include "tst_test.h"
+#include "lapi/common_timers.h"
+
+#define INVALID_ID ((kernel_timer_t)-1)
+
+static void run(void)
+{
+	TEST(tst_syscall(__NR_timer_delete, INVALID_ID));
+
+	if (TST_RET == -1 && TST_ERR == EINVAL) {
+		tst_res(TPASS | TTERRNO,
+			 "Failed as expected");
+	} else {
+		tst_res(TFAIL | TTERRNO,
+			 "Didn't fail with EINVAL as expected - got");
+	}
+}
+
+static struct tst_test test = {
+	.test_all = run,
+};
diff --git a/testcases/kernel/syscalls/timer_settime/.gitignore b/testcases/kernel/syscalls/timer_settime/.gitignore
new file mode 100644
index 0000000..e1ed3ef
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_settime/.gitignore
@@ -0,0 +1,2 @@
+/timer_settime01
+/timer_settime02
diff --git a/testcases/kernel/timers/timer_settime/Makefile b/testcases/kernel/syscalls/timer_settime/Makefile
similarity index 100%
rename from testcases/kernel/timers/timer_settime/Makefile
rename to testcases/kernel/syscalls/timer_settime/Makefile
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime01.c b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
new file mode 100644
index 0000000..7bf00f5
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
@@ -0,0 +1,124 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
+ *
+ * Author:	Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * Ported to new library:
+ * 07/2019      Christian Amann <camann@suse.com>
+ */
+/*
+ * This tests the timer_settime(2) syscall under various conditions:
+ *
+ * 1) General initialization: No old_value, no flags, 5-second-timer
+ * 2) Setting a pointer to a itimerspec struct as old_set parameter
+ * 3) Using a periodic timer
+ * 4) Using absolute time
+ *
+ * All of these tests are supposed to be successful.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <time.h>
+#include <signal.h>
+#include "tst_test.h"
+#include "lapi/common_timers.h"
+
+static struct timespec timenow;
+static struct itimerspec new_set, old_set;
+static kernel_timer_t timer;
+
+static struct testcase {
+	struct itimerspec	*old_ptr;
+	int			it_value_tv_sec;
+	int			it_interval_tv_sec;
+	int			flag;
+	char			*description;
+} tcases[] = {
+	{NULL,     5, 0, 0, "general initialization"},
+	{&old_set, 5, 0, 0, "setting old_value"},
+	{&old_set, 0, 5, 0, "using periodic timer"},
+	{&old_set, 5, 0, TIMER_ABSTIME, "using absolute time"},
+};
+
+static void run(unsigned int n)
+{
+	unsigned int i;
+	struct testcase *tc = &tcases[n];
+
+	tst_res(TINFO, "Testing for %s:", tc->description);
+
+	for (i = 0; i < CLOCKS_DEFINED; ++i) {
+		clock_t clock = clock_list[i];
+
+		if (clock == CLOCK_PROCESS_CPUTIME_ID ||
+			clock == CLOCK_THREAD_CPUTIME_ID) {
+			if (!have_cputime_timers())
+				continue;
+		}
+
+		TEST(tst_syscall(__NR_timer_create, clock, NULL, &timer));
+		if (TST_RET != 0) {
+			if (possibly_unsupported(clock) &&
+				(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
+					get_clock_str(clock));
+			} else {
+				tst_res(TFAIL | TTERRNO,
+					"timer_create(%s) failed",
+					get_clock_str(clock));
+			}
+			continue;
+		}
+
+		memset(&new_set, 0, sizeof(new_set));
+		memset(&old_set, 0, sizeof(old_set));
+
+		new_set.it_value.tv_sec = tc->it_value_tv_sec;
+		new_set.it_interval.tv_sec = tc->it_interval_tv_sec;
+
+		if (tc->flag & TIMER_ABSTIME) {
+			if (clock_gettime(clock, &timenow) < 0) {
+				tst_res(TFAIL,
+					"clock_gettime(%s) failed - skipping the test",
+					get_clock_str(clock));
+				continue;
+			}
+			new_set.it_value.tv_sec += timenow.tv_sec;
+		}
+
+		TEST(tst_syscall(__NR_timer_settime, timer,
+			tc->flag, &new_set, tc->old_ptr));
+
+		if (TST_RET != 0) {
+			tst_res(TFAIL | TTERRNO, "%s failed",
+					get_clock_str(clock));
+		} else {
+			tst_res(TPASS, "%s was successful",
+					get_clock_str(clock));
+		}
+
+		TEST(tst_syscall(__NR_timer_delete, timer));
+		if (TST_RET != 0)
+			tst_res(TFAIL | TTERRNO, "timer_delete() failed!");
+	}
+}
+
+static void sighandler(int sig)
+{
+	/* sighandler for CLOCK_*_ALARM */
+	tst_res(TINFO, "Caught signal %s", tst_strsig(sig));
+}
+
+static void setup(void)
+{
+	SAFE_SIGNAL(SIGALRM, sighandler);
+}
+
+static struct tst_test test = {
+	.test = run,
+	.needs_root = 1,
+	.tcnt = ARRAY_SIZE(tcases),
+	.setup = setup,
+};
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime02.c b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
new file mode 100644
index 0000000..74cb33d
--- /dev/null
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
+ *
+ * Author:	Aniruddha Marathe <aniruddha.marathe@wipro.com>
+ *
+ * Ported to new library:
+ * 07/2019      Christian Amann <camann@suse.com>
+ */
+/*
+ * This tests basic error handling of the timer_settime(2) syscall:
+ *
+ * 1) Setting pointer to new settings to NULL -> EINVAL
+ * 2) Setting tv_nsec of the itimerspec structure to a negative value
+ *    -> EINVAL
+ * 3) Setting tv_nsec of the itimerspec structure to something larger
+ *    than NSEC_PER_SEC -> EINVAL
+ * 4) Passing an invalid timer -> EINVAL
+ * 5) Passing an invalid address for new_value -> EFAULT
+ * 6) Passing an invalid address for old_value -> EFAULT
+ */
+
+#include <errno.h>
+#include <time.h>
+#include "tst_test.h"
+#include "lapi/common_timers.h"
+
+static struct itimerspec new_set, old_set;
+static kernel_timer_t timer;
+static kernel_timer_t timer_inval = -1;
+
+/* separate description-array to (hopefully) improve readability */
+static const char * const descriptions[] = {
+	"setting new_set pointer to NULL",
+	"setting tv_nsec to a negative value",
+	"setting tv_nsec value too high",
+	"passing pointer to invalid timer_id",
+	"passing invalid address for new_value",
+	"passing invalid address for old_value",
+};
+
+static struct testcase {
+	kernel_timer_t		*timer_id;
+	struct itimerspec	*new_ptr;
+	struct itimerspec	*old_ptr;
+	int			it_value_tv_nsec;
+	int			error;
+} tcases[] = {
+	{&timer, NULL, &old_set, 0, EINVAL},
+	{&timer, &new_set, &old_set, -1, EINVAL},
+	{&timer, &new_set, &old_set, NSEC_PER_SEC + 1, EINVAL},
+	{&timer_inval, &new_set, &old_set, 0, EINVAL},
+	{&timer, (struct itimerspec *) -1, &old_set, 0, EFAULT},
+	{&timer, &new_set, (struct itimerspec *) -1, 0, EFAULT},
+};
+
+static void run(unsigned int n)
+{
+	unsigned int i;
+	struct testcase *tc = &tcases[n];
+
+	tst_res(TINFO, "Testing for %s:", descriptions[n]);
+
+	for (i = 0; i < CLOCKS_DEFINED; ++i) {
+		clock_t clock = clock_list[i];
+
+		if (clock == CLOCK_PROCESS_CPUTIME_ID ||
+			clock == CLOCK_THREAD_CPUTIME_ID) {
+			if (!have_cputime_timers())
+				continue;
+		}
+
+		/* Init temporary timer */
+		TEST(tst_syscall(__NR_timer_create, clock, NULL, &timer));
+		if (TST_RET != 0) {
+			if (possibly_unsupported(clock) &&
+				(TST_ERR == EINVAL || TST_ERR == ENOTSUP)) {
+				tst_res(TCONF | TTERRNO, "%s unsupported",
+					get_clock_str(clock));
+			} else {
+				tst_res(TFAIL | TTERRNO,
+					"timer_create(%s) failed",
+					get_clock_str(clock));
+			}
+			continue;
+		}
+
+		memset(&new_set, 0, sizeof(new_set));
+		memset(&old_set, 0, sizeof(old_set));
+
+		new_set.it_value.tv_sec  = 5;
+		new_set.it_value.tv_nsec = tc->it_value_tv_nsec;
+
+		TEST(tst_syscall(__NR_timer_settime, *tc->timer_id,
+					0, tc->new_ptr,	tc->old_ptr));
+
+		if (tc->error != TST_ERR) {
+			tst_res(TFAIL | TTERRNO,
+				 "%s didn't fail as expected. Expected: %s - Got",
+				 get_clock_str(clock),
+				 tst_strerrno(tc->error));
+		} else {
+			tst_res(TPASS | TTERRNO,
+				"%s failed as expected",
+				get_clock_str(clock));
+		}
+
+		/* Delete temporary timer */
+		TEST(tst_syscall(__NR_timer_delete, timer));
+		if (TST_RET != 0)
+			tst_res(TFAIL | TTERRNO, "timer_delete() failed!");
+	}
+}
+
+static struct tst_test test = {
+	.test = run,
+	.needs_root = 1,
+	.tcnt = ARRAY_SIZE(tcases),
+};
diff --git a/testcases/kernel/syscalls/times/times03.c b/testcases/kernel/syscalls/times/times03.c
index 7911c03..c73fc0e 100644
--- a/testcases/kernel/syscalls/times/times03.c
+++ b/testcases/kernel/syscalls/times/times03.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (C) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 /*
  * DESCRIPTION
diff --git a/testcases/kernel/syscalls/umask/umask01.c b/testcases/kernel/syscalls/umask/umask01.c
index 87bfcdc..5d6aeda 100644
--- a/testcases/kernel/syscalls/umask/umask01.c
+++ b/testcases/kernel/syscalls/umask/umask01.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *  07/2001 Ported by John George
- *
- * 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 would 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 the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/umount/umount01.c b/testcases/kernel/syscalls/umount/umount01.c
index b959356..d05296d 100644
--- a/testcases/kernel/syscalls/umount/umount01.c
+++ b/testcases/kernel/syscalls/umount/umount01.c
@@ -1,24 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * AUTHOR		: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
- *
- * DESCRIPTION
- *	This is a Phase I test for the umount(2) system call.
- *	It is intended to provide a limited exposure of the system call.
- *****************************************************************************/
+ * Phase I test for the umount(2) system call.
+ * It is intended to provide a limited exposure of the system call.
+ */
 
 #include <errno.h>
 #include <sys/mount.h>
@@ -66,7 +53,6 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
diff --git a/testcases/kernel/syscalls/umount/umount02.c b/testcases/kernel/syscalls/umount/umount02.c
index ad8783e..34a38c9 100644
--- a/testcases/kernel/syscalls/umount/umount02.c
+++ b/testcases/kernel/syscalls/umount/umount02.c
@@ -1,32 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
  * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
+ * Check for basic errors returned by umount(2) system call.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- *    AUTHOR		: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
- *
- *    DESCRIPTION
- *	Check for basic errors returned by umount(2) system call.
- *
- *	Verify that umount(2) returns -1 and sets errno to
- *
- *	1) EBUSY if it cannot be umounted, because dir is still busy.
- *	2) EFAULT if specialfile or device file points to invalid address space.
- *	3) ENOENT if pathname was empty or has a nonexistent component.
- *	4) EINVAL if specialfile or device is invalid or not a mount point.
- *	5) ENAMETOOLONG if pathname was longer than MAXPATHLEN.
- *****************************************************************************/
+ * Verify that umount(2) returns -1 and sets errno to
+ * 1) EBUSY if it cannot be umounted, because dir is still busy.
+ * 2) EFAULT if specialfile or device file points to invalid address space.
+ * 3) ENOENT if pathname was empty or has a nonexistent component.
+ * 4) EINVAL if specialfile or device is invalid or not a mount point.
+ * 5) ENAMETOOLONG if pathname was longer than MAXPATHLEN.
+ */
 
 #include <errno.h>
 #include <string.h>
@@ -95,7 +81,6 @@
 static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(tcases),
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
index 3042aea..1cef06f 100644
--- a/testcases/kernel/syscalls/umount/umount03.c
+++ b/testcases/kernel/syscalls/umount/umount03.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- *    AUTHOR		: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
- *
- *    DESCRIPTION
- *	Verify that umount(2) returns -1 and sets errno to  EPERM if the user
- *	is not the super-user.
+ * Verify that umount(2) returns -1 and sets errno to  EPERM if the user
+ * is not the super-user.
  */
 
 #include <errno.h>
@@ -71,7 +58,6 @@
 
 static struct tst_test test = {
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.format_device = 1,
 	.setup = setup,
 	.cleanup = cleanup,
diff --git a/testcases/kernel/syscalls/uname/uname04.c b/testcases/kernel/syscalls/uname/uname04.c
index e4d9e8f..2d0851c 100644
--- a/testcases/kernel/syscalls/uname/uname04.c
+++ b/testcases/kernel/syscalls/uname/uname04.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
  * Copyright (c) 2012, Kees Cook <keescook@chromium.org>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Check that memory after the string terminator in all the utsname fields has
diff --git a/testcases/kernel/syscalls/unlink/unlink05.c b/testcases/kernel/syscalls/unlink/unlink05.c
index 8d10052..adb90fa 100644
--- a/testcases/kernel/syscalls/unlink/unlink05.c
+++ b/testcases/kernel/syscalls/unlink/unlink05.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/unlink/unlink07.c b/testcases/kernel/syscalls/unlink/unlink07.c
index 04cd783..869bd5f 100644
--- a/testcases/kernel/syscalls/unlink/unlink07.c
+++ b/testcases/kernel/syscalls/unlink/unlink07.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/unlink/unlink08.c b/testcases/kernel/syscalls/unlink/unlink08.c
index f1a778f..f3ce46a 100644
--- a/testcases/kernel/syscalls/unlink/unlink08.c
+++ b/testcases/kernel/syscalls/unlink/unlink08.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
index a5e1422..4e178b4 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd01.c
@@ -82,12 +82,19 @@
 
 	set_pages();
 
-	uffd = sys_userfaultfd(O_CLOEXEC | O_NONBLOCK);
+	TEST(sys_userfaultfd(O_CLOEXEC | O_NONBLOCK));
 
-	if (uffd == -1)
-		tst_brk(TBROK | TERRNO,
-			"Could not create userfault file descriptor");
+	if (TST_RET == -1) {
+		if (TST_ERR == EPERM) {
+			tst_res(TCONF, "Hint: check /proc/sys/vm/unprivileged_userfaultfd");
+			tst_brk(TCONF | TTERRNO,
+				"userfaultfd() requires CAP_SYS_PTRACE on this system");
+		} else
+			tst_brk(TBROK | TTERRNO,
+				"Could not create userfault file descriptor");
+	}
 
+	uffd = TST_RET;
 	uffdio_api.api = UFFD_API;
 	uffdio_api.features = 0;
 	SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c
index 2e7dcc9..0252858 100644
--- a/testcases/kernel/syscalls/ustat/ustat01.c
+++ b/testcases/kernel/syscalls/ustat/ustat01.c
@@ -5,6 +5,10 @@
  * Check that ustat() succeeds given correct parameters.
  */
 
+#include "config.h"
+#include "tst_test.h"
+
+#if defined(HAVE_SYS_USTAT_H) || defined(HAVE_LINUX_TYPES_H)
 #include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -12,7 +16,6 @@
 
 #include "lapi/syscalls.h"
 #include "lapi/ustat.h"
-#include "tst_test.h"
 
 static dev_t dev_num;
 
@@ -42,3 +45,6 @@
 	.test_all = run,
 	.setup = setup,
 };
+#else
+TST_TEST_TCONF("testing ustat requires <sys/ustat.h> or <linux/types.h>");
+#endif
diff --git a/testcases/kernel/syscalls/ustat/ustat02.c b/testcases/kernel/syscalls/ustat/ustat02.c
index 9bbe4f3..d08446e 100644
--- a/testcases/kernel/syscalls/ustat/ustat02.c
+++ b/testcases/kernel/syscalls/ustat/ustat02.c
@@ -6,6 +6,10 @@
  * invalid dev_t parameter and for bad address paramater.
  */
 
+#include "config.h"
+#include "tst_test.h"
+
+#if defined(HAVE_SYS_USTAT_H) || defined(HAVE_LINUX_TYPES_H)
 #include <unistd.h>
 #include <errno.h>
 #include <sys/stat.h>
@@ -13,7 +17,6 @@
 
 #include "lapi/syscalls.h"
 #include "lapi/ustat.h"
-#include "tst_test.h"
 
 static dev_t invalid_dev = -1;
 static dev_t root_dev;
@@ -36,7 +39,7 @@
 
 void run(unsigned int test)
 {
-	TEST(tst_syscall(__NR_ustat, *tc[test].dev, tc[test].buf));
+	TEST(tst_syscall(__NR_ustat, (unsigned int)*tc[test].dev, tc[test].buf));
 
 	if ((TST_RET == -1) && (TST_ERR == tc[test].exp_errno))
 		tst_res(TPASS | TTERRNO, "ustat(2) expected failure");
@@ -61,3 +64,6 @@
 	.setup = setup,
 	.tcnt = ARRAY_SIZE(tc),
 };
+#else
+TST_TEST_TCONF("testing ustat requires <sys/ustat.h> or <linux/types.h>");
+#endif
diff --git a/testcases/kernel/syscalls/utils/compat_16.h b/testcases/kernel/syscalls/utils/compat_16.h
index 5b0338d..75d5d2d 100644
--- a/testcases/kernel/syscalls/utils/compat_16.h
+++ b/testcases/kernel/syscalls/utils/compat_16.h
@@ -24,9 +24,7 @@
 
 #include <errno.h>
 #include <grp.h>
-#if defined(__GLIBC__) || defined(__ANDROID__)
 #include <sys/fsuid.h>
-#endif
 #include <sys/types.h>
 #include <unistd.h>
 
diff --git a/testcases/kernel/syscalls/utils/compat_tst_16.h b/testcases/kernel/syscalls/utils/compat_tst_16.h
index 3b86ef3..09fa8b0 100644
--- a/testcases/kernel/syscalls/utils/compat_tst_16.h
+++ b/testcases/kernel/syscalls/utils/compat_tst_16.h
@@ -21,9 +21,7 @@
 
 #include <errno.h>
 #include <grp.h>
-#if defined(__GLIBC__) || defined(__ANDROID__)
 #include <sys/fsuid.h>
-#endif
 #include <sys/types.h>
 #include <unistd.h>
 
diff --git a/testcases/kernel/syscalls/utils/mq.h b/testcases/kernel/syscalls/utils/mq.h
index b55228c..da45d2d 100644
--- a/testcases/kernel/syscalls/utils/mq.h
+++ b/testcases/kernel/syscalls/utils/mq.h
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef MQ_H
diff --git a/testcases/kernel/syscalls/utimes/utimes01.c b/testcases/kernel/syscalls/utimes/utimes01.c
index c6ee75c..2bfc165 100644
--- a/testcases/kernel/syscalls/utimes/utimes01.c
+++ b/testcases/kernel/syscalls/utimes/utimes01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Crackerjack Project., 2007 ,Hitachi, Ltd
  * Author(s): Takahiro Yasui <takahiro.yasui.mp@hitachi.com>
  * Ported to LTP: Manas Kumar Nayak maknayak@in.ibm.com>
- *
- * 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.
  */
 /*
  * Description:
diff --git a/testcases/kernel/syscalls/vmsplice/.gitignore b/testcases/kernel/syscalls/vmsplice/.gitignore
index 2cc74a9..0392207 100644
--- a/testcases/kernel/syscalls/vmsplice/.gitignore
+++ b/testcases/kernel/syscalls/vmsplice/.gitignore
@@ -1,2 +1,3 @@
 /vmsplice01
 /vmsplice02
+/vmsplice03
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice01.c b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
index 882e198..833af23 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice01.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice01.c
@@ -1,28 +1,9 @@
-/******************************************************************************
- *
- * Copyright (c) International Business Machines  Corp., 2006
- *   Author Yi Yang <yyangcdl@cn.ibm.com>
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) International Business Machines Corp., 2006
  * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
- *
- * DESCRIPTION
- *	This test case will verify basic function of vmsplice
- *	added by kernel 2.6.17 or up.
- *
- *****************************************************************************/
+ * Author: Yi Yang <yyangcdl@cn.ibm.com>
+ */
 
 #define _GNU_SOURCE
 
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice02.c b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
index ec9fb82..978633d 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice02.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014 Fujitsu Ltd.
  * Author: Xing Gu <gux.fnst@cn.fujitsu.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 /*
  * Description:
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice03.c b/testcases/kernel/syscalls/vmsplice/vmsplice03.c
new file mode 100644
index 0000000..ae4ceaa
--- /dev/null
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice03.c
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2019 SUSE LLC
+ * Author: Jorik Cronenberg <jcronenberg@suse.de>
+ *
+ * Test vmsplice() from a pipe into user memory
+ */
+
+#define _GNU_SOURCE
+
+#include "tst_test.h"
+#include "lapi/fcntl.h"
+#include "lapi/vmsplice.h"
+
+
+#define TEST_BLOCK_SIZE (64*1024)	/* 64K */
+
+static char buffer[TEST_BLOCK_SIZE];
+static struct iovec *iov;
+
+static void vmsplice_test(void)
+{
+	int written, i;
+	int pipes[2];
+	char *arr_write = iov->iov_base;
+
+	memset(iov->iov_base, 0, iov->iov_len);
+
+	SAFE_PIPE(pipes);
+	SAFE_WRITE(1, pipes[1], buffer, TEST_BLOCK_SIZE);
+	written = vmsplice(pipes[0], iov, 1, 0);
+
+	if (written < 0)
+		tst_brk(TBROK | TERRNO, "vmsplice() failed");
+
+	if (written == 0) {
+		tst_res(TFAIL, "vmsplice() didn't write anything");
+	} else {
+		for (i = 0; i < TEST_BLOCK_SIZE; i++) {
+			if (arr_write[i] != buffer[i]) {
+				tst_res(TFAIL,
+					"Wrong data in user memory at %i", i);
+				break;
+			}
+		}
+		if (i == written)
+			tst_res(TPASS, "Spliced correctly into user memory");
+	}
+
+	SAFE_CLOSE(pipes[1]);
+	SAFE_CLOSE(pipes[0]);
+}
+
+static void setup(void)
+{
+	int i;
+
+	for (i = 0; i < TEST_BLOCK_SIZE; i++)
+		buffer[i] = i & 0xff;
+}
+
+static struct tst_test test = {
+	.setup = setup,
+	.test_all = vmsplice_test,
+	.min_kver = "2.6.23",
+	.bufs = (struct tst_buffers []) {
+		{&iov, .iov_sizes = (int[]){TEST_BLOCK_SIZE, -1}},
+		{}
+	}
+};
diff --git a/testcases/kernel/syscalls/wait4/wait401.c b/testcases/kernel/syscalls/wait4/wait401.c
index 77151ea..fa0de69 100644
--- a/testcases/kernel/syscalls/wait4/wait401.c
+++ b/testcases/kernel/syscalls/wait4/wait401.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2012-2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/waitpid/waitpid01.c b/testcases/kernel/syscalls/waitpid/waitpid01.c
index efbc26e..6e03ace 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid01.c
+++ b/testcases/kernel/syscalls/waitpid/waitpid01.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  *    07/2001 John George
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/waitpid/waitpid09.c b/testcases/kernel/syscalls/waitpid/waitpid09.c
index 7811937..ccff64c 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid09.c
+++ b/testcases/kernel/syscalls/waitpid/waitpid09.c
@@ -1,23 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * 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.
- *
- * History
- *	07/2001 John George
- *		-Ported
- *      04/2002 wjhuie sigset cleanups
+ * Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/waitpid/waitpid_common.h b/testcases/kernel/syscalls/waitpid/waitpid_common.h
index 1e600ae..be52f27 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid_common.h
+++ b/testcases/kernel/syscalls/waitpid/waitpid_common.h
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * Licensed under the GNU GPLv2 or later.
- * 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.
  */
 
 #ifndef WAITPID_COMMON_H__
diff --git a/testcases/kernel/syscalls/write/write01.c b/testcases/kernel/syscalls/write/write01.c
index 592920b..6e997ba 100644
--- a/testcases/kernel/syscalls/write/write01.c
+++ b/testcases/kernel/syscalls/write/write01.c
@@ -1,25 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
  * Copyright (c) 2017 Fujitsu Ltd.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
diff --git a/testcases/kernel/syscalls/write/write02.c b/testcases/kernel/syscalls/write/write02.c
index 34b9ae0..2f630ab 100644
--- a/testcases/kernel/syscalls/write/write02.c
+++ b/testcases/kernel/syscalls/write/write02.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Carlo Marcelo Arenas Belon <carlo@gmail.com>
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 /*
  * Tests for a special case NULL buffer with size 0 is expected to return 0.
diff --git a/testcases/kernel/syscalls/write/write03.c b/testcases/kernel/syscalls/write/write03.c
index 7e3ec98..538079f 100644
--- a/testcases/kernel/syscalls/write/write03.c
+++ b/testcases/kernel/syscalls/write/write03.c
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (c) International Business Machines  Corp., 2001
+ *   Copyright (c) International Business Machines Corp., 2001
  *	07/2001 Ported by John George
  *   Copyright (c) 2017 Fujitsu Ltd.
  *	04/2017 Modified by Jinhui Huang
- *
- *   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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/write/write04.c b/testcases/kernel/syscalls/write/write04.c
index 4ca8eca..a765d91 100644
--- a/testcases/kernel/syscalls/write/write04.c
+++ b/testcases/kernel/syscalls/write/write04.c
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
- *   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
+ *   Copyright (c) International Business Machines Corp., 2001
  */
 
 /*
diff --git a/testcases/kernel/syscalls/write/write05.c b/testcases/kernel/syscalls/write/write05.c
index 023b04a..7976962 100644
--- a/testcases/kernel/syscalls/write/write05.c
+++ b/testcases/kernel/syscalls/write/write05.c
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
- *   Copyright (c) International Business Machines  Corp., 2001
+ *   Copyright (c) International Business Machines Corp., 2001
  *	07/2001 Ported by John George
  *      04/2002 wjhuie sigset cleanups
  *      08/2007 Ricardo Salveti de Araujo <rsalveti@linux.vnet.ibm.com>
- *
- *   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
  */
 
 /*
diff --git a/testcases/kernel/syscalls/writev/writev01.c b/testcases/kernel/syscalls/writev/writev01.c
index 539b529..a59ce66 100644
--- a/testcases/kernel/syscalls/writev/writev01.c
+++ b/testcases/kernel/syscalls/writev/writev01.c
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *   Copyright (c) International Business Machines  Corp., 2001
+ *   Copyright (c) International Business Machines Corp., 2001
  *                 Linux Test Project, 2016
- *
- *   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;
  */
 
 /*
diff --git a/testcases/kernel/syscalls/writev/writev07.c b/testcases/kernel/syscalls/writev/writev07.c
index ec883ed..b725f08 100644
--- a/testcases/kernel/syscalls/writev/writev07.c
+++ b/testcases/kernel/syscalls/writev/writev07.c
@@ -1,16 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
  *   Copyright (c) Linux Test Project, 2016
- *
- *   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.
  */
 
 /*
diff --git a/testcases/kernel/timers/Makefile b/testcases/kernel/timers/Makefile
deleted file mode 100644
index 15c1640..0000000
--- a/testcases/kernel/timers/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-#    testcases/kernel/timers Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems, Inc.
-#
-#    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.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir		?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/kernel/timers/leapsec/.gitignore b/testcases/kernel/timers/leapsec/.gitignore
deleted file mode 100644
index 58787e2..0000000
--- a/testcases/kernel/timers/leapsec/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/leapsec_timer
diff --git a/testcases/kernel/timers/leapsec/Makefile b/testcases/kernel/timers/leapsec/Makefile
deleted file mode 100644
index 782cdbc..0000000
--- a/testcases/kernel/timers/leapsec/Makefile
+++ /dev/null
@@ -1,27 +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 St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-
-CPPFLAGS		+= -I$(abs_srcdir)/../include
-
-LDLIBS			+= -lrt
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/timers/leapsec/leapsec_timer.c b/testcases/kernel/timers/leapsec/leapsec_timer.c
deleted file mode 100644
index 1d18f64..0000000
--- a/testcases/kernel/timers/leapsec/leapsec_timer.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Regression test for hrtimer early expiration during and after leap seconds
- *
- * A bug in the hrtimer subsystem caused all TIMER_ABSTIME CLOCK_REALTIME
- * timers to expire one second early during leap second.
- * See http://lwn.net/Articles/504658/.
- *
- * This is a regression test for the bug.
- *
- * Lingzhu Xiang <lxiang@redhat.com> Copyright (c) Red Hat, Inc., 2012.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/timex.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <time.h>
-#include "test.h"
-#include "common_timers.h"
-
-#define SECONDS_BEFORE_LEAP 2
-#define SECONDS_AFTER_LEAP 2
-
-char *TCID = "leapsec_timer";
-int TST_TOTAL = 1;
-
-static inline int in_order(struct timespec a, struct timespec b);
-static void adjtimex_status(struct timex *tx, int status);
-static const char *strtime(const struct timespec *now);
-static void test_hrtimer_early_expiration(void);
-static void run_leapsec(void);
-static void setup(void);
-static void cleanup(void);
-
-int main(int argc, char **argv)
-{
-	int lc;
-
-	tst_parse_opts(argc, argv, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		tst_count = 0;
-		run_leapsec();
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-static inline int in_order(struct timespec a, struct timespec b)
-{
-	if (a.tv_sec < b.tv_sec)
-		return 1;
-	if (a.tv_sec > b.tv_sec)
-		return 0;
-	if (a.tv_nsec > b.tv_nsec)
-		return 0;
-	return 1;
-}
-
-static void adjtimex_status(struct timex *tx, int status)
-{
-	const char *const msgs[6] = {
-		"clock synchronized",
-		"insert leap second",
-		"delete leap second",
-		"leap second in progress",
-		"leap second has occurred",
-		"clock not synchronized",
-	};
-	int r;
-	struct timespec now;
-
-	tx->modes = ADJ_STATUS;
-	tx->status = status;
-	r = adjtimex(tx);
-	now.tv_sec = tx->time.tv_sec;
-	now.tv_nsec = tx->time.tv_usec * 1000;
-
-	if ((tx->status & status) != status)
-		tst_brkm(TBROK, cleanup, "adjtimex status %d not set", status);
-	else if (r < 0)
-		tst_brkm(TBROK | TERRNO, cleanup, "adjtimex");
-	else if (r < 6)
-		tst_resm(TINFO, "%s adjtimex: %s", strtime(&now), msgs[r]);
-	else
-		tst_resm(TINFO, "%s adjtimex: clock state %d",
-			 strtime(&now), r);
-}
-
-static const char *strtime(const struct timespec *now)
-{
-	static char fmt[256], buf[256];
-
-	if (snprintf(fmt, sizeof(fmt), "%%F %%T.%09ld %%z", now->tv_nsec) < 0) {
-		buf[0] = '\0';
-		return buf;
-	}
-	if (!strftime(buf, sizeof(buf), fmt, localtime(&now->tv_sec))) {
-		buf[0] = '\0';
-		return buf;
-	}
-	return buf;
-}
-
-static void test_hrtimer_early_expiration(void)
-{
-	struct timespec now, target;
-	int r, fail;
-
-	clock_gettime(CLOCK_REALTIME, &now);
-	tst_resm(TINFO, "now is     %s", strtime(&now));
-
-	target = now;
-	target.tv_sec++;
-	tst_resm(TINFO, "sleep till %s", strtime(&target));
-	r = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &target, NULL);
-	if (r < 0) {
-		tst_resm(TINFO | TERRNO, "clock_nanosleep");
-		return;
-	}
-
-	clock_gettime(CLOCK_REALTIME, &now);
-	tst_resm(TINFO, "now is     %s", strtime(&now));
-
-	fail = !in_order(target, now);
-	tst_resm(fail ? TFAIL : TINFO, "hrtimer early expiration is %s.",
-		 fail ? "detected" : "not detected");
-}
-
-static void run_leapsec(void)
-{
-	const struct timespec sleeptime = { 0, NSEC_PER_SEC / 2 };
-	struct timespec now, leap, start;
-	struct timex tx;
-
-	clock_gettime(CLOCK_REALTIME, &now);
-	start = now;
-	tst_resm(TINFO, "test start at %s", strtime(&now));
-
-	test_hrtimer_early_expiration();
-
-	/* calculate the next leap second */
-	now.tv_sec += 86400 - now.tv_sec % 86400;
-	now.tv_nsec = 0;
-	leap = now;
-	tst_resm(TINFO, "scheduling leap second %s", strtime(&leap));
-
-	/* start before the leap second */
-	now.tv_sec -= SECONDS_BEFORE_LEAP;
-	if (clock_settime(CLOCK_REALTIME, &now) < 0)
-		tst_brkm(TBROK | TERRNO, cleanup, "clock_settime");
-	tst_resm(TINFO, "setting time to        %s", strtime(&now));
-
-	/* reset NTP time state */
-	adjtimex_status(&tx, STA_PLL);
-	adjtimex_status(&tx, 0);
-
-	/* set the leap second insert flag */
-	adjtimex_status(&tx, STA_INS);
-
-	/* reliably sleep till after the leap second */
-	while (tx.time.tv_sec < leap.tv_sec + SECONDS_AFTER_LEAP) {
-		adjtimex_status(&tx, tx.status);
-		clock_nanosleep(CLOCK_MONOTONIC, 0, &sleeptime, NULL);
-	}
-
-	test_hrtimer_early_expiration();
-
-	adjtimex_status(&tx, STA_PLL);
-	adjtimex_status(&tx, 0);
-
-	/* recover from timer expiring state and restore time */
-	clock_gettime(CLOCK_REALTIME, &now);
-	start.tv_sec += now.tv_sec - (leap.tv_sec - SECONDS_BEFORE_LEAP);
-	start.tv_nsec += now.tv_nsec;
-	start.tv_sec += start.tv_nsec / NSEC_PER_SEC;
-	start.tv_nsec = start.tv_nsec % NSEC_PER_SEC;
-	tst_resm(TINFO, "restoring time to %s", strtime(&start));
-	/* calls clock_was_set() in kernel to revert inconsistency */
-	if (clock_settime(CLOCK_REALTIME, &start) < 0)
-		tst_brkm(TBROK | TERRNO, cleanup, "clock_settime");
-
-	test_hrtimer_early_expiration();
-}
-
-static void setup(void)
-{
-	tst_require_root();
-	tst_sig(NOFORK, DEF_HANDLER, CLEANUP);
-	TEST_PAUSE;
-}
-
-static void cleanup(void)
-{
-	struct timespec now;
-	clock_gettime(CLOCK_REALTIME, &now);
-	/* Calls clock_was_set() in kernel to revert inconsistency.
-	 * The only possible EPERM doesn't matter here. */
-	clock_settime(CLOCK_REALTIME, &now);
-}
diff --git a/testcases/kernel/timers/timer_create/timer_create02.c b/testcases/kernel/timers/timer_create/timer_create02.c
deleted file mode 100644
index 1127400..0000000
--- a/testcases/kernel/timers/timer_create/timer_create02.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_create02
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for timer_create(2)
- *
- *    TEST CASE TOTAL	: 3
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *     This is a Phase I test for the timer_create(2) system call.
- *     It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- *	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 Execute system call with different notification types for
- *	 clock ID CLOCK_REALTIME
- *	 Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	 Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_create02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : Run n copies simultaneously.
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- *RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-void setup(void);
-void setup_test(int option);
-
-char *TCID = "timer_create02";	/* Test program identifier.    */
-int TST_TOTAL = 3;		/* Total number of test cases. */
-static struct sigevent evp, *evp_ptr;
-
-int main(int ac, char **av)
-{
-	int lc, i, j;
-	kernel_timer_t created_timer_id;	/* holds the returned timer_id */
-	char *message[3] = {
-		"SIGEV_SIGNAL",
-		"NULL",
-		"SIGEV_NONE"
-	};
-	const char *mrstr = "MONOTONIC_RAW";
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			setup_test(i);
-
-			for (j = 0; j < CLOCKS_DEFINED; ++j) {
-
-				if (strstr(get_clock_str(clock_list[j]),
-					   "CPUTIME_ID")) {
-					/* (PROCESS_CPUTIME_ID &
-					 *  THREAD_CPUTIME_ID)
-					 * is not supported on kernel versions
-					 * lower than 2.6.12
-					 */
-					if ((tst_kvercmp(2, 6, 12)) < 0) {
-						continue;
-					}
-				}
-				if (strstr(get_clock_str(clock_list[j]), mrstr))
-					continue;
-
-				TEST(ltp_syscall(__NR_timer_create,
-					clock_list[j], evp_ptr,
-					&created_timer_id));
-
-				tst_resm((TEST_RETURN == 0 ?
-					  TPASS :
-					  TFAIL | TTERRNO),
-					 "%s %s with notification type = %s",
-					 get_clock_str(clock_list[j]),
-					 (TEST_RETURN == 0 ?
-					  "passed" : "failed"), message[i]);
-			}
-		}
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/* setup_test() - sets up individual test */
-void setup_test(int option)
-{
-	switch (option) {
-	case 0:
-		evp.sigev_value = (union sigval) 0;
-		evp.sigev_signo = SIGALRM;
-		evp.sigev_notify = SIGEV_SIGNAL;
-		evp_ptr = &evp;
-		break;
-	case 1:
-		evp_ptr = NULL;
-		break;
-	case 2:
-		evp.sigev_value = (union sigval) 0;
-		evp.sigev_signo = SIGALRM;	/* any will do */
-		evp.sigev_notify = SIGEV_NONE;
-		evp_ptr = &evp;
-		break;
-	}
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-}
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/timers/timer_create/timer_create03.c b/testcases/kernel/timers/timer_create/timer_create03.c
deleted file mode 100644
index 8b01bf7..0000000
--- a/testcases/kernel/timers/timer_create/timer_create03.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_create03
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for timer_create(2)
- *
- *    TEST CASE TOTAL	: 3
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *     This is a Phase I test for the timer_create(2) system call.
- *     It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- *	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 Execute system call with different notification types for
- *	 clock ID CLOCK_MONOTONIC
- *	 Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	 Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_create03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : Run n copies simultaneously.
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- *RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-void setup(void);
-void setup_test(int option);
-
-char *TCID = "timer_create03";	/* Test program identifier. */
-int TST_TOTAL = 3;		/* Total number of test cases. */
-static struct sigevent evp, *evp_ptr;
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-}
-
-int main(int ac, char **av)
-{
-	int lc, i;
-	kernel_timer_t created_timer_id;	/* holds the returned timer_id */
-	char *message[] = {
-		"SIGEV_SIGNAL",
-		"NULL",
-		"SIGEV_NONE"
-	};
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			setup_test(i);
-			TEST(ltp_syscall(__NR_timer_create, CLOCK_MONOTONIC,
-				     evp_ptr, &created_timer_id));
-
-			tst_resm((TEST_RETURN == 0 ? TPASS : TFAIL | TTERRNO),
-				 "%s with notification type = %s",
-				 (TEST_RETURN == 0 ? "passed" : "failed"),
-				 message[i]);
-
-		}
-
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/* setup_test() - sets up individual test */
-void setup_test(int option)
-{
-	switch (option) {
-	case 0:
-		evp.sigev_value = (union sigval) 0;
-		evp.sigev_signo = SIGALRM;
-		evp.sigev_notify = SIGEV_SIGNAL;
-		evp_ptr = &evp;
-		break;
-	case 1:
-		evp_ptr = NULL;
-		break;
-	case 2:
-		evp.sigev_value = (union sigval) 0;
-		evp.sigev_signo = SIGALRM;	/* any will do */
-		evp.sigev_notify = SIGEV_NONE;
-		evp_ptr = &evp;
-		break;
-	}
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-}
diff --git a/testcases/kernel/timers/timer_create/timer_create04.c b/testcases/kernel/timers/timer_create/timer_create04.c
deleted file mode 100644
index 11cfc21..0000000
--- a/testcases/kernel/timers/timer_create/timer_create04.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_create04
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Test checking for basic error conditions for
- *    			  timer_create(2)
- *
- *    TEST CASE TOTAL	: 8
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *    	This test case check whether timer_create(2) returns appropriate error
- *    	value for invalid parameter
- *
- * 	Setup:
- *	 Setup signal handling.
- *	 Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 For case 7 set event parameter as bad pointer
- *	 for case 8 set returned timer ID parameter as bad pointer
- *	 Execute system call with invalid parameter
- *	 Check return code, if system call fails with errno == expected errno
- * 	 	Issue syscall passed with expected errno
- *	 Otherwise, Issue syscall failed to produce expected errno
- *
- * 	Cleanup:
- * 	 Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_create04 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : run n copies simultaneously
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- * RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <signal.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-void setup(void);
-
-int testcase[6] = {
-	EINVAL,			/* MAX_CLOCKS     */
-	EINVAL,			/* MAX_CLOCKS + 1 */
-	EFAULT,			/* bad sigevent   */
-	EFAULT			/* bad timer_id   */
-};
-
-char *TCID = "timer_create04";	/* Test program identifier.    */
-int TST_TOTAL = ARRAY_SIZE(testcase);
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-
-}
-
-int main(int ac, char **av)
-{
-	int lc, i;
-	kernel_timer_t timer_id, *temp_id;	/* stores the returned timer_id */
-	struct sigevent *temp_ev;	/* used for bad address test case */
-
-	clockid_t clocks[6] = {
-		MAX_CLOCKS,
-		MAX_CLOCKS + 1,
-		CLOCK_REALTIME,
-		CLOCK_MONOTONIC,
-		CLOCK_PROCESS_CPUTIME_ID,
-		CLOCK_THREAD_CPUTIME_ID
-	};
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	TST_TOTAL = sizeof(testcase) / sizeof(testcase[0]);
-
-	/* PROCESS_CPUTIME_ID & THREAD_CPUTIME_ID are not supported on
-	 * kernel versions lower than 2.6.12
-	 */
-	if (tst_kvercmp(2, 6, 12) < 0) {
-		testcase[4] = EINVAL;
-		testcase[5] = EINVAL;
-	} else {
-		testcase[4] = EFAULT;
-		testcase[5] = EFAULT;
-	}
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			temp_ev = NULL;
-			temp_id = &timer_id;
-
-			switch (i) {
-			case 2:	/* make the timer_id bad address */
-				temp_id = (kernel_timer_t *) - 1;
-				break;
-			case 3:
-				/* make the event bad address */
-				temp_ev = (struct sigevent *)-1;
-				break;
-			case 4:
-				/* Produce an invalid timer_id address. */
-				if (tst_kvercmp(2, 6, 12) >= 0)
-					temp_id = (kernel_timer_t *) - 1;
-				break;
-			case 5:
-				/* Produce an invalid event address. */
-				if (tst_kvercmp(2, 6, 12) >= 0)
-					temp_ev = (struct sigevent *)-1;
-			}
-
-			TEST(ltp_syscall(__NR_timer_create, clocks[i], temp_ev,
-				     temp_id));
-
-			/* check return code */
-			if (TEST_RETURN == -1 && TEST_ERRNO == testcase[i]) {
-				tst_resm(TPASS | TTERRNO, "failed as expected");
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "didn't fail as expected [expected "
-					 "errno = %d (%s)]",
-					 testcase[i], strerror(testcase[i]));
-			}	/* end of else */
-
-		}
-
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-}
diff --git a/testcases/kernel/timers/timer_delete/.gitignore b/testcases/kernel/timers/timer_delete/.gitignore
deleted file mode 100644
index fe1a281..0000000
--- a/testcases/kernel/timers/timer_delete/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/timer_delete02
-/timer_delete03
diff --git a/testcases/kernel/timers/timer_delete/timer_delete02.c b/testcases/kernel/timers/timer_delete/timer_delete02.c
deleted file mode 100644
index b9b9c7f..0000000
--- a/testcases/kernel/timers/timer_delete/timer_delete02.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_delete02
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for timer_delete(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *     This is a Phase I test for the timer_delete(2) system call.
- *     It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- *	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 Create a POSIX timer
- *	 Execute system call
- *	 Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	 Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_delete02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : Run n copies simultaneously.
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- *RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-void setup(void);
-
-char *TCID = "timer_delete02";	/* Test program identifier.    */
-int TST_TOTAL = 1;		/* Total number of test cases. */
-
-int main(int ac, char **av)
-{
-	int lc;
-	kernel_timer_t timer_id;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/* Create a Posix timer */
-		if (ltp_syscall(__NR_timer_create, CLOCK_REALTIME, NULL,
-			&timer_id) < 0) {
-			tst_count = TST_TOTAL;
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "timer_delete can't be tested because "
-				 "timer_create failed");
-		}
-		TEST(ltp_syscall(__NR_timer_delete, timer_id));
-		tst_resm((TEST_RETURN == 0 ? TPASS : TFAIL | TTERRNO),
-			 "%s", (TEST_RETURN == 0 ? "passed" : "failed"));
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-}
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/timers/timer_delete/timer_delete03.c b/testcases/kernel/timers/timer_delete/timer_delete03.c
deleted file mode 100644
index 02506fb..0000000
--- a/testcases/kernel/timers/timer_delete/timer_delete03.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_delete03
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Test checking for basic error conditions for
- *    			  timer_delete(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *    	This test case check whether timer_delete(2) returns appropriate error
- *    	value for invalid parameter
- *
- * 	Setup:
- *	 Setup signal handling.
- *	 Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 Execute system call with invalid parameter.
- *	 Check return code, if system call fails with errno == expected errno
- * 	 	Issue syscall passed with expected errno
- *	 Otherwise, Issue syscall failed to produce expected errno
- *
- * 	Cleanup:
- * 	 Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_delete03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : run n copies simultaneously
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- * RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-#define INVALID_ID ((kernel_timer_t)-1)
-
-void setup(void);
-
-int testcase[] = {
-	EINVAL			/* Invalid timer ID */
-};
-
-char *TCID = "timer_delete03";
-int TST_TOTAL = ARRAY_SIZE(testcase);
-
-int main(int ac, char **av)
-{
-	int lc, i;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			TEST(ltp_syscall(__NR_timer_delete, INVALID_ID));
-
-			/* check return code */
-			if (TEST_RETURN == -1 && TEST_ERRNO == testcase[i]) {
-				tst_resm(TPASS | TTERRNO,
-					 "failed as expected failure");
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "didn't fail as expected [expected "
-					 "errno = %d (%s)]",
-					 testcase[i], strerror(testcase[i]));
-			}	/* end of else */
-
-		}		/* End of TEST CASE LOOPING */
-
-	}			/* End for TEST_LOOPING */
-
-	cleanup();
-	tst_exit();
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-}
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/timers/timer_settime/.gitignore b/testcases/kernel/timers/timer_settime/.gitignore
deleted file mode 100644
index 7741c63..0000000
--- a/testcases/kernel/timers/timer_settime/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/timer_settime02
-/timer_settime03
diff --git a/testcases/kernel/timers/timer_settime/timer_settime02.c b/testcases/kernel/timers/timer_settime/timer_settime02.c
deleted file mode 100644
index cfeb7b3..0000000
--- a/testcases/kernel/timers/timer_settime/timer_settime02.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_settime02
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for timer_settime(2)
- *
- *    TEST CASE TOTAL	: 4
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *     This is a Phase I test for the timer_settime(2) system call.
- *     It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- *	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 setup individual test
- *	 Execute system call
- *	 Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	 Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_settime02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : Run n copies simultaneously.
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- *RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-void setup(void);
-static int setup_test(int option);
-
-char *TCID = "timer_settime02";	/* Test program identifier.    */
-int TST_TOTAL = 4;		/* Total number of test cases. */
-
-static struct itimerspec new_set, old_set, *old_temp;
-static kernel_timer_t timer;
-static int flag;
-
-int main(int ac, char **av)
-{
-	int lc, i;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			/* Set up individual test */
-			if (setup_test(i) == 0) {
-				TEST(ltp_syscall(__NR_timer_settime, timer,
-					flag, &new_set, old_temp));
-				tst_resm((TEST_RETURN == 0 ?
-					  TPASS :
-					  TFAIL | TTERRNO),
-					 "%s",
-					 (TEST_RETURN ==
-					  0 ? "passed" : "failed")
-				    );
-			}
-
-		}
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/* This function does set up for individual tests */
-static int setup_test(int option)
-{
-	struct timespec timenow;	/* Used to obtain current time */
-	int rc = 0;
-
-	switch (option) {
-	case 0:
-		/* This is general initialization.
-		 * make old_setting NULL
-		 * make flags equal to zero
-		 * use one-shot timer
-		 */
-		old_temp = NULL;
-		new_set.it_interval.tv_sec = 0;
-		new_set.it_interval.tv_nsec = 0;
-		new_set.it_value.tv_sec = 5;
-		new_set.it_value.tv_nsec = 0;
-		flag = 0;
-		break;
-	case 1:
-		/* get the old_setting in old_set
-		 * This test case also takes care
-		 * of situation where the timerid is
-		 * already armed
-		 */
-		old_temp = &old_set;
-		break;
-	case 2:
-		/* Use the periodic timer */
-		new_set.it_interval.tv_sec = 5;
-		new_set.it_value.tv_sec = 0;
-		break;
-	case 3:
-		/* Use TIMER_ABSTIME flag for setting
-		 * absolute time for timer
-		 */
-		flag = TIMER_ABSTIME;
-		/*
-		 * Let's not use the linux_syscall_number syscall(2)
-		 * wrapper here because our primary test focus is
-		 * timer_create, not clock_gettime. That's covered in
-		 * those respective tests.
-		 */
-		if (clock_gettime(CLOCK_REALTIME, &timenow) < 0) {
-			tst_resm(TWARN | TERRNO,
-				 "clock_gettime failed; skipping the test");
-			rc = -1;
-		} else {
-			new_set.it_value.tv_sec = timenow.tv_sec + 25;
-		}
-		break;
-	}
-	return rc;
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	if (ltp_syscall(__NR_timer_create, CLOCK_REALTIME, NULL, &timer) < 0)
-		tst_brkm(TBROK, NULL, "timer_create failed");
-}
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/timers/timer_settime/timer_settime03.c b/testcases/kernel/timers/timer_settime/timer_settime03.c
deleted file mode 100644
index 1216c11..0000000
--- a/testcases/kernel/timers/timer_settime/timer_settime03.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) Wipro Technologies Ltd, 2003.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-/**************************************************************************
- *
- *    TEST IDENTIFIER	: timer_settime03
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Test checking for basic error conditions for
- *    			  timer_settime(2)
- *
- *    TEST CASE TOTAL	: 6
- *
- *    AUTHOR		: Aniruddha Marathe <aniruddha.marathe@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *    	This test case check whether timer_settime(2) returns appropriate error
- *    	value for invalid parameter
- *
- * 	Setup:
- *	 Setup signal handling.
- *	 Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 setup the individual test.
- *	 Execute system call with invalid parameters.
- *	 Check return code, if system call fails with errno == expected errno
- * 	 	Issue syscall passed with expected errno
- *	 Otherwise, Issue syscall failed to produce expected errno
- *
- * 	Cleanup:
- * 	 Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- * timer_settime03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-p]
- * where:
- * 	-c n : run n copies simultaneously
- *	-e   : Turn on errno logging.
- *	-i n : Execute test n times.
- *	-I x : Execute test for x seconds.
- *	-p   : Pause for SIGUSR1 before starting
- *	-P x : Pause for x seconds between iterations.
- *	-t   : Turn on syscall timing.
- *
- * RESTRICTIONS:
- * None
- *****************************************************************************/
-
-#include <errno.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "test.h"
-#include "common_timers.h"
-
-void setup(void);
-void setup_test(int option);
-
-int testcase[] = {
-	EINVAL,			/* New setting null */
-	EINVAL,			/* tv_nsec < 0 */
-	EINVAL,			/* nsec > NSEC/SEC */
-	EINVAL,			/* Invalid timerid */
-	EFAULT,			/* bad newsetting * */
-	EFAULT			/* bad oldsetting * */
-};
-
-char *TCID = "timer_settime03";
-int TST_TOTAL = ARRAY_SIZE(testcase);
-
-static struct itimerspec new_set, old_set, *old_temp, *new_temp;
-static kernel_timer_t timer, tim;
-
-int main(int ac, char **av)
-{
-	int lc, i;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			/* Set up individual tests */
-			setup_test(i);
-			TEST(ltp_syscall(__NR_timer_settime, tim, 0, new_temp,
-				     old_temp));
-
-			/* check return code */
-			if (TEST_RETURN == -1 && TEST_ERRNO == testcase[i]) {
-				tst_resm(TPASS | TTERRNO, "failed as expected");
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "didn't fail as expected [expected "
-					 "errno = %d (%s)]",
-					 testcase[i], strerror(testcase[i]));
-			}	/* end of else */
-
-		}
-
-	}
-
-	cleanup();
-	tst_exit();
-}
-
-/* This function sets up individual tests */
-void setup_test(int option)
-{
-	switch (option) {
-	case 0:
-		/* Pass NULL structure as new setting */
-		new_temp = NULL;
-		tim = timer;
-		old_temp = &old_set;
-		break;
-	case 1:
-		/* Make tv_nsec value less than 0 */
-		new_set.it_value.tv_nsec = -1;
-		new_set.it_value.tv_sec = 5;
-		new_set.it_interval.tv_sec = 0;
-		new_set.it_interval.tv_nsec = 0;
-		new_temp = &new_set;
-		break;
-	case 2:
-		/* Make tv_nsec more than NSEC_PER_SEC */
-		new_set.it_value.tv_nsec = NSEC_PER_SEC + 1;
-		break;
-	case 3:
-		/* make timer_id invalid */
-		tim = (kernel_timer_t) - 1;
-		new_set.it_value.tv_nsec = 0;
-		break;
-	case 4:
-		/* make new_setting a bad pointer */
-		tim = timer;
-		new_temp = (struct itimerspec *)-1;
-		break;
-	case 5:
-		/* make old_setting a bad pointer */
-		new_temp = &new_set;
-		old_temp = (struct itimerspec *)-1;
-		break;
-	}
-}
-
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
-{
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	if (ltp_syscall(__NR_timer_create, CLOCK_REALTIME, NULL, &timer) < 0) {
-		tst_brkm(TBROK, NULL, "Timer create failed. Cannot"
-			 " setup test");
-	}
-
-	TEST_PAUSE;
-}
-
-/*
- * cleanup() - Performs one time cleanup for this test at
- * completion or premature exit
- */
-void cleanup(void)
-{
-}
diff --git a/testcases/kernel/tracing/dynamic_debug/dynamic_debug01.sh b/testcases/kernel/tracing/dynamic_debug/dynamic_debug01.sh
index 4cd43ba..7f06c24 100755
--- a/testcases/kernel/tracing/dynamic_debug/dynamic_debug01.sh
+++ b/testcases/kernel/tracing/dynamic_debug/dynamic_debug01.sh
@@ -1,31 +1,14 @@
 #!/bin/sh
-
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (C) 2017 Red Hat, Inc.
 #
-# 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.
+# Test functionality of dynamic debug feature by enabling
+# and disabling traces with available flags. Check that these
+# settings don't cause issues by searching dmesg.
 #
-# 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, see <http://www.gnu.org/licenses/>.
-#
-#
-# Test description: Test functionality of dynamic debug feature by enabling
-#                   and disabling traces with available flags. Check that these
-#                   settings don't cause issues by searching dmesg.
-#
-#                   This test handles changes of dynamic debug interface from
-#                   commits 5ca7d2a6 (dynamic_debug: describe_flags with
-#                   '=[pmflt_]*') and 8ba6ebf5 (Dynamic debug: Add more flags)
-#
-# Usage
-# ./dynamic_debug01.sh
+# This test handles changes of dynamic debug interface from
+# commits 5ca7d2a6 (dynamic_debug: describe_flags with
+# '=[pmflt_]*') and 8ba6ebf5 (Dynamic debug: Add more flags)
 
 TST_TESTFUNC=ddebug_test
 TST_NEEDS_CMDS="awk /bin/echo"
@@ -144,7 +127,7 @@
 	sed -i -e 1,`wc -l < ./dmesg.old`d ./dmesg.new
 	if grep -q -e "Kernel panic" -e "Oops" -e "general protection fault" \
 		-e "general protection handler: wrong gs" -e "\(XEN\) Panic" \
-		-e "fault" -e "warn" -e "BUG" ./dmesg.new ; then
+		-e "fault" -e "warn" -e "\<BUG\>" ./dmesg.new ; then
 		tst_res TFAIL "Issues found in dmesg!"
 	else
 		tst_res TPASS "Dynamic debug OK"
diff --git a/testcases/kernel/tracing/pt_test/pt_test.c b/testcases/kernel/tracing/pt_test/pt_test.c
index 5feb1aa..f9903fd 100644
--- a/testcases/kernel/tracing/pt_test/pt_test.c
+++ b/testcases/kernel/tracing/pt_test/pt_test.c
@@ -6,14 +6,14 @@
  */
 
 /*
- * This test will check if Intel PT(Intel Processer Trace) full trace mode is
- * working.
+ * This test will check if Intel PT(Intel Processer Trace) is working.
  *
  * Intel CPU of 5th-generation Core (Broadwell) or newer is required for the test.
  *
  * kconfig requirement: CONFIG_PERF_EVENTS
  */
 
+
 #include <sched.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -40,22 +40,35 @@
 //map head and size
 uint64_t **bufm;
 long buhsz;
+static char *str_mode;
+static char *str_exclude_info;
+static char *str_branch_flag;
+int mode = 1;
 
-static uint64_t **create_map(int fde, long bufsize)
+static uint64_t **create_map(int fde, long bufsize, int flag)
 {
 	uint64_t **buf_ev;
+	int pro_flag;
 	struct perf_event_mmap_page *pc;
 
 	buf_ev = SAFE_MALLOC(2*sizeof(uint64_t *));
 	buf_ev[0] = NULL;
 	buf_ev[1] = NULL;
+	if (flag == 1) {
+		tst_res(TINFO, "Memory will be r/w for full trace mode");
+		pro_flag = PROT_READ | PROT_WRITE;
+	} else {
+		tst_res(TINFO, "Memory will be r only for snapshot mode");
+		pro_flag = PROT_READ;
+	}
 	buf_ev[0] = SAFE_MMAP(NULL, INTEL_PT_MEMSIZE, PROT_READ | PROT_WRITE,
 							MAP_SHARED, fde, 0);
 
+	tst_res(TINFO, "Open Intel PT event failed");
 	pc = (struct perf_event_mmap_page *)buf_ev[0];
 	pc->aux_offset = INTEL_PT_MEMSIZE;
 	pc->aux_size = bufsize;
-	buf_ev[1] = SAFE_MMAP(NULL, bufsize, PROT_READ | PROT_WRITE,
+	buf_ev[1] = SAFE_MMAP(NULL, bufsize, pro_flag,
 					MAP_SHARED, fde, INTEL_PT_MEMSIZE);
 	return buf_ev;
 }
@@ -89,7 +102,7 @@
 	free(buf_ev);
 }
 
-static void intel_pt_full_trace_check(void)
+static void intel_pt_trace_check(void)
 {
 	uint64_t aux_head = 0;
 	struct perf_event_mmap_page *pmp;
@@ -104,11 +117,37 @@
 	pmp = (struct perf_event_mmap_page *)bufm[0];
 	aux_head = *(volatile uint64_t *)&pmp->aux_head;
 	if (aux_head == 0) {
-		tst_res(TFAIL, "There is no trace!");
+		tst_res(TFAIL, "There is no trace");
 		return;
 	}
 
-	tst_res(TPASS, "perf trace full mode is passed!");
+	tst_res(TPASS, "perf trace test passed");
+}
+
+static int is_affected_by_erratum_BDM106(void)
+{
+	int family = -1, model = -1;
+
+	if (FILE_LINES_SCANF("/proc/cpuinfo", "cpu family%*s%d", &family)
+		|| family != 6)
+		return 0;
+
+	if (!FILE_LINES_SCANF("/proc/cpuinfo", "model%*s%d", &model)) {
+		tst_res(TINFO, "Intel FAM6 model %d", model);
+
+		switch (model) {
+		case 0x3D: /* INTEL_FAM6_BROADWELL */
+		/* fallthrough */
+		case 0x47: /* INTEL_FAM6_BROADWELL_G */
+		/* fallthrough */
+		case 0x4F: /* INTEL_FAM6_BROADWELL_X */
+		/* fallthrough */
+		case 0x56: /* INTEL_FAM6_BROADWELL_D */
+			return 1;
+		}
+	}
+
+	return 0;
 }
 
 static void setup(void)
@@ -116,10 +155,10 @@
 	struct perf_event_attr attr = {};
 
 	buhsz = 2 * PAGESIZE;
+
 	if (access(INTEL_PT_PATH, F_OK)) {
 		tst_brk(TCONF,
-			"Requires Intel Core 5th+ generation (Broadwell and newer)"
-			" and CONFIG_PERF_EVENTS enabled.");
+			"Requires Intel Core 5th+ generation (Broadwell and newer) and CONFIG_PERF_EVENTS enabled");
 	}
 
 	/* set attr for Intel PT trace */
@@ -130,20 +169,43 @@
 	attr.config	= BIT(intel_pt_pmu_value(INTEL_PT_FORMAT_TSC)) |
 				BIT(intel_pt_pmu_value(INTEL_PT_FORMAT_NRT));
 	attr.size	= sizeof(struct perf_event_attr);
-	attr.exclude_kernel		= 0;
-	attr.exclude_user		= 0;
 	attr.mmap			= 1;
+	if (str_branch_flag) {
+		if (is_affected_by_erratum_BDM106()) {
+			tst_brk(TCONF, "erratum BDM106 disallows not "
+				"setting BRANCH_EN on this CPU");
+		}
+
+		tst_res(TINFO, "Intel PT will disable branch trace");
+		attr.config |= 1;
+	}
+
+	attr.exclude_kernel	= 0;
+	attr.exclude_user	= 0;
+	if (str_exclude_info) {
+		if (!strcmp(str_exclude_info, "user")) {
+			tst_res(TINFO, "Intel PT will exclude user trace");
+			attr.exclude_user = 1;
+		} else if (!strcmp(str_exclude_info, "kernel")) {
+			tst_res(TINFO, "Intel PT will exclude kernel trace");
+			attr.exclude_kernel = 1;
+		} else {
+			tst_brk(TBROK, "Invalid -e '%s'", str_exclude_info);
+		}
+	}
 
 	/* only get trace for own pid */
 	fde = tst_syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
 	if (fde < 0) {
-		tst_res(TINFO, "Open Intel PT event failed!");
-		tst_res(TFAIL, "perf trace full mode is failed!");
+		tst_res(TINFO, "Open Intel PT event failed");
+		tst_res(TFAIL, "perf trace full mode failed");
 		return;
 	}
 	bufm = NULL;
-	bufm = create_map(fde, buhsz);
+	if (str_mode)
+		mode = 0;
 
+	bufm = create_map(fde, buhsz, mode);
 }
 
 static void cleanup(void)
@@ -154,8 +216,17 @@
 	del_map(bufm, buhsz);
 }
 
+static struct tst_option options[] = {
+	{"m", &str_mode, "-m different mode, default is full mode"},
+	{"e:", &str_exclude_info, "-e exclude info, user or kernel"},
+	{"b", &str_branch_flag, "-b if disable branch trace"},
+	{NULL, NULL, NULL}
+};
+
+
 static struct tst_test test = {
-	.test_all = intel_pt_full_trace_check,
+	.test_all = intel_pt_trace_check,
+	.options = options,
 	.min_kver = "4.1",
 	.setup = setup,
 	.cleanup = cleanup,
@@ -163,5 +234,5 @@
 };
 
 #else
-TST_TEST_TCONF("missing aux_* fields in struct perf_event_mmap_page");
+TST_TEST_TCONF("Missing aux_* fields in struct perf_event_mmap_page");
 #endif /* HAVE_STRUCT_PERF_EVENT_MMAP_PAGE_AUX_HEAD */
diff --git a/testcases/kernel/uevents/.gitignore b/testcases/kernel/uevents/.gitignore
new file mode 100644
index 0000000..7818f73
--- /dev/null
+++ b/testcases/kernel/uevents/.gitignore
@@ -0,0 +1,3 @@
+uevent01
+uevent02
+uevent03
diff --git a/testcases/kernel/uevents/Makefile b/testcases/kernel/uevents/Makefile
new file mode 100644
index 0000000..d5ceb07
--- /dev/null
+++ b/testcases/kernel/uevents/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+top_srcdir			?= ../../..
+
+LTPLIBS = ltpuinput
+
+uevent03: LDLIBS += -lltpuinput
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/uevents/uevent.h b/testcases/kernel/uevents/uevent.h
new file mode 100644
index 0000000..908e150
--- /dev/null
+++ b/testcases/kernel/uevents/uevent.h
@@ -0,0 +1,176 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef UEVENT_H__
+#define UEVENT_H__
+
+#include "tst_netlink.h"
+
+/*
+ * There are two broadcast groups defined for the NETLINK_KOBJECT_UEVENT. The
+ * primary consument of the KERNEL group is udev which handles the hotplug
+ * events and then, once udev does it's magic the events are rebroadcasted to
+ * the UDEV group which is consumed by various daemons in the userspace.
+ */
+enum monitor_netlink_group {
+	MONITOR_GROUP_NONE,
+	MONITOR_GROUP_KERNEL,
+	MONITOR_GROUP_UDEV,
+};
+
+/*
+ * The messages received from the NETLINK_KOBJECT_UEVENT socket are stored as a
+ * sequence of a null-terminated strings. First in the buffer is a summary of a
+ * action i.e. "$ACTION@$DEVPATH" which is then followed by a bunch of
+ * key-value pairs.
+ *
+ * For example attaching a file to loopback device generates event:
+ *
+ * "change@/devices/virtual/block/loop0\0
+ *  ACTION=change\0
+ *  DEVPATH=/devices/virtual/block/loop0\0
+ *  SUBSYSTEM=block\0
+ *  MAJOR=7\0
+ *  MINOR=0\0
+ *  DEVNAME=loop0\0
+ *  DEVTYPE=disk\0
+ *  SEQNUM=2677\0"
+ */
+
+/*
+ * Prints uevent.
+ */
+static inline void print_uevent(const char *event, int len)
+{
+	int consumed = 0;
+
+	tst_res(TINFO, "Got uevent:");
+
+	while (consumed < len) {
+		tst_res(TINFO, "%s", event);
+		int l = strlen(event) + 1;
+		consumed += l;
+		event += l;
+	}
+}
+
+/*
+ * Uevents read from the socket are matched against this description.
+ *
+ * The msg is the overall action description e.g.
+ * "add@/class/input/input4/mouse1" which has to be matched exactly before we
+ * event attempt to check the key-value pairs stored in the values array. The
+ * event is considered to match if all key-value pairs in the values has been
+ * found in the received event.
+ */
+struct uevent_desc {
+	const char *msg;
+	int value_cnt;
+	const char **values;
+};
+
+static inline int uevent_match(const char *event, int len,
+                               const struct uevent_desc *uevent)
+{
+	int consumed = 0;
+	int val_matches = 0;
+
+	if (memcmp(event, uevent->msg, strlen(uevent->msg)))
+		return 0;
+
+	int l = strlen(event) + 1;
+
+	consumed += l;
+	event += l;
+
+	while (consumed < len) {
+		int i;
+		for (i = 0; i < uevent->value_cnt; i++) {
+			if (!strcmp(event, uevent->values[i])) {
+				val_matches++;
+				break;
+			}
+		}
+
+		l = strlen(event) + 1;
+		consumed += l;
+		event += l;
+	}
+
+	return val_matches == uevent->value_cnt;
+}
+
+static inline int open_uevent_netlink(void)
+{
+	int fd;
+	struct sockaddr_nl nl_addr = {
+		.nl_family = AF_NETLINK,
+		.nl_groups = MONITOR_GROUP_KERNEL,
+	};
+
+	fd = SAFE_SOCKET(AF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
+
+	SAFE_BIND(fd, (struct sockaddr *)&nl_addr, sizeof(nl_addr));
+
+	return fd;
+}
+
+/*
+ * Reads events from uevent netlink socket until all expected events passed in
+ * the uevent array are matched.
+ */
+static inline void wait_for_uevents(int fd, const struct uevent_desc *const uevents[])
+{
+	int i = 0;
+
+	while (1) {
+		int len;
+		char buf[4096];
+
+		len = recv(fd, &buf, sizeof(buf), 0);
+
+		if (len == 0)
+			continue;
+
+		print_uevent(buf, len);
+
+		if (uevent_match(buf, len, uevents[i])) {
+			tst_res(TPASS, "Got expected UEVENT");
+			if (!uevents[++i]) {
+				close(fd);
+				return;
+			}
+		}
+	}
+}
+
+/*
+ * Waits 5 seconds for a child to exit, kills the child after a timeout.
+ */
+static inline void wait_for_pid(int pid)
+{
+	int status, ret;
+	int retries = 5000;
+
+	do {
+		ret = waitpid(pid, &status, WNOHANG);
+		usleep(1000);
+	} while (ret == 0 && retries--);
+
+	if (ret == pid) {
+		if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
+			return;
+
+		tst_res(TFAIL, "Child exitted with %s", tst_strstatus(status));
+	}
+
+	SAFE_KILL(pid, SIGKILL);
+
+	SAFE_WAITPID(pid, NULL, 0);
+
+	tst_res(TFAIL, "Did not get all expected UEVENTS");
+}
+
+#endif /* UEVENT_H__ */
diff --git a/testcases/kernel/uevents/uevent01.c b/testcases/kernel/uevents/uevent01.c
new file mode 100644
index 0000000..5c65556
--- /dev/null
+++ b/testcases/kernel/uevents/uevent01.c
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Very simple uevent netlink socket test.
+ *
+ * We fork a child that listens for a kernel events while parents attaches and
+ * detaches a loop device which should produce two change events.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include "tst_test.h"
+
+#include "uevent.h"
+
+static void generate_device_events(const char *dev_path)
+{
+	tst_fill_file("loop.img", 0, 1024, 1024);
+
+	tst_res(TINFO, "Attaching device %s", dev_path);
+	tst_attach_device(dev_path, "loop.img");
+	tst_res(TINFO, "Detaching device %s", dev_path);
+	tst_detach_device(dev_path);
+}
+
+static void verify_uevent(void)
+{
+	int pid, fd, dev_num;
+	char dev_path[1024];
+	char ev_msg[1024];
+	char ev_dev_path[1024];
+	char ev_dev_minor[128];
+	char ev_dev_name[128];
+
+	struct uevent_desc desc = {
+		.msg = ev_msg,
+		.value_cnt = 7,
+		.values = (const char*[]) {
+			"ACTION=change",
+			ev_dev_path,
+			"SUBSYSTEM=block",
+			"MAJOR=7",
+			ev_dev_minor,
+			ev_dev_name,
+			"DEVTYPE=disk",
+		}
+	};
+
+	dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
+
+	if (dev_num < 0)
+		tst_brk(TBROK, "Failed to find free loop device");
+
+	snprintf(ev_msg, sizeof(ev_msg),
+	         "change@/devices/virtual/block/loop%i", dev_num);
+
+	snprintf(ev_dev_path, sizeof(ev_dev_path),
+	         "DEVPATH=/devices/virtual/block/loop%i", dev_num);
+
+	snprintf(ev_dev_minor, sizeof(ev_dev_minor), "MINOR=%i", dev_num);
+	snprintf(ev_dev_name, sizeof(ev_dev_name), "DEVNAME=loop%i", dev_num);
+
+	const struct uevent_desc *const uevents[] = {
+		&desc,
+		&desc,
+		NULL
+	};
+
+	pid = SAFE_FORK();
+	if (!pid) {
+		fd = open_uevent_netlink();
+		TST_CHECKPOINT_WAKE(0);
+		wait_for_uevents(fd, uevents);
+		exit(0);
+	}
+
+	TST_CHECKPOINT_WAIT(0);
+
+	generate_device_events(dev_path);
+
+	wait_for_pid(pid);
+}
+
+static struct tst_test test = {
+	.test_all = verify_uevent,
+	.forks_child = 1,
+	.needs_checkpoints = 1,
+	.needs_drivers = (const char *const []) {
+		"loop",
+		NULL
+	},
+	.needs_root = 1
+};
diff --git a/testcases/kernel/uevents/uevent02.c b/testcases/kernel/uevents/uevent02.c
new file mode 100644
index 0000000..ce0cf75
--- /dev/null
+++ b/testcases/kernel/uevents/uevent02.c
@@ -0,0 +1,143 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Very simple uevent netlink socket test.
+ *
+ * We fork a child that listens for a kernel events while parents creates and
+ * removes a tun network device which should produce two several add and remove
+ * events.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <linux/if.h>
+#include <linux/if_tun.h>
+
+#include "tst_test.h"
+
+#include "uevent.h"
+
+#define TUN_PATH "/dev/net/tun"
+
+static void generate_tun_uevents(void)
+{
+	int fd = SAFE_OPEN(TUN_PATH, O_RDWR);
+
+	struct ifreq ifr = {
+		.ifr_flags = IFF_TUN,
+		.ifr_name = "ltp-tun0",
+	};
+
+	SAFE_IOCTL(fd, TUNSETIFF, (void*)&ifr);
+
+	SAFE_IOCTL(fd, TUNSETPERSIST, 0);
+
+	SAFE_CLOSE(fd);
+}
+
+static void verify_uevent(void)
+{
+	int pid, fd;
+
+	struct uevent_desc add = {
+		.msg = "add@/devices/virtual/net/ltp-tun0",
+		.value_cnt = 4,
+		.values = (const char*[]) {
+			"ACTION=add",
+			"DEVPATH=/devices/virtual/net/ltp-tun0",
+			"SUBSYSTEM=net",
+			"INTERFACE=ltp-tun0",
+		}
+	};
+
+	struct uevent_desc add_rx = {
+		.msg = "add@/devices/virtual/net/ltp-tun0/queues/rx-0",
+		.value_cnt = 3,
+		.values = (const char*[]) {
+			"ACTION=add",
+			"DEVPATH=/devices/virtual/net/ltp-tun0/queues/rx-0",
+			"SUBSYSTEM=queues",
+		}
+	};
+
+	struct uevent_desc add_tx = {
+		.msg = "add@/devices/virtual/net/ltp-tun0/queues/tx-0",
+		.value_cnt = 3,
+		.values = (const char*[]) {
+			"ACTION=add",
+			"DEVPATH=/devices/virtual/net/ltp-tun0/queues/tx-0",
+			"SUBSYSTEM=queues",
+		}
+	};
+
+	struct uevent_desc rem_rx = {
+		.msg = "remove@/devices/virtual/net/ltp-tun0/queues/rx-0",
+		.value_cnt = 3,
+		.values = (const char*[]) {
+			"ACTION=remove",
+			"DEVPATH=/devices/virtual/net/ltp-tun0/queues/rx-0",
+			"SUBSYSTEM=queues",
+		}
+	};
+
+	struct uevent_desc rem_tx = {
+		.msg = "remove@/devices/virtual/net/ltp-tun0/queues/tx-0",
+		.value_cnt = 3,
+		.values = (const char*[]) {
+			"ACTION=remove",
+			"DEVPATH=/devices/virtual/net/ltp-tun0/queues/tx-0",
+			"SUBSYSTEM=queues",
+		}
+	};
+
+	struct uevent_desc rem = {
+		.msg = "remove@/devices/virtual/net/ltp-tun0",
+		.value_cnt = 4,
+		.values = (const char*[]) {
+			"ACTION=remove",
+			"DEVPATH=/devices/virtual/net/ltp-tun0",
+			"SUBSYSTEM=net",
+			"INTERFACE=ltp-tun0",
+		}
+	};
+
+	const struct uevent_desc *const uevents[] = {
+		&add,
+		&add_rx,
+		&add_tx,
+		&rem_rx,
+		&rem_tx,
+		&rem,
+		NULL
+	};
+
+	pid = SAFE_FORK();
+	if (!pid) {
+		fd = open_uevent_netlink();
+		TST_CHECKPOINT_WAKE(0);
+		wait_for_uevents(fd, uevents);
+		exit(0);
+	}
+
+	TST_CHECKPOINT_WAIT(0);
+
+	generate_tun_uevents();
+
+	wait_for_pid(pid);
+}
+
+static struct tst_test test = {
+	.test_all = verify_uevent,
+	.forks_child = 1,
+	.needs_checkpoints = 1,
+	.needs_drivers = (const char *const []) {
+		"tun",
+		NULL
+	},
+	.needs_root = 1
+};
diff --git a/testcases/kernel/uevents/uevent03.c b/testcases/kernel/uevents/uevent03.c
new file mode 100644
index 0000000..ed15fea
--- /dev/null
+++ b/testcases/kernel/uevents/uevent03.c
@@ -0,0 +1,243 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2019 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Very simple uevent netlink socket test.
+ *
+ * We fork a child that listens for a kernel events while parents creates and
+ * removes a virtual mouse which produces add and remove event for the device
+ * itself and for two event handlers called eventX and mouseY.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <sys/sysmacros.h>
+#include <linux/uinput.h>
+#include "tst_test.h"
+#include "tst_uinput.h"
+#include "uevent.h"
+
+static int mouse_fd;
+
+static void create_uinput_mouse(void)
+{
+	mouse_fd = open_uinput();
+	setup_mouse_events(mouse_fd);
+	create_input_device(mouse_fd);
+}
+
+static void destroy_uinput_mouse(void)
+{
+	destroy_input_device(mouse_fd);
+}
+
+static void get_minor_major(char *device, char *minor, char *major, size_t buf_sizes)
+{
+	char path[1024];
+	struct stat stbuf;
+
+	snprintf(path, sizeof(path), "/dev/input/%s", device);
+
+	SAFE_STAT(path, &stbuf);
+
+	snprintf(major, buf_sizes, "MAJOR=%i", major(stbuf.st_rdev));
+	snprintf(minor, buf_sizes, "MINOR=%i", minor(stbuf.st_rdev));
+}
+
+#define MINOR_MAJOR_SIZE 32
+
+static void verify_uevent(void)
+{
+	int pid, fd;
+	char add_msg[1024];
+	char rem_msg[1024];
+	char dev_path[1024];
+	char add_msg_event1[1024];
+	char rem_msg_event1[1024];
+	char dev_path_event1[1024];
+	char add_msg_event2[1024];
+	char rem_msg_event2[1024];
+	char dev_path_event2[1024];
+	char dev_name1[1024];
+	char dev_name2[1024];
+
+	char minor_event1[MINOR_MAJOR_SIZE];
+	char minor_event2[MINOR_MAJOR_SIZE];
+	char major_event1[MINOR_MAJOR_SIZE];
+	char major_event2[MINOR_MAJOR_SIZE];
+
+	char *handlers, *handler1, *handler2, *sysname;
+	struct uevent_desc add = {
+		.msg = add_msg,
+		.value_cnt = 7,
+		.values = (const char*[]) {
+			"ACTION=add",
+			dev_path,
+			"SUBSYSTEM=input",
+			"NAME=\"virtual-device-ltp\"",
+			"PROP=0",
+			"EV=7",
+			"REL=3",
+		}
+	};
+
+	struct uevent_desc add_event1 = {
+		.msg = add_msg_event1,
+		.value_cnt = 6,
+		.values = (const char*[]) {
+			"ACTION=add",
+			"SUBSYSTEM=input",
+			dev_name1,
+			dev_path_event1,
+			minor_event1,
+			major_event1,
+		}
+	};
+
+	struct uevent_desc add_event2 = {
+		.msg = add_msg_event2,
+		.value_cnt = 6,
+		.values = (const char*[]) {
+			"ACTION=add",
+			"SUBSYSTEM=input",
+			dev_name2,
+			dev_path_event2,
+			minor_event2,
+			major_event2,
+		}
+	};
+
+	struct uevent_desc rem_event1 = {
+		.msg = rem_msg_event1,
+		.value_cnt = 6,
+		.values = (const char*[]) {
+			"ACTION=remove",
+			"SUBSYSTEM=input",
+			dev_name1,
+			dev_path_event1,
+			minor_event1,
+			major_event1,
+		}
+	};
+
+	struct uevent_desc rem_event2 = {
+		.msg = rem_msg_event2,
+		.value_cnt = 6,
+		.values = (const char*[]) {
+			"ACTION=remove",
+			"SUBSYSTEM=input",
+			dev_name2,
+			dev_path_event2,
+			minor_event2,
+			major_event2,
+		}
+	};
+
+	struct uevent_desc rem = {
+		.msg = rem_msg,
+		.value_cnt = 7,
+		.values = (const char*[]) {
+			"ACTION=remove",
+			dev_path,
+			"SUBSYSTEM=input",
+			"NAME=\"virtual-device-ltp\"",
+			"PROP=0",
+			"EV=7",
+			"REL=3",
+		}
+	};
+
+	const struct uevent_desc *const uevents[] = {
+		&add,
+		&add_event1,
+		&add_event2,
+		&rem_event1,
+		&rem_event2,
+		&rem,
+		NULL
+	};
+
+	fd = open_uevent_netlink();
+
+	create_uinput_mouse();
+
+	sysname = get_input_field_value('S');
+	handlers = get_input_field_value('H');
+
+	if (!sysname)
+		tst_brk(TBROK, "Expected /devices/virtual/input/inputN sysname!");
+
+	tst_res(TINFO, "Sysname: %s", sysname);
+	tst_res(TINFO, "Handlers: %s", handlers);
+
+	handler1 = strtok(handlers, " ");
+	if (!handler1)
+		tst_brk(TBROK, "Expected mouseX and eventY handlers!");
+
+	get_minor_major(handler1, minor_event1, major_event1, MINOR_MAJOR_SIZE);
+
+	handler2 = strtok(NULL, " ");
+	if (!handler2)
+		tst_brk(TBROK, "Expected mouseX and eventY handlers!");
+
+	get_minor_major(handler2, minor_event2, major_event2, MINOR_MAJOR_SIZE);
+
+	destroy_uinput_mouse();
+
+	snprintf(add_msg, sizeof(add_msg), "add@%s", sysname);
+
+	snprintf(rem_msg, sizeof(rem_msg), "remove@%s", sysname);
+
+	snprintf(dev_path, sizeof(dev_path), "DEVPATH=%s", sysname);
+
+	snprintf(add_msg_event1, sizeof(add_msg_event1),
+		"add@%s/%s", sysname, handler1);
+
+	snprintf(rem_msg_event1, sizeof(rem_msg_event1),
+		"remove@%s/%s", sysname, handler1);
+
+	snprintf(dev_path_event1, sizeof(dev_path_event1),
+		"DEVPATH=%s/%s", sysname, handler1);
+
+	snprintf(dev_name1, sizeof(dev_name1),
+		"DEVNAME=input/%s", handler1);
+
+
+	snprintf(add_msg_event2, sizeof(add_msg_event2),
+		"add@%s/%s", sysname, handler2);
+
+	snprintf(rem_msg_event2, sizeof(rem_msg_event2),
+		"remove@%s/%s", sysname, handler2);
+
+	snprintf(dev_path_event2, sizeof(dev_path_event2),
+		"DEVPATH=%s/%s", sysname, handler2);
+
+	snprintf(dev_name2, sizeof(dev_name2),
+		"DEVNAME=input/%s", handler2);
+
+	free(sysname);
+	free(handlers);
+
+	pid = SAFE_FORK();
+	if (!pid) {
+		wait_for_uevents(fd, uevents);
+		exit(0);
+	}
+
+	SAFE_CLOSE(fd);
+	wait_for_pid(pid);
+}
+
+static struct tst_test test = {
+	.test_all = verify_uevent,
+	.forks_child = 1,
+	.needs_checkpoints = 1,
+	.needs_drivers = (const char *const[]) {
+		"uinput",
+		NULL
+	},
+	.needs_root = 1,
+};
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 670248e..a15fb05 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -23,6 +23,7 @@
 
 export LTP_RET_VAL=0
 export TST_COUNT=1
+export TST_PASS_COUNT=0
 export TST_LIB_LOADED=1
 export TST_TMPDIR_RHOST=0
 
@@ -58,9 +59,12 @@
 	echo " $@"
 
 	case "$ret" in
-	TPASS|TFAIL)
-	TST_COUNT=$((TST_COUNT+1));;
+	TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
 	esac
+
+	if [ "$ret" = TPASS ]; then
+		TST_PASS_COUNT=$((TST_PASS_COUNT+1))
+	fi
 }
 
 tst_brkm()
@@ -112,6 +116,10 @@
 		rm -f "$LTP_IPC_PATH"
 	fi
 
+	# Mask out TCONF if no TFAIL/TBROK/TWARN but has TPASS
+	if [ $((LTP_RET_VAL & 7)) -eq 0 -a $TST_PASS_COUNT -gt 0 ]; then
+		LTP_RET_VAL=$((LTP_RET_VAL & ~32))
+	fi
 	# Mask out TINFO
 	exit $((LTP_RET_VAL & ~16))
 }
@@ -143,7 +151,7 @@
 #
 # Checks if commands passed as arguments exists
 #
-tst_test_cmds()
+tst_require_cmds()
 {
 	local cmd
 	for cmd in $*; do
diff --git a/testcases/lib/tst_ansi_color.sh b/testcases/lib/tst_ansi_color.sh
index b7baa9b..703df1e 100644
--- a/testcases/lib/tst_ansi_color.sh
+++ b/testcases/lib/tst_ansi_color.sh
@@ -1,22 +1,7 @@
 #!/bin/sh
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) Linux Test Project, 2017
-#
-# 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.
-#
-# Written by  Petr Vorel <pvorel@suse.cz>
+# Written by Petr Vorel <pvorel@suse.cz>
 
 tst_flag2color()
 {
diff --git a/testcases/lib/tst_checkpoint.c b/testcases/lib/tst_checkpoint.c
index 57c7bc1..c70c4e8 100644
--- a/testcases/lib/tst_checkpoint.c
+++ b/testcases/lib/tst_checkpoint.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Linux Test Project
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <errno.h>
diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
index 1cfdc96..dc47d6f 100644
--- a/testcases/lib/tst_device.c
+++ b/testcases/lib/tst_device.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <errno.h>
diff --git a/testcases/lib/tst_kvcmp.c b/testcases/lib/tst_kvcmp.c
index 06632a2..0f5793e 100644
--- a/testcases/lib/tst_kvcmp.c
+++ b/testcases/lib/tst_kvcmp.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #define TST_NO_DEFAULT_MAIN
diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index f47a404..59ceb33 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) 2016-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2016-2019 Petr Vorel <pvorel@suse.cz>
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 [ -n "$TST_LIB_NET_LOADED" ] && return 0
@@ -99,17 +99,21 @@
 }
 tst_require_root_()
 {
-	[ -z "$TST_USE_LEGACY_API" ] && TST_NEEDS_ROOT=1 || tst_require_root
+	if [ -z "$TST_USE_LEGACY_API" ]; then
+		_tst_require_root
+	else
+		tst_require_root
+	fi
 }
 
 init_ltp_netspace()
 {
-	tst_test_cmds ip
-	tst_require_root_
-
-	local pid=
+	local pid
 
 	if [ ! -f /var/run/netns/ltp_ns -a -z "$LTP_NETNS" ]; then
+		tst_require_cmds ip
+		tst_require_root_
+
 		ROD ip li add name ltp_ns_veth1 type veth peer name ltp_ns_veth2
 		pid="$(ROD ns_create net,mnt)"
 		mkdir -p /var/run/netns
@@ -137,9 +141,8 @@
 # Run command on remote host.
 # Options:
 # -b run in background
-# -B run in background and save output to $TST_TMPDIR/bg.cmd
 # -s safe option, if something goes wrong, will exit with TBROK
-# -c specify command to run (this must be binary, not shell buildin/function)
+# -c specify command to run (this must be binary, not shell builtin/function)
 # RETURN: 0 on success, 1 on failure
 tst_rhost_run()
 {
@@ -149,15 +152,13 @@
 	local user="root"
 	local cmd=
 	local safe=0
-	local bg=
 
 	OPTIND=0
 
-	while getopts :bBsc:u: opt; do
+	while getopts :bsc:u: opt; do
 		case "$opt" in
-		b|B) [ "$TST_USE_NETNS" ] && pre_cmd= || pre_cmd="nohup"
-		   [ "$opt" = b ] && bg="/dev/null" || bg="$TST_TMPDIR/bg.cmd"
-		   post_cmd=" > $bg 2>&1 &"
+		b) [ "$TST_USE_NETNS" ] && pre_cmd= || pre_cmd="nohup"
+		   post_cmd=" > /dev/null 2>&1 &"
 		   out="1> /dev/null"
 		;;
 		s) safe=1 ;;
@@ -206,7 +207,7 @@
 # -l LPARAM: parameter passed to CMD in lhost
 # -r RPARAM: parameter passed to CMD in rhost
 # -q: quiet mode (suppress failure warnings)
-# CMD: command to run (this must be binary, not shell buildin/function due
+# CMD: command to run (this must be binary, not shell builtin/function due
 # tst_rhost_run() limitation)
 # RETURN: 0 on success, 1 on missing CMD or exit code on lhost or rhost
 tst_net_run()
@@ -288,6 +289,14 @@
 	fi
 }
 
+# Get count of test interfaces for local/remote host.
+tst_get_ifaces_cnt()
+{
+	tst_require_cmds awk
+	local type="${1:-lhost}"
+	echo "$(tst_get_ifaces $type)" | awk '{print NF}'
+}
+
 # Get HW addresses from defined test interface names.
 # tst_get_hwaddrs [TYPE]
 # TYPE: { lhost | rhost }; Default value is 'lhost'.
@@ -317,7 +326,7 @@
 # LINK: link number starting from 0. Default value is '0'.
 tst_hwaddr()
 {
-	tst_test_cmds awk
+	tst_require_cmds awk
 
 	local type="${1:-lhost}"
 	local link_num="${2:-0}"
@@ -333,7 +342,7 @@
 # LINK: link number starting from 0. Default value is '0'.
 tst_iface()
 {
-	tst_test_cmds awk
+	tst_require_cmds awk
 
 	local type="${1:-lhost}"
 	local link_num="${2:-0}"
@@ -354,68 +363,123 @@
 	fi
 }
 
-# Get IP address of unused network, specified either by type and counter
+# Get IP address of unused network, specified either counter and type
 # or by net and host.
-# tst_ipaddr_un [-cCOUNTER] [TYPE]
-# tst_ipaddr_un NET_ID [HOST_ID]
-# TYPE: { lhost | rhost }; Default value is 'lhost'.
-# COUNTER: Integer value for counting HOST_ID and NET_ID. Default is 1.
-# NET_ID: Integer or hex value of net. For IPv4 is 3rd octet, for IPv6
-# is 3rd hextet.
-# HOST_ID: Integer or hex value of host. For IPv4 is 4th octet, for
-# IPv6 is the last hextet. Default value is 0.
+# counter mode:
+# tst_ipaddr_un [-h MIN,MAX] [-n MIN,MAX] [-p] [-c COUNTER] [TYPE]
+# net & host mode:
+# tst_ipaddr_un [-h MIN,MAX] [-n MIN,MAX] [-p] NET_ID [HOST_ID]
+#
+# TYPE: { lhost | rhost } (default: 'lhost')
+# NET_ID: integer or hex value of net (IPv4: 3rd octet <0,255>, IPv6: 3rd
+# hextet <0,65535>)
+# HOST_ID: integer or hex value of host (IPv4: 4th octet <0,255>, IPv6: the
+# last hextet <0, 65535>, default: 0)
+#
+# OPTIONS
+# -c COUNTER: integer value for counting HOST_ID and NET_ID (default: 1)
+#
+# -h: specify *host* address range (HOST_ID)
+# -h MIN,MAX or -h MIN or -h ,MAX
+#
+# -n: specify *network* address range (NET_ID)
+# -n MIN,MAX or -n MIN or -n ,MAX
+#
+# -p: print also prefix
 tst_ipaddr_un()
 {
-	local counter host_id net_id max_host_id max_net_id tmp type
-	local OPTIND
+	local default_max=255
+	[ "$TST_IPV6" ] && default_max=65535
+	local max_net_id=$default_max
+	local min_net_id=0
 
-	while getopts "c:" opt; do
+	local counter host_id host_range is_counter max_host_id min_host_id net_id prefix tmp type
+
+	local OPTIND
+	while getopts "c:h:n:p" opt; do
 		case $opt in
 			c) counter="$OPTARG";;
+			h)
+				if echo $OPTARG | grep -q ','; then # 'min,max' or 'min,' or ',max'
+					min_host_id="$(echo $OPTARG | cut -d, -f1)"
+					max_host_id="$(echo $OPTARG | cut -d, -f2)"
+				else # min
+					min_host_id="$OPTARG"
+				fi
+				;;
+			n)
+				if echo $OPTARG | grep -q ','; then # 'min,max' or 'min,' or ',max'
+					min_net_id="$(echo $OPTARG | cut -d, -f1)"
+					max_net_id="$(echo $OPTARG | cut -d, -f2)"
+				else # min
+					min_net_id="$OPTARG"
+				fi
+				;;
+			m)
+				! tst_is_int "$OPTARG" || [ "$OPTARG" -lt 0 ]|| [ "$OPTARG" -gt $max_net_id ] && \
+					tst_brk TBROK "tst_ipaddr_un: -m must be integer <0,$max_net_id> ($OPTARG)"
+				[ "$OPTARG" -gt $max_net_id ] && \
+					tst_brk_ TBROK "tst_ipaddr_un: -m cannot be higher than $max_net_id ($OPTARG)"
+				max_host_id="$OPTARG"
+				;;
+			p) [ "$TST_IPV6" ] && prefix="/64" || prefix="/24";;
 		esac
 	done
 	shift $(($OPTIND - 1))
+	[ $# -eq 0 -o "$1" = "lhost" -o "$1" = "rhost" ] && is_counter=1
 
-	[ "$TST_IPV6" ] && max_net_id=65535 || max_net_id=255
+	if [ -z "$min_host_id" ]; then
+		[ "$is_counter" ] && min_host_id=1 || min_host_id=0
+	fi
+	if [ -z "$max_host_id" ]; then
+		[ "$is_counter" ] && max_host_id=$((default_max - 1)) || max_host_id=$default_max
+	fi
 
-	if [ $# -eq 0 -o "$1" = "lhost" -o "$1" = "rhost" ]; then
+	! tst_is_int "$min_host_id" || ! tst_is_int "$max_host_id" || \
+		[ $min_host_id -lt 0 -o $min_host_id -gt $default_max ] || \
+		[ $max_host_id -lt 0 -o $max_host_id -gt $default_max ] && \
+		tst_brk TBROK "tst_ipaddr_un: HOST_ID must be int in range <0,$default_max> ($min_host_id,$max_host_id)"
+	! tst_is_int "$min_net_id" || ! tst_is_int "$max_net_id" || \
+		[ $min_net_id -lt 0 -o $min_net_id -gt $default_max ] || \
+		[ $max_net_id -lt 0 -o $max_net_id -gt $default_max ] && \
+		tst_brk TBROK "tst_ipaddr_un: NET_ID must be int in range <0,$default_max> ($min_net_id,$max_net_id)"
+
+	[ $min_host_id -gt $max_host_id ] && \
+		tst_brk TBROK "tst_ipaddr_un: max HOST_ID ($max_host_id) must be >= min HOST_ID ($min_host_id)"
+	[ $min_net_id -gt $max_net_id ] && \
+		tst_brk TBROK "tst_ipaddr_un: max NET_ID ($max_net_id) must be >= min NET_ID ($min_net_id)"
+
+	# counter
+	host_range=$((max_host_id - min_host_id + 1))
+	if [ "$is_counter" ]; then
 		[ -z "$counter" ] && counter=1
 		[ $counter -lt 1 ] && counter=1
 		type="${1:-lhost}"
-		max_host_id=$((max_net_id - 1))
 		tmp=$((counter * 2))
 		[ "$type" = "rhost" ] && tmp=$((tmp - 1))
-
-		host_id=$((tmp % max_host_id))
-		net_id=$((tmp / max_host_id))
-
-		if [ $host_id -eq 0 ]; then
-			host_id=$max_host_id
-			net_id=$((net_id - 1))
-		fi
-	else
+		net_id=$(((tmp - 1) / host_range))
+		host_id=$((tmp - net_id * host_range + min_host_id - 1))
+	else # net_id & host_id
 		net_id="$1"
 		host_id="${2:-0}"
 		if [ "$TST_IPV6" ]; then
 			net_id=$(printf %d $net_id)
 			host_id=$(printf %d $host_id)
 		fi
-		[ $net_id -lt 0 ] && net_id=0
-		[ $host_id -lt 0 ] && host_id=1
+		host_id=$((host_id % host_range + min_host_id))
 	fi
 
-	net_id=$((net_id % max_net_id))
-	host_id=$((host_id % max_net_id))
+	net_id=$((net_id % (max_net_id - min_net_id + 1) + min_net_id))
 
 	if [ -z "$TST_IPV6" ]; then
-		echo "${IPV4_NET16_UNUSED}.${net_id}.${host_id}"
+		echo "${IPV4_NET16_UNUSED}.${net_id}.${host_id}${prefix}"
 		return
 	fi
 
 	[ $host_id -gt 0 ] && host_id="$(printf %x $host_id)" || host_id=
 	[ $net_id -gt 0 ] && net_id="$(printf %x $net_id)" || net_id=
 	[ "$net_id" ] && net_id=":$net_id"
-	echo "${IPV6_NET32_UNUSED}${net_id}::${host_id}"
+	echo "${IPV6_NET32_UNUSED}${net_id}::${host_id}${prefix}"
 }
 
 # tst_init_iface [TYPE] [LINK]
@@ -429,8 +493,10 @@
 	tst_res_ TINFO "initialize '$type' '$iface' interface"
 
 	if [ "$type" = "lhost" ]; then
-		ip xfrm policy flush || return $?
-		ip xfrm state flush || return $?
+		if ip xfrm state 1>/dev/null 2>&1; then
+			ip xfrm policy flush || return $?
+			ip xfrm state flush || return $?
+		fi
 		ip link set $iface down || return $?
 		ip route flush dev $iface || return $?
 		ip addr flush dev $iface || return $?
@@ -438,22 +504,45 @@
 		return $?
 	fi
 
-	tst_rhost_run -c "ip xfrm policy flush" || return $?
-	tst_rhost_run -c "ip xfrm state flush" || return $?
+	if tst_rhost_run -c "ip xfrm state 1>/dev/null 2>&1"; then
+		tst_rhost_run -c "ip xfrm policy flush" || return $?
+		tst_rhost_run -c "ip xfrm state flush" || return $?
+	fi
 	tst_rhost_run -c "ip link set $iface down" || return $?
 	tst_rhost_run -c "ip route flush dev $iface" || return $?
 	tst_rhost_run -c "ip addr flush dev $iface" || return $?
 	tst_rhost_run -c "ip link set $iface up"
 }
 
-# tst_add_ipaddr [TYPE] [LINK]
-# TYPE: { lhost | rhost }; Default value is 'lhost'.
-# LINK: link number starting from 0. Default value is '0'.
+# tst_add_ipaddr [TYPE] [LINK] [-a IP] [-d] [-q] [-s]
+# Options:
+# TYPE: { lhost | rhost }, default value is 'lhost'
+# LINK: link number starting from 0, default value is '0'
+# -a IP: IP address to be added, default value is
+# $(tst_ipaddr)/$IPV{4,6}_{L,R}PREFIX
+# -d: delete address instead of adding
+# -q: quiet mode (don't print info)
+# -s: safe option, if something goes wrong, will exit with TBROK
 tst_add_ipaddr()
 {
+	local action="add"
+	local addr dad lsafe mask quiet rsafe
+
+	local OPTIND
+	while getopts a:dqs opt; do
+		case "$opt" in
+		a) addr="$OPTARG" ;;
+		d) action="del" ;;
+		q) quiet=1 ;;
+		s) lsafe="ROD"; rsafe="-s" ;;
+		*) tst_brk TBROK "tst_add_ipaddr: unknown option: $OPTARG" ;;
+		esac
+	done
+	shift $((OPTIND - 1))
+
 	local type="${1:-lhost}"
 	local link_num="${2:-0}"
-	local mask dad
+	local iface=$(tst_iface $type $link_num)
 
 	if [ "$TST_IPV6" ]; then
 		dad="nodad"
@@ -461,17 +550,24 @@
 	else
 		[ "$type" = "lhost" ] && mask=$IPV4_LPREFIX || mask=$IPV4_RPREFIX
 	fi
-
-	local iface=$(tst_iface $type $link_num)
+	[ -n "$addr" ] || addr="$(tst_ipaddr $type)"
+	echo $addr | grep -q / || addr="$addr/$mask"
 
 	if [ $type = "lhost" ]; then
-		tst_res_ TINFO "set local addr $(tst_ipaddr)/$mask"
-		ip addr add $(tst_ipaddr)/$mask dev $iface $dad
+		[ "$quiet" ] || tst_res_ TINFO "$action local addr $addr"
+		$lsafe ip addr $action $addr dev $iface $dad
 		return $?
 	fi
 
-	tst_res_ TINFO "set remote addr $(tst_ipaddr rhost)/$mask"
-	tst_rhost_run -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface $dad"
+	[ "$quiet" ] || tst_res_ TINFO "$action remote addr $addr"
+	tst_rhost_run $rsafe -c "ip addr $action $addr dev $iface $dad"
+}
+
+# tst_del_ipaddr [ tst_add_ipaddr options ]
+# Delete IP address
+tst_del_ipaddr()
+{
+	tst_add_ipaddr -d $@
 }
 
 # tst_restore_ipaddr [TYPE] [LINK]
@@ -480,7 +576,7 @@
 # LINK: link number starting from 0. Default value is '0'.
 tst_restore_ipaddr()
 {
-	tst_test_cmds ip
+	tst_require_cmds ip
 	tst_require_root_
 
 	local type="${1:-lhost}"
@@ -545,6 +641,7 @@
 	# number of server replies after which TCP connection is closed
 	local s_replies="${TST_NETLOAD_MAX_SRV_REPLIES:-500000}"
 	local s_opts=
+	local bind_to_device=1
 
 	if [ ! "$TST_NEEDS_TMPDIR" = 1 ]; then
 		tst_brk_ TBROK "Using tst_netload requires setting TST_NEEDS_TMPDIR=1"
@@ -572,7 +669,8 @@
 		f) cs_opts="${cs_opts}-f " ;;
 		F) cs_opts="${cs_opts}-F " ;;
 		e) expect_res="$OPTARG" ;;
-		D) cs_opts="${cs_opts}-D $OPTARG " ;;
+		D) [ "$TST_NETLOAD_BINDTODEVICE" = 1 ] && cs_opts="${cs_opts}-D $OPTARG "
+		   bind_to_device=0 ;;
 		*) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;;
 		esac
 	done
@@ -580,6 +678,11 @@
 
 	[ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt "
 
+	if [ "$bind_to_device" = 1 -a "$TST_NETLOAD_BINDTODEVICE" = 1 ]; then
+		c_opts="${c_opts}-D $(tst_iface) "
+		s_opts="${s_opts}-D $(tst_iface rhost) "
+	fi
+
 	local expect_ret=0
 	[ "$expect_res" != "pass" ] && expect_ret=3
 
@@ -650,7 +753,7 @@
 	local ret=0
 
 	echo "$dst_addr" | grep -q ':' && cmd="ping6"
-	tst_test_cmds $cmd
+	tst_require_cmds $cmd
 
 	# ping cmd use 56 as default message size
 	for size in ${msg_sizes:-"56"}; do
@@ -764,7 +867,7 @@
 # tst_net_ip_prefix -h
 # tst_net_iface_prefix -h
 # tst_net_vars -h
-if [ -z "$TST_PARSE_VARIABLES" ]; then
+if [ -z "$_tst_net_parse_variables" ]; then
 	eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
 	eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")
 	eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
@@ -773,7 +876,7 @@
 
 [ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace
 
-if [ -z "$TST_PARSE_VARIABLES" ]; then
+if [ -z "$_tst_net_parse_variables" ]; then
 	eval $(tst_net_iface_prefix $IPV4_LHOST || echo "exit $?")
 	eval $(tst_rhost_run -c 'tst_net_iface_prefix -r '$IPV4_RHOST \
 		|| echo "exit $?")
@@ -790,11 +893,12 @@
 	tst_res_ TINFO "$LHOST_IFACES -- $RHOST_IFACES"
 	tst_res_ TINFO "$IPV4_LHOST/$IPV4_LPREFIX -- $IPV4_RHOST/$IPV4_RPREFIX"
 	tst_res_ TINFO "$IPV6_LHOST/$IPV6_LPREFIX -- $IPV6_RHOST/$IPV6_RPREFIX"
-	export TST_PARSE_VARIABLES="yes"
+	export _tst_net_parse_variables="yes"
 fi
 
 export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}"
 export TST_NETLOAD_CLN_NUMBER="${TST_NETLOAD_CLN_NUMBER:-2}"
+export TST_NETLOAD_BINDTODEVICE="${TST_NETLOAD_BINDTODEVICE-1}"
 export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
 export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
 export FTP_UPLOAD_DIR="${FTP_UPLOAD_DIR:-/var/ftp/pub}"
@@ -843,8 +947,8 @@
 	{
 		ping -6 $@
 	}
-	if [ -z "$ping6_warn_printed" ]; then
+	if [ -z "$_tst_net_ping6_warn_printed" ]; then
 		tst_res_ TINFO "ping6 binary/symlink is missing, using workaround. Please, report missing ping6 to your distribution."
-		export ping6_warn_printed=1
+		export _tst_net_ping6_warn_printed=1
 	fi
 fi
diff --git a/testcases/lib/tst_net_iface_prefix.c b/testcases/lib/tst_net_iface_prefix.c
index a9e3882..a40a8ed 100644
--- a/testcases/lib/tst_net_iface_prefix.c
+++ b/testcases/lib/tst_net_iface_prefix.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <sys/socket.h>
diff --git a/testcases/lib/tst_net_ip_prefix.c b/testcases/lib/tst_net_ip_prefix.c
index 92f80e0..2ac06e7 100644
--- a/testcases/lib/tst_net_ip_prefix.c
+++ b/testcases/lib/tst_net_ip_prefix.c
@@ -1,18 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
diff --git a/testcases/lib/tst_net_vars.c b/testcases/lib/tst_net_vars.c
index fc63f13..7c5507e 100644
--- a/testcases/lib/tst_net_vars.c
+++ b/testcases/lib/tst_net_vars.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
  * Copyright (c) 1997-2015 Red Hat, Inc. All rights reserved.
  * Copyright (c) 2011-2013 Rich Felker, et al.
- *
- * 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, see <http://www.gnu.org/licenses/>.
  */
 
 #include <arpa/inet.h>
@@ -153,7 +141,7 @@
  */
 static char *get_ipv4_netmask(unsigned int prefix)
 {
-	char buf[INET_ADDRSTRLEN + 1];
+	char buf[INET_ADDRSTRLEN];
 	struct in_addr mask = prefix2mask(prefix);
 
 	if (prefix > MAX_IPV4_PREFIX)
@@ -200,7 +188,7 @@
 {
 	struct in_addr mask = prefix2mask(prefix);
 	struct in_addr broadcast;
-	char buf[INET_ADDRSTRLEN + 1];
+	char buf[INET_ADDRSTRLEN];
 
 	memset(&broadcast, 0, sizeof(broadcast));
 	broadcast.s_addr = (ip.s_addr & mask.s_addr) | ~mask.s_addr;
@@ -220,7 +208,7 @@
 	unsigned int prefix)
 {
 	struct in_addr mask, network;
-	char buf[128], net_unused[128];
+	char buf[132], net_unused[128];
 
 	mask = prefix2mask(prefix);
 	network = calc_network(ip, &mask);
@@ -274,7 +262,7 @@
 {
 	int i, j;
 	struct in6_addr mask, network;
-	char buf[128], net_unused[128];
+	char buf[130], net_unused[128];
 
 	memset(&mask, 0x0, sizeof(mask));
 
@@ -471,28 +459,24 @@
 
 static char *get_ipv4_network(int ip, unsigned int prefix)
 {
-	char buf[INET_ADDRSTRLEN + 1];
+	char buf[INET_ADDRSTRLEN];
 	char *p_buf = buf;
 	unsigned char byte;
 	unsigned int i;
 
+	ip = htonl(ip);
+
 	if (prefix > MAX_IPV4_PREFIX)
 		return NULL;
 
 	if (prefix == MAX_IPV4_PREFIX)
 		return strdup("\0");
 
-	prefix &= 0x18;
+	prefix &= MAX_IPV4_PREFIX - 8;
 
-	for (i = 0; i < MAX_IPV4_PREFIX && (prefix == 0 || i < prefix);
-	     i += 8) {
-		if (i == 0) {
-			byte = ip & 0xff;
-			sprintf(p_buf, "%d", byte);
-		} else {
-			byte = (ip >> i) & 0xff;
-			sprintf(p_buf, ".%d", byte);
-		}
+	for (i = prefix; i > 0; i -= 8) {
+		byte = (ip >> i) & 0xff;
+		sprintf(p_buf, i < prefix ? ".%d" : "%d", byte);
 		p_buf += strlen(p_buf);
 	}
 
diff --git a/testcases/lib/tst_random.c b/testcases/lib/tst_random.c
index d3ba382..e389008 100644
--- a/testcases/lib/tst_random.c
+++ b/testcases/lib/tst_random.c
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Red Hat Inc.
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
  * Author: Chunyu Hu <chuhu@redhat.com>
- *
  */
 
 #include <stdio.h>
diff --git a/testcases/lib/tst_rod.c b/testcases/lib/tst_rod.c
index db6d176..2f0ff90 100644
--- a/testcases/lib/tst_rod.c
+++ b/testcases/lib/tst_rod.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <stdio.h>
diff --git a/testcases/lib/tst_security.sh b/testcases/lib/tst_security.sh
index 25e085d..7d033bb 100644
--- a/testcases/lib/tst_security.sh
+++ b/testcases/lib/tst_security.sh
@@ -17,7 +17,8 @@
 
 	if tst_apparmor_enabled; then
 		tst_res TINFO "AppArmor enabled, this may affect test results"
-		tst_res TINFO "You can try to disable it with TST_DISABLE_APPARMOR=1 (requires super/root)"
+		[ "$TST_DISABLE_APPARMOR" = 1 ] || \
+			tst_res TINFO "it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root)"
 		profiles=
 		for cmd in $TST_NEEDS_CMDS; do
 			tst_apparmor_used_profile $cmd && profiles="$cmd $profiles"
@@ -28,7 +29,9 @@
 
 	if tst_selinux_enabled; then
 		tst_res TINFO "SELinux enabled in enforcing mode, this may affect test results"
-		tst_res TINFO "You can try to disable it with TST_DISABLE_SELINUX=1 (requires super/root)"
+
+		[ "$TST_DISABLE_SELINUX" = 1 ] || \
+			tst_res TINFO "it can be disabled with TST_DISABLE_SELINUX=1 (requires super/root)"
 		profiles=
 		for cmd in $TST_NEEDS_CMDS; do
 			tst_selinux_used_profile $cmd && profiles="$cmd $profiles"
@@ -91,11 +94,13 @@
 # Return > 0: failed to disable AppArmor
 tst_disable_apparmor()
 {
+	tst_res TINFO "trying to disable AppArmor (requires super/root)"
 	_tst_require_root
+
 	local f="aa-teardown"
 	local action
 
-	tst_cmd_available $f && { $f; return; }
+	tst_cmd_available $f && { $f >/dev/null; return; }
 	f="/etc/init.d/apparmor"
 	if [ -f "$f" ]; then
 		for action in teardown kill stop; do
@@ -109,7 +114,9 @@
 # Return > 0: failed to disable SELinux
 tst_disable_selinux()
 {
+	tst_res TINFO "trying to disable SELinux (requires super/root)"
 	_tst_require_root
+
 	local f="$(_tst_get_enforce)"
 
 	[ -f "$f" ] && cat 0 > $f
diff --git a/testcases/lib/tst_sleep.c b/testcases/lib/tst_sleep.c
index b1d95cb..58fe77a 100644
--- a/testcases/lib/tst_sleep.c
+++ b/testcases/lib/tst_sleep.c
@@ -1,19 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
- *
- * 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 would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <stdio.h>
diff --git a/testcases/lib/tst_supported_fs.c b/testcases/lib/tst_supported_fs.c
index ebebcbb..022a615 100644
--- a/testcases/lib/tst_supported_fs.c
+++ b/testcases/lib/tst_supported_fs.c
@@ -37,9 +37,9 @@
 	}
 
 	if (argv[1])
-		return !tst_fs_is_supported(argv[1]);
+		return !tst_fs_is_supported(argv[1], 0);
 
-	filesystems = tst_get_supported_fs_types();
+	filesystems = tst_get_supported_fs_types(0);
 	for (i = 0; filesystems[i]; i++)
 		printf("%s\n", filesystems[i]);
 
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 5127323..b98f86e 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -1,25 +1,9 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Linux Test Project, 2014-2019
+# Author: Cyril Hrubis <chrubis@suse.cz>
 #
-# Copyright (c) Linux Test Project, 2014-2018
-#
-# 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.
-#
-# Written by Cyril Hrubis <chrubis@suse.cz>
-#
-# This is a LTP test library for shell.
-#
+# LTP test library for shell.
 
 [ -n "$TST_LIB_LOADED" ] && return 0
 
@@ -44,8 +28,7 @@
 	local ret=0
 	TST_DO_EXIT=1
 
-	if [ -n "$TST_SETUP_STARTED" -a -n "$TST_CLEANUP" -a \
-	     -z "$TST_NO_CLEANUP" ]; then
+	if [ -n "$TST_CLEANUP" -a -z "$TST_NO_CLEANUP" ]; then
 		$TST_CLEANUP
 	fi
 
@@ -78,7 +61,7 @@
 		ret=$((ret|4))
 	fi
 
-	if [ $TST_CONF -gt 0 ]; then
+	if [ $TST_CONF -gt 0 -a $TST_PASS -eq 0 ]; then
 		ret=$((ret|32))
 	fi
 
@@ -155,34 +138,66 @@
 	fi
 }
 
-EXPECT_PASS()
+_tst_expect_pass()
 {
+	local fnc="$1"
+	shift
+
 	tst_rod "$@"
 	if [ $? -eq 0 ]; then
 		tst_res TPASS "$@ passed as expected"
+		return 0
 	else
-		tst_res TFAIL "$@ failed unexpectedly"
+		$fnc TFAIL "$@ failed unexpectedly"
+		return 1
 	fi
 }
 
-EXPECT_FAIL()
+_tst_expect_fail()
 {
+	local fnc="$1"
+	shift
+
 	# redirect stderr since we expect the command to fail
 	tst_rod "$@" 2> /dev/null
 	if [ $? -ne 0 ]; then
 		tst_res TPASS "$@ failed as expected"
+		return 0
 	else
-		tst_res TFAIL "$@ passed unexpectedly"
+		$fnc TFAIL "$@ passed unexpectedly"
+		return 1
 	fi
 }
 
+EXPECT_PASS()
+{
+	_tst_expect_pass tst_res "$@"
+}
+
+EXPECT_PASS_BRK()
+{
+	_tst_expect_pass tst_brk "$@"
+}
+
+EXPECT_FAIL()
+{
+	_tst_expect_fail tst_res "$@"
+}
+
+EXPECT_FAIL_BRK()
+{
+	_tst_expect_fail tst_brk "$@"
+}
+
 TST_RETRY_FN_EXP_BACKOFF()
 {
 	local tst_fun="$1"
 	local tst_exp=$2
-	local tst_sec=$(expr $3 \* 1000000)
+	local tst_sec=$(($3 * 1000000))
 	local tst_delay=1
 
+	_tst_multiply_timeout tst_sec
+
 	if [ $# -ne 3 ]; then
 		tst_brk TBROK "TST_RETRY_FN_EXP_BACKOFF expects 3 parameters"
 	fi
@@ -259,9 +274,11 @@
 
 tst_umount()
 {
-	local device="$1"
+	local device="${1:-$TST_DEVICE}"
 	local i=0
 
+	[ -z "$device" ] && return
+
 	if ! grep -q "$device" /proc/mounts; then
 		tst_res TINFO "The $device is not mounted, skipping umount"
 		return
@@ -300,7 +317,7 @@
 		tst_brk TBROK "No device specified"
 	fi
 
-	tst_test_cmds mkfs.$fs_type
+	tst_require_cmds mkfs.$fs_type
 
 	tst_res TINFO "Formatting $device with $fs_type extra opts='$fs_opts'"
 	ROD_SILENT mkfs.$fs_type $fs_opts $device
@@ -322,7 +339,7 @@
 	fi
 }
 
-tst_test_cmds()
+tst_require_cmds()
 {
 	local cmd
 	for cmd in $*; do
@@ -342,7 +359,7 @@
 	return 0
 }
 
-tst_test_drivers()
+tst_require_drivers()
 {
 	[ $# -eq 0 ] && return 0
 
@@ -360,6 +377,11 @@
 	return $?
 }
 
+tst_is_num()
+{
+	echo "$1" | grep -Eq '^[-+]?[0-9]+\.?[0-9]*$'
+}
+
 tst_usage()
 {
 	if [ -n "$TST_USAGE" ]; then
@@ -387,12 +409,45 @@
 	fi
 }
 
+_tst_multiply_timeout()
+{
+	[ $# -ne 1 ] && tst_brk TBROK "_tst_multiply_timeout expect 1 parameter"
+	eval "local timeout=\$$1"
+
+	LTP_TIMEOUT_MUL=${LTP_TIMEOUT_MUL:-1}
+
+	local err="LTP_TIMEOUT_MUL must be number >= 1!"
+
+	tst_is_num "$LTP_TIMEOUT_MUL" || tst_brk TBROK "$err ($LTP_TIMEOUT_MUL)"
+
+	if ! tst_is_int "$LTP_TIMEOUT_MUL"; then
+		LTP_TIMEOUT_MUL=$(echo "$LTP_TIMEOUT_MUL" | cut -d. -f1)
+		LTP_TIMEOUT_MUL=$((LTP_TIMEOUT_MUL+1))
+		tst_res TINFO "ceiling LTP_TIMEOUT_MUL to $LTP_TIMEOUT_MUL"
+	fi
+
+	[ "$LTP_TIMEOUT_MUL" -ge 1 ] || tst_brk TBROK "$err ($LTP_TIMEOUT_MUL)"
+	[ "$timeout" -ge 1 ] || tst_brk TBROK "timeout need to be >= 1 ($timeout)"
+
+	eval "$1='$((timeout * LTP_TIMEOUT_MUL))'"
+	return 0
+}
 
 _tst_setup_timer()
 {
-	LTP_TIMEOUT_MUL=${LTP_TIMEOUT_MUL:-1}
+	TST_TIMEOUT=${TST_TIMEOUT:-300}
 
-	local sec=$((300 * LTP_TIMEOUT_MUL))
+	if [ "$TST_TIMEOUT" = -1 ]; then
+		tst_res TINFO "Timeout per run is disabled"
+		return
+	fi
+
+	if ! tst_is_int "$TST_TIMEOUT" || [ "$TST_TIMEOUT" -lt 1 ]; then
+		tst_brk TBROK "TST_TIMEOUT must be int >= 1! ($TST_TIMEOUT)"
+	fi
+
+	local sec=$TST_TIMEOUT
+	_tst_multiply_timeout sec
 	local h=$((sec / 3600))
 	local m=$((sec / 60 % 60))
 	local s=$((sec % 60))
@@ -407,7 +462,9 @@
 
 _tst_require_root()
 {
-	[ "$(id -ru)" != 0 ] && tst_brk TCONF "Must be super/root for this test!"
+	if [ "$(id -ru)" != 0 ]; then
+		tst_brk TCONF "Must be super/root for this test!"
+	fi
 }
 
 tst_run()
@@ -418,7 +475,7 @@
 	local _tst_name
 
 	if [ -n "$TST_TEST_PATH" ]; then
-		for _tst_i in $(grep TST_ "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
+		for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
 			case "$_tst_i" in
 			DISABLE_APPARMOR|DISABLE_SELINUX);;
 			SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);;
@@ -427,13 +484,13 @@
 			NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);;
 			NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);;
 			IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);;
-			RETRY_FUNC|RETRY_FN_EXP_BACKOFF);;
+			RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);;
 			NET_MAX_PKT);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
 
-		for _tst_i in $(grep _tst_ "$TST_TEST_PATH" | sed 's/.*_tst_//; s/[="} \t\/:`].*//'); do
+		for _tst_i in $(grep '^[^#]*\b_tst_' "$TST_TEST_PATH" | sed 's/.*_tst_//; s/[="} \t\/:`].*//'); do
 			tst_res TWARN "Private variable or function _tst_$_tst_i used!"
 		done
 	fi
@@ -462,8 +519,8 @@
 	[ "$TST_DISABLE_APPARMOR" = 1 ] && tst_disable_apparmor
 	[ "$TST_DISABLE_SELINUX" = 1 ] && tst_disable_selinux
 
-	tst_test_cmds $TST_NEEDS_CMDS
-	tst_test_drivers $TST_NEEDS_DRIVERS
+	tst_require_cmds $TST_NEEDS_CMDS
+	tst_require_drivers $TST_NEEDS_DRIVERS
 
 	if [ -n "$TST_MIN_KVER" ]; then
 		tst_kvcmp -lt "$TST_MIN_KVER" && \
@@ -472,6 +529,8 @@
 
 	_tst_setup_timer
 
+	[ "$TST_NEEDS_DEVICE" = 1 ] && TST_TMPDIR=1
+
 	if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
 		if [ -z "$TMPDIR" ]; then
 			export TMPDIR="/tmp"
@@ -488,13 +547,11 @@
 
 	TST_MNTPOINT="${TST_MNTPOINT:-mntpoint}"
 	if [ "$TST_NEEDS_DEVICE" = 1 ]; then
-		if [ -z ${TST_TMPDIR} ]; then
-			tst_brk TBROK "Use TST_NEEDS_TMPDIR must be set for TST_NEEDS_DEVICE"
-		fi
 
 		TST_DEVICE=$(tst_device acquire)
 
 		if [ ! -b "$TST_DEVICE" -o $? -ne 0 ]; then
+			unset TST_DEVICE
 			tst_brk TBROK "Failed to acquire device"
 		fi
 
@@ -520,14 +577,13 @@
 	fi
 
 	if [ -n "$TST_SETUP" ]; then
-		TST_SETUP_STARTED=1
 		$TST_SETUP
 	fi
 
 	#TODO check that test reports some results for each test function call
 	while [ $TST_ITERATIONS -gt 0 ]; do
 		if [ -n "$TST_TEST_DATA" ]; then
-			tst_test_cmds cut tr wc
+			tst_require_cmds cut tr wc
 			_tst_max=$(( $(echo $TST_TEST_DATA | tr -cd "$TST_TEST_DATA_IFS" | wc -c) +1))
 			for _tst_i in $(seq $_tst_max); do
 				_tst_data="$(echo "$TST_TEST_DATA" | cut -d"$TST_TEST_DATA_IFS" -f$_tst_i)"
diff --git a/testcases/misc/crash/crash02.c b/testcases/misc/crash/crash02.c
index 00fee34..cddedc1 100644
--- a/testcases/misc/crash/crash02.c
+++ b/testcases/misc/crash/crash02.c
@@ -430,13 +430,12 @@
 	arg6 = rand_long();
 	arg7 = rand_long();
 
-	if (x_opt) {
-		if (verbose_level >= 1)
-			printf("%04d: syscall(%ld, %#lx, %#lx, %#lx, %#lx, "
-			       "%#lx, %#lx, %#lx)\n",
-			       try_num, sysno, arg1, arg2, arg3, arg4, arg5,
-			       arg6, arg7);
-	} else {
+	if (x_opt || verbose_level >= 1)
+		printf("%04d: syscall(%ld, %#lx, %#lx, %#lx, %#lx, %#lx, "
+		       "%#lx, %#lx)\n", try_num, sysno, arg1, arg2, arg3,
+		       arg4, arg5, arg6, arg7);
+
+	if (!x_opt) {
 		syscall(sysno, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
 		record_errno(errno);
 	}
diff --git a/testcases/network/.gitignore b/testcases/network/.gitignore
index e952f6f..dab2bc3 100644
--- a/testcases/network/.gitignore
+++ b/testcases/network/.gitignore
@@ -7,7 +7,6 @@
 /lib6/getaddrinfo_01
 /lib6/in6_01
 /lib6/in6_02
-/multicast/mc_gethost/mc_gethost
 /multicast/mc_commo/mc_recv
 /multicast/mc_commo/mc_send
 /multicast/mc_member/mc_member_test
diff --git a/testcases/network/can/filter-tests/can_run_tests.sh b/testcases/network/can/filter-tests/can_run_tests.sh
index c5aec09..762d90e 100755
--- a/testcases/network/can/filter-tests/can_run_tests.sh
+++ b/testcases/network/can/filter-tests/can_run_tests.sh
@@ -61,7 +61,7 @@
 	ip link add dev $VCAN type vcan
 	ret=$?
 	if [ $ret -ne 0 ]; then
-		tst_brkm TBROK
+		tst_brkm TBROK \
 			 "ip link add dev $VCAN type vcan failed: ret - $ret"
 	fi
 
diff --git a/testcases/network/dhcp/dhcp_lib.sh b/testcases/network/dhcp/dhcp_lib.sh
index 649ce10..634d6ab 100755
--- a/testcases/network/dhcp/dhcp_lib.sh
+++ b/testcases/network/dhcp/dhcp_lib.sh
@@ -2,7 +2,6 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2018 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
 # Author:       Alexey Kodanev alexey.kodanev@oracle.com
 
 TST_SETUP="dhcp_lib_setup"
@@ -109,7 +108,8 @@
 
 test01()
 {
-	local wicked
+	local wicked_cfg="/etc/sysconfig/network/ifcfg-$iface1"
+	local wicked_cleanup
 
 	tst_res TINFO "testing DHCP server $dhcp_name: $(print_dhcp_version)"
 	tst_res TINFO "using DHCP client: $(dhclient --version 2>&1)"
@@ -131,15 +131,28 @@
 
 	if [ $HAVE_SYSTEMCTL -eq 1 ] && \
 		systemctl --no-pager -p Id show network.service | grep -q Id=wicked.service; then
-		tst_res TINFO "temporarily disabling wicked"
-		wicked=1
-		systemctl disable wicked
+		tst_res TINFO "wicked is running, don't start dhclient"
+		if [ ! -f "$wicked_cfg" ]; then
+			cat <<EOF > $wicked_cfg
+BOOTPROTO='dhcp'
+NAME='LTP card'
+STARTMODE='auto'
+USERCONTROL='no'
+EOF
+			wicked_cleanup=1
+		else
+			tst_res TINFO "wicked config file $wicked_cfg already exist"
+		fi
+
+		tst_res TINFO "restarting wicked"
+		systemctl restart wicked
+	else
+		tst_res TINFO "starting dhclient -$TST_IPVER $iface1"
+		dhclient -$TST_IPVER $iface1 || tst_brk TBROK "dhclient failed"
 	fi
-	tst_res TINFO "starting dhclient -$TST_IPVER $iface1"
-	dhclient -$TST_IPVER $iface1 || tst_brk TBROK "dhclient failed"
 
 	# check that we get configured ip address
-	ip addr show $iface1 | grep $ip_addr_check > /dev/null
+	ip addr show $iface1 | grep -q $ip_addr_check
 	if [ $? -eq 0 ]; then
 		tst_res TPASS "'$ip_addr_check' configured by DHCPv$TST_IPVER"
 	else
@@ -152,10 +165,7 @@
 		fi
 	fi
 
-	if [ "$wicked" ]; then
-		tst_res TINFO "reenabling wicked"
-		systemctl enable wicked
-	fi
+	[ "$wicked_cleanup" ] && rm -f $wicked_cfg
 
 	stop_dhcp
 }
diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
index 566a653..41c5156 100755
--- a/testcases/network/iproute/ip_tests.sh
+++ b/testcases/network/iproute/ip_tests.sh
@@ -1,11 +1,10 @@
 #! /bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2019 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines  Corp., 2001
+# Copyright (c) International Business Machines Corp., 2001
+# Author:       Manoj Iyer, manjo@mail.utexas.edu
 #
 # Description:  Test basic functionality of ip command in route2 package
-#
-# Author:       Manoj Iyer, manjo@mail.utexas.edu
 
 TST_CNT=6
 TST_SETUP="init"
diff --git a/testcases/network/iptables/Makefile b/testcases/network/iptables/Makefile
index afb96e9..1b42f25 100644
--- a/testcases/network/iptables/Makefile
+++ b/testcases/network/iptables/Makefile
@@ -1,29 +1,12 @@
-#
-#    network/iptables testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems Inc.
-#
-#    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.
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
 #
 # Ngie Cooper, July 2009
-#
 
 top_srcdir		?= ../../..
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= iptables_tests.sh
+INSTALL_TARGETS		:= *.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/iptables/iptables01.sh b/testcases/network/iptables/iptables01.sh
new file mode 100755
index 0000000..b788b91
--- /dev/null
+++ b/testcases/network/iptables/iptables01.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018-2019 Oracle and/or its affiliates. All Rights Reserved.
+
+use_iptables=1
+
+. iptables_lib.sh
+
+tst_run
diff --git a/testcases/network/iptables/iptables_lib.sh b/testcases/network/iptables/iptables_lib.sh
new file mode 100755
index 0000000..ad2a894
--- /dev/null
+++ b/testcases/network/iptables/iptables_lib.sh
@@ -0,0 +1,381 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018-2019 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2001
+#
+#  Author:	Jan 20 2004 Hubert Lin <linux02NOSPAAAM@tw.ibm.com>
+#				       <hubertNOSPAAAM@symbio.com.tw>
+
+TST_CNT=6
+TST_TESTFUNC="test"
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_ROOT=1
+TST_SETUP="${TST_SETUP:-init}"
+TST_CLEANUP="${TST_CLEANUP:-cleanup}"
+TST_NEEDS_CMDS="grep telnet"
+
+. tst_net.sh
+
+NFRUN()
+{
+	local rule
+
+	if [ "$use_iptables" = 1 ]; then
+		ip${TST_IPV6}tables $@
+	else
+		$(ip${TST_IPV6}tables-translate $@ | sed 's,\\,,g')
+	fi
+}
+
+NFRUN_REMOVE()
+{
+	if [ "$use_iptables" = 1 ]; then
+		ROD ip${TST_IPV6}tables -D INPUT 1
+	else
+		ROD nft flush chain ip${TST_IPV6} filter INPUT
+	fi
+}
+
+init()
+{
+	if [ "$use_iptables" = 1 ]; then
+		toolname=ip${TST_IPV6}tables
+		cmds="$toolname"
+		tst_require_drivers ip${TST_IPV6}_tables
+	else
+		toolname=nft
+		cmds="$toolname ip${TST_IPV6}tables-translate"
+	fi
+
+	if [ "$TST_IPV6" ];then
+		loc_addr="::1"
+		proto="icmpv6"
+	else
+		loc_addr="127.0.0.1"
+		proto="icmp"
+	fi
+
+	ping_cmd="ping$TST_IPV6"
+	tst_require_cmds $cmds $ping_cmd
+
+	tst_res TINFO "INIT: Flushing all rules"
+	NFRUN -F -t filter > tst_iptables.out 2>&1
+	NFRUN -F -t nat > tst_iptables.out 2>&1
+	NFRUN -F -t mangle > tst_iptables.out 2>&1
+}
+
+cleanup()
+{
+	if lsmod | grep -q "ip${TST_IPV6}_tables"; then
+		NFTRUN -F -t filter > /dev/null 2>&1
+		NFTRUN -F -t nat > /dev/null 2>&1
+		NFTRUN -F -t mangle > /dev/null 2>&1
+		rmmod -v ipt_limit ipt_multiport ipt_LOG ipt_REJECT \
+			 ip${TST_IPV6}table_mangle ip${TST_IPV6}table_nat ip_conntrack \
+			 ip${TST_IPV6}table_filter ip${TST_IPV6}_tables nf_nat_ipv${TST_IPVER} nf_nat \
+			 nf_log_ipv${TST_IPVER} nf_log_common nf_reject_ipv${TST_IPVER} \
+			 nf_conntrack_ipv${TST_IPVER} nf_defrag_ipv${TST_IPVER} nf_conntrack \
+			 > tst_iptables.out 2>&1
+	fi
+}
+
+test1()
+{
+	if [ "$use_iptables" != 1 ]; then
+		tst_res TCONF "$toolname not applicable for test $1"
+		return
+	fi
+	local chaincnt=0
+	local ipt_cmd="ip${TST_IPV6}tables"
+	local cmd="$ipt_cmd -L -t filter"
+	tst_res TINFO "$cmd will list all rules in table filter"
+	$cmd > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$cmd failed to list rules"
+		cat tst_iptables.out
+		return
+	else
+		chaincnt=$(grep -c Chain tst_iptables.out)
+		if [ $chaincnt -lt 3 ]; then
+			tst_res TFAIL "$cmd failed to list rules"
+			cat tst_iptables.out
+			return
+		else
+			tst_res TINFO "$cmd lists rules"
+		fi
+	fi
+
+	local cmd="$ipt_cmd -L -t nat"
+	tst_res TINFO "$cmd will list all rules in table nat"
+	$cmd > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$cmd failed to list rules"
+		cat tst_iptables.out
+		return
+	else
+		chaincnt=$(grep -c Chain tst_iptables.out)
+		if [ $chaincnt -lt 3 ]; then
+			tst_res TFAIL "$cmd failed to list rules"
+			cat tst_iptables.out
+			return
+		else
+			tst_res TINFO "$cmd lists rules"
+		fi
+	fi
+
+	local cmd="$ipt_cmd -L -t mangle"
+	tst_res TINFO "$cmd will list all rules in table mangle"
+	$cmd > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$cmd failed to list rules"
+		cat tst_iptables.out
+		return
+	else
+		chaincnt=$(grep -c Chain tst_iptables.out)
+		if [ $chaincnt -lt 5 ]; then
+			tst_res TFAIL "$cmd failed to list rules"
+			cat tst_iptables.out
+		else
+			tst_res TINFO "$cmd lists rules"
+		fi
+	fi
+
+	tst_res TPASS "$ipt_cmd -L lists rules"
+}
+
+test2()
+{
+	tst_res TINFO "Use $toolname to DROP packets from particular IP"
+	tst_res TINFO "Rule to block icmp from $loc_addr"
+
+	NFRUN -A INPUT -s $loc_addr -p $proto -j DROP > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname command failed to append new rule"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Pinging $loc_addr"
+	$ping_cmd -c 2 $loc_addr -W 1 -i 0 > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		grep "100% packet loss" tst_iptables.out > tst_iptables.err 2>&1
+		if [ $? -ne 0 ]; then
+			tst_res TFAIL \
+				 "$toolname did not block packets from loopback"
+			cat tst_iptables.err
+			return
+		else
+			tst_res TINFO "Ping $loc_addr not successful"
+		fi
+	else
+		tst_res TFAIL "$toolname did not block $proto from $loc_addr"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Deleting $proto DROP from $loc_addr rule"
+	NFRUN_REMOVE
+
+	tst_res TINFO "Pinging $loc_addr again"
+	$ping_cmd -c 2 $loc_addr -W 1 -i 0 > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname blocking loopback. This is expected" \
+			       "behaviour on certain distributions where" \
+			       "enabling firewall drops all packets by default"
+		cat tst_iptables.out
+		return
+	fi
+	tst_res TINFO "Ping succsess"
+	tst_res TPASS "$toolname can DROP packets from particular IP"
+}
+
+test3()
+{
+	tst_res TINFO "Use $toolname to REJECT ping request"
+	tst_res TINFO "Rule to reject ping request"
+
+	NFRUN -A INPUT -p $proto --${proto}-type echo-request -d $loc_addr -j \
+		 REJECT > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname command failed to append new rule"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Pinging $loc_addr"
+	$ping_cmd -c 2 $loc_addr -W 1 -i 0 > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		grep "100% packet loss" tst_iptables.out > tst_iptables.err 2>&1
+		if [ $? -ne 0 ]; then
+			tst_res TFAIL "$toolname did not block ping request"
+			cat tst_iptables.err
+			return
+		else
+			tst_res TINFO "Ping $loc_addr not successful"
+		fi
+	else
+		tst_res TFAIL "$toolname did not reject ping request"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Deleting icmp request REJECT rule"
+	NFRUN_REMOVE
+
+	tst_res TINFO "Pinging $loc_addr again"
+	$ping_cmd -c 2 $loc_addr -W 1 -i 0 > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname blocking ping requests. This is" \
+			      "expected behaviour on certain distributions" \
+			      "where enabling firewall drops all packets by" \
+			      "default"
+		cat tst_iptables.out
+		return
+	fi
+	tst_res TINFO "Ping succsess"
+	tst_res TPASS "$toolname can REJECT ping requests"
+}
+
+test4()
+{
+	local dport=45886
+	local logprefix="${TCID}$(date +%m%d%H%M%S):"
+
+	tst_res TINFO "Use $toolname to log packets to particular port"
+	tst_res TINFO "Rule to log tcp packets to particular port"
+
+	NFRUN -A INPUT -p tcp -d $loc_addr --dport $dport -j LOG \
+		 --log-prefix "$logprefix" > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname command failed to append new rule"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "telnet $loc_addr $dport"
+	telnet $loc_addr $dport > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		sleep 2
+		dmesg | grep "$logprefix" > tst_iptables.err 2>&1
+		if [ $? -ne 0 ]; then
+			tst_res TFAIL \
+				 "$toolname did not log packets to port $dport"
+			cat tst_iptables.err
+			return
+		else
+			tst_res TINFO "Packets to port $dport logged"
+		fi
+	else
+		tst_res TFAIL "telnet to $loc_addr $dport should fail"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Deleting the rule to log"
+	NFRUN_REMOVE
+
+	tst_res TINFO "$toolname logging succsess"
+	tst_res TPASS "$toolname can log packets to particular port"
+}
+
+test5()
+{
+	local dport=0
+	local logprefix="${TCID}$(date +%m%d%H%M%S):"
+
+	tst_res TINFO "Use $toolname to log packets to multiple ports"
+	tst_res TINFO "Rule to log tcp packets to port 45801 - 45803"
+	NFRUN -A INPUT -p tcp -d $loc_addr --dport 45801:45803 -j LOG \
+		 --log-prefix "$logprefix" > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname command failed to append new rule"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Rule to log tcp packets to port 45804 - 45806"
+	NFRUN -A INPUT -p tcp -d $loc_addr -m multiport --dports \
+		 45804,45806,45805 -j LOG --log-prefix "$logprefix" \
+		 > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname command failed to append new rule"
+		cat tst_iptables.out
+		return
+	fi
+
+	for dport in 45801 45802 45803 45804 45805 45806; do
+		tst_res TINFO "telnet $loc_addr $dport"
+		telnet $loc_addr $dport > tst_iptables.out 2>&1
+		if [ $? -ne 0 ]; then
+			sleep 2
+			dmesg | grep "$logprefix" | grep "=$dport " \
+				> tst_iptables.err 2>&1
+			if [ $? -ne 0 ]; then
+				tst_res TFAIL "$toolname did not log packets" \
+					       "to port $dport"
+				cat tst_iptables.err
+				return
+			else
+				tst_res TINFO "Packets to port $dport logged"
+			fi
+		else
+			tst_res TFAIL "telnet to $loc_addr $dport should fail"
+			cat tst_iptables.out
+			return
+		fi
+	done
+
+	tst_res TINFO "Flushing all rules"
+	NFRUN -F > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname did not flush all rules"
+		cat tst_iptables.out
+		return
+	fi
+	tst_res TINFO "$toolname logging succsess"
+	tst_res TPASS "$toolname can log packets to multiple ports"
+}
+
+test6()
+{
+	local logcnt=0
+	local logprefix="${TCID}$(date +%m%d%H%M%S):"
+
+	tst_res TINFO "Use $toolname to log ping request with limited rate"
+	tst_res TINFO "Rule to log ping request"
+
+	NFRUN -A INPUT -p $proto --$proto-type echo-request -d $loc_addr -m \
+		 limit -j LOG --log-prefix "$logprefix" > tst_iptables.out 2>&1
+	if [ $? -ne 0 ]; then
+		tst_res TFAIL "$toolname command failed to append new rule"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Pinging $loc_addr"
+	$ping_cmd -c 10 $loc_addr -W 1 -i 0 > tst_iptables.out 2>&1
+	if [ $? -eq 0 ]; then
+		sleep 2
+		logcnt=$(dmesg | grep -c "$logprefix")
+		if [ $logcnt -ne 5 ]; then
+			tst_res TFAIL "$toolname did not log packets with" \
+				      "limited rate"
+			cat tst_iptables.out
+			return
+		else
+			tst_res TINFO "ping requests logged with limited rate"
+		fi
+	else
+		tst_res TFAIL "ping to $loc_addr failed. This is expected" \
+			      "behaviour on certain distributions where" \
+			      "enabling firewall drops all packets by default"
+		cat tst_iptables.out
+		return
+	fi
+
+	tst_res TINFO "Deleting the rule to log"
+	NFRUN_REMOVE
+
+	tst_res TINFO "$toolname limited logging succsess"
+	tst_res TPASS "$toolname can log packets with limited rate"
+}
diff --git a/testcases/network/iptables/iptables_tests.sh b/testcases/network/iptables/iptables_tests.sh
deleted file mode 100755
index 11412d6..0000000
--- a/testcases/network/iptables/iptables_tests.sh
+++ /dev/null
@@ -1,366 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines  Corp., 2001
-#
-#  Author:	Jan 20 2004 Hubert Lin <linux02NOSPAAAM@tw.ibm.com>
-#				       <hubertNOSPAAAM@symbio.com.tw>
-
-TST_CNT=6
-TST_SETUP="init"
-TST_TESTFUNC="test"
-TST_CLEANUP="cleanup"
-TST_NEEDS_TMPDIR=1
-TST_NEEDS_ROOT=1
-TST_NEEDS_CMDS="iptables grep ping telnet"
-
-. tst_test.sh
-
-init()
-{
-	tst_res TINFO "INIT: Inititalizing tests."
-
-	modprobe ip_tables
-	if [ $? -ne 0 ]; then
-		iptables -L > tst_iptables.out 2>&1
-		if [ $? -ne 0 ]; then
-			tst_brk TCONF "no iptables support in kernel."
-		fi
-	fi
-
-	tst_res TINFO "INIT: Flushing all rules."
-	iptables -F -t filter > tst_iptables.out 2>&1
-	iptables -F -t nat > tst_iptables.out 2>&1
-	iptables -F -t mangle > tst_iptables.out 2>&1
-}
-
-cleanup()
-{
-	lsmod | grep "ip_tables" > tst_iptables.out 2>&1
-	if [ $? -eq 0 ]; then
-		iptables -F -t filter > tst_iptables.out 2>&1
-		iptables -F -t nat > tst_iptables.out 2>&1
-		iptables -F -t mangle > tst_iptables.out 2>&1
-		rmmod -v ipt_limit ipt_multiport ipt_LOG ipt_REJECT \
-			 iptable_mangle iptable_nat ip_conntrack \
-			 iptable_filter ip_tables nf_nat_ipv4 nf_nat \
-			 nf_log_ipv4 nf_log_common nf_reject_ipv4 \
-			 nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack \
-			 > tst_iptables.out 2>&1
-	fi
-}
-
-test1()
-{
-	local chaincnt=0
-
-	local cmd="iptables -L -t filter"
-	tst_res TINFO "$cmd will list all rules in table filter."
-	$cmd > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "$cmd failed to list rules."
-		cat tst_iptables.out
-		return
-	else
-		chaincnt=$(grep -c Chain tst_iptables.out)
-		if [ $chaincnt -lt 3 ]; then
-			tst_res TFAIL "$cmd failed to list rules."
-			cat tst_iptables.out
-			return
-		else
-			tst_res TINFO "$cmd lists rules."
-		fi
-	fi
-
-	local cmd="iptables -L -t nat"
-	tst_res TINFO "$cmd will list all rules in table nat."
-	$cmd > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "$cmd failed to list rules."
-		cat tst_iptables.out
-		return
-	else
-		chaincnt=$(grep -c Chain tst_iptables.out)
-		if [ $chaincnt -lt 3 ]; then
-			tst_res TFAIL "$cmd failed to list rules."
-			cat tst_iptables.out
-			return
-		else
-			tst_res TINFO "$cmd lists rules."
-		fi
-	fi
-
-	local cmd="iptables -L -t mangle"
-	tst_res TINFO "$cmd will list all rules in table mangle."
-	$cmd > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "$cmd failed to list rules."
-		cat tst_iptables.out
-		return
-	else
-		chaincnt=$(grep -c Chain tst_iptables.out)
-		if [ $chaincnt -lt 5 ]; then
-			tst_res TFAIL "$cmd failed to list rules."
-			cat tst_iptables.out
-		else
-			tst_res TINFO "$cmd lists rules."
-		fi
-	fi
-
-	tst_res TPASS "iptables -L lists rules."
-}
-
-test2()
-{
-	tst_res TINFO "Use iptables to DROP packets from particular IP"
-	tst_res TINFO "Rule to block icmp from 127.0.0.1"
-
-	iptables -A INPUT -s 127.0.0.1 -p icmp -j DROP > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables command failed to append new rule."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Pinging 127.0.0.1"
-	ping -c 2 127.0.0.1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		grep "100% packet loss" tst_iptables.out > tst_iptables.err 2>&1
-		if [ $? -ne 0 ]; then
-			tst_res TFAIL \
-				 "iptables did not block packets from loopback"
-			cat tst_iptables.err
-			return
-		else
-			tst_res TINFO "Ping 127.0.0.1 not successful."
-		fi
-	else
-		tst_res TFAIL "iptables did not block icmp from 127.0.0.1"
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Deleting icmp DROP from 127.0.0.1 rule."
-	iptables -D INPUT 1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables did not remove the rule."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "Pinging 127.0.0.1 again"
-	ping -c 2 127.0.0.1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables blocking loopback. This is expected" \
-			       "behaviour on certain distributions where" \
-			       "enabling firewall drops all packets by default."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "Ping succsess"
-	tst_res TPASS "iptables can DROP packets from particular IP."
-}
-
-test3()
-{
-	tst_res TINFO "Use iptables to REJECT ping request."
-	tst_res TINFO "Rule to reject ping request."
-
-	iptables -A INPUT -p icmp --icmp-type echo-request -d 127.0.0.1 -j \
-		 REJECT > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables command failed to append new rule."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Pinging 127.0.0.1"
-	ping -c 2 127.0.0.1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		grep "100% packet loss" tst_iptables.out > tst_iptables.err 2>&1
-		if [ $? -ne 0 ]; then
-			tst_res TFAIL "iptables did not block ping request."
-			cat tst_iptables.err
-			return
-		else
-			tst_res TINFO "Ping 127.0.0.1 not successful."
-		fi
-	else
-		tst_res TFAIL "iptables did not reject ping request."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Deleting icmp request REJECT rule."
-	iptables -D INPUT 1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables did not remove the rule."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "Pinging 127.0.0.1 again"
-	ping -c 2 127.0.0.1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables blocking ping requests. This is" \
-			      "expected behaviour on certain distributions" \
-			      "where enabling firewall drops all packets by" \
-			      "default."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "Ping succsess"
-	tst_res TPASS "iptables can REJECT ping requests."
-}
-
-test4()
-{
-	local dport=45886
-	local logprefix="${TCID}$(date +%m%d%H%M%S):"
-
-	tst_res TINFO "Use iptables to log packets to particular port."
-	tst_res TINFO "Rule to log tcp packets to particular port."
-
-	iptables -A INPUT -p tcp -d 127.0.0.1 --dport $dport -j LOG \
-		 --log-prefix "$logprefix" > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables command failed to append new rule."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "telnet 127.0.0.1 $dport"
-	telnet 127.0.0.1 $dport > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		sleep 2
-		dmesg | grep "$logprefix" > tst_iptables.err 2>&1
-		if [ $? -ne 0 ]; then
-			tst_res TFAIL \
-				 "iptables did not log packets to port $dport"
-			cat tst_iptables.err
-			return
-		else
-			tst_res TINFO "Packets to port $dport logged."
-		fi
-	else
-		tst_res TFAIL "telnet to 127.0.0.1 $dport should fail."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Deleting the rule to log."
-	iptables -D INPUT 1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables did not remove the rule."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "iptables logging succsess"
-	tst_res TPASS "iptables can log packets to particular port."
-}
-
-test5()
-{
-	local dport=0
-	local logprefix="${TCID}$(date +%m%d%H%M%S):"
-
-	tst_res TINFO "Use iptables to log packets to multiple ports."
-	tst_res TINFO "Rule to log tcp packets to port 45801 - 45803."
-	iptables -A INPUT -p tcp -d 127.0.0.1 --dport 45801:45803 -j LOG \
-		 --log-prefix "$logprefix" > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables command failed to append new rule."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Rule to log tcp packets to port 45804 - 45806."
-	iptables -A INPUT -p tcp -d 127.0.0.1 -m multiport --dports \
-		 45804,45806,45805 -j LOG --log-prefix "$logprefix" \
-		 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables command failed to append new rule."
-		cat tst_iptables.out
-		return
-	fi
-
-	for dport in 45801 45802 45803 45804 45805 45806; do
-		tst_res TINFO "telnet 127.0.0.1 $dport"
-		telnet 127.0.0.1 $dport > tst_iptables.out 2>&1
-		if [ $? -ne 0 ]; then
-			sleep 2
-			dmesg | grep "$logprefix" | grep "=$dport " \
-				> tst_iptables.err 2>&1
-			if [ $? -ne 0 ]; then
-				tst_res TFAIL "iptables did not log packets" \
-					       "to port $dport"
-				cat tst_iptables.err
-				return
-			else
-				tst_res TINFO "Packets to port $dport logged."
-			fi
-		else
-			tst_res TFAIL "telnet to 127.0.0.1 $dport should fail."
-			cat tst_iptables.out
-			return
-		fi
-	done
-
-	tst_res TINFO "Flushing all rules."
-	iptables -F > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables did not flush all rules."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "iptables logging succsess"
-	tst_res TPASS "iptables can log packets to multiple ports."
-}
-
-test6()
-{
-	local logcnt=0
-	local logprefix="${TCID}$(date +%m%d%H%M%S):"
-
-	tst_res TINFO "Use iptables to log ping request with limited rate."
-	tst_res TINFO "Rule to log ping request."
-
-	iptables -A INPUT -p icmp --icmp-type echo-request -d 127.0.0.1 -m \
-		 limit -j LOG --log-prefix "$logprefix" > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables command failed to append new rule."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "ping 127.0.0.1"
-	ping -c 10 127.0.0.1 > tst_iptables.out 2>&1
-	if [ $? -eq 0 ]; then
-		sleep 2
-		logcnt=$(dmesg | grep -c "$logprefix")
-		if [ $logcnt -ne 5 ]; then
-			tst_res TFAIL "iptables did not log packets with" \
-				      "limited rate."
-			cat tst_iptables.out
-			return
-		else
-			tst_res TINFO "ping requests logged with limited rate."
-		fi
-	else
-		tst_res TFAIL "ping to 127.0.0.1 failed. This is expected" \
-			      "behaviour on certain distributions where" \
-			      "enabling firewall drops all packets by default."
-		cat tst_iptables.out
-		return
-	fi
-
-	tst_res TINFO "Deleting the rule to log."
-	iptables -D INPUT 1 > tst_iptables.out 2>&1
-	if [ $? -ne 0 ]; then
-		tst_res TFAIL "iptables did not remove the rule."
-		cat tst_iptables.out
-		return
-	fi
-	tst_res TINFO "iptables limited logging succsess"
-	tst_res TPASS "iptables can log packets with limited rate."
-}
-
-tst_run
diff --git a/testcases/network/iptables/nft01.sh b/testcases/network/iptables/nft01.sh
new file mode 100755
index 0000000..bf2a53c
--- /dev/null
+++ b/testcases/network/iptables/nft01.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Oracle and/or its affiliates. All Rights Reserved.
+
+TST_SETUP="do_setup"
+TST_CLEANUP="do_cleanup"
+TST_NEEDS_DRIVERS="nf_tables"
+use_iptables=0
+cleanup_table=0
+cleanup_chain=0
+
+. iptables_lib.sh
+
+do_setup()
+{
+	init
+	local ip_table="ip${TST_IPV6}"
+
+	if ! nft list table $ip_table filter > /dev/null 2>&1; then
+		ROD nft add table $ip_table filter
+		cleanup_table=1
+	fi
+	if ! nft list chain $ip_table filter INPUT > /dev/null 2>&1; then
+		ROD nft add chain $ip_table filter INPUT '{ type filter hook input priority 0; }'
+		cleanup_chain=1
+	fi
+}
+
+do_cleanup()
+{
+	local ip_table="ip${TST_IPV6}"
+
+	[ "$cleanup_chain" = 1 ] && nft delete chain $ip_table filter INPUT >/dev/null 2>&1
+	[ "$cleanup_table" = 1 ] && nft delete table $ip_table filter >/dev/null 2>&1
+	cleanup
+}
+
+tst_run
diff --git a/testcases/network/lib6/in6_01.c b/testcases/network/lib6/in6_01.c
index cb18011..2e4b5c5 100644
--- a/testcases/network/lib6/in6_01.c
+++ b/testcases/network/lib6/in6_01.c
@@ -1,25 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
- *
  * Author: David L Stevens
- */
-
-/*
- * Description: Verify that in6 and sockaddr fields are present.
+ *
+ * Verify that in6 and sockaddr fields are present.
  */
 
 #include <errno.h>
diff --git a/testcases/network/lib6/in6_02.c b/testcases/network/lib6/in6_02.c
index 6cc0242..f6c99f7 100644
--- a/testcases/network/lib6/in6_02.c
+++ b/testcases/network/lib6/in6_02.c
@@ -1,23 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Copyright (c) International Business Machines  Corp., 2001
+ * Copyright (c) International Business Machines Corp., 2001
  * Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
- *
  * Author: David L Stevens
  *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
- *
- * Description:
  * IPv6 name to index and index to name function tests
  */
 
diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh
index 84b3236..8ebedba 100755
--- a/testcases/network/mpls/mpls_lib.sh
+++ b/testcases/network/mpls/mpls_lib.sh
@@ -8,7 +8,7 @@
 TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel mpls_gso"
 TST_NEEDS_CMDS="sysctl modprobe"
 TST_TEST_DATA="icmp tcp udp"
-
+TST_NETLOAD_BINDTODEVICE=
 . tst_net.sh
 
 mpls_cleanup()
diff --git a/testcases/network/multicast/Makefile b/testcases/network/multicast/Makefile
index 6ade5e5..590f41e 100644
--- a/testcases/network/multicast/Makefile
+++ b/testcases/network/multicast/Makefile
@@ -24,8 +24,4 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-ifeq ($(ANDROID),1)
-FILTER_OUT_DIRS		+= mc_gethost
-endif
-
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/multicast/mc_cmds/Makefile b/testcases/network/multicast/mc_cmds/Makefile
index cf5ae6f..f4142ad 100644
--- a/testcases/network/multicast/mc_cmds/Makefile
+++ b/testcases/network/multicast/mc_cmds/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS	:= mc_cmds
+INSTALL_TARGETS	:= mc_cmds.sh
 
 MAKE_TARGETS	:=
 
diff --git a/testcases/network/multicast/mc_cmds/mc_cmds b/testcases/network/multicast/mc_cmds/mc_cmds.sh
similarity index 100%
rename from testcases/network/multicast/mc_cmds/mc_cmds
rename to testcases/network/multicast/mc_cmds/mc_cmds.sh
diff --git a/testcases/network/multicast/mc_commo/Makefile b/testcases/network/multicast/mc_commo/Makefile
index f183ca5..db51108 100644
--- a/testcases/network/multicast/mc_commo/Makefile
+++ b/testcases/network/multicast/mc_commo/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS	:= mc_commo
+INSTALL_TARGETS	:= mc_commo.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/multicast/mc_commo/mc_commo b/testcases/network/multicast/mc_commo/mc_commo.sh
similarity index 98%
rename from testcases/network/multicast/mc_commo/mc_commo
rename to testcases/network/multicast/mc_commo/mc_commo.sh
index 6852f17..b537080 100755
--- a/testcases/network/multicast/mc_commo/mc_commo
+++ b/testcases/network/multicast/mc_commo/mc_commo.sh
@@ -36,7 +36,7 @@
 
 do_setup()
 {
-	tst_test_cmds netstat pgrep
+	tst_require_cmds netstat pgrep
 
 	OCTET=$(ps -ewf | grep [m]c_commo | wc -l | awk '{print $1}')
 	GROUP_ADDR=224.0.0.$OCTET
diff --git a/testcases/network/multicast/mc_commo/mc_send.c b/testcases/network/multicast/mc_commo/mc_send.c
index df9a263..25890d3 100644
--- a/testcases/network/multicast/mc_commo/mc_send.c
+++ b/testcases/network/multicast/mc_commo/mc_send.c
@@ -95,7 +95,7 @@
 
 	/* Send datagrams */
 	for (i = 1; i < Num_Loops; i++) {
-		sprintf(buf, "%s %d %d", argv[2], i, (int)time(0));
+		sprintf(buf, "%s %d %lld", argv[2], i, (long long int)time(0));
 		if ((n =
 		     sendto(s, buf, sizeof(buf), 0,
 			    (struct sockaddr *)&mcast_out,
diff --git a/testcases/network/multicast/mc_gethost/Makefile b/testcases/network/multicast/mc_gethost/Makefile
deleted file mode 100644
index d5eaf84..0000000
--- a/testcases/network/multicast/mc_gethost/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#    Copyright (C) 2013, Linux Test Project
-#
-#    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.
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/testcases.mk
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/multicast/mc_gethost/mc_gethost.c b/testcases/network/multicast/mc_gethost/mc_gethost.c
deleted file mode 100644
index 9cc15d0..0000000
--- a/testcases/network/multicast/mc_gethost/mc_gethost.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* host - print information about a host
- * originally written by Paul Vixie @DEC WRL, January 1989
- */
-
-/* DECWRL Header: host.c,v 1.1 89/04/05 15:41:12 vixie Locked $ */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <stdio.h>
-#include <resolv.h>
-#include <netdb.h>
-#include <syslog.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifndef LOG_PERROR
-#define LOG_PERROR 0
-#endif
-
-int main(int argc, char **argv)
-{
-	unsigned char b_addr[IN6ADDRSZ];
-	struct hostent *host;
-	char **ap, **cp, *arg;
-	const char *prog = "amnesia";
-	int af = AF_INET;
-	int size = INADDRSZ;
-	int force = 0;
-
-	if (argc < 1) {
-usage:
-		printf("usage:  %s [-d] [-6] [-f] (hostname|ipaddr)\n", prog);
-		exit(1);
-	}
-	prog = *argv++;
-	argc--;
-#ifdef LOG_USER
-	openlog(prog, LOG_PERROR, LOG_USER);
-#else
-	openlog(prog, LOG_PERROR);
-#endif
-	res_init();
-
-	if (argc >= 1 && !strcmp(*argv, "-d")) {
-		_res.options |= RES_DEBUG;
-		argv++, argc--;
-	}
-	if (argc >= 1 && !strcmp(*argv, "-6")) {
-		af = AF_INET6, size = IN6ADDRSZ;
-		_res.options |= RES_USE_INET6;
-		argv++, argc--;
-	}
-	if (argc >= 1 && !strcmp(*argv, "-f")) {
-		force++;
-		argv++, argc--;
-	}
-
-	if (argc < 1)
-		goto usage;
-	arg = *argv++;
-	argc--;
-
-	if (inet_pton(af, arg, b_addr)) {
-		char p[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
-
-		printf("[%s]\n", inet_ntop(af, b_addr, p, sizeof p));
-		if (!(host = gethostbyaddr((char *)b_addr, size, af))) {
-			herror("gethostbyaddr");
-			exit(1);
-		}
-	} else {
-		printf("{%s}\n", arg);
-		if (force)
-			host = gethostbyname2(arg, af);
-		else
-			host = gethostbyname(arg);
-		if (!host) {
-			herror("gethostbyname*");
-			exit(1);
-		}
-	}
-	printf("name: %s\n", host->h_name);
-	if (host->h_aliases && *host->h_aliases) {
-		printf("aliases:");
-		for (cp = (char **)host->h_aliases; *cp; cp++)
-			printf(" %s", *cp);
-		printf("\n");
-	}
-	if (host->h_addr_list && *host->h_addr_list) {
-		printf("addresses:");
-		for (ap = host->h_addr_list; *ap; ap++) {
-			char p[sizeof
-			       "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
-
-			printf(" %s", inet_ntop(host->h_addrtype,
-						*ap, p, sizeof p));
-		}
-		printf("\n");
-	}
-	exit(0);
-}
diff --git a/testcases/network/multicast/mc_member/Makefile b/testcases/network/multicast/mc_member/Makefile
index 78cb882..88461b9 100644
--- a/testcases/network/multicast/mc_member/Makefile
+++ b/testcases/network/multicast/mc_member/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= mc_member
+INSTALL_TARGETS		:= mc_member.sh
 
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/multicast/mc_member/mc_member b/testcases/network/multicast/mc_member/mc_member.sh
similarity index 97%
rename from testcases/network/multicast/mc_member/mc_member
rename to testcases/network/multicast/mc_member/mc_member.sh
index 6552062..f41b03a 100755
--- a/testcases/network/multicast/mc_member/mc_member
+++ b/testcases/network/multicast/mc_member/mc_member.sh
@@ -38,13 +38,13 @@
 
 setup()
 {
-	tst_test_cmds netstat
+	tst_require_cmds netstat
 	tst_tmpdir
 }
 
 get_address()
 {
-	DIGIT=`ps -ef | grep mc_member | grep -v grep | wc -l`
+	DIGIT=`ps -ef | grep mc_member.sh | grep -v grep | wc -l`
 	ADDRESS=$DIGIT.$DIGIT.$DIGIT.$DIGIT
 }
 
diff --git a/testcases/network/multicast/mc_opts/Makefile b/testcases/network/multicast/mc_opts/Makefile
index ceeaa59..8b18c3b 100644
--- a/testcases/network/multicast/mc_opts/Makefile
+++ b/testcases/network/multicast/mc_opts/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= mc_opts
+INSTALL_TARGETS		:= mc_opts.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/multicast/mc_opts/mc_opts b/testcases/network/multicast/mc_opts/mc_opts.sh
similarity index 100%
rename from testcases/network/multicast/mc_opts/mc_opts
rename to testcases/network/multicast/mc_opts/mc_opts.sh
diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c
index 06882b1..76d2fdb 100644
--- a/testcases/network/netstress/netstress.c
+++ b/testcases/network/netstress/netstress.c
@@ -1,21 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2014-2016 Oracle and/or its affiliates. All Rights Reserved.
- *
- * 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 would 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, see <http://www.gnu.org/licenses/>.
- *
  * Author: Alexey Kodanev <alexey.kodanev@oracle.com>
- *
  */
 
 #include <pthread.h>
@@ -84,7 +70,7 @@
 static int client_max_requests	= 10;
 static int clients_num;
 static char *tcp_port;
-static char *server_addr	= "localhost";
+static char *server_addr;
 static char *source_addr;
 static char *server_bg;
 static int busy_poll		= -1;
@@ -115,7 +101,7 @@
 static int wait_timeout = 60000;
 
 /* in the end test will save time result in this file */
-static char *rpath = "tfo_result";
+static char *rpath;
 static char *port_path = "netstress_port";
 static char *log_path = "netstress.log";
 
@@ -531,7 +517,8 @@
 		SAFE_CLOSE(cfd);
 	}
 	/* the script tcp_fastopen_run.sh will remove it */
-	SAFE_FILE_PRINTF(rpath, "%ld", clnt_time);
+	if (rpath)
+		SAFE_FILE_PRINTF(rpath, "%ld", clnt_time);
 
 	tst_res(TPASS, "test completed");
 }
@@ -881,6 +868,9 @@
 	if (tst_parse_int(Aarg, &max_rand_msg_len, 10, max_msg_len))
 		tst_brk(TBROK, "Invalid max random payload size '%s'", Aarg);
 
+	if (!server_addr)
+		server_addr = "localhost";
+
 	if (max_rand_msg_len) {
 		max_rand_msg_len -= min_msg_len;
 		unsigned int seed = max_rand_msg_len ^ client_max_requests;
@@ -1013,7 +1003,7 @@
 	{"T:", &type, "-T x     tcp (default), udp, udp_lite, dccp, sctp"},
 	{"z", &zcopy, "-z       enable SO_ZEROCOPY"},
 	{"P:", &reuse_port, "-P       enable SO_REUSEPORT"},
-	{"D:", &dev, "-d x     bind to device x\n"},
+	{"D:", &dev, "-D x     bind to device x\n"},
 
 	{"H:", &server_addr, "Client:\n-H x     Server name or IP address"},
 	{"l", &client_mode, "-l       Become client, default is server"},
diff --git a/testcases/network/nfs/nfs_stress/nfs05_make_tree.c b/testcases/network/nfs/nfs_stress/nfs05_make_tree.c
index c4cbd05..25809e1 100644
--- a/testcases/network/nfs/nfs_stress/nfs05_make_tree.c
+++ b/testcases/network/nfs/nfs_stress/nfs05_make_tree.c
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
- * Copyright (c) International Business Machines  Corp., 2001
+ * 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 would 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, see <http://www.gnu.org/licenses/>.
-
- * Description:
  * This program is designed to stress the NFS implimentation. Many bugs were
  * uncovered in the AIX operating system implimentation of NFS when AIX kernel
  * was built over NFS. Source directory on a remote machine (one server many
@@ -43,7 +30,6 @@
  *   * initate a build, executable will print hello world;
  *   * clean up all the executables that were created;
  *   * recurssively remove each subdir and its contents.
- *
  */
 
 #define _GNU_SOURCE
diff --git a/testcases/network/nfs/nfsstat01/nfsstat01 b/testcases/network/nfs/nfsstat01/nfsstat01
index b5ecb83..b71129f 100755
--- a/testcases/network/nfs/nfsstat01/nfsstat01
+++ b/testcases/network/nfs/nfsstat01/nfsstat01
@@ -17,7 +17,7 @@
 	local opt=
 	[ "$name" = "rpc" ] && opt="r" || opt="n"
 
-	if [ "$nfs_f" = "nfs" ]; then
+	if [ -n "$LTP_NETNS" -o "$nfs_f" = "nfs" ]; then
 		calls="$(grep $name /proc/net/rpc/$nfs_f | cut -d' ' -f$field)"
 		ROD nfsstat -c$opt | grep -q "$calls"
 		echo "$calls"
diff --git a/testcases/network/nfsv4/acl/acl1.c b/testcases/network/nfsv4/acl/acl1.c
index bdf0180..aae9484 100644
--- a/testcases/network/nfsv4/acl/acl1.c
+++ b/testcases/network/nfsv4/acl/acl1.c
@@ -48,7 +48,6 @@
 	result = 0;
 	FILE *fptr;
 	char str[256] = "./";
-	fptr = malloc(sizeof(FILE));
 
 	uid = geteuid();
 	strcat(str, filename);
diff --git a/testcases/network/nfsv4/acl/runtest b/testcases/network/nfsv4/acl/runtest
index d2e1b4c..a859e85 100755
--- a/testcases/network/nfsv4/acl/runtest
+++ b/testcases/network/nfsv4/acl/runtest
@@ -22,7 +22,7 @@
 done
 
 #  creation of users on the remote machine (removed only at the end of the tests)
-rsh -n $REMOTEHOST python $PWD/create_users.py -u 50 -g 50
+rsh -n $REMOTEHOST python3 $PWD/create_users.py -u 50 -g 50
 
 echo "Starting ACL testing"
 
@@ -51,19 +51,19 @@
 
 echo "LONG ACL TEST"
 echo "creating necessary users and groups"
-python create_users.py -u 50 -g 50
+python3 create_users.py -u 50 -g 50
 echo "creating necessary users and groups on the remote host"
 mkdir $NFSMNTDIR/lacl-testdir
-python test_long_acl.py -l $MAXLENGTH -p $NFSMNTDIR/lacl-testdir
+python3 test_long_acl.py -l $MAXLENGTH -p $NFSMNTDIR/lacl-testdir
 rm -rf $NFSMNTDIR/lacl-testdir
 echo "Long ACL test OK with $MAXLENGTH entries"
 echo "ACL STRESSING TEST"
-python setacl_stress.py -n 100 -u $USER_NB -g $GRP_NB -f $FILE_NB -p $NFSMNTDIR
+python3 setacl_stress.py -n 100 -u $USER_NB -g $GRP_NB -f $FILE_NB -p $NFSMNTDIR
 
 # remove local an remote users
-python cleanusers.py
-python cleangroups.py
-rsh -n $REMOTEHOST python $PWD/cleanusers.py
+python3 cleanusers.py
+python3 cleangroups.py
+rsh -n $REMOTEHOST python3 $PWD/cleanusers.py
 
 echo "Test OK"
 
diff --git a/testcases/network/nfsv4/locks/locktests.h b/testcases/network/nfsv4/locks/locktests.h
index e26c730..a40e417 100644
--- a/testcases/network/nfsv4/locks/locktests.h
+++ b/testcases/network/nfsv4/locks/locktests.h
@@ -20,7 +20,7 @@
  * HISTORY : This program has been written to stress NFSv4 locks. -P
  * option was created to verify NFSv4 locking was thread-aware, and so,
  * locking behaviour over NFSv4 was POSIX correct both using threads and
- * process. This option may not be usefull to stress.
+ * process. This option may not be useful to stress.
  *
  * EXAMPLE : ./locktests -n 50 -f /file/system/to/test
  *
diff --git a/testcases/network/packet/fanout01.c b/testcases/network/packet/fanout01.c
index f5ce19a..5067d83 100644
--- a/testcases/network/packet/fanout01.c
+++ b/testcases/network/packet/fanout01.c
@@ -106,4 +106,10 @@
 	.test_all = run,
 	.cleanup = cleanup,
 	.needs_root = 1,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2017-15649"},
+		{"linux-git", "4971613c1639"},
+		{"linux-git", "008ba2a13f2d"},
+		{}
+	}
 };
diff --git a/testcases/network/rpc/basic_tests/rpc01/Makefile b/testcases/network/rpc/basic_tests/rpc01/Makefile
index bbf5b9c..6fe9669 100644
--- a/testcases/network/rpc/basic_tests/rpc01/Makefile
+++ b/testcases/network/rpc/basic_tests/rpc01/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= rpc01
+INSTALL_TARGETS		:= rpc01.sh
 SUBDIRS			:= datafiles
 
 CPPFLAGS		+= -I$(abs_srcdir)/lib
diff --git a/testcases/network/rpc/basic_tests/rpc01/rpc01 b/testcases/network/rpc/basic_tests/rpc01/rpc01.sh
similarity index 100%
rename from testcases/network/rpc/basic_tests/rpc01/rpc01
rename to testcases/network/rpc/basic_tests/rpc01/rpc01.sh
diff --git a/testcases/network/rpc/basic_tests/rpc01/rpc_server.c b/testcases/network/rpc/basic_tests/rpc01/rpc_server.c
index db5865f..21a45ff 100644
--- a/testcases/network/rpc/basic_tests/rpc01/rpc_server.c
+++ b/testcases/network/rpc/basic_tests/rpc01/rpc_server.c
@@ -4,6 +4,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <rpc/rpc.h>
 #include "librpc01.h"
diff --git a/testcases/network/rpc/basic_tests/rpcinfo/Makefile b/testcases/network/rpc/basic_tests/rpcinfo/Makefile
index f48bba6..6b84403 100644
--- a/testcases/network/rpc/basic_tests/rpcinfo/Makefile
+++ b/testcases/network/rpc/basic_tests/rpcinfo/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= rpcinfo01
+INSTALL_TARGETS		:= rpcinfo01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01 b/testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
similarity index 100%
rename from testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01
rename to testcases/network/rpc/basic_tests/rpcinfo/rpcinfo01.sh
diff --git a/testcases/network/rpc/basic_tests/rup/Makefile b/testcases/network/rpc/basic_tests/rup/Makefile
index 6b8386a..a4dee68 100644
--- a/testcases/network/rpc/basic_tests/rup/Makefile
+++ b/testcases/network/rpc/basic_tests/rup/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= rup01
+INSTALL_TARGETS		:= rup01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/rpc/basic_tests/rup/rup01 b/testcases/network/rpc/basic_tests/rup/rup01.sh
similarity index 100%
rename from testcases/network/rpc/basic_tests/rup/rup01
rename to testcases/network/rpc/basic_tests/rup/rup01.sh
diff --git a/testcases/network/rpc/basic_tests/rusers/Makefile b/testcases/network/rpc/basic_tests/rusers/Makefile
index 72715e3..b5f69f5 100644
--- a/testcases/network/rpc/basic_tests/rusers/Makefile
+++ b/testcases/network/rpc/basic_tests/rusers/Makefile
@@ -1,5 +1,5 @@
 #
-#    network/rpc/basic_tests/rusers01 test suite Makefile.
+#    network/rpc/basic_tests/rusers01.sh test suite Makefile.
 #
 #    Copyright (C) 2009, Cisco Systems Inc.
 #
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= rusers01
+INSTALL_TARGETS		:= rusers01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/rpc/basic_tests/rusers/rusers01 b/testcases/network/rpc/basic_tests/rusers/rusers01.sh
similarity index 100%
rename from testcases/network/rpc/basic_tests/rusers/rusers01
rename to testcases/network/rpc/basic_tests/rusers/rusers01.sh
diff --git a/testcases/network/rpc/rpc-tirpc/.gitignore b/testcases/network/rpc/rpc-tirpc/.gitignore
index adcd811..15b7c4d 100644
--- a/testcases/network/rpc/rpc-tirpc/.gitignore
+++ b/testcases/network/rpc/rpc-tirpc/.gitignore
@@ -140,7 +140,6 @@
 /tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt
 /tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_performance
 /tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall
-/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/tirpc_authdes_seccreate
 /tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_set/tirpc_rpcb_set
 /tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_weakauth/tirpc_svcerr_weakauth
 /tests_pack/rpc_suite/tirpc/tirpc_err_svcerr_systemerr/tirpc_svcerr_systemerr
@@ -176,7 +175,6 @@
 /tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control
 /tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_control/tirpc_clnt_control_limits
 /tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_tp_create/tirpc_clnt_tp_create
-/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/tirpc_authdes_create
 /tests_pack/rpc_suite/tirpc/tirpc_interlevel_svc_tp_create/tirpc_svc_tp_create
 /tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed
 /tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_create_timed/tirpc_clnt_create_timed_limits
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c
index c6a3ba4..17b9606 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_broadc_clnt_broadcast/rpc_clnt_broadcast_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c
index e849468..a83dd60 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
@@ -61,7 +62,7 @@
 		exit(-1);
 	}
 
-	bcopy(hp->h_addr, (caddr_t) & server_addr.sin_addr, hp->h_length);
+	memcpy((caddr_t) & server_addr.sin_addr, hp->h_addr, hp->h_length);
 	server_addr.sin_family = AF_INET;
 	server_addr.sin_port = 0;
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c
index 8c1800b..3bc2ae7 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_limits.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
@@ -72,7 +73,7 @@
 		exit(-1);
 	}
 
-	bcopy(hp->h_addr, (caddr_t) & server_addr.sin_addr, hp->h_length);
+	memcpy((caddr_t) & server_addr.sin_addr, hp->h_addr, hp->h_length);
 	server_addr.sin_family = AF_INET;
 	server_addr.sin_port = 0;
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_performance.c
index 0df43db..f9dda47 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_performance.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/time.h>
 #include <rpc/rpc.h>
 #include <netdb.h>
@@ -112,7 +113,7 @@
 		exit(5);
 	}
 
-	bcopy(hp->h_addr, (caddr_t) & server_addr.sin_addr, hp->h_length);
+	memcpy((caddr_t) & server_addr.sin_addr, hp->h_addr, hp->h_length);
 	server_addr.sin_family = AF_INET;
 	server_addr.sin_port = 0;
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c
index 384a00d..51d6412 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clnttcp_create/rpc_clnttcp_create_stress.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
@@ -65,7 +66,7 @@
 		exit(-1);
 	}
 
-	bcopy(hp->h_addr, (caddr_t) & server_addr.sin_addr, hp->h_length);
+	memcpy((caddr_t) & server_addr.sin_addr, hp->h_addr, hp->h_length);
 	server_addr.sin_family = AF_INET;
 	server_addr.sin_port = 0;
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c
index 285eb21..bbcecfe 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c
index 1f2690a..a0182db 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_bufcreate/rpc_clntudp_bufcreate_limits.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c
index faa8ef6..91f5b27 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_performance.c
index 2722730..a8df605 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_performance.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/time.h>
 #include <rpc/rpc.h>
 #include <netdb.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c
index 974f5fb..1cbe1e8 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_clntudp_create/rpc_clntudp_create_stress.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 #include <sys/socket.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcraw_create/rpc_svcraw_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcraw_create/rpc_svcraw_create.c
index e195c0e..004d1fa 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcraw_create/rpc_svcraw_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcraw_create/rpc_svcraw_create.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create.c
index 38eeabb..3f1b90a 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create_stress.c
index 241ffd7..d465f26 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svctcp_create/rpc_svctcp_create_stress.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_bufcreate/rpc_svcudp_bufcreate.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_bufcreate/rpc_svcudp_bufcreate.c
index 4e9955b..24f7142 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_bufcreate/rpc_svcudp_bufcreate.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_bufcreate/rpc_svcudp_bufcreate.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create.c
index 97fb875..19c2ac1 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create_stress.c
index 3b6b640..e9f5555 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svcudp_create/rpc_svcudp_create_stress.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
index 974c348..3778f36 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 #include <utmp.h>
 
 //Standard define
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c
index 63adef0..99129cf 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_register/rpc_svc_register.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c
index b52a337..8f0b6de 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_svc_unregister/rpc_svc_unregister.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c
index ea347b4..da3b930 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c
index 1d7151c..d0b7a20 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c
@@ -31,7 +31,6 @@
 #include <rpc/rpc.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/socketvar.h>
 
 //Standard define
 #define PROCNUM 1
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_callrpc/rpc_callrpc_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_callrpc/rpc_callrpc_dataint.c
index 407ebbe..149ffcc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_callrpc/rpc_callrpc_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_callrpc/rpc_callrpc_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_dataint.c
index 3cfa6b0..ca23e9f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_clnt_call/rpc_clnt_call_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c
index 38e6105..cdec0c0 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_freeargs/rpc_svc_freeargs_svc.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c
index 5ea06a0..c4860a5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_getargs/rpc_svc_getargs.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c
index 84a7117..e325823 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_stdcall_svc_sendreply/rpc_svc_sendreply.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <rpc/rpc.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/Makefile
deleted file mode 100644
index 23bf048..0000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#    Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
-#
-#    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.
-#
-
-top_srcdir		?= ../../../../../../../..
-
-include	$(top_srcdir)/include/mk/env_pre.mk
-include $(abs_srcdir)/../../../Makefile.inc
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/assertions.xml b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/assertions.xml
deleted file mode 100644
index 927fdbb..0000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/assertions.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<assertions>
-	<assertion id="1" tag="ef:XSH6TC2:3966:3967">
-	Basic call of TIRPC authdes_create() function
-	</assertion>
-</assertions>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/tirpc_authdes_create.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/tirpc_authdes_create.c
deleted file mode 100644
index bd52f5c..0000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_create/tirpc_authdes_create.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* Copyright (c) Bull S.A.  2007 All Rights Reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* Further, this software is distributed without any warranty that it is
-* free of the rightful claim of any third person regarding infringement
-* or the like.  Any license provided herein, whether implied or
-* otherwise, applies only to this software file.  Patent licenses, if
-* any, provided herein do not apply to combinations of this program with
-* other software, or any other product whatsoever.
-*
-* You should have received a copy of the GNU General Public License along
-* with this program; if not, write the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* History:
-* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
-*
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <netdb.h>
-#include "lapi/rpc.h"
-
-//Standard define
-#define PROCNUM 1
-#define VERSNUM 1
-
-int main(int argn, char *argc[])
-{
-	//Program parameters : argc[1] : HostName or Host IP
-	//                                         argc[2] : Server Program Number
-	//                                         other arguments depend on test case
-
-	int test_status = 1;	//Default test result set to FAILED
-	AUTH *authDes = NULL;
-	struct sockaddr server_addr;
-
-	//Initialization
-
-	authDes = authdes_create(argc[1], 60, &server_addr, NULL);
-
-	//If we are here, macro call was successful
-	test_status = ((AUTH *) authDes != NULL) ? 0 : 1;
-
-	//This last printf gives the result status to the tests suite
-	//normally should be 0: test has passed or 1: test has failed
-	printf("%d\n", test_status);
-
-	return test_status;
-}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/Makefile b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/Makefile
deleted file mode 100644
index 23bf048..0000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#    Copyright (C) 2014, Oracle and/or its affiliates. All Rights Reserved.
-#
-#    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.
-#
-
-top_srcdir		?= ../../../../../../../..
-
-include	$(top_srcdir)/include/mk/env_pre.mk
-include $(abs_srcdir)/../../../Makefile.inc
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/assertions.xml b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/assertions.xml
deleted file mode 100644
index a19e4c1..0000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/assertions.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<assertions>
-	<assertion id="1" tag="ef:XSH6TC2:3966:3967">
-	Basic call of TIRPC authdes_seccreate() function
-	</assertion>
-</assertions>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/tirpc_authdes_seccreate.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/tirpc_authdes_seccreate.c
deleted file mode 100644
index 87b07ec..0000000
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_auth_authdes_seccreate/tirpc_authdes_seccreate.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) Bull S.A.  2007 All Rights Reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it would be useful, but
-* WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-*
-* Further, this software is distributed without any warranty that it is
-* free of the rightful claim of any third person regarding infringement
-* or the like.  Any license provided herein, whether implied or
-* otherwise, applies only to this software file.  Patent licenses, if
-* any, provided herein do not apply to combinations of this program with
-* other software, or any other product whatsoever.
-*
-* You should have received a copy of the GNU General Public License along
-* with this program; if not, write the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* History:
-* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
-*
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <netdb.h>
-#include "lapi/rpc.h"
-
-//Standard define
-#define PROCNUM 1
-#define VERSNUM 1
-
-int main(int argn, char *argc[])
-{
-	//Program parameters : argc[1] : HostName or Host IP
-	//                                         argc[2] : Server Program Number
-	//                                         other arguments depend on test case
-
-	//run_mode can switch into stand alone program or program launch by shell script
-	//1 : stand alone, debug mode, more screen information
-	//0 : launch by shell script as test case, only one printf -> result status
-	int run_mode = 0;
-	int test_status = 1;	//Default test result set to FAILED
-	int progNum = atoi(argc[2]);
-	AUTH *authDes = NULL;
-	struct sockaddr server_addr;
-
-	//Initialization
-
-	authDes = authdes_seccreate(argc[1], 60, (char *)&server_addr, NULL);
-
-	//If we are here, macro call was successful
-	test_status = ((AUTH *) authDes != NULL) ? 0 : 1;
-
-	//This last printf gives the result status to the tests suite
-	//normally should be 0: test has passed or 1: test has failed
-	printf("%d\n", test_status);
-
-	return test_status;
-}
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c
index 22d9098..514c345 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c
index 708f8c3..7c41734 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c
index 361ce55..05d25ab 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_bottomlevel_clnt_call/tirpc_bottomlevel_clnt_call_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c
index fb2dbe0..1146827 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_complex.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c
index 9137324..26644e2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c
index bdce523..040f080 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c
index 6c17e70..ceedc19 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_clnt_call/tirpc_expertlevel_clnt_call_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c
index c25cec1..d0d1091 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_complex.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c
index a0c5471..ecb8d3c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c
index f61a33b..8cbe5b9 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c
index 447c716..405f9c2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_rpcb_rmtcall/tirpc_rpcb_rmtcall_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c
index 167890c..8473c04 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_reg/tirpc_svc_reg_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c
index d812509..00bcc88 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_expertlevel_svc_unreg/tirpc_svc_unreg_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c
index 945557a..3464ff2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_complex.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c
index 8b9ea2e..b9ed6da 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c
index f960d04..8e8bbc2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c
index e7cca3c..c40be76 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_interlevel_clnt_call/tirpc_interlevel_clnt_call_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c
index f8a9ea1..30ffd93 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c
index 3cd02e5..1e773a1 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c
index c6a6e2d..372f742 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast/tirpc_rpc_broadcast_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c
index bd574b1..b358af5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c
index 0a46127..65189fa 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c
index a40c2aa..dea6d82 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_broadcast_exp/tirpc_rpc_broadcast_exp_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c
index 257b108..1dc533d 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <errno.h>
 #include "lapi/rpc.h"
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c
index 6276f2f..5a44bf4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_complex.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c
index 780f5a0..6ff3851 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c
index 376ac0f..06ffdd2 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c
index 357d9d1..1a60975 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_performance.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c
index 73118cb..4641da7 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c
index 56b5ddb..264e24c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_call/tirpc_rpc_call_stress.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <errno.h>
 #include "lapi/rpc.h"
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c
index 6b6d500..b1eb843 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_simple_rpc_reg/tirpc_rpc_reg_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c
index 9ffb0ba..2f965e5 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_complex.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c
index e88663a..e94f203 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_dataint.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include "lapi/rpc.h"
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c
index 6f333ac..2ffaa82 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_mt.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <pthread.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c
index d2352b3..12664fc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/tirpc/tirpc_toplevel_clnt_call/tirpc_toplevel_clnt_call_scalability.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <pthread.h>
 #include <time.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c
index 63dd2f1..2757749 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <rpc/rpc.h>
 #include <utmp.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c
index 877db2a..a2d18cc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_2/rpc_svc_2.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <rpc/rpc.h>
 #include <utmp.h>
 
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c
index a93e831..121ae97 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_11/tirpc_svc_11.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include <netinet/in.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c
index e20b9b4..c28f412 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_3/tirpc_svc_3.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include "lapi/rpc.h"
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c
index 02d745c..566b6fc 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_4/tirpc_svc_4.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include "lapi/rpc.h"
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c
index 36003cb..ebf5777 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_5/tirpc_svc_5.c
@@ -27,6 +27,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include <netinet/in.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c
index 71a4753..1dd421e 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_6/tirpc_svc_6.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include <pthread.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c
index ea141f4..559ef7f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_7/tirpc_svc_7.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <errno.h>
 #include <netinet/in.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c
index 6c1c37b..fd516e4 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_8/tirpc_svc_8.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <pthread.h>
 #include <sys/socket.h>
 #include <errno.h>
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c
index a000ba2..2fd9b4f 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/tirpc_svc_9/tirpc_svc_9.c
@@ -26,6 +26,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 #include <pthread.h>
 #include <sys/socket.h>
 #include <errno.h>
diff --git a/testcases/network/sctp/sctp_big_chunk.c b/testcases/network/sctp/sctp_big_chunk.c
index 4ebdcb2..7b39765 100644
--- a/testcases/network/sctp/sctp_big_chunk.c
+++ b/testcases/network/sctp/sctp_big_chunk.c
@@ -182,5 +182,10 @@
 	.setup = setup,
 	.forks_child = 1,
 	.test_all = run,
-	.options = options
+	.options = options,
+	.tags = (const struct tst_tag[]) {
+		{"CVE", "2018-5803"},
+		{"linux-git", "07f2c7ab6f8d"},
+		{}
+	}
 };
diff --git a/testcases/network/stress/dccp/dccp_ipsec_vti.sh b/testcases/network/stress/dccp/dccp_ipsec_vti.sh
index 5c8f782..24c28fb 100755
--- a/testcases/network/stress/dccp/dccp_ipsec_vti.sh
+++ b/testcases/network/stress/dccp/dccp_ipsec_vti.sh
@@ -16,7 +16,7 @@
 	local rand_opt="$(echo $2 | cut -d'R' -f2)"
 
 	[ "$2" != "$rand_opt" ] && opts="-A $rand_opt"
-	tst_netload -H $ip_rmt_tun -T dccp $opts -r $IPSEC_REQUESTS
+	tst_netload -H $ip_rmt_tun -T dccp $opts -r $IPSEC_REQUESTS -D $tst_vti
 }
 
 tst_run
diff --git a/testcases/network/stress/dns/Makefile b/testcases/network/stress/dns/Makefile
index 10f00bf..a345f12 100644
--- a/testcases/network/stress/dns/Makefile
+++ b/testcases/network/stress/dns/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= dns*
+INSTALL_TARGETS		:= *.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/stress/dns/dns-stress b/testcases/network/stress/dns/dns-stress.sh
similarity index 95%
rename from testcases/network/stress/dns/dns-stress
rename to testcases/network/stress/dns/dns-stress.sh
index 5817681..dfc2ed5 100755
--- a/testcases/network/stress/dns/dns-stress
+++ b/testcases/network/stress/dns/dns-stress.sh
@@ -43,7 +43,7 @@
 common_setup()
 {
 	tst_require_root
-	tst_test_cmds named dig
+	tst_require_cmds named dig
 
 	if [ "$TST_IPV6" ]; then
 		record="AAAA"
@@ -180,7 +180,7 @@
 {
 	tst_resm TINFO "Handling name lookup queries '$NS_TIMES' times"
 
-	tst_rhost_run -s -c "dns-stress01-rmt $TST_IPVER $(tst_ipaddr) $port \
+	tst_rhost_run -s -c "dns-stress01-rmt.sh $TST_IPVER $(tst_ipaddr) $port \
 		$DOMAIN $MIN_ID $MAX_ID $NS_TIMES"
 
 	tst_resm TPASS "Test is finished successfully"
@@ -190,7 +190,7 @@
 {
 	tst_resm TINFO "Handling reverse lookup queries '$NS_TIMES' times"
 
-	tst_rhost_run -s -c "dns-stress02-rmt $TST_IPVER $(tst_ipaddr) $port $net \
+	tst_rhost_run -s -c "dns-stress02-rmt.sh $TST_IPVER $(tst_ipaddr) $port $net \
 		$MIN_ID $MAX_ID $NS_TIMES"
 
 	tst_resm TPASS "Test is finished successfully"
diff --git a/testcases/network/stress/dns/dns-stress01-rmt b/testcases/network/stress/dns/dns-stress01-rmt.sh
old mode 100644
new mode 100755
similarity index 100%
rename from testcases/network/stress/dns/dns-stress01-rmt
rename to testcases/network/stress/dns/dns-stress01-rmt.sh
diff --git a/testcases/network/stress/dns/dns-stress02-rmt b/testcases/network/stress/dns/dns-stress02-rmt.sh
old mode 100644
new mode 100755
similarity index 100%
rename from testcases/network/stress/dns/dns-stress02-rmt
rename to testcases/network/stress/dns/dns-stress02-rmt.sh
diff --git a/testcases/network/stress/ftp/Makefile b/testcases/network/stress/ftp/Makefile
index c0ea3d4..38cbd13 100644
--- a/testcases/network/stress/ftp/Makefile
+++ b/testcases/network/stress/ftp/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= ftp*
+INSTALL_TARGETS		:= *.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/stress/ftp/ftp-download-stress b/testcases/network/stress/ftp/ftp-download-stress.sh
old mode 100644
new mode 100755
similarity index 93%
rename from testcases/network/stress/ftp/ftp-download-stress
rename to testcases/network/stress/ftp/ftp-download-stress.sh
index 5ba67cf..4320bbd
--- a/testcases/network/stress/ftp/ftp-download-stress
+++ b/testcases/network/stress/ftp/ftp-download-stress.sh
@@ -42,7 +42,7 @@
 setup()
 {
 	tst_require_root
-	tst_test_cmds pkill vsftpd
+	tst_require_cmds pkill vsftpd
 	tst_tmpdir
 
 	tst_resm TINFO "run FTP over IPv$TST_IPVER"
@@ -70,7 +70,7 @@
 		tst_resm TBROK "Failed to create test file"
 
 	# Run the script at the remote host
-	tst_rhost_run -s -c "ftp-download-stress01-rmt \
+	tst_rhost_run -s -c "ftp-download-stress01-rmt.sh \
 		$(tst_ipaddr) ftp_file $DOWNLOAD_BIGFILESIZE"
 
 	tst_resm TPASS "Test is finished successfully"
@@ -83,7 +83,7 @@
 	create_file $FTP_DOWNLOAD_DIR/ftp_reg_file $DOWNLOAD_REGFILESIZE || \
 		tst_resm TBROK "Failed to create test file"
 
-	tst_rhost_run -s -c "ftp-download-stress02-rmt $(tst_ipaddr) \
+	tst_rhost_run -s -c "ftp-download-stress02-rmt.sh $(tst_ipaddr) \
 		ftp_reg_file $DOWNLOAD_REGFILESIZE \
 		$NS_DURATION $CONNECTION_TOTAL"
 
diff --git a/testcases/network/stress/ftp/ftp-download-stress01-rmt b/testcases/network/stress/ftp/ftp-download-stress01-rmt.sh
old mode 100644
new mode 100755
similarity index 98%
rename from testcases/network/stress/ftp/ftp-download-stress01-rmt
rename to testcases/network/stress/ftp/ftp-download-stress01-rmt.sh
index a87f2ac..54f43d0
--- a/testcases/network/stress/ftp/ftp-download-stress01-rmt
+++ b/testcases/network/stress/ftp/ftp-download-stress01-rmt.sh
@@ -28,7 +28,7 @@
 filename="$2"
 filesize="$3"
 
-tst_test_cmds curl
+tst_require_cmds curl
 
 echo $server_ipaddr | grep ':' > /dev/null
 if [ $? -eq 0 ]; then
diff --git a/testcases/network/stress/ftp/ftp-download-stress02-rmt b/testcases/network/stress/ftp/ftp-download-stress02-rmt.sh
old mode 100644
new mode 100755
similarity index 98%
rename from testcases/network/stress/ftp/ftp-download-stress02-rmt
rename to testcases/network/stress/ftp/ftp-download-stress02-rmt.sh
index 95a8a41..599d210
--- a/testcases/network/stress/ftp/ftp-download-stress02-rmt
+++ b/testcases/network/stress/ftp/ftp-download-stress02-rmt.sh
@@ -24,7 +24,7 @@
 
 . test.sh
 
-tst_test_cmds awk killall
+tst_require_cmds awk killall
 
 server_ipaddr="$1"
 filename="$2"
diff --git a/testcases/network/stress/ftp/ftp-upload-stress b/testcases/network/stress/ftp/ftp-upload-stress.sh
old mode 100644
new mode 100755
similarity index 93%
rename from testcases/network/stress/ftp/ftp-upload-stress
rename to testcases/network/stress/ftp/ftp-upload-stress.sh
index 637df2d..602dc4e
--- a/testcases/network/stress/ftp/ftp-upload-stress
+++ b/testcases/network/stress/ftp/ftp-upload-stress.sh
@@ -42,7 +42,7 @@
 setup()
 {
 	tst_require_root
-	tst_test_cmds pkill vsftpd
+	tst_require_cmds pkill vsftpd
 	tst_tmpdir
 
 	tst_resm TINFO "run FTP over IPv$TST_IPVER"
@@ -57,7 +57,7 @@
 	getenforce 2> /dev/null | grep -q Enforcing
 	if [ $? -eq 0 ]; then
 		tst_resm TINFO "configuring SELinux FTP parameters"
-		tst_test_cmds chcon setsebool
+		tst_require_cmds chcon setsebool
 		setsebool allow_ftpd_anon_write 1 || \
 			tst_brkm TBROK "Failed to allow ftpd anonymous write"
 		chcon -R -t public_content_rw_t $FTP_UPLOAD_DIR || \
@@ -81,7 +81,7 @@
 	tst_resm TINFO "upload file with size '$UPLOAD_BIGFILESIZE'"
 
 	# Run the script at the remote host
-	tst_rhost_run -s -c "ftp-upload-stress01-rmt $(tst_ipaddr) \
+	tst_rhost_run -s -c "ftp-upload-stress01-rmt.sh $(tst_ipaddr) \
 		$FTP_UPLOAD_URLDIR ftp_file $UPLOAD_BIGFILESIZE"
 
 	tst_resm TPASS "Test is finished successfully"
@@ -91,7 +91,7 @@
 {
 	tst_resm TINFO "Upload data asynchronously in $NS_DURATION sec"
 
-	tst_rhost_run -s -c "ftp-upload-stress02-rmt \
+	tst_rhost_run -s -c "ftp-upload-stress02-rmt.sh \
 		$(tst_ipaddr) $FTP_UPLOAD_URLDIR ftp_reg_file \
 		$UPLOAD_REGFILESIZE $NS_DURATION $CONNECTION_TOTAL"
 
diff --git a/testcases/network/stress/ftp/ftp-upload-stress01-rmt b/testcases/network/stress/ftp/ftp-upload-stress01-rmt.sh
old mode 100644
new mode 100755
similarity index 98%
rename from testcases/network/stress/ftp/ftp-upload-stress01-rmt
rename to testcases/network/stress/ftp/ftp-upload-stress01-rmt.sh
index 0042f09..d4a9fe9
--- a/testcases/network/stress/ftp/ftp-upload-stress01-rmt
+++ b/testcases/network/stress/ftp/ftp-upload-stress01-rmt.sh
@@ -30,7 +30,7 @@
 filename="$3"
 filesize="$4"
 
-tst_test_cmds curl
+tst_require_cmds curl
 
 cleanup()
 {
diff --git a/testcases/network/stress/ftp/ftp-upload-stress02-rmt b/testcases/network/stress/ftp/ftp-upload-stress02-rmt.sh
old mode 100644
new mode 100755
similarity index 98%
rename from testcases/network/stress/ftp/ftp-upload-stress02-rmt
rename to testcases/network/stress/ftp/ftp-upload-stress02-rmt.sh
index d266fb2..cba8f32
--- a/testcases/network/stress/ftp/ftp-upload-stress02-rmt
+++ b/testcases/network/stress/ftp/ftp-upload-stress02-rmt.sh
@@ -25,7 +25,7 @@
 
 . test.sh
 
-tst_test_cmds killall
+tst_require_cmds killall
 
 server_ipaddr="$1"
 urldir="$2"
diff --git a/testcases/network/stress/http/Makefile b/testcases/network/stress/http/Makefile
index ddc45c1..4529865 100644
--- a/testcases/network/stress/http/Makefile
+++ b/testcases/network/stress/http/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= http*
+INSTALL_TARGETS		:= *.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/stress/http/http-stress b/testcases/network/stress/http/http-stress.sh
old mode 100644
new mode 100755
similarity index 93%
rename from testcases/network/stress/http/http-stress
rename to testcases/network/stress/http/http-stress.sh
index ff617a2..31fe5af
--- a/testcases/network/stress/http/http-stress
+++ b/testcases/network/stress/http/http-stress.sh
@@ -58,7 +58,7 @@
 {
 	tst_resm TINFO "http client download test file"
 
-	tst_rhost_run -s -c "http-stress01-rmt $(tst_ipaddr) \
+	tst_rhost_run -s -c "http-stress01-rmt.sh $(tst_ipaddr) \
 		http_file $DOWNLOAD_BIGFILESIZE"
 
 	tst_resm TPASS "Test is finished successfully"
@@ -68,7 +68,7 @@
 {
 	tst_resm TINFO "clients request data asynchronously $NS_DURATION sec"
 
-	tst_rhost_run -s -c "http-stress02-rmt $(tst_ipaddr) http_file \
+	tst_rhost_run -s -c "http-stress02-rmt.sh $(tst_ipaddr) http_file \
 		$DOWNLOAD_BIGFILESIZE $NS_DURATION $CONNECTION_TOTAL"
 
 	tst_resm TPASS "Test is finished successfully"
diff --git a/testcases/network/stress/http/http-stress01-rmt b/testcases/network/stress/http/http-stress01-rmt.sh
old mode 100644
new mode 100755
similarity index 97%
rename from testcases/network/stress/http/http-stress01-rmt
rename to testcases/network/stress/http/http-stress01-rmt.sh
index 69abcf0..dcea686
--- a/testcases/network/stress/http/http-stress01-rmt
+++ b/testcases/network/stress/http/http-stress01-rmt.sh
@@ -24,7 +24,7 @@
 
 . test.sh
 
-tst_test_cmds awk curl
+tst_require_cmds awk curl
 
 # Check the arguments
 [ $# -ne 3 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename filesize"
diff --git a/testcases/network/stress/http/http-stress02-rmt b/testcases/network/stress/http/http-stress02-rmt.sh
old mode 100644
new mode 100755
similarity index 98%
rename from testcases/network/stress/http/http-stress02-rmt
rename to testcases/network/stress/http/http-stress02-rmt.sh
index 52efc92..1734c2b
--- a/testcases/network/stress/http/http-stress02-rmt
+++ b/testcases/network/stress/http/http-stress02-rmt.sh
@@ -24,7 +24,7 @@
 
 . test.sh
 
-tst_test_cmds awk curl
+tst_require_cmds awk curl
 
 if [ $# -ne 5 ]; then
 	tst_brkm TBROK "Usage: $0 server_addr fname fsize duration connections"
diff --git a/testcases/network/stress/interface/00_Descriptions.txt b/testcases/network/stress/interface/00_Descriptions.txt
index 5120f8b..cbf5554 100644
--- a/testcases/network/stress/interface/00_Descriptions.txt
+++ b/testcases/network/stress/interface/00_Descriptions.txt
@@ -1,27 +1,27 @@
-if-updown
+if-updown.sh
 	Verify the IPv4/IPv6 connectivity is not broken when ip/ifconfig
 	command ups, then downs an interface many times
 
-if4-addr-change
+if4-addr-change.sh
 	Verify the IPv4 connectivity is not broken when ifconfig
 	command changes address many times
 
-if-addr-adddel
+if-addr-adddel.sh
 	Verify the IPv4/IPv6 connectivity is not broken when ip/ifconfig adds,
 	then deletes an IPv4 alias many times
 
-if-addr-addlarge
+if-addr-addlarge.sh
 	Verify the IPv4/IPv6 connectivity is not broken when ip/ifconifg
 	creates many addresses
 
-if-route-adddel
+if-route-adddel.sh
 	Verify the IPv4/IPv6 connectivity is not broken when the ip/route adds,
 	then and deletes an IPv4/IPv6 route many times
 
-if-route-addlarge
+if-route-addlarge.sh
 	Verify the IPv4/IPv6 connectivity is not broken when the ip/route
 	creates many routes
 
-if-mtu-change
+if-mtu-change.sh
 	Verify the IPv4/IPv6 connectivity is not broken when ip/ifconfig
 	changes MTU many times every 5 seconds
diff --git a/testcases/network/stress/interface/Makefile b/testcases/network/stress/interface/Makefile
index 86ba1e9..31072d5 100644
--- a/testcases/network/stress/interface/Makefile
+++ b/testcases/network/stress/interface/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= if*
+INSTALL_TARGETS		:= *.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/stress/interface/if-addr-adddel b/testcases/network/stress/interface/if-addr-adddel.sh
old mode 100644
new mode 100755
similarity index 74%
rename from testcases/network/stress/interface/if-addr-adddel
rename to testcases/network/stress/interface/if-addr-adddel.sh
index 8e3990f..f8f0d11
--- a/testcases/network/stress/interface/if-addr-adddel
+++ b/testcases/network/stress/interface/if-addr-adddel.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
 IF_CMD='ifconfig'
diff --git a/testcases/network/stress/interface/if-addr-addlarge b/testcases/network/stress/interface/if-addr-addlarge.sh
old mode 100644
new mode 100755
similarity index 78%
rename from testcases/network/stress/interface/if-addr-addlarge
rename to testcases/network/stress/interface/if-addr-addlarge.sh
index 78641e4..3cf7397
--- a/testcases/network/stress/interface/if-addr-addlarge
+++ b/testcases/network/stress/interface/if-addr-addlarge.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
 IF_CMD='ifconfig'
diff --git a/testcases/network/stress/interface/if-lib.sh b/testcases/network/stress/interface/if-lib.sh
index c247dcd..b398be1 100644
--- a/testcases/network/stress/interface/if-lib.sh
+++ b/testcases/network/stress/interface/if-lib.sh
@@ -1,22 +1,17 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
-#
-# 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 would 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 the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
 # Author: Petr Vorel <pvorel@suse.cz>
 
+CMD="${CMD:-ip}"
+
+TST_SETUP="${TST_SETUP:-if_setup}"
+TST_TESTFUNC="test_body"
+TST_PARSE_ARGS="if_parse_args"
+TST_USAGE="if_usage"
+TST_OPTS="c:"
+. tst_net_stress.sh
+
 if_usage()
 {
 	echo "-c      Test command (ip, $IF_CMD)"
@@ -31,12 +26,11 @@
 
 if_setup()
 {
-	[ -n "$CMD" ] || tst_brk TBROK "IF_CMD variable not defined"
 	if [ "$CMD" != 'ip' -a "$CMD" != "$IF_CMD" ]; then
 		tst_brk TBROK "Missing or wrong -c parameter: '$CMD', use 'ip' or '$IF_CMD'"
 	fi
 
-	tst_test_cmds "$CMD"
+	tst_require_cmds "$CMD"
 	netstress_setup
 	TST_CLEANUP="${TST_CLEANUP:-netstress_cleanup}"
 }
@@ -47,11 +41,3 @@
 	restore_ipaddr
 	restore_ipaddr rhost
 }
-
-TST_SETUP="${TST_SETUP:-if_setup}"
-TST_TESTFUNC="test_body"
-TST_PARSE_ARGS="if_parse_args"
-TST_USAGE="if_usage"
-TST_OPTS="c:"
-
-. tst_net_stress.sh
diff --git a/testcases/network/stress/interface/if-mtu-change b/testcases/network/stress/interface/if-mtu-change.sh
old mode 100644
new mode 100755
similarity index 74%
rename from testcases/network/stress/interface/if-mtu-change
rename to testcases/network/stress/interface/if-mtu-change.sh
index 19bcffe..b945fb6
--- a/testcases/network/stress/interface/if-mtu-change
+++ b/testcases/network/stress/interface/if-mtu-change.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
 IF_CMD='ifconfig'
@@ -26,6 +13,8 @@
 # The interval of the mtu change [second]
 CHANGE_INTERVAL=${CHANGE_INTERVAL:-5}
 
+TST_TIMEOUT=$(((CHANGE_INTERVAL + 30) * MTU_CHANGE_TIMES))
+
 # The array of the value which MTU is changed into sequentially
 # 552 - net.ipv4.route.min_pmtu
 CHANGE_VALUES="784 1142 552 1500 552 1500 552 748 552 1142 1500"
diff --git a/testcases/network/stress/interface/if-route-adddel b/testcases/network/stress/interface/if-route-adddel.sh
old mode 100644
new mode 100755
similarity index 69%
rename from testcases/network/stress/interface/if-route-adddel
rename to testcases/network/stress/interface/if-route-adddel.sh
index 4ca523e..45ca5d5
--- a/testcases/network/stress/interface/if-route-adddel
+++ b/testcases/network/stress/interface/if-route-adddel.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
 IF_CMD='route'
diff --git a/testcases/network/stress/interface/if-route-addlarge b/testcases/network/stress/interface/if-route-addlarge.sh
old mode 100644
new mode 100755
similarity index 72%
rename from testcases/network/stress/interface/if-route-addlarge
rename to testcases/network/stress/interface/if-route-addlarge.sh
index f522f9a..14de3f6
--- a/testcases/network/stress/interface/if-route-addlarge
+++ b/testcases/network/stress/interface/if-route-addlarge.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
 IF_CMD='route'
diff --git a/testcases/network/stress/interface/if-updown b/testcases/network/stress/interface/if-updown.sh
old mode 100644
new mode 100755
similarity index 62%
rename from testcases/network/stress/interface/if-updown
rename to testcases/network/stress/interface/if-updown.sh
index d5f3218..094e57a
--- a/testcases/network/stress/interface/if-updown
+++ b/testcases/network/stress/interface/if-updown.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
 IF_CMD='ifconfig'
diff --git a/testcases/network/stress/interface/if4-addr-change b/testcases/network/stress/interface/if4-addr-change.sh
old mode 100644
new mode 100755
similarity index 64%
rename from testcases/network/stress/interface/if4-addr-change
rename to testcases/network/stress/interface/if4-addr-change.sh
index 5ab6775..5af8fb9
--- a/testcases/network/stress/interface/if4-addr-change
+++ b/testcases/network/stress/interface/if4-addr-change.sh
@@ -1,24 +1,10 @@
 #!/bin/sh
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015-2016 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines  Corp., 2005
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
+# Copyright (c) International Business Machines Corp., 2005
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 
-TCID=if4-addr-change
 TST_CLEANUP="do_cleanup"
 TST_TESTFUNC="test_body"
 TST_NEEDS_CMDS="ifconfig"
@@ -38,7 +24,7 @@
 {
 	local cnt=0
 	local num=1
-	local add_to_net=
+	local add_to_net
 
 	tst_res TINFO "ifconfig changes IPv4 address $NS_TIMES times"
 
diff --git a/testcases/network/stress/multicast/grp-operation/mcast-lib.sh b/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
index 18e843d..381ab6b 100644
--- a/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
+++ b/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
@@ -1,20 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) International Business Machines  Corp., 2006
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
+# Copyright (c) International Business Machines Corp., 2006
 # Author: Petr Vorel <pvorel@suse.cz>
 #
 # Setup script for multicast stress tests.
diff --git a/testcases/network/stress/ns-tools/ns-common.c b/testcases/network/stress/ns-tools/ns-common.c
index 9b4263c..22a923b 100644
--- a/testcases/network/stress/ns-tools/ns-common.c
+++ b/testcases/network/stress/ns-tools/ns-common.c
@@ -358,7 +358,7 @@
  *  by interface index
  *
  * Argument:
- *   lla_p  : pointer to a sockaddr_in6 sturcture which stores the lla
+ *   lla_p  : pointer to a sockaddr_in6 structure which stores the lla
  *  ifindex : index of the interface
  *
  * Return value:
diff --git a/testcases/network/stress/ns-tools/tst_net_stress.sh b/testcases/network/stress/ns-tools/tst_net_stress.sh
index 66c1ffb..ae040bc 100644
--- a/testcases/network/stress/ns-tools/tst_net_stress.sh
+++ b/testcases/network/stress/ns-tools/tst_net_stress.sh
@@ -1,21 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines  Corp., 2006
-#
-# 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 would 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, see <http://www.gnu.org/licenses/>.
-#
+# Copyright (c) International Business Machines Corp., 2006
 # Author: Petr Vorel <pvorel@suse.cz>
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 #
@@ -39,7 +26,7 @@
 netstress_setup()
 {
 	TST_NEEDS_ROOT=1
-	tst_test_cmds pgrep pkill
+	tst_require_cmds pgrep pkill
 }
 
 # Cleanup for tests using netstress.
diff --git a/testcases/network/stress/route/00_Descriptions.txt b/testcases/network/stress/route/00_Descriptions.txt
index 2a871fd..e0e2e42 100644
--- a/testcases/network/stress/route/00_Descriptions.txt
+++ b/testcases/network/stress/route/00_Descriptions.txt
@@ -1,26 +1,14 @@
-route4-change-dst01
-	Verify the kernel is not crashed when the destination of an IPv4 route
-	is changed frequently by route command
+route{4,6}-change-dst
+	Verify the IPv4/IPv6 is not broken when ip command changes route
+	destination many times
 
-route4-change-dst02
-	Verify the kernel is not crashed when the destination of an IPv4 route
-	is changed frequently by ip command
+route{4,6}-change-gw
+	Verify the IPv4/IPv6 is not broken when ip command changes route
+	gateway many times
 
-route4-change-gw01
-	Verify the kernel is not crashed when the gateway of an IPv4 route is
-	changed frequently by route command
-
-route4-change-gw02
-	Verify the kernel is not crashed when the gateway of an IPv4 route is
-	changed frequently by ip command
-
-route4-change-if01
-	Verify the kernel is not crashed when the interface of an IPv4 route is
-	changed frequently by route command
-
-route4-change-if02
-	Verify the kernel is not crashed when the interface of an IPv4 route is
-	changed frequently by ip command
+route{4,6}-change-if
+	Verify the IPv4/IPv6 is not broken when ip command changes route
+	interface many times
 
 route4-redirect01
 	Verify the kernel is not crashed when the IPv4 route is modified by
@@ -35,30 +23,6 @@
 	then it is deleted by the removing network driver
 
 
-route6-change-dst01
-	Verify the kernel is not crashed when the destination of an IPv6 route
-	is changed frequently by route command
-
-route6-change-dst02
-	Verify the kernel is not crashed when the destination of an IPv6 route
-	is changed frequently by ip command
-
-route6-change-gw01
-	Verify the kernel is not crashed when the gateway of an IPv6 route is
-	changed frequently by route command
-
-route6-change-gw02
-	Verify the kernel is not crashed when the gateway of an IPv6 route is
-	changed frequently by ip command
-
-route6-change-if01
-	Verify the kernel is not crashed when the interface of an IPv6 route is
-	changed frequently by route command
-
-route6-change-if02
-	Verify the kernel is not crashed when the interface of an IPv6 route is
-	changed frequently by ip command
-
 route6-redirect01
 	Verify the kernel is not crashed when the IPv6 route is modified by
 	ICMP Redirects frequently
diff --git a/testcases/network/stress/route/route-change-dst.sh b/testcases/network/stress/route/route-change-dst.sh
new file mode 100755
index 0000000..fff79fa
--- /dev/null
+++ b/testcases/network/stress/route/route-change-dst.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+# Rewrite into new shell API: Petr Vorel
+#
+# Change route destination
+# lhost: 10.0.0.2, rhost: 10.23.x.1
+
+TST_TESTFUNC="test_dst"
+. route-lib.sh
+
+setup()
+{
+	tst_res TINFO "change IPv$TST_IPVER route destination $NS_TIMES times"
+}
+
+test_dst()
+{
+	local iface="$(tst_iface)"
+	local rt="$(tst_ipaddr_un -p $1)"
+	local rhost="$(tst_ipaddr_un $1 1)"
+
+	tst_res TINFO "testing route '$rt'"
+
+	tst_add_ipaddr -s -q -a $rhost rhost
+	ROD ip route add $rt dev $iface
+	EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $(tst_ipaddr) $rhost \>/dev/null
+	ROD ip route del $rt dev $iface
+	tst_del_ipaddr -s -q -a $rhost rhost
+}
+
+tst_run
diff --git a/testcases/network/stress/route/route-change-gw.sh b/testcases/network/stress/route/route-change-gw.sh
new file mode 100755
index 0000000..d9eeb81
--- /dev/null
+++ b/testcases/network/stress/route/route-change-gw.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+# Rewrite into new shell API: Petr Vorel
+#
+# Change route gateway
+# lhost: 10.23.x.2, gw (on rhost): 10.23.x.1, rhost: 10.23.0.1
+
+TST_TESTFUNC="test_gw"
+. route-lib.sh
+
+setup()
+{
+	tst_res TINFO "change IPv$TST_IPVER route gateway $NS_TIMES times"
+
+	rt="$(tst_ipaddr_un -p 0 0)"
+	lhost="$(tst_ipaddr_un 1 1)"
+	rhost="$(tst_ipaddr_un 0 1)"
+	tst_add_ipaddr -s -q -a $lhost
+	tst_add_ipaddr -s -q -a $rhost rhost
+}
+
+test_gw()
+{
+	local gw="$(tst_ipaddr_un -h 2,254 1 $(($1 + 1)))"
+	local iface="$(tst_iface)"
+
+	tst_res TINFO "testing route over gateway '$gw'"
+
+	tst_add_ipaddr -s -q -a $gw rhost
+	ROD ip route add $rt dev $iface via $gw
+	EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $lhost $rhost \>/dev/null
+	ROD ip route del $rt dev $iface via $gw
+	tst_del_ipaddr -s -q -a $gw rhost
+}
+
+tst_run
diff --git a/testcases/network/stress/route/route-change-if.sh b/testcases/network/stress/route/route-change-if.sh
new file mode 100755
index 0000000..75d70e9
--- /dev/null
+++ b/testcases/network/stress/route/route-change-if.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines Corp., 2006
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# Change route interface
+# lhost: 10.23.x.2, gw (on rhost): 10.23.x.1, rhost: 10.23.0.1, switching ifaces on lhost
+
+TST_TESTFUNC="test_if"
+. route-lib.sh
+TST_CLEANUP="cleanup"
+
+add_macvlan()
+{
+	local action="add"
+	local OPTIND
+	while getopts d opt; do
+		case "$opt" in
+		d) action="del";;
+		esac
+	done
+	shift $((OPTIND - 1))
+
+	local iface="$1"
+	local type="${2:-lhost}"
+
+	cmd="ip link $action $iface link $(tst_iface $type) type macvlan mode bridge"
+	if [ $type = "lhost" ]; then
+		ROD $cmd
+		[ "$action" = "add" ] || return
+		LHOST_IFACES="$LHOST_IFACES $iface"
+	else
+		tst_rhost_run -s -c "$cmd"
+		[ "$action" = "add" ] || return
+		RHOST_IFACES="$RHOST_IFACES $iface"
+	fi
+	tst_init_iface $type 1
+}
+
+setup()
+{
+	tst_res TINFO "change IPv$TST_IPVER route interface $NS_TIMES times"
+
+	rt="$(tst_ipaddr_un -p 0)"
+	rhost="$(tst_ipaddr_un 0 1)"
+	tst_add_ipaddr -s -q -a $rhost rhost
+
+	if [ $(tst_get_ifaces_cnt) -lt 2 ]; then
+		new_liface="ltp_mv2"
+		tst_res TINFO "2 or more local ifaces required, adding $new_liface"
+		add_macvlan $new_liface
+	fi
+
+	if [ $(tst_get_ifaces_cnt rhost) -lt 2 ]; then
+		new_riface="ltp_mv1"
+		tst_res TINFO "2 or more remote ifaces required, adding $new_riface"
+		add_macvlan $new_riface rhost
+	fi
+
+
+}
+
+test_if()
+{
+	local gw="$(tst_ipaddr_un -n1 $1 1)"
+	local lhost="$(tst_ipaddr_un -n1 $1 2)"
+	local link_num="$(($1 % $(tst_get_ifaces_cnt)))"
+	local iface="$(tst_iface lhost $link_num)"
+
+	tst_res TINFO "testing route over interface '$iface' with gateway '$gw'"
+
+	tst_add_ipaddr -s -q -a $lhost lhost $link_num
+	tst_add_ipaddr -s -q -a $gw rhost $link_num
+	ROD ip route add $rt dev $iface via $gw
+	EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $lhost $rhost \>/dev/null
+	ROD ip route del $rt dev $iface via $gw
+	tst_del_ipaddr -s -q -a $lhost lhost $link_num
+	tst_del_ipaddr -s -q -a $gw rhost $link_num
+}
+
+cleanup()
+{
+	[ "$new_liface" ] && add_macvlan -d $new_liface
+	[ "$new_riface" ] && add_macvlan -d $new_riface rhost
+	route_cleanup
+}
+
+tst_run
diff --git a/testcases/network/stress/route/route-lib.sh b/testcases/network/stress/route/route-lib.sh
new file mode 100644
index 0000000..4afbe63
--- /dev/null
+++ b/testcases/network/stress/route/route-lib.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2019 Petr Vorel <pvorel@suse.cz>
+
+TST_NEEDS_ROOT=1
+TST_SETUP="setup"
+TST_CLEANUP="route_cleanup"
+TST_NEEDS_CMDS="ip"
+TST_CNT=$NS_TIMES
+
+. tst_net.sh
+
+route_cleanup()
+{
+	tst_restore_ipaddr
+	tst_restore_ipaddr rhost
+}
diff --git a/testcases/network/stress/route/route4-change-dst b/testcases/network/stress/route/route4-change-dst
deleted file mode 100644
index 8ec6061..0000000
--- a/testcases/network/stress/route/route4-change-dst
+++ /dev/null
@@ -1,276 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
-#
-# File:
-#   route4-change-dst
-#
-# Description:
-#   Verify the kernel is not crashed when the destination of an IPv4 route is
-#   changed frequently
-#    test01 - by route command
-#    test02 - by ip command
-#
-# Setup:
-#   See testcases/network/stress/README
-#
-# Author:
-#   Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-#	Mar 16 2006 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# Default of the test case ID and the test case count
-TCID=route4-change-dst
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-# Network portion of the IPv4 address
-IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of for the tested network
-IPV4_NETMASK="255.255.255.0"
-IPV4_NETMASK_NUM=24
-
-# Broadcast address of the tested network
-IPV4_BROADCAST=${IPV4_NETWORK}.255
-
-# Host portion of the IPv4 address
-LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}	# src
-RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}	# gateway
-
-# The destination network
-DST_NETWORK_PREFIX="10.10"	# destination network would be 10.10.n.0/24
-DST_HOST="5"
-DST_PORT="7"
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_setup
-#
-# DESCRIPTION:
-#   Make a IPv4 connectivity
-#
-# SET VALUES:
-#   rhost_ipv4addr	- IPv4 Address of the remote host
-#   lhost_ifname	- Interface name of the local host
-#   rhost_ifname	- Interface name of the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
-    TCID=route4-change-dst
-    TST_COUNT=0
-
-    # Initialize the interfaces of the remote host
-    initialize_if rhost ${LINK_NUM}
-
-    # Set IPv4 address to the interfaces
-    set_ipv4addr rhost ${LINK_NUM} ${IPV4_NETWORK} ${RHOST_IPV4_HOST}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to add an IPv4 address the remote host"
-	exit $TST_TOTAL
-    fi
-
-    # IPv4 address of the remote host (gateway)
-    rhost_ipv4addr="${IPV4_NETWORK}.${RHOST_IPV4_HOST}"
-
-    # Get the Interface name of local host
-    lhost_ifname=`get_ifname lhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the local host"
-	exit $TST_TOTAL
-    fi
-
-    # Get the Interface name of remote host
-    rhost_ifname=`get_ifname rhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the remote host"
-	exit $TST_TOTAL
-    fi
-}
-
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_cleanup
-#
-# DESCRIPTION:
-#   Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Initialize the interfaces
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:
-#   test_body
-#
-# DESCRIPTION:
-#   main code of the test
-#
-# Arguments:
-#   $1: define the test type
-#       1 - route command case
-#       2 - ip command case
-#
-#-----------------------------------------------------------------------
-test_body()
-{
-    test_type=$1
-
-    TCID=route4-change-dst0${test_type}
-    TST_COUNT=$test_type
-
-    case $test_type in
-	1)
-	test_command="route"
-	;;
-	2)
-	test_command="ip"
-	;;
-	*)
-	tst_resm TBROK "unspecified case"
-	return 1
-	;;
-    esac
-
-    tst_resm TINFO "Verify the kernel is not crashed when the destination of an IPv4 route is changed frequently by $test_command command in $NS_TIMES times"
-
-    # Initialize the interface of the local host
-    initialize_if lhost ${LINK_NUM}
-
-    # Assign IPv4 address to the interface of the local host
-    set_ipv4addr lhost ${LINK_NUM} ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to assign an IPv4 address at the local host"
-	return 1
-    fi
-    lhost_ipv4addr="${IPV4_NETWORK}.${LHOST_IPV4_HOST}"
-
-    # Check the connectivity to the gateway
-    check_icmpv4_connectivity $lhost_ifname $rhost_ipv4addr
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Test Link $LINK_NUM is somthing wrong."
-	return 1
-    fi
-
-    # Start the loop
-    cnt=0
-    while [ $cnt -lt $NS_TIMES ]; do
-	# Define the destination IP address
-	dst_network_postfix=`expr $cnt % 255`
-	dst_addr=${DST_NETWORK_PREFIX}.${dst_network_postfix}.${DST_HOST}
-	dst_network=${DST_NETWORK_PREFIX}.${dst_network_postfix}.0
-
-	# Add the route
-	case $test_type in
-	    1)
-	    route add -net $dst_network netmask 255.255.255.0 gw $rhost_ipv4addr dev $lhost_ifname
-	    ;;
-	    2)
-	    ip route add ${dst_network}/24 via $rhost_ipv4addr dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to add the route to ${dst_network}/24"
-	    return 1
-	fi
-
-	# Load the route with UDP datagram
-	ns-udpsender -f 4 -D $dst_addr -p $DST_PORT -o -s 1472
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to run a UDP datagram sender"
-	    return 1
-	fi
-
-	# Delete the route
-	case $test_type in
-	    1)
-	    route del -net $dst_network netmask 255.255.255.0 gw $rhost_ipv4addr dev $lhost_ifname
-	    ;;
-	    2)
-	    ip route del ${dst_network}/24 via $rhost_ipv4addr dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Cannot delete the route to ${ADDDEL_ROUTE}"
-	    return 1
-	fi
-
-	cnt=`expr $cnt + 1`
-    done
-
-    tst_resm TPASS "Test is finished correctly."
-    return 0
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-#   The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test_body 1 || RC=`expr $RC + 1`      # Case of route command
-test_body 2 || RC=`expr $RC + 1`      # Case of ip command
-do_cleanup
-
-exit $RC
diff --git a/testcases/network/stress/route/route4-change-gw b/testcases/network/stress/route/route4-change-gw
deleted file mode 100644
index 791f98c..0000000
--- a/testcases/network/stress/route/route4-change-gw
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
-#
-# File:
-#   route4-change-gw
-#
-# Description:
-#   Verify the kernel is not crashed when the gateway of an IPv4 route is
-#   changed frequently
-#    test01 - by route command
-#    test02 - by ip command
-#
-# Setup:
-#   See testcases/network/stress/README
-#
-# Author:
-#   Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-#	Mar 16 2006 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# Default of the test case ID and the test case count
-TCID=route4-change-gw
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-# Network portion of the IPv4 address
-IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of for the tested network
-IPV4_NETMASK_NUM=24
-
-# Broadcast address of the tested network
-IPV4_BROADCAST=${IPV4_NETWORK}.255
-
-# Host portion of the IPv4 address
-LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"1"}	# src
-RHOST_IPV4_HOST_TOP="10"	# gateway
-RHOST_IPV4_HOST_LAST=19
-
-# The destination network
-DST_NETWORK="10.10.0"	# destination network would be 10.10.0.0/24
-DST_HOST="5"
-DST_PORT="7"
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_setup
-#
-# DESCRIPTION:
-#   Make a IPv4 connectivity
-#
-# SET VALUES:
-#   rhost_ipv4addr	- IPv4 Address of the remote host
-#   lhost_ifname	- Interface name of the local host
-#   rhost_ifname	- Interface name of the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
-    TCID=route4-change-gw
-    TST_COUNT=0
-
-    # Get the Interface name of local host
-    lhost_ifname=`get_ifname lhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the local host"
-	exit $TST_TOTAL
-    fi
-
-    # Get the Interface name of remote host
-    rhost_ifname=`get_ifname rhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the remote host"
-	exit $TST_TOTAL
-    fi
-
-    # Initialize the interfaces of the remote host
-    initialize_if rhost ${LINK_NUM}
-
-    # Set IPv4 address to the interface of the remote host
-    rhost_part=$RHOST_IPV4_HOST_TOP
-    while [ $rhost_part -le $RHOST_IPV4_HOST_LAST ]; do
-	ret=`$LTP_RSH $RHOST '( PATH=/sbin:/usr/sbin:$PATH ; ip addr add '${IPV4_NETWORK}.${rhost_part}/${IPV4_NETMASK_NUM}' broadcast '${IPV4_NETWORK}'.255 dev '$rhost_ifname' ) > /dev/null ; echo $?'`
-	if [ $ret -ne 0 ]; then
-	    tst_resm TBROK "Failed to assign IP address to the interface at the remote host"
-	    exit $TST_TOTAL
-	fi
-	rhost_part=`expr $rhost_part + 1`
-    done
-}
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_cleanup
-#
-# DESCRIPTION:
-#   Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
-    # Initialize the interfaces
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:
-#   test_body
-#
-# DESCRIPTION:
-#   main code of the test
-#
-# Arguments:
-#   $1: define the test type
-#       1 - route command case
-#       2 - ip command case
-#
-#-----------------------------------------------------------------------
-test_body()
-{
-    test_type=$1
-
-    TCID=route4-change-gw0${test_type}
-    TST_COUNT=$test_type
-
-    case $test_type in
-	1)
-	test_command="route"
-	;;
-	2)
-	test_command="ip"
-	;;
-	*)
-	tst_resm TBROK "unspecified case"
-	return 1
-	;;
-    esac
-
-    tst_resm TINFO "Verify the kernel is not crashed when the gateway of an IPv4 route is changed frequently by $test_command command in $NS_TIMES times"
-
-    # Initialize the interface of the local host
-    initialize_if lhost ${LINK_NUM}
-
-    # Assign IPv4 address to the interface of the local host
-    set_ipv4addr lhost ${LINK_NUM} ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to assign an IPv4 address at the local host"
-	return 1
-    fi
-
-    # Check the connectivity to the gateway
-    rhost_part=$RHOST_IPV4_HOST_TOP
-    check_icmpv4_connectivity $lhost_ifname ${IPV4_NETWORK}.${rhost_part}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Test Link $LINK_NUM is somthing wrong."
-	return 1
-    fi
-
-    # Set the variables regarding the destination host
-    dst_addr=${DST_NETWORK}.${DST_HOST}
-    dst_network=${DST_NETWORK}.0
-
-    # Set the first route
-    case $test_type in
-	1)
-	route add -net $dst_network netmask 255.255.255.0 gw ${IPV4_NETWORK}.${rhost_part} dev $lhost_ifname
-	;;
-	2)
-	ip route add ${dst_network}/24 via ${IPV4_NETWORK}.${rhost_part} dev $lhost_ifname
-	;;
-    esac
-
-    # Load the route with UDP traffic
-    ns-udpsender -f 4 -D $dst_addr -p $DST_PORT -b -s 1472
-    if [ $? -ne 0 ]; then
-	tst_resm TFAIL "Failed to run a UDP datagram sender"
-	return 1
-    fi
-
-    # Loop for changing the route
-    cnt=0
-    while [ $cnt -lt $NS_TIMES ]; do
-	pre_rhost_part=$rhost_part
-	rhost_part=`expr $rhost_part + 1`
-	if [ $rhost_part -gt $RHOST_IPV4_HOST_LAST ]; then
-	    rhost_part=$RHOST_IPV4_HOST_TOP
-	fi
-
-	case $test_type in
-	    1)
-	    route add -net $dst_network netmask 255.255.255.0 gw ${IPV4_NETWORK}.${rhost_part} dev $lhost_ifname
-	    route del -net $dst_network netmask 255.255.255.0 gw ${IPV4_NETWORK}.${pre_rhost_part} dev $lhost_ifname
-	    ;;
-	    2)
-	    ip route change ${dst_network}/24 via ${IPV4_NETWORK}.${rhost_part} dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to change the gateway to ${IPV4_NETWORK}.${rhost_part}"
-	    return 1
-	fi
-
-	# Rerun if udp datagram sender is dead
-	ps auxw | fgrep -v grep | grep ns-udpsender > /dev/null
-	if [ $? -ne 0 ]; then
-	    ns-udpsender -f 4 -D $dst_addr -p $DST_PORT -b -s 1472
-	    if [ $? -ne 0 ]; then
-		tst_resm TFAIL "Failed to run a UDP datagram sender"
-		return 1
-	    fi
-	fi
-
-	cnt=`expr $cnt + 1`
-    done
-
-    # Kill the udp datagram sender
-    killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
-    tst_resm TPASS "Test is finished correctly."
-    return 0
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-#   The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test_body 1 || RC=`expr $RC + 1`      # Case of route command
-test_body 2 || RC=`expr $RC + 1`      # Case of ip command
-do_cleanup
-
-exit $RC
diff --git a/testcases/network/stress/route/route4-change-if b/testcases/network/stress/route/route4-change-if
deleted file mode 100644
index 8753203..0000000
--- a/testcases/network/stress/route/route4-change-if
+++ /dev/null
@@ -1,324 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
-#
-# File:
-#   route4-change-if
-#
-# Description:
-#   Verify the kernel is not crashed when the interface of an IPv4 route is
-#   changed frequently
-#    test01 - by route command
-#    test02 - by ip command
-#
-# Setup:
-#   See testcases/network/stress/README
-#
-# Author:
-#   Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-#	Mar 17 2006 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# Default of the test case ID and the test case count
-TCID=route4-change-if
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
-
-# The first 2 ocnted of the Network portion of the gateway address
-IPV4_NETWORK_PRE=${IPV4_NETWORK_PRE:-"10.0"}
-
-# Netmask of for the gateway
-IPV4_NETMASK_NUM=24
-
-# Host portion of the IPv4 address
-LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}	# src
-RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}	# gateway
-
-# The destination network
-DST_NETWORK="10.10.0"	# destination network would be 10.10.0.0/24
-DST_HOST="5"
-DST_PORT="7"
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_setup
-#
-# DESCRIPTION:
-#   Make a IPv4 connectivity
-#
-# SET VALUES:
-#   rhost_ipv4addr	- IPv4 Address of the remote host
-#   lhost_ifname	- Interface name of the local host
-#   rhost_ifname	- Interface name of the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
-    TCID=route4-change-if
-    TST_COUNT=0
-
-    # Get the number of the test links
-    link_total=`echo $LHOST_HWADDRS | wc -w`
-    rhost_link_total=`echo $RHOST_HWADDRS | wc -w`
-    if [ $link_total -ne $rhost_link_total ]; then
-	tst_resm TBROK "The number of element in LHOST_HWADDRS differs from RHOST_HWADDRS"
-	exit $TST_TOTAL
-    fi
-    if [ $link_total -lt 2 ]; then
-	tst_resm TBROK "This test case requires plural Test Links"
-	exit $TST_TOTAL
-    fi
-
-    lhost_ifname_array=""
-    rhost_ifname_array=""
-    link_num=0
-    while [ $link_num -lt $link_total ]; do
-	# Get the Interface names of the local host
-	lhost_ifname=`get_ifname lhost ${link_num}`
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to get the interface name at the local host"
-	    exit $TST_TOTAL
-	fi
-	lhost_ifname_array="$lhost_ifname_array $lhost_ifname"
-
-	# Get the Interface names of the remote host
-	rhost_ifname=`get_ifname rhost ${link_num}`
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to get the interface name at the remote host"
-	    exit $TST_TOTAL
-	fi
-	rhost_ifname_array="$rhost_ifname_array $rhost_ifname"
-
-	# Initialize the interfaces of the remote host
-	initialize_if rhost ${link_num}
-
-	# Set IPv4 address to the interface of the remote host
-	set_ipv4addr rhost ${link_num} "${IPV4_NETWORK_PRE}.${link_num}" ${RHOST_IPV4_HOST}
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to assign IP address to the interface $rhost_ifname at the remote host"
-	    exit $TST_TOTAL
-	fi
-
-	link_num=`expr $link_num + 1`
-    done
-}
-
-
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_cleanup
-#
-# DESCRIPTION:
-#   Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Make sure to kill the udp datagram sender
-    killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
-    # Initialize the interfaces
-    link_num=0
-    while [ $link_num -lt $link_total ]; do
-	initialize_if lhost ${link_num}
-	initialize_if rhost ${link_num}
-	link_num=`expr $link_num + 1`
-    done
-}
-
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:
-#   test_body
-#
-# DESCRIPTION:
-#   main code of the test
-#
-# Arguments:
-#   $1: define the test type
-#       1 - route command case
-#       2 - ip command case
-#
-#-----------------------------------------------------------------------
-test_body()
-{
-    test_type=$1
-
-    TCID=route4-change-if0${test_type}
-    TST_COUNT=$test_type
-
-    case $test_type in
-	1)
-	test_command="route"
-	;;
-	2)
-	test_command="ip"
-	;;
-	*)
-	tst_resm TBROK "unspecified case"
-	return 1
-	;;
-    esac
-
-    tst_resm TINFO "Verify the kernel is not crashed when the interface of an IPv4 route is changed frequently by $test_command command in $NS_TIMES times"
-
-    link_num=0
-    while [ $link_num -lt $link_total ]; do
-	# Initialize the interface of the local host
-	initialize_if lhost ${link_num}
-
-	# Assign IPv4 address to the interface of the local host
-	set_ipv4addr lhost ${link_num} "${IPV4_NETWORK_PRE}.${link_num}" ${LHOST_IPV4_HOST}
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to assign an IPv4 address at the local host"
-	    return 1
-	fi
-
-	# Check the connectivity to the gateway
-	field=`expr $link_num + 1`
-	lhost_ifname=`echo $lhost_ifname_array | cut -d ' ' -f $field`
-	check_icmpv4_connectivity $lhost_ifname "${IPV4_NETWORK_PRE}.${link_num}.${LHOST_IPV4_HOST}"
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Test Link $link_num is somthing wrong."
-	    return 1
-	fi
-	link_num=`expr $link_num + 1`
-    done
-
-    # Set the variables regarding the destination host
-    dst_addr=${DST_NETWORK}.${DST_HOST}
-    dst_network=${DST_NETWORK}.0
-
-    # Set the first route
-    link_num=0
-    field=`expr $link_num + 1`
-    lhost_ifname=`echo $lhost_ifname_array | cut -d ' ' -f $field`
-    gateway="${IPV4_NETWORK_PRE}.${link_num}.${RHOST_IPV4_HOST}"
-    case $test_type in
-	1)
-	route add -net $dst_network netmask 255.255.255.0 gw $gateway dev $lhost_ifname
-	;;
-	2)
-	ip route add ${dst_network}/24 via $gateway dev $lhost_ifname
-	;;
-    esac
-
-    # Load the route with UDP traffic
-    ns-udpsender -f 4 -D $dst_addr -p $DST_PORT -b -s 1472
-    if [ $? -ne 0 ]; then
-	tst_resm TFAIL "Failed to run a UDP datagram sender"
-	return 1
-    fi
-
-    # Loop for changing the route
-    cnt=0
-    while [ $cnt -lt $NS_TIMES ]; do
-	link_num=`expr $link_num + 1`
-	if [ $link_num -ge $link_total ]; then
-	    link_num=0
-	fi
-
-	pre_lhost_ifname=$lhost_ifname
-	pre_gateway=$gateway
-
-	field=`expr $link_num + 1`
-	lhost_ifname=`echo $lhost_ifname_array | cut -d ' ' -f $field`
-	gateway="${IPV4_NETWORK_PRE}.${link_num}.${RHOST_IPV4_HOST}"
-
-	case $test_type in
-	    1)
-	    route add -net $dst_network netmask 255.255.255.0 gw $gateway dev $lhost_ifname
-	    route del -net $dst_network netmask 255.255.255.0 gw $pre_gateway dev $pre_lhost_ifname
-	    ;;
-	    2)
-	    ip route change ${dst_network}/24 via $gateway dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to change the gateway to $gateway"
-	    return 1
-	fi
-
-	# Rerun if udp datagram sender is dead
-	ps auxw | fgrep -v grep | grep ns-udpsender > /dev/null
-	if [ $? -ne 0 ]; then
-	    ns-udpsender -f 4 -D $dst_addr -p $DST_PORT -b -s 1472
-	    if [ $? -ne 0 ]; then
-		tst_resm TFAIL "Failed to run a UDP datagram sender"
-		return 1
-	    fi
-	fi
-
-	cnt=`expr $cnt + 1`
-    done
-
-    # Kill the udp datagram sender
-    killall -SIGHUP ns-udpsender
-
-    tst_resm TPASS "Test is finished correctly."
-    return 0
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-#   The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test_body 1 || RC=`expr $RC + 1`      # Case of route command
-test_body 2 || RC=`expr $RC + 1`      # Case of ip command
-do_cleanup
-
-exit $RC
diff --git a/testcases/network/stress/route/route6-change-dst b/testcases/network/stress/route/route6-change-dst
deleted file mode 100644
index 2aa9533..0000000
--- a/testcases/network/stress/route/route6-change-dst
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
-#
-# File:
-#   route6-change-dst
-#
-# Description:
-#   Verify the kernel is not crashed when the destination of an IPv6 route is
-#   changed frequently
-#    test01 - by route command
-#    test02 - by ip command
-#
-# Setup:
-#   See testcases/network/stress/README
-#
-# Author:
-#   Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-#	Mar 16 2006 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# Default of the test case ID and the test case count
-TCID=route6-change-dst
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-# Network portion of the IPv6 address
-IPV6_NETWORK="fec0:1:1:1"
-
-# Netmask of for the tested network
-IPV6_NETMASK_NUM=64
-
-# Host portion of the IPv6 address
-LHOST_IPV6_HOST=":2"	# src
-RHOST_IPV6_HOST=":3"	# gateway
-
-# The destination network
-DST_NETWORK_PREFIX="fd00:100:1"	# dest network would be fd00:100:1:n:::/64
-DST_HOST="5"
-DST_PORT="7"
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_setup
-#
-# DESCRIPTION:
-#   Make a IPv6 connectivity
-#
-# SET VALUES:
-#   rhost_ipv6addr	- IPv6 Address of the remote host
-#   lhost_ifname	- Interface name of the local host
-#   rhost_ifname	- Interface name of the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
-    TCID=route6-change-dst
-    TST_COUNT=0
-
-    # Initialize the interfaces of the remote host
-    initialize_if rhost ${LINK_NUM}
-
-    # Set IPv6 address to the interfaces
-    add_ipv6addr rhost ${LINK_NUM} ${IPV6_NETWORK} ${RHOST_IPV6_HOST}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to add an IPv6 address the remote host"
-	exit $TST_TOTAL
-    fi
-
-    # IPv6 address of the remote host (gateway)
-    rhost_ipv6addr="${IPV6_NETWORK}:${RHOST_IPV6_HOST}"
-
-    # Get the Interface name of local host
-    lhost_ifname=`get_ifname lhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the local host"
-	exit $TST_TOTAL
-    fi
-
-    # Get the Interface name of remote host
-    rhost_ifname=`get_ifname rhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the remote host"
-	exit $TST_TOTAL
-    fi
-}
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_cleanup
-#
-# DESCRIPTION:
-#   Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Initialize the interfaces
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:
-#   test_body
-#
-# DESCRIPTION:
-#   main code of the test
-#
-# Arguments:
-#   $1: define the test type
-#       1 - route command case
-#       2 - ip command case
-#
-#-----------------------------------------------------------------------
-test_body()
-{
-    test_type=$1
-
-    TCID=route6-change-dst0${test_type}
-    TST_COUNT=$test_type
-
-    case $test_type in
-	1)
-	test_command="route"
-	;;
-	2)
-	test_command="ip"
-	;;
-	*)
-	tst_resm TBROK "unspecified case"
-	return 1
-	;;
-    esac
-
-    tst_resm TINFO "Verify the kernel is not crashed when the destination of an IPv6 route is changed frequently by $test_command command in $NS_TIMES times"
-
-    # Initialize the interface of the local host
-    initialize_if lhost ${LINK_NUM}
-
-    # Assign IPv6 address to the interface of the local host
-    add_ipv6addr lhost ${LINK_NUM} ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to assign an IPv6 address at the local host"
-	return 1
-    fi
-    lhost_ipv6addr="${IPV6_NETWORK}:${LHOST_IPV6_HOST}"
-
-    # Check the connectivity to the gateway
-    check_icmpv6_connectivity $lhost_ifname $rhost_ipv6addr
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Test Link $LINK_NUM is something wrong."
-	return 1
-    fi
-
-    # Start the loop
-    cnt=0
-    while [ $cnt -lt $NS_TIMES ]; do
-	# Define the destination IP address
-	tmp_postfix=`expr $cnt % 65535`
-	dst_network_postfix=`printf "%x" $tmp_postfix`
-	dst_addr=${DST_NETWORK_PREFIX}:${dst_network_postfix}::${DST_HOST}
-	dst_network=${DST_NETWORK_PREFIX}:${dst_network_postfix}::
-
-	# Add the route
-	case $test_type in
-	    1)
-	    route -A inet6 add ${dst_network}/64 gw $rhost_ipv6addr dev $lhost_ifname
-	    ;;
-	    2)
-	    ip -f inet6 route add ${dst_network}/64 via $rhost_ipv6addr dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to add the route to ${dst_network}/64"
-	    return 1
-	fi
-
-	# Load the route with UDP datagram
-	ns-udpsender -f 6 -D $dst_addr -p $DST_PORT -o -s 1452
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to run a UDP datagram sender"
-	    return 1
-	fi
-
-	# Delete the route
-	case $test_type in
-	    1)
-	    route -A inet6 del ${dst_network}/64 gw $rhost_ipv6addr dev $lhost_ifname
-	    ;;
-	    2)
-	    ip -f inet6 route del ${dst_network}/64 via $rhost_ipv6addr dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Cannot delete the route to ${ADDDEL_ROUTE}"
-	    return 1
-	fi
-
-	cnt=`expr $cnt + 1`
-    done
-
-    tst_resm TPASS "Test is finished correctly."
-    return 0
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-#   The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test_body 1 || RC=`expr $RC + 1`      # Case of route command
-test_body 2 || RC=`expr $RC + 1`      # Case of ip command
-do_cleanup
-
-exit $RC
diff --git a/testcases/network/stress/route/route6-change-gw b/testcases/network/stress/route/route6-change-gw
deleted file mode 100644
index 05e45b9..0000000
--- a/testcases/network/stress/route/route6-change-gw
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/bin/sh
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
-#
-# File:
-#   route6-change-gw
-#
-# Description:
-#   Verify the kernel is not crashed when the gateway of an IPv6 route is
-#   changed frequently
-#    test01 - by route command
-#    test02 - by ip command
-#
-# Setup:
-#   See testcases/network/stress/README
-#
-# Author:
-#   Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-#	Mar 16 2006 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# Default of the test case ID and the test case count
-TCID=route6-change-gw
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-# Network portion of the IPv6 address
-IPV6_NETWORK="fec0:1:1:1"
-
-# Netmask of for the tested network
-IPV6_NETMASK_NUM=64
-
-# Host portion of the IPv6 address
-LHOST_IPV6_HOST=":2"		# src
-RHOST_IPV6_HOST_TOP="10"	# gateway
-RHOST_IPV6_HOST_LAST="19"
-
-# The destination network
-DST_NETWORK="fd00:100:1:1"	# dest network would be fd00:100:1:1:::/64
-DST_HOST="5"
-DST_PORT="7"
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_setup
-#
-# DESCRIPTION:
-#   Make a IPv6 connectivity
-#
-# SET VALUES:
-#   rhost_ipv6addr	- IPv6 Address of the remote host
-#   lhost_ifname	- Interface name of the local host
-#   rhost_ifname	- Interface name of the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
-    TCID=route6-change-gw
-    TST_COUNT=0
-
-    # Get the Interface name of local host
-    lhost_ifname=`get_ifname lhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the local host"
-	exit $TST_TOTAL
-    fi
-
-    # Get the Interface name of remote host
-    rhost_ifname=`get_ifname rhost ${LINK_NUM}`
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to get the interface name at the remote host"
-	exit $TST_TOTAL
-    fi
-
-    # Initialize the interfaces of the remote host
-    initialize_if rhost ${LINK_NUM}
-
-    # Set IPv6 address to the interface of the remote host
-    rhost_part=$RHOST_IPV6_HOST_TOP
-    rhost_part_hex=`printf "%x" $rhost_part`
-    while [ $rhost_part -le $RHOST_IPV6_HOST_LAST ]; do
-	rhost_part_hex=":`printf "%x" $rhost_part`"
-	add_ipv6addr rhost ${LINK_NUM} ${IPV6_NETWORK} ${rhost_part_hex}
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to assign IP address to the interface at the remote host"
-	    exit $TST_TOTAL
-	fi
-	rhost_part=`expr $rhost_part + 1`
-    done
-}
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_cleanup
-#
-# DESCRIPTION:
-#   Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
-    # Initialize the interfaces
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:
-#   test_body
-#
-# DESCRIPTION:
-#   main code of the test
-#
-# Arguments:
-#   $1: define the test type
-#       1 - route command case
-#       2 - ip command case
-#
-#-----------------------------------------------------------------------
-test_body()
-{
-    test_type=$1
-
-    TCID=route6-change-gw0${test_type}
-    TST_COUNT=$test_type
-
-    case $test_type in
-	1)
-	test_command="route"
-	;;
-	2)
-	test_command="ip"
-	;;
-	*)
-	tst_resm TBROK "unspecified case"
-	return 1
-	;;
-    esac
-
-    tst_resm TINFO "Verify the kernel is not crashed when the gateway of an IPv6 route is changed frequently by $test_command command in $NS_TIMES times"
-
-    # Initialize the interface of the local host
-    initialize_if lhost ${LINK_NUM}
-
-    # Assign IPv6 address to the interface of the local host
-    add_ipv6addr lhost ${LINK_NUM} ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Failed to assign an IPv6 address at the local host"
-	return 1
-    fi
-
-    # Check the connectivity to the gateway
-    rhost_part=$RHOST_IPV6_HOST_TOP
-    rhost_part_hex=":`printf "%x" $rhost_part`"
-    check_icmpv6_connectivity $lhost_ifname ${IPV6_NETWORK}:${rhost_part_hex}
-    if [ $? -ne 0 ]; then
-	tst_resm TBROK "Test Link $LINK_NUM is somthing wrong."
-	return 1
-    fi
-
-    # Set the variables regarding the destination host
-    dst_addr=${DST_NETWORK}::${DST_HOST}
-    dst_network=${DST_NETWORK}::
-
-    # Set the first route
-    case $test_type in
-	1)
-	route -A inet6 add ${dst_network}/64 gw ${IPV6_NETWORK}:${rhost_part_hex} dev $lhost_ifname
-	;;
-	2)
-	ip -f inet6 route add ${dst_network}/64 via ${IPV6_NETWORK}:${rhost_part_hex} dev $lhost_ifname
-	;;
-    esac
-
-    # Load the route with UDP traffic
-    ns-udpsender -f 6 -D $dst_addr -p $DST_PORT -b -s 1452
-    if [ $? -ne 0 ]; then
-	tst_resm TFAIL "Failed to run a UDP datagram sender"
-	return 1
-    fi
-
-    # Loop for changing the route
-    cnt=0
-    while [ $cnt -lt $NS_TIMES ]; do
-	pre_rhost_part_hex=$rhost_part_hex
-	rhost_part=`expr $rhost_part + 1`
-	if [ $rhost_part -gt $RHOST_IPV6_HOST_LAST ]; then
-	    rhost_part=$RHOST_IPV6_HOST_TOP
-	fi
-	rhost_part_hex=":`printf "%x" $rhost_part`"
-
-	case $test_type in
-	    1)
-	    route -A inet6 add ${dst_network}/64 gw ${IPV6_NETWORK}:${rhost_part_hex} dev $lhost_ifname
-	    route -A inet6 del ${dst_network}/64 gw ${IPV6_NETWORK}:${pre_rhost_part_hex} dev $lhost_ifname
-	    ;;
-	    2)
-	    ip -f inet6 route change ${dst_network}/64 via ${IPV6_NETWORK}:${rhost_part_hex} dev $lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to change the gateway to ${IPV6_NETWORK}.${rhost_part}"
-	    return 1
-	fi
-
-	# Rerun if udp datagram sender is dead
-	ps auxw | fgrep -v grep | grep ns-udpsender > /dev/null
-	if [ $? -ne 0 ]; then
-	    ns-udpsender -f 4 -D $dst_addr -p $DST_PORT -o -s 1472
-	    if [ $? -ne 0 ]; then
-		tst_resm TFAIL "Failed to run a UDP datagram sender"
-		return 1
-	    fi
-	fi
-
-	cnt=`expr $cnt + 1`
-    done
-
-    # Kill the udp datagram sender
-    killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
-    tst_resm TPASS "Test is finished correctly."
-    return 0
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-#   The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test_body 1 || RC=`expr $RC + 1`      # Case of route command
-test_body 2 || RC=`expr $RC + 1`      # Case of ip command
-do_cleanup
-
-exit $RC
diff --git a/testcases/network/stress/route/route6-change-if b/testcases/network/stress/route/route6-change-if
deleted file mode 100644
index 051ba8b..0000000
--- a/testcases/network/stress/route/route6-change-if
+++ /dev/null
@@ -1,323 +0,0 @@
-#!/bin/sh
-
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## 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    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
-#
-# File:
-#   route6-change-if
-#
-# Description:
-#   Verify the kernel is not crashed when the interface of an IPv6 route is
-#   changed frequently
-#    test01 - by route command
-#    test02 - by ip command
-#
-# Setup:
-#   See testcases/network/stress/README
-#
-# Author:
-#   Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-#	Mar 17 2006 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# Default of the test case ID and the test case count
-TCID=route6-change-if
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
-
-# The first 2 ocnted of the Network portion of the gateway address
-IPV6_NETWORK_PRE="fec0:1:1"
-
-# Netmask of for the gateway
-IPV6_NETMASK_NUM=64
-
-# Host portion of the IPv6 address
-LHOST_IPV6_HOST=":2"	# src
-RHOST_IPV6_HOST=":1"	# gateway
-
-# The destination network
-DST_NETWORK="fd00:100:1:1"      # dest network would be fd00:100:1:1:::/64
-DST_HOST=":5"
-DST_PORT="7"
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_setup
-#
-# DESCRIPTION:
-#   Make a IPv6 connectivity
-#
-# SET VALUES:
-#   rhost_ipv6addr	- IPv6 Address of the remote host
-#   lhost_ifname	- Interface name of the local host
-#   rhost_ifname	- Interface name of the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
-    TCID=route6-change-if
-    TST_COUNT=0
-
-    # Get the number of the test links
-    link_total=`echo $LHOST_HWADDRS | wc -w`
-    rhost_link_total=`echo $RHOST_HWADDRS | wc -w`
-    if [ $link_total -ne $rhost_link_total ]; then
-	tst_resm TBROK "The number of element in LHOST_HWADDRS differs from RHOST_HWADDRS"
-	exit $TST_TOTAL
-    fi
-    if [ $link_total -lt 2 ]; then
-	tst_resm TBROK "This test case requires plural Test Links"
-	exit $TST_TOTAL
-    fi
-
-    lhost_ifname_array=""
-    rhost_ifname_array=""
-    link_num=0
-    while [ $link_num -lt $link_total ]; do
-	# Get the Interface names of the local host
-	lhost_ifname=`get_ifname lhost ${link_num}`
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to get the interface name at the local host"
-	    exit $TST_TOTAL
-	fi
-	lhost_ifname_array="$lhost_ifname_array $lhost_ifname"
-
-	# Get the Interface names of the remote host
-	rhost_ifname=`get_ifname rhost ${link_num}`
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to get the interface name at the remote host"
-	    exit $TST_TOTAL
-	fi
-	rhost_ifname_array="$rhost_ifname_array $rhost_ifname"
-
-	# Initialize the interfaces of the remote host
-	initialize_if rhost ${link_num}
-
-	# Set IPv6 address to the interface of the remote host
-	add_ipv6addr rhost ${link_num} "${IPV6_NETWORK_PRE}:${link_num}" ${RHOST_IPV6_HOST}
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to assign IP address to the interface $rhost_ifname at the remote host"
-	    exit $TST_TOTAL
-	fi
-
-	link_num=`expr $link_num + 1`
-    done
-}
-
-
-#-----------------------------------------------------------------------
-#
-# NAME:
-#   do_cleanup
-#
-# DESCRIPTION:
-#   Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Make sure to kill the udp datagram sender
-    killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
-    # Initialize the interfaces
-    link_num=0
-    while [ $link_num -lt $link_total ]; do
-	initialize_if lhost ${link_num}
-	initialize_if rhost ${link_num}
-	link_num=`expr $link_num + 1`
-    done
-}
-
-
-#-----------------------------------------------------------------------
-#
-# FUNCTION:
-#   test_body
-#
-# DESCRIPTION:
-#   main code of the test
-#
-# Arguments:
-#   $1: define the test type
-#       1 - route command case
-#       2 - ip command case
-#
-#-----------------------------------------------------------------------
-test_body()
-{
-    test_type=$1
-
-    TCID=route6-change-if0${test_type}
-    TST_COUNT=$test_type
-
-    case $test_type in
-	1)
-	test_command="route"
-	;;
-	2)
-	test_command="ip"
-	;;
-	*)
-	tst_resm TBROK "unspecified case"
-	return 1
-	;;
-    esac
-
-    tst_resm TINFO "Verify the kernel is not crashed when the interface of an IPv6 route is changed frequently by $test_command command in $NS_TIMES times"
-
-    link_num=0
-    while [ $link_num -lt $link_total ]; do
-	# Initialize the interface of the local host
-	initialize_if lhost ${link_num}
-
-	# Assign IPv6 address to the interface of the local host
-	add_ipv6addr lhost ${link_num} "${IPV6_NETWORK_PRE}:${link_num}" ${LHOST_IPV6_HOST}
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Failed to assign an IPv6 address at the local host"
-	    return 1
-	fi
-
-	# Check the connectivity to the gateway
-	field=`expr $link_num + 1`
-	lhost_ifname=`echo $lhost_ifname_array | cut -d ' ' -f $field`
-	check_icmpv6_connectivity $lhost_ifname "${IPV6_NETWORK_PRE}:${link_num}:${LHOST_IPV6_HOST}"
-	if [ $? -ne 0 ]; then
-	    tst_resm TBROK "Test Link $link_num is somthing wrong."
-	    return 1
-	fi
-	link_num=`expr $link_num + 1`
-    done
-
-    # Set the variables regarding the destination host
-    dst_addr=${DST_NETWORK}:${DST_HOST}
-    dst_network=${DST_NETWORK}::
-
-    # Set the first route
-    link_num=0
-    field=`expr $link_num + 1`
-    lhost_ifname=`echo $lhost_ifname_array | cut -d ' ' -f $field`
-    gateway="${IPV6_NETWORK_PRE}:${link_num}:${RHOST_IPV6_HOST}"
-    case $test_type in
-	1)
-	route -A inet6 add ${dst_network}/64 gw $gateway dev $lhost_ifname
-	;;
-	2)
-	ip -f inet6 route add ${dst_network}/64 via $gateway dev $lhost_ifname
-	;;
-    esac
-
-    # Load the route with UDP traffic
-    ns-udpsender -f 6 -D $dst_addr -p $DST_PORT -b -s 1452
-    if [ $? -ne 0 ]; then
-	tst_resm TFAIL "Failed to run a UDP datagram sender"
-	return 1
-    fi
-
-    # Loop for changing the route
-    cnt=0
-    while [ $cnt -lt $NS_TIMES ]; do
-	link_num=`expr $link_num + 1`
-	if [ $link_num -ge $link_total ]; then
-	    link_num=0
-	fi
-
-	pre_lhost_ifname=$lhost_ifname
-	pre_gateway=$gateway
-
-	field=`expr $link_num + 1`
-	lhost_ifname=`echo $lhost_ifname_array | cut -d ' ' -f $field`
-	gateway="${IPV6_NETWORK_PRE}:${link_num}:${RHOST_IPV6_HOST}"
-
-	case $test_type in
-	    1)
-	    route -A inet6 add ${dst_network}/64 gw $gateway dev $lhost_ifname
-	    route -A inet6 del ${dst_network}/64 gw $pre_gateway dev $pre_lhost_ifname
-	    ;;
-	    2)
-	    ip -f inet6 route add ${dst_network}/64 via $gateway dev $lhost_ifname
-	    ip -f inet6 route del ${dst_network}/64 via $pre_gateway dev $pre_lhost_ifname
-	    ;;
-	esac
-	if [ $? -ne 0 ]; then
-	    tst_resm TFAIL "Failed to change the gateway to $gateway"
-	    return 1
-	fi
-
-	# Rerun if udp datagram sender is dead
-	ps auxw | fgrep -v grep | grep ns-udpsender > /dev/null
-	if [ $? -ne 0 ]; then
-	    ns-udpsender -f 6 -D $dst_addr -p $DST_PORT -b -s 1452
-	    if [ $? -ne 0 ]; then
-		tst_resm TFAIL "Failed to run a UDP datagram sender"
-		return 1
-	    fi
-	fi
-
-	cnt=`expr $cnt + 1`
-    done
-
-    # Kill the udp datagram sender
-    killall -SIGHUP ns-udpsender
-
-    tst_resm TPASS "Test is finished correctly."
-    return 0
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-#   The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test_body 1 || RC=`expr $RC + 1`      # Case of route command
-test_body 2 || RC=`expr $RC + 1`      # Case of ip command
-do_cleanup
-
-exit $RC
diff --git a/testcases/network/stress/sctp/sctp_ipsec_vti.sh b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
index fe6135a..9c57471 100755
--- a/testcases/network/stress/sctp/sctp_ipsec_vti.sh
+++ b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
@@ -17,7 +17,7 @@
 
 	[ "$2" != "$rand_opt" ] && opts="-A $rand_opt"
 	tst_netload -H $ip_rmt_tun -T sctp $opts -r $IPSEC_REQUESTS \
-		-S $ip_loc_tun
+		-S $ip_loc_tun -D $tst_vti
 }
 
 tst_run
diff --git a/testcases/network/stress/ssh/Makefile b/testcases/network/stress/ssh/Makefile
index 633d1c0..1a6d052 100644
--- a/testcases/network/stress/ssh/Makefile
+++ b/testcases/network/stress/ssh/Makefile
@@ -24,6 +24,6 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= ssh*
+INSTALL_TARGETS		:= *.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/ssh/ssh-stress b/testcases/network/stress/ssh/ssh-stress.sh
old mode 100644
new mode 100755
similarity index 93%
rename from testcases/network/stress/ssh/ssh-stress
rename to testcases/network/stress/ssh/ssh-stress.sh
index 6bedd50..516bce7
--- a/testcases/network/stress/ssh/ssh-stress
+++ b/testcases/network/stress/ssh/ssh-stress.sh
@@ -46,7 +46,7 @@
 	trap "tst_brkm TBROK 'test interrupted'" INT
 
 	tst_require_root
-	tst_test_cmds pkill sshd ssh od
+	tst_require_cmds pkill sshd ssh od
 
 	# Get the sshd command with absolute path
 	SSHD=$(which sshd)
@@ -106,7 +106,7 @@
 {
 	tst_resm TINFO "Creating '$CONNECTION_TOTAL' ssh sessions"
 
-	tst_rhost_run -s -c "ssh-stress01-rmt $TST_IPVER $(tst_ipaddr) \
+	tst_rhost_run -s -c "ssh-stress01-rmt.sh $TST_IPVER $(tst_ipaddr) \
 		$rconfig $CONNECTION_TOTAL"
 
 	tst_resm TPASS "Test is finished successfully"
@@ -117,7 +117,7 @@
 	tst_resm TINFO "Log in/out by many clients asynchronously"
 	tst_resm TINFO "'$CONNECTION_TOTAL' clients, time $NS_DURATION sec"
 
-	tst_rhost_run -s -c "ssh-stress02-rmt $TST_IPVER $(tst_ipaddr) \
+	tst_rhost_run -s -c "ssh-stress02-rmt.sh $TST_IPVER $(tst_ipaddr) \
 		$rconfig $CONNECTION_TOTAL $NS_DURATION"
 
 	tst_resm TPASS "Test is finished successfully"
@@ -132,7 +132,7 @@
 
 	netstress -R 3 -g $port > tcp_server.log 2>&1 &
 
-	tst_rhost_run -s -c "ssh-stress03-rmt $TST_IPVER $(tst_ipaddr) \
+	tst_rhost_run -s -c "ssh-stress03-rmt.sh $TST_IPVER $(tst_ipaddr) \
 		$rconfig $port $NS_TIMES"
 
 	tst_resm TPASS "Test is finished successfully"
diff --git a/testcases/network/stress/ssh/ssh-stress01-rmt b/testcases/network/stress/ssh/ssh-stress01-rmt.sh
old mode 100644
new mode 100755
similarity index 100%
rename from testcases/network/stress/ssh/ssh-stress01-rmt
rename to testcases/network/stress/ssh/ssh-stress01-rmt.sh
diff --git a/testcases/network/stress/ssh/ssh-stress02-rmt b/testcases/network/stress/ssh/ssh-stress02-rmt.sh
old mode 100644
new mode 100755
similarity index 100%
rename from testcases/network/stress/ssh/ssh-stress02-rmt
rename to testcases/network/stress/ssh/ssh-stress02-rmt.sh
diff --git a/testcases/network/stress/ssh/ssh-stress03-rmt b/testcases/network/stress/ssh/ssh-stress03-rmt.sh
old mode 100644
new mode 100755
similarity index 100%
rename from testcases/network/stress/ssh/ssh-stress03-rmt
rename to testcases/network/stress/ssh/ssh-stress03-rmt.sh
diff --git a/testcases/network/stress/tcp/tcp_ipsec_vti.sh b/testcases/network/stress/tcp/tcp_ipsec_vti.sh
index 118db54..41ab1ca 100755
--- a/testcases/network/stress/tcp/tcp_ipsec_vti.sh
+++ b/testcases/network/stress/tcp/tcp_ipsec_vti.sh
@@ -18,7 +18,8 @@
 	local rand_opt="$(echo $2 | cut -d'R' -f2)"
 
 	[ "$2" != "$rand_opt" ] && opts="-A $rand_opt"
-	tst_netload -H $ip_rmt_tun $opts -r $IPSEC_REQUESTS -R $max_requests
+	tst_netload -H $ip_rmt_tun $opts -r $IPSEC_REQUESTS \
+		    -R $max_requests -D $tst_vti
 }
 
 tst_run
diff --git a/testcases/network/stress/udp/udp_ipsec_vti.sh b/testcases/network/stress/udp/udp_ipsec_vti.sh
index 2afe70e..d9a1e33 100755
--- a/testcases/network/stress/udp/udp_ipsec_vti.sh
+++ b/testcases/network/stress/udp/udp_ipsec_vti.sh
@@ -19,7 +19,7 @@
 
 	[ $1 -eq 2 ] && type="udp_lite"
 	[ "$2" != "$rand_opt" ] && opts="-A $rand_opt"
-	tst_netload -H $ip_rmt_tun -T $type $opts -r $IPSEC_REQUESTS
+	tst_netload -H $ip_rmt_tun -T $type $opts -r $IPSEC_REQUESTS -D $tst_vti
 }
 
 tst_run
diff --git a/testcases/network/tcp_cc/tcp_cc_lib.sh b/testcases/network/tcp_cc/tcp_cc_lib.sh
index 163ac02..815cc9c 100755
--- a/testcases/network/tcp_cc/tcp_cc_lib.sh
+++ b/testcases/network/tcp_cc/tcp_cc_lib.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
+# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_ROOT=1
diff --git a/testcases/network/tcp_cmds/arping/arping01.sh b/testcases/network/tcp_cmds/arping/arping01.sh
index d9c79f6..6388f6a 100755
--- a/testcases/network/tcp_cmds/arping/arping01.sh
+++ b/testcases/network/tcp_cmds/arping/arping01.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016-2019 Oracle and/or its affiliates. All Rights Reserved.
-#
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 TST_TESTFUNC="do_test"
diff --git a/testcases/network/tcp_cmds/clockdiff/clockdiff01.sh b/testcases/network/tcp_cmds/clockdiff/clockdiff01.sh
index db1b8d5..06b38fc 100755
--- a/testcases/network/tcp_cmds/clockdiff/clockdiff01.sh
+++ b/testcases/network/tcp_cmds/clockdiff/clockdiff01.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016-2019 Oracle and/or its affiliates. All Rights Reserved.
-#
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 TST_TESTFUNC="do_test"
diff --git a/testcases/network/tcp_cmds/ftp/ftp01 b/testcases/network/tcp_cmds/ftp/ftp01.sh
similarity index 100%
rename from testcases/network/tcp_cmds/ftp/ftp01
rename to testcases/network/tcp_cmds/ftp/ftp01.sh
diff --git a/testcases/network/tcp_cmds/ftp/ftp_setup b/testcases/network/tcp_cmds/ftp/ftp_setup
deleted file mode 100644
index 4233d52..0000000
--- a/testcases/network/tcp_cmds/ftp/ftp_setup
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-###############################################################################
-## Copyright (c) International Business Machines  Corp., 2003                ##
-##                                                                           ##
-## 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          ##
-##                                                                           ##
-###############################################################################
-. daemonlib.sh
-
-do_setup()
-{
-	export RHOST="localhost"
-	export TEST_USER_PASSWD="eal"
-	export TEST_USER_ENCRYPTED_PASSWD="42VmxaOByKwlA"
-	export TEST_USER_HOMEDIR="/home/$TEST_USER"
-
-	tst_test_cmds awk expect ftp useradd userdel vsftpd
-
-	for vsftp_confdir in /etc/vsftpd /etc; do
-		if [ -r "$vsftp_confdir/vsftpd.conf" ]; then
-			VSFTP_CONF="$vsftp_confdir/vsftpd.conf"
-			break
-		fi
-	done
-	if [ ! -r "$VSFTP_CONF" ] ; then
-		tst_brkm TBROK "vsftpd.conf not found."
-	fi
-
-	status_daemon vsftpd
-	if [ $? -ne 0 ]; then
-		start_daemon vsftpd
-		if [ $? -ne 0 ]; then
-			tst_brkm TBROK "Can't start vsftp"
-		fi
-	fi
-
-	LOCAL_ENABLE=$(awk -F= '/^local_enable=/ {print $2}' "$VSFTP_CONF")
-	if [ "$LOCAL_ENABLE" != "YES" ]; then
-		LOCAL_ENABLE="NO"
-	fi
-
-	ANONYMOUS_ENABLE=$(awk -F= '/^anonymous_enable=/ {print $2}' "$VSFTP_CONF")
-	if [ "$ANONYMOUS_ENABLE" != "NO" ]; then
-		ANONYMOUS_ENABLE="YES"
-	fi
-
-	if [ $TEST_USER = "root" -o $TEST_USER = "anonymous" ]; then
-		return
-	fi
-
-	userdel -r $TEST_USER
-	sleep 1
-
-	if ! useradd -m -p $TEST_USER_ENCRYPTED_PASSWD $TEST_USER; then
-		tst_brkm TBROK "Could not add test user $TEST_USER to system $RHOST."
-	fi
-
-	# create users home diretory (SLES 8 does not do this, even when specified
-	# in adduser)
-	USER_UID=$(id -u $TEST_USER)
-	USER_GID=$(id -g $TEST_USER)
-	mkdir -p "$TEST_USER_HOMEDIR"
-	chown -R $USER_UID:$USER_GID $TEST_USER_HOMEDIR
-}
-
-do_cleanup()
-{
-	if [ $TEST_USER != "root" -a $TEST_USER != "anonymous" ]; then
-		userdel -r $TEST_USER
-	fi
-}
diff --git a/testcases/network/tcp_cmds/host/Makefile b/testcases/network/tcp_cmds/host/Makefile
index 7920a0e..1f3a513 100644
--- a/testcases/network/tcp_cmds/host/Makefile
+++ b/testcases/network/tcp_cmds/host/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= host01
+INSTALL_TARGETS		:= host01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/tcp_cmds/host/host01 b/testcases/network/tcp_cmds/host/host01.sh
similarity index 100%
rename from testcases/network/tcp_cmds/host/host01
rename to testcases/network/tcp_cmds/host/host01.sh
diff --git a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
index 19d1edd..e15dd70 100755
--- a/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
+++ b/testcases/network/tcp_cmds/ipneigh/ipneigh01.sh
@@ -1,19 +1,8 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018 SUSE Linux GmbH
 # Copyright (c) 2016 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines  Corp., 2000
-# 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 would 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, see <http://www.gnu.org/licenses/>.
+# Copyright (c) International Business Machines Corp., 2000
 #
 # Test basic functionality of 'arp' and 'ip neigh'.
 
@@ -45,7 +34,7 @@
 		;;
 	esac
 
-	tst_test_cmds $CMD ping$TST_IPV6
+	tst_require_cmds $CMD ping$TST_IPV6
 }
 
 usage()
diff --git a/testcases/network/tcp_cmds/netstat/Makefile b/testcases/network/tcp_cmds/netstat/Makefile
index b660d66..83444db 100644
--- a/testcases/network/tcp_cmds/netstat/Makefile
+++ b/testcases/network/tcp_cmds/netstat/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= netstat01
+INSTALL_TARGETS		:= netstat01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/tcp_cmds/netstat/netstat01 b/testcases/network/tcp_cmds/netstat/netstat01.sh
similarity index 100%
rename from testcases/network/tcp_cmds/netstat/netstat01
rename to testcases/network/tcp_cmds/netstat/netstat01.sh
diff --git a/testcases/network/tcp_cmds/ping/ping01.sh b/testcases/network/tcp_cmds/ping/ping01.sh
index 916f057..bc9c1f9 100755
--- a/testcases/network/tcp_cmds/ping/ping01.sh
+++ b/testcases/network/tcp_cmds/ping/ping01.sh
@@ -1,11 +1,9 @@
 #! /bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2019 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines  Corp., 2000
+# Copyright (c) International Business Machines Corp., 2000
 #
-#  PURPOSE: To test the basic functionality of the `ping` command.
-#
-#  SETUP: If "RHOST" is not exported, then the local hostname is used.
+# To test the basic functionality of the `ping` command.
 #
 #  HISTORY:
 #    06/06/03 Manoj Iyer manjo@mail.utexas.edu
@@ -25,7 +23,7 @@
 
 	PING_CMD=ping${TST_IPV6}
 
-	tst_test_cmds $PING_CMD
+	tst_require_cmds $PING_CMD
 }
 
 do_test()
diff --git a/testcases/network/tcp_cmds/ping/ping02.sh b/testcases/network/tcp_cmds/ping/ping02.sh
index b245210..e0a63c5 100755
--- a/testcases/network/tcp_cmds/ping/ping02.sh
+++ b/testcases/network/tcp_cmds/ping/ping02.sh
@@ -15,7 +15,7 @@
 
 	PING=ping${TST_IPV6}
 
-	tst_test_cmds $PING
+	tst_require_cmds $PING
 }
 
 do_test()
diff --git a/testcases/network/tcp_cmds/rcp/Makefile b/testcases/network/tcp_cmds/rcp/Makefile
index 7cb00b0..f8131a9 100644
--- a/testcases/network/tcp_cmds/rcp/Makefile
+++ b/testcases/network/tcp_cmds/rcp/Makefile
@@ -25,6 +25,6 @@
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-INSTALL_TARGETS		:= rcp01
+INSTALL_TARGETS		:= rcp01.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/rcp/rcp01 b/testcases/network/tcp_cmds/rcp/rcp01.sh
similarity index 100%
rename from testcases/network/tcp_cmds/rcp/rcp01
rename to testcases/network/tcp_cmds/rcp/rcp01.sh
diff --git a/testcases/network/tcp_cmds/rlogin/Makefile b/testcases/network/tcp_cmds/rlogin/Makefile
index 97acadb..1e8d10e 100644
--- a/testcases/network/tcp_cmds/rlogin/Makefile
+++ b/testcases/network/tcp_cmds/rlogin/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= rlogin01
+INSTALL_TARGETS		:= rlogin01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/tcp_cmds/rlogin/rlogin01 b/testcases/network/tcp_cmds/rlogin/rlogin01.sh
similarity index 97%
rename from testcases/network/tcp_cmds/rlogin/rlogin01
rename to testcases/network/tcp_cmds/rlogin/rlogin01.sh
index 260e238..c34ab1c 100755
--- a/testcases/network/tcp_cmds/rlogin/rlogin01
+++ b/testcases/network/tcp_cmds/rlogin/rlogin01.sh
@@ -25,7 +25,7 @@
 
 setup()
 {
-	tst_test_cmds rlogin expect
+	tst_require_cmds rlogin expect
 
 	if [ -z $RUSER ]; then
 		RUSER=root
diff --git a/testcases/network/tcp_cmds/rsh/Makefile b/testcases/network/tcp_cmds/rsh/Makefile
index f8870a3..00ae49d 100644
--- a/testcases/network/tcp_cmds/rsh/Makefile
+++ b/testcases/network/tcp_cmds/rsh/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= rsh01
+INSTALL_TARGETS		:= rsh01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/tcp_cmds/rsh/rsh01 b/testcases/network/tcp_cmds/rsh/rsh01.sh
similarity index 100%
rename from testcases/network/tcp_cmds/rsh/rsh01
rename to testcases/network/tcp_cmds/rsh/rsh01.sh
diff --git a/testcases/network/tcp_cmds/sendfile/Makefile b/testcases/network/tcp_cmds/sendfile/Makefile
index 88aec5e..e3cc045 100644
--- a/testcases/network/tcp_cmds/sendfile/Makefile
+++ b/testcases/network/tcp_cmds/sendfile/Makefile
@@ -27,7 +27,7 @@
 
 CPPFLAGS		+= -I$(abs_srcdir)/../include
 
-INSTALL_TARGETS		:= sendfile01
+INSTALL_TARGETS		:= sendfile01.sh
 
 MAKE_TARGETS		+= testsf_c testsf_s testsf_c6 testsf_s6
 
diff --git a/testcases/network/tcp_cmds/sendfile/sendfile01 b/testcases/network/tcp_cmds/sendfile/sendfile01.sh
similarity index 98%
rename from testcases/network/tcp_cmds/sendfile/sendfile01
rename to testcases/network/tcp_cmds/sendfile/sendfile01.sh
index 1677ec3..1e4739a 100755
--- a/testcases/network/tcp_cmds/sendfile/sendfile01
+++ b/testcases/network/tcp_cmds/sendfile/sendfile01.sh
@@ -47,7 +47,7 @@
 
 	FILES=${FILES:-"ascii.sm ascii.med ascii.lg ascii.jmb"}
 
-	tst_test_cmds diff stat
+	tst_require_cmds diff stat
 
 	tst_tmpdir
 }
diff --git a/testcases/network/tcp_cmds/tcpdump/Makefile b/testcases/network/tcp_cmds/tcpdump/Makefile
index 60831e1..ed06cb8 100644
--- a/testcases/network/tcp_cmds/tcpdump/Makefile
+++ b/testcases/network/tcp_cmds/tcpdump/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= tcpdump01
+INSTALL_TARGETS		:= tcpdump01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/tcp_cmds/tcpdump/tcpdump01 b/testcases/network/tcp_cmds/tcpdump/tcpdump01.sh
similarity index 97%
rename from testcases/network/tcp_cmds/tcpdump/tcpdump01
rename to testcases/network/tcp_cmds/tcpdump/tcpdump01.sh
index e8ecdec..32953e7 100755
--- a/testcases/network/tcp_cmds/tcpdump/tcpdump01
+++ b/testcases/network/tcp_cmds/tcpdump/tcpdump01.sh
@@ -29,7 +29,7 @@
 do_setup()
 {
 	ping_cmd=ping$TST_IPV6
-	tst_test_cmds tcpdump kill $ping_cmd
+	tst_require_cmds tcpdump kill $ping_cmd
 	outfile="tcpdump_out"
 	numloops=20
 	tst_tmpdir
diff --git a/testcases/network/tcp_cmds/telnet/Makefile b/testcases/network/tcp_cmds/telnet/Makefile
index af8d121..fefdf6b 100644
--- a/testcases/network/tcp_cmds/telnet/Makefile
+++ b/testcases/network/tcp_cmds/telnet/Makefile
@@ -24,7 +24,7 @@
 
 include $(top_srcdir)/include/mk/env_pre.mk
 
-INSTALL_TARGETS		:= telnet01
+INSTALL_TARGETS		:= telnet01.sh
 
 MAKE_TARGETS		:=
 
diff --git a/testcases/network/tcp_cmds/telnet/telnet01 b/testcases/network/tcp_cmds/telnet/telnet01.sh
similarity index 97%
rename from testcases/network/tcp_cmds/telnet/telnet01
rename to testcases/network/tcp_cmds/telnet/telnet01.sh
index d87cc8b..a6e6024 100755
--- a/testcases/network/tcp_cmds/telnet/telnet01
+++ b/testcases/network/tcp_cmds/telnet/telnet01.sh
@@ -25,7 +25,7 @@
 
 setup()
 {
-	tst_test_cmds telnet expect
+	tst_require_cmds telnet expect
 
 	if [ -z $RUSER ]; then
 		RUSER=root
diff --git a/testcases/network/tcp_cmds/tracepath/tracepath01.sh b/testcases/network/tcp_cmds/tracepath/tracepath01.sh
index 037fca0..2b75c10 100755
--- a/testcases/network/tcp_cmds/tracepath/tracepath01.sh
+++ b/testcases/network/tcp_cmds/tracepath/tracepath01.sh
@@ -16,7 +16,7 @@
 		cmd="tracepath$TST_IPVER"
 		tst_cmd_available $cmd || cmd="tracepath -6"
 	fi
-	tst_test_cmds $(echo $cmd | cut -f 1 -d' ')
+	tst_require_cmds $(echo $cmd | cut -f 1 -d' ')
 
 	if $cmd -V >/dev/null 2>&1; then
 		tst_res TINFO "traceroute version:"
diff --git a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh
index 7c79d6d..a4b5422 100755
--- a/testcases/network/tcp_fastopen/tcp_fastopen_run.sh
+++ b/testcases/network/tcp_fastopen/tcp_fastopen_run.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2014-2018 Oracle and/or its affiliates. All Rights Reserved.
-#
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
 TST_SETUP="setup"
diff --git a/testcases/network/virt/virt_lib.sh b/testcases/network/virt/virt_lib.sh
index 2be0ffb..f488932 100644
--- a/testcases/network/virt/virt_lib.sh
+++ b/testcases/network/virt/virt_lib.sh
@@ -50,7 +50,7 @@
 	;;
 	esac
 
-	tst_test_cmds "ip"
+	tst_require_cmds "ip"
 
 	virt_add ltp_v0 || \
 		tst_brk TCONF "iproute2 or kernel doesn't support $virt_type"
@@ -256,7 +256,7 @@
 
 vxlan_setup_subnet_multi()
 {
-	tst_test_cmds "od"
+	tst_require_cmds "od"
 	local b1=$(($(od -An -d -N1 /dev/urandom) % 254 + 1))
 	local b2=$(($(od -An -d -N1 /dev/urandom) % 254 + 1))
 	local b3=$(($(od -An -d -N1 /dev/urandom) % 254 + 1))
diff --git a/testcases/network/xinetd/xinetd_tests.sh b/testcases/network/xinetd/xinetd_tests.sh
index f7fa77f..e2c2dfd 100755
--- a/testcases/network/xinetd/xinetd_tests.sh
+++ b/testcases/network/xinetd/xinetd_tests.sh
@@ -30,7 +30,7 @@
 
 	tst_tmpdir
 
-	tst_test_cmds xinetd diff telnet
+	tst_require_cmds xinetd diff telnet
 
 	check_addr="127.0.0.1"
 	ip a | grep -q inet6 && check_addr="$check_addr ::1"
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock/1-1.c
index 9c48cd9..384be06 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock/1-1.c
@@ -17,20 +17,23 @@
 #include <time.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <time.h>
 #include "posixtest.h"
 
-#define LARGENUMBER 8000000
+#define BUSY_LOOP_SECONDS 5
+
 int main(void)
 {
 	clock_t c1, c2;
 	double sec1, sec2;
-	int i;
+	time_t end;
 
 	c1 = clock();
 	sec1 = c1 / CLOCKS_PER_SEC;
 
-	for (i = 0; i < LARGENUMBER; i++) {
-		// keep busy so CPU time increases
+	end = time(NULL) + BUSY_LOOP_SECONDS;
+
+	while (end >= time(NULL)) {
 		clock();
 	}
 
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-1.c
index 5419aef..87bda99 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-1.c
@@ -24,7 +24,8 @@
 int main(void)
 {
 	struct timespec tssleep, tsbefore, tsafter;
-	int sleepuntilsec, flags = 0;
+	time_t sleepuntilsec;
+	int flags = 0;
 
 	if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) {
 		perror("clock_gettime() did not return success\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
index 8982cba..dab0a4a 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
@@ -36,7 +36,8 @@
 int main(void)
 {
 	struct timespec tssleep, tsbefore, tsafter;
-	int pid, sleepuntilsec;
+	int pid;
+	time_t sleepuntilsec;
 	struct sigaction act;
 
 	if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) {
@@ -95,8 +96,9 @@
 			printf("Test PASSED\n");
 			return PTS_PASS;
 		} else {
-			printf("Slept for too long: %d >= %d\n",
-			       (int)tsafter.tv_sec, sleepuntilsec);
+			printf("Slept for too long: %lld >= %lld\n",
+			       (long long int)tsafter.tv_sec,
+				   (long long int)sleepuntilsec);
 			printf("Test FAILED\n");
 			return PTS_FAIL;
 		}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c
index 85b977f..06a79a9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c
@@ -22,7 +22,8 @@
 int main(void)
 {
 	struct timespec tssleep, tsbefore, tsafter;
-	int pid, sleepuntilsec;
+	int pid;
+	time_t sleepuntilsec;
 
 	if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) {
 		perror("clock_gettime() did not return success\n");
@@ -68,8 +69,9 @@
 			printf("Test PASSED\n");
 			return PTS_PASS;
 		} else {
-			printf("Slept for too long: %d >= %d\n",
-			       (int)tsafter.tv_sec, sleepuntilsec);
+			printf("Slept for too long: %lld >= %lld\n",
+			       (long long int)tsafter.tv_sec,
+				   (long long int)sleepuntilsec);
 			printf("Test FAILED\n");
 			return PTS_FAIL;
 		}
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/3-1.c
index 287d85d..d4312f5 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/3-1.c
@@ -25,7 +25,8 @@
 int main(void)
 {
 	struct timespec tssleep, tsbefore, tsafter;
-	int sleepuntilsec, flags = 0;
+	time_t sleepuntilsec;
+	int flags = 0;
 
 	if (clock_gettime(CLOCK_REALTIME, &tsbefore) != 0) {
 		perror("clock_gettime() did not return success\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/8-1.c
index 4e9d183..4340cc8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/8-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_settime/8-1.c
@@ -50,7 +50,7 @@
 	if ((pid = fork()) == 0) {
 		/* child here */
 		struct timespec tsend;
-		int expectedsec;
+		time_t expectedsec;
 
 		tssleep.tv_sec = SLEEPSEC;
 		tssleep.tv_nsec = 0;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-1.c
index 778a2cb..406e650 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedreceive/5-1.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include "posixtest.h"
+#include "timespec.h"
 
 #define TEST "5-1"
 #define FUNCTION "mq_timedreceive"
@@ -61,7 +62,7 @@
 	if (pid != 0) {
 		/* Parent process */
 		int status;
-		ts.tv_sec = INT32_MAX;
+		ts.tv_sec = TIME_T_MAX;
 		ts.tv_nsec = 0;
 		if (mq_timedreceive(mqdes, msgrv, BUFFER, NULL, &ts) > 0) {
 			wait(&status);
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
index b3ab27a..7d8ddf8 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c
@@ -33,6 +33,7 @@
 #include <signal.h>
 #include <errno.h>
 #include "posixtest.h"
+#include "timespec.h"
 
 #define NAMESIZE 50
 #define MSGSTR "0123456789"
@@ -76,7 +77,7 @@
 		struct timespec ts;
 
 		/* set up timeout to be as long as possible */
-		ts.tv_sec = INT32_MAX;
+		ts.tv_sec = TIME_T_MAX;
 		ts.tv_nsec = 0;
 
 		sleep(1);	// give parent time to set up handler
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c
index d32aa78..05e6bbe 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-2.c
@@ -28,6 +28,7 @@
 #include <signal.h>
 #include <errno.h>
 #include "posixtest.h"
+#include "timespec.h"
 
 #define NAMESIZE 50
 #define MSGSTR "0123456789"
@@ -80,7 +81,7 @@
 		int i;
 		struct timespec ts;
 		/* set up timeout to be as long as possible */
-		ts.tv_sec = INT32_MAX;
+		ts.tv_sec = TIME_T_MAX;
 		ts.tv_nsec = 0;
 
 		sleep(1);	// give parent time to set up handler
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
index 96b7d01..66f8b58 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/2-3.c
@@ -94,11 +94,17 @@
 
 	valuensec = tsres.tv_nsec;
 	intervalnsec = 2 * valuensec;
-	//expectedoverruns = (1000000000 - valuensec) / intervalnsec;
 	expectedoverruns = 1000000000 / intervalnsec - 1;
 
+	/*
+	 * waking up from sleep isn't instant, we can overshoot.
+	 * Allow up to ~50ms worth of extra overruns.
+	 */
+	fudge = 50000000 / intervalnsec + 1;
+
 	printf("value = %d sec, interval = %d nsec, "
-	       "expected overruns = %d\n", 1, intervalnsec, expectedoverruns);
+	       "expected overruns = %d, fudge = %d\n", 1,
+	       intervalnsec, expectedoverruns, fudge);
 
 	its.it_interval.tv_sec = 0;
 	its.it_interval.tv_nsec = intervalnsec;
@@ -146,7 +152,6 @@
 	 * extra expiries after the nanosleep completes so do
 	 * a range check.
 	 */
-	fudge = expectedoverruns / 100;
 	if (overruns >= expectedoverruns && overruns < expectedoverruns + fudge) {
 		printf("Test PASSED\n");
 		return PTS_PASS;
diff --git a/testcases/open_posix_testsuite/functional/threads/README b/testcases/open_posix_testsuite/functional/threads/README
index af99bad..9490caf 100644
--- a/testcases/open_posix_testsuite/functional/threads/README
+++ b/testcases/open_posix_testsuite/functional/threads/README
@@ -11,8 +11,3 @@
 
 condvar - Test cases by Abhijeet Bisain. Testing pthread_cond_wait()
 scheduling behavior when threads has realtime priority.
-
-pi_test - Test Priority Inheritence.
-
-robust_test - This suite is not proper to exist in PTS, since
-the work of adding Robust Mutex to POSIX is still ongoing.
diff --git a/testcases/open_posix_testsuite/functional/threads/include/pitest.h b/testcases/open_posix_testsuite/functional/threads/include/pitest.h
deleted file mode 100644
index dd7a48f..0000000
--- a/testcases/open_posix_testsuite/functional/threads/include/pitest.h
+++ /dev/null
@@ -1,85 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-#include <sys/time.h>
-#include <string.h>
-#include "test.h"
-
-#define PROTOCOL                PTHREAD_PRIO_INHERIT
-
-static inline
-double seconds_read(void)
-{
-	struct timeval tv;
-	gettimeofday(&tv, 0);
-	return tv.tv_sec + 1e-6 * tv.tv_usec;
-}
-
-static inline
-int test_set_priority(pthread_t pid, unsigned policy, unsigned prio)
-{
-	struct sched_param sched_param;
-	memset(&sched_param, 0, sizeof(sched_param));
-	sched_param.sched_priority = prio;
-	if (pthread_setschedparam(pid, policy, &sched_param) == -1)
-	{
-		EPRINTF("UNRESOLVED: Can't set policy to %d and prio to %d",
-		  	policy, prio);
-  	  	exit(UNRESOLVED);
-  	}
-	return 0;
-}
-
-static inline
-void mutex_attr_init(pthread_mutexattr_t *attr)
-{
-	unsigned rc;
-
-	rc = pthread_mutexattr_init(attr);
-        if (rc != 0) {
-                EPRINTF("UNRESOLVED: pthread_mutexattr_init: %d %s",
-                        rc, strerror(rc));
-                exit(UNRESOLVED);
-        }
-
-	rc = pthread_mutexattr_setprotocol(attr, PROTOCOL);
-        if (rc != 0) {
-                EPRINTF("UNRESOLVED: pthread_mutexattr_setprotocol: %d %s",
-	                rc, strerror(rc));
-                exit(UNRESOLVED);
-        }
-}
-
-static inline
-int mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
-{
-	unsigned rc;
-
-	rc = pthread_mutex_init(mutex, attr);
-        if (rc != 0) {
-                EPRINTF("UNRESOLVED: pthread_mutex_init: %d %s",
-                        rc, strerror(rc));
-                exit(UNRESOLVED);
-        }
-	return 0;
-}
-
-static inline
-int threadattr_init(pthread_attr_t *threadattr)
-{
-	unsigned rc;
-	rc = pthread_attr_init(threadattr);
-	if (rc != 0) {
-                EPRINTF("UNRESOLVED: pthread_attr_init: %d %s",
-                        rc, strerror(rc));
-	        exit(UNRESOLVED);
-        }
-	return 0;
-}
-
diff --git a/testcases/open_posix_testsuite/functional/threads/include/test.h b/testcases/open_posix_testsuite/functional/threads/include/test.h
deleted file mode 100644
index 1ebb64a..0000000
--- a/testcases/open_posix_testsuite/functional/threads/include/test.h
+++ /dev/null
@@ -1,26 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-#include <errno.h>
-#include <string.h>
-
-#ifndef EOWNERDEAD
-#define EOWNERDEAD	ESRCH
-#endif
-#ifndef ENOTRECOVERABLE
-#define ENOTRECOVERABLE	EBADR
-#endif
-
-#define PASS	0
-#define FAIL	1
-#define UNRESOLVED 2
-
-#define DPRINTF(a, x, args...)     fprintf(a, x , ##args);
-#define EPRINTF(x, args...)	fprintf(stderr, "%s: %d: " x "\n",__FILE__, __LINE__, ##args);
-
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/CFLAGS b/testcases/open_posix_testsuite/functional/threads/pi_test/CFLAGS
deleted file mode 100644
index a1e2b5c..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/CFLAGS
+++ /dev/null
@@ -1 +0,0 @@
--I"$(srcdir)/../include"
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/LDLIBS b/testcases/open_posix_testsuite/functional/threads/pi_test/LDLIBS
deleted file mode 100644
index 1d2c98f..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/LDLIBS
+++ /dev/null
@@ -1 +0,0 @@
--lpthread
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/README b/testcases/open_posix_testsuite/functional/threads/pi_test/README
deleted file mode 100644
index ae644c9..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/README
+++ /dev/null
@@ -1,98 +0,0 @@
-Real Time NPTL(rt-nptl) test suite README
-=========================================
-
-The document describes what rt-nptl tests are, how they are created,
-how to make and run the tests and how to analysis the result.
-
-rt-nptl tests include two parts, one is robust mutex tests, the other
-is priority inheritance(pi) mutex tests.
-
-In the document, <rtnptl-tests> stands for the directory where
-rtnptl-tests was extracted.
-
-
-Building the tests
--------------------
-If you use the build method outlined in INSTALL-rtnptl, then just
-change the top Makefile and the two Makefile under pi_test and
-robust_test to include the Makefile.inc generated by INSTALL-rtnptl.
-
-Otherwise, you need to set the CFLAGS and LDFLAGS of the Makefile to
-point to where your copy of glibc+RTNPTL is built.
-
-Run the tests
-----------------
-Use ./run.sh to run the tests; this makes sure there is a basic
-watchdog timer to kill the pi mutex tests if they fail.
-
-For different tests, there are different result analysis methods. The
-following two sections will describe this in detail.
-
-Priority Inheritance Mutex Tests
---------------------------
-The tests are under <rtnptl-tests>/pi_test directory.
-
-rt-nptl supports priority inheritance, if task TL with priority P(TL)
-held a mutex, task TB with priority P(TB) claims the mutex and becomes
-a waiter, P(TB)>P(TL), TL will boost to TB's priority until it
-releases the lock. The pi mutex tests create several scenarios to test
-this functionality. Please refer to the description in the tests for
-the detailed information.
-
-Currently pi mutex tests don't provide automatic PASS or FAIL result
-display. Although users can use run.sh under <rtnptl-tests>/pi_test to
-run the pi mutex tests, they need to analyze the output to get the
-PASS or FAIL test result manually. After executing run.sh, the output
-files will be generated with the name output.<testcasename>, such as
-output.pitest-1.
-
-If users use run.sh from ssh, to avoid the priority inversion
-problem happened occasionally, users can use "chrt -p -f $PRIORITY
-$$PPID" to increase the priority of sshd, if use run.sh from console,
-users can use "chrt -p -f $PRIORITY $$" to increase the shell priority
-before executing run.sh.
-
-A sampling thread will sample the progress of working threads (TL, TPs
-and TFs) at a specified interval and print out an integer value.
-Progress of TL and TP is measured by how many times they execute a
-busy loop; the output of this count indicates how far they progress
-with respect to each other.
-
-The first column of the output is the time when sampling happens. The
-second column indicates the progress of TL thread at that time. The
-third column indicates the progress of TP at that time. For pitest-2
-and pitest-3, the second column is TP1 and the third column is TP2.
-The remaining columns indicate the progress of TF (if any).
-
-If the priority of TL is higher than (or equal to) the priority of TP,
-TP will make not progress (the output of TP will not increase, since
-it will not be scheduled to execute). Otherwise, TP and TL will both
-make progress. As a result, Users can observe the priority change of
-TL by the progress of TP.
-
-Users can also use 'do-plot' utility under <rtnptl-tests>/pi_test to
-generate a diagram using the output of test case. To do so:
-
-1. Redirect the output of test case into a file, e.g:
-	pitest-1 > output.pitest-1
-
-2. Under X term, run:
-	do-plot output.pitest-1
-
-do-plot will invoke 'gnuplot' to generate a diagram showing the
-progress of TL and TP. ('gnuplot has to be installed in the system').
-
-Given pitest-1 as an example:
-If the pi function works, TF's progress should be a straight line
-constantly going up; TP's progress should start at about 10 seconds
-and should be parallel to TF's until ten seconds later (20 seconds)
-when TL is created; at this time TP's slope should go down a wee bit
-and TL's slope should not be zero. After 10 seconds (30 seconds), TB
-is created and TL boosted. At this moment, TP's slope should go down
-to zero and TL's should be parallel to TF's. After TB timeouts on
-waiting the mutex (50 seconds), TL and TP's slope will change back to
-the original trend during 20~30 seconds.
-
-You can refer to
-http://developer.osdl.org/dev/robustmutexes/pitest-1-0.5.png for the
-diagram generated by do-plot for pitest-1.
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/do-plot b/testcases/open_posix_testsuite/functional/threads/pi_test/do-plot
deleted file mode 100755
index 17a1ccc..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/do-plot
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /bin/sh
-
-FILE=$1
-TMP=$(mktemp -d /tmp/tmp.XXXXXX)
-function error
-{
-    cat 1>&2
-    exit 1
-    rm -rf $TMP
-}
-
-if ! cols=$(grep "#[ ]*COLUMNS" $FILE)
-then
-    error <<EOF
-E: $FILE: Cannot locate the COLUMNS descriptor
-EOF
-fi
-cols=$(echo $cols | sed 's/#//')
-columns=$(echo $cols | awk '{print $2;}')
-count=1
-while [ $count -le $columns ]
-do
-  column[$count]=$(echo $cols | awk -vcount=$count '{print $(2 + count);}')
-  if [ -z "${column[$count]}" ]
-      then
-      column[$count]=$count;
-  fi
-  count=$(($count + 1))
-done
-
-# Set up the plot area
-count=2
-with="with dots"
-cat > $TMP/gnuplot.script <<EOF
-set xlabel "${column[1]} (s)"
-set ylabel "Progress"
-EOF
-
-# Plot the events
-height=15
-grep "#[ ]*EVENT" $FILE | sed 's/#//' > $TMP/events
-cat $TMP/events | while read event x text
-do
-  if ! [ $event = "EVENT" ]
-      then
-      cat 1>&2 <<EOF
-E: Unknown event type "$event", ignoring
-EOF
-      continue;
-  fi
-  height_text=$(($height + 2))
-  echo "set arrow from $x, graph 0 to $x, graph 0.$height" >> $TMP/gnuplot.script
-  echo "set label \"$text\" at $x, graph 0.$height_text center" >> $TMP/gnuplot.script
-  height=$(($height + 8))
-done
-
-# Set Key
-echo "set key left top box lt 0" >> $TMP/gnuplot.script
-# Plot the data
-echo "plot '$FILE' using 1:2 title \"${column[$count]}\" $with" >> $TMP/gnuplot.script
-count=3
-while [ $count -le $columns ]
-do
-  echo "replot '$FILE' using 1:$count title \"${column[$count]}\" $with" \
-      >> $TMP/gnuplot.script
-  count=$(($count + 1))
-done
-
-
-( cat $TMP/gnuplot.script; cat ) | gnuplot
-rm -rf $TMP
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c
deleted file mode 100644
index 581edee..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-1.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-/* There are n TF threads, n is equal to the processors in the system minus
- * one. TFs are used to keep busy these CPUs, which have priority 3. A
- * TL thread with lower priority 1 is created, which locks a mutex and
- * does workload. A TB thread with higher priority 4 is created and try
- * to lock TL's mutex. A TP thread with priority 2 is created to reflect the
- * priority change of TL. Main thread has the highest priority 6, which will
- * control the running steps of those threads, including creating threads,
- * stopping threads. There is another thread to collect the sample data with
- * priority 5.
- *
- * Steps:
- * 1.	Create n TF threads, n is equal to processors number minus one. TF
- * 	will do workload.
- * 2.	Create 1 TP thread and do workload. The thread will keep running when
- * 	TL is created.
- * 3.	Create 1 TL thread to lock a mutex. TL will get a chance to run
- *      when TP sleep a wee bit in between.
- * 4.	Create 1 TB thread to lock the mutex. TL's priority will boost to
- *  	TB's priority, which will cause TP having no chance to run.
- * 5.	TB timeout from the lock, TL's priority will decrease, so TP and TL
- * 	will keep working as before.
- * 5.	Keep running for a while to let TL stabilize.
- * 6.	Stop these threads.
- *
- * Thanks Inaky.Perez-Gonzalez's suggestion and code
- */
-
-#ifdef	__linux__
-#define	_GNU_SOURCE
-#endif
-#include <errno.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include "test.h"
-#include "posixtest.h"
-#include "pitest.h"
-
-int cpus;
-pthread_mutex_t mutex;
-
-volatile int ts_stop = 0;
-volatile double base_time;
-
-struct thread_param {
-	int index;
-	volatile int stop;
-	int sleep_ms;
-	int priority;
-	int policy;
-	const char *name;
-	int cpu;
-	volatile unsigned futex;
-	volatile unsigned should_stall;
-	volatile unsigned progress;
-} tp[] = {
-	{
-	0, 0, 0, 1, SCHED_FIFO, "TL", 0, 0, 0, 0}, {
-	1, 0, 50, 2, SCHED_FIFO, "TP", 0, 0, 0, 0}, {
-	2, 0, 0, 3, SCHED_FIFO, "TF", 1, 0, 0, 0}, {
-	3, 0, 0, 3, SCHED_FIFO, "TF", 2, 0, 0, 0}, {
-	4, 0, 0, 3, SCHED_FIFO, "TF", 3, 0, 0, 0}, {
-	5, 0, 0, 3, SCHED_FIFO, "TF", 4, 0, 0, 0}, {
-	6, 0, 0, 3, SCHED_FIFO, "TF", 5, 0, 0, 0}, {
-	7, 0, 0, 3, SCHED_FIFO, "TF", 6, 0, 0, 0}
-};
-
-volatile unsigned do_work_dummy;
-void do_work(unsigned granularity_top, volatile unsigned *progress)
-{
-	unsigned granularity_cnt, i;
-	unsigned top = 5 * 1000 * 1000;
-	unsigned dummy = do_work_dummy;
-
-	for (granularity_cnt = 0; granularity_cnt < granularity_top;
-	     granularity_cnt++) {
-		for (i = 0; i < top; i++)
-			dummy = i | dummy;
-		(*progress)++;
-	}
-	return;
-}
-
-void *thread_fn(void *param)
-{
-	struct thread_param *tp = param;
-	struct timespec ts;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity(0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF("UNRESOLVED: Thread %s index %d: Can't set affinity: "
-			"%d %s", tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f %s Thread Started\n",
-		seconds_read() - base_time, tp->name);
-	tp->progress = 0;
-	ts.tv_sec = 0;
-	ts.tv_nsec = tp->sleep_ms * 1000 * 1000;
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (tp->sleep_ms == 0)
-			continue;
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0) {
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s \n", tp->name, tp->index, rc,
-				strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-
-	DPRINTF(stdout, "#EVENT %f %s Thread Stopped\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_tl(void *param)
-{
-	struct thread_param *tp = param;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-	int rc;
-
-	rc = sched_setaffinity((pid_t) 0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF
-		    ("UNRESOLVED: Thread %s index %d: Can't set affinity: %d %s",
-		     tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f Thread TL Started\n",
-		seconds_read() - base_time);
-	tp->progress = 0;
-	pthread_mutex_lock(&mutex);
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-	}
-	pthread_mutex_unlock(&mutex);
-
-	DPRINTF(stdout, "#EVENT %f Thread TL Stopped\n",
-		seconds_read() - base_time);
-	return NULL;
-}
-
-void *thread_sample(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	char buffer[1024];
-	struct timespec ts;
-	double period = 250;
-	double newtime;
-	size_t size;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 5);
-	DPRINTF(stderr, "Thread Sampler: started \n");
-	DPRINTF(stdout, "# COLUMNS %d Time TL TP ", 2 + cpus);
-	for (i = 0; i < (cpus - 1); i++)
-		DPRINTF(stdout, "TF%d ", i);
-	DPRINTF(stdout, "\n");
-	ts.tv_sec = 0;
-	ts.tv_nsec = period * 1000 * 1000;
-	while (!ts_stop) {
-		newtime = seconds_read();
-		size = snprintf(buffer, 1023, "%f ", newtime - base_time);
-		for (i = 0; i < cpus + 1; i++)
-			size +=
-			    snprintf(buffer + size, 1023 - size, "%u ",
-				     tp[i].progress);
-		DPRINTF(stdout, "%s \n", buffer);
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0)
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-	}
-	return NULL;
-}
-
-void *thread_tb(void *arg)
-{
-	struct timespec boost_time;
-	double seconds, t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 4);
-
-	DPRINTF(stdout, "#EVENT %f TB Starts\n", seconds_read() - base_time);
-
-	boost_time.tv_sec = time(NULL) + *((time_t *) arg);
-	boost_time.tv_nsec = 0;
-
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex, &boost_time);
-	t1 = seconds_read();
-	seconds = t1 - t0;
-
-	DPRINTF(stdout, "#EVENT %f TB Waited for %.2f s\n",
-		t1 - base_time, seconds);
-
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB: lock returned %d %s, ", rc,
-			strerror(rc));
-		exit(FAIL);
-	}
-	DPRINTF(stderr, "Thread TB: DONE. lock returned %d %s, "
-		"slept %f \n", rc, strerror(rc), seconds)
-
-	    return NULL;
-}
-
-int main(void)
-{
-	cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	pthread_mutexattr_t mutex_attr;
-	pthread_attr_t threadattr;
-	pthread_t threads[cpus - 1], threadsample, threadtp, threadtl, threadtb;
-
-	int multiplier = 1;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 6);
-	base_time = seconds_read();
-
-	/* Initialize a mutex with PTHREAD_PRIO_INHERIT protocol */
-	mutex_attr_init(&mutex_attr);
-	mutex_init(&mutex, &mutex_attr);
-
-	/* Initialize thread attr */
-	threadattr_init(&threadattr);
-
-	/* Start the sample thread */
-	DPRINTF(stderr, "Main Thread: start sample thread \n");
-	rc = pthread_create(&threadsample, &threadattr, thread_sample, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-
-	/* Start the TF threads */
-	DPRINTF(stderr, "Main Thread: start %d TF thread\n", cpus - 1);
-	for (i = 0; i < cpus - 1; i++) {
-		rc = pthread_create(&threads[i], &threadattr, thread_fn,
-				    &tp[i + 2]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	sleep(base_time + multiplier * 10 - seconds_read());
-
-	/* Start TP thread */
-
-	DPRINTF(stderr, "Main Thread: start TP thread\n");
-	rc = pthread_create(&threadtp, &threadattr, thread_fn, &tp[1]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 20 - seconds_read());
-
-	/* Start TL thread */
-	DPRINTF(stderr, "Main Thread: start TL thread\n");
-	rc = pthread_create(&threadtl, &threadattr, thread_tl, &tp[0]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 30 - seconds_read());
-
-	/* Start TB thread (boosting thread) */
-	DPRINTF(stderr, "Main Thread: start TB thread\n");
-	time_t timeout = multiplier * 20;
-	rc = pthread_create(&threadtb, &threadattr, thread_tb, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 60 - seconds_read());
-
-	/* Stop TL thread */
-
-	DPRINTF(stderr, "Main Thread: stop TL thread\n");
-	tp[0].stop = 1;
-	sleep(base_time + multiplier * 70 - seconds_read());
-
-	/* Stop TP thread */
-	DPRINTF(stderr, "Main Thread: stop TP thread\n");
-	tp[1].stop = 1;
-	sleep(base_time + multiplier * 80 - seconds_read());
-
-	/* Stop TF threads */
-	DPRINTF(stderr, "Main Thread: stop TF threads\n");
-	for (i = 2; i < cpus - 1; i++) {
-		tp[i].stop = 1;
-	}
-
-	/* Stop sampler */
-	ts_stop = 1;
-	DPRINTF(stderr, "Main Thread: stop sampler thread \n");
-	return 0;
-}
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-2.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-2.c
deleted file mode 100644
index 19ac67b..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-2.c
+++ /dev/null
@@ -1,361 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-/* There are n TF threads, n is equal to the processors in the system minus
- * one. TFs are used to keep busy these CPUs, which have priority 3. A
- * TL thread with lower priority 1 is created, which locks a mutex and
- * does workload. One TB1 and one TB2 thread with higher priority 4, 6 are
- * created and try to lock TL's mutex. One TP1 and one TP2 thread with priority
- * 2, 5 are created to reflect the priority change of TL. Main thread
- * has the highest priority 8, which will control the running steps of
- * those threads, including creating threads, stopping threads. There is
- * another thread to collect the sample data with priority 7.
- *
- * Steps:
- * 1.	Create n TF threads, n is equal to processors number minus one. TF
- * 	will do workload.
- * 2.	Create 2 TP threads(TP1, TP2) and do workload. The 2 threads will
- * 	keep running when TL is created.
- * 3.	Create 1 TL thread to lock a mutex. TL will get a chance to run
- *      when TPs sleep a wee bit in between.
- * 4.	Create 1 TB1 thread with higher priority than TP1 to lock the mutex.
- * 	TL's priority will boost to TB1's priority, which will cause TP1 having
- * 	no chance to run.
- * 5.	Create 1 TB2 thread with higher priority than TP2 to lock the mutex,
- * 	TL's priority will boost to TB2's priority, which wll cause TP2 having
- * 	no chance to run.
- * 6.	TB1, TL will timeout later.
- * 7.	Stop these threads.
- *
- */
-
-#ifdef	__linux__
-#define	_GNU_SOURCE
-#endif
-#include <errno.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include "test.h"
-#include "posixtest.h"
-#include "pitest.h"
-
-int cpus;
-pthread_mutex_t mutex;
-volatile int ts_stop = 0;
-volatile double base_time;
-
-struct thread_param {
-	int index;
-	volatile int stop;
-	int sleep_ms;
-	int priority;
-	int policy;
-	const char *name;
-	int cpu;
-	volatile unsigned futex;
-	volatile unsigned should_stall;
-	volatile unsigned progress;
-} tp[] = {
-	{
-	0, 0, 0, 1, SCHED_FIFO, "TL", 0, 0, 0, 0}, {
-	1, 0, 500, 2, SCHED_FIFO, "TP1", 0, 0, 0, 0}, {
-	2, 0, 500, 5, SCHED_FIFO, "TP2", 0, 0, 0, 0}, {
-	3, 0, 0, 3, SCHED_FIFO, "TF", 1, 0, 0, 0}, {
-	4, 0, 0, 3, SCHED_FIFO, "TF", 2, 0, 0, 0}, {
-	5, 0, 0, 3, SCHED_FIFO, "TF", 3, 0, 0, 0}, {
-	6, 0, 0, 3, SCHED_FIFO, "TF", 4, 0, 0, 0}, {
-	7, 0, 0, 3, SCHED_FIFO, "TF", 5, 0, 0, 0}, {
-	8, 0, 0, 3, SCHED_FIFO, "TF", 6, 0, 0, 0}
-};
-
-volatile unsigned do_work_dummy;
-void do_work(unsigned granularity_top, volatile unsigned *progress)
-{
-	unsigned granularity_cnt, i;
-	unsigned top = 5 * 1000 * 1000;
-	unsigned dummy = do_work_dummy;
-
-	for (granularity_cnt = 0; granularity_cnt < granularity_top;
-	     granularity_cnt++) {
-		for (i = 0; i < top; i++)
-			dummy = i | dummy;
-		(*progress)++;
-	}
-	return;
-}
-
-void *thread_fn(void *param)
-{
-	struct thread_param *tp = param;
-	struct timespec ts;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity(0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF("UNRESOLVED: Thread %s index %d: Can't set affinity: "
-			"%d %s", tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-	DPRINTF(stdout, "#EVENT %f Thread %s Started\n",
-		seconds_read() - base_time, tp->name);
-	DPRINTF(stderr, "Thread %s index %d: started \n", tp->name, tp->index);
-	tp->progress = 0;
-	ts.tv_sec = 0;
-	ts.tv_nsec = tp->sleep_ms * 1000 * 1000;
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (tp->sleep_ms == 0)
-			continue;
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0) {
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	DPRINTF(stdout, "#EVENT %f Thread %s Stopped\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_tl(void *param)
-{
-	struct thread_param *tp = param;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-	int rc;
-
-	rc = sched_setaffinity((pid_t) 0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF
-		    ("UNRESOLVED: Thread %s index %d: Can't set affinity: %d %s",
-		     tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f Thread TL Started\n",
-		seconds_read() - base_time);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-	tp->progress = 0;
-	pthread_mutex_lock(&mutex);
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-	}
-	pthread_mutex_unlock(&mutex);
-	DPRINTF(stdout, "#EVENT %f Thread TL Stoped\n",
-		seconds_read() - base_time);
-	return NULL;
-}
-
-void *thread_sample(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	char buffer[1024];
-	struct timespec ts;
-	double period = 300;
-	double newtime;
-	size_t size;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 7);
-	DPRINTF(stderr, "Thread Sampler: started \n");
-	DPRINTF(stdout, "# COLUMNS %d Time TL TP1 TP2 ", 3 + cpus);
-	for (i = 0; i < (cpus - 1); i++)
-		DPRINTF(stdout, "TF%d ", i);
-	DPRINTF(stdout, "\n");
-	ts.tv_sec = 0;
-	ts.tv_nsec = period * 1000 * 1000;
-	while (!ts_stop) {
-		newtime = seconds_read();
-		size = snprintf(buffer, 1023, "%f ", newtime - base_time);
-		for (i = 0; i < cpus + 2; i++)
-			size +=
-			    snprintf(buffer + size, 1023 - size, "%u ",
-				     tp[i].progress);
-		DPRINTF(stdout, "%s \n", buffer);
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0)
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-	}
-	return NULL;
-}
-
-void *thread_tb1(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 4);
-
-	DPRINTF(stderr, "Thread TB1: started\n");
-	DPRINTF(stdout, "#EVENT %f TB1 Thread Started\n",
-		seconds_read() - base_time);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex, &boost_time);
-	t1 = seconds_read();
-	DPRINTF(stdout, "#EVENT %f TB1 Thread Waited for %.2f s\n",
-		t1 - base_time, t1 - t0);
-
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB1: lock returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-	return NULL;
-}
-
-void *thread_tb2(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 6);
-
-	DPRINTF(stderr, "Thread TB2: started\n");
-	DPRINTF(stdout, "#EVENT %f TB2 Thread Started\n",
-		seconds_read() - base_time);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex, &boost_time);
-	t1 = seconds_read();
-	DPRINTF(stdout, "#EVENT %f TB2 Thread Waited for %.2f s\n",
-		t1 - base_time, t1 - t0);
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB2: lock returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-	return NULL;
-}
-
-int main(void)
-{
-	cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	pthread_mutexattr_t mutex_attr;
-	pthread_attr_t threadattr;
-	pthread_t threads[cpus - 1];
-	pthread_t threadsample, threadtp, threadtl, threadtb1, threadtb2;
-
-	time_t multiplier = 1;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 8);
-	base_time = seconds_read();
-
-	/* Initialize a mutex with PTHREAD_PRIO_INHERIT protocol */
-	mutex_attr_init(&mutex_attr);
-	mutex_init(&mutex, &mutex_attr);
-
-	/* Initialize thread attr */
-	threadattr_init(&threadattr);
-
-	/* Start the sample thread */
-	DPRINTF(stderr, "Main Thread: Creating sample thread \n");
-	rc = pthread_create(&threadsample, &threadattr, thread_sample, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-
-	/* Start the TF threads */
-	DPRINTF(stderr, "Main Thread: Creating %d TF threads \n", cpus - 1);
-	for (i = 0; i < cpus - 1; i++) {
-		rc = pthread_create(&threads[i], &threadattr, thread_fn,
-				    &tp[i + 3]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	sleep(base_time + multiplier * 10 - seconds_read());
-
-	/* Start TP1, TP2 thread */
-	DPRINTF(stderr, "Main Thread: Creating TP1, TP2 thread \n");
-	for (i = 1; i <= 2; i++) {
-		rc = pthread_create(&threadtp, &threadattr, thread_fn, &tp[i]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	sleep(base_time + multiplier * 20 - seconds_read());
-
-	/* Start TL thread */
-	DPRINTF(stderr, "Main Thread: Creating TL thread\n");
-	rc = pthread_create(&threadtl, &threadattr, thread_tl, &tp[0]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 30 - seconds_read());
-
-	/* Start TB1 thread (boosting thread) */
-	time_t timeout = multiplier * 20;
-	rc = pthread_create(&threadtb1, &threadattr, thread_tb1, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 60 - seconds_read());
-
-	/* Start TB2 thread (boosting thread) */
-	rc = pthread_create(&threadtb2, &threadattr, thread_tb2, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 90 - seconds_read());
-
-	/* Stop TL thread */
-	tp[0].stop = 1;
-	sleep(base_time + multiplier * 100 - seconds_read());
-
-	/* Stop TP thread */
-	tp[1].stop = 1;
-	sleep(base_time + multiplier * 110 - seconds_read());
-
-	tp[2].stop = 1;
-	sleep(base_time + multiplier * 120 - seconds_read());
-
-	/* Stop TF threads */
-	for (i = 2; i < cpus - 1; i++) {
-		tp[i].stop = 1;
-	}
-
-	/* Stop sampler */
-	ts_stop = 1;
-	DPRINTF(stderr, "Main Thread: stop sampler thread \n");
-	return 0;
-}
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-3.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-3.c
deleted file mode 100644
index 586785b..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-3.c
+++ /dev/null
@@ -1,373 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-/* There are n TF threads, n is equal to the processors in the system minus
- * one. TFs are used to keep busy these CPUs, which have priority 3. A
- * TL thread with lower priority 1 is created, which locks 2 mutex and
- * does workload. A TB1 thread with high priority 4 is created and try
- * to lock mutex1 of TL. A TB2 thread with high priority 6 is created and
- * try to lock mutex2 of TL. TL's priority should boost to TB2's priority.
- * There are another 2 threads TP1 and TP2, which are used to check the
- * priority change of TL, P(TP1)<P(TB1)<P(TP2)<P(TB2), P(TH) stands for
- * the priority of TH thread. Main thread has the highest priority 8,
- * which will control the running steps of those threads, including
- * creating threads, stopping threads. There is another thread to collect
- * the sample data with priority 7.
- *
- * Steps:
- * 1.	Create n TF threads, n is equal to processors number minus one. TF
- * 	will do workload.
- * 2.	Create 2 TP threads: TP1 and TP2 and do workload. The 2 threads
- * 	will keep running when TL is created.
- * 3.	Create 1 TL thread to lock 2 mutex: mutex1 and mutex2. TL will get
- * 	a chance to run when TP sleep a wee bit in between.
- * 4.	Create 1 TB1 thread to lock mutex1. TL's priority will boost to
- *  	TB1's priority, which will cause TP1 having no chance to run.
- * 5.	Create 1 TB2 thread to lock mutex2. TL's priority will boost to
- *  	TB2's priority, which will cause TP1, TP2 having no chance to run.
- * 6.	Stop these threads.
- *
- */
-
-#ifdef	__linux__
-#define	_GNU_SOURCE
-#endif
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sched.h>
-#include <errno.h>
-#include "test.h"
-#include "posixtest.h"
-#include "pitest.h"
-
-int cpus;
-pthread_mutex_t mutex1;
-pthread_mutex_t mutex2;
-volatile int ts_stop = 0;
-volatile double base_time;
-
-struct thread_param {
-	int index;
-	volatile int stop;
-	int sleep_ms;
-	int priority;
-	int policy;
-	const char *name;
-	int cpu;
-	volatile unsigned futex;
-	volatile unsigned should_stall;
-	volatile unsigned progress;
-} tp[] = {
-	{
-	0, 0, 0, 1, SCHED_FIFO, "TL", 0, 0, 0, 0}, {
-	1, 0, 500, 2, SCHED_FIFO, "TP1", 0, 0, 0, 0}, {
-	1, 0, 500, 5, SCHED_FIFO, "TP2", 0, 0, 0, 0}, {
-	2, 0, 0, 3, SCHED_FIFO, "TF", 1, 0, 0, 0}, {
-	3, 0, 0, 3, SCHED_FIFO, "TF", 2, 0, 0, 0}, {
-	4, 0, 0, 3, SCHED_FIFO, "TF", 3, 0, 0, 0}, {
-	5, 0, 0, 3, SCHED_FIFO, "TF", 4, 0, 0, 0}, {
-	6, 0, 0, 3, SCHED_FIFO, "TF", 5, 0, 0, 0}, {
-	7, 0, 0, 3, SCHED_FIFO, "TF", 6, 0, 0, 0}
-};
-
-volatile unsigned do_work_dummy;
-void do_work(unsigned granularity_top, volatile unsigned *progress)
-{
-	unsigned granularity_cnt, i;
-	unsigned top = 5 * 1000 * 1000;
-	unsigned dummy = do_work_dummy;
-
-	for (granularity_cnt = 0; granularity_cnt < granularity_top;
-	     granularity_cnt++) {
-		for (i = 0; i < top; i++)
-			dummy = i | dummy;
-		(*progress)++;
-	}
-	return;
-}
-
-void *thread_fn(void *param)
-{
-	struct thread_param *tp = param;
-	struct timespec ts;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity(0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF("UNRESOLVED: Thread %s index %d: Can't set affinity: "
-			"%d %s", tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f Thread %s Started\n",
-		seconds_read() - base_time, tp->name);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-
-	tp->progress = 0;
-	ts.tv_sec = 0;
-	ts.tv_nsec = tp->sleep_ms * 1000 * 1000;
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (tp->sleep_ms == 0)
-			continue;
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0) {
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-
-	DPRINTF(stdout, "#EVENT %f Thread %s Stopped\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_tl(void *param)
-{
-	struct thread_param *tp = param;
-
-#if __linux__
-	int rc;
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity((pid_t) 0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF
-		    ("UNRESOLVED: Thread %s index %d: Can't set affinity: %d %s",
-		     tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-	DPRINTF(stdout, "#EVENT %f Thread TL Started\n",
-		seconds_read() - base_time);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-
-	tp->progress = 0;
-	pthread_mutex_lock(&mutex1);
-	pthread_mutex_lock(&mutex2);
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-	}
-
-	pthread_mutex_unlock(&mutex1);
-	pthread_mutex_unlock(&mutex2);
-	DPRINTF(stdout, "#EVENT %f Thread TL Stopped\n",
-		seconds_read() - base_time);
-	return NULL;
-}
-
-void *thread_sample(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	char buffer[1024];
-	struct timespec ts;
-	double period = 300;
-	double newtime;
-	size_t size;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 7);
-	DPRINTF(stderr, "Thread Sampler: started\n");
-
-	DPRINTF(stdout, "# COLUMNS %d Time TL TP1 TP2  ", 3 + cpus);
-
-	for (i = 0; i < (cpus - 1); i++)
-		DPRINTF(stdout, "TF%d ", i);
-	DPRINTF(stdout, "\n");
-
-	ts.tv_sec = 0;
-	ts.tv_nsec = period * 1000 * 1000;
-	while (!ts_stop) {
-		newtime = seconds_read();
-		size = snprintf(buffer, 1023, "%f ", newtime - base_time);
-		for (i = 0; i < cpus + 2; i++)
-			size +=
-			    snprintf(buffer + size, 1023 - size, "%u ",
-				     tp[i].progress);
-		DPRINTF(stdout, "%s\n", buffer);
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0)
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-	}
-	return NULL;
-}
-
-void *thread_tb1(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 4);
-	DPRINTF(stderr, "Thread TB1: started\n");
-	DPRINTF(stdout, "#EVENT %f Thread TB1 Started\n",
-		seconds_read() - base_time);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex1, &boost_time);
-	t1 = seconds_read();
-
-	DPRINTF(stdout, "#EVENT %f Thread TB1 Waited for %.2f s\n",
-		t1 - base_time, t1 - t0);
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB1: lock returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-	return NULL;
-}
-
-void *thread_tb2(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 6);
-	DPRINTF(stderr, "Thread TB2: started\n");
-	DPRINTF(stdout, "#EVENT %f Thread TB2 Started\n",
-		seconds_read() - base_time);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex2, &boost_time);
-	t1 = seconds_read();
-
-	DPRINTF(stdout, "#EVENT %f Thread TB2 waited %.2f s\n",
-		t1 - base_time, t1 - t0);
-
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB2: lock returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-
-	return NULL;
-}
-
-int main(void)
-{
-	cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	pthread_mutexattr_t mutex_attr;
-	pthread_attr_t threadattr;
-	pthread_t threads[cpus - 1];
-	pthread_t threadsample, threadtp, threadtl, threadtb1, threadtb2;
-
-	time_t multiplier = 1;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 8);
-	base_time = seconds_read();
-
-	/* Initialize mutex1, mutex2 with PTHREAD_PRIO_INHERIT protocol */
-	mutex_attr_init(&mutex_attr);
-	mutex_init(&mutex1, &mutex_attr);
-	mutex_init(&mutex2, &mutex_attr);
-
-	/* Initialize thread attr */
-	threadattr_init(&threadattr);
-
-	/* Start the sample thread */
-	DPRINTF(stderr, "Main Thread: Creating sample thread\n");
-	rc = pthread_create(&threadsample, &threadattr, thread_sample, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-
-	/* Start the TF threads */
-	DPRINTF(stderr, "Main Thread: Creating %d TF threads\n", cpus - 1);
-	for (i = 0; i < cpus - 1; i++) {
-		rc = pthread_create(&threads[i], &threadattr, thread_fn,
-				    &tp[i + 3]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	sleep(base_time + multiplier * 10 - seconds_read());
-
-	/* Start TP1, TP2 thread */
-	DPRINTF(stderr, "Main Thread: Creating TP1, TP2 thread\n");
-	for (i = 1; i <= 2; i++) {
-		rc = pthread_create(&threadtp, &threadattr, thread_fn, &tp[i]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	sleep(base_time + multiplier * 20 - seconds_read());
-
-	/* Start TL thread */
-	DPRINTF(stderr, "Main Thread: Creating TL thread\n");
-	rc = pthread_create(&threadtl, &threadattr, thread_tl, &tp[0]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 30 - seconds_read());
-
-	/* Start TB1 thread (boosting thread) */
-	time_t timeout = multiplier * 20;
-	rc = pthread_create(&threadtb1, &threadattr, thread_tb1, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 60 - seconds_read());
-
-	/* Start TB2 thread (boosting thread) */
-	rc = pthread_create(&threadtb2, &threadattr, thread_tb2, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 90 - seconds_read());
-
-	/* Stop TL thread */
-	tp[0].stop = 1;
-	sleep(base_time + multiplier * 100 - seconds_read());
-
-	/* Stop TP thread */
-	tp[1].stop = 1;
-	sleep(base_time + multiplier * 110 - seconds_read());
-
-	tp[2].stop = 1;
-	sleep(base_time + multiplier * 120 - seconds_read());
-
-	/* Stop TF threads */
-	for (i = 2; i < cpus - 1; i++) {
-		tp[i].stop = 1;
-	}
-
-	/* Stop sampler */
-	ts_stop = 1;
-	DPRINTF(stderr, "Main Thread: stop sampler thread\n");
-	return 0;
-}
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c
deleted file mode 100644
index 2d81b28..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c
+++ /dev/null
@@ -1,337 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-/* There are n TF threads, n is equal to the processors in the system minus
- * one. TFs are used to keep busy these CPUs, which have priority 4. A
- * TL thread with priority 1 is created, which locks mutex1 and
- * does workload. A TB1 thread with higher priority 2 is created and try
- * to lock mutex1 of TL, TB1 will also lock another mutex mutex2. A TB2 thread
- * with high priority 5 is created and try to lock mutex2 of TB1. Then TB's
- * priority will boost to TB2's, and TL's priority will boost to TB1's.
- * There are another 1 thread TP, which is used to check the
- * priority change of TL, P(TB1)<P(TL)<P(TP)<P(TB2), P(TH) stands for
- * the priority of TH thread. Main thread has the highest priority 8,
- * which will control the running steps of those threads, including
- * creating threads, stopping threads. There is another thread to collect
- * the sample data with priority 7.
- *
- * Steps:
- * 1.	Create n TF threads, n is equal to processors number minus one. TF
- * 	will do workload.
- * 2.	Create 1 TP threads and do workload. The thread
- * 	will keep running when TL is created.
- * 3.	Create 1 TL thread to lock mutex1. TL will get a chance to
- * 	run when TP sleep a wee bit in between.
- * 4.	Create 1 TB1 thread to lock mutex2 and try to lock mutex1, TL's priority will
- *	be boosted to TB1
- * 5.	Create 1 TB2 thread to lock mutex2. TB1's priority will boost to
- *  	TB2's priority, then TL's priority will boost to TB1's new priority.
- * 6.	Stop these threads.
- *
- */
-
-#ifdef	__linux__
-#define	_GNU_SOURCE
-#endif
-#include <errno.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include "posixtest.h"
-#include "test.h"
-#include "pitest.h"
-
-int cpus;
-pthread_mutex_t mutex1;
-pthread_mutex_t mutex2;
-volatile int ts_stop = 0;
-volatile double base_time;
-
-struct thread_param {
-	int index;
-	volatile int stop;
-	int sleep_ms;
-	int priority;
-	int policy;
-	const char *name;
-	int cpu;
-	volatile unsigned futex;
-	volatile unsigned should_stall;
-	volatile unsigned progress;
-} tp[] = {
-	{
-	0, 0, 0, 1, SCHED_FIFO, "TL", 0, 0, 0, 0}, {
-	1, 0, 100, 4, SCHED_FIFO, "TP", 0, 0, 0, 0}, {
-	2, 0, 0, 2, SCHED_FIFO, "TF", 1, 0, 0, 0}, {
-	3, 0, 0, 2, SCHED_FIFO, "TF", 2, 0, 0, 0}, {
-	4, 0, 0, 2, SCHED_FIFO, "TF", 3, 0, 0, 0}, {
-	5, 0, 0, 2, SCHED_FIFO, "TF", 4, 0, 0, 0}, {
-	6, 0, 0, 2, SCHED_FIFO, "TF", 5, 0, 0, 0}, {
-	7, 0, 0, 2, SCHED_FIFO, "TF", 6, 0, 0, 0}
-};
-
-volatile unsigned do_work_dummy;
-void do_work(unsigned granularity_top, volatile unsigned *progress)
-{
-	unsigned granularity_cnt, i;
-	unsigned top = 5 * 1000 * 1000;
-	unsigned dummy = do_work_dummy;
-
-	for (granularity_cnt = 0; granularity_cnt < granularity_top;
-	     granularity_cnt++) {
-		for (i = 0; i < top; i++)
-			dummy = i | dummy;
-		(*progress)++;
-	}
-	return;
-}
-
-void *thread_fn(void *param)
-{
-	struct thread_param *tp = param;
-	struct timespec ts;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity(0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF("UNRESOLVED: Thread %s index %d: Can't set affinity: "
-			"%d %s", tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f Thread %s Started\n",
-		seconds_read() - base_time, tp->name);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-
-	tp->progress = 0;
-	ts.tv_sec = 0;
-	ts.tv_nsec = tp->sleep_ms * 1000 * 1000;
-	if (tp->index == 0)
-		pthread_mutex_lock(&mutex1);
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (tp->sleep_ms == 0)
-			continue;
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0) {
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	if (tp->index == 0)
-		pthread_mutex_unlock(&mutex1);
-
-	DPRINTF(stdout, "#EVENT %f Thread %s Stopped\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_sample(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	char buffer[1024];
-	struct timespec ts;
-	double period = 300;
-	double newtime;
-	size_t size;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 6);
-	DPRINTF(stderr, "Thread Sampler: started\n");
-	DPRINTF(stdout, "# COLUMNS %d Time TL TP ", 2 + cpus);
-	for (i = 0; i < (cpus - 1); i++)
-		DPRINTF(stdout, "TF%d ", i);
-	DPRINTF(stdout, "\n");
-	ts.tv_sec = 0;
-	ts.tv_nsec = period * 1000 * 1000;
-	while (!ts_stop) {
-		newtime = seconds_read();
-		size = snprintf(buffer, 1023, "%f ", newtime - base_time);
-		for (i = 0; i < cpus + 1; i++)
-			size +=
-			    snprintf(buffer + size, 1023 - size, "%u ",
-				     tp[i].progress);
-		DPRINTF(stdout, "%s\n", buffer);
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0)
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-	}
-	return NULL;
-}
-
-void *thread_tb1(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 3);
-	DPRINTF(stderr, "Thread TB1: started\n");
-	DPRINTF(stdout, "#EVENT %f Thread TB1 Started\n",
-		seconds_read() - base_time);
-
-	pthread_mutex_lock(&mutex2);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex1, &boost_time);
-	t1 = seconds_read();
-
-	DPRINTF(stdout, "#EVENT %f TB1 Waited on mutex1 for %.2f s\n",
-		t1 - base_time, t1 - t0);
-
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB1: lock returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-
-	pthread_mutex_unlock(&mutex2);
-	return NULL;
-}
-
-void *thread_tb2(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 5);
-	DPRINTF(stderr, "Thread TB2: started\n");
-	DPRINTF(stdout, "#EVENT %f Thread TB2 Started\n",
-		seconds_read() - base_time);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex2, &boost_time);
-	t1 = seconds_read();
-
-	DPRINTF(stdout, "#EVENT %f Thread TB2 Waited on mutex2 for %.2f s\n",
-		t1 - base_time, t1 - t0);
-
-	if (rc != ETIMEDOUT) {
-		EPRINTF("FAIL: Thread TB2: lock mutex2 returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-	return NULL;
-}
-
-int main(void)
-{
-	cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	pthread_mutexattr_t mutex_attr;
-	pthread_attr_t threadattr;
-	pthread_t threads[cpus - 1];
-	pthread_t threadsample, threadtp, threadtl, threadtb1, threadtb2;
-
-	time_t multiplier = 1;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 8);
-	base_time = seconds_read();
-
-	/* Initialize mutex1, mutex2 with PTHREAD_PRIO_INHERIT protocol */
-	mutex_attr_init(&mutex_attr);
-	mutex_init(&mutex1, &mutex_attr);
-	mutex_init(&mutex2, &mutex_attr);
-
-	/* Initialize thread attr */
-	threadattr_init(&threadattr);
-
-	/* Start the sample thread */
-	DPRINTF(stderr, "Main Thread: Creating sample thread\n");
-	rc = pthread_create(&threadsample, &threadattr, thread_sample, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-
-	/* Start the TF threads */
-	DPRINTF(stderr, "Main Thread: Creating %d TF threads\n", cpus - 1);
-	for (i = 0; i < cpus - 1; i++) {
-		rc = pthread_create(&threads[i], &threadattr, thread_fn,
-				    &tp[i + 2]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-	sleep(base_time + multiplier * 10 - seconds_read());
-
-	/* Start TP thread */
-	DPRINTF(stderr, "Main Thread: Creating TP thread\n");
-	rc = pthread_create(&threadtp, &threadattr, thread_fn, &tp[1]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 20 - seconds_read());
-
-	/* Start TL thread */
-	DPRINTF(stderr, "Main Thread: Creating TL thread\n");
-	rc = pthread_create(&threadtl, &threadattr, thread_fn, &tp[0]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 30 - seconds_read());
-
-	/* Start TB1 thread (the lowest priority thread) */
-	time_t timeout = multiplier * 40;
-	rc = pthread_create(&threadtb1, &threadattr, thread_tb1, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 40 - seconds_read());
-
-	/* Start TB2 thread (boosting thread) */
-	timeout = multiplier * 20;
-	rc = pthread_create(&threadtb2, &threadattr, thread_tb2, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 75 - seconds_read());
-
-	/* Stop TL thread */
-	tp[0].stop = 1;
-	sleep(base_time + multiplier * 85 - seconds_read());
-
-	/* Stop TP thread */
-	tp[1].stop = 1;
-	sleep(base_time + multiplier * 95 - seconds_read());
-
-	/* Stop TF threads */
-	for (i = 2; i < cpus - 1; i++) {
-		tp[i].stop = 1;
-	}
-
-	/* Stop sampler */
-	ts_stop = 1;
-	DPRINTF(stderr, "Main Thread: stop sampler thread\n");
-	return 0;
-}
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-5.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-5.c
deleted file mode 100644
index 2568b05..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-5.c
+++ /dev/null
@@ -1,345 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-/* There are n TF threads, n is equal to the processors in the system minus
- * one. TFs are used to keep busy these CPUs, which have priority 3. A
- * TL thread with lower priority 1 is created, which locks a mutex and
- * does workload. A TB thread with higher priority 4 is created and try
- * to lock TL's mutex. A TP thread with priority 2 is created to reflect the
- * priority change of TL. Main thread has the highest priority 6, which will
- * control the running steps of those threads, including creating threads,
- * stopping threads. There is another thread to collect the sample data
- * with priority 5.
- *
- * Steps:
- * 1.	Create n TF threads, n is equal to processors number minus one. TF
- * 	will do workload.
- * 2.	Create 1 TP thread and do workload. The thread will keep running when
- * 	TL is created.
- * 3.	Create 1 TL thread to lock a mutex. TL will get a chance to run
- *      when TP sleep a wee bit in between.
- * 4.	Create 1 TB thread to lock the mutex. TL's priority will boost to
- *  	TB's priority, which will cause TP having no chance to run.
- * 5.	TL will unlock the mutex,  TL's priority will decrease, so TP and TL
- * 	will keep working as before.
- * 5.	Keep running for a while to let TL stabilize.
- * 6.	Stop these threads.
- *
- * NOTE: Most of the code is ported from test-11 written by inkay.
- */
-
-#ifdef	__linux__
-#define	_GNU_SOURCE
-#endif
-#include <errno.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include "test.h"
-#include "posixtest.h"
-#include "pitest.h"
-
-int cpus;
-pthread_mutex_t mutex;
-volatile int ts_stop = 0;
-volatile double base_time;
-volatile int unlock_mutex = 0;
-
-struct thread_param {
-	int index;
-	volatile int stop;
-	int sleep_ms;
-	int priority;
-	int policy;
-	const char *name;
-	int cpu;
-	volatile unsigned futex;
-	volatile unsigned should_stall;
-	volatile unsigned progress;
-} tp[] = {
-	{
-	0, 0, 0, 1, SCHED_FIFO, "TL", 0, 0, 0, 0}, {
-	1, 0, 200, 2, SCHED_FIFO, "TP", 0, 0, 0, 0}, {
-	2, 0, 0, 3, SCHED_FIFO, "TF", 1, 0, 0, 0}, {
-	3, 0, 0, 3, SCHED_FIFO, "TF", 2, 0, 0, 0}, {
-	4, 0, 0, 3, SCHED_FIFO, "TF", 3, 0, 0, 0}, {
-	5, 0, 0, 3, SCHED_FIFO, "TF", 4, 0, 0, 0}, {
-	6, 0, 0, 3, SCHED_FIFO, "TF", 5, 0, 0, 0}, {
-	7, 0, 0, 3, SCHED_FIFO, "TF", 6, 0, 0, 0}
-};
-
-volatile unsigned do_work_dummy;
-void do_work(unsigned granularity_top, volatile unsigned *progress)
-{
-	unsigned granularity_cnt, i;
-	unsigned top = 5 * 1000 * 1000;
-	unsigned dummy = do_work_dummy;
-
-	for (granularity_cnt = 0; granularity_cnt < granularity_top;
-	     granularity_cnt++) {
-		for (i = 0; i < top; i++)
-			dummy = i | dummy;
-		(*progress)++;
-	}
-	return;
-}
-
-void *thread_fn(void *param)
-{
-	struct thread_param *tp = param;
-	struct timespec ts;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity(0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF("UNRESOLVED: Thread %s index %d: Can't set affinity: "
-			"%d %s", tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f Thread %s started\n",
-		seconds_read() - base_time, tp->name);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-
-	tp->progress = 0;
-	ts.tv_sec = 0;
-	ts.tv_nsec = tp->sleep_ms * 1000 * 1000;
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (tp->sleep_ms == 0)
-			continue;
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0) {
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-
-	DPRINTF(stdout, "#EVENT %f Thread %s stopped\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_tl(void *param)
-{
-	struct thread_param *tp = param;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity((pid_t) 0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF
-		    ("UNRESOLVED: Thread %s index %d: Can't set affinity: %d %s",
-		     tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stdout, "#EVENT %f Thread TL started\n",
-		seconds_read() - base_time);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-
-	tp->progress = 0;
-	pthread_mutex_lock(&mutex);
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (unlock_mutex == 1) {
-			rc = pthread_mutex_unlock(&mutex);
-			if (rc == 0) {
-				unlock_mutex = 0;
-				DPRINTF(stdout,
-					"#EVENT %f TL unlock the mutex\n",
-					seconds_read() - base_time);
-			} else {
-				EPRINTF
-				    ("UNRESOLVED: TL failed to unlock mutex: %d %s",
-				     rc, strerror(rc));
-				exit(UNRESOLVED);
-			}
-		}
-	}
-
-	DPRINTF(stdout, "#EVENT %f Thread TL stopped\n",
-		seconds_read() - base_time);
-	return NULL;
-}
-
-void *thread_sample(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	char buffer[1024];
-	struct timespec ts;
-	double period = 300;
-	size_t size;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 5);
-
-	DPRINTF(stderr, "Thread Sampler: started\n");
-	DPRINTF(stdout, "# COLUMNS %d Time TL TP ", 2 + cpus);
-
-	for (i = 0; i < (cpus - 1); i++)
-		DPRINTF(stdout, "TF%d ", i);
-	DPRINTF(stdout, "\n");
-
-	ts.tv_sec = 0;
-	ts.tv_nsec = period * 1000 * 1000;
-
-	while (!ts_stop) {
-		size =
-		    snprintf(buffer, 1023, "%f ", seconds_read() - base_time);
-		for (i = 0; i < cpus + 1; i++)
-			size +=
-			    snprintf(buffer + size, 1023 - size, "%u ",
-				     tp[i].progress);
-		DPRINTF(stdout, "%s\n", buffer);
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0)
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-	}
-	return NULL;
-}
-
-void *thread_tb(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	int rc;
-	struct timespec ts;
-	ts.tv_sec = 2;
-	ts.tv_nsec = 0;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 4);
-	DPRINTF(stderr, "Thread TB: started\n");
-	DPRINTF(stdout, "#EVENT %f Thread TB started,trying to lock\n",
-		seconds_read() - base_time);
-
-	rc = pthread_mutex_lock(&mutex);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: Thread TB: lock returned %d %s",
-			rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	DPRINTF(stdout, "#EVENT %f Thread TB got lock\n",
-		seconds_read() - base_time);
-
-	nanosleep(&ts, NULL);
-
-	rc = pthread_mutex_unlock(&mutex);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: Thread TB: unlock returned %d %s",
-			rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-
-	DPRINTF(stdout, "#EVENT %f Thread TB unlocked and stopped\n",
-		seconds_read() - base_time);
-
-	return NULL;
-}
-
-int main(void)
-{
-	cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	pthread_mutexattr_t mutex_attr;
-	pthread_attr_t threadattr;
-	pthread_t threads[cpus - 1], threadsample, threadtp, threadtl, threadtb;
-	time_t multiplier = 1;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 6);
-	base_time = seconds_read();
-
-	/* Initialize a mutex with PTHREAD_PRIO_INHERIT protocol */
-	mutex_attr_init(&mutex_attr);
-	mutex_init(&mutex, &mutex_attr);
-
-	/* Initialize thread attr */
-	threadattr_init(&threadattr);
-
-	/* Start the sample thread */
-	DPRINTF(stderr, "Main Thread: Creating sample thread\n");
-	rc = pthread_create(&threadsample, &threadattr, thread_sample, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	/* Start the TF threads */
-	DPRINTF(stderr, "Main Thread: Creating %d TF threads\n", cpus - 1);
-	for (i = 0; i < cpus - 1; i++) {
-		rc = pthread_create(&threads[i], &threadattr, thread_fn,
-				    &tp[i + 2]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-
-	sleep(base_time + multiplier * 10 - seconds_read());
-
-	/* Start TP thread */
-	DPRINTF(stderr, "Main Thread: Creating TP thread\n");
-	rc = pthread_create(&threadtp, &threadattr, thread_fn, &tp[1]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 20 - seconds_read());
-
-	/* Start TL thread */
-	DPRINTF(stderr, "Main Thread: Creating TL thread\n");
-	rc = pthread_create(&threadtl, &threadattr, thread_tl, &tp[0]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 30 - seconds_read());
-
-	/* Start TB thread (boosting thread) */
-	rc = pthread_create(&threadtb, &threadattr, thread_tb, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 40 - seconds_read());
-	unlock_mutex = 1;
-	sleep(base_time + multiplier * 50 - seconds_read());
-
-	/* Stop TL thread */
-	tp[0].stop = 1;
-	sleep(base_time + multiplier * 60 - seconds_read());
-
-	/* Stop TP thread */
-	tp[1].stop = 1;
-	sleep(base_time + multiplier * 70 - seconds_read());
-
-	/* Stop TF threads */
-	for (i = 2; i < cpus - 1; i++) {
-		tp[i].stop = 1;
-	}
-
-	/* Stop sampler */
-	ts_stop = 1;
-	DPRINTF(stderr, "Main Thread: stop sampler thread\n");
-	return 0;
-}
diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-6.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-6.c
deleted file mode 100644
index b873dfd..0000000
--- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-6.c
+++ /dev/null
@@ -1,328 +0,0 @@
-
-/*
- *  Copyright (c) 2003, Intel Corporation. All rights reserved.
- *  Created by:  crystal.xiong REMOVE-THIS AT intel DOT com
- *  This file is licensed under the GPL license.  For the full content
- *  of this license, see the COPYING file at the top level of this
- *  source tree.
- */
-
-/* There are n TF threads, n is equal to the processors in the system minus
- * one. TFs are used to keep busy these CPUs, which have priority 3. A
- * TL thread with lower priority 1 is created, which locks a mutex and
- * does workload. A TB thread with higher priority 4 is created and try
- * to lock TL's mutex. A TP thread with priority 2 is created to reflect the
- * priority change of TL. Main thread has the highest priority 6, which will
- * control the running steps of those threads, including creating threads,
- * stopping threads. There is another thread to collect the sample data with
- * priority 5.
- *
- * Steps:
- * 1.	Create n TF threads, n is equal to processors number minus one. TF
- * 	will do workload.
- * 2.	Create 1 TP thread and do workload. The thread will keep running when
- * 	TL is created.
- * 3.	Create 1 TL thread to lock a mutex. TL will get a chance to run
- *      when TP sleep a wee bit in between.
- * 4.	Create 1 TB thread to lock the mutex. TL's priority will boost to
- *  	TB's priority, which will cause TP having no chance to run.
- * 5.	Set TB's prioirty to 1, TL's priority will decrease. So TP and TL
- * 	will keep working as before.
- * 6.	Stop these threads.
- *
- * NOTE: Most of the code is ported from test-11 written by inkay.
- */
-
-#ifdef	__linux__
-#define	_GNU_SOURCE
-#endif
-#include <errno.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include "test.h"
-#include "posixtest.h"
-#include "pitest.h"
-
-int cpus;
-pthread_mutex_t mutex;
-volatile int ts_stop = 0;
-volatile double base_time;
-
-struct thread_param {
-	int index;
-	volatile int stop;
-	int sleep_ms;
-	int priority;
-	int policy;
-	const char *name;
-	int cpu;
-	volatile unsigned futex;
-	volatile unsigned should_stall;
-	volatile unsigned progress;
-} tp[] = {
-	{
-	0, 0, 0, 1, SCHED_FIFO, "TL", 0, 0, 0, 0}, {
-	1, 0, 200, 2, SCHED_FIFO, "TP", 0, 0, 0, 0}, {
-	2, 0, 0, 3, SCHED_FIFO, "TF", 1, 0, 0, 0}, {
-	3, 0, 0, 3, SCHED_FIFO, "TF", 2, 0, 0, 0}, {
-	4, 0, 0, 3, SCHED_FIFO, "TF", 3, 0, 0, 0}, {
-	5, 0, 0, 3, SCHED_FIFO, "TF", 4, 0, 0, 0}, {
-	6, 0, 0, 3, SCHED_FIFO, "TF", 5, 0, 0, 0}, {
-	7, 0, 0, 3, SCHED_FIFO, "TF", 6, 0, 0, 0}
-};
-
-volatile unsigned do_work_dummy;
-void do_work(unsigned granularity_top, volatile unsigned *progress)
-{
-	unsigned granularity_cnt, i;
-	unsigned top = 5 * 1000 * 1000;
-	unsigned dummy = do_work_dummy;
-
-	for (granularity_cnt = 0; granularity_cnt < granularity_top;
-	     granularity_cnt++) {
-		for (i = 0; i < top; i++)
-			dummy = i | dummy;
-		(*progress)++;
-	}
-	return;
-}
-
-void *thread_fn(void *param)
-{
-	struct thread_param *tp = param;
-	struct timespec ts;
-	int rc;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-
-	rc = sched_setaffinity(0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF("UNRESOLVED: Thread %s index %d: Can't set affinity: "
-			"%d %s", tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-	DPRINTF(stdout, "#EVENT %f Thread %s Started\n",
-		seconds_read() - base_time, tp->name);
-
-	tp->progress = 0;
-	ts.tv_sec = 0;
-	ts.tv_nsec = tp->sleep_ms * 1000 * 1000;
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-		if (tp->sleep_ms == 0)
-			continue;
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0) {
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-
-	DPRINTF(stdout, "#EVENT %f Thread %s Started\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_tl(void *param)
-{
-	struct thread_param *tp = param;
-
-#if __linux__
-	unsigned long mask = 1 << tp->cpu;
-	int rc;
-
-	rc = sched_setaffinity((pid_t) 0, sizeof(mask), &mask);
-	if (rc < 0) {
-		EPRINTF
-		    ("UNRESOLVED: Thread %s index %d: Can't set affinity: %d %s",
-		     tp->name, tp->index, rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-#endif
-
-	test_set_priority(pthread_self(), SCHED_FIFO, tp->priority);
-
-	DPRINTF(stderr, "Thread %s index %d: started\n", tp->name, tp->index);
-	DPRINTF(stdout, "#EVENT %f Thread %s Started\n",
-		seconds_read() - base_time, tp->name);
-	tp->progress = 0;
-	pthread_mutex_lock(&mutex);
-	while (!tp->stop) {
-		do_work(5, &tp->progress);
-	}
-	pthread_mutex_unlock(&mutex);
-	DPRINTF(stdout, "#EVENT %f Thread %s Stopted\n",
-		seconds_read() - base_time, tp->name);
-	return NULL;
-}
-
-void *thread_sample(void *arg LTP_ATTRIBUTE_UNUSED)
-{
-	char buffer[1024];
-	struct timespec ts;
-	double period = 250;
-	size_t size;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 5);
-	DPRINTF(stderr, "Thread Sampler: started\n");
-	DPRINTF(stdout, "# COLUMNS %d Time TP TL ", 2 + cpus);
-	for (i = 0; i < (cpus - 1); i++)
-		DPRINTF(stdout, "TF%d ", i);
-	DPRINTF(stdout, "\n");
-	ts.tv_sec = 0;
-	ts.tv_nsec = period * 1000 * 1000;
-
-	while (!ts_stop) {
-		size =
-		    snprintf(buffer, 1023, "%f ", seconds_read() - base_time);
-		for (i = 0; i < cpus + 1; i++)
-			size +=
-			    snprintf(buffer + size, 1023 - size, "%u ",
-				     tp[i].progress);
-		DPRINTF(stdout, "%s\n", buffer);
-		rc = nanosleep(&ts, NULL);
-		if (rc < 0)
-			EPRINTF("UNRESOLVED: Thread %s %d: nanosleep returned "
-				"%d %s", tp->name, tp->index, rc, strerror(rc));
-	}
-	return NULL;
-}
-
-void *thread_tb(void *arg)
-{
-	struct timespec boost_time;
-	double t0, t1;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 4);
-	DPRINTF(stderr, "Thread TB: started\n");
-
-	DPRINTF(stdout, "#EVENT %f TB Started, waiting for mutex for %lu s\n",
-		seconds_read() - base_time, *(time_t *) arg);
-
-	boost_time.tv_sec = time(NULL) + *(time_t *) arg;
-	boost_time.tv_nsec = 0;
-
-	t0 = seconds_read();
-	rc = pthread_mutex_timedlock(&mutex, &boost_time);
-	t1 = seconds_read();
-	DPRINTF(stdout, "#EVENT %f TB Thread Waited for %.2f s\n",
-		seconds_read() - base_time, t1 - t0);
-
-	if (rc != ETIMEDOUT && rc != 0) {
-		EPRINTF("FAIL: Thread TB: lock returned %d %s, "
-			"slept %f", rc, strerror(rc), t1 - t0);
-		exit(FAIL);
-	}
-
-	DPRINTF(stdout, "#EVENT %f TB Stopped\n", seconds_read() - base_time);
-	return NULL;
-}
-
-int main(void)
-{
-	cpus = sysconf(_SC_NPROCESSORS_ONLN);
-	pthread_mutexattr_t mutex_attr;
-	pthread_attr_t threadattr;
-	pthread_t threads[cpus - 1], threadsample, threadtp, threadtl, threadtb;
-
-	time_t multiplier = 1;
-	int i;
-	int rc;
-
-	test_set_priority(pthread_self(), SCHED_FIFO, 6);
-	base_time = seconds_read();
-
-	/* Initialize a mutex with PTHREAD_PRIO_INHERIT protocol */
-	mutex_attr_init(&mutex_attr);
-	mutex_init(&mutex, &mutex_attr);
-
-	/* Initialize thread attr */
-	threadattr_init(&threadattr);
-
-	/* Start the sample thread */
-	DPRINTF(stderr, "Main Thread: Creating sample thread\n");
-	rc = pthread_create(&threadsample, &threadattr, thread_sample, NULL);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-
-	/* Start the TF threads */
-	DPRINTF(stderr, "Main Thread: Creating %d TF threads\n", cpus - 1);
-	for (i = 0; i < cpus - 1; i++) {
-		rc = pthread_create(&threads[i], &threadattr, thread_fn,
-				    &tp[i + 2]);
-		if (rc != 0) {
-			EPRINTF("UNRESOLVED: pthread_create: %d %s",
-				rc, strerror(rc));
-			exit(UNRESOLVED);
-		}
-	}
-
-	sleep(base_time + multiplier * 10 - seconds_read());
-
-	/* Start TP thread */
-	DPRINTF(stderr, "Main Thread: Creating TP thread\n");
-	rc = pthread_create(&threadtp, &threadattr, thread_fn, &tp[1]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 20 - seconds_read());
-
-	/* Start TL thread */
-	DPRINTF(stderr, "Main Thread: Creating TL thread\n");
-	rc = pthread_create(&threadtl, &threadattr, thread_tl, &tp[0]);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 30 - seconds_read());
-
-	/* Start TB thread (boosting thread) */
-	unsigned long timeout = multiplier * 20;
-	rc = pthread_create(&threadtb, &threadattr, thread_tb, &timeout);
-	if (rc != 0) {
-		EPRINTF("UNRESOLVED: pthread_create: %d %s", rc, strerror(rc));
-		exit(UNRESOLVED);
-	}
-	sleep(base_time + multiplier * 40 - seconds_read());
-
-	/* Decrease TB's priority */
-	DPRINTF(stderr, "Main Thread: decrease TB's priority to 1\n");
-	test_set_priority(threadtb, SCHED_FIFO, 1);
-	DPRINTF(stdout, "#EVENT %f TB's priority decreased\n",
-		seconds_read() - base_time);
-	sleep(base_time + multiplier * 60 - seconds_read());
-
-	/* Stop TL thread */
-	tp[0].stop = 1;
-	sleep(base_time + multiplier * 70 - seconds_read());
-
-	/* Stop TP thread */
-	tp[1].stop = 1;
-	sleep(base_time + multiplier * 80 - seconds_read());
-
-	/* Stop TF threads */
-	for (i = 2; i < cpus - 1; i++) {
-		tp[i].stop = 1;
-	}
-
-	/* Stop sampler */
-	ts_stop = 1;
-	DPRINTF(stderr, "Main Thread: stop sampler thread\n");
-	return 0;
-}
diff --git a/testcases/open_posix_testsuite/functional/threads/tools/watchdogtimer.sh b/testcases/open_posix_testsuite/functional/threads/tools/watchdogtimer.sh
deleted file mode 100755
index af57901..0000000
--- a/testcases/open_posix_testsuite/functional/threads/tools/watchdogtimer.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-PRIORITY=20
-# PINUM stands for the test cases number of pi test
-PINUM=6
-num=0
-chrt -p -f $PRIORITY $$
-TIMEOUT=600
-echo "Start watchdogtimer script..."
-echo "wait 10 minutes, if pitest hangs, stop the case execution"
-while [ $num -lt $PINUM ]
-do
-sleep $TIMEOUT
-killall -9 -q pitest*
-echo "Timeout, kill pi test case"
-num=`expr $num + 1`
-done
-
diff --git a/testcases/open_posix_testsuite/include/timespec.h b/testcases/open_posix_testsuite/include/timespec.h
index f1376ae..027592d 100644
--- a/testcases/open_posix_testsuite/include/timespec.h
+++ b/testcases/open_posix_testsuite/include/timespec.h
@@ -13,11 +13,15 @@
 
 #define NSEC_IN_SEC 1000000000
 
+#ifndef TIME_T_MAX
+#	define TIME_T_MAX	(time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
+#endif
+
 /*
  * Returns difference between two struct timespec values. If difference is
  * greater that 1 sec, 1 sec is returned.
  */
-static long timespec_nsec_diff(struct timespec *t1, struct timespec *t2)
+static inline long timespec_nsec_diff(struct timespec *t1, struct timespec *t2)
 {
 	time_t sec_diff;
 	long nsec_diff;
diff --git a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
index 4666739..7b11c98 100755
--- a/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
+++ b/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
@@ -186,7 +186,7 @@
 	if ! grep -q '^run.sh' "$makefile.3"; then
 		cat >> "$makefile.3" <<EOF
 run.sh:
-	@echo '#/bin/sh' > \$@
+	@echo '#!/bin/sh' > \$@
 	@echo "\$(top_srcdir)/bin/run-tests.sh \$(subdir) \$(INSTALL_TARGETS)" >> \$@
 	@chmod +x run.sh
 
diff --git a/testcases/open_posix_testsuite/tools/t0.c b/testcases/open_posix_testsuite/tools/t0.c
index 0033635..0581220 100644
--- a/testcases/open_posix_testsuite/tools/t0.c
+++ b/testcases/open_posix_testsuite/tools/t0.c
@@ -29,7 +29,7 @@
  * SPECIAL CASE:
  * $ ./t0 0
  *  Here another arg is not required. This special case will return immediatly
- *  as if it has been timedout. This is usefull to check a timeout return code value.
+ *  as if it has been timedout. This is useful to check a timeout return code value.
  *
  */
 
diff --git a/testcases/realtime/func/pi-tests/run_auto.sh b/testcases/realtime/func/pi-tests/run_auto.sh
index d130260..2779885 100755
--- a/testcases/realtime/func/pi-tests/run_auto.sh
+++ b/testcases/realtime/func/pi-tests/run_auto.sh
@@ -15,15 +15,15 @@
 
 export LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-1.log"
 $SCRIPTS_DIR/run_c_files.sh $profile testpi-1
-PYTHONPATH=../../  python parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
+PYTHONPATH=../../  python3 parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
 
 export LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-2.log"
 $SCRIPTS_DIR/run_c_files.sh $profile testpi-2
-PYTHONPATH=../../  python parse-testpi2.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
+PYTHONPATH=../../  python3 parse-testpi2.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
 
 export LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-4.log"
 $SCRIPTS_DIR/run_c_files.sh $profile testpi-4
-PYTHONPATH=../../  python parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
+PYTHONPATH=../../  python3 parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
 
 
 export LOG_FILE=""
diff --git a/testscripts/network.sh b/testscripts/network.sh
index 78257d8..5cfeee8 100755
--- a/testscripts/network.sh
+++ b/testscripts/network.sh
@@ -1,4 +1,6 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Linux Test Project, 2013-2019
 
 cd $(dirname $0)
 export LTPROOT=${LTPROOT:-"$PWD"}
diff --git a/travis/alpine.sh b/travis/alpine.sh
new file mode 100755
index 0000000..cef627b
--- /dev/null
+++ b/travis/alpine.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Copyright (c) 2019 Petr Vorel <petr.vorel@gmail.com>
+set -e
+
+apk update
+
+apk add \
+	acl-dev \
+	autoconf \
+	automake \
+	clang \
+	gcc \
+	keyutils-dev \
+	libaio-dev \
+	libacl \
+	libcap-dev \
+	libselinux-dev \
+	libsepol-dev \
+	libtirpc-dev \
+	linux-headers \
+	make \
+	musl-dev \
+	numactl-dev \
+	openssl-dev \
+	pkgconfig
+
+echo "=== /etc/os-release ==="
+cat /etc/os-release
+
+echo "WARNING: remove unsupported tests (until they're fixed)"
+cd ..
+rm -rfv \
+	testcases/kernel/pty/pty01.c \
+	testcases/kernel/pty/pty02.c \
+	testcases/kernel/pty/ptem01.c \
+	testcases/kernel/sched/process_stress/process.c \
+	testcases/kernel/syscalls/accept4/accept4_01.c \
+	testcases/kernel/syscalls/confstr/confstr01.c \
+	testcases/kernel/syscalls/fmtmsg/fmtmsg01.c \
+	testcases/kernel/syscalls/getcontext/getcontext01.c \
+	testcases/kernel/syscalls/getdents/getdents01.c \
+	testcases/kernel/syscalls/getdents/getdents02.c \
+	testcases/kernel/syscalls/ioctl/ioctl01.c \
+	testcases/kernel/syscalls/ioctl/ioctl02.c \
+	testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c \
+	testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c \
+	testcases/kernel/syscalls/timer_create/timer_create01.c \
+	testcases/kernel/syscalls/timer_create/timer_create03.c \
+	testcases/misc/crash/crash01.c \
+	utils/benchmark/ebizzy-0.3
+cd -
diff --git a/travis/debian.i386.sh b/travis/debian.i386.sh
index 250d53b..51a77e1 100755
--- a/travis/debian.i386.sh
+++ b/travis/debian.i386.sh
@@ -16,4 +16,4 @@
 	libkeyutils1:i386 \
 	libnuma1:i386 \
 	libssl-dev:i386 \
-	libtirpc1:i386
+	libtirpc-dev:i386
diff --git a/travis/debian.minimal.sh b/travis/debian.minimal.sh
index 8e8bb62..822de63 100755
--- a/travis/debian.minimal.sh
+++ b/travis/debian.minimal.sh
@@ -3,17 +3,17 @@
 set -e
 
 apt remove -y \
-    libacl1-dev \
-    libaio-dev \
-    libaio1 \
-    libcap-dev \
-    libcap2 \
-    libkeyutils-dev \
-    libkeyutils1 \
-    libmm-dev \
-    libnuma-dev \
-    libnuma1 \
-    libselinux1-dev \
-    libsepol1-dev \
-    libssl-dev \
-    libtirpc1
+	libacl1-dev \
+	libaio-dev \
+	libaio1 \
+	libcap-dev \
+	libcap2 \
+	libkeyutils-dev \
+	libkeyutils1 \
+	libmm-dev \
+	libnuma-dev \
+	libnuma1 \
+	libselinux1-dev \
+	libsepol1-dev \
+	libssl-dev \
+	libtirpc-dev
diff --git a/travis/debian.sh b/travis/debian.sh
index 56c8a08..e1be4bb 100755
--- a/travis/debian.sh
+++ b/travis/debian.sh
@@ -9,31 +9,30 @@
 apt update
 
 apt install -y --no-install-recommends \
-    acl-dev \
-    autoconf \
-    automake \
-    build-essential \
-    debhelper \
-    devscripts \
-    clang \
-    gcc \
-    libacl1 \
-    libacl1-dev \
-    libaio-dev \
-    libaio1 \
-    libcap-dev \
-    libcap2 \
-    libc6 \
-    libc6-dev \
-    libkeyutils-dev \
-    libkeyutils1 \
-    libmm-dev \
-    libnuma-dev \
-    libnuma1 \
-    libselinux1-dev \
-    libsepol1-dev \
-    libssl-dev \
-    linux-libc-dev \
-    lsb-release
-
-apt install libtirpc1 libtirpc3 || true
+	acl-dev \
+	autoconf \
+	automake \
+	build-essential \
+	debhelper \
+	devscripts \
+	clang \
+	gcc \
+	libacl1 \
+	libacl1-dev \
+	libaio-dev \
+	libaio1 \
+	libcap-dev \
+	libcap2 \
+	libc6 \
+	libc6-dev \
+	libkeyutils-dev \
+	libkeyutils1 \
+	libmm-dev \
+	libnuma-dev \
+	libnuma1 \
+	libselinux1-dev \
+	libsepol1-dev \
+	libssl-dev \
+	libtirpc-dev \
+	linux-libc-dev \
+	lsb-release
diff --git a/utils/.gitignore b/utils/.gitignore
index a582748..5b6dfd0 100644
--- a/utils/.gitignore
+++ b/utils/.gitignore
@@ -1,12 +1,3 @@
-/ffsb
-/ffsb-6.0-rc2/.deps/
-/ffsb-6.0-rc2/ffsb
-/ffsb-6.0-rc2/Makefile
-/ffsb-6.0-rc2/config.h
-/ffsb-6.0-rc2/config.log
-/ffsb-6.0-rc2/config.status
-/ffsb-6.0-rc2/stamp-h
-/ffsb-6.0-rc2/stamp-h1
 /sctp/func_tests/test_1_to_1_accept_close
 /sctp/func_tests/test_1_to_1_addrs
 /sctp/func_tests/test_1_to_1_connect
diff --git a/utils/ffsb-6.0-rc2/AUTHORS b/utils/ffsb-6.0-rc2/AUTHORS
deleted file mode 100644
index 85d037d..0000000
--- a/utils/ffsb-6.0-rc2/AUTHORS
+++ /dev/null
@@ -1,7 +0,0 @@
-Dominique Heger (dheger@us.ibm.com)
-Josh Jacobs (josh@mit.edu)
-
--> up to Version 3.0 of FFSB
-
-Sonny Rao (raosanth@us.ibm.com)
-versions 3.1 and beyond
diff --git a/utils/ffsb-6.0-rc2/COPYING b/utils/ffsb-6.0-rc2/COPYING
deleted file mode 100644
index e90dfed..0000000
--- a/utils/ffsb-6.0-rc2/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/utils/ffsb-6.0-rc2/INSTALL b/utils/ffsb-6.0-rc2/INSTALL
deleted file mode 100644
index b42a17a..0000000
--- a/utils/ffsb-6.0-rc2/INSTALL
+++ /dev/null
@@ -1,182 +0,0 @@
-Basic Installation
-==================
-
-   These are generic installation instructions.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
-   The file `configure.in' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
-
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package.
-
-  4. Type `make install' to install the programs and any data files and
-     documentation.
-
-  5. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
-
-Compilers and Options
-=====================
-
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
-   You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
-     CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
-   `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
-
-`--help'
-     Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
diff --git a/utils/ffsb-6.0-rc2/LICENSE b/utils/ffsb-6.0-rc2/LICENSE
deleted file mode 100644
index 76d9f61..0000000
--- a/utils/ffsb-6.0-rc2/LICENSE
+++ /dev/null
@@ -1,347 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-The Free Software Foundation has exempted Bash from the requirement of
-Paragraph 2c of the General Public License.  This is to say, there is
-no requirement for Bash to print a notice when it is started
-interactively in the usual way.  We made this exception because users
-and standards expect shells not to print such messages.  This
-exception applies to any program that serves as a shell and that is
-based primarily on Bash as opposed to other GNU software.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	Appendix: How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
-
-    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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) 19yy name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/utils/ffsb-6.0-rc2/Makefile.am b/utils/ffsb-6.0-rc2/Makefile.am
deleted file mode 100644
index 9ed678b..0000000
--- a/utils/ffsb-6.0-rc2/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-bin_PROGRAMS = ffsb #ffsb_test
-ffsb_SOURCES = \
-	fileops.c \
-	rand.c \
-	config.h \
-	fileops.h \
-	ffsb.h \
-	rand.h \
-	main.c \
-	fh.h \
-	fh.c \
-	filelist.c \
-	filelist.h \
-	metaops.c \
-	metaops.h \
-	rwlock.h \
-	rwlock.c \
-	cirlist.c \
-	cirlist.h \
-	rbt.c \
-	rbt.h \
-	ffsb_tg.h \
-	ffsb_tg.c \
-	ffsb_fs.h \
-	ffsb_fs.c \
-	ffsb_thread.c \
-	ffsb_thread.h \
-	ffsb_op.h \
-	ffsb_op.c \
-	util.h \
-	util.c \
-	parser.c \
-	parser.h \
-	ffsb_fc.c \
-	ffsb_stats.c \
-	list.c
-
-#ffsb_test_SOURCES = config.h fileops.h ffsb.h rand.h fh.h filelist.h metaops.h rwlock.h cirlist.h rbt.h ffsb_tg.h ffsb_fs.h ffsb_thread.h ffsb_op.h util.h parser.c parser.h ffsb_test.c
-
-EXTRA_DIST = *.txt *.tex
-
-AM_CFLAGS = -D_GNU_SOURCE
-
-#CFLAGS += -Wall -Werror -g -Wconversion -ansi
-#LDFLAGS += -lefence
-
diff --git a/utils/ffsb-6.0-rc2/Makefile.in b/utils/ffsb-6.0-rc2/Makefile.in
deleted file mode 100644
index 131dd5f..0000000
--- a/utils/ffsb-6.0-rc2/Makefile.in
+++ /dev/null
@@ -1,628 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-bin_PROGRAMS = ffsb$(EXEEXT)
-subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
-	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
-	config.guess config.sub depcomp install-sh missing \
-	mkinstalldirs
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno config.status.lineno
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)"
-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(bin_PROGRAMS)
-am_ffsb_OBJECTS = fileops.$(OBJEXT) rand.$(OBJEXT) main.$(OBJEXT) \
-	fh.$(OBJEXT) filelist.$(OBJEXT) metaops.$(OBJEXT) \
-	rwlock.$(OBJEXT) cirlist.$(OBJEXT) rbt.$(OBJEXT) \
-	ffsb_tg.$(OBJEXT) ffsb_fs.$(OBJEXT) ffsb_thread.$(OBJEXT) \
-	ffsb_op.$(OBJEXT) util.$(OBJEXT) parser.$(OBJEXT) \
-	ffsb_fc.$(OBJEXT) ffsb_stats.$(OBJEXT) list.$(OBJEXT)
-ffsb_OBJECTS = $(am_ffsb_OBJECTS)
-ffsb_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I.@am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(ffsb_SOURCES)
-DIST_SOURCES = $(ffsb_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-am__remove_distdir = \
-  { test ! -d $(distdir) \
-    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr $(distdir); }; }
-DIST_ARCHIVES = $(distdir).tar.gz
-GZIP_ENV = --best
-distuninstallcheck_listfiles = find . -type f -print
-distcleancheck_listfiles = find . -type f -print
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-ffsb_SOURCES = \
-	fileops.c \
-	rand.c \
-	config.h \
-	fileops.h \
-	ffsb.h \
-	rand.h \
-	main.c \
-	fh.h \
-	fh.c \
-	filelist.c \
-	filelist.h \
-	metaops.c \
-	metaops.h \
-	rwlock.h \
-	rwlock.c \
-	cirlist.c \
-	cirlist.h \
-	rbt.c \
-	rbt.h \
-	ffsb_tg.h \
-	ffsb_tg.c \
-	ffsb_fs.h \
-	ffsb_fs.c \
-	ffsb_thread.c \
-	ffsb_thread.h \
-	ffsb_op.h \
-	ffsb_op.c \
-	util.h \
-	util.c \
-	parser.c \
-	parser.h \
-	ffsb_fc.c \
-	ffsb_stats.c \
-	list.c
-
-
-#ffsb_test_SOURCES = config.h fileops.h ffsb.h rand.h fh.h filelist.h metaops.h rwlock.h cirlist.h rbt.h ffsb_tg.h ffsb_fs.h ffsb_thread.h ffsb_op.h util.h parser.c parser.h ffsb_test.c
-EXTRA_DIST = *.txt *.tex
-AM_CFLAGS = -D_GNU_SOURCE
-all: config.h
-	$(MAKE) $(AM_MAKEFLAGS) all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .o .obj
-am--refresh:
-	@:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
-	      cd $(srcdir) && $(AUTOMAKE) --gnu  \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    echo ' $(SHELL) ./config.status'; \
-	    $(SHELL) ./config.status;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	$(SHELL) ./config.status --recheck
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-
-config.h: stamp-h1
-	@if test ! -f $@; then \
-	  rm -f stamp-h1; \
-	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
-	else :; fi
-
-stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
-	@rm -f stamp-h1
-	cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in:  $(am__configure_deps)
-	cd $(top_srcdir) && $(AUTOHEADER)
-	rm -f stamp-h1
-	touch $@
-
-distclean-hdr:
-	-rm -f config.h stamp-h1
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
-	@list='$(bin_PROGRAMS)'; for p in $$list; do \
-	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-	  if test -f $$p \
-	  ; then \
-	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
-	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
-	  else :; fi; \
-	done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(bin_PROGRAMS)'; for p in $$list; do \
-	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
-	done
-
-clean-binPROGRAMS:
-	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-ffsb$(EXEEXT): $(ffsb_OBJECTS) $(ffsb_DEPENDENCIES)
-	@rm -f ffsb$(EXEEXT)
-	$(LINK) $(ffsb_OBJECTS) $(ffsb_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cirlist.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffsb_fc.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffsb_fs.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffsb_op.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffsb_stats.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffsb_tg.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffsb_thread.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fh.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filelist.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileops.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaops.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rand.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rwlock.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	$(am__remove_distdir)
-	test -d $(distdir) || mkdir $(distdir)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
-	    || exit 1; \
-	  fi; \
-	done
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
-	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
-	|| chmod -R a+r $(distdir)
-dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
-
-dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
-
-dist-lzma: distdir
-	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-	$(am__remove_distdir)
-
-dist-tarZ: distdir
-	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-	$(am__remove_distdir)
-
-dist-shar: distdir
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__remove_distdir)
-
-dist-zip: distdir
-	-rm -f $(distdir).zip
-	zip -rq $(distdir).zip $(distdir)
-	$(am__remove_distdir)
-
-dist dist-all: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
-
-# This target untars the dist file and tries a VPATH configuration.  Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
-	case '$(DIST_ARCHIVES)' in \
-	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
-	*.tar.bz2*) \
-	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
-	*.tar.lzma*) \
-	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
-	*.tar.Z*) \
-	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
-	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
-	*.zip*) \
-	  unzip $(distdir).zip ;;\
-	esac
-	chmod -R a-w $(distdir); chmod a+w $(distdir)
-	mkdir $(distdir)/_build
-	mkdir $(distdir)/_inst
-	chmod a-w $(distdir)
-	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
-	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-	  && cd $(distdir)/_build \
-	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
-	    $(DISTCHECK_CONFIGURE_FLAGS) \
-	  && $(MAKE) $(AM_MAKEFLAGS) \
-	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
-	  && $(MAKE) $(AM_MAKEFLAGS) check \
-	  && $(MAKE) $(AM_MAKEFLAGS) install \
-	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
-	        distuninstallcheck \
-	  && chmod -R a-w "$$dc_install_base" \
-	  && ({ \
-	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
-	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
-	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
-	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
-	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
-	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
-	  && rm -rf "$$dc_destdir" \
-	  && $(MAKE) $(AM_MAKEFLAGS) dist \
-	  && rm -rf $(DIST_ARCHIVES) \
-	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
-	$(am__remove_distdir)
-	@(echo "$(distdir) archives ready for distribution: "; \
-	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
-	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
-distuninstallcheck:
-	@cd $(distuninstallcheck_dir) \
-	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
-	   || { echo "ERROR: files left after uninstall:" ; \
-	        if test -n "$(DESTDIR)"; then \
-	          echo "  (check DESTDIR support)"; \
-	        fi ; \
-	        $(distuninstallcheck_listfiles) ; \
-	        exit 1; } >&2
-distcleancheck: distclean
-	@if test '$(srcdir)' = . ; then \
-	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
-	  exit 1 ; \
-	fi
-	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
-	  || { echo "ERROR: files left in build directory after distclean:" ; \
-	       $(distcleancheck_listfiles) ; \
-	       exit 1; } >&2
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS) config.h
-installdirs:
-	for dir in "$(DESTDIR)$(bindir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
-
-distclean: distclean-am
-	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-hdr distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am: install-binPROGRAMS
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -rf $(top_srcdir)/autom4te.cache
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-binPROGRAMS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
-	clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
-	dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
-	distclean distclean-compile distclean-generic distclean-hdr \
-	distclean-tags distcleancheck distdir distuninstallcheck dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS
-
-
-#CFLAGS += -Wall -Werror -g -Wconversion -ansi
-#LDFLAGS += -lefence
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/utils/ffsb-6.0-rc2/README b/utils/ffsb-6.0-rc2/README
deleted file mode 100644
index 0689ff4..0000000
--- a/utils/ffsb-6.0-rc2/README
+++ /dev/null
@@ -1,413 +0,0 @@
-Introduction:
-
-The Flexible Filesystem Benchmark (FFSB) is a filesystem performance
-measurement tool.  It is a multi-threaded application (using
-pthreads), written entirely in C with cross-platform portability in
-mind.  It differs from other filesystem benchmarks in that the user
-may supply a profile to create custom workloads, while most other
-filesystem benchmarks use a fixed set of workloads.
-
-As of version 5.1, it supports seven different basic operations, support
-for multiple groups of threads with different operation mixtures,
-support for operation across multiple filesystems, and support for
-filesystem aging prior to benchmarking.
-
-
-Differences from version 4.0 and older:
-
-Version 5.0 and above represent almost a total re-write and many
-things have changed.  In version 5.0 and above FFSB moved to a
-time-regulated run versus doing a set number of different operations
-and timing the whole thing.  This is primarily to better deal with the
-use of multiple threadgroups which would otherwise not be synchronized
-at termination time.
-
-Additionally, the FFSB configuration file format has changed in
-version 5.0, although we do support old-style configuration files
-along with a run-time passed on the command line.  In this mode,
-version 5.0 and above ignores the iterations parameter, and simply
-uses the time specified on the command line.
-
-Behaviorally, most of the old operations are the same -- sequential
-reads and sequential writes work as they did before.  One change in
-version 5.0 is the skip-read behavior of reading then seeking forward
-a fixed amount then reading again is removed, we now support fully
-randomized reads and writes from random offsets within the file.
-
-Version 4.0 didn't support overwrites (only appends) so we interpret
-writes in old config files to be append operations.
-
-On Linux, CPU utilization information will only be accurate for
-systems using NPTL, older Linuxthreads systems will probably only see
-zeros for CPU utilization because Linuxthreads is non-compliant to
-POSIX. Version 4.0 and older could be recompiled to work on
-Linuxthreads, but in 5.0 and later we no longer support this.
-
-We no longer support the "outputfile" on the command line.
-
-One should simply use tee or similar to capture the output.  FFSB
-unbuffers standard out for this purpose, and errors are sent on
-standard error.
-
-Global options:
-
-There are eight valid global options placed at the beginning of the
-profile.  Three of them are required: num_filesystems (number of
-filesystems), num_threadgroups (number of threadgroups), and time
-(running time of the benchmark).  The other five options are:
-
-directio   - each call to open will be made using O_DIRECT
-alignio    - aligns all block operations for random reads and writes
-             on 4k boundaries.
-bufferedio - currently ignored: it is intended to use libc
-             fread,rwrite, instead of just unix read and write calls
-verbose    - currently ignored
-
-callout    - calls and external command and waits for its termination
-	     before FFSB begins the benchmark phase.
-	     This is useful for synchronizing distributed clients,
-	     starting profilers, etc.
-
-They must be specified in the above order (num_filesystems,
-num_threadgroups, time, directio, alignio, bufferedio, verbose,
-callout).
-
-
-
-Filesystems:
-
-Filesystems are specified to FFSB in the form of a directory.  FFSB
-assumes that the filesystem is mounted at this directory and will not
-do any verification of this fact beyond ensuring it can read/write to
-the location.  So be careful to ensure something with enough space to
-handle the dataset is in fact mounted at the specified location.
-
-In the filesystem clause of the profile, one may set the starting
-number of files and directories as well as a minimum and maximum
-filesize for the filesystem.  One may also specify the blocksize
-used for creating the files separately in the filesystem clause.
-
-Also, if a filesystem is to be aged, a special threadgroup clause may
-be embedded in a filesystem clause to specify the operation mixture
-and number of threads used to age the filesystem.  This threadgroup is
-run until filesystem utilization reaches the specified amount.
-
-Inheritance --  if you are using multiple filesystems, all attributes
-except the location should be inherited from the previous filesystem.
-This is done to make it easier to add groups of similar filesystems.
-In this case, only the location is required in the filesystem clause.
-
-As of version 5.1, filesystem re-use is supported if a given
-filesystem hasn't been modified beyond it's orginal specifications
-(number of files and directories is correct, and file sizes are within
-specifications).  This can be a huge time saver if one wishes to do
-multiple runs on the same data-set without altering it during a run,
-because the fileset doesn't need to be recreated before each run.
-
-To do this, specify "reuse=1" in the filesystem clause, and FFSB will
-verify the fileset first, and if it checks out it will use it.
-Otherwise, it will remove everything and re-create the filesets for
-that filesystem.
-
-Threadgroups:
-
-An arbitrary number of threadgroups with differing numbers of threads
-and operation mixes can be specified.  The operations are specified
-using a weighting for each operation, if an operation isn't specified
-it's weighting is assumed to be zero (not used).
-
-"Think-time" for a threadgroup may also be specified in millisecond
-amounts using the "op_delay" parameter, where every thread will wait
-for the specified amount between each operation.
-
-Operations:
-
-All operations begin by randomly selecting a filesystem from the list
-of filesystems specified in the profile.  The distribution aims to be
-uniform across all filesystems.
-
-
-The seven operations are:
-
-reads  - read() calls with an overall amount and a blocksize
-         operates on existing files.  Care must be taken to ensure
-         that the read amount is smaller than the size of any possible
-         file.
-
-	 If random_read is specified, then the each individual blocks
-         will be read starting from a random point with the file, and
-         this will continue until the entire amount specified has been
-         read.  This offset of each random block will be totally
-         random to the byte level, unless the "alignio" global parameter
-         is on, and then the reads will be 4096 byte aligned.  This is
-         generally recommended.
-
-
-readall - Very similar to read above, except it doesn't take an
-          amount; it simply reads the entire file sequentially using the
-          read_blocksize.   This is useful for situations where
-	  different filesystems have differently sized files, and sequential
-	  read patterns across all filesystems are desired.
-
-writes - write() calls with an overall amount and blocksize
-         this is an overwrite operation and will not enlarge an existing
-         file, again one must be careful not to specify a write amount
-         that is larger than any possible file in the data set.
-
-	 If random_write is specified, then the each individual blocks
-         will be written starting from a random point with the file, and
-         this will continue until the entire amount specified has been
-         written out.  This offset of each random block will be totally
-         random to the byte level, unless the "alignio" global parameter
-         is on, and then the writes will be 4096 byte aligned.  This
-         is generally recommended.
-
-	 If the fsync_flag parameter for the threadgroup is non-zero,
-	 then after all of the write calls are finished, fsync() will
-	 be called on the file descriptor before the file is closed.
-
-
-creates - creates a file using open() call and determines the size
-          randomly between on the constraints (min_filesize and
-          max_filesize) for the selected filesystem. Write operations will
-          be done using the same blocksize as is specified for the
-          write operation.
-deletes - calls unlink() on a filename and removes it from the
-          internal data-structures.  One must be careful to ensure
-          there are enough files to delete at all times or else the benchmark
-          will terminate.
-appends - calls write() using the append flag with an overall amount
-          and a blocksize to be appended onto a randomly chosen file.
-metas   - this is actually a mix of several different directory
-          operations.  Each "meta" operation consists of two directory
-          creates, one directory remove, and a directory rename.
-          These operations are all carried out separately from the
-          other 5 operations.
-
-Operation accounting:
-
-Each operation which uses a blocksize counts each read/write of a
-blocksize as an operation (reads,writes,creates, and appends) whereas
-deletes and metas are considered single operations.
-
-Running the benchmark:
-
-There are three phases to running the benchmark, aging, fileset
-creates, and the benchmark phase.
-
-The create phase is carried out across all filesystems simultaneously
-with one dedicated thread per filesystem.
-
-After the create phase, sync() is called to ensure all dirty data gets
-written out before the benchmark phase begins, and sync() is again
-called at the end of the benchmark phase.  The time in sync() at the
-end of the benchmark phase is counted as part of the benchmark phase.
-
-Caveats/Holes/Bugs:
-
-Aging and aging across multiple filesystems simultaneously hasn't been tested
-very much.
-
-If *any* i/o operation or system call/libc call fails, the benchmark
-will terminate immediately.
-
-The parser doesn't handle mal-formed or incorrect profiles very well
-(or at all).
-
-The parser doesn't check to make sure all of the appropriate options
-have been specified.  For example, if writes are specified in a
-threadgroup but write_blocksize isn't specified, the parse won't catch
-it, but the benchmark run will fail later on.
-
-
-Configuration Files (new style):
-
-New Style Configuration allows for arbitrary newlines between lines,
-and comments using '#' at the start of a line.  Also it allows tabs,
-whitespace before and after configuration parameters.
-
-The new style configuration file is broken up into three main parts:
-
-global parameters, filesystems, and threadgroups
-
-The sections must be in the above order.
-
-Global parameters:
-
-Global parameters are described above, the first three are always
-required. Example:
-
-----------
-
-num_filesystems=1
-num_threadgroups=1
-time=30 		# time is in seconds
-
-directio=0 		# don't use direct io
-alignio=1  		# align random IOs to 4k
-bufferedio=0		# this does nothing right now
-verbose=0		# this does nothing right now
-
-			# calls and external command and waits
-			# everything until the newline is taken
-			# so you can have abritrary parmeters
-callout=synchronize.sh myhostname
-
----------
-
-All of these must appear in this order, though you can leave out the
-optional ones.
-
-Filesystems:
-
-Filesystems describe different logical sets of files residing in
-different directorys.  There is no strict requirement that they
-actually be on different filesystems, only that the directory
-specified already exists.
-
-Filesystems are specified by a clause with a filesystem number like
-this:
-
-[filesystem0]
-	location=/mnt/testing/
-	num_files=10
-	num_dirs=1
-	max_filesize=4096
-	min_filesize=4096
-[end0]
-
-
-The clause must always begin with [filesystemX] and end with [endX]
-where X is the number of that filesystem.
-
-You should start wiht X = 0, and increment by one for each following
-filesystem.  If they are out of order, things will likely break.
-
-The required information for each filesystem is: location, num_files,
-num_dirs, max_filesize, and min_filesize.  Beyond those the following
-four options are supported:
-
-
-
-reuse=1 # check the filesystem to see if it is reusable
-
-	# filesystem aging, three components required
-	# takes agefs=1 to turn it on
-	# then a valid threadgroup specification
-	# then a desired utilization percentage
-
-agefs=1 # age the filesystem according to the following threadgroup
-	[threadgroup0]
-		num_threads=10
-		write_size=40960
-		write_blocksize=4096
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-desired_util=0.20	# In this case, age until the fs is 20% full
-
-create_blocksize=4096   # specify the blocksize to write()
-		        # for creating the fileset, defaults to 4096
-
-age_blocksize=4096      # specify the blocksize to write() for aging
-
-
-Also, to allow lazy people to use lots of filesystems, we support
-filesystem inheritance, which simply copies all options but the
-location from the previous filesystem clause if nothing is specified.
-Obviously, this doesn't work for filesystem0. (May not work for aging
-either?)
-
-Full blown filesystem clause example:
-
-----
-
-[filesystem0]
-
-	# required parts
-
-	location=/home/sonny/tmp
-	num_files=100
-	num_dirs=100
-	max_filesize=65536
-	min_filesize=4096
-
-	# aging part
-	agefs=0
-	[threadgroup0]
-		num_threads=10
-		write_size=40960
-		write_blocksize=4096
-		create_weight=10
-		append_weight=10
-		delete_weight=1
-	[end0]
-		desired_util=0.02	# age until 2% full
-
-	# other optional commands
-
-	create_blocksize=1024		# use a small create blocksize
-	age_blocksize=1024		# and smaller age create blocksize
-	reuse=0	                        # don't reuse it
-[end0]
-
-
-
---
-
-Threadgroups:
-
-Threadgropus are very similar to filesystems in that any number of
-them can be specified in clauses, and they must be in order starting
-with threadgroup0.
-
-Example:
-
----
-
-[threadgroup0]
-	num_threads=32
-	read_weight=4
-	append_weight=1
-
-	write_size=4096
-	write_blocksize=4096
-
-	read_size=4096
-	read_blocksize=4096
-[end0]
-
----
-
-In a threadgroup clause, num_threads is required and must be at least
-1.  Then, at least one operation must be given a weight greater than 0
-to be a valid threadgroup.  Operations can be given a weighting of 0,
-and in this case they are ignored.
-
-Certain operations will also require other commands, for example, if
-read_weight is greater than zero, then one must also include a
-read_size and a read_blocksize.  Here's the table of requirements and
-options:
-
-
-Operation		Requirements			Options
---			--				--
-read_weight		read_size, read_blocksize	read_random
-readall_weight		read_blocksize			none
-write_weight		write_size, write_blocksize	write_random,fsync_file
-create_weight		write_blocksize or create_blocksize	none
-append_weight		write_blocksize, write_size	none
-delete_weight		none				none
-meta_weight		none				none
-
-
-
-Other threadgroup options:
-
-op_delay=10  # specify a wait between operations in milli-seconds
-
-bindfs=3     # This allows you to restrict a threadgroup's operation
-             # to a specific filesystem number.  Currently only
-	     # binding to one specific filesystem is supported
-
diff --git a/utils/ffsb-6.0-rc2/aclocal.m4 b/utils/ffsb-6.0-rc2/aclocal.m4
deleted file mode 100644
index 19b0c2d..0000000
--- a/utils/ffsb-6.0-rc2/aclocal.m4
+++ /dev/null
@@ -1,880 +0,0 @@
-# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(AC_AUTOCONF_VERSION, [2.61],,
-[m4_warning([this file was generated for autoconf 2.61.
-You have another version of autoconf.  It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_AUTOMAKE_VERSION(VERSION)
-# ----------------------------
-# Automake X.Y traces this macro to ensure aclocal.m4 has been
-# generated from the m4 files accompanying Automake X.Y.
-# (This private macro should not be called outside this file.)
-AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.10'
-dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
-dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10.1], [],
-      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
-])
-
-# _AM_AUTOCONF_VERSION(VERSION)
-# -----------------------------
-# aclocal traces this macro to find the Autoconf version.
-# This is a private macro too.  Using m4_define simplifies
-# the logic in aclocal, which can simply ignore this definition.
-m4_define([_AM_AUTOCONF_VERSION], [])
-
-# AM_SET_CURRENT_AUTOMAKE_VERSION
-# -------------------------------
-# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.1])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
-
-# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
-
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
-#
-# Of course, Automake must honor this variable whenever it calls a
-# tool from the auxiliary directory.  The problem is that $srcdir (and
-# therefore $ac_aux_dir as well) can be either absolute or relative,
-# depending on how configure is run.  This is pretty annoying, since
-# it makes $ac_aux_dir quite unusable in subdirectories: in the top
-# source directory, any form will work fine, but in subdirectories a
-# relative path needs to be adjusted first.
-#
-# $ac_aux_dir/missing
-#    fails when called from a subdirectory if $ac_aux_dir is relative
-# $top_srcdir/$ac_aux_dir/missing
-#    fails if $ac_aux_dir is absolute,
-#    fails when called from a subdirectory in a VPATH build with
-#          a relative $ac_aux_dir
-#
-# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
-# are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
-# start a VPATH build or use an absolute $srcdir.
-#
-# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
-# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
-#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
-# and then we would define $MISSING as
-#   MISSING="\${SHELL} $am_aux_dir/missing"
-# This will work as long as MISSING is not called from configure, because
-# unfortunately $(top_srcdir) has no meaning in configure.
-# However there are other variables, like CC, which are often used in
-# configure, and could therefore not use this "fixed" $ac_aux_dir.
-#
-# Another solution, used here, is to always expand $ac_aux_dir to an
-# absolute PATH.  The drawback is that using absolute paths prevent a
-# configured tree to be moved without reconfiguration.
-
-AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-])
-
-# AM_CONDITIONAL                                            -*- Autoconf -*-
-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])dnl
-AC_SUBST([$1_FALSE])dnl
-_AM_SUBST_NOTMAKE([$1_TRUE])dnl
-_AM_SUBST_NOTMAKE([$1_FALSE])dnl
-if $2; then
-  $1_TRUE=
-  $1_FALSE='#'
-else
-  $1_TRUE='#'
-  $1_FALSE=
-fi
-AC_CONFIG_COMMANDS_PRE(
-[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
-  AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
-fi])])
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 9
-
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
-# written in clear, in which case automake, when reading aclocal.m4,
-# will think it sees a *use*, and therefore will trigger all it's
-# C support machinery.  Also note that it means that autoscan, seeing
-# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
-
-# _AM_DEPENDENCIES(NAME)
-# ----------------------
-# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
-# We try a few techniques and use that to set a single cache variable.
-#
-# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
-# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
-# dependency, and given that the user is not expected to run this macro,
-# just rely on AC_PROG_CC.
-AC_DEFUN([_AM_DEPENDENCIES],
-[AC_REQUIRE([AM_SET_DEPDIR])dnl
-AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
-AC_REQUIRE([AM_MAKE_INCLUDE])dnl
-AC_REQUIRE([AM_DEP_TRACK])dnl
-
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
-
-AC_CACHE_CHECK([dependency style of $depcc],
-               [am_cv_$1_dependencies_compiler_type],
-[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_$1_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
-  fi
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    case $depmode in
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    none) break ;;
-    esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
-    if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_$1_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_$1_dependencies_compiler_type=none
-fi
-])
-AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
-AM_CONDITIONAL([am__fastdep$1], [
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
-])
-
-
-# AM_SET_DEPDIR
-# -------------
-# Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
-AC_DEFUN([AM_SET_DEPDIR],
-[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
-])
-
-
-# AM_DEP_TRACK
-# ------------
-AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-fi
-AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-])
-
-# Generate code to set up dependency tracking.              -*- Autoconf -*-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-#serial 3
-
-# _AM_OUTPUT_DEPENDENCY_COMMANDS
-# ------------------------------
-AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[for mf in $CONFIG_FILES; do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`AS_DIRNAME("$mf")`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`AS_DIRNAME(["$file"])`
-    AS_MKDIR_P([$dirpart/$fdir])
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
-  done
-done
-])# _AM_OUTPUT_DEPENDENCY_COMMANDS
-
-
-# AM_OUTPUT_DEPENDENCY_COMMANDS
-# -----------------------------
-# This macro should only be invoked once -- use via AC_REQUIRE.
-#
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
-# need in order to bootstrap the dependency handling code.
-AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
-[AC_CONFIG_COMMANDS([depfiles],
-     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
-# Do all the work for Automake.                             -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 13
-
-# This macro actually does too much.  Some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out.  PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition.  After
-# the next Automake release, Autoconf can make the AC_INIT
-# arguments mandatory, and then we can depend on a new Autoconf
-# release and drop the old call support.
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.60])dnl
-dnl Autoconf wants to disallow AM_ names.  We explicitly allow
-dnl the ones we care about.
-m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
-  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
-  # is not polluted with repeated "-I."
-  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
-  # test to see if srcdir already configured
-  if test -f $srcdir/config.status; then
-    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-  fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
- AC_SUBST([PACKAGE], [$1])dnl
- AC_SUBST([VERSION], [$2])],
-[_AM_SET_OPTIONS([$1])dnl
-dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
-  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
-
-_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
-
-# Some tools Automake needs.
-AC_REQUIRE([AM_SANITY_CHECK])dnl
-AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_PROG_INSTALL_SH
-AM_PROG_INSTALL_STRIP
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
-              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
-				[_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
-                  [_AM_DEPENDENCIES(CC)],
-                  [define([AC_PROG_CC],
-                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
-                  [_AM_DEPENDENCIES(CXX)],
-                  [define([AC_PROG_CXX],
-                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-                  [_AM_DEPENDENCIES(OBJC)],
-                  [define([AC_PROG_OBJC],
-                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
-])
-])
-
-
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated.  The stamp files are numbered to have different names.
-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_arg=$1
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
-AC_SUBST(install_sh)])
-
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot.  For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
-
-# Check to see how 'make' treats includes.	            -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# AM_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo done
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
-
-# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 5
-
-# AM_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
-
-
-# AM_MISSING_HAS_RUN
-# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
-AC_DEFUN([AM_MISSING_HAS_RUN],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([missing])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
-fi
-])
-
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
-# Helper functions for option handling.                     -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# _AM_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-
-# _AM_SET_OPTION(NAME)
-# ------------------------------
-# Set option NAME.  Presently that only means defining a flag for this option.
-AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
-
-# _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
-
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-AC_DEFUN([_AM_IF_OPTION],
-[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
-   test "$[2]" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-AC_MSG_RESULT(yes)])
-
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_STRIP
-# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
-# specify the program used to strip binaries.  This is especially
-# annoying in cross-compiling environments, where the build's strip
-# is unlikely to handle the host's binaries.
-# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
-# STRIPPROG with the value of the STRIP variable (set by the user).
-AC_DEFUN([AM_PROG_INSTALL_STRIP],
-[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
-if test "$cross_compiling" != no; then
-  AC_CHECK_TOOL([STRIP], [strip], :)
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-AC_SUBST([INSTALL_STRIP_PROGRAM])])
-
-# Copyright (C) 2006  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# _AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# Check how to create a tarball.                            -*- Autoconf -*-
-
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-#     tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-#     $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
-m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
-
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
-
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
-  rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
-
diff --git a/utils/ffsb-6.0-rc2/cirlist.c b/utils/ffsb-6.0-rc2/cirlist.c
deleted file mode 100644
index 1a96dc4..0000000
--- a/utils/ffsb-6.0-rc2/cirlist.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <stdlib.h>
-#include <assert.h>
-
-#include "cirlist.h"
-#include "util.h"
-
-void init_cirlist(struct cirlist *cl)
-{
-	cl->count = 0;
-	cl->head = NULL;
-}
-
-int cl_empty(struct cirlist *cl)
-{
-	return !(cl->count);
-}
-
-void cl_insert_tail(struct cirlist *cl, cldatatype object)
-{
-	struct cnode *new = ffsb_malloc(sizeof(struct cnode));
-	new->obj = object;
-	if (cl->count == 0) {
-		assert(cl->head == NULL);
-		cl->head = new;
-		cl->head->next = cl->head;
-		cl->head->prev = cl->head;
-		cl->count = 1;
-	} else {
-		if (cl->count == 1) {
-			assert(cl->head->next == cl->head);
-			assert(cl->head->prev == cl->head);
-			cl->head->next = new;
-			cl->head->prev = new;
-			new->next = cl->head;
-			new->prev = cl->head;
-		} else {
-			assert(cl->head->next != cl->head);
-			assert(cl->head->prev != cl->head);
-
-			new->next = cl->head;
-			new->prev = (cl->head)->prev;
-			cl->head->prev->next = new;
-			cl->head->prev = new;
-		}
-		cl->count++;
-	}
-}
-
-cldatatype cl_remove_head(struct cirlist *cl)
-{
-	struct cnode *oldhead = NULL;
-	struct cnode *newhead = NULL;
-	cldatatype ret = NULL;
-
-	if (cl->count == 0) {
-		assert(cl->head == NULL);
-		return NULL;
-	}
-	if (cl->count == 1) {
-		assert(cl->head->next == cl->head);
-		assert(cl->head->prev == cl->head);
-		oldhead = cl->head;
-		cl->head = NULL;
-		cl->count = 0;
-	} else if (cl->count == 2) {
-		oldhead = cl->head;
-		newhead = oldhead->next;
-		newhead->next = newhead;
-		newhead->prev = newhead;
-		cl->head = newhead;
-		cl->count = 1;
-	} else {
-		assert(cl->head->next != cl->head);
-		assert(cl->head->prev != cl->head);
-		oldhead = cl->head;
-		newhead = oldhead->next;
-		newhead->prev = oldhead->prev;
-		newhead->prev->next = newhead;
-		cl->head = newhead;
-		cl->count--;
-	}
-	ret = oldhead->obj;
-	oldhead->obj = (void *)(-1);
-	oldhead->next = (void *)(-1);
-	oldhead->prev = (void *)(-1);
-	free(oldhead);
-
-	return ret;
-}
diff --git a/utils/ffsb-6.0-rc2/cirlist.h b/utils/ffsb-6.0-rc2/cirlist.h
deleted file mode 100644
index e8356a9..0000000
--- a/utils/ffsb-6.0-rc2/cirlist.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _CIRLIST_H
-#define _CIRLIST_H
-
-#include "filelist.h"
-
-typedef struct ffsb_file *cldatatype;
-
-struct cnode {
-	cldatatype obj;
-	struct cnode *next;
-	struct cnode *prev;
-};
-
-struct cirlist {
-	int count;
-	struct cnode *head;
-};
-
-void init_cirlist(struct cirlist *cl);
-int cl_empty(struct cirlist *cl);
-void cl_insert_tail(struct cirlist *cl , cldatatype object);
-cldatatype cl_remove_head(struct cirlist *cl);
-
-#endif /* _CIRLIST_H */
diff --git a/utils/ffsb-6.0-rc2/config.guess b/utils/ffsb-6.0-rc2/config.guess
deleted file mode 120000
index 2442af0..0000000
--- a/utils/ffsb-6.0-rc2/config.guess
+++ /dev/null
@@ -1 +0,0 @@
-../../config.guess
\ No newline at end of file
diff --git a/utils/ffsb-6.0-rc2/config.h.in b/utils/ffsb-6.0-rc2/config.h.in
deleted file mode 100644
index 8e1aa84..0000000
--- a/utils/ffsb-6.0-rc2/config.h.in
+++ /dev/null
@@ -1,130 +0,0 @@
-/* config.h.in.  Generated from configure.in by autoheader.  */
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the `fseeko64' function. */
-#undef HAVE_FSEEKO64
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the `m' library (-lm). */
-#undef HAVE_LIBM
-
-/* Define to 1 if you have the `pthread' library (-lpthread). */
-#undef HAVE_LIBPTHREAD
-
-/* Define to 1 if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define to 1 if you have the `lrand48_r' function. */
-#undef HAVE_LRAND48_R
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the `mkdir' function. */
-#undef HAVE_MKDIR
-
-/* Define to 1 if you have the `open64' function. */
-#undef HAVE_OPEN64
-
-/* Define to 1 if you have the <pthread.h> header file. */
-#undef HAVE_PTHREAD_H
-
-/* Define to 1 if you have the `srand48_r' function. */
-#undef HAVE_SRAND48_R
-
-/* Define to 1 if you have the `stat64' function. */
-#undef HAVE_STAT64
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `system' function. */
-#undef HAVE_SYSTEM
-
-/* Define to 1 if you have the <sys/limits.h> header file. */
-#undef HAVE_SYS_LIMITS_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <sys/vfs.h> header file. */
-#undef HAVE_SYS_VFS_H
-
-/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
-   second argument and the buffer pointer as the third, as on System V before
-   release 3. */
-#undef SETVBUF_REVERSED
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
diff --git a/utils/ffsb-6.0-rc2/config.sub b/utils/ffsb-6.0-rc2/config.sub
deleted file mode 120000
index f1d837b..0000000
--- a/utils/ffsb-6.0-rc2/config.sub
+++ /dev/null
@@ -1 +0,0 @@
-../../config.sub
\ No newline at end of file
diff --git a/utils/ffsb-6.0-rc2/configure b/utils/ffsb-6.0-rc2/configure
deleted file mode 100755
index 12d5202..0000000
--- a/utils/ffsb-6.0-rc2/configure
+++ /dev/null
@@ -1,7000 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61.
-#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""	$as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
-
-  if test $as_have_required = yes && 	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-	 /*)
-	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-	   done;;
-       esac
-done
-IFS=$as_save_IFS
-
-
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-        done
-        export CONFIG_SHELL
-        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell autoconf@gnu.org about your system,
-  echo including any error possibly output before this
-  echo message
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-	case $1 in
-        -*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-
-ac_unique_file="main.c"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-am__isrc
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-CPP
-GREP
-EGREP
-LIBOBJS
-LTLIBOBJS'
-ac_subst_files=''
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
-    ac_prev=
-    continue
-  fi
-
-  case $ac_option in
-  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)	ac_optarg=yes ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case $ac_dashdash$ac_option in
-  --)
-    ac_dashdash=yes ;;
-
-  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-    ac_prev=bindir ;;
-  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
-
-  -build | --build | --buil | --bui | --bu)
-    ac_prev=build_alias ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
-
-  --config-cache | -C)
-    cache_file=config.cache ;;
-
-  -datadir | --datadir | --datadi | --datad)
-    ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=*)
-    datadir=$ac_optarg ;;
-
-  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-  | --dataroo | --dataro | --datar)
-    ac_prev=datarootdir ;;
-  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
-
-  -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
-
-  -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
-  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
-  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host_alias ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
-
-  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-    ac_prev=htmldir ;;
-  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-  | --ht=*)
-    htmldir=$ac_optarg ;;
-
-  -includedir | --includedir | --includedi | --included | --include \
-  | --includ | --inclu | --incl | --inc)
-    ac_prev=includedir ;;
-  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-  | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
-
-  -infodir | --infodir | --infodi | --infod | --info | --inf)
-    ac_prev=infodir ;;
-  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
-
-  -libdir | --libdir | --libdi | --libd)
-    ac_prev=libdir ;;
-  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
-
-  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-  | --libexe | --libex | --libe)
-    ac_prev=libexecdir ;;
-  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-  | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
-
-  -localedir | --localedir | --localedi | --localed | --locale)
-    ac_prev=localedir ;;
-  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
-
-  -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst | --locals)
-    ac_prev=localstatedir ;;
-  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-    localstatedir=$ac_optarg ;;
-
-  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-    ac_prev=mandir ;;
-  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-  | --oldin | --oldi | --old | --ol | --o)
-    ac_prev=oldincludedir ;;
-  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
-
-  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-    ac_prev=pdfdir ;;
-  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
-
-  -psdir | --psdir | --psdi | --psd | --ps)
-    ac_prev=psdir ;;
-  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-    ac_prev=sbindir ;;
-  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-  | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
-
-  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-  | --sharedst | --shareds | --shared | --share | --shar \
-  | --sha | --sh)
-    ac_prev=sharedstatedir ;;
-  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-  | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
-
-  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-  | --syscon | --sysco | --sysc | --sys | --sy)
-    ac_prev=sysconfdir ;;
-  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target_alias ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
-
-  -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
-
-  -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=no ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
-
-  -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
-    ;;
-
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
-    eval $ac_envvar=\$ac_optarg
-    export $ac_envvar ;;
-
-  *)
-    # FIXME: should be removed in autoconf 3.0.
-    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute directory names.
-for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
-		datadir sysconfdir sharedstatedir localstatedir includedir \
-		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
-do
-  eval ac_val=\$$ac_var
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
-  esac
-  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
-  if test "x$build_alias" = x; then
-    cross_compiling=maybe
-    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { echo "$as_me: error: Working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$0" : 'X\(//\)[^/]' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
-  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
-	pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
-  srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
-  eval ac_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_env_${ac_var}_value=\$${ac_var}
-  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
-  # Omit some internal or obsolete options to make the list less imposing.
-  # This message is too long to be a string in the A/UX 3.1 sh.
-  cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.  See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
-  -h, --help              display this help and exit
-      --help=short        display options specific to this package
-      --help=recursive    display the short help of all the included packages
-  -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
-      --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
-  -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
-
-Installation directories:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-			  [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-			  [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
-  --bindir=DIR           user executables [EPREFIX/bin]
-  --sbindir=DIR          system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
-  --libdir=DIR           object code libraries [EPREFIX/lib]
-  --includedir=DIR       C header files [PREFIX/include]
-  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR          info documentation [DATAROOTDIR/info]
-  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR           man documentation [DATAROOTDIR/man]
-  --docdir=DIR           documentation root [DATAROOTDIR/doc/PACKAGE]
-  --htmldir=DIR          html documentation [DOCDIR]
-  --dvidir=DIR           dvi documentation [DOCDIR]
-  --pdfdir=DIR           pdf documentation [DOCDIR]
-  --psdir=DIR            ps documentation [DOCDIR]
-_ACEOF
-
-  cat <<\_ACEOF
-
-Program names:
-  --program-prefix=PREFIX            prepend PREFIX to installed program names
-  --program-suffix=SUFFIX            append SUFFIX to installed program names
-  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
-
-System types:
-  --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-
-  cat <<\_ACEOF
-
-Optional Features:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
-
-Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
-  CPP         C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
-    else
-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
-  done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-configure
-generated by GNU Autoconf 2.61
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit
-fi
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by $as_me, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-	ac_must_keep_next=false # Got value, back to normal.
-      else
-	case $ac_arg in
-	  *=* | --config-cache | -C | -disable-* | --disable-* \
-	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-	  | -with-* | --with-* | -without-* | --without-* | --x)
-	    case "$ac_configure_args0 " in
-	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-	    esac
-	    ;;
-	  -* ) ac_must_keep_next=true ;;
-	esac
-      fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-	"s/'\''/'\''\\\\'\'''\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
-
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      echo "$as_me: caught signal $ac_signal"
-    echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
-elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
-else
-  set x "$ac_default_prefix/share/config.site" \
-	"$ac_default_prefix/etc/config.site"
-fi
-shift
-for ac_site_file
-do
-  if test -r "$ac_site_file"; then
-    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
-else
-  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
-echo "$as_me:   former value:  $ac_old_val" >&2;}
-	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
-echo "$as_me:   current value: $ac_new_val" >&2;}
-	ac_cache_corrupted=:
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-am__api_version='1.10'
-
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-	  if test $ac_prog = install &&
-	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	    break 3
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-done
-IFS=$as_save_IFS
-
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
-   fi
-
-   test "$2" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-test "$program_prefix" != NONE &&
-  program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.  echo might interpret backslashes.
-# By default was `s,x,x', remove it if useless.
-cat <<\_ACEOF >conftest.sed
-s/[\\$]/&&/g;s/;s,x,x,$//
-_ACEOF
-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm -f conftest.sed
-
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
-echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
-
-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
-if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in mkdir gmkdir; do
-	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
-	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
-	     'mkdir (GNU coreutils) '* | \
-	     'mkdir (coreutils) '* | \
-	     'mkdir (fileutils) '4.1*)
-	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
-	       break 3;;
-	   esac
-	 done
-       done
-done
-IFS=$as_save_IFS
-
-fi
-
-  if test "${ac_cv_path_mkdir+set}" = set; then
-    MKDIR_P="$ac_cv_path_mkdir -p"
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for MKDIR_P within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    test -d ./--version && rmdir ./--version
-    MKDIR_P="$ac_install_sh -d"
-  fi
-fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
-
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
-for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AWK="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-	@echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-  SET_MAKE=
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
-  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
-  # is not polluted with repeated "-I."
-  am__isrc=' -I$(srcdir)'
-  # test to see if srcdir already configured
-  if test -f $srcdir/config.status; then
-    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-
-
-# Define the identity of the package.
- PACKAGE=ffsb
- VERSION=6.0-RC2
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
-# Some tools Automake needs.
-
-ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
-
-
-AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
-
-
-AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
-
-
-AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
-
-
-MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-# Always define AMTAR for backward compatibility.
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-
-
-
-
-
-
-ac_config_headers="$ac_config_headers config.h"
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
-if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
-if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo done
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
-fi
-
-
-{ echo "$as_me:$LINENO: result: $_am_result" >&5
-echo "${ECHO_T}$_am_result" >&6; }
-rm -f confinc confmf
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
-  enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-fi
- if test "x$enable_dependency_tracking" != xno; then
-  AMDEP_TRUE=
-  AMDEP_FALSE='#'
-else
-  AMDEP_TRUE='#'
-  AMDEP_FALSE=
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort.  b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions.  Remove them first so a
-# subsequent execution test works.
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
-	;;
-    [ab].out )
-	# We found the default executable, but exeext='' is most
-	# certainly right.
-	break;;
-    *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-	then :; else
-	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	fi
-	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
-	# argument, so we may need to know it at that point already.
-	# Even if this section looks crufty: it has the advantage of
-	# actually working.
-	break;;
-    * )
-	break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-    fi
-  fi
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	  break;;
-    * ) break;;
-  esac
-done
-else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
-if test "${ac_cv_objext+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_c89=$ac_arg
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
-  xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-depcc="$CC"   am_compiler_list=
-
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_CC_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
-  fi
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    case $depmode in
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    none) break ;;
-    esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
-    if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_CC_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_CC_dependencies_compiler_type=none
-fi
-
-fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
-CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-
- if
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
-  am__fastdepCC_TRUE=
-  am__fastdepCC_FALSE='#'
-else
-  am__fastdepCC_TRUE='#'
-  am__fastdepCC_FALSE=
-fi
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  break
-fi
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-    # Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
-    $ac_path_GREP_found && break 3
-  done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-    # Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
-    $ac_path_EGREP_found && break 3
-  done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-
-   fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-
-{ echo "$as_me:$LINENO: checking for AIX" >&5
-echo $ECHO_N "checking for AIX... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef _AIX
-  yes
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "yes" >/dev/null 2>&1; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-cat >>confdefs.h <<\_ACEOF
-#define _ALL_SOURCE 1
-_ACEOF
-
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-rm -f conftest*
-
-
-
-case "${host}" in
-  *aix*)
-    CFLAGS="${CFLAGS} -D_THREAD_SAFE"
-    ;;
-  *linux*)
-    CFLAGS="${CFLAGS} -D_REENTRANT"
-    ;;
-  *)
-    echo "detected unknown platform : ${host} : compiles may fail"
-    CFLAGS="${CFLAGS} -D_REENTRANT"
-    ;;
-esac
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_c89=$ac_arg
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
-  xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-depcc="$CC"   am_compiler_list=
-
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_CC_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
-  fi
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    case $depmode in
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    none) break ;;
-    esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
-    if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_CC_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_CC_dependencies_compiler_type=none
-fi
-
-fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
-CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-
- if
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
-  am__fastdepCC_TRUE=
-  am__fastdepCC_FALSE='#'
-else
-  am__fastdepCC_TRUE='#'
-  am__fastdepCC_FALSE=
-fi
-
-
-
-
-{ echo "$as_me:$LINENO: checking for main in -lm" >&5
-echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6; }
-if test "${ac_cv_lib_m_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_m_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_m_main=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
-echo "${ECHO_T}$ac_cv_lib_m_main" >&6; }
-if test $ac_cv_lib_m_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
-  LIBS="-lm $LIBS"
-
-fi
-
-
-{ echo "$as_me:$LINENO: checking for main in -lpthread" >&5
-echo $ECHO_N "checking for main in -lpthread... $ECHO_C" >&6; }
-if test "${ac_cv_lib_pthread_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_pthread_main=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_pthread_main=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_main" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_main" >&6; }
-if test $ac_cv_lib_pthread_main = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
-
-  LIBS="-lpthread $LIBS"
-
-fi
-
-
-
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stdc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
-int
-main ()
-{
-  int s;
-  wait (&s);
-  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_sys_wait_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_sys_wait_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; }
-if test $ac_cv_header_sys_wait_h = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_WAIT_H 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-
-
-
-
-
-
-for ac_header in pthread.h fcntl.h limits.h stdint.h sys/time.h unistd.h sys/vfs.h sys/limits.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
-if test "${ac_cv_c_const+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
-  typedef int charset[2];
-  const charset cs;
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *pcpcc;
-  char **ppc;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  pcpcc = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++pcpcc;
-  ppc = (char**) pcpcc;
-  pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-    *t++ = 0;
-    if (s) return 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_const=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_const=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
-
-fi
-
-{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
-if test "${ac_cv_header_time+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_time=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_time=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
-
-fi
-
-
-{ echo "$as_me:$LINENO: checking for function prototypes" >&5
-echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; }
-if test "$ac_cv_prog_cc_c89" != no; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define PROTOTYPES 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define __PROTOTYPES 1
-_ACEOF
-
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-{ echo "$as_me:$LINENO: checking whether setvbuf arguments are reversed" >&5
-echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6; }
-if test "${ac_cv_func_setvbuf_reversed+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_func_setvbuf_reversed=no
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-#	  ifdef PROTOTYPES
-	   int (setvbuf) (FILE *, int, char *, size_t);
-#	  endif
-int
-main ()
-{
-char buf; return setvbuf (stdout, _IOLBF, &buf, 1);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-#	     ifdef PROTOTYPES
-	      int (setvbuf) (FILE *, int, char *, size_t);
-#	     endif
-int
-main ()
-{
-char buf; return setvbuf (stdout, &buf, _IOLBF, 1);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  # It compiles and links either way, so it must not be declared
-	 # with a prototype and most likely this is a K&R C compiler.
-	 # Try running it.
-	 if test "$cross_compiling" = yes; then
-  : # Assume setvbuf is not reversed when cross-compiling.
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-/* This call has the arguments reversed.
-		   A reversed system may check and see that the address of buf
-		   is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
-		char buf;
-		if (setvbuf (stdout, _IOLBF, &buf, 1) != 0)
-		  return 1;
-		putchar ('\r');
-		return 0; /* Non-reversed systems SEGV here.  */
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_setvbuf_reversed=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-	ac_cv_func_setvbuf_reversed=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_setvbuf_reversed" >&5
-echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6; }
-if test $ac_cv_func_setvbuf_reversed = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define SETVBUF_REVERSED 1
-_ACEOF
-
-fi
-
-
-
-
-
-
-
-
-
-
-for ac_func in system gettimeofday mkdir strerror open64 stat64 fseeko64 lrand48_r srand48_r
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-
-ac_config_files="$ac_config_files Makefile"
-
-ac_config_commands="$ac_config_commands default"
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
-  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-
-  (set) 2>&1 |
-    case $as_nl`(ac_space=' '; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
-      sed -n \
-	"s/'/'\\\\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;; #(
-    *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-) |
-  sed '
-     /^ac_cv_env_/b end
-     t clear
-     :clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-     t end
-     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
-  if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
-      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
-  else
-    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
-  fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-  # 1. Remove the extension, and $U if already installed.
-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`echo "$ac_i" | sed "$ac_script"`
-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
-  #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""	$as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-	case $1 in
-        -*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-
-# Save the log message, to keep $[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
-
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
-  -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
-  -q, --quiet      do not print progress messages
-  -d, --debug      don't remove temporary files
-      --recheck    update $as_me by reconfiguring in the same conditions
-  --file=FILE[:TEMPLATE]
-		   instantiate the configuration file FILE
-  --header=FILE[:TEMPLATE]
-		   instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to <bug-autoconf@gnu.org>."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.61,
-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2006 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-MKDIR_P='$MKDIR_P'
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value.  By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
-  case $1 in
-  --*=*)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
-    ac_shift=:
-    ;;
-  *)
-    ac_option=$1
-    ac_optarg=$2
-    ac_shift=shift
-    ;;
-  esac
-
-  case $ac_option in
-  # Handling of the options.
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    ac_cs_recheck=: ;;
-  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    echo "$ac_cs_version"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
-    ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
-    ac_need_defaults=false;;
-  --he | --h)
-    # Conflict between --help and --header
-    { echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit ;;
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil | --si | --s)
-    ac_cs_silent=: ;;
-
-  # This is an error.
-  -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
-
-  *) ac_config_targets="$ac_config_targets $1"
-     ac_need_defaults=false ;;
-
-  esac
-  shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
-  exec 6>/dev/null
-  ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
-  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  CONFIG_SHELL=$SHELL
-  export CONFIG_SHELL
-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-#
-# INIT-COMMANDS
-#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
-  case $ac_config_target in
-    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
-
-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
-  esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used.  Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
-  tmp=
-  trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
-}  ||
-{
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
-} ||
-{
-   echo "$me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
-
-#
-# Set up the sed scripts for CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
-
-_ACEOF
-
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-am__isrc!$am__isrc$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-DEPDIR!$DEPDIR$ac_delim
-am__include!$am__include$ac_delim
-am__quote!$am__quote$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-CPP!$CPP$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
-
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
-_ACEOF
-
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[	 ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-fi # test -n "$CONFIG_FILES"
-
-
-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
-   { (exit 1); exit 1; }; };;
-  :[FH]-) ac_tag=-:-;;
-  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-  esac
-  ac_save_IFS=$IFS
-  IFS=:
-  set x $ac_tag
-  IFS=$ac_save_IFS
-  shift
-  ac_file=$1
-  shift
-
-  case $ac_mode in
-  :L) ac_source=$1;;
-  :[FH])
-    ac_file_inputs=
-    for ac_f
-    do
-      case $ac_f in
-      -) ac_f="$tmp/stdin";;
-      *) # Look for the file first in the build tree, then in the source tree
-	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
-	 # because $ac_f cannot contain `:'.
-	 test -f "$ac_f" ||
-	   case $ac_f in
-	   [\\/$]*) false;;
-	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-	   esac ||
-	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
-      esac
-      ac_file_inputs="$ac_file_inputs $ac_f"
-    done
-
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
-    # use $as_me), people would be surprised to read:
-    #    /* config.h.  Generated by config.status.  */
-    configure_input="Generated from "`IFS=:
-	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    fi
-
-    case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin";;
-    esac
-    ;;
-  esac
-
-  ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$ac_file" : 'X\(//\)[^/]' \| \
-	 X"$ac_file" : 'X\(//\)$' \| \
-	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-  ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
-  case $ac_mode in
-  :F)
-  #
-  # CONFIG_FILE
-  #
-
-  case $INSTALL in
-  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
-  esac
-  ac_MKDIR_P=$MKDIR_P
-  case $MKDIR_P in
-  [\\/$]* | ?:[\\/]* ) ;;
-  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
-  esac
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-  ac_datarootdir_hack='
-  s&@datadir@&$datadir&g
-  s&@docdir@&$docdir&g
-  s&@infodir@&$infodir&g
-  s&@localedir@&$localedir&g
-  s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF
-  sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-s&@MKDIR_P@&$ac_MKDIR_P&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
-
-  rm -f "$tmp/stdin"
-  case $ac_file in
-  -) cat "$tmp/out"; rm -f "$tmp/out";;
-  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
-  esac
- ;;
-  :H)
-  #
-  # CONFIG_HEADER
-  #
-_ACEOF
-
-# Transform confdefs.h into a sed script `conftest.defines', that
-# substitutes the proper values into config.h.in to produce config.h.
-rm -f conftest.defines conftest.tail
-# First, append a space to every undef/define line, to ease matching.
-echo 's/$/ /' >conftest.defines
-# Then, protect against being on the right side of a sed subst, or in
-# an unquoted here document, in config.status.  If some macros were
-# called several times there might be several #defines for the same
-# symbol, which is useless.  But do not sort them, since the last
-# AC_DEFINE must be honored.
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
-# NAME is the cpp macro being defined, VALUE is the value it is being given.
-# PARAMS is the parameter list in the macro definition--in most cases, it's
-# just an empty string.
-ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
-ac_dB='\\)[	 (].*,\\1define\\2'
-ac_dC=' '
-ac_dD=' ,'
-
-uniq confdefs.h |
-  sed -n '
-	t rset
-	:rset
-	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
-	t ok
-	d
-	:ok
-	s/[\\&,]/\\&/g
-	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
-	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
-  ' >>conftest.defines
-
-# Remove the space that was appended to ease matching.
-# Then replace #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-# (The regexp can be short, since the line contains either #define or #undef.)
-echo 's/ $//
-s,^[	 #]*u.*,/* & */,' >>conftest.defines
-
-# Break up conftest.defines:
-ac_max_sed_lines=50
-
-# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
-# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
-# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
-# et cetera.
-ac_in='$ac_file_inputs'
-ac_out='"$tmp/out1"'
-ac_nxt='"$tmp/out2"'
-
-while :
-do
-  # Write a here document:
-    cat >>$CONFIG_STATUS <<_ACEOF
-    # First, check the format of the line:
-    cat >"\$tmp/defines.sed" <<\\CEOF
-/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
-/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
-b
-:def
-_ACEOF
-  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
-  echo 'CEOF
-    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
-  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
-  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
-  grep . conftest.tail >/dev/null || break
-  rm -f conftest.defines
-  mv conftest.tail conftest.defines
-done
-rm -f conftest.defines conftest.tail
-
-echo "ac_result=$ac_in" >>$CONFIG_STATUS
-cat >>$CONFIG_STATUS <<\_ACEOF
-  if test x"$ac_file" != x-; then
-    echo "/* $configure_input  */" >"$tmp/config.h"
-    cat "$ac_result" >>"$tmp/config.h"
-    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
-      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
-    else
-      rm -f $ac_file
-      mv "$tmp/config.h" $ac_file
-    fi
-  else
-    echo "/* $configure_input  */"
-    cat "$ac_result"
-  fi
-  rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_arg=$ac_file
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$_am_arg" : 'X\(//\)[^/]' \| \
-	 X"$_am_arg" : 'X\(//\)$' \| \
-	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$_am_arg" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`/stamp-h$_am_stamp_count
- ;;
-
-  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
- ;;
-  esac
-
-
-  case $ac_file$ac_mode in
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$mf" : 'X\(//\)[^/]' \| \
-	 X"$mf" : 'X\(//\)$' \| \
-	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$mf" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$file" : 'X\(//\)[^/]' \| \
-	 X"$file" : 'X\(//\)$' \| \
-	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-    { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
-  done
-done
- ;;
-    "default":C) echo timestamp > stamp-h ;;
-
-  esac
-done # for ac_tag
-
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded.  So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status.  When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
-  ac_cs_success=:
-  ac_config_status_args=
-  test "$silent" = yes &&
-    ac_config_status_args="$ac_config_status_args --quiet"
-  exec 5>/dev/null
-  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-  exec 5>>config.log
-  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
-  # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
-fi
-
diff --git a/utils/ffsb-6.0-rc2/configure.in b/utils/ffsb-6.0-rc2/configure.in
deleted file mode 100644
index 6aede0a..0000000
--- a/utils/ffsb-6.0-rc2/configure.in
+++ /dev/null
@@ -1,50 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT([ffsb], [6.0-RC2])
-AC_CONFIG_SRCDIR([main.c])
-AM_INIT_AUTOMAKE([foreign])
-
-AM_CONFIG_HEADER(config.h)
-AC_CANONICAL_HOST
-
-dnl need to define _ALL_SOURCE and _THREAD_SAFE on AIX
-AC_AIX
-
-case "${host}" in
-  *aix*)
-    CFLAGS="${CFLAGS} -D_THREAD_SAFE"
-    ;;
-  *linux*)
-    CFLAGS="${CFLAGS} -D_REENTRANT"
-    ;;
-  *)
-    echo "detected unknown platform : ${host} : compiles may fail"
-    CFLAGS="${CFLAGS} -D_REENTRANT"
-    ;;
-esac
-
-dnl Checks for programs.
-AC_PROG_CC
-
-dnl Checks for libraries.
-dnl Replace `main' with a function in -lm:
-AC_CHECK_LIB(m, main)
-dnl Replace `main' with a function in -lpthread:
-AC_CHECK_LIB(pthread, main)
-
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(pthread.h fcntl.h limits.h stdint.h sys/time.h unistd.h sys/vfs.h sys/limits.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_HEADER_TIME
-
-dnl Checks for library functions.
-AC_FUNC_SETVBUF_REVERSED
-AC_CHECK_FUNCS(system gettimeofday mkdir strerror open64 stat64 fseeko64 lrand48_r srand48_r)
-
-AC_SUBST(CFLAGS)
-AC_SUBST(CC)
-AC_OUTPUT(Makefile, echo timestamp > stamp-h)
diff --git a/utils/ffsb-6.0-rc2/depcomp b/utils/ffsb-6.0-rc2/depcomp
deleted file mode 100755
index aea3d00..0000000
--- a/utils/ffsb-6.0-rc2/depcomp
+++ /dev/null
@@ -1,472 +0,0 @@
-#! /bin/sh
-
-# depcomp - compile a program generating dependencies as side-effects
-# Copyright 1999, 2000 Free Software Foundation, Inc.
-
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
-  echo "depcomp: Variables source, object and depmode must be set" 1>&2
-  exit 1
-fi
-# `libtool' can also be set to `yes' or `no'.
-
-if test -z "$depfile"; then
-   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
-   dir=`echo "$object" | sed 's,/.*$,/,'`
-   if test "$dir" = "$object"; then
-      dir=
-   fi
-   # FIXME: should be _deps on DOS.
-   depfile="$dir.deps/$base"
-fi
-
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags.  We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write.  Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
-  # HP compiler uses -M and no extra arg.
-  gccflag=-M
-  depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff.  Hmm.
-  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  mv "$tmpdepfile" "$depfile"
-  ;;
-
-gcc)
-## There are various ways to get dependency output from gcc.  Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-##   up in a subdir.  Having to rename by hand is ugly.
-##   (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-##   than renaming).
-  if test -z "$gccflag"; then
-    gccflag=-MD,
-  fi
-  "$@" -Wp,"$gccflag$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
-  sed -e 's/^[^:]*: / /' \
-      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header).  We avoid this by adding
-## dummy dependencies for each header file.  Too bad gcc doesn't do
-## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
-sgi)
-  if test "$libtool" = yes; then
-    "$@" "-Wp,-MDupdate,$tmpdepfile"
-  else
-    "$@" -MDupdate "$tmpdepfile"
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-
-  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
-    echo "$object : \\" > "$depfile"
-
-    # Clip off the initial element (the dependent).  Don't try to be
-    # clever and replace this with sed code, as IRIX sed won't handle
-    # lines with more than a fixed number of characters (4096 in
-    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
-    # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> $depfile
-    echo >> $depfile
-
-    # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-aix)
-  # The C for AIX Compiler uses -M and outputs the dependencies
-  # in a .u file.  This file always lives in the current directory.
-  # Also, the AIX compiler puts `$object:' at the start of each line;
-  # $object doesn't have directory information.
-  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
-  outname="$stripped.o"
-  if test "$libtool" = yes; then
-    "$@" -Wc,-M
-  else
-    "$@" -M
-  fi
-
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      tmpdepfile1="$dir.libs/$base.lo.d"
-      tmpdepfile2="$dir.libs/$base.d"
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1="$dir$base.o.d"
-      tmpdepfile2="$dir$base.d"
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2"
-      exit $stat
-   fi
-
-   if test -f "$tmpdepfile1"; then
-      tmpdepfile="$tmpdepfile1"
-   else
-      tmpdepfile="$tmpdepfile2"
-   fi
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a space and a tab in the [].
-      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
-
-#nosideeffect)
-  # This comment above is used by automake to tell side-effect
-  # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the proprocessed file to stdout, regardless of -o.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
-  # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
-  "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-dashXmstdout)
-  # This case only exists to satisfy depend.m4.  It is never actually
-  # run, as this mode is specially recognized in the preamble.
-  exit 1
-  ;;
-
-makedepend)
-  "$@" || exit $?
-  # Remove any Libtool call
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-  # X makedepend
-  shift
-  cleared=no
-  for arg in "$@"; do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    case "$arg" in
-    -D*|-I*)
-      set fnord "$@" "$arg"; shift ;;
-    # Strip any option that makedepend may not understand.  Remove
-    # the object too, otherwise makedepend will parse it as a source file.
-    -*|$object)
-      ;;
-    *)
-      set fnord "$@" "$arg"; shift ;;
-    esac
-  done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
-  touch "$tmpdepfile"
-  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile" "$tmpdepfile".bak
-  ;;
-
-cpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the proprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  "$@" -E |
-    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  cat < "$tmpdepfile" >> "$depfile"
-  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvisualcpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the proprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
-  "$@" || exit $?
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
-    *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
-    esac
-  done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-none)
-  exec "$@"
-  ;;
-
-*)
-  echo "Unknown depmode $depmode" 1>&2
-  exit 1
-  ;;
-esac
-
-exit 0
diff --git a/utils/ffsb-6.0-rc2/examples/profile_everything b/utils/ffsb-6.0-rc2/examples/profile_everything
deleted file mode 100644
index 67972e1..0000000
--- a/utils/ffsb-6.0-rc2/examples/profile_everything
+++ /dev/null
@@ -1,119 +0,0 @@
-directio	= 0
-time		= 10
-
-[filesystem]
-	location	= /mnt/test1
-
-	num_dirs	= 100
-
-	size_weight	4k	33
-	size_weight	8k	21
-	size_weight	16k	13
-	size_weight	32k	10
-	size_weight	64k	8
-	size_weight	128k	5
-	size_weight	256k	4
-	size_weight	512k	3
-	size_weight	8m	2
-	size_weight	32m	1
-#	size_weight	1g	1
-
-#	min_filesize	= 4k
-#	max_filesize	= 10m
-
-#	num_files	= 0
-	init_size	= 100m
-#	init_size	= 6GB
-#	init_size	= 1gb
-#	init_util	= 0.002
-
-	agefs		= 0
-	[threadgroup]
-		num_threads	= 10
-		write_size	= 400
-		write_blocksize	= 1024
-		create_weight	= 10
-		append_weight	= 10
-		delete_weight	= 1
-	[end]
-	desired_util	= 0.005
-
-
-[end]
-
-#[filesystem]
-#	location	= /mnt/test1
-#	clone		= /mnt/test2
-#[end]
-
-[threadgroup]
-	num_threads	= 4
-
-#	bindfs		= /mnt/test1
-
-	append_weight		= 1
-	append_fsync_weight	= 1
-	stat_weight		= 1
-#	write_weight		= 1
-#	write_fsync_weight	= 1
-#	read_weight		= 1
-	create_weight		= 1
-	create_fsync_weight	= 1
-	delete_weight		= 1
-	readall_weight		= 1
-	writeall_weight		= 1
-	writeall_fsync_weight	= 1
-	open_close_weight	= 1
-
-	read_random	= 0
-	write_random	= 0
-
-	write_size	= 40k
-	write_blocksize	= 4k
-	read_size	= 40k
-	read_blocksize	= 4k
-
-	op_delay	= 0
-
-	[stats]
-		enable_stats	= 1
-		enable_range	= 0
-
-#		ignore		= close
-#		ignore		= open
-#		ignore		= lseek
-#		ignore		= write
-#		ignore		= read
-
-		msec_range	0.00 0.01
-		msec_range	0.01 0.02
-		msec_range	0.02 0.03
-		msec_range	0.03 0.04
-		msec_range	0.04 0.05
-		msec_range	0.05 0.1
-		msec_range	0.1 0.2
-		msec_range	0.2 0.5
-		msec_range	0.5 1.0
-		msec_range	1.0 2.0
-		msec_range	2.0 3.0
-		msec_range	3.0 4.0
-		msec_range	4.0 5.0
-		msec_range	5.0 10.0
-		msec_range	10.0 10000.0
-	[end]
-[end]
-
-#[threadgroup]
-#	num_threads	= 1
-#
-#	readall_weight  = 0
-#	writeall_weight = 0
-#	createdir_weight = 0
-#
-#	write_size      = 4096
-#	write_blocksize = 4096
-#	read_size       = 4096
-#	read_blocksize  = 4096
-#
-#	op_delay	= 12
-#[end]
diff --git a/utils/ffsb-6.0-rc2/ffsb.h b/utils/ffsb-6.0-rc2/ffsb.h
deleted file mode 100644
index 25a9a10..0000000
--- a/utils/ffsb-6.0-rc2/ffsb.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FFSB_H_
-#define _FFSB_H_
-
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "config.h"
-
-#include "ffsb_op.h"
-#include "ffsb_tg.h"
-#include "ffsb_fs.h"
-
-/*
- * The main thread wakes up once in so many seconds to check elapsed
- * time this is a tunable for that sleep interval in seconds
- */
-
-#define FFSB_TG_WAIT_TIME (1)
-
-#define MARK printf("MARK FUNC: %s() @ %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
-
-struct results {
-	struct rusage before;
-	struct rusage after;
-	double runtime;
-	double cputime;
-	double cpu_before;
-	double cpu_after;
-	double cpu_total;
-};
-
-struct ffsb_tg;
-struct ffsb_fs;
-
-typedef struct profile_config {
-	struct config_options *global;
-	struct container *fs_container;
-	struct container *tg_container;
-} profile_config_t;
-
-typedef struct ffsb_config {
-	unsigned time;
-
-	unsigned num_filesys;
-	unsigned num_threadgroups;
-
-	int num_totalthreads;		/* gets calculated after init() */
-
-	struct ffsb_tg *groups;
-	struct ffsb_fs *filesystems;
-
-	struct profile_config *profile_conf;
-	char *callout;			/* we will try and exec this */
-
-	struct results results;
-} ffsb_config_t;
-
-void init_ffsb_config(ffsb_config_t *fc, unsigned num_fs, unsigned num_tg);
-
-/*
- * this is kind of like a special case "constructor" which is only
- * used by fs-aging code to build a fake config for the aging tg
- */
-void init_ffsb_config_1fs(ffsb_config_t *fc, struct ffsb_fs *fs,
-			   struct ffsb_tg *tg);
-
-void destroy_ffsb_config(ffsb_config_t *fc);
-
-/* getters/setters, parser only should use setters */
-
-void fc_set_time(ffsb_config_t *fc, unsigned time);
-
-void fc_set_num_totalthreads(ffsb_config_t *fc, int num);
-
-/* num is zero-based */
-/* get a particular threadgroup object */
-struct ffsb_tg *fc_get_tg(ffsb_config_t *fc, unsigned num);
-
-/* get a particular filesystem object */
-struct ffsb_fs *fc_get_fs(ffsb_config_t *fc, unsigned num);
-
-void fc_set_callout(ffsb_config_t *fc, char *callout);
-char *fc_get_callout(ffsb_config_t *fc);
-
-#endif
diff --git a/utils/ffsb-6.0-rc2/ffsb_fc.c b/utils/ffsb-6.0-rc2/ffsb_fc.c
deleted file mode 100644
index c383a6a..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_fc.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <pthread.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-#include <assert.h>
-
-#include "config.h"
-
-#include "ffsb.h"
-#include "util.h"
-#include "parser.h"
-
-void init_ffsb_config(ffsb_config_t * fc, unsigned num_fs, unsigned num_tg)
-{
-	memset(fc, 0, sizeof(ffsb_config_t));
-
-	fc->num_totalthreads = -1;
-	fc->num_threadgroups = num_tg;
-	fc->num_filesys = num_fs;
-
-	fc->groups = ffsb_malloc(sizeof(ffsb_tg_t) * num_tg);
-	fc->filesystems = ffsb_malloc(sizeof(ffsb_fs_t) * num_fs);
-}
-
-void init_ffsb_config_1fs(ffsb_config_t * fc, ffsb_fs_t * fs, ffsb_tg_t * tg)
-{
-	memset(fc, 0, sizeof(*fc));
-
-	fc->num_totalthreads = tg_get_numthreads(tg);
-	fc->num_threadgroups = 1;
-	fc->num_filesys = 1;
-
-	fc->groups = tg;
-	fc->filesystems = fs;
-}
-
-void destroy_ffsb_config(ffsb_config_t * fc)
-{
-	int i;
-	for (i = 0; i < fc->num_filesys; i++)
-		destroy_ffsb_fs(&fc->filesystems[i]);
-
-	for (i = 0; i < fc->num_threadgroups; i++)
-		destroy_ffsb_tg(&fc->groups[i]);
-
-	free(fc->groups);
-	free(fc->filesystems);
-}
-
-void fc_set_time(ffsb_config_t * fc, unsigned time)
-{
-	fc->time = time;
-}
-
-unsigned fc_get_num_filesys(ffsb_config_t * fc)
-{
-	return fc->num_filesys;
-}
-
-struct ffsb_tg *fc_get_tg(ffsb_config_t * fc, unsigned num)
-{
-	assert(num < fc->num_threadgroups);
-	return &fc->groups[num];
-}
-
-struct ffsb_fs *fc_get_fs(ffsb_config_t * fc, unsigned num)
-{
-	assert(num < fc->num_filesys);
-	return &fc->filesystems[num];
-}
-
-void fc_set_num_totalthreads(ffsb_config_t * fc, int num)
-{
-	assert(num > 0);
-	fc->num_totalthreads = num;
-}
-
-void fc_set_callout(ffsb_config_t * fc, char *callout)
-{
-	free(fc->callout);
-	fc->callout = ffsb_strdup(callout);
-}
-
-char *fc_get_callout(ffsb_config_t * fc)
-{
-	return fc->callout;
-}
diff --git a/utils/ffsb-6.0-rc2/ffsb_fs.c b/utils/ffsb-6.0-rc2/ffsb_fs.c
deleted file mode 100644
index eb5a759..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_fs.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fcntl.h>
-
-#include "ffsb_fs.h"
-#include "util.h"
-#include "fh.h"
-
-/* First zero out struct, set num_dirs, and strdups basedir */
-void init_ffsb_fs(ffsb_fs_t * fs, char *basedir, uint32_t num_data_dirs,
-		  uint32_t numstartfiles, unsigned flags)
-{
-	memset(fs, 0, sizeof(ffsb_fs_t));
-	fs->basedir = ffsb_strdup(basedir);
-	fs->num_dirs = num_data_dirs;
-	fs->num_start_files = numstartfiles;
-	fs->flags = flags;
-	fs->create_blocksize = FFSB_FS_DEFAULT_CREATE_BLOCKSIZE;
-	fs->age_blocksize = FFSB_FS_DEFAULT_AGE_BLOCKSIZE;
-	fs->age_fs = 0;
-}
-
-/*
- * Does not remove files/dirs on disk, only frees up data
- * structures
-*/
-void destroy_ffsb_fs(ffsb_fs_t * fs)
-{
-	free(fs->basedir);
-	destroy_filelist(&fs->files);
-	destroy_filelist(&fs->fill);
-	destroy_filelist(&fs->meta);
-}
-
-void clone_ffsb_fs(ffsb_fs_t * target, ffsb_fs_t * orig)
-{
-	target->basedir = orig->basedir;
-	target->flags = orig->flags;
-
-	/* !!!! hackish, write a filelist_clone() function later */
-	memcpy(&target->files, &orig->files, sizeof(orig->files));
-	memcpy(&target->fill, &orig->fill, sizeof(orig->fill));
-	memcpy(&target->meta, &orig->meta, sizeof(orig->meta));
-
-	target->num_dirs = orig->num_dirs;
-	target->num_start_files = orig->num_start_files;
-	target->minfilesize = orig->minfilesize;
-	target->maxfilesize = orig->maxfilesize;
-
-	target->start_fsutil = orig->start_fsutil;
-	target->desired_fsutil = orig->desired_fsutil;
-
-	target->age_fs = orig->age_fs;
-	target->num_age_dirs = orig->num_age_dirs;
-	target->aging_tg = orig->aging_tg;
-
-	target->create_blocksize = orig->create_blocksize;
-	target->age_blocksize = orig->age_blocksize;
-
-	memcpy(target->op_data, orig->op_data, sizeof(void *) * FFSB_NUMOPS);
-}
-
-static void add_files(ffsb_fs_t * fs, struct benchfiles *bf, int num,
-		      uint64_t minsize, uint64_t maxsize, unsigned blocksize)
-{
-	struct ffsb_file *cur;
-	int i, fd, condition = 0, has_directio = 0;
-	randdata_t rd;
-	char *buf = ffsb_malloc(blocksize);
-	uint64_t initial_free = getfsutil_size(fs->basedir);
-
-	if (fs_get_directio(fs)) {
-		has_directio = 1;
-		fs_set_directio(fs, 0);
-	}
-
-	assert(blocksize);
-
-	init_random(&rd, 0);
-
-	if (num)
-		condition = num;
-	else if (fs->init_size) {
-		if (getfsutil(fs->basedir) != initial_free ||
-		    fs->init_size > (getfsutil_size(fs->basedir) -
-				     initial_free))
-			condition = 1;
-		else
-			condition = 0;
-	} else if (fs->init_fsutil) {
-		if (fs->init_fsutil > getfsutil(fs->basedir))
-			condition = 1;
-		else
-			condition = 0;
-	}
-
-	while (condition) {
-		uint64_t size;
-		if (fs->num_weights) {
-			int num = 1 + getrandom(&rd, fs->sum_weights);
-			int curop = 0;
-
-			while (fs->size_weights[curop].weight < num) {
-				num -= fs->size_weights[curop].weight;
-				curop++;
-			}
-			size = fs->size_weights[curop].size;
-		} else
-			size = minsize + getllrandom(&rd, maxsize - minsize);
-
-		cur = add_file(bf, size, &rd);
-		fd = fhopencreate(cur->name, NULL, fs);
-		writefile_helper(fd, size, blocksize, buf, NULL, fs);
-		fhclose(fd, NULL, fs);
-		unlock_file_writer(cur);
-
-		if (num)
-			condition--;
-		else if (fs->init_size) {
-			if (fs->init_size > getfsutil_size(fs->basedir) -
-			    initial_free)
-				condition = 1;
-			else
-				condition = 0;
-		} else if (fs->init_fsutil) {
-			if (fs->init_fsutil > getfsutil(fs->basedir))
-				condition = 1;
-			else
-				condition = 0;
-		}
-
-	}
-	free(buf);
-	if (has_directio)
-		fs_set_directio(fs, 1);
-}
-
-static void age_fs(ffsb_fs_t * fs, double utilization);
-static ffsb_fs_t *construct_new_fileset(ffsb_fs_t * fs);
-static ffsb_fs_t *check_existing_fileset(ffsb_fs_t * fs);
-
-void *construct_ffsb_fs(void *data)
-{
-	ffsb_fs_t *fs = (ffsb_fs_t *) data;
-	ffsb_fs_t *ret = NULL;
-
-	if (fs_get_reuse_fs(fs)) {
-		printf("checking existing fs: %s\n", fs->basedir);
-		ret = check_existing_fileset(fs);
-		if (ret == NULL) {
-			printf("recreating new fileset\n");
-			ret = construct_new_fileset(fs);
-		}
-	} else {
-		printf("creating new fileset %s\n", fs->basedir);
-		ret = construct_new_fileset(fs);
-	}
-	if (ret == NULL) {
-		printf("fs setup on %s failed\n", fs->basedir);
-		exit(1);
-	}
-	return ret;
-}
-
-static int verify_file(struct benchfiles *bf, char *fname, void *fs_ptr)
-{
-	ffsb_fs_t *fs = (ffsb_fs_t *) fs_ptr;
-	uint64_t minsize = fs->minfilesize;
-	uint64_t maxsize = fs->maxfilesize;
-	uint64_t filesize = 0;
-	int fd = 0;
-	DIR *dirptr = NULL;
-
-	/* If it is a directory and it passed the name verification we
-	 * don't need to do anything here
-	 */
-	dirptr = opendir(fname);
-	if (dirptr) {
-		closedir(dirptr);
-		return 0;
-	}
-
-	fd = open(fname, O_RDONLY);
-	/* If we can't open it for read we're done */
-	if (fd < 0) {
-		printf("verify_file: error opening %s for readonly\n", fname);
-		perror(fname);
-		return 1;
-	}
-	close(fd);
-	filesize = ffsb_get_filesize(fname);
-
-	if (filesize < minsize || filesize > maxsize) {
-		printf("size %llu bytes for file %s is invalid\n",
-		       filesize, fname);
-		return 1;
-	}
-
-	return 0;
-}
-
-/* Record the number of files and directorys there are supposed to be
- * grab (check and build the structures) the regular data fileset then
- * check to make sure the number of directories and files in that
- * filelist matches up.  Then grab the meta filelist and verify that
- * the meta filelist is empty.  Set up the filelist for fill (aging)
- * and setup the ops for the benchmark.
-*/
-static ffsb_fs_t *check_existing_fileset(ffsb_fs_t * fs)
-{
-	char buf[FILENAME_MAX * 3];
-	int retval = 0;
-	uint32_t num_dirs = fs->num_dirs;
-	uint32_t num_files = fs->num_start_files;
-
-	if (fs->age_fs) {
-		printf("Aging and reusing the fileset are mutually "
-		       "exclusive\n");
-		printf("aborting\n");
-		return NULL;
-	}
-
-	/* Set up bench/age dir */
-	if (FILENAME_MAX <=
-	    snprintf(buf, FILENAME_MAX, "%s/%s", fs->basedir, FILES_BASE)) {
-		printf("pathname \"%s\" is too long, aborting\n", buf);
-		return NULL;
-	}
-
-	/* Make a "dummy" filelist that has numsubdirs set to 0 and
-	 * numstartfiles set to 0
-	 */
-	init_filelist(&fs->files, buf, FILES_BASE, 0, 0);
-
-	retval = grab_old_fileset(&fs->files, buf, verify_file, fs);
-
-	if (retval)
-		return NULL;
-
-	if ((get_listsize(&fs->files) != num_files) ||
-	    (get_numsubdirs(&fs->files) != num_dirs)) {
-		printf("check_existing_fileset: number of files (%u)"
-		       " or directorys (%u) don't match up\n",
-		       get_listsize(&fs->files), get_numsubdirs(&fs->files));
-		destroy_filelist(&fs->files);
-		return NULL;
-	}
-
-	if (FILENAME_MAX <=
-	    snprintf(buf, FILENAME_MAX, "%s/%s", fs->basedir, META_BASE)) {
-		printf("pathname \"%s\" is too long, aborting\n", buf);
-		return NULL;
-	}
-
-	init_filelist(&fs->meta, buf, META_BASE, 0, 1);
-	retval = grab_old_fileset(&fs->meta, buf, verify_file, fs);
-
-	if (retval) {
-		destroy_filelist(&fs->files);
-		return NULL;
-	}
-
-	if ((get_listsize(&fs->meta) != 0) || (get_numsubdirs(&fs->meta) != 0)) {
-		printf("check_existing_fileset: meta directory isn't empty\n"
-		       "aborting\n");
-		destroy_filelist(&fs->files);
-		destroy_filelist(&fs->meta);
-		return NULL;
-	}
-
-	/* Even though we won't use it, we still need to be consistent
-	 * here.
-	 */
-	init_filelist(&fs->fill, buf, AGE_BASE, 0, 0);
-
-	/* Have to do this or everything else could break. */
-	ops_setup_bench(fs);
-
-	return fs;
-}
-
-/*
- *  clean up fs, "rm -rf data meta"
- *  record utilization
- *  set up the dirs: files, meta
- *  age filesystem
- *  have ffsb_ops setup their data
- *  create starting files in files
- */
-static ffsb_fs_t *construct_new_fileset(ffsb_fs_t * fs)
-{
-	char buf[FILENAME_MAX * 3];
-
-	/* TODO: Convert this quick and dirty rm -rf to a "real"
-	 * programmatic version, that doesn't rely on the rm command.
-	 */
-	if (FILENAME_MAX * 3 <= snprintf(buf, FILENAME_MAX * 3,
-					 "rm -rf %s/data %s/meta",
-					 fs->basedir, fs->basedir)) {
-		printf("pathname too long for command \"%s\"\n", buf);
-		return NULL;
-	}
-
-	if (ffsb_system(buf) < 0) {
-		perror(buf);
-		return NULL;
-	}
-
-	fs->start_fsutil = getfsutil(fs->basedir);
-
-	/* Set up bench/age dir */
-	if (FILENAME_MAX <=
-	    snprintf(buf, FILENAME_MAX, "%s/%s", fs->basedir, FILES_BASE)) {
-		printf("pathname \"%s\" is too long, aborting\n", buf);
-		return NULL;
-	}
-
-	ffsb_mkdir(buf);
-
-	/* Regular files and aging share this directory */
-	init_filelist(&fs->files, buf, FILES_BASE, fs->num_dirs, 1);
-	init_filelist(&fs->fill, buf, AGE_BASE, fs->num_age_dirs, 1);
-
-	/* Set up meta dir */
-	snprintf(buf, FILENAME_MAX, "%s/%s", fs->basedir, META_BASE);
-
-	ffsb_mkdir(buf);
-
-	init_filelist(&fs->meta, buf, META_BASE, 0, 1);
-
-	/* Do aging */
-	if (fs->age_fs)
-		age_fs(fs, fs->desired_fsutil);
-
-	/* Call back into ops, set for benchmark */
-	ops_setup_bench(fs);
-
-	/* Create initial fileset */
-	add_files(fs, &fs->files, fs->num_start_files, fs->minfilesize,
-		  fs->maxfilesize, fs->create_blocksize);
-	return fs;
-}
-
-struct poll_data {
-	ffsb_fs_t *fs;
-	double util;
-};
-
-static int fs_get_util(void *data)
-{
-	struct poll_data *pd = (struct poll_data *)data;
-	double fsutil = getfsutil(pd->fs->basedir);
-
-	if (fsutil >= pd->util)
-		return 1;
-
-	return 0;
-}
-
-static void age_fs(ffsb_fs_t * fs, double utilization)
-{
-	ffsb_barrier_t barrier;
-	pthread_t thread;
-	struct poll_data pdata;
-	ffsb_tg_t *tg = fs_get_aging_tg(fs);
-	tg_run_params_t params;
-	ffsb_config_t fc;
-
-	printf("aging fs %s from %.2lf to %.2lf\n", fs->basedir,
-	       fs->start_fsutil, utilization);
-	ffsb_barrier_init(&barrier, tg_get_numthreads(tg));
-
-	init_ffsb_config_1fs(&fc, fs, tg);
-
-	pdata.fs = fs;
-	pdata.util = utilization;
-
-	params.tg = tg;
-	params.poll_fn = fs_get_util;
-	params.poll_data = &pdata;
-	params.wait_time = 1;
-	params.fc = &fc;
-
-	params.tg_barrier = NULL;
-	params.thread_barrier = &barrier;
-
-	/* Call back into ops, setup for aging */
-	ops_setup_age(fs);
-
-	/* Throw in some files to start off, so there's something */
-	add_files(fs, &fs->fill, 10, 0, 0, fs->age_blocksize);
-
-	pthread_create(&thread, NULL, tg_run, &params);
-	pthread_join(thread, NULL);
-}
-
-void fs_set_create_blocksize(ffsb_fs_t * fs, uint32_t blocksize)
-{
-	fs->create_blocksize = blocksize;
-}
-
-void fs_set_age_blocksize(ffsb_fs_t * fs, uint32_t blocksize)
-{
-	fs->age_blocksize = blocksize;
-}
-
-uint32_t fs_get_create_blocksize(ffsb_fs_t * fs)
-{
-	return fs->create_blocksize;
-}
-
-uint32_t fs_get_age_blocksize(ffsb_fs_t * fs)
-{
-	return fs->age_blocksize;
-}
-
-char *fs_get_basedir(ffsb_fs_t * fs)
-{
-	return fs->basedir;
-}
-
-uint32_t fs_get_numstartfiles(ffsb_fs_t * fs)
-{
-	return fs->num_start_files;
-}
-
-uint32_t fs_get_numdirs(ffsb_fs_t * fs)
-{
-	return fs->num_dirs;
-}
-
-int fs_get_libcio(ffsb_fs_t * fs)
-{
-	return fs->flags & FFSB_FS_LIBCIO;
-}
-
-void fs_set_libcio(ffsb_fs_t * fs, int lio)
-{
-	if (lio)
-		fs->flags |= FFSB_FS_LIBCIO;
-	else
-		fs->flags &= ~0 & ~FFSB_FS_LIBCIO;
-}
-
-int fs_get_directio(ffsb_fs_t * fs)
-{
-	return fs->flags & FFSB_FS_DIRECTIO;
-}
-
-void fs_set_directio(ffsb_fs_t * fs, int dio)
-{
-	if (dio)
-		fs->flags |= FFSB_FS_DIRECTIO;
-	else
-		fs->flags &= ~0 & ~FFSB_FS_DIRECTIO;
-}
-
-int fs_get_alignio(ffsb_fs_t * fs)
-{
-	return fs->flags & FFSB_FS_ALIGNIO4K;
-}
-
-void fs_set_alignio(ffsb_fs_t * fs, int aio)
-{
-	if (aio)
-		fs->flags |= FFSB_FS_ALIGNIO4K;
-	else
-		fs->flags &= ~0 & ~FFSB_FS_ALIGNIO4K;
-}
-
-int fs_get_reuse_fs(ffsb_fs_t * fs)
-{
-	return fs->flags & FFSB_FS_REUSE_FS;
-}
-
-void fs_set_reuse_fs(ffsb_fs_t * fs, int rfs)
-{
-	if (rfs)
-		fs->flags |= FFSB_FS_REUSE_FS;
-	else
-		fs->flags &= ~0 & ~FFSB_FS_REUSE_FS;
-}
-
-struct benchfiles *fs_get_datafiles(ffsb_fs_t * fs)
-{
-	return &fs->files;
-}
-
-struct benchfiles *fs_get_metafiles(ffsb_fs_t * fs)
-{
-	return &fs->meta;
-}
-
-struct benchfiles *fs_get_agefiles(ffsb_fs_t * fs)
-{
-	return &fs->fill;
-}
-
-void fs_set_aging_tg(ffsb_fs_t * fs, struct ffsb_tg *tg, double util)
-{
-	fs->aging_tg = tg;
-	fs->age_fs = 1;
-	fs->desired_fsutil = util;
-}
-
-struct ffsb_tg *fs_get_aging_tg(ffsb_fs_t * fs)
-{
-	return fs->aging_tg;
-}
-
-int fs_get_agefs(ffsb_fs_t * fs)
-{
-	return fs->age_fs;
-}
-
-/* TODO: Implement this!!!*/
-void fs_set_num_age_dirs(ffsb_fs_t * fs, uint32_t numdirs)
-{
-	fs->num_age_dirs = numdirs;
-}
-
-void fs_set_opdata(ffsb_fs_t * fs, void *data, unsigned opnum)
-{
-	fs->op_data[opnum] = data;
-}
-
-void *fs_get_opdata(ffsb_fs_t * fs, unsigned opnum)
-{
-	return fs->op_data[opnum];
-}
-
-void fs_set_min_filesize(ffsb_fs_t * fs, uint64_t size)
-{
-	fs->minfilesize = size;
-}
-
-void fs_set_max_filesize(ffsb_fs_t * fs, uint64_t size)
-{
-	fs->maxfilesize = size;
-}
-
-uint64_t fs_get_min_filesize(ffsb_fs_t * fs)
-{
-	return fs->minfilesize;
-}
-
-uint64_t fs_get_max_filesize(ffsb_fs_t * fs)
-{
-	return fs->maxfilesize;
-}
-
-double fs_get_desired_fsutil(ffsb_fs_t * fs)
-{
-	return fs->desired_fsutil;
-}
-
-void fs_print_config(ffsb_fs_t * fs)
-{
-	char buf[256];
-
-	printf("FileSystem %s\n", fs->basedir);
-	printf("==========\n");
-	printf("\t num_dirs         = %u\n", fs->num_dirs);
-	printf("\t starting files   = %u\n", fs->num_start_files);
-	printf("\t\n");
-	if (fs->num_weights) {
-		int i;
-		printf("\t Fileset weight:\n");
-		for (i = 0; i < fs->num_weights; i++)
-			printf("\t\t %12llu (%6s) -> %u (%.2f\%)\n",
-			       fs->size_weights[i].size,
-			       ffsb_printsize(buf, fs->size_weights[i].size,
-					      256), fs->size_weights[i].weight,
-			       ((float)fs->size_weights[i].weight /
-				(float)fs->sum_weights) * 100);
-	} else {
-		printf("\t min file size    = %llu\t(%s)\n", fs->minfilesize,
-		       ffsb_printsize(buf, fs->minfilesize, 256));
-		printf("\t max file size    = %llu\t(%s)\n", fs->maxfilesize,
-		       ffsb_printsize(buf, fs->maxfilesize, 256));
-	}
-	printf("\t directio         = %s\n", (fs->flags & FFSB_FS_DIRECTIO) ?
-	       "on" : "off");
-	printf("\t alignedio        = %s\n", (fs->flags & FFSB_FS_ALIGNIO4K) ?
-	       "on" : "off");
-	printf("\t bufferedio       = %s\n", (fs->flags & FFSB_FS_LIBCIO) ?
-	       "on" : "off");
-	printf("\t\n");
-	printf("\t aging is %s\n", (fs->age_fs) ? "on" : "off");
-	printf("\t current utilization = %.2f\%\n",
-	       getfsutil(fs->basedir) * 100);
-	if (fs->age_fs) {
-		printf("\t desired utilization = %.2lf%\n",
-		       fs->desired_fsutil * 100);
-		printf("\t \n");
-		tg_print_config_aging(fs->aging_tg, fs->basedir);
-	}
-	printf("\t\n");
-}
-
-int fs_needs_stats(ffsb_fs_t * fs, syscall_t sys)
-{
-	return (fs != NULL) ? (int)fs->fsd.config : 0;
-}
-
-void fs_add_stat(ffsb_fs_t * fs, syscall_t sys, uint32_t val)
-{
-	if (fs)
-		ffsb_add_data(&fs->fsd, sys, val);
-}
diff --git a/utils/ffsb-6.0-rc2/ffsb_fs.h b/utils/ffsb-6.0-rc2/ffsb_fs.h
deleted file mode 100644
index e811fa8..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_fs.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FFSB_FS_H_
-#define _FFSB_FS_H_
-
-#include "filelist.h"
-#include "ffsb_op.h"
-#include "ffsb_tg.h"
-#include "ffsb_stats.h"
-
-/* These are the base names for the different file types on a
- * filesystem.
-*/
-#define FILES_BASE "data"
-#define META_BASE  "meta"
-#define AGE_BASE   "fill"
-
-struct ffsb_tg;
-
-typedef struct size_weight {
-	uint64_t size;
-	int weight;
-} size_weight_t;
-
-/* A filesystem object
- * --
- * represents a filesystem on disk, and maintains access to the different
- * directories within it.  Currently there are two directories created in
- * each filesystem: data and meta
- * "data" contains the aging files and the working set files
- * "meta" only contains directories for use in the metadata operation
- *
- * Aging
- * This object contains methods for aging the filesystem if needed
- * a properly set up threadgroup is supplied by the parser which is run
- * until the filesystem reaches the desired utilization
- *
- * Operations
- * The semantics of a ffsb operation are always such that they occur on
- * a filesystem, so the filesystem also hold operation specific data as
- * an opaque type
- * One example of how this is useful is the aging process, where a different
- * set of files is operated upon than in the regular benchmark and the
- * op_data is pointing to the "fill" set rather than the "files" set
- */
-
-typedef struct ffsb_fs {
-	char *basedir;
-
-	struct benchfiles files;
-	struct benchfiles meta;
-	struct benchfiles fill;
-
-	int flags;
-#define FFSB_FS_DIRECTIO   (1 << 0)
-#define FFSB_FS_ALIGNIO4K  (1 << 1)
-#define FFSB_FS_LIBCIO     (1 << 2)
-#define FFSB_FS_REUSE_FS   (1 << 3)
-
-	/* These pararmeters pertain to files in the files and fill
-	 * dirs.  Meta dir only contains directories, starting with 0.
-	 */
-	uint32_t num_dirs;
-	uint32_t num_start_files;
-	uint64_t minfilesize, maxfilesize;
-	double init_fsutil;
-	uint64_t init_size;
-
-	/* These two parameters specify the blocksize to use for
-	 * writes when creating and aging the fs.
-	 */
-	uint32_t create_blocksize, age_blocksize;
-#define FFSB_FS_DEFAULT_CREATE_BLOCKSIZE 4096
-#define FFSB_FS_DEFAULT_AGE_BLOCKSIZE    4096
-
-	double start_fsutil;
-
-	/* Aging data/parameters */
-	double desired_fsutil;
-	int age_fs;
-	uint32_t num_age_dirs;
-
-	/* Use an ffsb thread group to do the aging work */
-	struct ffsb_tg *aging_tg;
-
-	/* If a particular operation wants to maintain fs-specific
-	 * data, it should use this array.  Naturally, the ops must
-	 * synchonize access to the data for now, they are all just
-	 * putting pointers to a particular benchfiles struct here,
-	 * which is already sync'ed
-	 */
-	void *op_data[FFSB_NUMOPS];
-
-	/* per-fs stats */
-	ffsb_statsc_t fsc;
-	ffsb_statsd_t fsd;
-
-	size_weight_t *size_weights;
-	unsigned num_weights;
-	unsigned sum_weights;
-
-} ffsb_fs_t;
-
-/* Set up the structure, zeros everything out and dups the basedir
- * string
- */
-void init_ffsb_fs(ffsb_fs_t *fs, char *basedir, uint32_t num_data_dirs,
-		  uint32_t num_start_files, unsigned flags);
-
-/* Does not remove files/dirs on disk, only frees up data
- * structures
- */
-void destroy_ffsb_fs(ffsb_fs_t *fs);
-
-/* Set up the files and such on the disk including aging if requested.
- * Should call back into each op, which initialize its op_data[]
- * entry.  Aging is done by starting the aging_tg thread group, and
- * waiting until the desired utilization is achieved.  It can (and is)
- * be used with pthread_create().  Parameter should be a ffsb_fs_t * ,
- * and it will return the same type
- */
-void *construct_ffsb_fs(void *ffsb_fs_ptr);
-
-/* Shallow clone, original should simply be discarded (not destroyed).
- * Generally should only be used by parser to write into the config
- * object
- */
-void clone_ffsb_fs(ffsb_fs_t *target, ffsb_fs_t *original);
-
-void fs_print_config(ffsb_fs_t *fs);
-
-char *fs_get_basedir(ffsb_fs_t *fs);
-int fs_get_directio(ffsb_fs_t *fs);
-void fs_set_directio(ffsb_fs_t *fs, int dio);
-int fs_get_alignio(ffsb_fs_t *fs);
-void fs_set_alignio(ffsb_fs_t *fs, int aio);
-int fs_get_libcio(ffsb_fs_t *fs);
-void fs_set_libcio(ffsb_fs_t *fs, int lio);
-int fs_get_reuse_fs(ffsb_fs_t *fs);
-void fs_set_reuse_fs(ffsb_fs_t *fs, int rfs);
-
-struct benchfiles *fs_get_datafiles(ffsb_fs_t *fs);
-struct benchfiles *fs_get_metafiles(ffsb_fs_t *fs);
-struct benchfiles *fs_get_agefiles(ffsb_fs_t *fs);
-
-void fs_set_aging_tg(ffsb_fs_t *fs, struct ffsb_tg *, double util);
-struct ffsb_tg *fs_get_aging_tg(ffsb_fs_t *fs);
-int fs_get_agefs(ffsb_fs_t *fs);
-
-void fs_set_opdata(ffsb_fs_t *fs, void *data, unsigned opnum);
-void *fs_get_opdata(ffsb_fs_t *fs, unsigned opnum);
-void fs_set_min_filesize(ffsb_fs_t *fs, uint64_t size);
-void fs_set_max_filesize(ffsb_fs_t *fs, uint64_t size);
-void fs_set_create_blocksize(ffsb_fs_t *fs, uint32_t blocksize);
-void fs_set_age_blocksize(ffsb_fs_t *fs, uint32_t blocksize);
-uint32_t fs_get_create_blocksize(ffsb_fs_t *fs);
-uint32_t fs_get_age_blocksize(ffsb_fs_t *fs);
-uint64_t fs_get_min_filesize(ffsb_fs_t *fs);
-uint64_t fs_get_max_filesize(ffsb_fs_t *fs);
-uint32_t fs_get_numstartfiles(ffsb_fs_t *fs);
-uint32_t fs_get_numdirs(ffsb_fs_t *fs);
-
-double fs_get_desired_fsutil(ffsb_fs_t *fs);
-
-/* For these two, fs == NULL is OK */
-int fs_needs_stats(ffsb_fs_t *fs, syscall_t s);
-void fs_add_stat(ffsb_fs_t *fs, syscall_t sys, uint32_t val);
-
-#endif /* _FFSB_FS_H_ */
diff --git a/utils/ffsb-6.0-rc2/ffsb_op.c b/utils/ffsb-6.0-rc2/ffsb_op.c
deleted file mode 100644
index ba05fba..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_op.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "ffsb_op.h"
-#include "fileops.h"
-#include "metaops.h"
-
-ffsb_op_t ffsb_op_list[] = { {0, "read", ffsb_readfile, READ, fop_bench, NULL}
-,
-{1, "readall", ffsb_readall, READ, fop_bench, NULL}
-,
-{2, "write", ffsb_writefile, WRITE, fop_bench, NULL}
-,
-{3, "create", ffsb_createfile, WRITE, fop_bench, fop_age}
-,
-{4, "append", ffsb_appendfile, WRITE, fop_bench, fop_age}
-,
-{5, "delete", ffsb_deletefile, NA, fop_bench, fop_age}
-,
-{6, "metaop", ffsb_metaops, NA, metaops_metadir, NULL}
-,
-{7, "createdir", ffsb_createdir, NA, fop_bench, NULL}
-,
-{8, "stat", ffsb_stat, NA, fop_bench, NULL}
-,
-{9, "writeall", ffsb_writeall, WRITE, fop_bench, NULL}
-,
-{10, "writeall_fsync", ffsb_writeall_fsync, WRITE, fop_bench, NULL}
-,
-{11, "open_close", ffsb_open_close, NA, fop_bench, NULL}
-,
-{12, "write_fsync", ffsb_writefile_fsync, WRITE, fop_bench, NULL}
-,
-{13, "create_fsync", ffsb_createfile_fsync, WRITE, fop_bench, fop_age}
-,
-{14, "append_fsync", ffsb_appendfile_fsync, WRITE, fop_bench, fop_age}
-,
-};
-
-void init_ffsb_op_results(ffsb_op_results_t * results)
-{
-	memset(results, 0, sizeof(ffsb_op_results_t));
-}
-
-static int exclusive_op(ffsb_op_results_t * results, unsigned int op_num)
-{
-	int i;
-	int ret = 0;
-	for (i = 0; i < FFSB_NUMOPS; i++) {
-		if (i == op_num)
-			continue;
-		ret += results->ops[i];
-	}
-
-	if (ret)
-		return 0;
-	return 1;
-}
-
-static void generic_op_print(char *name, unsigned num, double op_pcnt,
-			     double weigth_pcnt, double runtime, char *tput)
-{
-	printf("%20s : %12u\t%10.2lf\t%6.3lf%%\t\t%6.3lf%%\t  %11s\n",
-	       name, num, num / runtime, op_pcnt, weigth_pcnt, tput);
-}
-
-static void print_op_results(unsigned int op_num, ffsb_op_results_t * results,
-			     double runtime, unsigned total_ops,
-			     unsigned total_weight)
-{
-	char buf[256];
-
-	double op_pcnt = 100 * (double)results->ops[op_num] / (double)total_ops;
-	double weight_pcnt = 100 * (double)results->op_weight[op_num] /
-	    (double)total_weight;
-	if (ffsb_op_list[op_num].throughput) {
-		ffsb_printsize(buf, results->bytes[op_num] / runtime, 256);
-		sprintf(buf, "%s/sec\0", buf);
-	} else
-		sprintf(buf, "NA\0");
-	generic_op_print(ffsb_op_list[op_num].op_name, results->ops[op_num],
-			 op_pcnt, weight_pcnt, runtime, buf);
-}
-
-#if 0
-static void print_op_throughput(unsigned int op_num,
-				ffsb_op_results_t * results, double runtime)
-{
-	if (ffsb_op_list[op_num].op_exl_print_fn != NULL)
-		ffsb_op_list[op_num].op_exl_print_fn(results, runtime, op_num);
-}
-#endif
-
-void print_results(struct ffsb_op_results *results, double runtime)
-{
-	int i;
-	uint64_t total_ops = 0;
-	uint64_t total_weight = 0;
-	char buf[256];
-
-	for (i = 0; i < FFSB_NUMOPS; i++) {
-		total_ops += results->ops[i];
-		total_weight += results->op_weight[i];
-	}
-
-	printf
-	    ("             Op Name   Transactions\t Trans/sec\t% Trans\t    % Op Weight\t   Throughput\n");
-	printf
-	    ("             =======   ============\t =========\t=======\t    ===========\t   ==========\n");
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		if (results->ops[i] != 0)
-			print_op_results(i, results, runtime, total_ops,
-					 total_weight);
-	printf("-\n%.2lf Transactions per Second\n\n",
-	       (double)total_ops / runtime);
-
-	if (results->write_bytes || results->read_bytes)
-		printf("Throughput Results\n===================\n");
-	if (results->read_bytes) {
-		ffsb_printsize(buf, results->read_bytes / runtime, 256);
-		printf("Read Throughput: %s/sec\n", buf);
-	}
-	if (results->write_bytes) {
-		ffsb_printsize(buf, results->write_bytes / runtime, 256);
-		printf("Write Throughput: %s/sec\n", buf);
-	}
-}
-
-char *op_get_name(int opnum)
-{
-	return ffsb_op_list[opnum].op_name;
-}
-
-void ops_setup_bench(ffsb_fs_t * fs)
-{
-	int i;
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		ffsb_op_list[i].op_bench(fs, i);
-}
-
-void ops_setup_age(ffsb_fs_t * fs)
-{
-	int i;
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		if (ffsb_op_list[i].op_age)
-			ffsb_op_list[i].op_age(fs, i);
-}
-
-int ops_find_op(char *opname)
-{
-	int i;
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		if (!strcmp(opname, ffsb_op_list[i].op_name))
-			return i;
-	return -1;
-}
-
-void add_results(struct ffsb_op_results *target, struct ffsb_op_results *src)
-{
-	int i;
-	target->read_bytes += src->read_bytes;
-	target->write_bytes += src->write_bytes;
-
-	for (i = 0; i < FFSB_NUMOPS; i++) {
-		target->ops[i] += src->ops[i];
-		target->op_weight[i] += src->op_weight[i];
-		target->bytes[i] += src->bytes[i];
-	}
-}
-
-void do_op(struct ffsb_thread *ft, struct ffsb_fs *fs, unsigned op_num)
-{
-	ffsb_op_list[op_num].op_fn(ft, fs, op_num);
-}
diff --git a/utils/ffsb-6.0-rc2/ffsb_op.h b/utils/ffsb-6.0-rc2/ffsb_op.h
deleted file mode 100644
index a0064a5..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_op.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FFSB_OP_H_
-#define _FFSB_OP_H_
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-struct ffsb_op_results;
-struct ffsb_thread;
-struct ffsb_fs;
-
-#define NA 0x00
-#define READ 0x01
-#define WRITE 0x02
-
-/* This file handles all of the operations FFSB supports.  It has
- * tight interactions with the filesystem objects, but is otherwise
- * pretty abstract.
- */
-
-/* The op callback */
-typedef void (*ffsb_op_fn)(struct ffsb_thread *, struct ffsb_fs *,
-			     unsigned op_num);
-
-/* Operation results printing function */
-typedef void (*ffsb_op_print_fn)(struct ffsb_op_results *, double secs,
-				  unsigned int op_num);
-
-/* Operation specific initialization for a filesystem */
-typedef void (*ffsb_op_fs_fn)(struct ffsb_fs *, unsigned opnum);
-
-typedef struct ffsb_op {
-	unsigned int op_id;
-	char *op_name;
-	ffsb_op_fn op_fn;
-
-	unsigned int throughput;
-	/* The point of these two fields is to determine which set of
-	 * files are being worked on.  Currently either data, meta, or
-	 * aging.  Data and meta are mutually exclusive, so we only
-	 * need two funcs.
-	 */
-	ffsb_op_fs_fn op_bench;
-	ffsb_op_fs_fn op_age;
-} ffsb_op_t;
-
-/* List of all operations, located in ffsb_op.c */
-extern ffsb_op_t ffsb_op_list[];
-
-/* This *must* be updated when a new operation is added or one is
- * removed several other structures use it for statically sized arrays
- */
-#define FFSB_NUMOPS (15)
-
-/* Returns index of an op.
- * Returns -1 if opname isn't found, and its case sensitive :)
- */
-int ops_find_op(char *opname);
-
-typedef struct ffsb_op_results {
-	/* Count of how many times each op was run */
-	unsigned int ops[FFSB_NUMOPS];
-	unsigned int op_weight[FFSB_NUMOPS];
-	uint64_t bytes[FFSB_NUMOPS];
-
-	uint64_t read_bytes;
-	uint64_t write_bytes;
-} ffsb_op_results_t;
-
-void init_ffsb_op_results(struct ffsb_op_results *);
-void print_results(struct ffsb_op_results *results, double runtime);
-char *op_get_name(int opnum);
-
-/* Setup the ops for the benchmark */
-void ops_setup_bench(struct ffsb_fs *fs);
-
-/* setup the ops for aging the filesystem */
-void ops_setup_age(struct ffsb_fs *fs);
-
-void add_results(struct ffsb_op_results *target, struct ffsb_op_results *src);
-
-/* Run this op, using this thread state, on this filesystem */
-void do_op(struct ffsb_thread *ft, struct ffsb_fs *fs, unsigned op_num);
-
-#endif /* _FFSB_OP_H_ */
diff --git a/utils/ffsb-6.0-rc2/ffsb_stats.c b/utils/ffsb-6.0-rc2/ffsb_stats.c
deleted file mode 100644
index 2b3a3be..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_stats.c
+++ /dev/null
@@ -1,240 +0,0 @@
-#include <stdio.h>
-#include <assert.h>
-#include <limits.h>
-#include "ffsb_stats.h"
-#include "util.h"
-
-char *syscall_names[] = {
-	"open",
-	"read",
-	"write",
-	"create",
-	"lseek",
-	"unlink",
-	"close",
-	"stat",
-};
-
-/* yuck, just for the parser anyway.. */
-int ffsb_stats_str2syscall(char *str, syscall_t * sys)
-{
-	int i;
-	int ret;
-	for (i = 0; i < FFSB_NUM_SYSCALLS; i++) {
-		ret = strncasecmp(syscall_names[i], str,
-				  strlen(syscall_names[i]));
-		/* printf("%s = syscall_names[%d] vs %str ret = %d\n",
-		 * syscall_names[i],i,str,ret);
-		 */
-		if (0 == ret) {
-			*sys = (syscall_t) i;	/* ewww */
-			/* printf("matched syscall %s\n",syscall_names[i]); */
-			return 1;
-		}
-	}
-	printf("warning: failed to get match for syscall %s\n", str);
-	return 0;
-}
-
-void ffsb_statsc_init(ffsb_statsc_t * fsc)
-{
-	fsc->num_buckets = 0;
-	fsc->buckets = NULL;
-	fsc->ignore_stats = 0;
-}
-
-void ffsb_statsc_addbucket(ffsb_statsc_t * fsc, uint32_t min, uint32_t max)
-{
-	struct stat_bucket *temp;
-	fsc->num_buckets++;
-
-	/* printf("ffsb_realloc(): fsc_buckets = %d\n",fsc->num_buckets); */
-	temp = ffsb_realloc(fsc->buckets, sizeof(struct stat_bucket) *
-			    fsc->num_buckets);
-
-	fsc->buckets = temp;
-
-	/* Convert to micro-secs from milli-secs */
-	fsc->buckets[fsc->num_buckets - 1].min = min;
-	fsc->buckets[fsc->num_buckets - 1].max = max;
-}
-
-void ffsb_statsc_destroy(ffsb_statsc_t * fsc)
-{
-	free(fsc->buckets);
-}
-
-void ffsb_statsc_ignore_sys(ffsb_statsc_t * fsc, syscall_t s)
-{
-	/* printf("fsis: oring 0x%x with 0x%x\n",
-	 *      fsc->ignore_stats,
-	 *      (1 << s ) );
-	 */
-	fsc->ignore_stats |= (1 << s);
-}
-
-int fsc_ignore_sys(ffsb_statsc_t * fsc, syscall_t s)
-{
-	return fsc->ignore_stats & (1 << s);
-}
-
-void ffsb_statsd_init(ffsb_statsd_t * fsd, ffsb_statsc_t * fsc)
-{
-	int i;
-	memset(fsd, 0, sizeof(*fsd));
-
-	for (i = 0; i < FFSB_NUM_SYSCALLS; i++) {
-		fsd->totals[i] = 0;
-		fsd->mins[i] = UINT_MAX;
-		fsd->maxs[i] = 0;
-		fsd->buckets[i] = ffsb_malloc(sizeof(uint32_t) *
-					      fsc->num_buckets);
-		assert(fsd->buckets[i] != NULL);
-
-		memset(fsd->buckets[i], 0, sizeof(uint32_t) * fsc->num_buckets);
-	}
-	fsd->config = fsc;
-}
-
-void ffsb_statsd_destroy(ffsb_statsd_t * fsd)
-{
-	int i;
-	for (i = 0; i < FFSB_NUM_SYSCALLS; i++)
-		free(fsd->buckets[i]);
-}
-
-void ffsb_add_data(ffsb_statsd_t * fsd, syscall_t s, uint32_t value)
-{
-	unsigned num_buckets, i;
-	struct stat_bucket *bucket_defs;
-
-	if (!fsd || fsc_ignore_sys(fsd->config, s))
-		return;
-
-	if (value < fsd->mins[s])
-		fsd->mins[s] = value;
-	if (value > fsd->maxs[s])
-		fsd->maxs[s] = value;
-
-	fsd->counts[s]++;
-	fsd->totals[s] += value;
-
-	if (fsd->config->num_buckets == 0)
-		return;
-
-	num_buckets = fsd->config->num_buckets;
-	bucket_defs = fsd->config->buckets;
-
-	for (i = 0; i < num_buckets; i++) {
-		struct stat_bucket *b = &bucket_defs[i];
-
-		if (value <= b->max && value >= b->min) {
-			fsd->buckets[s][i]++;
-			break;
-		}
-	}
-}
-
-void ffsb_statsc_copy(ffsb_statsc_t * dest, ffsb_statsc_t * src)
-{
-	memcpy(dest, src, sizeof(*src));
-}
-
-void ffsb_statsd_add(ffsb_statsd_t * dest, ffsb_statsd_t * src)
-{
-	int i, j;
-	unsigned num_buckets;
-	if (dest->config != src->config)
-		printf("ffsb_statsd_add: warning configs do not"
-		       "match for data being collected\n");
-
-	num_buckets = dest->config->num_buckets;
-
-	for (i = 0; i < FFSB_NUM_SYSCALLS; i++) {
-		dest->counts[i] += src->counts[i];
-		dest->totals[i] += src->totals[i];
-
-		if (src->mins[i] < dest->mins[i])
-			dest->mins[i] = src->mins[i];
-		if (src->maxs[i] > dest->maxs[i])
-			dest->maxs[i] = src->maxs[i];
-
-		for (j = 0; j < num_buckets; j++)
-			dest->buckets[i][j] += src->buckets[i][j];
-	}
-}
-
-static void print_buckets_helper(ffsb_statsc_t * fsc, uint32_t * buckets)
-{
-	int i;
-	if (fsc->num_buckets == 0) {
-		printf("   -\n");
-		return;
-	}
-	for (i = 0; i < fsc->num_buckets; i++) {
-		struct stat_bucket *sb = &fsc->buckets[i];
-		printf("\t\t msec_range[%d]\t%f - %f : %8u\n",
-		       i, (double)sb->min / 1000.0f, (double)sb->max / 1000.0f,
-		       buckets[i]);
-	}
-	printf("\n");
-}
-
-void ffsb_statsd_print(ffsb_statsd_t * fsd)
-{
-	int i;
-	printf("\nSystem Call Latency statistics in millisecs\n" "=====\n");
-	printf("\t\tMin\t\tAvg\t\tMax\t\tTotal Calls\n");
-	printf("\t\t========\t========\t========\t============\n");
-	for (i = 0; i < FFSB_NUM_SYSCALLS; i++)
-		if (fsd->counts[i]) {
-			printf("[%7s]\t%05f\t%05lf\t%05f\t%12u\n",
-			       syscall_names[i], (float)fsd->mins[i] / 1000.0f,
-			       (fsd->totals[i] / (1000.0f *
-						  (double)fsd->counts[i])),
-			       (float)fsd->maxs[i] / 1000.0f, fsd->counts[i]);
-			print_buckets_helper(fsd->config, fsd->buckets[i]);
-		}
-}
-
-#if 0				/* Testing */
-
-void *ffsb_malloc(size_t s)
-{
-	void *p = malloc(s);
-	assert(p != NULL);
-	return p;
-}
-
-int main(int arc, char *argv[])
-{
-	ffsb_statsc_t fsc;
-	ffsb_statsd_t fsd;
-	int i;
-
-	printf("init\n");
-
-	ffsb_statsc_init(&fsc, 10);
-	ffsb_statsc_setbucket(&fsc, 0, 0.0f, 50.0f);
-	ffsb_statsc_setbucket(&fsc, 1, 50.0f, 10000.0f);
-	ffsb_statsc_setbucket(&fsc, 2, 0.1f, 0.2f);
-	ffsb_statsc_setbucket(&fsc, 3, 0.0f, 50.0f);
-	ffsb_statsc_setbucket(&fsc, 4, 50.0f, 10000.0f);
-	ffsb_statsc_setbucket(&fsc, 5, 0.1f, 0.2f);
-	ffsb_statsc_setbucket(&fsc, 6, 0.0f, 50.0f);
-	ffsb_statsc_setbucket(&fsc, 7, 50.0f, 10000.0f);
-	ffsb_statsc_setbucket(&fsc, 8, 0.1f, 0.2f);
-	ffsb_statsc_setbucket(&fsc, 9, 50.0f, 10000.0f);
-	ffsb_statsd_init(&fsd, &fsc);
-
-	printf("test\n");
-	for (i = 0; i < 50000000; i++)
-		ffsb_add_data(&fsd, SYS_READ, (float)i);
-
-	printf("cleanup\n");
-	ffsb_statsd_destroy(&fsd);
-	ffsb_statsc_destroy(&fsc);
-	return 0;
-}
-
-#endif /* Testing */
diff --git a/utils/ffsb-6.0-rc2/ffsb_stats.h b/utils/ffsb-6.0-rc2/ffsb_stats.h
deleted file mode 100644
index 616e12e..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_stats.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2007
- *
- *   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
- */
-#ifndef _FFSB_STATS_H_
-#define _FFSB_STATS_H_
-
-#include <inttypes.h>
-
-/* Latency statistics collection extension.
- *
- * For now, we are going to collect latency info on each (most)
- * syscalls using gettimeofday. Unfortunately, it is the
- * responsibility of each operation to collect this timing info.  We
- * try to make this easier by providing a function that does the
- * timing for supported syscalls.
- *
- * We want the ability to collect the average latency for a particular
- * call, and also to collect latency info for user specified intervals
- * -- called "buckets"
- */
-
-struct stat_bucket {
-	uint32_t min;
-	uint32_t max;
-	/* max = 0 indicates uninitialized bucket */
-};
-
-/* These are all the syscalls we currently support */
-typedef enum { SYS_OPEN = 0,
-	       SYS_READ,
-	       SYS_WRITE,
-	       SYS_CREATE,
-	       SYS_LSEEK,
-	       SYS_UNLINK,
-	       SYS_CLOSE,
-	       SYS_STAT
-} syscall_t;
-
-/* ASCII versions of the syscall names */
-extern char *syscall_names[];
-
-/* Return 1 on success, 0 on error */
-int ffsb_stats_str2syscall(char *, syscall_t *);
-
-/* Keep it in sync with syscall_t */
-#define FFSB_NUM_SYSCALLS (8UL)
-
-/* What stats to collect, shared among all threads  */
-typedef struct ffsb_stats_config {
-	unsigned num_buckets;
-	struct stat_bucket *buckets;
-
-	/* Ignore stats collection for some syscalls.
-	 * Each bit corresponds to one syscall.
-	 */
-	uint32_t ignore_stats;
-} ffsb_statsc_t;
-
-void ffsb_statsc_init(ffsb_statsc_t *);
-void ffsb_statsc_addbucket(ffsb_statsc_t *, uint32_t min, uint32_t max);
-void ffsb_statsc_ignore_sys(ffsb_statsc_t *, syscall_t s);
-void ffsb_statsc_destroy(ffsb_statsc_t *);
-
-/* If we are collecting stats, then the config field is non-NULL */
-typedef struct ffsb_stats_data {
-	ffsb_statsc_t *config;
-	uint32_t counts[FFSB_NUM_SYSCALLS];
-	uint64_t totals[FFSB_NUM_SYSCALLS]; /* cumulative sums */
-	uint64_t mins[FFSB_NUM_SYSCALLS];
-	uint64_t maxs[FFSB_NUM_SYSCALLS];
-	uint32_t *buckets[FFSB_NUM_SYSCALLS]; /* bucket counters */
-} ffsb_statsd_t ;
-
-/* constructor/destructor */
-void ffsb_statsd_init(ffsb_statsd_t *, ffsb_statsc_t *);
-void ffsb_statsd_destroy(ffsb_statsd_t *);
-
-/* Add data to a stats data struct.  Value should be in microsecs
- * _NOT_ milli-secs
- */
-void ffsb_add_data(ffsb_statsd_t *, syscall_t, uint32_t);
-
-/* Make a copy of a stats config */
-void ffsb_statsc_copy(ffsb_statsc_t *, ffsb_statsc_t *);
-
-/* Add two statsd structs together */
-void ffsb_statsd_add(ffsb_statsd_t *, ffsb_statsd_t *);
-
-/* Print out statsd structure */
-void ffsb_statsd_print(ffsb_statsd_t *fsd);
-
-/* Do we want stats for the specified syscall */
-int fsc_ignore_sys(ffsb_statsc_t *fsc, syscall_t s);
-
-#endif /* _FFSB_STATS_H_ */
diff --git a/utils/ffsb-6.0-rc2/ffsb_tg.c b/utils/ffsb-6.0-rc2/ffsb_tg.c
deleted file mode 100644
index 881f32d..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_tg.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-#include <pthread.h>
-
-#include "ffsb_tg.h"
-#include "util.h"
-
-void init_ffsb_tg(ffsb_tg_t * tg, unsigned num_threads, unsigned tg_num)
-{
-	int i;
-	memset(tg, 0, sizeof(ffsb_tg_t));
-
-	tg->threads = ffsb_malloc(sizeof(ffsb_thread_t) * num_threads);
-	tg->tg_num = tg_num;
-	tg->num_threads = num_threads;
-
-	tg->bindfs = -1;	/* default is not bound */
-
-	tg->thread_bufsize = 0;
-	for (i = 0; i < num_threads; i++)
-		init_ffsb_thread(tg->threads + i, tg, 0, tg_num, i);
-}
-
-void destroy_ffsb_tg(ffsb_tg_t * tg)
-{
-	int i;
-	for (i = 0; i < tg->num_threads; i++)
-		destroy_ffsb_thread(tg->threads + i);
-	free(tg->threads);
-	if (tg_needs_stats(tg))
-		ffsb_statsc_destroy(&tg->fsc);
-}
-
-void *tg_run(void *data)
-{
-	tg_run_params_t *params = (tg_run_params_t *) data;
-	ffsb_tg_t *tg = params->tg;
-	int i;
-	pthread_attr_t attr;
-
-	pthread_attr_init(&attr);
-	pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-
-	tg->start_barrier = params->thread_barrier;
-
-	/* Sum up the weights for use later by tg_get_op() */
-	tg->sum_weights = 0;
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		tg->sum_weights += tg->op_weights[i];
-
-	tg->fc = params->fc;
-	tg->flagval = -1;
-	tg->stopval = 1;
-
-	/* spawn threads */
-	for (i = 0; i < tg->num_threads; i++) {
-		ffsb_thread_t *ft = &tg->threads[i];
-		pthread_create(&ft->ptid, &attr, ft_run, ft);
-	}
-
-	if (params->tg_barrier)
-		ffsb_barrier_wait(params->tg_barrier);
-
-	/* wait for termination condition to be true */
-	do {
-		ffsb_sleep(params->wait_time);
-	} while (params->poll_fn(params->poll_data) == 0);
-
-	/* set flag value */
-	tg->flagval = tg->stopval;
-
-	/* wait on theads to finish */
-	for (i = 0; i < tg->num_threads; i++)
-		pthread_join(tg->threads[i].ptid, NULL);
-
-	return NULL;
-}
-
-/* Needs to set params->opnum and params->fs */
-void tg_get_op(ffsb_tg_t * tg, randdata_t * rd, tg_op_params_t * params)
-{
-	unsigned curop;
-	int num;
-	int fsnum;
-
-	num = 1 + getrandom(rd, tg->sum_weights);
-	curop = 0;
-
-	while (tg->op_weights[curop] < num) {
-		num -= tg->op_weights[curop];
-		curop++;
-	}
-
-	params->opnum = curop;
-
-	/* If we're bound to a particular filesystem, use that,
-	 * otherwise, pick one at random.
-	 */
-	fsnum = tg->bindfs;
-	if (fsnum < 0)
-		fsnum = getrandom(rd, tg->fc->num_filesys);
-
-	params->fs = fc_get_fs(tg->fc, fsnum);
-}
-
-void tg_set_op_weight(ffsb_tg_t * tg, char *opname, unsigned weight)
-{
-	int opnum = ops_find_op(opname);
-	assert(opnum >= 0);
-	tg->op_weights[opnum] = weight;
-}
-
-unsigned tg_get_op_weight(ffsb_tg_t * tg, char *opname)
-{
-	int opnum = ops_find_op(opname);
-	assert(opnum >= 0);
-	return tg->op_weights[opnum];
-}
-
-void tg_set_bindfs(ffsb_tg_t * tg, int fsnum)
-{
-	tg->bindfs = fsnum;
-}
-
-int tg_get_bindfs(ffsb_tg_t * tg)
-{
-	return tg->bindfs;
-}
-
-unsigned tg_get_numthreads(ffsb_tg_t * tg)
-{
-	return tg->num_threads;
-}
-
-static void update_bufsize(ffsb_tg_t * tg)
-{
-	int i;
-	uint32_t newmax = max(tg->read_blocksize, tg->write_blocksize);
-
-	if (newmax == max(newmax, tg->thread_bufsize))
-		for (i = 0; i < tg->num_threads; i++)
-			ft_alter_bufsize(tg->threads + i, newmax);
-}
-
-void tg_set_read_random(ffsb_tg_t * tg, int rr)
-{
-	tg->read_random = rr;
-}
-
-void tg_set_write_random(ffsb_tg_t * tg, int wr)
-{
-	tg->write_random = wr;
-}
-
-void tg_set_fsync_file(ffsb_tg_t * tg, int fsync)
-{
-	tg->fsync_file = fsync;
-}
-
-void tg_set_read_size(ffsb_tg_t * tg, uint64_t rs)
-{
-	tg->read_size = rs;
-}
-
-void tg_set_read_blocksize(ffsb_tg_t * tg, uint32_t rs)
-{
-	tg->read_blocksize = rs;
-	update_bufsize(tg);
-}
-
-void tg_set_read_skip(ffsb_tg_t * tg, int rs)
-{
-	tg->read_skip = rs;
-}
-
-void tg_set_read_skipsize(ffsb_tg_t * tg, uint32_t rs)
-{
-	tg->read_skipsize = rs;
-}
-
-void tg_set_write_size(ffsb_tg_t * tg, uint64_t ws)
-{
-	tg->write_size = ws;
-}
-
-void tg_set_write_blocksize(ffsb_tg_t * tg, uint32_t ws)
-{
-	tg->write_blocksize = ws;
-	update_bufsize(tg);
-}
-
-int tg_get_read_random(ffsb_tg_t * tg)
-{
-	return tg->read_random;
-}
-
-int tg_get_write_random(ffsb_tg_t * tg)
-{
-	return tg->write_random;
-}
-
-int tg_get_fsync_file(ffsb_tg_t * tg)
-{
-	return tg->fsync_file;
-}
-
-uint64_t tg_get_read_size(ffsb_tg_t * tg)
-{
-	return tg->read_size;
-}
-
-uint32_t tg_get_read_blocksize(ffsb_tg_t * tg)
-{
-	return tg->read_blocksize;
-}
-
-int tg_get_read_skip(ffsb_tg_t * tg)
-{
-	return tg->read_skip;
-}
-
-uint32_t tg_get_read_skipsize(ffsb_tg_t * tg)
-{
-	return tg->read_skipsize;
-}
-
-uint64_t tg_get_write_size(ffsb_tg_t * tg)
-{
-	return tg->write_size;
-}
-
-uint32_t tg_get_write_blocksize(ffsb_tg_t * tg)
-{
-	return tg->write_blocksize;
-}
-
-int tg_get_stopval(ffsb_tg_t * tg)
-{
-	return tg->stopval;
-}
-
-ffsb_barrier_t *tg_get_start_barrier(ffsb_tg_t * tg)
-{
-	return tg->start_barrier;
-}
-
-static void tg_print_config_helper(ffsb_tg_t * tg)
-{
-	int i;
-	int sumweights = 0;
-	char buf[256];
-
-	printf("\t num_threads      = %d\n", tg->num_threads);
-	printf("\t\n");
-	printf("\t read_random      = %s\n", (tg->read_random) ? "on" : "off");
-	printf("\t read_size        = %llu\t(%s)\n", tg->read_size,
-	       ffsb_printsize(buf, tg->read_size, 256));
-	printf("\t read_blocksize   = %u\t(%s)\n", tg->read_blocksize,
-	       ffsb_printsize(buf, tg->read_blocksize, 256));
-	printf("\t read_skip        = %s\n", (tg->read_skip) ? "on" : "off");
-	printf("\t read_skipsize    = %u\t(%s)\n", tg->read_skipsize,
-	       ffsb_printsize(buf, tg->read_skipsize, 256));
-	printf("\t\n");
-	printf("\t write_random     = %s\n", (tg->write_random) ? "on" : "off");
-	printf("\t write_size       = %llu\t(%s)\n", tg->write_size,
-	       ffsb_printsize(buf, tg->write_size, 256));
-	printf("\t fsync_file       = %d\n", tg->fsync_file);
-	printf("\t write_blocksize  = %u\t(%s)\n", tg->write_blocksize,
-	       ffsb_printsize(buf, tg->write_blocksize, 256));
-	printf("\t wait time        = %u\n", tg->wait_time);
-	if (tg->bindfs >= 0) {
-		printf("\t\n");
-		printf("\t bound to fs %d\n", tg->bindfs);
-	}
-	printf("\t\n");
-	printf("\t op weights\n");
-
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		sumweights += tg->op_weights[i];
-
-	for (i = 0; i < FFSB_NUMOPS; i++)
-		printf("\t %20s = %d (%.2f%%)\n", op_get_name(i),
-		       tg->op_weights[i], 100 * (float)tg->op_weights[i] /
-		       (float)sumweights);
-	printf("\t\n");
-}
-
-void tg_print_config(ffsb_tg_t * tg)
-{
-	printf("ThreadGroup %d\n", tg->tg_num);
-	printf("================\n");
-	tg_print_config_helper(tg);
-}
-
-void tg_print_config_aging(ffsb_tg_t * tg, char *fsname)
-{
-	printf("\t Aging ThreadGroup for fs %s\n", fsname);
-	printf("\t ================\n");
-	tg_print_config_helper(tg);
-}
-
-void tg_collect_results(ffsb_tg_t * tg, ffsb_op_results_t * r)
-{
-	int i;
-	for (i = 0; i < tg_get_numthreads(tg); i++)
-		add_results(r, ft_get_results(tg->threads + i));
-}
-
-void tg_set_waittime(ffsb_tg_t * tg, unsigned time)
-{
-	tg->wait_time = time;
-}
-
-unsigned tg_get_waittime(ffsb_tg_t * tg)
-{
-	return tg->wait_time;
-}
-
-int tg_get_flagval(ffsb_tg_t * tg)
-{
-	return tg->flagval;
-}
-
-void tg_set_statsc(ffsb_tg_t * tg, ffsb_statsc_t * fsc)
-{
-	if (fsc) {
-		int i;
-
-		tg->need_stats = 1;
-		ffsb_statsc_copy(&tg->fsc, fsc);
-
-		for (i = 0; i < tg->num_threads; i++)
-			ft_set_statsc(tg->threads + i, &tg->fsc);
-	}
-}
-
-void tg_collect_stats(ffsb_tg_t * tg, ffsb_statsd_t * fsd)
-{
-	int i;
-
-	assert(tg->need_stats);
-	ffsb_statsd_init(fsd, &tg->fsc);
-
-	for (i = 0; i < tg_get_numthreads(tg); i++)
-		ffsb_statsd_add(fsd, ft_get_stats_data(tg->threads + i));
-}
-
-int tg_needs_stats(ffsb_tg_t * tg)
-{
-	return tg->need_stats;
-}
diff --git a/utils/ffsb-6.0-rc2/ffsb_tg.h b/utils/ffsb-6.0-rc2/ffsb_tg.h
deleted file mode 100644
index 0f915b0..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_tg.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FFSB_TG_H_
-#define _FFSB_TG_H_
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-#include <pthread.h>
-
-#include "ffsb.h"
-#include "ffsb_op.h"
-#include "ffsb_thread.h"
-#include "ffsb_fs.h"
-#include "ffsb_stats.h"
-
-#include "util.h" /* for barrier obj */
-
-/* "Thread Group" object defs.
- *
- *  A thread group contains configuration information and can run its
- *  "gang" of threads performing a particular mix of operations.
- *
- * The thread group is responsible for creating the ffsb_thread
- * objects which must ask the thread group object to select an
- * operation and a filesystem to run that operation on.  The thread
- * objects don't contain any of the configuration information.
- *
- * Thread groups are also abstracted so they can be "run" arbitrarily
- * which is useful because we can reuse them for aging.  The running
- * is a bit complex, the thread group has to have a callback function
- * which is runs at a specified interval to determine when to
- * terminate.
- *
- * To synchronize starting across many thread groups there are two
- * barriers used, the first one "tg_barrier" in the run_params is to
- * synchronize multiple thread-groups being ready to start, meaning
- * that all their threads have been spawned The second one
- * "thread_barrier" synchronizes all threads across multiple thread
- * groups, so that they all start at once.
-*/
-
-struct ffsb_thread;
-struct ffsb_config;
-
-typedef struct ffsb_tg {
-	unsigned tg_num;
-	unsigned num_threads;
-	unsigned op_weights[FFSB_NUMOPS];
-	struct ffsb_thread *threads;
-
-	/* A threadgroup can be bound to just one filesystem.
-	 * A value * < 0 , means we aren't bound to any.
-	*/
-	int bindfs;
-
-	int read_random;	/* boolean */
-	uint64_t read_size;
-	uint32_t read_blocksize;
-
-	int read_skip;		/* boolean */
-	uint32_t read_skipsize;
-
-	int write_random;	/* boolean */
-	uint64_t write_size;
-	uint32_t write_blocksize;
-
-	int fsync_file;		/* boolean */
-
-	/* Should be max(write_blocksize, read_blocksize) */
-	uint32_t thread_bufsize;
-
-	/* these fields are calculated/set by tg_run() */
-	unsigned sum_weights;
-	struct ffsb_config *fc;
-	ffsb_barrier_t *start_barrier;
-
-	/* Used for stopping the threads */
-	int flagval;
-	int stopval;
-
-	/* Delay between every operation, in milliseconds*/
-	unsigned wait_time;
-
-	/* stats configuration */
-	int need_stats;
-	ffsb_statsc_t fsc;
-} ffsb_tg_t;
-
-/* Init should be the very first thing called on the tg.  After that,
- * the user can call the set methods and finally run.
- */
-void init_ffsb_tg(ffsb_tg_t *tg, unsigned num_threads, unsigned tg_num);
-void destroy_ffsb_tg(ffsb_tg_t *tg);
-
-/* Parameters needed to fire off a thread group.  The main thread will
- * evaluate poll_fn(poll_data) until it gets a nonzero return value.
- * It will sleep for wait_time secs between calls The ffsb_config
- * struct is needed for fs selection.  Barriers are to synchronize
- * multiple tgs and all threads pt is for pthread_create()
- */
-typedef struct tg_run_params {
-	ffsb_tg_t *tg;
-	int (*poll_fn)(void *);
-	void *poll_data;
-	unsigned wait_time; /* in sec */
-	struct ffsb_config *fc;
-	ffsb_barrier_t *tg_barrier;
-
-	/* Should be initialized by caller to tg_run() */
-	ffsb_barrier_t *thread_barrier;
-	pthread_t  pt;
-} tg_run_params_t;
-
-/* This function is meant to be called as a parameter to
- * pthread_create()
- */
-void *tg_run(void *);
-
-void tg_print_config(ffsb_tg_t *tg);
-void tg_print_config_aging(ffsb_tg_t *tg, char *fsname);
-
-/* Adds all of this tg's results to res */
-void tg_collect_results(ffsb_tg_t *tg, ffsb_op_results_t *res);
-
-/* Adds up all this tg's stats to totals */
-void tg_collect_stats(ffsb_tg_t *tg, ffsb_statsd_t *totals);
-
-/* getters/setters, setters should not be called after a run has begun */
-
-void tg_set_statsc(ffsb_tg_t *tg, ffsb_statsc_t *fsc);
-
-void tg_set_bindfs(ffsb_tg_t *tg, int fsnum);
-int  tg_get_bindfs(ffsb_tg_t *tg);
-
-unsigned tg_get_numthreads(ffsb_tg_t *tg);
-
-void tg_set_op_weight(ffsb_tg_t *tg, char *opname, unsigned weight);
-unsigned tg_get_op_weight(ffsb_tg_t *tg, char *opname);
-
-void tg_set_read_random(ffsb_tg_t *tg, int rr);
-void tg_set_write_random(ffsb_tg_t *tg, int wr);
-void tg_set_fsync_file(ffsb_tg_t *tg, int fsync);
-
-int tg_get_read_random(ffsb_tg_t *tg);
-int tg_get_write_random(ffsb_tg_t *tg);
-int tg_get_fsync_file(ffsb_tg_t *tg);
-
-void tg_set_read_size(ffsb_tg_t *tg, uint64_t rs);
-void tg_set_read_blocksize(ffsb_tg_t *tg, uint32_t rs);
-
-void tg_set_read_skipsize(ffsb_tg_t *tg, uint32_t rs);
-void tg_set_read_skip(ffsb_tg_t *tg, int rs);
-
-void tg_set_write_size(ffsb_tg_t *tg, uint64_t ws);
-void tg_set_write_blocksize(ffsb_tg_t *tg, uint32_t ws);
-
-uint64_t tg_get_read_size(ffsb_tg_t *tg);
-uint32_t tg_get_read_blocksize(ffsb_tg_t *tg);
-
-int tg_get_read_skip(ffsb_tg_t *tg);
-uint32_t tg_get_read_skipsize(ffsb_tg_t *tg);
-
-uint64_t tg_get_write_size(ffsb_tg_t *tg);
-uint32_t tg_get_write_blocksize(ffsb_tg_t *tg);
-
-void tg_set_waittime(ffsb_tg_t *tg, unsigned time);
-unsigned tg_get_waittime(ffsb_tg_t *tg);
-
-/* The threads in the tg should be the only ones using these (below)
- * funcs.
- */
-ffsb_barrier_t *tg_get_start_barrier(ffsb_tg_t *tg);
-int tg_get_stopval(ffsb_tg_t *tg);
-int tg_get_flagval(ffsb_tg_t *tg);
-
-/* The threads in this tg will use this function to get an op to run,
- * so all configuration specific information is kept in this object.
- */
-typedef struct tg_op_params {
-	struct ffsb_fs *fs;     /* out parameter */
-	unsigned opnum;         /* out parameter */
-} tg_op_params_t;
-
-/* tg and rd and in parameters, everything in params is out */
-void  tg_get_op(ffsb_tg_t *tg, randdata_t *rd, tg_op_params_t *params);
-
-/* want stats for this tg ? */
-int tg_needs_stats(ffsb_tg_t *tg);
-
-#endif /* _FFSB_TG_H_ */
diff --git a/utils/ffsb-6.0-rc2/ffsb_thread.c b/utils/ffsb-6.0-rc2/ffsb_thread.c
deleted file mode 100644
index 95cebcb..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_thread.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include "ffsb_tg.h"
-#include "ffsb_thread.h"
-#include "ffsb_op.h"
-#include "util.h"
-
-void init_ffsb_thread(ffsb_thread_t * ft, struct ffsb_tg *tg, unsigned bufsize,
-		      unsigned tg_num, unsigned thread_num)
-{
-	memset(ft, 0, sizeof(ffsb_thread_t));
-
-	ft->tg = tg;
-	ft->tg_num = tg_num;
-	ft->thread_num = thread_num;
-
-	if (bufsize)
-		ft_alter_bufsize(ft, bufsize);
-
-	init_random(&ft->rd, MAX_RANDBUF_SIZE);
-}
-
-void destroy_ffsb_thread(ffsb_thread_t * ft)
-{
-	free(ft->mallocbuf);
-	destroy_random(&ft->rd);
-	if (ft->fsd.config)
-		ffsb_statsd_destroy(&ft->fsd);
-}
-
-void ft_set_statsc(ffsb_thread_t * ft, ffsb_statsc_t * fsc)
-{
-	ffsb_statsd_init(&ft->fsd, fsc);
-}
-
-void *ft_run(void *data)
-{
-	ffsb_thread_t *ft = (ffsb_thread_t *) data;
-	tg_op_params_t params;
-	unsigned wait_time = tg_get_waittime(ft->tg);
-	int stopval = tg_get_stopval(ft->tg);
-
-	ffsb_barrier_wait(tg_get_start_barrier(ft->tg));
-
-	while (tg_get_flagval(ft->tg) != stopval) {
-		tg_get_op(ft->tg, &ft->rd, &params);
-		do_op(ft, params.fs, params.opnum);
-		ffsb_milli_sleep(wait_time);
-	}
-	return NULL;
-}
-
-void ft_alter_bufsize(ffsb_thread_t * ft, unsigned bufsize)
-{
-	if (ft->mallocbuf != NULL)
-		free(ft->mallocbuf);
-	ft->mallocbuf = ffsb_malloc(bufsize + 4096);
-	ft->alignedbuf = ffsb_align_4k(ft->mallocbuf + (4096 - 1));
-}
-
-char *ft_getbuf(ffsb_thread_t * ft)
-{
-	return ft->alignedbuf;
-}
-
-int ft_get_read_random(ffsb_thread_t * ft)
-{
-	return tg_get_read_random(ft->tg);
-}
-
-uint32_t ft_get_read_size(ffsb_thread_t * ft)
-{
-	return tg_get_read_size(ft->tg);
-}
-
-uint32_t ft_get_read_blocksize(ffsb_thread_t * ft)
-{
-	return tg_get_read_blocksize(ft->tg);
-}
-
-int ft_get_write_random(ffsb_thread_t * ft)
-{
-	return tg_get_write_random(ft->tg);
-}
-
-uint32_t ft_get_write_size(ffsb_thread_t * ft)
-{
-	return tg_get_write_size(ft->tg);
-}
-
-uint32_t ft_get_write_blocksize(ffsb_thread_t * ft)
-{
-	return tg_get_write_blocksize(ft->tg);
-}
-
-int ft_get_fsync_file(ffsb_thread_t * ft)
-{
-	return tg_get_fsync_file(ft->tg);
-}
-
-randdata_t *ft_get_randdata(ffsb_thread_t * ft)
-{
-	return &ft->rd;
-}
-
-void ft_incr_op(ffsb_thread_t * ft, unsigned opnum, unsigned increment,
-		uint64_t bytes)
-{
-	ft->results.ops[opnum] += increment;
-	ft->results.op_weight[opnum]++;
-	ft->results.bytes[opnum] += bytes;
-}
-
-void ft_add_readbytes(ffsb_thread_t * ft, uint32_t bytes)
-{
-	ft->results.read_bytes += bytes;
-}
-
-void ft_add_writebytes(ffsb_thread_t * ft, uint32_t bytes)
-{
-	ft->results.write_bytes += bytes;
-}
-
-ffsb_op_results_t *ft_get_results(ffsb_thread_t * ft)
-{
-	return &ft->results;
-}
-
-int ft_get_read_skip(ffsb_thread_t * ft)
-{
-	return tg_get_read_skip(ft->tg);
-}
-
-uint32_t ft_get_read_skipsize(ffsb_thread_t * ft)
-{
-	return tg_get_read_skipsize(ft->tg);
-}
-
-int ft_needs_stats(ffsb_thread_t * ft, syscall_t sys)
-{
-	int ret = 0;
-	if (ft && ft->fsd.config && !fsc_ignore_sys(ft->fsd.config, sys))
-		ret = 1;
-	return ret;
-}
-
-void ft_add_stat(ffsb_thread_t * ft, syscall_t sys, uint32_t val)
-{
-	if (ft)
-		ffsb_add_data(&ft->fsd, sys, val);
-}
-
-ffsb_statsd_t *ft_get_stats_data(ffsb_thread_t * ft)
-{
-	return &ft->fsd;
-}
diff --git a/utils/ffsb-6.0-rc2/ffsb_thread.h b/utils/ffsb-6.0-rc2/ffsb_thread.h
deleted file mode 100644
index 9543e2f..0000000
--- a/utils/ffsb-6.0-rc2/ffsb_thread.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FFSB_THREAD_H_
-#define _FFSB_THREAD_H_
-
-#include <pthread.h>
-#include <inttypes.h>
-
-#include "rand.h"
-#include "ffsb_op.h"
-#include "ffsb_tg.h"
-#include "ffsb_stats.h"
-
-#include "util.h" /* for barrier stuff */
-
-struct ffsb_tg;
-struct ffsb_op_results;
-
-/* FFSB thread object
- *
- * The thread object doesn't store any configuration information, it
- * mostly just holds per-thread state information such as the random
- * data store and the per-thread buffer to copy data to/from disk
- */
-
-typedef struct ffsb_thread {
-	unsigned thread_num;
-	unsigned tg_num;
-	pthread_t ptid;
-	struct randdata rd;
-	struct ffsb_tg *tg; /* owning thread group */
-
-	/* If we are using Direct IO, then we must only use a 4k
-	 * aligned buffer so, alignedbuf_4k is a pointer into
-	 * "mallocbuf" which is what malloc gave us.
-	 */
-	char *alignedbuf;
-	char *mallocbuf;
-
-	struct ffsb_op_results results;
-
-	/* stats */
-	ffsb_statsd_t fsd;
-} ffsb_thread_t ;
-
-void init_ffsb_thread(ffsb_thread_t *, struct ffsb_tg *, unsigned,
-		       unsigned, unsigned);
-void destroy_ffsb_thread(ffsb_thread_t *);
-
-/* Owning thread group will start thread with this, thread runs until
- * *ft->checkval == ft->stopval.  Yes this is not strictly
- * synchronized, but that is okay for our purposes, and it limits (IMO
- * expensive) bus-locking.
- *
- * pthread_create() is called by tg with this function as a parameter
- * data is a (ffsb_thread_t*)
- */
-void *ft_run(void *);
-
-void ft_alter_bufsize(ffsb_thread_t *, unsigned);
-char *ft_getbuf(ffsb_thread_t *);
-
-int ft_get_read_random(ffsb_thread_t *);
-uint32_t ft_get_read_size(ffsb_thread_t *);
-uint32_t ft_get_read_blocksize(ffsb_thread_t *);
-
-int ft_get_write_random(ffsb_thread_t *);
-uint32_t ft_get_write_size(ffsb_thread_t *);
-uint32_t ft_get_write_blocksize(ffsb_thread_t *);
-
-int ft_get_fsync_file(ffsb_thread_t *);
-
-randdata_t *ft_get_randdata(ffsb_thread_t *);
-
-void ft_incr_op(ffsb_thread_t *ft, unsigned opnum, unsigned increment, uint64_t bytes);
-
-void ft_add_readbytes(ffsb_thread_t *, uint32_t);
-void ft_add_writebytes(ffsb_thread_t *, uint32_t);
-
-int ft_get_read_skip(ffsb_thread_t *);
-uint32_t ft_get_read_skipsize(ffsb_thread_t *);
-
-ffsb_op_results_t *ft_get_results(ffsb_thread_t *);
-
-void ft_set_statsc(ffsb_thread_t *, ffsb_statsc_t *);
-
-/* for these two, ft == NULL is OK */
-int ft_needs_stats(ffsb_thread_t *, syscall_t);
-void ft_add_stat(ffsb_thread_t *, syscall_t, uint32_t);
-
-ffsb_statsd_t *ft_get_stats_data(ffsb_thread_t *);
-
-#endif /* _FFSB_THREAD_H_ */
diff --git a/utils/ffsb-6.0-rc2/fh.c b/utils/ffsb-6.0-rc2/fh.c
deleted file mode 100644
index 196e5be..0000000
--- a/utils/ffsb-6.0-rc2/fh.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-
-#define FILE_OFFSET_BITS 64
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "ffsb.h"
-#include "fh.h"
-
-#include "config.h"
-
-/* !!! ugly */
-#ifndef HAVE_OPEN64
-#define open64 open
-#endif
-
-#ifndef HAVE_FSEEKO64
-#define lseek64 lseek
-#endif
-
-/* All these functions read the global mainconfig->bufferedio variable
- * to determine if they are to do buffered i/o or normal.
- *
- * ha, well, they're supposed to anyway...!!! TODO -SR 2006/05/14
- */
-
-static void do_stats(struct timeval *start, struct timeval *end,
-		     ffsb_thread_t * ft, ffsb_fs_t * fs, syscall_t sys)
-{
-	struct timeval diff;
-	uint32_t value = 0;
-
-	if (!ft && !fs)
-		return;
-
-	timersub(end, start, &diff);
-
-	value = 1000000 * diff.tv_sec + diff.tv_usec;
-
-	if (ft && ft_needs_stats(ft, sys))
-		ft_add_stat(ft, sys, value);
-	if (fs && fs_needs_stats(fs, sys))
-		fs_add_stat(fs, sys, value);
-}
-
-static int fhopenhelper(char *filename, char *bufflags, int flags,
-			ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	int fd = 0;
-	struct timeval start, end;
-	int need_stats = ft_needs_stats(ft, SYS_OPEN) ||
-	    fs_needs_stats(fs, SYS_OPEN);
-
-	flags |= O_LARGEFILE;
-
-	if (need_stats)
-		gettimeofday(&start, NULL);
-
-	fd = open64(filename, flags, S_IRWXU);
-	if (fd < 0) {
-		perror(filename);
-		exit(0);
-	}
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_OPEN);
-	}
-
-	return fd;
-}
-
-int fhopenread(char *filename, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	int flags = O_RDONLY;
-	int directio = fs_get_directio(fs);
-
-	if (directio)
-		flags |= O_DIRECT;
-	return fhopenhelper(filename, "r", flags, ft, fs);
-}
-
-int fhopenappend(char *filename, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	int flags = O_APPEND | O_WRONLY;
-	int directio = fs_get_directio(fs);
-
-	if (directio)
-		flags |= O_DIRECT;
-	return fhopenhelper(filename, "a", flags, ft, fs);
-}
-
-int fhopenwrite(char *filename, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	int flags = O_WRONLY;
-	int directio = fs_get_directio(fs);
-
-	if (directio)
-		flags |= O_DIRECT;
-	return fhopenhelper(filename, "w", flags, ft, fs);
-}
-
-int fhopencreate(char *filename, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	int flags = O_CREAT | O_RDWR | O_TRUNC;
-	int directio = fs_get_directio(fs);
-
-	if (directio)
-		flags |= O_DIRECT;
-	return fhopenhelper(filename, "rw", flags, ft, fs);
-}
-
-void fhread(int fd, void *buf, uint64_t size, ffsb_thread_t * ft,
-	    ffsb_fs_t * fs)
-{
-	ssize_t realsize;
-	struct timeval start, end;
-	int need_stats = ft_needs_stats(ft, SYS_READ) ||
-	    fs_needs_stats(fs, SYS_READ);
-
-	assert(size <= SIZE_MAX);
-	if (need_stats)
-		gettimeofday(&start, NULL);
-	realsize = read(fd, buf, size);
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_READ);
-	}
-
-	if (realsize != size) {
-		printf("Read %lld instead of %llu bytes.\n",
-		       (unsigned long long)realsize, (unsigned long long)size);
-		perror("read");
-		exit(1);
-	}
-}
-
-void fhwrite(int fd, void *buf, uint32_t size, ffsb_thread_t * ft,
-	     ffsb_fs_t * fs)
-{
-	ssize_t realsize;
-	struct timeval start, end;
-	int need_stats = ft_needs_stats(ft, SYS_WRITE) ||
-	    fs_needs_stats(fs, SYS_WRITE);
-
-	assert(size <= SIZE_MAX);
-	if (need_stats)
-		gettimeofday(&start, NULL);
-
-	realsize = write(fd, buf, size);
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_WRITE);
-	}
-
-	if (realsize != size) {
-		printf("Wrote %d instead of %d bytes.\n"
-		       "Probably out of disk space\n", realsize, size);
-		perror("write");
-		exit(1);
-	}
-}
-
-void fhseek(int fd, uint64_t offset, int whence, ffsb_thread_t * ft,
-	    ffsb_fs_t * fs)
-{
-	uint64_t res;
-	struct timeval start, end;
-	int need_stats = ft_needs_stats(ft, SYS_LSEEK) ||
-	    fs_needs_stats(fs, SYS_LSEEK);
-
-	if ((whence == SEEK_CUR) && (offset == 0))
-		return;
-
-	if (need_stats)
-		gettimeofday(&start, NULL);
-
-	res = lseek64(fd, offset, whence);
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_LSEEK);
-	}
-	if ((whence == SEEK_SET) && (res != offset))
-		perror("seek");
-
-	if (res == -1) {
-		if (whence == SEEK_SET)
-			fprintf(stderr, "tried to seek to %lld\n", offset);
-		else
-			fprintf(stderr, "tried to seek from current "
-				"position to %lld\n", offset);
-
-		perror("seek");
-		exit(1);
-	}
-}
-
-void fhclose(int fd, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	struct timeval start, end;
-	int need_stats = ft_needs_stats(ft, SYS_CLOSE) ||
-	    fs_needs_stats(fs, SYS_CLOSE);
-
-	if (need_stats)
-		gettimeofday(&start, NULL);
-
-	close(fd);
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_CLOSE);
-	}
-}
-
-void fhstat(char *name, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	struct timeval start, end;
-	struct stat tmp_stat;
-
-	int need_stats = ft_needs_stats(ft, SYS_STAT) ||
-	    fs_needs_stats(fs, SYS_CLOSE);
-
-	if (need_stats)
-		gettimeofday(&start, NULL);
-
-	if (stat(name, &tmp_stat)) {
-		fprintf(stderr, "stat call failed for file %s\n", name);
-		exit(1);
-	}
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_STAT);
-	}
-}
-
-int writefile_helper(int fd, uint64_t size, uint32_t blocksize, char *buf,
-		     struct ffsb_thread *ft, struct ffsb_fs *fs)
-{
-	uint64_t iterations, a;
-	uint64_t last;
-
-	iterations = size / blocksize;
-	last = size % blocksize;
-
-	for (a = 0; a < iterations; a++)
-		fhwrite(fd, buf, blocksize, ft, fs);
-
-	if (last) {
-		a++;
-		fhwrite(fd, buf, last, ft, fs);
-	}
-	return a;
-}
diff --git a/utils/ffsb-6.0-rc2/fh.h b/utils/ffsb-6.0-rc2/fh.h
deleted file mode 100644
index 23a198b..0000000
--- a/utils/ffsb-6.0-rc2/fh.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FH_H_
-#define _FH_H_
-
-#include <inttypes.h>
-
-struct ffsb_thread;
-struct ffsb_fs;
-
-int fhopenread(char *, struct ffsb_thread *, struct ffsb_fs *);
-int fhopenwrite(char *, struct ffsb_thread *, struct ffsb_fs *);
-int fhopencreate(char *, struct ffsb_thread *, struct ffsb_fs *);
-int fhopenappend(char *, struct ffsb_thread *, struct ffsb_fs *);
-
-void fhread(int, void *, uint64_t, struct ffsb_thread *, struct ffsb_fs *);
-
-/* can only write up to size_t bytes at a time, so size is a uint32_t */
-void fhwrite(int, void *, uint32_t, struct ffsb_thread *, struct ffsb_fs *);
-void fhseek(int, uint64_t, int, struct ffsb_thread *, struct ffsb_fs *);
-void fhclose(int, struct ffsb_thread *, struct ffsb_fs *);
-
-int writefile_helper(int, uint64_t, uint32_t, char *, struct ffsb_thread *,
-		     struct ffsb_fs *);
-
-#endif /* _FH_H_ */
diff --git a/utils/ffsb-6.0-rc2/filelist.c b/utils/ffsb-6.0-rc2/filelist.c
deleted file mode 100644
index 98fdad4..0000000
--- a/utils/ffsb-6.0-rc2/filelist.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <limits.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "rand.h"
-#include "filelist.h"
-#include "util.h"
-#include "rwlock.h"
-#include "rbt.h"
-#include "cirlist.h"
-
-#if 0
-static
-void print_cl(struct cirlist *cl)
-{
-	struct cnode *cur = cl->head;
-	printf("curlist: ");
-	if (cur == NULL) {
-		printf("\n");
-		return;
-	}
-	do {
-		printf("%d ", cur->obj->num);
-		cur = cur->next;
-	} while (cur != cl->head);
-	printf("\n");
-}
-#endif
-
-#if 0
-static
-int node_cmp(struct ffsb_file *a, struct ffsb_file *b)
-{
-	return a->num - b->num;
-}
-#endif
-
-static
-void build_dirs(struct benchfiles *bf)
-{
-	char buf[FILENAME_MAX];
-	int i;
-
-	if (mkdir(bf->basedir, S_IRWXU) < 0)
-		if (errno != EEXIST) {
-			perror(bf->basedir);
-			exit(1);
-		}
-	for (i = 0; i < bf->numsubdirs; i++) {
-		snprintf(buf, FILENAME_MAX, "%s/%s%s%d",
-			 bf->basedir, bf->basename, SUBDIRNAME_BASE, i);
-		if (mkdir(buf, S_IRWXU) == -1)
-			if (errno != EEXIST) {
-				perror(buf);
-				exit(1);
-			}
-	}
-}
-
-void init_filelist(struct benchfiles *b, char *basedir, char *basename,
-		   uint32_t numsubdirs, int builddirs)
-{
-	memset(b, 0, sizeof(struct benchfiles));
-	b->basedir = ffsb_strdup(basedir);
-	b->basename = ffsb_strdup(basename);
-	b->numsubdirs = numsubdirs;
-	init_rwlock(&b->fileslock);
-	b->files = rbtree_construct();
-	b->dirs = rbtree_construct();
-	b->holes = ffsb_malloc(sizeof(struct cirlist));
-	b->dholes = ffsb_malloc(sizeof(struct cirlist));
-	init_cirlist(b->holes);
-	init_cirlist(b->dholes);
-
-	if (builddirs)
-		build_dirs(b);
-}
-
-static void file_destructor(struct ffsb_file *file)
-{
-	free(file->name);
-	free(file);
-}
-
-void destroy_filelist(struct benchfiles *bf)
-{
-	free(bf->basedir);
-	free(bf->basename);
-
-	while (!cl_empty(bf->holes)) {
-		struct ffsb_file *cur = cl_remove_head(bf->holes);
-		file_destructor(cur);
-	}
-	free(bf->holes);
-	rbtree_clean(bf->files, file_destructor);
-	free(bf->files);
-}
-
-struct ffsb_file *add_file(struct benchfiles *b, uint64_t size, randdata_t * rd)
-{
-	struct ffsb_file *newfile, *oldfile = NULL;
-	int filenum = 0;
-
-	/* We pre-allocate here, because I don't want to spend time
-	 * malloc'ing while the list is locked we free it later if
-	 * necessary
-	 */
-	newfile = ffsb_malloc(sizeof(struct ffsb_file));
-
-	newfile->size = size;
-	init_rwlock(&(newfile->lock));
-
-	/* Write lock the filelist, begin critical section */
-	rw_lock_write(&b->fileslock);
-
-	/* First check "holes" for a file  */
-	if (!cl_empty(b->holes)) {
-		oldfile = cl_remove_head(b->holes);
-		rbtree_insert(b->files, oldfile);
-		rw_lock_write(&oldfile->lock);
-	} else {
-		filenum = b->listsize;
-		b->listsize++;
-
-		newfile->num = filenum;
-		rbtree_insert(b->files, newfile);
-
-		rw_lock_write(&newfile->lock);
-	}
-
-	/* unlock filelist */
-	rw_unlock_write(&b->fileslock);
-
-	if (oldfile == NULL) {
-		char buf[FILENAME_MAX];
-		int randdir = getrandom(rd, b->numsubdirs + 1);
-		int namesize = 0;
-		if (randdir == 0)
-			namesize = snprintf(buf, FILENAME_MAX, "%s/%s%s%d",
-					    b->basedir, b->basename,
-					    FILENAME_BASE, filenum);
-		else
-			namesize = snprintf(buf, FILENAME_MAX,
-					    "%s/%s%s%d/%s%s%d", b->basedir,
-					    b->basename, SUBDIRNAME_BASE,
-					    randdir - 1, b->basename,
-					    FILENAME_BASE, filenum);
-		if (namesize >= FILENAME_MAX)
-			/* !!! do something about this ? */
-			printf("warning: filename \"%s\" too long\n", buf);
-		newfile->name = ffsb_strdup(buf);
-		return newfile;
-	} else {
-		free(newfile);
-		return oldfile;
-	}
-}
-
-struct ffsb_file *add_dir(struct benchfiles *b, uint64_t size, randdata_t * rd)
-{
-	struct ffsb_file *newdir, *olddir = NULL;
-	int dirnum = 0;
-
-	newdir = ffsb_malloc(sizeof(struct ffsb_file));
-
-	init_rwlock(&newdir->lock);
-
-	/* write lock the filelist, beging critical section */
-	rw_lock_write(&b->fileslock);
-
-	/* First check "holes" for a file  */
-	if (!cl_empty(b->dholes)) {
-		olddir = cl_remove_head(b->dholes);
-		rbtree_insert(b->files, olddir);
-		rw_lock_write(&olddir->lock);
-	} else {
-		dirnum = b->numsubdirs;
-		b->numsubdirs++;
-		printf("dirnum: %d\n", dirnum);
-		newdir->num = dirnum;
-		rbtree_insert(b->dirs, newdir);
-
-		rw_lock_write(&newdir->lock);
-	}
-
-	/* unlock filelist */
-	rw_unlock_write(&b->fileslock);
-
-	if (olddir == NULL) {
-		char buf[FILENAME_MAX];
-		int namesize = 0;
-		namesize = snprintf(buf, FILENAME_MAX, "%s/%s%s%d",
-				    b->basedir, b->basename,
-				    SUBDIRNAME_BASE, dirnum);
-		if (namesize >= FILENAME_MAX)
-			printf("warning: filename \"%s\" too long\n", buf);
-		/* TODO: take action here... */
-		newdir->name = ffsb_strdup(buf);
-		return newdir;
-	} else {
-		free(newdir);
-		return olddir;
-	}
-}
-
-/* Private version of above function used only for reusing a
- * fileset.
- */
-static struct ffsb_file *add_file_named(struct benchfiles *b, uint64_t size,
-					char *name)
-{
-	struct ffsb_file *newfile = NULL;
-
-	newfile = ffsb_malloc(sizeof(struct ffsb_file));
-	memset(newfile, 0, sizeof(struct ffsb_file));
-	newfile->name = ffsb_strdup(name);
-	newfile->size = size;
-	init_rwlock(&newfile->lock);
-
-	/* Write lock the filelist, begin critical section */
-	rw_lock_write(&b->fileslock);
-
-	newfile->num = b->listsize;
-	b->listsize++;
-
-	/* Add a new file to the rbtree */
-	rbtree_insert(b->files, newfile);
-
-	rw_lock_write(&newfile->lock);
-
-	/* Unlock filelist */
-	rw_unlock_write(&b->fileslock);
-
-	return newfile;
-}
-
-#if 0
-static void print_rb_helper(rb_node * cur)
-{
-	if (cur != NULL) {
-		print_rb_helper(cur->left);
-		printf("%d ", cur->object->num);
-		print_rb_helper(cur->right);
-	}
-}
-
-static void print_rb(rb_tree * tree)
-{
-	print_rb_helper(tree->root);
-}
-#endif
-
-void remove_file(struct benchfiles *b, struct ffsb_file *entry)
-{
-	rw_lock_write(&b->fileslock);
-
-	rbtree_remove(b->files, entry, NULL);
-	/* add node to the cir. list of "holes" */
-	cl_insert_tail(b->holes, entry);
-
-	rw_unlock_write(&b->fileslock);
-}
-
-static struct ffsb_file *choose_file(struct benchfiles *b, randdata_t * rd)
-{
-	rb_node *cur = NULL;
-	int chosen = 0;
-	struct ffsb_file temp;
-	temp.num = chosen;
-
-	if (b->listsize == 0) {
-		fprintf(stderr, "No more files to operate on,"
-			" try making more initial files "
-			"or fewer delete operations\n");
-		exit(0);
-	}
-
-	while (cur == NULL) {
-		chosen = getrandom(rd, b->listsize);
-		temp.num = chosen;
-		cur = rbtree_find(b->files, &temp);
-	}
-	return cur->object;
-}
-
-struct ffsb_file *choose_file_reader(struct benchfiles *bf, randdata_t * rd)
-{
-	struct ffsb_file *ret;
-
-	rw_lock_read(&bf->fileslock);
-	/* If b->holes->count == bf->listsize, all files have been
-	 * deleted!
-	 */
-	assert(bf->holes->count != bf->listsize);
-
-	ret = choose_file(bf, rd);
-	if (rw_trylock_read(&ret->lock)) {
-		rw_unlock_read(&bf->fileslock);
-		return choose_file_reader(bf, rd);
-	}
-
-	rw_unlock_read(&bf->fileslock);
-	return ret;
-}
-
-struct ffsb_file *choose_file_writer(struct benchfiles *bf, randdata_t * rd)
-{
-	struct ffsb_file *ret;
-
-	rw_lock_read(&bf->fileslock);
-	assert(bf->holes->count != bf->listsize);
-	ret = choose_file(bf, rd);
-
-	if (rw_trylock_write(&ret->lock)) {
-		rw_unlock_read(&bf->fileslock);
-		return choose_file_writer(bf, rd);
-	}
-
-	rw_unlock_read(&bf->fileslock);
-	return ret;
-}
-
-void unlock_file_reader(struct ffsb_file *file)
-{
-	rw_unlock_read(&file->lock);
-}
-
-void unlock_file_writer(struct ffsb_file *file)
-{
-	rw_unlock_write(&file->lock);
-}
-
-void rename_file(struct ffsb_file *file)
-{
-	char *newname = malloc(strlen(file->name) + 2);
-	sprintf(newname, "%sa", file->name);
-	file->name = newname;
-}
-
-int validate_filename(struct benchfiles *bf, char *name)
-{
-	int retval = -1;
-	char fmt_str[FILENAME_MAX];
-	if (FILENAME_MAX <= snprintf(fmt_str, FILENAME_MAX,
-				     "%s%s%%d", bf->basename, FILENAME_BASE)) {
-		printf("filename is too long declaring it invalid\n");
-		return -1;
-	}
-
-	sscanf(name, fmt_str, &retval);
-	return retval;
-}
-
-int validate_dirname(struct benchfiles *bf, char *name)
-{
-	int retval = -1;
-	char fmt_str[FILENAME_MAX];
-	if (FILENAME_MAX <= snprintf(fmt_str, FILENAME_MAX, "%s%s%%d",
-				     bf->basename, SUBDIRNAME_BASE)) {
-		printf("dirname is too long declaring it invalid\n");
-		return -1;
-	}
-
-	sscanf(name, fmt_str, &retval);
-	return retval;
-}
-
-/* Do all the dirty work of recursing through a directory structure
- * check everything for validitiy and update everything properly.
- * Note it does not check filesizes !!!, it doesn't know anything
- * about them
- */
-static int add_dir_to_filelist(struct benchfiles *bf, DIR * subdir,
-			       char *subdir_path, fl_validation_func_t vfunc,
-			       void *vf_data)
-{
-	int retval = 0;
-	struct dirent *d_ent = NULL;
-
-	while ((d_ent = readdir(subdir)) != NULL) {
-		DIR *tmp = NULL;
-		char filename_buf[FILENAME_MAX * 2];
-
-		if (FILENAME_MAX < snprintf(filename_buf, FILENAME_MAX, "%s/%s",
-					    subdir_path, d_ent->d_name)) {
-			printf("filename \"%s\" too long aborting\n",
-			       filename_buf);
-			return -1;
-		}
-		tmp = opendir(filename_buf);
-		if (tmp == NULL) {
-			struct ffsb_file *ffsb_file = NULL;
-
-			if (validate_filename(bf, d_ent->d_name) < 0) {
-				printf("filename \"%s\" is invalid aborting\n",
-				       d_ent->d_name);
-				return -1;
-			}
-			/* Verify size/other attributes via callback  */
-			if (vfunc(bf, filename_buf, vf_data)) {
-				printf("filename \"%s\" didn't pass "
-				       "validation\n", d_ent->d_name);
-				return -1;
-			}
-			/* Add file to data structure */
-			ffsb_file =
-			    add_file_named(bf, ffsb_get_filesize(filename_buf),
-					   filename_buf);
-			unlock_file_writer(ffsb_file);
-		} else {
-			/* Check for the usual suspects and skip them */
-			if ((0 == strcmp(".", d_ent->d_name)) ||
-			    (0 == strcmp("..", d_ent->d_name))) {
-				closedir(tmp);
-				continue;
-			}
-			if (validate_dirname(bf, d_ent->d_name) < 0) {
-				printf("dirname \"%s\" is invalid aborting\n",
-				       d_ent->d_name);
-				closedir(tmp);
-				return -1;
-			}
-			if (vfunc(bf, filename_buf, vf_data)) {
-				printf("dir \"%s\" didn't pass validation\n",
-				       d_ent->d_name);
-				closedir(tmp);
-				return -1;
-			}
-			/* Update filelist */
-			bf->numsubdirs++;
-
-			/* recurse */
-			retval += add_dir_to_filelist(bf, tmp, filename_buf,
-						      vfunc, vf_data);
-
-			/* clean up */
-			closedir(tmp);
-		}
-	}
-	return retval;
-}
-
-int grab_old_fileset(struct benchfiles *bf, char *basename,
-		     fl_validation_func_t vfunc, void *vfunc_data)
-{
-	int retval = 0;
-	char buf[FILENAME_MAX * 2];
-	DIR *lc_dir = NULL;
-
-	if (FILENAME_MAX < snprintf(buf, FILENAME_MAX, "%s", bf->basedir)) {
-		printf("filename \"%s\" is too long aborting\n", buf);
-		return -1;
-	}
-
-	lc_dir = opendir(buf);
-	if (lc_dir == NULL) {
-		perror("opendir");
-		return -1;
-	}
-
-	retval = add_dir_to_filelist(bf, lc_dir, buf, vfunc, vfunc_data);
-
-	closedir(lc_dir);
-	return retval;
-}
-
-/* Get the number of files */
-uint32_t get_listsize(struct benchfiles * bf)
-{
-	return bf->listsize;
-}
-
-/* Get the number of subdirectories */
-uint32_t get_numsubdirs(struct benchfiles * bf)
-{
-	return bf->numsubdirs;
-}
diff --git a/utils/ffsb-6.0-rc2/filelist.h b/utils/ffsb-6.0-rc2/filelist.h
deleted file mode 100644
index e11d066..0000000
--- a/utils/ffsb-6.0-rc2/filelist.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FILELIST_H_
-#define _FILELIST_H_
-
-#include <pthread.h>
-#include "rand.h"
-#include "rwlock.h"
-#include "cirlist.h"
-#include "rbt.h"
-
-#define SUBDIRNAME_BASE "dir"
-#define FILENAME_BASE "file"
-
-struct ffsb_file {
-	char *name;
-	uint64_t size;
-	struct rwlock lock;
-	uint32_t num;
-};
-
-struct cirlist;
-
-/* Tree of ffsb_file structs and associated state info struct must be
- * locked during use.
- */
-struct benchfiles {
-	/* The base directory in which all subdirs and files are
-	 * created
-	 */
-	char *basedir;
-
-	/* The name to prepend to all directory and file names */
-	char *basename;
-	uint32_t numsubdirs;
-
-	/* Files which currently exist on the filesystem */
-	struct red_black_tree *files;
-
-	/* Directories which currently exist on the filesystem */
-	struct red_black_tree *dirs;
-
-	/* Files which have been deleted, and whose numbers should be
-	 * reused
-	 */
-	struct cirlist *holes;
-	struct cirlist *dholes;
-
-	/* This lock must be held while manipulating the structure */
-	struct rwlock fileslock;
-	uint32_t listsize; /* Sum size of nodes in files and holes */
-};
-
-/* Initializes the list, user must call this before anything else it
- * will create the basedir and subdirs on the filesystem automatically
- * if the builddirs arg. is nonzero
- */
-void init_filelist(struct benchfiles *, char *, char *, uint32_t, int);
-void destroy_filelist(struct benchfiles *);
-
-/* Allocates a new file, adds to list, (write) locks it, and returns
- * it.  This function also randomly selects a filename + path to
- * assign to the new file.
- *
- * It first checks the "holes" list for any available filenames.
- * Caller must ensure file is actually created on disk
- */
-struct ffsb_file *add_file(struct benchfiles *b, uint64_t size, randdata_t *rd);
-struct ffsb_file *add_dir(struct benchfiles *, uint64_t, randdata_t *);
-
-/* Removes file from list, decrements listsize.
- *
- * File should be writer-locked before calling this function.
- *
- * This function does not unlock file after removal from list.
- *
- * Caller must ensure file is actually removed on disk.
- *
- * Caller must NOT free file->name and file, since oldfiles are being
- * put into holes list.
- */
-void remove_file(struct benchfiles *, struct ffsb_file *);
-
-/* Picks a file at random, locks it for reading and returns it
- * locked
- */
-struct ffsb_file *choose_file_reader(struct benchfiles *, randdata_t *);
-
-/* Picks a file at random, locks it for writing and returns it
- * locked
- */
-struct ffsb_file *choose_file_writer(struct benchfiles *, randdata_t *);
-
-/* changes the file->name of a file, file must be write locked
- * it does not free the old file->name, so caller must keep a ref to it
- * and free after the call
- */
-void rename_file(struct ffsb_file *);
-
-void unlock_file_reader(struct ffsb_file *);
-void unlock_file_writer(struct ffsb_file *);
-
-/* Uses SUBDIRNAME_BASE/FILENAME_BASE + bf->basename to validate a
- * name returns a negative on invalid names, and the actual file
- * number if valid
- */
-int validate_filename(struct benchfiles *, char *);
-int validate_dirname(struct benchfiles *, char *);
-
-/* Function type which, does some validation of existing files
- * currently only used by ffsb_fs stuff, returns 0 on success
- */
-typedef int (*fl_validation_func_t)(struct benchfiles *, char *, void *);
-
-/* Provided for re-use of filesets.  Also runs the validation callback
- * on each file/dir that is found, after verifying the name is
- * conformant.  The fileset should be initialized with init_fileset()
- * beforehand.
- * Returns 0 on success
- */
-int grab_old_fileset(struct benchfiles *, char *, fl_validation_func_t,
-		      void *);
-
-/* Get the number of files */
-uint32_t get_listsize(struct benchfiles *);
-
-/* Get the number of subdirectories */
-uint32_t get_numsubdirs(struct benchfiles *);
-
-#endif /* _FILELIST_H_ */
diff --git a/utils/ffsb-6.0-rc2/fileops.c b/utils/ffsb-6.0-rc2/fileops.c
deleted file mode 100644
index 3212c18..0000000
--- a/utils/ffsb-6.0-rc2/fileops.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#define _LARGEFILE64_SOURCE
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <pthread.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <errno.h>
-
-#include "fh.h"
-#include "util.h"
-#include "ffsb.h"
-#include "fileops.h"
-#include "ffsb_op.h"
-
-static void do_stats(struct timeval *start, struct timeval *end,
-		     ffsb_thread_t * ft, ffsb_fs_t * fs, syscall_t sys)
-{
-	struct timeval diff;
-	uint32_t value = 0;
-
-	if (!ft && !fs)
-		return;
-
-	timersub(end, start, &diff);
-
-	value = 1000000 * diff.tv_sec + diff.tv_usec;
-
-	if (ft && ft_needs_stats(ft, sys))
-		ft_add_stat(ft, sys, value);
-	if (fs && fs_needs_stats(fs, sys))
-		fs_add_stat(fs, sys, value);
-}
-
-void fop_bench(ffsb_fs_t * fs, unsigned opnum)
-{
-	fs_set_opdata(fs, fs_get_datafiles(fs), opnum);
-}
-
-void fop_age(ffsb_fs_t * fs, unsigned opnum)
-{
-	fs_set_opdata(fs, fs_get_agefiles(fs), opnum);
-}
-
-static unsigned readfile_helper(int fd, uint64_t size, uint32_t blocksize,
-				char *buf, ffsb_thread_t * ft, ffsb_fs_t * fs)
-{
-	int iterations, a;
-	int last;
-
-	iterations = size / blocksize;
-	last = size % blocksize;
-
-	for (a = 0; a < iterations; a++)
-		fhread(fd, buf, blocksize, ft, fs);
-	if (last)
-		fhread(fd, buf, last, ft, fs);
-	return iterations;
-}
-
-static uint64_t get_random_offset(randdata_t * rd, uint64_t filesize,
-				  int aligned)
-{
-	if (!aligned)
-		return getllrandom(rd, filesize);
-
-	filesize /= 4096;
-	return getllrandom(rd, filesize) * 4096;
-}
-
-void ffsb_readfile(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-
-	int fd;
-	uint64_t filesize;
-
-	char *buf = ft_getbuf(ft);
-	int read_random = ft_get_read_random(ft);
-	uint64_t read_size = ft_get_read_size(ft);
-	uint32_t read_blocksize = ft_get_read_blocksize(ft);
-	uint32_t read_skipsize = ft_get_read_skipsize(ft);
-	int skip_reads = ft_get_read_skip(ft);
-	struct randdata *rd = ft_get_randdata(ft);
-
-	uint64_t iterations = 0;
-
-	curfile = choose_file_reader(bf, rd);
-	fd = fhopenread(curfile->name, ft, fs);
-
-	filesize = ffsb_get_filesize(curfile->name);
-
-	assert(filesize >= read_size);
-
-	/* Sequential read, starting at a random point */
-	if (!read_random) {
-		uint64_t range = filesize - read_size;
-		uint64_t offset = 0;
-		/* Skip or "stride" reads option */
-		if (skip_reads) {
-			unsigned i, last;
-			uint64_t minfilesize;
-			iterations = read_size / read_blocksize;
-			last = read_size % read_blocksize;
-
-			/* Double check that the user hasn't specified
-			 * a read_size that is too large when combined
-			 * with the seeks
-			 */
-			if (last)
-				minfilesize = last + iterations *
-				    (read_blocksize + read_skipsize);
-			else
-				minfilesize = read_blocksize + iterations - 1 *
-				    (read_blocksize + read_skipsize);
-
-			if (minfilesize > filesize) {
-				printf("Error: read size %llu bytes too big "
-				       "w/ skipsize %u and blocksize %u,"
-				       " for file of size %llu bytes\n"
-				       " aborting\n\n", read_size,
-				       read_skipsize, read_blocksize, filesize);
-				printf("minimum file size must be at least "
-				       " %llu bytes\n", minfilesize);
-				exit(1);
-			}
-
-			for (i = 0; i < iterations; i++) {
-				fhread(fd, buf, read_blocksize, ft, fs);
-				fhseek(fd, (uint64_t) read_skipsize, SEEK_CUR,
-				       ft, fs);
-			}
-			if (last) {
-				fhread(fd, buf, (uint64_t) last, ft, fs);
-				iterations++;
-			}
-		} else {
-			/* Regular sequential reads */
-			if (range) {
-				offset = get_random_offset(rd, range,
-							   fs_get_alignio(fs));
-				fhseek(fd, offset, SEEK_SET, ft, fs);
-			}
-			iterations = readfile_helper(fd, read_size,
-						     read_blocksize, buf,
-						     ft, fs);
-		}
-	} else {
-		/* Randomized read */
-		uint64_t range = filesize - read_blocksize;
-		int i;
-
-		iterations = read_size / read_blocksize;
-
-		for (i = 0; i < iterations; i++) {
-			uint64_t offset = get_random_offset(rd, range,
-							    fs_get_alignio(fs));
-			fhseek(fd, offset, SEEK_SET, ft, fs);
-			fhread(fd, buf, read_blocksize, ft, fs);
-		}
-	}
-
-	unlock_file_reader(curfile);
-	fhclose(fd, ft, fs);
-
-	ft_incr_op(ft, opnum, iterations, read_size);
-	ft_add_readbytes(ft, read_size);
-}
-
-/* Just like ffsb_readfile but we read the whole file from start to
- * finish regardless of file size.
- */
-void ffsb_readall(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-	int fd;
-	uint64_t filesize;
-
-	char *buf = ft_getbuf(ft);
-	uint32_t read_blocksize = ft_get_read_blocksize(ft);
-	struct randdata *rd = ft_get_randdata(ft);
-
-	unsigned iterations = 0;
-
-	curfile = choose_file_reader(bf, rd);
-	fd = fhopenread(curfile->name, ft, fs);
-
-	filesize = ffsb_get_filesize(curfile->name);
-	iterations = readfile_helper(fd, filesize, read_blocksize, buf, ft, fs);
-
-	unlock_file_reader(curfile);
-	fhclose(fd, ft, fs);
-
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_readbytes(ft, filesize);
-}
-
-/* Shared core between ffsb_writefile and ffsb_writefile_fsync.*/
-
-static unsigned ffsb_writefile_core(ffsb_thread_t * ft, ffsb_fs_t * fs,
-				    unsigned opnum, uint64_t * filesize_ret,
-				    int fsync_file)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-
-	int fd;
-	uint64_t filesize;
-
-	char *buf = ft_getbuf(ft);
-	int write_random = ft_get_write_random(ft);
-	uint32_t write_size = ft_get_write_size(ft);
-	uint32_t write_blocksize = ft_get_write_blocksize(ft);
-	struct randdata *rd = ft_get_randdata(ft);
-	unsigned iterations = 0;
-
-	curfile = choose_file_reader(bf, rd);
-	fd = fhopenwrite(curfile->name, ft, fs);
-
-	filesize = ffsb_get_filesize(curfile->name);
-
-	assert(filesize >= write_size);
-
-	/* Sequential write, starting at a random point  */
-	if (!write_random) {
-		uint64_t range = filesize - write_size;
-		uint64_t offset = 0;
-		if (range) {
-			offset = get_random_offset(rd, range,
-						   fs_get_alignio(fs));
-			fhseek(fd, offset, SEEK_SET, ft, fs);
-		}
-		iterations = writefile_helper(fd, write_size, write_blocksize,
-					      buf, ft, fs);
-	} else {
-		/* Randomized write */
-		uint64_t range = filesize - write_blocksize;
-		int i;
-		iterations = write_size / write_blocksize;
-
-		for (i = 0; i < iterations; i++) {
-			uint64_t offset = get_random_offset(rd, range,
-							    fs_get_alignio(fs));
-			fhseek(fd, offset, SEEK_SET, ft, fs);
-			fhwrite(fd, buf, write_blocksize, ft, fs);
-		}
-	}
-
-	if (fsync_file) {
-		if (fsync(fd)) {
-			perror("fsync");
-			printf("aborting\n");
-			exit(1);
-		}
-	}
-	unlock_file_reader(curfile);
-	fhclose(fd, ft, fs);
-	*filesize_ret = filesize;
-	return iterations;
-}
-
-void ffsb_writefile(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_writefile_core(ft, fs, opnum, &filesize, 0);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-void ffsb_writefile_fsync(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_writefile_core(ft, fs, opnum, &filesize, 1);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-/* Shared core between ffsb_writeall and ffsb_writeall_fsync.*/
-
-static unsigned ffsb_writeall_core(ffsb_thread_t * ft, ffsb_fs_t * fs,
-				   unsigned opnum, uint64_t * filesize_ret,
-				   int fsync_file)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-	int fd;
-	uint64_t filesize;
-
-	char *buf = ft_getbuf(ft);
-	uint32_t write_blocksize = ft_get_write_blocksize(ft);
-	struct randdata *rd = ft_get_randdata(ft);
-
-	unsigned iterations = 0;
-
-	curfile = choose_file_reader(bf, rd);
-	fd = fhopenwrite(curfile->name, ft, fs);
-
-	filesize = ffsb_get_filesize(curfile->name);
-	iterations = writefile_helper(fd, filesize, write_blocksize, buf,
-				      ft, fs);
-	if (fsync_file)
-		if (fsync(fd)) {
-			perror("fsync");
-			printf("aborting\n");
-			exit(1);
-		}
-
-	unlock_file_reader(curfile);
-	fhclose(fd, ft, fs);
-	*filesize_ret = filesize;
-	return iterations;
-}
-
-/* Just like ffsb_writefile but we write the whole file from start to
- * finish regardless of file size
- */
-void ffsb_writeall(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_writeall_core(ft, fs, opnum, &filesize, 0);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-void ffsb_writeall_fsync(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_writeall_core(ft, fs, opnum, &filesize, 1);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-static unsigned ffsb_appendfile_core(ffsb_thread_t * ft, ffsb_fs_t * fs,
-				     unsigned opnum, uint64_t * filesize_ret,
-				     int fsync_file)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile;
-
-	int fd;
-
-	char *buf = ft_getbuf(ft);
-	uint32_t write_size = ft_get_write_size(ft);
-	uint32_t write_blocksize = ft_get_write_blocksize(ft);
-	struct randdata *rd = ft_get_randdata(ft);
-	unsigned iterations = 0;
-
-	curfile = choose_file_reader(bf, rd);
-	fd = fhopenappend(curfile->name, ft, fs);
-
-	unlock_file_reader(curfile);
-
-	curfile->size += (uint64_t) write_size;
-
-	iterations = writefile_helper(fd, write_size, write_blocksize, buf,
-				      ft, fs);
-	if (fsync_file)
-		if (fsync(fd)) {
-			perror("fsync");
-			printf("aborting\n");
-			exit(1);
-		}
-
-	fhclose(fd, ft, fs);
-	*filesize_ret = write_size;
-	return iterations;
-}
-
-void ffsb_appendfile(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_appendfile_core(ft, fs, opnum, &filesize, 0);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-void ffsb_appendfile_fsync(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_appendfile_core(ft, fs, opnum, &filesize, 1);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-static unsigned ffsb_createfile_core(ffsb_thread_t * ft, ffsb_fs_t * fs,
-				     unsigned opnum, uint64_t * filesize_ret,
-				     int fsync_file)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *newfile = NULL;
-
-	int fd;
-	uint64_t size;
-
-	char *buf = ft_getbuf(ft);
-	uint32_t write_blocksize = ft_get_write_blocksize(ft);
-	struct randdata *rd = ft_get_randdata(ft);
-	unsigned iterations = 0;
-
-	if (fs->num_weights) {
-		int num = 1 + getrandom(rd, fs->sum_weights);
-		int curop = 0;
-
-		while (fs->size_weights[curop].weight < num) {
-			num -= fs->size_weights[curop].weight;
-			curop++;
-		}
-		size = fs->size_weights[curop].size;
-	} else {
-		uint64_t range =
-		    fs_get_max_filesize(fs) - fs_get_min_filesize(fs);
-		size = fs_get_min_filesize(fs);
-		if (range != 0)
-			size += getllrandom(rd, range);
-	}
-
-	newfile = add_file(bf, size, rd);
-	fd = fhopencreate(newfile->name, ft, fs);
-	iterations = writefile_helper(fd, size, write_blocksize, buf, ft, fs);
-
-	if (fsync_file)
-		if (fsync(fd)) {
-			perror("fsync");
-			printf("aborting\n");
-			exit(1);
-		}
-
-	fhclose(fd, ft, fs);
-	unlock_file_writer(newfile);
-	*filesize_ret = size;
-	return iterations;
-}
-
-void ffsb_createfile(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_createfile_core(ft, fs, opnum, &filesize, 0);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-void ffsb_createfile_fsync(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	unsigned iterations;
-	uint64_t filesize;
-
-	iterations = ffsb_createfile_core(ft, fs, opnum, &filesize, 1);
-	ft_incr_op(ft, opnum, iterations, filesize);
-	ft_add_writebytes(ft, filesize);
-}
-
-void ffsb_deletefile(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-	randdata_t *rd = ft_get_randdata(ft);
-	struct timeval start, end;
-	int need_stats = ft_needs_stats(ft, SYS_UNLINK) ||
-	    fs_needs_stats(fs, SYS_UNLINK);
-
-	curfile = choose_file_writer(bf, rd);
-	remove_file(bf, curfile);
-
-	if (need_stats)
-		gettimeofday(&start, NULL);
-
-	if (unlink(curfile->name) == -1) {
-		printf("error deleting %s in deletefile\n", curfile->name);
-		perror("deletefile");
-		exit(0);
-	}
-
-	if (need_stats) {
-		gettimeofday(&end, NULL);
-		do_stats(&start, &end, ft, fs, SYS_UNLINK);
-	}
-
-	rw_unlock_write(&curfile->lock);
-
-	ft_incr_op(ft, opnum, 1, 0);
-}
-
-void ffsb_open_close(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-	randdata_t *rd = ft_get_randdata(ft);
-	int fd;
-
-	curfile = choose_file_reader(bf, rd);
-	fd = fhopenread(curfile->name, ft, fs);
-	fhclose(fd, ft, fs);
-	unlock_file_reader(curfile);
-	ft_incr_op(ft, opnum, 1, 0);
-}
-
-void ffsb_stat(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *curfile = NULL;
-	randdata_t *rd = ft_get_randdata(ft);
-
-	curfile = choose_file_reader(bf, rd);
-	fhstat(curfile->name, ft, fs);
-	unlock_file_reader(curfile);
-
-	ft_incr_op(ft, opnum, 1, 0);
-}
diff --git a/utils/ffsb-6.0-rc2/fileops.h b/utils/ffsb-6.0-rc2/fileops.h
deleted file mode 100644
index f15f79b..0000000
--- a/utils/ffsb-6.0-rc2/fileops.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _FILEOPS_H_
-#define _FILEOPS_H_
-
-#include "ffsb_thread.h"
-#include "ffsb.h"
-#include "ffsb_op.h"
-#include "ffsb_fs.h"
-
-void ffsb_readfile(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_readall(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_writefile(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_writefile_fsync(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_writeall(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_writeall_fsync(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_createfile(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_createfile_fsync(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_deletefile(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_appendfile(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_appendfile_fsync(ffsb_thread_t *tconfig, ffsb_fs_t *, unsigned opnum);
-void ffsb_stat(ffsb_thread_t *ft, ffsb_fs_t *fs, unsigned opnum);
-void ffsb_open_close(ffsb_thread_t *ft, ffsb_fs_t *fs, unsigned opnum);
-
-struct ffsb_op_results;
-
-void ffsb_read_print_exl(struct ffsb_op_results *, double secs, unsigned op_num);
-void ffsb_write_print_exl(struct ffsb_op_results *, double secs, unsigned op_num);
-void ffsb_create_print_exl(struct ffsb_op_results *, double secs, unsigned op_num);
-void ffsb_append_print_exl(struct ffsb_op_results *, double secs, unsigned op_num);
-
-/* Set up ops for either aging or benchmarking */
-void fop_bench(ffsb_fs_t *fs, unsigned opnum);
-void fop_age(ffsb_fs_t *fs, unsigned opnum);
-
-#endif /* _FILEOPS_H_ */
diff --git a/utils/ffsb-6.0-rc2/install-sh b/utils/ffsb-6.0-rc2/install-sh
deleted file mode 100755
index 4b1cd95..0000000
--- a/utils/ffsb-6.0-rc2/install-sh
+++ /dev/null
@@ -1,250 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd="$cpprog"
-	    shift
-	    continue;;
-
-	-d) dir_arg=true
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd="$stripprog"
-	    shift
-	    continue;;
-
-	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-	    shift
-	    continue;;
-
-	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-	    shift
-	    continue;;
-
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		# this colon is to work around a 386BSD /bin/sh bug
-		:
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-	echo "install:	no input file specified"
-	exit 1
-else
-	true
-fi
-
-if [ x"$dir_arg" != x ]; then
-	dst=$src
-	src=""
-
-	if [ -d $dst ]; then
-		instcmd=:
-		chmodcmd=""
-	else
-		instcmd=mkdir
-	fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
-	if [ -f $src -o -d $src ]
-	then
-		true
-	else
-		echo "install:  $src does not exist"
-		exit 1
-	fi
-
-	if [ x"$dst" = x ]
-	then
-		echo "install:	no destination specified"
-		exit 1
-	else
-		true
-	fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-	if [ -d $dst ]
-	then
-		dst="$dst"/`basename $src`
-	else
-		true
-	fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS=''
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-	pathcomp="${pathcomp}${1}"
-	shift
-
-	if [ ! -d "${pathcomp}" ] ;
-        then
-		$mkdirprog "${pathcomp}"
-	else
-		true
-	fi
-
-	pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-	$doit $instcmd $dst &&
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-	if [ x"$transformarg" = x ]
-	then
-		dstfile=`basename $dst`
-	else
-		dstfile=`basename $dst $transformbasename |
-			sed $transformarg`$transformbasename
-	fi
-
-# don't allow the sed command to completely eliminate the filename
-
-	if [ x"$dstfile" = x ]
-	then
-		dstfile=`basename $dst`
-	else
-		true
-	fi
-
-# Make a temp file name in the proper directory.
-
-	dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
-	$doit $instcmd $src $dsttmp &&
-
-	trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
-	$doit $rmcmd -f $dstdir/$dstfile &&
-	$doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/utils/ffsb-6.0-rc2/list.c b/utils/ffsb-6.0-rc2/list.c
deleted file mode 100644
index eeed81f..0000000
--- a/utils/ffsb-6.0-rc2/list.c
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/*
- * Simple list implementation mostly take from the Linux Kernel
- */
-
-#include <stdlib.h>
-#include "list.h"
-
-void INIT_LIST_HEAD(struct list_head *list)
-{
-	list->next = list;
-	list->prev = list;
-}
-
-void __list_add(struct list_head *new,
-		struct list_head *prev, struct list_head *next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-void __list_del(struct list_head *prev, struct list_head *next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-void list_add(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head, head->next);
-}
-
-void list_add_tail(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head->prev, head);
-}
-
-void list_del(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	entry->next = NULL;
-	entry->prev = NULL;
-}
-
-void list_replace(struct list_head *old, struct list_head *new)
-{
-	new->next = old->next;
-	new->next->prev = new;
-	new->prev = old->prev;
-	new->prev->next = new;
-}
diff --git a/utils/ffsb-6.0-rc2/list.h b/utils/ffsb-6.0-rc2/list.h
deleted file mode 100644
index e14709d..0000000
--- a/utils/ffsb-6.0-rc2/list.h
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/*
- * Simple list implementation mostly take from the Linux Kernel
- */
-
-#ifndef _LIST_H_
-#define _LIST_H_
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-void INIT_LIST_HEAD(struct list_head *list);
-void __list_add(struct list_head *new, struct list_head *prev,
-		struct list_head *next);
-void __list_del(struct list_head *prev, struct list_head *next);
-void list_add(struct list_head *new, struct list_head *head);
-void list_add_tail(struct list_head *new, struct list_head *head);
-void list_del(struct list_head *entry);
-void list_replace(struct list_head *old, struct list_head *new);
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)
-
-#define list_for_each(pos, head) \
-	for (pos = (head)->next; pos->next, pos != (head); pos = pos->next)
-
-#define offsetof(type, member) ((int) &((type *)0)->member)
-
-#define container_of(ptr, type, member) ({ \
-	const typeof(((type *)0)->member) *__mptr = (ptr); \
-	(type *)((char *)__mptr - offsetof(type, member)); })
-
-#define list_entry(ptr, type, member) \
-	container_of(ptr, type, member)
-
-#define list_for_each_entry(pos, head, member) \
-	for (pos = list_entry((head)->next, typeof(*pos), member);	\
-	     pos->member.next, &pos->member != (head); 	\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-#define list_for_each_entry_safe(pos, n, head, member)			\
-	for (pos = list_entry((head)->next, typeof(*pos), member),	\
-		n = list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
-
-#define list_for_each_safe(pos, n, head) \
-	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, n = pos->next)
-
-#endif
diff --git a/utils/ffsb-6.0-rc2/main.c b/utils/ffsb-6.0-rc2/main.c
deleted file mode 100644
index b3c68b4..0000000
--- a/utils/ffsb-6.0-rc2/main.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <pthread.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-#include <assert.h>
-
-#include "config.h"
-
-#include "ffsb.h"
-#include "util.h"
-#include "parser.h"
-
-/* State information for the polling function below */
-struct ffsb_time_poll {
-	struct timeval starttime;
-	int wait_time;
-};
-
-/* This is the polling function used by the threadgroups to check
- * elapsed time, when it returns 1 they know it is time to stop
- */
-static int ffsb_poll_fn(void *ptr)
-{
-	struct ffsb_time_poll *data = (struct ffsb_time_poll *)ptr;
-	struct timeval curtime, difftime;
-	gettimeofday(&curtime, NULL);
-
-	timersub(&curtime, &data->starttime, &difftime);
-	if (difftime.tv_sec >= data->wait_time)
-		return 1;
-	return 0;
-}
-
-int main(int argc, char *argv[])
-{
-	int i;
-	ffsb_config_t fc;
-	ffsb_barrier_t thread_barrier, tg_barrier;
-	tg_run_params_t *params;
-	struct ffsb_time_poll pdata;
-	struct timeval starttime, endtime, difftime;
-	pthread_attr_t attr;
-	ffsb_op_results_t total_results;
-	double totaltime = 0.0f, usertime = 0.0f, systime = 0.0f;
-	struct rusage before_self, before_children, after_self, after_children;
-	pthread_t *fs_pts;	/* threads to do filesystem creates in parallel */
-	char *callout = NULL;
-
-	char ctime_start_buf[32];
-	char ctime_end_buf[32];
-
-	memset(&before_self, 0, sizeof(before_self));
-	memset(&before_children, 0, sizeof(before_children));
-	memset(&after_self, 0, sizeof(after_self));
-	memset(&after_children, 0, sizeof(after_children));
-
-	ffsb_unbuffer_stdout();
-
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <config file>\n", argv[0]);
-		exit(1);
-	}
-
-	/* VERSION comes from config.h (which is autogenerated by autoconf) */
-	printf("FFSB version %s started\n\n", VERSION);
-
-	ffsb_parse_newconfig(&fc, argv[1]);
-	pdata.wait_time = fc.time;
-
-	if (fc.time)
-		printf("benchmark time = %u\n", fc.time);
-	else
-		printf("Only creating the fileset, not running benchmark.\n");
-
-	pthread_attr_init(&attr);
-	pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
-
-	for (i = 0; i < fc.num_threadgroups; i++)
-		tg_print_config(&fc.groups[i]);
-
-	fs_pts = ffsb_malloc(sizeof(pthread_t) * fc.num_filesys);
-
-	gettimeofday(&starttime, NULL);
-	for (i = 0; i < fc.num_filesys; i++) {
-		fs_print_config(&fc.filesystems[i]);
-		pthread_create(fs_pts + i, &attr, construct_ffsb_fs,
-			       &fc.filesystems[i]);
-	}
-
-	fflush(stdout);
-	for (i = 0; i < fc.num_filesys; i++)
-		pthread_join(fs_pts[i], NULL);
-
-	gettimeofday(&endtime, NULL);
-	timersub(&endtime, &starttime, &difftime);
-	printf("fs setup took %ld secs\n", difftime.tv_sec);
-	free(fs_pts);
-
-	if (fc.time == 0) {
-		printf("Setup complete, exiting\n");
-		return 0;
-	}
-
-	params = ffsb_malloc(sizeof(tg_run_params_t) * fc.num_threadgroups);
-
-	init_ffsb_op_results(&total_results);
-	ffsb_barrier_init(&thread_barrier, fc.num_totalthreads);
-	ffsb_barrier_init(&tg_barrier, fc.num_threadgroups + 1);
-
-	ffsb_sync();
-
-	/* Execute the callout if any and wait for it to return */
-	callout = fc_get_callout(&fc);
-	if (callout) {
-		printf("executing callout: \n %s\n", callout);
-		if (ffsb_system(callout) < 0) {
-			perror("system");
-			exit(1);
-		}
-	}
-
-	/* Spawn all of the threadgroup master threads */
-	for (i = 0; i < fc.num_threadgroups; i++) {
-		params[i].tg = &fc.groups[i];
-		params[i].fc = &fc;
-		params[i].poll_fn = ffsb_poll_fn;
-		params[i].poll_data = &pdata;
-		params[i].wait_time = FFSB_TG_WAIT_TIME;
-		params[i].tg_barrier = &tg_barrier;
-		params[i].thread_barrier = &thread_barrier;
-
-		pthread_create(&params[i].pt, &attr, tg_run, &params[i]);
-	}
-
-	ffsb_getrusage(&before_self, &before_children);
-	gettimeofday(&pdata.starttime, NULL);
-
-	ffsb_barrier_wait(&tg_barrier);	/* sync with tg's to start */
-	printf("Starting Actual Benchmark At: %s\n",
-	       ctime_r(&pdata.starttime.tv_sec, ctime_start_buf));
-	fflush(stdout);
-
-	/* Wait for all of the threadgroup master threads to finish */
-	for (i = 0; i < fc.num_threadgroups; i++)
-		pthread_join(params[i].pt, NULL);
-
-	ffsb_sync();
-	gettimeofday(&endtime, NULL);
-	ffsb_getrusage(&after_self, &after_children);
-
-	printf("FFSB benchmark finished   at: %s\n",
-	       ctime_r(&endtime.tv_sec, ctime_end_buf));
-	printf("Results:\n");
-	fflush(stdout);
-
-	timersub(&endtime, &pdata.starttime, &difftime);
-
-	totaltime = tvtodouble(&difftime);
-
-	printf("Benchmark took %.2lf sec\n", totaltime);
-	printf("\n");
-
-	for (i = 0; i < fc.num_threadgroups; i++) {
-		struct ffsb_op_results tg_results;
-		ffsb_tg_t *tg = fc.groups + i;
-
-		init_ffsb_op_results(&tg_results);
-
-		/* Grab the individual tg results */
-		tg_collect_results(tg, &tg_results);
-
-		if (fc.num_threadgroups == 1)
-			printf("Total Results\n");
-		else
-			printf("ThreadGroup %d\n", i);
-
-		printf("===============\n");
-		print_results(&tg_results, totaltime);
-
-		if (tg_needs_stats(tg)) {
-			ffsb_statsd_t fsd;
-			tg_collect_stats(tg, &fsd);
-			ffsb_statsd_print(&fsd);
-		}
-		printf("\n");
-
-		/* Add the tg results to the total */
-		tg_collect_results(&fc.groups[i], &total_results);
-	}
-
-	if (fc.num_threadgroups > 1) {
-		printf("Total Results\n");
-		printf("===============\n");
-		print_results(&total_results, totaltime);
-	}
-#define USEC_PER_SEC ((double)(1000000.0f))
-
-	/* sum up self and children after */
-	usertime = (after_self.ru_utime.tv_sec +
-		    ((after_self.ru_utime.tv_usec) / USEC_PER_SEC)) +
-	    ((after_children.ru_utime.tv_sec +
-	      ((after_children.ru_utime.tv_usec) / USEC_PER_SEC)));
-
-	/* subtract away the before */
-	usertime -= (before_self.ru_utime.tv_sec +
-		     ((before_self.ru_utime.tv_usec) / USEC_PER_SEC)) +
-	    ((before_children.ru_utime.tv_sec +
-	      ((before_children.ru_utime.tv_usec) / USEC_PER_SEC)));
-
-	/* sum up self and children after */
-	systime = (after_self.ru_stime.tv_sec +
-		   ((after_self.ru_stime.tv_usec) / USEC_PER_SEC)) +
-	    ((after_children.ru_stime.tv_sec +
-	      ((after_children.ru_stime.tv_usec) / USEC_PER_SEC)));
-
-	/* subtract away the before */
-	systime -= (before_self.ru_stime.tv_sec +
-		    ((before_self.ru_stime.tv_usec) / USEC_PER_SEC)) +
-	    ((before_children.ru_stime.tv_sec +
-	      ((before_children.ru_stime.tv_usec) / USEC_PER_SEC)));
-
-	printf("\n\n");
-	printf("%.1lf%% User   Time\n", 100 * usertime / totaltime);
-	printf("%.1lf%% System Time\n", 100 * systime / totaltime);
-	printf("%.1f%% CPU Utilization\n", 100 * (usertime + systime) /
-	       totaltime);
-	free(params);
-	destroy_ffsb_config(&fc);
-
-	return 0;
-}
diff --git a/utils/ffsb-6.0-rc2/metaops.c b/utils/ffsb-6.0-rc2/metaops.c
deleted file mode 100644
index 954cddd..0000000
--- a/utils/ffsb-6.0-rc2/metaops.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "ffsb.h"
-#include "metaops.h"
-#include "rand.h"
-#include "filelist.h"
-
-/* metaops:
- *  createdir
- *  removedir
- *  renamedir
- *  renamefile
- */
-
-void metaops_metadir(ffsb_fs_t * fs, unsigned opnum)
-{
-	fs_set_opdata(fs, fs_get_metafiles(fs), opnum);
-}
-
-static void createdir(struct benchfiles *dirs, randdata_t * rd)
-{
-	struct ffsb_file *newdir;
-
-	newdir = add_file(dirs, 0, rd);
-	if (mkdir(newdir->name, S_IRWXU) < 0) {
-		perror("mkdir");
-		exit(1);
-	}
-	unlock_file_writer(newdir);
-}
-
-static void removedir(struct benchfiles *dirs, randdata_t * rd)
-{
-	struct ffsb_file *deldir;
-
-	deldir = choose_file_writer(dirs, rd);
-	remove_file(dirs, deldir);
-
-	if (rmdir(deldir->name) < 0) {
-		perror("rmdir");
-		exit(1);
-	}
-	unlock_file_writer(deldir);
-}
-
-static void renamedir(struct benchfiles *dirs, randdata_t * rd)
-{
-	struct ffsb_file *dir;
-	char *oldname;
-
-	dir = choose_file_writer(dirs, rd);
-	oldname = dir->name;
-	rename_file(dir);
-
-	if (rename(oldname, dir->name) < 0) {
-		perror("rename");
-		exit(1);
-	}
-	unlock_file_writer(dir);
-	free(oldname);
-}
-
-void ffsb_metaops(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	randdata_t *rd = ft_get_randdata(ft);
-
-	createdir(bf, rd);
-	createdir(bf, rd);
-	removedir(bf, rd);
-	renamedir(bf, rd);
-
-	ft_incr_op(ft, opnum, 1, 0);
-}
-
-void ffsb_createdir(ffsb_thread_t * ft, ffsb_fs_t * fs, unsigned opnum)
-{
-	struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
-	struct ffsb_file *newdir;
-	randdata_t *rd = ft_get_randdata(ft);
-
-	newdir = add_dir(bf, 0, rd);
-	if (mkdir(newdir->name, S_IRWXU) < 0) {
-		perror("mkdir");
-		exit(1);
-	}
-	unlock_file_writer(newdir);
-
-	ft_incr_op(ft, opnum, 1, 0);
-}
diff --git a/utils/ffsb-6.0-rc2/metaops.h b/utils/ffsb-6.0-rc2/metaops.h
deleted file mode 100644
index 3f81e4f..0000000
--- a/utils/ffsb-6.0-rc2/metaops.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _METAOPS_H_
-#define _METAOPS_H_
-
-#include "ffsb.h"
-#include "fileops.h"
-
-void ffsb_metaops(struct ffsb_thread *, ffsb_fs_t *, unsigned);
-void ffsb_createdir(struct ffsb_thread *, ffsb_fs_t *, unsigned);
-void metaops_metadir(ffsb_fs_t *, unsigned);
-
-#endif /* _METAOPS_H_ */
diff --git a/utils/ffsb-6.0-rc2/missing b/utils/ffsb-6.0-rc2/missing
deleted file mode 100755
index 6a37006..0000000
--- a/utils/ffsb-6.0-rc2/missing
+++ /dev/null
@@ -1,336 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-case "$1" in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing 0.4 - GNU automake"
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-  aclocal*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case "$f" in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
-         system.  You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison|yacc)
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-	case "$LASTARG" in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if [ -f "$SRCFILE" ]; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if [ -f "$SRCFILE" ]; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if [ ! -f y.tab.h ]; then
-	echo >y.tab.h
-    fi
-    if [ ! -f y.tab.c ]; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex|flex)
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-	case "$LASTARG" in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if [ -f "$SRCFILE" ]; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if [ ! -f lex.yy.c ]; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit 1
-    fi
-    ;;
-
-  makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
-    echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
-    fi
-    touch $file
-    ;;
-
-  tar)
-    shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case "$firstarg" in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case "$firstarg" in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
-         system.  You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequirements for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
diff --git a/utils/ffsb-6.0-rc2/mkinstalldirs b/utils/ffsb-6.0-rc2/mkinstalldirs
deleted file mode 100755
index 1790da1..0000000
--- a/utils/ffsb-6.0-rc2/mkinstalldirs
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain
-
-# $Id: mkinstalldirs,v 1.1 2009/10/26 11:25:55 subrata_modak Exp $
-
-errstatus=0
-
-for file
-do
-   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-   shift
-
-   pathcomp=
-   for d
-   do
-     pathcomp="$pathcomp$d"
-     case "$pathcomp" in
-       -* ) pathcomp=./$pathcomp ;;
-     esac
-
-     if test ! -d "$pathcomp"; then
-        echo "mkdir $pathcomp"
-
-        mkdir "$pathcomp" || lasterr=$?
-
-        if test ! -d "$pathcomp"; then
-  	  errstatus=$lasterr
-        fi
-     fi
-
-     pathcomp="$pathcomp/"
-   done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
diff --git a/utils/ffsb-6.0-rc2/parser.c b/utils/ffsb-6.0-rc2/parser.c
deleted file mode 100644
index 7ec3d73..0000000
--- a/utils/ffsb-6.0-rc2/parser.c
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include "ffsb.h"
-#include "parser.h"
-#include "ffsb_tg.h"
-#include "ffsb_stats.h"
-#include "util.h"
-#include "list.h"
-
-#define BUFSIZE 1024
-
-config_options_t global_options[] = GLOBAL_OPTIONS;
-config_options_t tg_options[] = THREADGROUP_OPTIONS;
-config_options_t fs_options[] = FILESYSTEM_OPTIONS;
-config_options_t stats_options[] = STATS_OPTIONS;
-container_desc_t container_desc[] = CONTAINER_DESC;
-
-/* strips out whitespace and comments, returns NULL on eof */
-void parseerror(char *msg)
-{
-	fprintf(stderr, "Error parsing %s\n", msg);
-	exit(1);
-}
-
-static char *get_next_line(FILE * f)
-{
-	static char buf[BUFSIZE];
-	char *ret, *tmp;
-	int flag = 1;
-	while (flag) {
-		ret = fgets(buf, BUFSIZE, f);
-		if (ret == NULL)
-			return NULL;
-		ret = buf;
-		while (isspace(*ret))
-			ret++;
-
-		if ((*ret == COMMENT_CHAR) || (*ret == '\0'))
-			continue;
-
-		tmp = ret;
-		while (*tmp != '\0') {
-			if (*tmp == COMMENT_CHAR) {
-				*tmp = '\0';
-				break;
-			}
-			tmp++;
-		}
-		flag = 0;
-	}
-	return ret;
-}
-
-static char *strip_space(char *buf)
-{
-	int len;
-	char *tmp, *tmp2;
-	int flag = 1;
-
-	len = strnlen(buf, BUFSIZE);
-	tmp = malloc(sizeof(char) * len);
-	memset(tmp, 0, sizeof(char) * len);
-	tmp2 = tmp;
-	while (flag) {
-		if (!isspace(*buf)) {
-			*tmp = *buf;
-			tmp++;
-		}
-		buf++;
-		if (*buf != '\0')
-			continue;
-		flag = 0;
-	}
-	return tmp2;
-}
-
-static uint64_t size64_convert(char *buf)
-{
-	size_t buf_size = strlen(buf);
-	char unit[3] = { 0 };
-	char search_str[256];
-	uint64_t size;
-	uint64_t multiplier = 1;
-	int i;
-
-	if (buf_size == 1)
-		goto out;
-
-	strcpy(unit, buf + (buf_size - 2));
-	for (i = 0; i < 2; i++) {
-		if (isdigit(unit[i]))
-			goto try_single;
-		unit[i] = toupper(unit[i]);
-	}
-	goto do_multiplier;
-
-try_single:
-	memset(unit, 0, sizeof(unit));
-	strcpy(unit, buf + (buf_size - 1));
-	if (isdigit(unit[0])) {
-		unit[0] = 0;
-		goto out;
-	}
-	unit[0] = toupper(unit[0]);
-
-do_multiplier:
-	if (!strcmp("KB", unit) || !strcmp("K", unit))
-		multiplier = 1024;
-	if (!strcmp("MB", unit) || !strcmp("M", unit))
-		multiplier = 1048576;
-	if (!strcmp("GB", unit) || !strcmp("G", unit))
-		multiplier = 1073741824;
-	if (multiplier == 1) {
-		unit[0] = 0;
-		multiplier = 0;
-	}
-out:
-	sprintf(search_str, "%%llu%s", unit);
-	if (1 == sscanf(buf, search_str, &size))
-		return size * multiplier;
-	return 0;
-}
-
-static uint64_t *get_opt64(char *buf, char string[])
-{
-	char search_str[256];
-	char *line = strip_space(buf);
-	uint64_t temp;
-	uint64_t *ret;
-
-	sprintf(search_str, "%s=%%llu\\n", string);
-	if (1 == sscanf(line, search_str, &temp)) {
-		ret = malloc(sizeof(uint64_t));
-		*ret = temp;
-		return ret;
-	}
-	free(line);
-	return NULL;
-}
-
-static uint32_t *get_opt32(char *buf, char string[])
-{
-	uint32_t *ret;
-	uint64_t *res;
-	res = get_opt64(buf, string);
-	if (res) {
-		ret = malloc(sizeof(uint32_t));
-		*ret = *res;
-		free(res);
-		return ret;
-	}
-	return NULL;
-}
-
-static uint8_t *get_optbool(char *buf, char string[])
-{
-	uint8_t *ret;
-	uint64_t *res;
-	res = get_opt64(buf, string);
-	if (res) {
-		if ((int)*res < 0 || (int)*res > 1) {
-			printf("Error in: %s", buf);
-			printf("%llu not boolean\n", (long long unsigned)*res);
-			exit(1);
-		}
-		ret = malloc(sizeof(uint8_t));
-		*ret = *res;
-		free(res);
-		return ret;
-	}
-	return NULL;
-}
-
-static char *get_optstr(char *buf, char string[])
-{
-	char search_str[256];
-	char *line = strip_space(buf);
-	char *ret_buf;
-	char temp[BUFSIZE];
-	int len;
-
-	len = strnlen(string, BUFSIZE);
-	sprintf(search_str, "%s=%%%ds\\n", string, BUFSIZE - len - 1);
-	if (1 == sscanf(line, search_str, &temp)) {
-		len = strnlen(temp, 4096);
-		ret_buf = malloc(len);
-		strncpy(ret_buf, temp, len);
-		return ret_buf;
-	}
-	free(line);
-	return NULL;
-}
-
-static double *get_optdouble(char *buf, char string[])
-{
-	char search_str[256];
-	char *line = strip_space(buf);
-	double temp;
-	double *ret;
-
-	sprintf(search_str, "%s=%%lf\\n", string);
-	if (1 == sscanf(line, search_str, &temp)) {
-		ret = malloc(sizeof(double));
-		*ret = temp;
-		return ret;
-	}
-	free(line);
-	return NULL;
-}
-
-static range_t *get_optrange(char *buf, char string[])
-{
-	char search_str[256];
-	double a, b;
-	range_t *ret;
-
-	sprintf(search_str, "%s %%lf %%lf\\n", string);
-	if (2 == sscanf(buf, search_str, &a, &b)) {
-		ret = malloc(sizeof(struct range));
-		ret->a = a;
-		ret->b = b;
-		return ret;
-	}
-	return NULL;
-}
-
-static size_weight_t *get_optsizeweight(char *buf, char string[])
-{
-	char search_str[256];
-	char size[256];
-	int weight;
-	size_weight_t *ret;
-
-	sprintf(search_str, "%s %%s %%d\\n", string);
-	if (2 == sscanf(buf, search_str, &size, &weight)) {
-		ret = malloc(sizeof(struct size_weight));
-		ret->size = size64_convert(size);
-		ret->weight = weight;
-		return ret;
-	}
-	return NULL;
-}
-
-static uint64_t *get_optsize64(char *buf, char string[])
-{
-	char search_str[256];
-	char *line = strip_space(buf);
-	char temp[256];
-	uint64_t size;
-	uint64_t *ret = NULL;
-
-	sprintf(search_str, "%s=%%s\\n", string);
-	if (1 == sscanf(line, search_str, &temp)) {
-		ret = malloc(sizeof(uint64_t));
-		*ret = size64_convert(temp);
-	}
-	free(line);
-	return ret;
-}
-
-static uint32_t *get_optsize32(char *buf, char string[])
-{
-	uint32_t *ret;
-	uint64_t *res;
-	res = get_optsize64(buf, string);
-	if (res) {
-		ret = malloc(sizeof(uint32_t));
-		*ret = *res;
-		free(res);
-		return ret;
-	}
-	return NULL;
-}
-
-static uint64_t *get_deprecated(char *buf, char string[])
-{
-	char search_str[256];
-	char temp[BUFSIZE];
-	int len;
-
-	len = strnlen(string, BUFSIZE);
-	sprintf(search_str, "%s%%%ds\\n", string, BUFSIZE - len - 1);
-	if (1 == sscanf(buf, search_str, &temp))
-		printf("WARNING: The \"%s\" option is deprecated!!!\n", string);
-
-	return NULL;
-}
-
-static container_t *init_container(void)
-{
-	container_t *container;
-	container = malloc(sizeof(container_t));
-	container->config = NULL;
-	container->type = 0;
-	container->next = NULL;
-	return container;
-}
-
-static int set_option(char *buf, config_options_t * options)
-{
-	void *value;
-
-	while (options->name) {
-		switch (options->type) {
-		case TYPE_WEIGHT:
-		case TYPE_U32:
-			value = get_opt32(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_U64:
-			value = get_opt64(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_STRING:
-			value = get_optstr(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_BOOLEAN:
-			value = get_optbool(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_DOUBLE:
-			value = get_optdouble(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_RANGE:
-			value = get_optrange(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_SIZEWEIGHT:
-			value = get_optsizeweight(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_DEPRECATED:
-			value = get_deprecated(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_SIZE32:
-			value = get_optsize32(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		case TYPE_SIZE64:
-			value = get_optsize64(buf, options->name);
-			if (value)
-				goto out;
-			break;
-		default:
-			printf("Unknown type\n");
-			break;
-		}
-		options++;
-	}
-	return 0;
-
-out:
-	if (options->storage_type == STORE_SINGLE)
-		options->value = value;
-	if (options->storage_type == STORE_LIST) {
-		if (!options->value) {
-			value_list_t *lhead;
-			lhead = malloc(sizeof(struct value_list));
-			INIT_LIST_HEAD(&lhead->list);
-			options->value = lhead;
-		}
-		value_list_t *tmp_list, *tmp_list2;
-		tmp_list = malloc(sizeof(struct value_list));
-		INIT_LIST_HEAD(&tmp_list->list);
-		tmp_list->value = value;
-		tmp_list2 = (struct value_list *)options->value;
-		list_add(&(tmp_list->list), &(tmp_list2->list));
-	}
-
-	return 1;
-}
-
-void insert_container(container_t * container, container_t * new_container)
-{
-	while (container->next)
-		container = container->next;
-	container->next = new_container;
-}
-
-container_t *search_group(char *, FILE *);
-
-container_t *handle_container(char *buf, FILE * f, uint32_t type,
-			      config_options_t * options)
-{
-	container_desc_t *desc = container_desc;
-	container_t *ret_container;
-	container_t *tmp_container, *tmp2_container;
-	container_t *child = NULL;
-	int is_option;
-
-	while (desc->name)
-		if (desc->type == type)
-			break;
-		else
-			desc++;
-
-	if (!desc->name)
-		return NULL;
-
-	buf = get_next_line(f);
-	while (buf) {
-		is_option = set_option(buf, options);
-		tmp_container = search_group(buf, f);
-		if (tmp_container) {
-			if (tmp_container->type == END) {
-				free(tmp_container);
-				break;
-			} else {
-				if (child == NULL)
-					child = tmp_container;
-				else {
-					tmp2_container = child;
-					while (tmp2_container->next)
-						tmp2_container =
-						    tmp2_container->next;
-					tmp2_container->next = tmp_container;
-				}
-
-			}
-		}
-		if (!is_option && !tmp_container) {
-			printf("ERROR!!! Unknow option: %s", buf);
-			exit(1);
-		}
-		buf = get_next_line(f);
-	}
-	ret_container = init_container();
-	ret_container->config = options;
-	ret_container->type = type;
-	if (child)
-		ret_container->child = child;
-
-	return ret_container;
-}
-
-container_t *search_group(char *buf, FILE * f)
-{
-	char temp[BUFSIZE];
-	char *ptr;
-	config_options_t *options;
-	container_desc_t *desc = container_desc;
-	container_t *ret_container;
-
-	if (1 == sscanf(buf, "[%s]\n", (char *)&temp))
-		while (desc->name) {
-			ptr = strstr(buf, desc->name);
-			if (ptr)
-				switch (desc->type) {
-				case FILESYSTEM:
-					options = malloc(sizeof(fs_options));
-					memcpy(options, fs_options,
-					       sizeof(fs_options));
-					return handle_container(buf, f,
-								desc->type,
-								options);
-					break;
-				case THREAD_GROUP:
-					options = malloc(sizeof(tg_options));
-					memcpy(options, tg_options,
-					       sizeof(tg_options));
-					return handle_container(buf, f,
-								desc->type,
-								options);
-					break;
-				case STATS:
-					options = malloc(sizeof(stats_options));
-					memcpy(options, stats_options,
-					       sizeof(stats_options));
-					return handle_container(buf, f,
-								desc->type,
-								options);
-					break;
-				case END:
-					ret_container = init_container();
-					ret_container->type = END;
-					return ret_container;
-					break;
-				}
-			desc++;
-		}
-	return NULL;
-}
-
-void *get_value(config_options_t * config, char *name)
-{
-	while (config->name) {
-		if (!strcmp(config->name, name)) {
-			if (config->value)
-				return config->value;
-			else
-				return NULL;
-		}
-		config++;
-	}
-	return 0;
-}
-
-char *get_config_str(config_options_t * config, char *name)
-{
-	return get_value(config, name);
-}
-
-uint32_t get_config_u32(config_options_t * config, char *name)
-{
-	void *value = get_value(config, name);
-	if (value)
-		return *(uint32_t *) value;
-	return 0;
-}
-
-uint8_t get_config_bool(config_options_t * config, char *name)
-{
-	void *value = get_value(config, name);
-	if (value)
-		return *(uint8_t *) value;
-	return 0;
-}
-
-uint64_t get_config_u64(config_options_t * config, char *name)
-{
-	void *value = get_value(config, name);
-	if (value)
-		return *(uint64_t *) value;
-	return 0;
-}
-
-double get_config_double(config_options_t * config, char *name)
-{
-	void *value = get_value(config, name);
-	if (value)
-		return *(double *)value;
-	return 0;
-}
-
-static profile_config_t *parse(FILE * f)
-{
-	char *buf;
-	profile_config_t *profile_conf;
-	container_t *tmp_container;
-
-	profile_conf = malloc(sizeof(profile_config_t));
-	profile_conf->global = malloc(sizeof(global_options));
-	memcpy(profile_conf->global, global_options, sizeof(global_options));
-	profile_conf->fs_container = NULL;
-	profile_conf->tg_container = NULL;
-	int is_option;
-	buf = get_next_line(f);
-
-	while (buf) {
-		is_option = set_option(buf, profile_conf->global);
-		tmp_container = search_group(buf, f);
-		if (tmp_container)
-			switch (tmp_container->type) {
-			case FILESYSTEM:
-				if (profile_conf->fs_container == NULL)
-					profile_conf->fs_container =
-					    tmp_container;
-				else
-					insert_container(profile_conf->
-							 fs_container,
-							 tmp_container);
-				break;
-			case THREAD_GROUP:
-				if (profile_conf->tg_container == NULL)
-					profile_conf->tg_container =
-					    tmp_container;
-				else
-					insert_container(profile_conf->
-							 tg_container,
-							 tmp_container);
-				break;
-			default:
-				break;
-			}
-		if (!is_option && !tmp_container) {
-			printf("ERROR!!! Unknow option: %s", buf);
-			exit(1);
-		}
-		buf = get_next_line(f);
-	}
-	return profile_conf;
-}
-
-void set_weight(ffsb_tg_t * tg, config_options_t * config)
-{
-	char *op;
-	int len;
-	config_options_t *tmp_config = config;
-
-	while (tmp_config->name) {
-		if (tmp_config->type == TYPE_WEIGHT) {
-			len = strlen(tmp_config->name);
-			op = malloc(sizeof(char) * len - 6);
-			memset(op, 0, sizeof(char) * len - 6);
-			strncpy(op, tmp_config->name, len - 7);
-			tg_set_op_weight(tg, op,
-					 get_config_u32(config,
-							tmp_config->name));
-			free(op);
-		}
-		tmp_config++;
-	}
-}
-
-int get_weight_total(ffsb_tg_t * tg)
-{
-	char *op;
-	int len;
-	int total = 0;
-	config_options_t *tmp_config = tg_options;
-
-	while (tmp_config->name) {
-		if (tmp_config->type == TYPE_WEIGHT) {
-			len = strlen(tmp_config->name);
-			op = malloc(sizeof(char) * len - 6);
-			memset(op, 0, sizeof(char) * len - 6);
-			strncpy(op, tmp_config->name, len - 7);
-			total += tg_get_op_weight(tg, op);
-			free(op);
-		}
-		tmp_config++;
-	}
-	return total;
-}
-
-/* !!! hackish verification function, we should somehow roll this into the */
-/* op descriptions/struct themselves at some point with a callback verify */
-/* op requirements: */
-/* require tg->read_blocksize:  read, readall */
-/* require tg->write_blocksize: write, create, append, rewritefsync */
-/* */
-
-static int verify_tg(ffsb_tg_t * tg)
-{
-	uint32_t read_weight = tg_get_op_weight(tg, "read");
-	uint32_t readall_weight = tg_get_op_weight(tg, "readall");
-	uint32_t write_weight = tg_get_op_weight(tg, "write");
-	uint32_t create_weight = tg_get_op_weight(tg, "create");
-	uint32_t append_weight = tg_get_op_weight(tg, "append");
-	uint32_t createdir_weight = tg_get_op_weight(tg, "createdir");
-	uint32_t delete_weight = tg_get_op_weight(tg, "delete");
-	uint32_t writeall_weight = tg_get_op_weight(tg, "writeall");
-	uint32_t writeall_fsync_weight = tg_get_op_weight(tg, "writeall_fsync");
-
-	uint32_t sum_weight = get_weight_total(tg);
-
-	uint32_t read_blocksize = tg_get_read_blocksize(tg);
-	uint32_t write_blocksize = tg_get_write_blocksize(tg);
-
-	int read_random = tg_get_read_random(tg);
-	int read_skip = tg_get_read_skip(tg);
-	uint32_t read_skipsize = tg_get_read_skipsize(tg);
-
-	if (sum_weight == 0) {
-		printf("Error: A threadgroup must have at least one weighted "
-		       "operation\n");
-		return 1;
-	}
-
-	if ((read_weight || readall_weight) && !(read_blocksize)) {
-		printf("Error: read and readall operations require a "
-		       "read_blocksize\n");
-		return 1;
-	}
-
-	if ((write_weight || create_weight || append_weight || writeall_weight
-	     || writeall_fsync_weight) && !(write_blocksize)) {
-		printf("Error: write, writeall, create, append"
-		       "operations require a write_blocksize\n");
-		return 1;
-	}
-
-	if (read_random && read_skip) {
-		printf("Error: read_random and read_skip are mutually "
-		       "exclusive\n");
-		return 1;
-	}
-
-	if (read_skip && !(read_skipsize)) {
-		printf("Error: read_skip specified but read_skipsize is "
-		       "zero\n");
-		return 1;
-	}
-
-	return 0;
-}
-
-static unsigned get_num_containers(container_t * container)
-{
-	int numtg = 0;
-	while (container) {
-		numtg++;
-		container = container->next;
-	}
-	return numtg;
-}
-
-static unsigned get_num_threadgroups(profile_config_t * profile_conf)
-{
-	return get_num_containers(profile_conf->tg_container);
-}
-
-static unsigned get_num_filesystems(profile_config_t * profile_conf)
-{
-	return get_num_containers(profile_conf->fs_container);
-}
-
-static int get_num_totalthreads(profile_config_t * profile_conf)
-{
-	int num_threads = 0;
-	container_t *tg = profile_conf->tg_container;
-	config_options_t *tg_config;
-
-	while (tg) {
-		tg_config = tg->config;
-		while (tg_config->name) {
-			if (!strcmp(tg_config->name, "num_threads"))
-				num_threads += *(uint32_t *) tg_config->value;
-			tg_config++;
-		}
-		if (tg->next)
-			tg = tg->next;
-		else
-			break;
-	}
-
-	return num_threads;
-}
-
-container_t *get_container(container_t * head_cont, int pos)
-{
-	int count = 0;
-	while (head_cont) {
-		if (count == pos)
-			return head_cont;
-		head_cont = head_cont->next;
-		count++;
-	}
-	return NULL;
-}
-
-config_options_t *get_fs_config(ffsb_config_t * fc, int pos)
-{
-	container_t *tmp_cont;
-
-	assert(pos < fc->num_filesys);
-	tmp_cont = get_container(fc->profile_conf->fs_container, pos);
-	if (tmp_cont)
-		return tmp_cont->config;
-	return NULL;
-}
-
-container_t *get_fs_container(ffsb_config_t * fc, int pos)
-{
-	assert(pos < fc->num_filesys);
-	return get_container(fc->profile_conf->fs_container, pos);
-}
-
-config_options_t *get_tg_config(ffsb_config_t * fc, int pos)
-{
-	container_t *tmp_cont;
-
-	assert(pos < fc->num_threadgroups);
-	tmp_cont = get_container(fc->profile_conf->tg_container, pos);
-	if (tmp_cont)
-		return tmp_cont->config;
-	return NULL;
-}
-
-container_t *get_tg_container(ffsb_config_t * fc, int pos)
-{
-	assert(pos < fc->num_threadgroups);
-	return get_container(fc->profile_conf->tg_container, pos);
-}
-
-static void init_threadgroup(ffsb_config_t * fc, config_options_t * config,
-			     ffsb_tg_t * tg, int tg_num)
-{
-	int num_threads;
-	memset(tg, 0, sizeof(ffsb_tg_t));
-
-	num_threads = get_config_u32(config, "num_threads");
-
-	init_ffsb_tg(tg, num_threads, tg_num);
-
-	if (get_config_str(config, "bindfs")) {
-		int i;
-		config_options_t *tmp_config;
-		for (i = 0; i < fc->num_filesys; i++) {
-			tmp_config = get_fs_config(fc, i);
-			if (!strcmp(get_config_str(config, "bindfs"),
-				    get_config_str(tmp_config, "location")))
-				break;
-		}
-		if (strcmp(get_config_str(config, "bindfs"),
-			   get_config_str(tmp_config, "location"))) {
-			printf("Bind fs failed:  Base fs \"%s\" not found\n",
-			       get_config_str(config, "bindfs"));
-			exit(1);
-		}
-		printf("%d\n", i);
-		tg->bindfs = i;
-	}
-
-	tg->read_random = get_config_bool(config, "read_random");
-	tg->read_size = get_config_u64(config, "read_size");
-	tg->read_skip = get_config_bool(config, "read_skip");
-	tg->read_skipsize = get_config_u32(config, "read_skipsize");
-
-	tg->write_random = get_config_bool(config, "write_random");
-	tg->write_size = get_config_u64(config, "write_size");
-	tg->fsync_file = get_config_bool(config, "fsync_file");
-
-	tg->wait_time = get_config_u32(config, "op_delay");
-
-	tg_set_read_blocksize(tg, get_config_u32(config, "read_blocksize"));
-	tg_set_write_blocksize(tg, get_config_u32(config, "write_blocksize"));
-
-	set_weight(tg, config);
-
-	if (verify_tg(tg)) {
-		printf("threadgroup %d verification failed\n", tg_num);
-		exit(1);
-	}
-}
-
-static void init_filesys(ffsb_config_t * fc, int num)
-{
-	config_options_t *config = get_fs_config(fc, num);
-	profile_config_t *profile_conf = fc->profile_conf;
-	ffsb_fs_t *fs = &fc->filesystems[num];
-	value_list_t *tmp_list, *list_head;
-
-	memset(fs, 0, sizeof(ffsb_fs_t));
-
-	fs->basedir = get_config_str(config, "location");
-
-	if (get_config_str(config, "clone")) {
-		int i;
-		config_options_t *tmp_config;
-		for (i = 0; i < fc->num_filesys; i++) {
-			tmp_config = get_fs_config(fc, i);
-			if (!strcmp(get_config_str(config, "clone"),
-				    get_config_str(tmp_config, "location")))
-				break;
-		}
-		if (strcmp(get_config_str(config, "clone"),
-			   get_config_str(tmp_config, "location"))) {
-			printf("Clone fs failed:  Base fs \"%s\" not found\n",
-			       get_config_str(config, "clone"));
-			exit(1);
-		}
-		config = tmp_config;
-	}
-
-	fs->num_dirs = get_config_u32(config, "num_dirs");
-	fs->num_start_files = get_config_u32(config, "num_files");
-	fs->minfilesize = get_config_u64(config, "min_filesize");
-	fs->maxfilesize = get_config_u64(config, "max_filesize");
-	fs->desired_fsutil = get_config_double(config, "desired_util");
-	fs->init_fsutil = get_config_double(config, "init_util");
-	fs->init_size = get_config_u64(config, "init_size");
-
-	fs->flags = 0;
-	if (get_config_bool(config, "reuse"))
-		fs->flags |= FFSB_FS_REUSE_FS;
-
-	if (get_config_bool(profile_conf->global, "directio"))
-		 fs->flags |= FFSB_FS_DIRECTIO | FFSB_FS_ALIGNIO4K;
-
-	if (get_config_bool(profile_conf->global, "bufferio"))
-		 fs->flags |= FFSB_FS_LIBCIO;
-
-	if (get_config_bool(profile_conf->global, "alignio"))
-		 fs->flags |= FFSB_FS_ALIGNIO4K;
-
-	if (get_config_bool(config, "agefs")) {
-		container_t *age_cont = get_fs_container(fc, num);
-		if (!age_cont->child) {
-			printf("No age threaggroup in profile");
-			exit(1);
-		}
-
-		age_cont = age_cont->child;
-		ffsb_tg_t *age_tg = ffsb_malloc(sizeof(ffsb_tg_t));
-		init_threadgroup(fc, age_cont->config, age_tg, 0);
-		fs->aging_tg = age_tg;
-		fs->age_fs = 1;
-	}
-
-	if (get_config_u32(config, "create_blocksize"))
-		fs->create_blocksize = get_config_u32(config,
-						      "create_blocksize");
-	else
-		fs->create_blocksize = FFSB_FS_DEFAULT_CREATE_BLOCKSIZE;
-
-	if (get_config_u32(config, "age_blocksize"))
-		fs->age_blocksize = get_config_u32(config, "age_blocksize");
-	else
-		fs->age_blocksize = FFSB_FS_DEFAULT_AGE_BLOCKSIZE;
-
-	list_head = (value_list_t *) get_value(config, "size_weight");
-	if (list_head) {
-		int count = 0;
-		size_weight_t *sizew;
-		list_for_each_entry(tmp_list, &list_head->list, list)
-		    count++;
-
-		fs->num_weights = count;
-		fs->size_weights =
-		    malloc(sizeof(size_weight_t) * fs->num_weights);
-
-		count = 0;
-		list_for_each_entry(tmp_list, &list_head->list, list) {
-			sizew = (size_weight_t *) tmp_list->value;
-			fs->size_weights[count].size = sizew->size;
-			fs->size_weights[count].weight = sizew->weight;
-			fs->sum_weights += sizew->weight;
-			count++;
-		}
-	}
-}
-
-static void init_tg_stats(ffsb_config_t * fc, int num)
-{
-	config_options_t *config;
-	container_t *tmp_cont;
-	value_list_t *tmp_list, *list_head;
-	syscall_t sys;
-	ffsb_statsc_t fsc = { 0, };
-	char *sys_name;
-	range_t *bucket_range;
-	uint32_t min, max;
-
-	tmp_cont = get_tg_container(fc, num);
-	if (tmp_cont->child) {
-		if (tmp_cont->type == STATS) {
-			config = tmp_cont->config;
-			if (get_config_bool(config, "enable_stats")) {
-
-				list_head =
-				    (value_list_t *) get_value(config,
-							       "ignore");
-				if (list_head)
-					list_for_each_entry(tmp_list,
-							    &list_head->list,
-							    list) {
-					sys_name = (char *)tmp_list->value;
-					ffsb_stats_str2syscall(sys_name, &sys);
-					ffsb_statsc_ignore_sys(&fsc, sys);
-					}
-
-				list_head =
-				    (value_list_t *) get_value(config,
-							       "msec_range");
-				if (list_head
-				    && get_config_bool(config, "enable_range"))
-					list_for_each_entry(tmp_list,
-							    &list_head->list,
-							    list) {
-					bucket_range =
-					    (range_t *) tmp_list->value;
-					min =
-					    (uint32_t) (bucket_range->a *
-							1000.0f);
-					max =
-					    (uint32_t) (bucket_range->b *
-							1000.0f);
-					ffsb_statsc_addbucket(&fsc, min, max);
-					}
-
-				tg_set_statsc(&fc->groups[num], &fsc);
-			}
-		}
-	}
-}
-
-static void init_config(ffsb_config_t * fc, profile_config_t * profile_conf)
-{
-	config_options_t *config;
-	container_t *tmp_cont;
-	int i;
-
-	fc->time = get_config_u32(profile_conf->global, "time");
-	fc->num_filesys = get_num_filesystems(profile_conf);
-	fc->num_threadgroups = get_num_threadgroups(profile_conf);
-	fc->num_totalthreads = get_num_totalthreads(profile_conf);
-	fc->profile_conf = profile_conf;
-	fc->callout = get_config_str(profile_conf->global, "callout");
-
-	fc->filesystems = ffsb_malloc(sizeof(ffsb_fs_t) * fc->num_filesys);
-	for (i = 0; i < fc->num_filesys; i++)
-		init_filesys(fc, i);
-
-	fc->groups = ffsb_malloc(sizeof(ffsb_tg_t) * fc->num_threadgroups);
-	for (i = 0; i < fc->num_threadgroups; i++) {
-		config = get_tg_config(fc, i);
-		init_threadgroup(fc, config, &fc->groups[i], i);
-		init_tg_stats(fc, i);
-	}
-}
-
-void ffsb_parse_newconfig(ffsb_config_t * fc, char *filename)
-{
-	FILE *f;
-
-	profile_config_t *profile_conf;
-
-	f = fopen(filename, "r");
-	if (f == NULL) {
-		perror(filename);
-		exit(1);
-	}
-	profile_conf = parse(f);
-	fclose(f);
-
-	init_config(fc, profile_conf);
-}
diff --git a/utils/ffsb-6.0-rc2/parser.h b/utils/ffsb-6.0-rc2/parser.h
deleted file mode 100644
index 6357ede..0000000
--- a/utils/ffsb-6.0-rc2/parser.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _PARSER_H_
-#define _PARSER_H_
-
-#include "ffsb.h"
-#include "list.h"
-
-#define COMMENT_CHAR	'#'
-
-#define STORE_SINGLE		0x0001
-#define STORE_LIST		0x0002
-
-#define TYPE_U32		0x0001
-#define	TYPE_U64		0x0002
-#define TYPE_STRING		0x0004
-#define TYPE_BOOLEAN		0x0008
-#define TYPE_DOUBLE		0x0010
-#define TYPE_RANGE		0x0020
-#define TYPE_SIZEWEIGHT		0x0040
-#define TYPE_DEPRECATED		0x0080
-#define TYPE_WEIGHT		0x0100
-#define TYPE_SIZE32		0x0200
-#define TYPE_SIZE64		0x0400
-
-#define ROOT			0x0001
-#define THREAD_GROUP		0x0002
-#define FILESYSTEM		0x0004
-#define END			0x0008
-#define STATS			0x0010
-
-#define GLOBAL_OPTIONS {						\
-	{"num_filesystems", NULL, TYPE_DEPRECATED, STORE_SINGLE},	\
-	{"num_threadgroups", NULL, TYPE_DEPRECATED, STORE_SINGLE},	\
-	{"verbose", NULL, TYPE_BOOLEAN, STORE_SINGLE},			\
-	{"time", NULL, TYPE_U32, STORE_SINGLE},				\
-	{"directio", NULL, TYPE_BOOLEAN, STORE_SINGLE},			\
-	{"bufferio", NULL, TYPE_BOOLEAN, STORE_SINGLE},			\
-	{"alignio", NULL, TYPE_BOOLEAN, STORE_SINGLE},			\
-	{"callout", NULL, TYPE_STRING, STORE_SINGLE},			\
-	{NULL, NULL, 0, 0} }
-
-#define THREADGROUP_OPTIONS {						\
-	{"bindfs", NULL, TYPE_STRING, STORE_SINGLE},			\
-	{"num_threads", NULL, TYPE_U32, STORE_SINGLE},			\
-	{"read_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"readall_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"read_random", NULL, TYPE_BOOLEAN, STORE_SINGLE},		\
-	{"read_skip", NULL, TYPE_U32, STORE_SINGLE},			\
-	{"read_size", NULL, TYPE_SIZE64, STORE_SINGLE},			\
-	{"read_blocksize", NULL, TYPE_SIZE32, STORE_SINGLE},		\
-	{"read_skipsize", NULL, TYPE_SIZE32, STORE_SINGLE},		\
-	{"write_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"write_fsync_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},	\
-	{"write_random", NULL, TYPE_BOOLEAN, STORE_SINGLE},		\
-	{"fsync_file", NULL, TYPE_DEPRECATED, STORE_SINGLE},		\
-	{"write_size", NULL, TYPE_SIZE64, STORE_SINGLE},		\
-	{"write_blocksize", NULL, TYPE_SIZE32, STORE_SINGLE},		\
-	{"create_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"create_fsync_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},	\
-	{"delete_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"append_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"append_fsync_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},	\
-	{"metaop_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"createdir_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"op_delay", NULL, TYPE_U32, STORE_SINGLE},			\
-	{"stat_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"writeall_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{"writeall_fsync_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},	\
-	{"open_close_weight", NULL, TYPE_WEIGHT, STORE_SINGLE},		\
-	{NULL, NULL, 0} }
-
-#define FILESYSTEM_OPTIONS {						\
-	{"location", NULL, TYPE_STRING, STORE_SINGLE},			\
-	{"num_files", NULL, TYPE_U32, STORE_SINGLE},			\
-	{"num_dirs", NULL, TYPE_U32, STORE_SINGLE},			\
-	{"reuse", NULL, TYPE_BOOLEAN, STORE_SINGLE},			\
-	{"min_filesize", NULL, TYPE_SIZE64, STORE_SINGLE},		\
-	{"max_filesize", NULL, TYPE_SIZE64, STORE_SINGLE},		\
-	{"create_blocksize", NULL, TYPE_SIZE32, STORE_SINGLE},		\
-	{"age_blocksize", NULL, TYPE_SIZE32, STORE_SINGLE},		\
-	{"desired_util", NULL, TYPE_DOUBLE, STORE_SINGLE},		\
-	{"agefs", NULL, TYPE_BOOLEAN, STORE_SINGLE},			\
-	{"size_weight", NULL, TYPE_SIZEWEIGHT, STORE_LIST},		\
-	{"init_util", NULL, TYPE_DOUBLE, STORE_SINGLE},			\
-	{"init_size", NULL, TYPE_SIZE64, STORE_SINGLE},			\
-	{"clone", NULL, TYPE_STRING, STORE_SINGLE},			\
-	{NULL, NULL, 0} }
-
-#define STATS_OPTIONS {							\
-	{"enable_stats", NULL, TYPE_BOOLEAN, STORE_SINGLE},		\
-	{"enable_range", NULL, TYPE_BOOLEAN, STORE_SINGLE},		\
-	{"ignore", NULL, TYPE_STRING, STORE_LIST},			\
-	{"msec_range", NULL, TYPE_RANGE, STORE_LIST},			\
-	{NULL, NULL, 0} }
-
-#define CONTAINER_DESC {				\
-	{"filesystem", FILESYSTEM, 10},			\
-	{"threadgroup", THREAD_GROUP, 11},		\
-	{"end", END, 3},				\
-	{"stats", STATS, 5},				\
-	{NULL, 0, 0} }
-
-typedef struct container {
-	struct config_options *config;
-	uint32_t type;
-	struct container *child;
-	struct container *next;
-} container_t;
-
-typedef struct config_options {
-	char *name;
-	void *value;
-	int type;
-	int storage_type;
-} config_options_t;
-
-typedef struct container_desc {
-	char *name;
-	uint16_t type;
-	uint16_t size;
-} container_desc_t;
-
-typedef struct range {
-	double a;
-	double b;
-} range_t;
-
-typedef struct value_list {
-	void *value;
-	struct list_head list;
-} value_list_t;
-
-void ffsb_parse_newconfig(ffsb_config_t *fc, char *filename);
-
-#endif
diff --git a/utils/ffsb-6.0-rc2/public-description b/utils/ffsb-6.0-rc2/public-description
deleted file mode 100644
index f770dd0..0000000
--- a/utils/ffsb-6.0-rc2/public-description
+++ /dev/null
@@ -1,4 +0,0 @@
-The Flexible Filesystem Benchmark (FFSB) is a filesystem performance
-measurement tool.  It uses customizable profiles to measure of different
-workloads, and it supports multiple groups of threads across multiple
-filesystems.
diff --git a/utils/ffsb-6.0-rc2/rand.c b/utils/ffsb-6.0-rc2/rand.c
deleted file mode 100644
index d2b349b..0000000
--- a/utils/ffsb-6.0-rc2/rand.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "config.h"
-#include "rand.h"
-#include "util.h"
-
-#define RANDSRC "/dev/urandom"
-
-static int randfd = -1;
-
-/* close the file after we're done with the benchmark */
-void randcleanup(void)
-{
-	if (randfd > 0)
-		close(randfd);
-}
-
-/* We fill up the array with random bits from RANDSRC here and set index */
-/* to 0 */
-/* pre: state->size must be set and state->mt must be allocated! */
-static void sgenrand(randdata_t * state)
-{
-	int got = 0;
-	got = read(randfd, state->mt, state->size);
-	if (got != state->size) {
-		int i;
-		/* fall back on lrand48 */
-		/* printf("fallback_rand\n"); */
-
-		for (i = got; i < state->size; i += 4) {
-			long int rand = 0;
-#ifdef HAVE_LRAND48
-			lrand48_r(&(state->data), &rand);
-#else
-			rand = random();
-#endif
-			assert(rand != 0);
-			state->mt[i] = (rand >> 24) & (512 - 1);
-			state->mt[i + 1] = (rand >> 16) & (512 - 1);
-			state->mt[i + 2] = (rand >> 8) & (512 - 1);
-			state->mt[i + 3] = (rand) & (512 - 1);
-		}
-
-	}
-	state->mti = 0;
-}
-
-/* returns 8 random bits */
-static uint8_t genrand8(randdata_t * state)
-{
-	unsigned long ret = 0;
-	if (state->mti >= state->size) {
-/*		sgenrand(state); */
-		state->mti = 0;
-	}
-	ret = state->mt[state->mti];
-	state->mti++;
-	return ret;
-}
-
-/* returns 32 random bits */
-static uint32_t genrand32(randdata_t * state)
-{
-	uint8_t bytes[4];
-	uint32_t ret = 0;
-
-	bytes[0] = genrand8(state);
-	bytes[1] = genrand8(state);
-	bytes[2] = genrand8(state);
-	bytes[3] = genrand8(state);
-
-	ret = *((uint32_t *) bytes);	/* !!! hack */
-	return ret;
-}
-
-void init_random(randdata_t * state, uint32_t iter)
-{
-	struct timeval time;
-	if (iter == 0)
-		state->size = MIN_RANDBUF_SIZE * AVG_ITR_RNDBTS;
-	else if (iter > MAX_RANDBUF_SIZE)
-		state->size = MAX_RANDBUF_SIZE * AVG_ITR_RNDBTS;
-	else
-		state->size = iter * AVG_ITR_RNDBTS;
-
-	state->mt = ffsb_malloc(state->size);
-
-	/* !!!! racy? add pthread_once stuff later  */
-	if ((randfd < 0) && (randfd = open(RANDSRC, O_RDONLY)) < 0) {
-		perror("open " RANDSRC);
-		exit(1);
-	}
-	sgenrand(state);
-	gettimeofday(&time, NULL);
-#ifdef HAVE_LRAND48
-	srand48_r(time.tv_sec, &state->data);
-#endif
-}
-
-void destroy_random(randdata_t * rd)
-{
-	free(rd->mt);
-}
-
-/*
- * I've taken the liberty of slightly redesigning this stuff.
- * Instead of simply getting the full word of random bits
- * and throwing away most of it using the mod operator,
- * we should only get byte-sized chunks of random bits and
- * construct our random number that way with less wasteage - SR
- */
-uint32_t getrandom(randdata_t * state, uint32_t mod)
-{
-
-	uint8_t bytes[4] = { 0, 0, 0, 0 };
-	uint32_t ret;
-	int num_bytes = 4;
-	int i;
-
-	if ((mod == 0) || (mod == 1))
-		return 0;
-
-	if (!(mod >> 8))
-		num_bytes = 1;
-	else if (!(mod >> 16))
-		num_bytes = 2;
-	else if (!(mod >> 24))
-		num_bytes = 3;
-
-	for (i = 0; i < num_bytes; i++)
-		bytes[i] = genrand8(state);
-
-	ret = (bytes[3] << 24) + (bytes[2] << 16) + (bytes[1] << 8) + bytes[0];
-
-	return ret % mod;
-}
-
-uint64_t getllrandom(randdata_t * state, uint64_t mod)
-{
-	uint64_t result = 0;
-	uint64_t high = 0;
-	uint32_t low = 0;
-
-	if (mod == 0)
-		return 0;
-
-	/* ULONG_MAX comes from limits.h */
-	if (mod < ULONG_MAX)
-		return (uint64_t) getrandom(state, (uint32_t) mod);
-
-	high = genrand32(state);
-
-	low = genrand32(state);
-
-	result = high << 32;
-	result |= (uint64_t) low;
-
-	assert(result != 0);
-	assert(result > 0);
-
-	return result % mod;
-}
diff --git a/utils/ffsb-6.0-rc2/rand.h b/utils/ffsb-6.0-rc2/rand.h
deleted file mode 100644
index 3abfdec..0000000
--- a/utils/ffsb-6.0-rc2/rand.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _MTINT_H_
-#define _MTINT_H_
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-/* A guess of how many random bytes (not bits) */
-/* will be consumed per iteration */
-/* This is multiplied by the iteration count */
-/* to get the size of the array in init_random() */
-#define AVG_ITR_RNDBTS 2
-
-/* Set a cap on the size of the array, note this */
-/* is multiplied by AVG_ITR_RNDBTS */
-#define MAX_RANDBUF_SIZE (10 * 1024)
-
-#define MIN_RANDBUF_SIZE 1024
-
-
-typedef struct randdata {
-	int size;
-	uint8_t *mt; /* the array of random bits  */
-	int mti; /* mti==N+1 means mt[N] is not initialized */
-
-	/* fallback random source, lrand48_r() */
-#ifdef HAVE_LRAND48_R
-	struct drand48_data data;
-#endif
-} randdata_t;
-
-uint32_t getrandom(randdata_t *rd, uint32_t mod);
-uint64_t getllrandom(randdata_t *rd, uint64_t mod);
-
-/* pass in thread-local state, and est. number of "uses" */
-/* pass in 0 for size if size is unknown/not important */
-void init_random(randdata_t *state, uint32_t size);
-void destroy_random(randdata_t *rd);
-void randcleanup(void);
-
-#endif
diff --git a/utils/ffsb-6.0-rc2/rbt.c b/utils/ffsb-6.0-rc2/rbt.c
deleted file mode 100644
index e68e991..0000000
--- a/utils/ffsb-6.0-rc2/rbt.c
+++ /dev/null
@@ -1,1063 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "rbt.h"
-
-/*
- * ***********************************************
- *
- * D.H. IBM, S. Rao
- *
- * Module: Operations executed on red-black struct
- *
- * ***********************************************
- */
-
-/* Construct a red-black tree node */
-
-rb_node *rbnode_construct(datatype object, rb_color color)
-{
-	rb_node *node = (rb_node *) malloc(sizeof(rb_node));
-	if (!node) {
-		fprintf(stderr, "Memory Shortage - No Execution Possible\n");
-		return NULL;
-	}
-	node->object = object;
-	node->color = color;
-	node->parent = node->right = node->left = NULL;
-	return node;
-}
-
-/* Destructor of a red-black tree node */
-
-void rbnode_destruct(rb_node * node, destructor d)
-{
-	if (!node)
-		return;
-	if (d != NULL)
-		d(node->object);
-	rbnode_destruct(node->right, d);
-	rbnode_destruct(node->left, d);
-	free(node);
-}
-
-/* Determine the depth of the subtree spanned by a given node */
-
-int rbnode_depth(rb_node * node)
-{
-	/* Recursively determine the depth of the left and right
-	 * subtrees
-	 */
-	int irightdepth = (node->right) ? rbnode_depth(node->right) : 0;
-	int ileftdepth = (node->left) ? rbnode_depth(node->left) : 0;
-
-	/* Return the maximal child depth + 1 (the current node) */
-	return ((irightdepth >
-		 ileftdepth) ? (irightdepth + 1) : (ileftdepth + 1));
-}
-
-/* Return the leftmost leaf in the tree */
-
-rb_node *rbnode_minimum(rb_node * node)
-{
-	while (node->left)
-		node = node->left;
-	return node;
-}
-
-/* Return the rightmost leaf in the tree */
-
-rb_node *rbnode_maximum(rb_node * node)
-{
-	while (node->right)
-		node = node->right;
-	return node;
-}
-
-/* Replace an object */
-
-void rbnode_replace(rb_node * node, datatype object)
-{
-	/* Make sure the replacement does not violate the tree order
-	 * Replace the object at the node
-	 */
-	node->object = object;
-}
-
-/* Get the next node in the tree (according to the tree order) */
-
-rb_node *rbnode_successor(rb_node * node)
-{
-	rb_node *succ_node;
-
-	if (node->right) {
-
-		/* If there is a right child, the successor is the
-		 * minimal object in the sub-tree spanned by this
-		 * child.
-		 */
-
-		succ_node = node->right;
-		while (succ_node->left)
-			succ_node = succ_node->left;
-	} else {
-
-		/* Otherwise, go up the tree until reaching the parent
-		 * from the left direction.
-		 */
-
-		rb_node *prev_node = node;
-		succ_node = node->parent;
-		while (succ_node && prev_node == succ_node->right) {
-			prev_node = succ_node;
-			succ_node = succ_node->parent;
-		}
-	}
-
-	return (succ_node);
-}
-
-/* Get the previous node in the tree (according to the tree order) */
-
-rb_node *rbnode_predecessor(rb_node * node)
-{
-	rb_node *pred_node;
-
-	if (node->left) {
-
-		/* If there is a left child, the predecessor is the
-		 * maximal object in the sub-tree spanned by this
-		 * child.
-		 */
-
-		pred_node = node->left;
-		while (pred_node->right)
-			pred_node = pred_node->right;
-	} else {
-
-		/* Otherwise, go up the tree until reaching the parent
-		 * from the right direction.
-		 */
-
-		rb_node *prev_node = node;
-		pred_node = node->parent;
-		while (pred_node && prev_node == pred_node->left) {
-			prev_node = pred_node;
-			pred_node = pred_node->parent;
-		}
-	}
-
-	return (pred_node);
-}
-
-/* Return a pointer to a duplication of the given node */
-
-rb_node *rbnode_duplicate(rb_node * node)
-{
-	/* Create a node of the same color, containing the same
-	 * object
-	 */
-	rb_node *dup_node = rbnode_construct(node->object, node->color);
-	if (!dup_node)
-		return NULL;
-
-	/* Duplicate the children recursively */
-	if (node->right) {
-		dup_node->right = rbnode_duplicate(node->right);
-		dup_node->right->parent = dup_node;
-	} else {
-		dup_node->right = NULL;
-	}
-
-	if (node->left) {
-		dup_node->left = rbnode_duplicate(node->left);
-		dup_node->left->parent = dup_node;
-	} else {
-		dup_node->left = NULL;
-	}
-
-	return dup_node;	/* Return the duplicated node */
-}
-
-/* Traverse a red-black subtree */
-
-void rbnode_traverse(rb_node * node, opr * op)
-{
-	if (!node)
-		return;
-	rbnode_traverse(node->left, op);
-	op(node->object);
-	rbnode_traverse(node->right, op);
-}
-
-/*
- * ***********************************
- *
- * Operations on rb_tree struct
- *
- * ***********************************
- */
-
-/* Intialize a tree */
-void rbtree_init(rb_tree * tree)
-{
-/*   tree->comp = comp; */
-	tree->isize = 0;
-	tree->root = NULL;
-}
-
-/* Construct a tree given a comparison function */
-
-rb_tree *rbtree_construct()
-{
-	rb_tree *tree = (rb_tree *) malloc(sizeof(rb_tree));
-	if (!tree) {
-		fprintf(stderr, "Memory Issue - Shortge Exists!\n");
-		return NULL;
-	}
-	rbtree_init(tree);
-	return tree;
-}
-
-/* Remove all objects from a black-red tree */
-
-void rbtree_clean(rb_tree * tree, destructor d)
-{
-	if (tree->root)
-		rbnode_destruct(tree->root, d);
-	tree->root = NULL;
-	tree->isize = 0;
-}
-
-/* Destruct a red-black tree */
-
-void rbtree_destruct(rb_tree * tree, destructor d)
-{
-	rbtree_clean(tree, d);
-	free(tree);
-}
-
-/* Returns the size of the tree */
-
-int rbtree_size(rb_tree * tree)
-{
-	return tree->isize;
-}
-
-/* Returns the depth of the tree */
-
-int rbtree_depth(rb_tree * tree)
-{
-	if (!(tree->root))
-		return 0;
-	return rbnode_depth(tree->root);
-}
-
-/* Check whether the tree contains a certain object */
-
-int rbtree_contains(rb_tree * tree, datatype object)
-{
-	return (rbtree_find(tree, object) != NULL);
-}
-
-/* Insert an object into the rb-tree */
-
-rb_node *rbtree_insert(rb_tree * tree, datatype object)
-{
-	rb_node *cur_node;
-	rb_node *new_node;
-	int comp_result = 0;
-
-	if (!(tree->root)) {
-		/* Assign a new root node (the root is always
-		 * black)
-		 */
-		new_node = rbnode_construct(object, black);
-		if (!new_node)
-			return NULL;
-		tree->root = new_node;
-		tree->isize = 1;
-		return new_node;
-	}
-
-	/* Find a spot for the new object, insert the object as a red
-	 * leaf
-	 */
-
-	cur_node = tree->root;
-	new_node = rbnode_construct(object, red);
-	if (!new_node)
-		return NULL;
-
-	while (cur_node) {
-		/* Compare inserted object with the object stored in
-		 * the current node
-		 */
-		comp_result = COMP_NODES(object, cur_node->object);
-		if (comp_result == 0) {
-			printf
-			    ("Attempted to insert duplicate node, aborting\n");
-			free(new_node);
-			return NULL;
-		}
-		if (comp_result > 0) {
-			if (!(cur_node->left)) {
-				/* Insert the new leaf as the left
-				 * child of the current node
-				 */
-				cur_node->left = new_node;
-				new_node->parent = cur_node;
-				cur_node = NULL;	/* Terminate the while loop */
-			} else {
-				/* Go to the left subtree */
-				cur_node = cur_node->left;
-			}
-		} else {
-			if (!(cur_node->right)) {
-				/* Insert the new leaf as the right
-				 * child of the current node
-				 */
-				cur_node->right = new_node;
-				new_node->parent = cur_node;
-				cur_node = NULL;	/* Terminate the while loop */
-			} else {
-				/* Go to the right subtree */
-				cur_node = cur_node->right;
-			}
-		}
-	}
-
-	/* Mark the fact that a new node was added */
-	tree->isize++;
-
-	/* Fix the tree properties */
-	rbtree_insert_fixup(tree, new_node);
-
-	return new_node;
-}
-
-/* Insert a new object to the tree as the a successor of a given
- * node
- */
-
-rb_node *insert_successor_at(rb_tree * tree, rb_node * at_node, datatype object)
-{
-	rb_node *parent;
-	rb_node *new_node;
-
-	if (!(tree->root)) {
-		/* Assign a new root node (the root is always
-		 * black)
-		 */
-		new_node = rbnode_construct(object, black);
-		if (!new_node)
-			return NULL;
-		tree->root = new_node;
-		tree->isize = 1;
-		return new_node;
-	}
-
-	/* Insert the new object as a red leaf, being the successor of
-	 * node
-	 */
-	new_node = rbnode_construct(object, red);
-	if (!new_node)
-		return NULL;
-
-	if (!at_node) {
-		/* The new node should become the tree's minimum Place
-		 * is as the left child of the current minimal leaf
-		 */
-		parent = rbnode_minimum(tree->root);
-		parent->left = new_node;
-	} else {
-		/* Make sure the insertion does not violate the tree
-		 * order In case given node has no right child, place
-		 * the new node as its right child. Otherwise, place
-		 * it at the leftmost position at the sub-tree rooted
-		 * at its right side.
-		 */
-		if (!at_node->right) {
-			parent = at_node;
-			parent->right = new_node;
-		} else {
-			parent = rbnode_minimum(at_node->right);
-			parent->left = new_node;
-		}
-	}
-
-	new_node->parent = parent;
-
-	/* Mark that a new node was added */
-	tree->isize++;
-
-	/* Fix the tree properties */
-	rbtree_insert_fixup(tree, new_node);
-
-	return new_node;
-}
-
-/* Insert a new object to the tree as the a predecessor of a given node */
-
-rb_node *insert_predecessor_at(rb_tree * tree, rb_node * at_node,
-			       datatype object)
-{
-	rb_node *parent;
-	rb_node *new_node;
-
-	if (!(tree->root)) {
-		/* Assign a new root node (the root is always
-		 * black)
-		 */
-		new_node = rbnode_construct(object, black);
-		if (!new_node)
-			return NULL;
-		tree->root = new_node;
-		tree->isize = 1;
-		return new_node;
-	}
-
-	/* Insert the new object as a red leaf, being the predecessor
-	 * of at_node
-	 */
-	new_node = rbnode_construct(object, red);
-	if (!new_node)
-		return NULL;
-
-	if (!at_node) {
-		/* The new node should become the tree maximum. Place
-		 * is as the right child of the current maximal leaf
-		 */
-		parent = rbnode_maximum(tree->root);
-		parent->right = new_node;
-	} else {
-		/* Make sure the insertion does not violate the tree
-		 * order In case given node has no left child, place
-		 * the new node as its left child. Otherwise, place it
-		 * at the rightmost position at the sub-tree rooted at
-		 * its left side.
-		 */
-		if (!(at_node->left)) {
-			parent = at_node;
-			parent->left = new_node;
-		} else {
-			parent = rbnode_maximum(at_node->left);
-			parent->right = new_node;
-		}
-	}
-
-	new_node->parent = parent;
-
-	/* Mark that a new node was added */
-	tree->isize++;
-
-	/* Fix the tree properties */
-	rbtree_insert_fixup(tree, new_node);
-
-	return new_node;
-}
-
-/* Remove an object from the tree */
-
-void rbtree_remove(rb_tree * tree, datatype object, destructor d)
-{
-	rb_node *node = rbtree_find(tree, object);	/* Find the node */
-	rbtree_remove_at(tree, node, d);	/* Remove the node */
-}
-
-/* Remove the object pointed by the given node. */
-
-void rbtree_remove_at(rb_tree * tree, rb_node * node, destructor d)
-{
-	rb_node *child = NULL;
-
-	/* In case of deleting the single object stored in the tree,
-	 * free the root, thus emptying the tree
-	 */
-	if (tree->isize == 1) {
-		rbnode_destruct(tree->root, d);
-		tree->root = NULL;
-		tree->isize = 0;
-		return;
-	}
-
-	/* Remove the given node from the tree */
-	if (node->left && node->right) {
-		/* If the node we want to remove has two children,
-		 * find its successor, which is the leftmost child in
-		 * its right sub-tree and has at most one child (it
-		 * may have a right child).
-		 */
-		rb_node *succ_node = rbnode_minimum(node->right);
-
-		/* Now physically swap node and its successor. Notice
-		 * this may temporarily violate the tree properties,
-		 * but we are going to remove node anyway.  This way
-		 * we have moved node to a position were it is more
-		 * convinient to delete it.
-		 */
-		int immediate_succ = (node->right == succ_node);
-		rb_node *succ_parent = succ_node->parent;
-		rb_node *succ_left = succ_node->left;
-		rb_node *succ_right = succ_node->right;
-		rb_color succ_color = succ_node->color;
-
-		succ_node->parent = node->parent;
-		succ_node->left = node->left;
-		succ_node->right = immediate_succ ? node : node->right;
-		succ_node->color = node->color;
-
-		node->parent = immediate_succ ? succ_node : succ_parent;
-		node->left = succ_left;
-		node->right = succ_right;
-		node->color = succ_color;
-
-		if (!immediate_succ) {
-			if (succ_node == node->parent->left)
-				node->parent->left = node;
-			else
-				node->parent->right = node;
-		}
-
-		if (node->left)
-			node->left->parent = node;
-		if (node->right)
-			node->right->parent = node;
-
-		if (succ_node->parent) {
-			if (node == succ_node->parent->left)
-				succ_node->parent->left = succ_node;
-			else
-				succ_node->parent->right = succ_node;
-		} else {
-			tree->root = succ_node;
-		}
-
-		if (succ_node->left)
-			succ_node->left->parent = succ_node;
-		if (succ_node->right)
-			succ_node->right->parent = succ_node;
-	}
-
-	/* At this stage, the node we are going to remove has at most
-	 * one child
-	 */
-	child = (node->left) ? node->left : node->right;
-
-	/* Splice out the node to be removed, by linking its parent
-	 * straight to the removed node's single child.
-	 */
-	if (child)
-		child->parent = node->parent;
-
-	if (!(node->parent)) {
-		/* If we are deleting the root, make the child the new
-		 * tree node
-		 */
-		tree->root = child;
-	} else {
-		/* Link the removed node parent to its child */
-		if (node == node->parent->left)
-			node->parent->left = child;
-		else
-			node->parent->right = child;
-	}
-
-	/* Fix-up the red-black properties that may have been damaged:
-	 * If we have just removed a black node, the black-depth
-	 * property is no longer valid
-	 */
-	if (node->color == black && child)
-		rbtree_remove_fixup(tree, child);
-
-	/* Delete the un-necessary node (nullify both its children
-	 * because the node's destructor is recursive).
-	 */
-	node->left = NULL;
-	node->right = NULL;
-	free(node);
-
-	/* Decrease the number of objects in the tree */
-	tree->isize--;
-}
-
-/* Get the tree minimum */
-
-rb_node *rbtree_minimum(rb_tree * tree)
-{
-	if (!(tree->root))
-		return NULL;
-
-	/* Return the leftmost leaf in the tree */
-	return rbnode_minimum(tree->root);
-}
-
-/* Get the tree maximum */
-
-rb_node *rbtree_maximum(rb_tree * tree)
-{
-	if (!(tree->root))
-		return NULL;
-
-	/* Return the rightmost leaf in the tree */
-	return rbnode_maximum(tree->root);
-}
-
-/* Return a pointer to the node containing the given object */
-
-rb_node *rbtree_find(rb_tree * tree, datatype object)
-{
-	rb_node *cur_node = tree->root;
-	int comp_result;
-
-	while (cur_node) {
-		comp_result = COMP_NODES(object, cur_node->object);
-		/* In case of equality, we can return the current
-		 * node.
-		 */
-		if (comp_result == 0)
-			return cur_node;
-		/* Go down to the left or right child. */
-		cur_node = (comp_result > 0) ? cur_node->left : cur_node->right;
-	}
-
-	/* If we get here, the object is not in the tree */
-	return NULL;
-}
-
-void rbtree_rotate_left(rb_tree * tree, rb_node * x_node)
-{
-	/* Get the right child of the node */
-	rb_node *y_node = x_node->right;
-
-	/* Change its left subtree (T2) to x's right subtree */
-	x_node->right = y_node->left;
-
-	/* Link T2 to its new parent x */
-	if (y_node->left != NULL)
-		y_node->left->parent = x_node;
-
-	/* Assign x's parent to be y's parent */
-	y_node->parent = x_node->parent;
-
-	if (!(x_node->parent)) {
-		/* Make y the new tree root */
-		tree->root = y_node;
-	} else {
-		/* Assign a pointer to y from x's parent */
-		if (x_node == x_node->parent->left)
-			x_node->parent->left = y_node;
-		else
-			x_node->parent->right = y_node;
-	}
-
-	/* Assign x to be y's left child */
-	y_node->left = x_node;
-	x_node->parent = y_node;
-}
-
-/* Right-rotate the sub-tree spanned by the given node */
-
-void rbtree_rotate_right(rb_tree * tree, rb_node * y_node)
-{
-	/* Get the left child of the node */
-	rb_node *x_node = y_node->left;
-
-	/* Change its right subtree (T2) to y's left subtree */
-	y_node->left = x_node->right;
-
-	/* Link T2 to its new parent y */
-	if (x_node->right != NULL)
-		x_node->right->parent = y_node;
-
-	/* Assign y's parent to be x's parent */
-	x_node->parent = y_node->parent;
-
-	if (!(y_node->parent)) {
-		/* Make x the new tree root */
-		tree->root = x_node;
-	} else {
-		/* Assign a pointer to x from y's parent */
-		if (y_node == y_node->parent->left)
-			y_node->parent->left = x_node;
-		else
-			y_node->parent->right = x_node;
-	}
-
-	/* Assign y to be x's right child */
-	x_node->right = y_node;
-	y_node->parent = x_node;
-}
-
-/* Fix the tree so it maintains the red-black properties after an insert */
-
-void rbtree_insert_fixup(rb_tree * tree, rb_node * node)
-{
-	/* Fix the red-black propreties. We may have inserted a red
-	 * leaf as the child of a red parent - so we have to fix the
-	 * coloring of the parent recursively.
-	 */
-	rb_node *curr_node = node;
-	rb_node *grandparent;
-	rb_node *uncle;
-
-	assert(node && node->color == red);
-
-	while (curr_node != tree->root && curr_node->parent->color == red) {
-		/* Get a pointer to the current node's grandparent
-		 * (the root is always black, so the red parent must
-		 * have a parent).
-		 */
-
-		grandparent = curr_node->parent->parent;
-
-		if (curr_node->parent == grandparent->left) {
-			/* If the red parent is a left child, the
-			 * uncle is the right child of the grandparent.
-			 */
-			uncle = grandparent->right;
-
-			if (uncle && uncle->color == red) {
-
-				/* If both parent and uncle are red,
-				 * color them black and color the
-				 * grandparent red. In case of a NULL
-				 * uncle, treat it as a black node
-				 */
-				curr_node->parent->color = black;
-				uncle->color = black;
-				grandparent->color = red;
-
-				/* Move to the grandparent */
-				curr_node = grandparent;
-			} else {
-				/* Make sure the current node is a
-				 * right child. If not, left-rotate the
-				 * parent's sub-tree so the parent
-				 * becomes the right child of the
-				 * current node (see _rotate_left).
-				 */
-				if (curr_node == curr_node->parent->right) {
-					curr_node = curr_node->parent;
-					rbtree_rotate_left(tree, curr_node);
-				}
-
-				/* Color the parent black and the
-				 * grandparent red
-				 */
-				curr_node->parent->color = black;
-				grandparent->color = red;
-
-				/* Right-rotate the grandparent's
-				 * sub-tree
-				 */
-				rbtree_rotate_right(tree, grandparent);
-			}
-		} else {
-			/* If the red parent is a right child, the
-			 * uncle is the left child of the grandparent.
-			 */
-			uncle = grandparent->left;
-
-			if (uncle && uncle->color == red) {
-				/* If both parent and uncle are red,
-				 * color them black and color the
-				 * grandparent red. In case of a NULL
-				 * uncle, treat it as a black node
-				 */
-				curr_node->parent->color = black;
-				uncle->color = black;
-				grandparent->color = red;
-
-				/* Move to the grandparent */
-				curr_node = grandparent;
-			} else {
-				/* Make sure the current node is a
-				 * left child. If not, right-rotate
-				 * the parent's sub-tree so the parent
-				 * becomes the left child of the
-				 * current node.
-				 */
-				if (curr_node == curr_node->parent->left) {
-					curr_node = curr_node->parent;
-					rbtree_rotate_right(tree, curr_node);
-				}
-
-				/* Color the parent black and the
-				 * grandparent red
-				 */
-				curr_node->parent->color = black;
-				grandparent->color = red;
-
-				/* Left-rotate the grandparent's
-				 * sub-tree
-				 */
-				rbtree_rotate_left(tree, grandparent);
-			}
-		}
-	}
-
-	/* Make sure that the root is black */
-	tree->root->color = black;
-}
-
-void rbtree_remove_fixup(rb_tree * tree, rb_node * node)
-{
-	rb_node *curr_node = node;
-	rb_node *sibling;
-
-	while (curr_node != tree->root && curr_node->color == black) {
-		/* Get a pointer to the current node's sibling (notice
-		 * that the node's parent must exist, since the node
-		 * is not the root).
-		 */
-		if (curr_node == curr_node->parent->left) {
-			/* If the current node is a left child, its
-			 * sibling is the right child of the parent.
-			 */
-			sibling = curr_node->parent->right;
-
-			/* Check the sibling's color. Notice that NULL
-			 * nodes are treated as if they are colored
-			 * black.
-			 */
-			if (sibling && sibling->color == red) {
-				/* In case the sibling is red, color
-				 * it black and rotate.  Then color
-				 * the parent red (the grandparent is
-				 * now black)
-				 */
-				sibling->color = black;
-				curr_node->parent->color = red;
-				rbtree_rotate_left(tree, curr_node->parent);
-				sibling = curr_node->parent->right;
-			}
-
-			if (sibling &&
-			    (!(sibling->left) || sibling->left->color == black)
-			    && (!(sibling->right)
-				|| sibling->right->color == black)) {
-				/* If the sibling has two black
-				 * children, color it red
-				 */
-				sibling->color = red;
-				if (curr_node->parent->color == red) {
-					/* If the parent is red, we
-					 * can safely color it black
-					 * and terminate the fix
-					 * process.
-					 */
-					curr_node->parent->color = black;
-					/* In order to stop the while loop */
-					curr_node = tree->root;
-				} else {
-					/* The black depth of the
-					 * entire sub-tree rooted at
-					 * the parent is now too small
-					 * - fix it up recursively.
-					 */
-					curr_node = curr_node->parent;
-				}
-			} else {
-				if (!sibling) {
-					/* Take special care of the
-					 * case of a NULL sibling
-					 */
-					if (curr_node->parent->color == red) {
-						curr_node->parent->color =
-						    black;
-						/* In order to stop
-						 * the while loop */
-						curr_node = tree->root;
-					} else {
-						curr_node = curr_node->parent;
-					}
-				} else {
-					/* In this case, at least one
-					 * of the sibling's children
-					 * is red.  It is therfore
-					 * obvious that the sibling
-					 * itself is black.
-					 */
-					if (sibling->right
-					    && sibling->right->color == red) {
-						/* If the right child
-						 * of the sibling is
-						 * red, color it black
-						 * and rotate around
-						 * the current parent.
-						 */
-						sibling->right->color = black;
-						rbtree_rotate_left(tree,
-								   curr_node->
-								   parent);
-					} else {
-						/* If the left child
-						 * of the sibling is
-						 * red, rotate around
-						 * the sibling, then
-						 * rotate around the
-						 * new sibling of our
-						 * current node.
-						 */
-						rbtree_rotate_right(tree,
-								    sibling);
-						sibling =
-						    curr_node->parent->right;
-						rbtree_rotate_left(tree,
-								   sibling);
-					}
-
-					/* It is now safe to color the
-					 * parent black and to
-					 * terminate the fix process.
-					 */
-					if (curr_node->parent->parent)
-						curr_node->parent->parent->
-						    color =
-						    curr_node->parent->color;
-					curr_node->parent->color = black;
-					/* In order to stop the while loop */
-					curr_node = tree->root;
-				}
-			}
-		} else {
-			/* If the current node is a right child, its
-			 * sibling is the left child of the parent.
-			 */
-			sibling = curr_node->parent->left;
-
-			/* Check the sibling's color. Notice that NULL
-			 * nodes are treated as if they are colored
-			 * black.
-			 */
-			if (sibling && sibling->color == red) {
-				/* In case the sibling is red, color
-				 * it black and rotate.  Then color
-				 * the parent red (the grandparent is
-				 * now black).
-				 */
-				sibling->color = black;
-				curr_node->parent->color = red;
-				rbtree_rotate_right(tree, curr_node->parent);
-
-				sibling = curr_node->parent->left;
-			}
-
-			if (sibling &&
-			    (!(sibling->left) || sibling->left->color == black)
-			    && (!(sibling->right)
-				|| sibling->right->color == black)) {
-				/* If the sibling has two black children, color it red */
-				sibling->color = red;
-				if (curr_node->parent->color == red) {
-					/* If the parent is red, we
-					 * can safely color it black
-					 * and terminate the fix-up
-					 * process.
-					 */
-					curr_node->parent->color = black;
-					/* In order to stop the while
-					 * loop
-					 */
-					curr_node = tree->root;
-				} else {
-					/* The black depth of the
-					 * entire sub-tree rooted at
-					 * the parent is now too small
-					 * - fix it up recursively.
-					 */
-					curr_node = curr_node->parent;
-				}
-			} else {
-				if (!sibling) {
-					/* Take special care of the
-					 * case of a NULL sibling */
-					if (curr_node->parent->color == red) {
-						curr_node->parent->color =
-						    black;
-						/* In order to stop
-						 * the while loop */
-						curr_node = tree->root;
-					} else {
-						curr_node = curr_node->parent;
-					}
-				} else {
-					/* In this case, at least one
-					 * of the sibling's children is
-					 * red.  It is therfore obvious
-					 * that the sibling itself is
-					 * black.
-					 */
-					if (sibling->left
-					    && sibling->left->color == red) {
-						/* If the left child
-						 * of the sibling is
-						 * red, color it black
-						 * and rotate around
-						 * the current parent
-						 */
-						sibling->left->color = black;
-						rbtree_rotate_right(tree,
-								    curr_node->
-								    parent);
-					} else {
-						/* If the right child
-						 * of the sibling is
-						 * red, rotate around
-						 * the sibling, then
-						 * rotate around the
-						 * new sibling of our
-						 * current node
-						 */
-						rbtree_rotate_left(tree,
-								   sibling);
-						sibling =
-						    curr_node->parent->left;
-						rbtree_rotate_right(tree,
-								    sibling);
-					}
-
-					/* It is now safe to color the
-					 * parent black and to
-					 * terminate the fix process.
-					 */
-					if (curr_node->parent->parent)
-						curr_node->parent->parent->
-						    color =
-						    curr_node->parent->color;
-					curr_node->parent->color = black;
-					/* In order to stop the while loop */
-					curr_node = tree->root;
-				}
-			}
-		}
-	}
-
-	/* The root can always be colored black */
-	curr_node->color = black;
-}
-
-/* Traverse a red-black tree */
-
-void rbtree_traverse(rb_tree * tree, opr * op)
-{
-	rbnode_traverse(tree->root, op);
-}
diff --git a/utils/ffsb-6.0-rc2/rbt.h b/utils/ffsb-6.0-rc2/rbt.h
deleted file mode 100644
index a77ce4f..0000000
--- a/utils/ffsb-6.0-rc2/rbt.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef RED_BLACK_TREE_H
-#define RED_BLACK_TREE_H
-
-/*
- * ***************************************************************************
- *
- * Container class for a red-black tree ......
- *
- * A binary tree that satisfies the following properties:
- *
- * 1. Every node is either red or black
- * 2. The root node is black
- * 3. Every leaf (NIL) is black
- * 4. If a node is red, both its children are black
- * 5. For each node, all paths from the node to descendant leaf nodes
- *    contain the same number of black nodes
- *
- * Due to points 4 & 5, the depth of a red-black tree containing n nodes
- * is bounded by 2*log2(n+1) (WC).
- *
- *
- * The rb_tree template requires two additional parmeters:
- *
- * - The contained TYPE class represents the objects stored in the tree.
- *   It has to support the copy constructor and the assignment operator (opr)
- * - cmp is a functor used to define the order of objects of class TYPE:
- *   This class has to support an operator() that receives two objects from
- *   the TYPE class and returns a negative, 0, or a positive integer,
- *   depending on the comparison result.
- *
- * Dominique Heger, S. Rao
- *
- * ***************************************************************************
- */
-
-/* Color enumeration for nodes of red-black tree */
-/* ********************************************* */
-
-#include "filelist.h"
-
-typedef struct ffsb_file *datatype;
-
-#define COMP_NODES(a, b) ((a)->num - (b)->num)
-
-typedef enum red_black_color {red, black} rb_color;
-
-/*! Representation of a node in a red-black tree */
-typedef struct red_black_node {
-	datatype object;                      /* the stored object */
-	rb_color color;                       /* the color of the node */
-	struct red_black_node *parent;       /* points to the parent node */
-	struct red_black_node *right;        /* points to the right child */
-	struct red_black_node *left;         /* points to the left child */
-} rb_node;
-
-typedef int(cmp)(datatype, datatype);
-typedef void(opr)(void *);
-typedef void(destructor)(datatype);
-
-/* Construct of a red-black tree node
- * - The object stored in the node
- * - The color of the node
- */
-
-extern rb_node *rbnode_construct(datatype object, rb_color color);
-
-/* Recursive destructor for the entire sub-tree */
-/* ******************************************** */
-
-extern void rbnode_destruct(rb_node *node, destructor d);
-
-/* Calculate the depth of the sub-tree spanned by the given node
- * - The sub-tree root
- * - The sub-tree depth
- */
-
-extern int rbnode_depth(rb_node *node);
-
-/* Get the leftmost node in the sub-tree spanned by the given node
- * - The sub-tree root
- * - The sub-tree minimum
- */
-
-extern rb_node *rbnode_minimum(rb_node *node);
-
-/* Get the rightmost node in the sub-tree spanned by the given node
- * - The sub-tree root
- * - The sub-tree maximum
- */
-
-extern rb_node *rbnode_maximum(rb_node *node);
-
-/* Replace the object */
-/* ****************** */
-
-extern void rbnode_replace(rb_node *node, datatype object);
-
-/* Get the next node in the tree (according to the tree order)
- * - The current node
- * - The successor node, or NULL if node is the tree maximum
- */
-
-extern rb_node *rbnode_successor(rb_node *node);
-
-/* Get the previous node in the tree (according to the tree order)
- * - The current node
- * - The predecessor node, or NULL if node is the tree minimum
- */
-
-extern rb_node *rbnode_predecessor(rb_node *node);
-
-/* Duplicate the entire sub-tree rooted at the given node
- * - The sub-tree root
- * - A pointer to the duplicated sub-tree root
- */
-
-extern rb_node *rbnode_duplicate(rb_node *node);
-
-/* Traverse a red-black sub-tree
- * - The sub-tree root
- * - The operation to perform on each object in the sub-tree
- */
-extern void rbnode_traverse(rb_node *node, opr *op);
-
-/* Representation of a red-black tree */
-/* ********************************** */
-
-typedef struct red_black_tree {
-	rb_node *root;                /* pointer to the tree root */
-	int isize;                     /* number of objects stored */
-	/*   cmp * comp; */                   /* compare function */
-} rb_tree;
-
-/* Initialize a red-black tree with a comparision function
- * - The tree
- * - The comparision function
- */
-
-void rbtree_init(rb_tree *tree);
-
-/* Construct a red-black tree with a comparison object
- * - A pointer to the comparison object to be used by the tree
- * - The newly constructed  tree
- */
-
-rb_tree *rbtree_construct(void);
-
-/* Clean a red-black tree [takes O(n) operations]
- * - The tree
- */
-
-extern void rbtree_clean(rb_tree *tree, destructor d);
-
-/* Destruct a red-black tree
- * - The tree
- */
-
-extern void rbtree_destruct(rb_tree *tree, destructor d);
-
-/* Get the size of the tree [takes O(1) operations]
- * - The tree
- * - The number of objects stored in the tree
- */
-
-extern int rbtree_size(rb_tree *tree);
-
-/* Get the depth of the tree [takes O(n) operations]
- * - The tree
- * - The length of the longest path from the root to a leaf node
- */
-
-extern int rbtree_depth(rb_tree *tree);
-
-/* Check whether the tree contains an object [takes O(log n) operations]
- * - The tree
- * - The query object
- * - (true) if an equal object is found in the tree, otherwise (false)
- */
-
-extern int rbtree_contains(rb_tree *tree, datatype object);
-
-/* Insert an object to the tree [takes O(log n) operations]
- * - The tree
- * - The object to be inserted
- * - Return the inserted object node
- */
-
-extern rb_node *rbtree_insert(rb_tree *tree, datatype object);
-
-/* Insert a new object to the tree as the a successor of a given node
- * - The tree
- * - The new node
- */
-
-extern rb_node *insert_successor_at(rb_tree *tree, rb_node *at_node,
-				    datatype object);
-
-/* Insert a new object to the tree as the a predecessor of a given node
- * - The tree
- * - The new node
- */
-
-extern rb_node *insert_predecessor_at(rb_tree *tree, rb_node *at_node,
-				      datatype object);
-
-/* Remove an object from the tree [takes O(log n) operations]
- * - The tree
- * - The object to be removed
- * - The object should be contained in the tree
- */
-
-extern void rbtree_remove(rb_tree *tree, datatype object, destructor d);
-
-/* Get a handle to the tree minimum [takes O(log n) operations]
- * - The tree
- * - Return the minimal object in the tree, or a NULL if the tree is empty
- */
-
-extern rb_node *rbtree_minimum(rb_tree *tree);
-
-/* Get a handle to the tree maximum [takes O(log n) operations]
- * - The tree
- * - Return the maximal object in the tree, or a NULL if the tree is empty
- */
-
-extern rb_node *rbtree_maximum(rb_tree *tree);
-
-/* Get the next node in the tree (according to the tree order)
- * - [takes O(log n) operations at worst-case, but only O(1) amortized]
- * - The tree
- * - The current object
- * - The successor node, or a NULL, if we are at the tree maximum
- */
-extern rb_node *rbtree_successor(rb_tree *tree, rb_node *node);
-
-/* Get the previous node in the tree (according to the tree order)
- * - [takes O(log n) operations at worst-case, but only O(1) amortized]
- * - The tree
- * - The current object
- * - The predecessor node, or a NULL, if we are at the tree minimum
- */
-
-extern rb_node *rbtree_predecessor(rb_tree *tree, rb_node *node);
-
-/* Find a node that contains the given object
- * - The tree
- * - The desired object
- * - Return a node that contains the given object, or NULL if no such object
- *   is found in the tree
- */
-
-extern rb_node *rbtree_find(rb_tree *tree, datatype object);
-
-/* Remove the object stored in the given tree node
- * - The tree
- * - The node storing the object to be removed from the tree
- */
-
-extern void rbtree_remove_at(rb_tree *tree, rb_node *node, destructor d);
-
-/* Left-rotate the sub-tree spanned by the given node
- * - The tree
- * - The sub-tree root
- */
-
-extern void rbtree_rotate_left(rb_tree *tree, rb_node *node);
-
-/* Right-rotate the sub-tree spanned by the given node
- * - The tree
- * - The sub-tree root
- */
-
-extern void rbtree_rotate_right(rb_tree *tree, rb_node *node);
-
-/*
- * Fix the red-black tree properties after an insertion operation
- * - The tree
- * - The node that has just been inserted to the tree
- * - The color of node must be red
- */
-
-extern void rbtree_insert_fixup(rb_tree *tree, rb_node *node);
-
-/* Fix the red-black tree properties after a removal operation
- * - The tree
- * - The child of the node that has just been removed from the tree
- */
-
-extern void rbtree_remove_fixup(rb_tree *tree, rb_node *node);
-
-/* Traverse a red-black tree
- * - The tree
- * - The operation to perform on every object of the tree (according to
- *   the tree order)
- */
-
-extern void rbtree_traverse(rb_tree *tree, opr *op);
-
-#endif
diff --git a/utils/ffsb-6.0-rc2/registration-description b/utils/ffsb-6.0-rc2/registration-description
deleted file mode 100644
index 9faaea2..0000000
--- a/utils/ffsb-6.0-rc2/registration-description
+++ /dev/null
@@ -1,7 +0,0 @@
-The Flexible Filesystem Benchmark (FFSB) is a filesystem performance measurement tool.  It is a multi-threaded application (using pthreads), written entirely in C with cross-platform portability in mind.  It differs from other filesystem benchmarks in that the user may supply a profile to create custom workloads, while most other filesystem benchmarks use a fixed set of workloads.
-
-It is currently known to support Linux, AIX, and Solaris, although almost all development and testing has occurred on Linux.  We intend to add support for HP-UX, IRIX, and possibly others in the near future.
-
-FFSB is currently at version 5.0, and has been an internal tool at IBM for about four years.  I has already been used to conduct a study of Linux Kernel 2.6 IO-schedulers, and a great deal of future filesystem performance work is planned with FFSB as the primary tool.
-
-In version 5.0, it supports six different basic operations, support for multiple groups of threads with different operation mixtures, support for operation across multiple filesystems, and support for filesystem aging prior to benchmarking.
diff --git a/utils/ffsb-6.0-rc2/rwlock.c b/utils/ffsb-6.0-rc2/rwlock.c
deleted file mode 100644
index 01806e5..0000000
--- a/utils/ffsb-6.0-rc2/rwlock.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <pthread.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* #define RWDEBUG 1 */
-#include "config.h"
-#include "rwlock.h"
-
-void init_rwlock(struct rwlock *rw)
-{
-	rw->n_readers = 0;
-	pthread_mutex_init(&rw->plock, NULL);
-	pthread_cond_init(&rw->pcond, NULL);
-#ifdef RWDEBUG
-	rw->n_write_waiting = 0;
-	rw->n_read_waiting = 0;
-	rw->writer_tid = -1;
-#endif
-}
-
-void rw_lock_read(struct rwlock *rw)
-{
-	pthread_mutex_lock(&rw->plock);
-#ifdef RWDEBUG
-	rw->n_read_waiting++;
-#endif
-	while (rw->n_readers < 0)
-		pthread_cond_wait(&rw->pcond, &rw->plock);
-	rw->n_readers++;
-#ifdef RWDEBUG
-	rw->n_read_waiting--;
-#endif
-	pthread_mutex_unlock(&rw->plock);
-}
-
-void rw_lock_write(struct rwlock *rw)
-{
-	pthread_mutex_lock(&rw->plock);
-#ifdef RWDEBUG
-	rw->n_write_waiting++;
-#endif
-	while (rw->n_readers != 0)
-		pthread_cond_wait(&rw->pcond, &rw->plock);
-	rw->n_readers = -1;
-#ifdef RWDEBUG
-	rw->n_write_waiting--;
-	rw->writer_tid = (int)pthread_self();
-#endif
-	pthread_mutex_unlock(&rw->plock);
-
-}
-
-void rw_unlock_read(struct rwlock *rw)
-{
-	pthread_mutex_lock(&rw->plock);
-	rw->n_readers -= 1;
-	pthread_cond_signal(&rw->pcond);
-	pthread_mutex_unlock(&rw->plock);
-}
-
-void rw_unlock_write(struct rwlock *rw)
-{
-	pthread_mutex_lock(&rw->plock);
-	rw->n_readers = 0;
-	pthread_cond_broadcast(&rw->pcond);
-	pthread_mutex_unlock(&rw->plock);
-}
-
-int rw_trylock_read(struct rwlock *rw)
-{
-	int ret = 1;
-	pthread_mutex_lock(&rw->plock);
-	if (rw->n_readers >= 0) {
-		rw->n_readers++;
-		ret = 0;
-	}
-	pthread_mutex_unlock(&rw->plock);
-	return ret;
-}
-
-int rw_trylock_write(struct rwlock *rw)
-{
-	int ret = 1;
-	pthread_mutex_lock(&rw->plock);
-	if (rw->n_readers == 0) {
-		ret = 0;
-		rw->n_readers = -1;
-	}
-	pthread_mutex_unlock(&rw->plock);
-	return ret;
-}
diff --git a/utils/ffsb-6.0-rc2/rwlock.h b/utils/ffsb-6.0-rc2/rwlock.h
deleted file mode 100644
index aa33d84..0000000
--- a/utils/ffsb-6.0-rc2/rwlock.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#ifndef _RWLOCK_H
-#define _RWLOCK_H
-
-#include <pthread.h>
-
-/* #define RWDEBUG 1 */
-
-/* n_readers >= 0 means 0 or more readers */
-/* n_readers < 0 means a writer */
-struct rwlock {
-	pthread_mutex_t plock;
-	int n_readers;
-	pthread_cond_t pcond;
-#ifdef RWDEBUG
-  int writer_tid;
-  int n_read_waiting;
-  int n_write_waiting;
-#endif
-};
-
-void init_rwlock(struct rwlock *rw);
-
-void rw_lock_read(struct rwlock *rw);
-void rw_lock_write(struct rwlock *rw);
-
-void rw_unlock_read(struct rwlock *rw);
-void rw_unlock_write(struct rwlock *rw);
-
-int rw_trylock_read(struct rwlock *rw);
-int rw_trylock_write(struct rwlock *rw);
-
-
-
-#endif
diff --git a/utils/ffsb-6.0-rc2/stamp-h.in b/utils/ffsb-6.0-rc2/stamp-h.in
deleted file mode 100644
index 9788f70..0000000
--- a/utils/ffsb-6.0-rc2/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/utils/ffsb-6.0-rc2/util.c b/utils/ffsb-6.0-rc2/util.c
deleted file mode 100644
index 77e1b3b..0000000
--- a/utils/ffsb-6.0-rc2/util.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2004
- *
- *   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
- */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/select.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <pthread.h>
-
-#include "config.h"
-#include "fh.h"
-#include "util.h"
-
-uint64_t ffsb_get_filesize(char *name)
-{
-#ifndef HAVE_STAT64
-#define STAT(a, b) do { stat((a), (b)); } while (0)
-	struct stat filestat;
-#else
-#define STAT(a, b) do { stat64((a), (b)); } while (0)
-	struct stat64 filestat;
-#endif
-
-	STAT(name, &filestat);
-	return (uint64_t) filestat.st_size;
-#undef STAT
-}
-
-void *ffsb_malloc(size_t size)
-{
-	void *ptr = malloc((size));
-	assert(ptr != NULL);
-	memset(ptr, 0, size);
-	return ptr;
-}
-
-void *ffsb_realloc(void *ptr, size_t size)
-{
-	void *tmp;
-	/* printf("ffsb_realloc: ptr = %p  size = %ld\n",ptr,size); */
-
-	if (ptr == NULL)
-		return ffsb_malloc(size);
-
-	tmp = realloc(ptr, size);
-	assert(ptr != NULL);
-	ptr = tmp;
-	return ptr;
-}
-
-void *ffsb_align_4k(void *ptr)
-{
-	unsigned long mask = ~(0xfff);	/* 12 zeros at the end */
-	void *ret = (void *)((unsigned long)ptr & mask);
-	/* printf("align_4k got %p returning %p\n",ptr,ret); */
-	return ret;
-}
-
-char *ffsb_strdup(const char *str)
-{
-	int len = strlen(str);
-	char *dup = ffsb_malloc(len + 1);
-	/* !!! am I off by one here ?? */
-	strncpy(dup, str, len + 1);
-	return dup;
-}
-
-size_t ffsb_strnlen(const char *str, size_t maxlen)
-{
-	size_t index = 0;
-
-	while (index < maxlen) {
-		if (str[index] == '\0')
-			break;
-		index++;
-	}
-	return index;
-}
-
-/* not perfect, in case we are somehow interrupted it's borked */
-void ffsb_sleep(unsigned secs)
-{
-	struct timeval tv = { 0, 0 };
-	tv.tv_sec = secs;
-	select(0, NULL, NULL, NULL, &tv);
-}
-
-char *ffsb_printsize(char *buf, double size, int bufsize)
-{
-	if (size >= 1024 * 1024 * 1024)
-		snprintf(buf, bufsize, "%.3gGB", size / (1024 * 1024 * 1024));
-	else if (size >= 1024 * 1024)
-		snprintf(buf, bufsize, "%.3gMB", size / (1024 * 1024));
-	else if (size >= 1024)
-		snprintf(buf, bufsize, "%.3gKB", size / 1024);
-	else
-		snprintf(buf, bufsize, "%.3gB", size);
-
-	return buf;
-}
-
-void ffsb_mkdir(char *dirname)
-{
-	if (mkdir(dirname, S_IRWXU) < 0) {
-		fprintf(stderr, "Error creating %s\n", dirname);
-		perror("mkdir");
-		exit(1);
-	}
-}
-
-struct timeval tvsub(struct timeval t1, struct timeval t0)
-{
-	struct timeval tdiff;
-	tdiff.tv_sec = t1.tv_sec - t0.tv_sec;
-	tdiff.tv_usec = t1.tv_usec - t0.tv_usec;
-	if (tdiff.tv_usec < 0)
-		tdiff.tv_sec--, tdiff.tv_usec += 1000000;
-	return tdiff;
-}
-
-struct timeval tvadd(struct timeval t1, struct timeval t0)
-{
-	struct timeval tdiff;
-	tdiff.tv_sec = t1.tv_sec + t0.tv_sec;
-	tdiff.tv_usec = t1.tv_usec + t0.tv_usec;
-	if (tdiff.tv_usec > 1000000)
-		tdiff.tv_sec++, tdiff.tv_usec -= 1000000;
-	return tdiff;
-}
-
-double tvtodouble(struct timeval *t)
-{
-	return ((double)t->tv_sec * (1000000.0f) + (double)t->tv_usec) /
-	    1000000.0f;
-}
-
-double cpu_so_far(void)
-{
-	struct rusage rusage;
-
-	getrusage(RUSAGE_SELF, &rusage);
-
-	return
-	    ((double)rusage.ru_utime.tv_sec) +
-	    (((double)rusage.ru_utime.tv_usec) / 1000000.0) +
-	    ((double)rusage.ru_stime.tv_sec) +
-	    (((double)rusage.ru_stime.tv_usec) / 1000000.0);
-}
-
-double cpu_so_far_children(void)
-{
-	struct rusage rusage;
-
-	getrusage(RUSAGE_CHILDREN, &rusage);
-
-	return
-	    ((double)rusage.ru_utime.tv_sec) +
-	    (((double)rusage.ru_utime.tv_usec) / 1000000.0) +
-	    ((double)rusage.ru_stime.tv_sec) +
-	    (((double)rusage.ru_stime.tv_usec) / 1000000.0);
-}
-
-/* !!!! check portability */
-float getfsutil(char *dirname)
-{
-	struct statvfs64 fsdata;
-
-	statvfs64(dirname, &fsdata);
-
-/* 	return (float)(fsdata.f_blocks-fsdata.f_bfree)/ */
-/* 		(float)(fsdata.f_blocks-fsdata.f_bfree+fsdata.f_bavail); */
-	return (float)(((float)(fsdata.f_blocks - fsdata.f_bfree)) /
-		       ((float)fsdata.f_blocks));
-}
-
-uint64_t getfsutil_size(char *dirname)
-{
-	struct statvfs64 fsdata;
-	statvfs64(dirname, &fsdata);
-
-	return (fsdata.f_blocks - fsdata.f_bfree) * fsdata.f_bsize;
-}
-
-int ffsb_system(char *command)
-{
-	int pid = 0, status;
-	extern char **environ;
-
-	if (command == NULL)
-		return 1;
-	pid = fork();
-	if (pid == -1)
-		return -1;
-	if (pid == 0) {
-		char *argv[4];
-		argv[0] = "sh";
-		argv[1] = "-c";
-		argv[2] = command;
-		argv[3] = 0;
-		execve("/bin/sh", argv, environ);
-		exit(127);
-	}
-	do {
-		if (waitpid(pid, &status, 0) == -1) {
-			if (errno != EINTR)
-				return -1;
-		} else
-			return status;
-	} while (1);
-}
-
-void ffsb_sync()
-{
-	struct timeval starttime, endtime, difftime;
-	printf("Syncing()...");
-	fflush(stdout);
-	gettimeofday(&starttime, NULL);
-	sync();
-	gettimeofday(&endtime, NULL);
-	timersub(&endtime, &starttime, &difftime);
-	printf("%ld sec\n", difftime.tv_sec);
-}
-
-void ffsb_getrusage(struct rusage *ru_self, struct rusage *ru_children)
-{
-	int ret = 0;
-/* 	printf("cpu_so_far is %lf\n",cpu_so_far()); */
-/* 	printf("cpu_so_far_children is %lf\n",cpu_so_far_children()); */
-	ret = getrusage(RUSAGE_SELF, ru_self);
-	if (ret < 0)
-		perror("getrusage self");
-
-/* 	printf("self returned %d\n",ret); */
-	ret = getrusage(RUSAGE_CHILDREN, ru_children);
-	if (ret < 0)
-		perror("getrusage children");
-/* 	printf("children returned %d\n",ret); */
-}
-
-void ffsb_milli_sleep(unsigned time)
-{
-	struct timeval tv = { 0, 0 };
-	if (!time)
-		return;
-	tv.tv_usec = time * 1000;
-	select(0, NULL, NULL, NULL, &tv);
-}
-
-void ffsb_micro_sleep(unsigned time)
-{
-	struct timeval tv = { 0, 0 };
-	if (!time)
-		return;
-	tv.tv_usec = time;
-	select(0, NULL, NULL, NULL, &tv);
-}
-
-void ffsb_barrier_init(ffsb_barrier_t * fb, unsigned count)
-{
-	memset(fb, 0, sizeof(*fb));
-	pthread_mutex_init(&fb->plock, NULL);
-	pthread_cond_init(&fb->pcond, NULL);
-	fb->required_count = count;
-}
-
-void ffsb_barrier_wait(ffsb_barrier_t * fb)
-{
-	pthread_mutex_lock(&fb->plock);
-
-	fb->current_count++;
-
-	if (fb->current_count == fb->required_count)
-		pthread_cond_broadcast(&fb->pcond);
-	else
-		while (fb->current_count != fb->required_count)
-			pthread_cond_wait(&fb->pcond, &fb->plock);
-
-	pthread_mutex_unlock(&fb->plock);
-}
-
-void ffsb_unbuffer_stdout(void)
-{
-#ifndef SETVBUF_REVERSED
-	setvbuf(stdout, NULL, _IONBF, 0);
-#else
-	setvbuf(stdout, _IONBF, NULL, 0);
-#endif
-}
-
-void ffsb_bench_gettimeofday(void)
-{
-	unsigned long i = 0;
-	uint64_t total_usec;
-	uint64_t average = 0;
-	struct timeval starttime, endtime, junk, difftime;
-	gettimeofday(&starttime, NULL);
-	for (i = 0; i < 1000000; i++)
-		gettimeofday(&junk, NULL);
-	gettimeofday(&endtime, NULL);
-	timersub(&endtime, &starttime, &difftime);
-	total_usec = difftime.tv_sec * 1000000;
-	total_usec += difftime.tv_usec;
-	average = total_usec / 1000ull;
-	printf("average time for gettimeofday(): %llu nsec\n", average);
-}
-
-void ffsb_bench_getpid(void)
-{
-	unsigned long i = 0;
-	uint64_t total_usec;
-	uint64_t average = 0;
-	struct timeval starttime, endtime, difftime;
-	gettimeofday(&starttime, NULL);
-	for (i = 0; i < 1000000; i++)
-		getpid();
-	gettimeofday(&endtime, NULL);
-	timersub(&endtime, &starttime, &difftime);
-	total_usec = difftime.tv_sec * 1000000;
-	total_usec += difftime.tv_usec;
-	average = total_usec / 1000ull;
-	printf("average time for getpid(): %llu nsec\n", average);
-}
diff --git a/utils/ffsb-6.0-rc2/util.h b/utils/ffsb-6.0-rc2/util.h
deleted file mode 100644
index 0de0364..0000000
--- a/utils/ffsb-6.0-rc2/util.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *   Copyright (c) International Business Machines Corp., 2001-2006
- *
- *   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
- */
-#ifndef _UTIL_H_
-#define _UTIL_H_
-
-#include "config.h"
-
-#include <sys/time.h>
-#include <sys/resource.h>
-
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#include <sys/statvfs.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <pthread.h>
-
-
-void ffsb_sleep(unsigned secs);
-void *ffsb_malloc(size_t size);
-void *ffsb_realloc(void *ptr, size_t size);
-char *ffsb_strdup(const char *str);
-size_t ffsb_strnlen(const char *str, size_t maxlen);
-
-void ffsb_mkdir(char *dirname);
-void ffsb_getrusage(struct rusage *ru_self, struct rusage *ru_children);
-void ffsb_sync(void);
-void *ffsb_align_4k(void *ptr);
-char *ffsb_printsize(char *buf, double size, int bufsize);
-
-int ffsb_system(char *command);
-void ffsb_milli_sleep(unsigned time);
-void ffsb_micro_sleep(unsigned time);
-void ffsb_unbuffer_stdout(void);
-void ffsb_bench_gettimeofday(void);
-void ffsb_bench_getpid(void);
-
-uint64_t ffsb_get_filesize(char *name);
-
-typedef struct {
-	unsigned required_count;
-	unsigned current_count;
-	pthread_mutex_t plock;
-	pthread_cond_t pcond;
-} ffsb_barrier_t ;
-
-void ffsb_barrier_init(ffsb_barrier_t *fb, unsigned count);
-void ffsb_barrier_wait(ffsb_barrier_t *fb);
-
-double cpu_so_far(void);
-double time_so_far(void);
-double cpu_so_far_children(void);
-float getfsutil(char *dirname);
-uint64_t getfsutil_size(char *dirname);
-
-struct timeval tvsub(struct timeval t1, struct timeval t0);
-struct timeval tvadd(struct timeval t1, struct timeval t0);
-double tvtodouble(struct timeval *t);
-
-
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
-#ifndef timersub
-#define timersub(a, b, result)                                          \
-	do {           	                                                \
-		(result)->tv_sec = (a)->tv_sec - (b)->tv_sec;		\
-		(result)->tv_usec = (a)->tv_usec - (b)->tv_usec;	\
-									\
-		if ((result)->tv_usec < 0) {				\
-			(result)->tv_sec--;				\
-			(result)->tv_usec += 1000000;			\
-		}							\
-	} while (0)
-#endif /* timersub */
-
-#endif /* _UTIL_H_ */
diff --git a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c
index 8efb4f5..3743679 100644
--- a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c
+++ b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c
@@ -1,39 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* SCTP kernel Implementation
  * Copyright (c) 2003 Hewlett-Packard Development Company, L.P
  * (C) Copyright IBM Corp. 2004
+ * Copyright (c) 2019 Martin Doucha <mdoucha@suse.cz>
  *
  * When init timeout is set to zero, a connect () crashed the system. This case
  * tests the fix for the same.
- *
- * The SCTP implementation 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, or (at your option)
- * any later version.
- *
- * The SCTP implementation 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 GNU CC; see the file COPYING.  If not, write to
- * the Free Software Foundation, 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Please send any bug reports or fixes you make to the
- * email address(es):
- *    lksctp developers <lksctp-developers@lists.sourceforge.net>
- *
- * Or submit a bug report through the following website:
- *    http://www.sf.net/projects/lksctp
- *
- *
- * Any bugs reported given to us we will try to fix... any fixes shared will
- * be incorporated into the next SCTP release.
- *
  */
+
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -43,78 +17,97 @@
 #include <sys/socket.h>
 #include <netinet/in.h>         /* for sockaddr_in */
 #include <arpa/inet.h>
-#include <errno.h>
 #include <netinet/sctp.h>
-#include <sys/uio.h>
-#include <sctputil.h> 
+#include "tst_test.h"
+#include "tst_net.h"
 
-char *TCID = __FILE__;
-int TST_TOTAL = 1;
-int TST_CNT = 0;
+#ifdef PROT_SOCK
+#define SCTP_TESTPORT_1 PROT_SOCK
+#else
+#define SCTP_TESTPORT_1 1024
+#endif
 
-int 
-main (int argc, char **argv)
+#define SCTP_IP_LOOPBACK  htonl(0x7f000001)
+
+static const struct test_case {
+	__u16 streams;
+	int accept_err;
+} testcase_list[] = {
+	{10, 0},
+	{65535, ENOMEM}
+};
+
+static void test_sctp(unsigned int n)
 {
-	int sk1, sk2, sk3, pf_class;
+	int sk1, sk2, sk3, msglen;
 	socklen_t len;
 	struct sockaddr_in lstn_addr, acpt_addr;
-	struct sockaddr_in conn_addr;
-	char * buffer_rcv;
+	char *buffer_rcv;
 	struct sctp_initmsg sinmsg;
-	char *message = "Hello World!\n";
+	const char *message = "Hello World!\n";
+	const struct test_case *tc = testcase_list + n;
 
-	/* Rather than fflush() throughout the code, set stdout to
-	 * be unbuffered.
-	 */
-	setvbuf(stdout, NULL, _IONBF, 0);
-	setvbuf(stderr, NULL, _IONBF, 0);
+	tst_res(TINFO, "Running test with %u streams", tc->streams);
 
-	/* Opening the socket*/
-	
-	pf_class = PF_INET;
+	sk1 = SAFE_SOCKET(PF_INET, SOCK_STREAM, IPPROTO_SCTP);
+	sk3 = SAFE_SOCKET(PF_INET, SOCK_STREAM, IPPROTO_SCTP);
 
-	sk1 = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP);
-	sk3 = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP);
+	lstn_addr.sin_family = AF_INET;
+	lstn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK;
+	lstn_addr.sin_port = htons(SCTP_TESTPORT_1);
 
-        conn_addr.sin_family = AF_INET;
-        conn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK;
-        conn_addr.sin_port = htons(SCTP_TESTPORT_1);
-
-        lstn_addr.sin_family = AF_INET;
-        lstn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK;
-        lstn_addr.sin_port = htons(SCTP_TESTPORT_1);
-
-	test_bind(sk3, (struct sockaddr *) &lstn_addr, sizeof(lstn_addr));
+	SAFE_BIND(sk3, (struct sockaddr *) &lstn_addr, sizeof(lstn_addr));
 
 	len = sizeof(struct sctp_initmsg);
-	sinmsg.sinit_num_ostreams = 65535;
+	sinmsg.sinit_num_ostreams = tc->streams;
 	sinmsg.sinit_max_instreams = 10;
 	sinmsg.sinit_max_attempts = 1;
 	sinmsg.sinit_max_init_timeo = 0;
-	test_setsockopt(sk1, SCTP_INITMSG, &sinmsg, len);
+	SAFE_SETSOCKOPT(sk1, SOL_SCTP, SCTP_INITMSG, &sinmsg, len);
 	sinmsg.sinit_num_ostreams = 10;
-	sinmsg.sinit_max_instreams = 65535;
-	test_setsockopt(sk3, SCTP_INITMSG, &sinmsg, len);
+	sinmsg.sinit_max_instreams = tc->streams;
+	SAFE_SETSOCKOPT(sk3, SOL_SCTP, SCTP_INITMSG, &sinmsg, len);
 
-	test_listen(sk3, 1);
+	SAFE_LISTEN(sk3, 1);
 
 	len = sizeof(struct sockaddr_in);
-	test_connect(sk1, (struct sockaddr *) &conn_addr, len);
+	TEST(connect(sk1, (struct sockaddr *) &lstn_addr, len));
 
-	sk2 = test_accept(sk3, (struct sockaddr *) &acpt_addr, &len);
+	if (TST_RET == -1 && tc->accept_err && TST_ERR == tc->accept_err) {
+		tst_res(TPASS, "connect() failed in an acceptable way");
+		SAFE_CLOSE(sk1);
+		SAFE_CLOSE(sk3);
+		return;
+	} else if (TST_RET < 0) {
+		tst_brk(TBROK | TTERRNO, "connect() failed");
+	}
 
-	test_sctp_sendmsg(sk1, message, strlen(message) + 1,
-			  (struct sockaddr *)&conn_addr, len,
-			  0, 0, 65534, 0, 0);
+	sk2 = SAFE_ACCEPT(sk3, (struct sockaddr *) &acpt_addr, &len);
 
-	buffer_rcv = malloc(100);
-	test_recv(sk2, buffer_rcv, (strlen(message) + 1), MSG_NOSIGNAL);
+	msglen = strlen(message) + 1;
+	TEST(sctp_sendmsg(sk1, message, msglen, (struct sockaddr *)&lstn_addr,
+		len, 0, 0, tc->streams - 1, 0, 0));
 
-	tst_resm(TPASS, "connect() with init timeout set to 0 - SUCCESS");
+	if (TST_RET != msglen) {
+		tst_brk(TBROK | TTERRNO, "sctp_sendmsg() failed");
+	}
 
-	close (sk1);
-	close (sk2);
-	close (sk3);
-	
-        return 0;
+	buffer_rcv = malloc(msglen);
+	TEST(recv(sk2, buffer_rcv, msglen, MSG_NOSIGNAL));
+
+	if (TST_RET != msglen || strncmp(buffer_rcv, message, msglen)) {
+		tst_res(TFAIL | TTERRNO, "recv() failed");
+	} else {
+		tst_res(TPASS, "connect() with init timeout set to 0");
+	}
+
+	free(buffer_rcv);
+	SAFE_CLOSE(sk1);
+	SAFE_CLOSE(sk2);
+	SAFE_CLOSE(sk3);
 }
+
+static struct tst_test test = {
+	.test = test_sctp,
+	.tcnt = ARRAY_SIZE(testcase_list),
+};
diff --git a/utils/sctp/func_tests/test_getname.c b/utils/sctp/func_tests/test_getname.c
index ffc4735..f7070a3 100644
--- a/utils/sctp/func_tests/test_getname.c
+++ b/utils/sctp/func_tests/test_getname.c
@@ -41,7 +41,6 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -92,7 +91,7 @@
         svr_sk = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP);
 	test_bind(svr_sk, &svr_loop.sa, sizeof(svr_loop));
 
-	bzero(&svr_local_addr, sizeof(svr_local_addr));
+	memset(&svr_local_addr, 0, sizeof(svr_local_addr));
 	len = sizeof(svr_local_addr);
 	/* Verify that getsockname() on an unconnected socket works fine. */
 	error = getsockname(svr_sk, (struct sockaddr *)&svr_local_addr, &len);
@@ -101,7 +100,7 @@
 
 	tst_resm(TPASS, "getsockname on an unconnected socket");
 
-	bzero(&svr_peer_addr, sizeof(svr_peer_addr));
+	memset(&svr_peer_addr, 0, sizeof(svr_peer_addr));
 	len = sizeof(svr_peer_addr);
 	/* Verify that getpeername() on an unconnected socket fails. */
 	error = getpeername(svr_sk, (struct sockaddr *)&svr_peer_addr, &len);
@@ -125,7 +124,7 @@
 #endif
 	test_connect(clt_sk, &svr_loop.sa, sizeof(svr_loop));
 
-	bzero(&clt_local_addr, sizeof(clt_local_addr));
+	memset(&clt_local_addr, 0, sizeof(clt_local_addr));
 	len = sizeof(clt_local_addr);
 	/* Get the client's local address. */
 	error = getsockname(clt_sk, (struct sockaddr *)&clt_local_addr, &len);
@@ -135,7 +134,7 @@
 
 	tst_resm(TPASS, "getsockname on a connected client socket");
 
-	bzero(&clt_peer_addr, sizeof(clt_peer_addr));
+	memset(&clt_peer_addr, 0, sizeof(clt_peer_addr));
 	len = sizeof(clt_peer_addr);
 	/* Get the client's peer address. */
 	error = getpeername(clt_sk, (struct sockaddr *)&clt_peer_addr, &len);
@@ -149,7 +148,7 @@
 	len = sizeof(accept_loop);
 	accept_sk = test_accept(svr_sk, &accept_loop.sa, &len); 
 
-	bzero(&svr_local_addr, sizeof(svr_local_addr));
+	memset(&svr_local_addr, 0, sizeof(svr_local_addr));
 	len = sizeof(svr_local_addr);
 	/* Get the server's local address. */
 	error = getsockname(accept_sk, (struct sockaddr *)&svr_local_addr,
@@ -160,7 +159,7 @@
 
 	tst_resm(TPASS, "getsockname on a connected server socket");
 
-	bzero(&svr_peer_addr, sizeof(svr_peer_addr));
+	memset(&svr_peer_addr, 0, sizeof(svr_peer_addr));
 	len = sizeof(svr_peer_addr);
 	/* Get the server's peer address. */
 	error = getpeername(accept_sk, (struct sockaddr *)&svr_peer_addr,
@@ -200,7 +199,7 @@
 #endif
 	tst_resm(TPASS, "getsockname/getpeername server/client match");
 
-	bzero(&clt_local_addr, sizeof(clt_local_addr));
+	memset(&clt_local_addr, 0, sizeof(clt_local_addr));
 	len = sizeof(clt_local_addr);
 	/*getsockname():  Bad socket descriptor, EBADF expected error*/
 	error = getsockname(-1, (struct sockaddr *)&clt_local_addr, &len);
@@ -235,7 +234,7 @@
 
 	tst_resm(TPASS, "getsockname with invalid buffer - EFAULT");
  
-	bzero(&clt_peer_addr, sizeof(clt_peer_addr));
+	memset(&clt_peer_addr, 0, sizeof(clt_peer_addr));
 	len = sizeof(clt_peer_addr);
 	/*getpeername():  Bad socket descriptor, EBADF expected error*/
 	error = getpeername(-1, (struct sockaddr *)&clt_local_addr, &len);
diff --git a/ver_linux b/ver_linux
index 6c2706b..824c395 100755
--- a/ver_linux
+++ b/ver_linux
@@ -70,7 +70,7 @@
 ld -v 2>&1 | awk -F\) '{print $1}' | awk \
       '/BFD/{print "binutils              ",$NF}'
 
-fdformat --version 2>&1 | awk -F\- '{print "util-linux            ", $NF}'
+mkswap -V 2>&1 | awk '{print "util-linux            ", $NF}'
 
 mount --version 2>&1 | awk -F\- '{print "mount                 ", $NF}'
 
@@ -112,6 +112,9 @@
 ping -V 2>&1 | awk \
 'NR==1{print "iputils               ", $NF}'
 
+ethtool --version | grep version 2>&1 | awk \
+'NR==1{print "ethtool               ", $NF}'
+
 # Kbd needs 'loadkeys -h',
 loadkeys -h 2>&1 | awk \
 '(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'