Merge remote-tracking branch 'strace/master' into HEAD

Change-Id: I818627080b47fdadcd619d6220579fecbb6bc28c
diff --git a/.gitignore b/.gitignore
index 9d6703e..596f363 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,9 +39,6 @@
 /ioctls_all[012].h
 /ioctlsort[012]
 
-/sen.h
-/sys_func.h
-
 /strace-*.tar.xz
 
 /tests-m32
@@ -49,17 +46,9 @@
 
 /libmpers-m32.a
 /libmpers-mx32.a
-/m32_funcs.h
-/m32_printer_decls.h
-/m32_printer_defs.h
-/m32_type_defs.h
 /mpers-m32
 /mpers-m32.stamp
 /mpers-mx32
 /mpers-mx32.stamp
 /mpers.am
-/mpers_xlat.h
-/mx32_funcs.h
-/mx32_printer_decls.h
-/mx32_printer_defs.h
-/mx32_type_defs.h
+/*.mpers.i
diff --git a/.travis.yml b/.travis.yml
index e70329a..6a77b21 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@
 
 env:
   global:
-    - SLEEP_A_BIT="sleep 0.1"
+    - SLEEP_A_BIT="sleep 0.2"
     - VERBOSE="1"
   matrix:
     - TARGET=x86_64
diff --git a/Android.mk b/Android.mk
index 9116204..51e7751 100644
--- a/Android.mk
+++ b/Android.mk
@@ -36,7 +36,7 @@
 # We don't currently have a good solution for the 'configure' side of things.
 # You can get a list of the HAVE_* variables in use and manually go through it:
 #
-#   find . -name "*.[ch]" | xargs grep HAVE_ | sed 's/.*\(HAVE_[A-Z0-9_]*\).*/\1/p' | sort | uniq -d
+#   find . -name "*.[ch]" | xargs grep HAVE_ | sed 's/.*\(HAVE_[A-Z0-9_]*\).*/\1/p' | grep -v HAVE_DECL_ | sort | uniq -d
 
 # -------------------------------------------------------------------------
 
@@ -51,6 +51,7 @@
     bjm.c \
     block.c \
     bpf.c \
+    btrfs.c \
     cacheflush.c \
     capability.c \
     chdir.c \
@@ -62,6 +63,7 @@
     dirent.c \
     dirent64.c \
     epoll.c \
+    evdev.c \
     eventfd.c \
     execve.c \
     exit.c \
@@ -72,14 +74,20 @@
     fcntl.c \
     fetch_seccomp_fprog.c \
     fetch_struct_flock.c \
+    fetch_struct_statfs.c \
     file.c \
     file_handle.c \
+    file_ioctl.c \
     flock.c \
+    fstatfs.c \
+    fstatfs64.c \
+    fs_x_ioctl.c \
     futex.c \
     getcpu.c \
     getcwd.c \
     getrandom.c \
     get_robust_list.c \
+    hdio.c \
     hostname.c \
     inotify.c \
     io.c \
@@ -108,6 +116,7 @@
     mq.c \
     mtd.c \
     net.c \
+    numa.c \
     open.c \
     pathtrace.c \
     perf.c \
@@ -117,6 +126,7 @@
     print_mq_attr.c \
     print_msgbuf.c \
     print_sigevent.c \
+    print_statfs.c \
     print_time.c \
     print_timex.c \
     printmode.c \
@@ -144,9 +154,11 @@
     socketutils.c \
     sram_alloc.c \
     statfs.c \
+    statfs64.c \
     strace.c \
     swapon.c \
     sync_file_range.c \
+    sync_file_range2.c \
     syscall.c \
     sysctl.c \
     sysinfo.c \
@@ -156,6 +168,7 @@
     time.c \
     times.c \
     truncate.c \
+    ubi.c \
     uid16.c \
     uid.c \
     umask.c \
@@ -174,10 +187,7 @@
 
 LOCAL_SHARED_LIBRARIES :=
 
-LOCAL_CFLAGS := \
-    -DGETGROUPS_T=gid_t \
-    -DHAVE_ASM_SIGCONTEXT_H=1 \
-    -DHAVE_DECL_PTRACE_EVENT_FORK=1 \
+#    -DHAVE_DECL_PTRACE_EVENT_FORK=1 \
     -DHAVE_DECL_PTRACE_EVENT_VFORK=1 \
     -DHAVE_DECL_PTRACE_EVENT_CLONE=1 \
     -DHAVE_DECL_PTRACE_EVENT_EXEC=1 \
@@ -197,17 +207,36 @@
     -UHAVE_DECL_LO_FLAGS_AUTOCLEAR \
     -UHAVE_DECL_LO_FLAGS_PARTSCAN \
     -DHAVE_DECL_SYS_ERRLIST=1 \
+
+LOCAL_CFLAGS := \
+    -DGETGROUPS_T=gid_t \
+    \
+    -UHAVE_ASM_CACHECTL_H \
+    -DHAVE_ASM_SIGCONTEXT_H=1 \
+    -DHAVE_BLKGETSIZE64=1 \
+    -UHAVE_BLUETOOTH_BLUETOOTH_H \
+    -DHAVE___BUILTIN_POPCOUNT=1 \
+    -DHAVE_DIRENT_H=1 \
+    -DHAVE_DLADDR=1 \
     -DHAVE_ELF_H=1 \
     -DHAVE_FOPEN64=1 \
     -DHAVE_FORK=1 \
+    -DHAVE_FSTATAT=1 \
+    -DHAVE_FTRUNCATE=1 \
+    -DHAVE_FUTIMENS=1 \
     -DHAVE_IF_INDEXTONAME=1 \
     -DHAVE_INET_NTOP=1 \
-    -DHAVE_LINUX_CAPABILITY_H=1 \
+    -DHAVE_INET_PTON=1 \
+    -DHAVE_INTTYPES_H=1 \
+    -DHAVE_LINUX_BPF_H=1 \
+    -DHAVE_LINUX_BSG_H=1 \
+    -DHAVE_LINUX_BTRFS_H=1 \
     -DHAVE_LINUX_FALLOC_H=1 \
     -DHAVE_LINUX_FILTER_H=1 \
     -DHAVE_LINUX_FUTEX_H=1 \
     -DHAVE_LINUX_ICMP_H=1 \
     -DHAVE_LINUX_IF_PACKET_H=1 \
+    -DHAVE_LINUX_INPUT_H=1 \
     -DHAVE_LINUX_IN6_H=1 \
     -DHAVE_LINUX_IPC_H=1 \
     -DHAVE_LINUX_MQUEUE=1 \
@@ -234,6 +263,7 @@
     -DHAVE_STATFS64=1 \
     -DHAVE_STDBOOL_H=1 \
     -DHAVE_STRERROR=1 \
+    -DHAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS=1 \
     -DHAVE_STRUCT_FLOCK=1 \
     -DHAVE_STRUCT_FLOCK64=1 \
     -DHAVE_STRUCT_MMSGHDR=1 \
@@ -260,6 +290,9 @@
     -DHAVE_SYS_REG_H=1 \
     -DHAVE_SYS_VFS_H=1 \
     -DHAVE_SYS_XATTR_H=1 \
+    -DHAVE_UNISTD_H=1 \
+    -DHAVE_UTIMENSAT=1 \
+    \
     -DMAJOR_IN_SYSMACROS \
     -DPACKAGE_NAME='"strace"' \
     -DVERSION='"$(strace_version)"' \
diff --git a/Makefile.am b/Makefile.am
index e15c2d9..77e0cc8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,6 +64,12 @@
 libstrace_a_CPPFLAGS = $(strace_CPPFLAGS)
 libstrace_a_CFLAGS = $(strace_CFLAGS)
 libstrace_a_SOURCES =	\
+	fstatfs.c \
+	fstatfs64.c \
+	statfs.c \
+	statfs64.c \
+	sync_file_range.c \
+	sync_file_range2.c \
 	upeek.c		\
 	# end of libstrace_a_SOURCES
 
@@ -75,6 +81,7 @@
 	bjm.c		\
 	block.c		\
 	bpf.c		\
+	btrfs.c		\
 	cacheflush.c	\
 	capability.c	\
 	caps0.h		\
@@ -101,8 +108,11 @@
 	fcntl.c		\
 	fetch_seccomp_fprog.c \
 	fetch_struct_flock.c \
+	fetch_struct_statfs.c \
 	file.c		\
 	file_handle.c	\
+	file_ioctl.c	\
+	fs_x_ioctl.c	\
 	flock.c		\
 	flock.h		\
 	futex.c		\
@@ -111,6 +121,7 @@
 	getcpu.c	\
 	getcwd.c	\
 	getrandom.c	\
+	hdio.c		\
 	hostname.c	\
 	inotify.c	\
 	io.c		\
@@ -145,6 +156,7 @@
 	mtd.c		\
 	native_defs.h	\
 	net.c		\
+	numa.c		\
 	open.c		\
 	or1k_atomic.c	\
 	pathtrace.c	\
@@ -155,6 +167,7 @@
 	print_mq_attr.c	\
 	print_msgbuf.c	\
 	print_sigevent.c \
+	print_statfs.c	\
 	print_time.c	\
 	print_timex.c	\
 	printmode.c	\
@@ -188,9 +201,9 @@
 	socketutils.c	\
 	sram_alloc.c	\
 	statfs.c	\
+	statfs.h	\
 	strace.c	\
 	swapon.c	\
-	sync_file_range.c \
 	syscall.c	\
 	sysctl.c	\
 	sysinfo.c	\
@@ -200,6 +213,7 @@
 	time.c		\
 	times.c		\
 	truncate.c	\
+	ubi.c		\
 	uid.c		\
 	uid16.c		\
 	umask.c		\
@@ -213,6 +227,7 @@
 	vsprintf.c	\
 	wait.c		\
 	xattr.c		\
+	xlat.h		\
 	xmalloc.c	\
 	# end of strace_SOURCES
 
@@ -224,9 +239,9 @@
 endif
 
 @CODE_COVERAGE_RULES@
-CODE_COVERAGE_LCOV_OPTIONS = \
-	$(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) --rc lcov_branch_coverage=1
-CODE_COVERAGE_GENHTML_OPTIONS = --rc lcov_branch_coverage=1
+CODE_COVERAGE_BRANCH_COVERAGE = 1
+CODE_COVERAGE_GENHTML_OPTIONS = $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) \
+	--prefix $(shell realpath -Ls $(abs_top_srcdir)/..)
 CODE_COVERAGE_IGNORE_PATTERN = '/usr/include/*'
 strace_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
 strace_CFLAGS += $(CODE_COVERAGE_CFLAGS)
@@ -426,6 +441,7 @@
 	linux/mips/syscallent.h		\
 	linux/mips/userent.h		\
 	linux/mtd-abi.h			\
+	linux/netlink_diag.h		\
 	linux/nios2/arch_regs.c		\
 	linux/nios2/get_error.c		\
 	linux/nios2/get_scno.c		\
@@ -641,7 +657,8 @@
 $(srcdir)/.version:
 	$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
 
-strace_SOURCES_c = $(filter %.c,$(strace_SOURCES))
+strace_SOURCES_c = \
+	$(filter %.c,$(strace_SOURCES)) $(filter %.c,$(libstrace_a_SOURCES))
 
 sys_func.h: $(patsubst %,$(srcdir)/%,$(strace_SOURCES_c))
 	for f in $^; do \
@@ -682,6 +699,15 @@
 
 ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
 ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
+ioctl_redefs_h = $(filter-out ioctl_redefs0.h,$(subst ioctlent,ioctl_redefs,$(ioctlent_h)))
+
+ioctl_redefs%.h: ioctlent%.h ioctlent0.h
+	sort $< > $<-t
+	sort ioctlent0.h | comm -23 $<-t - | \
+		sed -n 's/^{ "\([^"]\+\)", \(0x[[:xdigit:]]\+\) },$$/#ifdef \1\n# undef \1\n# define \1 \2\n#endif/p' \
+		> $@-t
+	rm -f $<-t
+	mv $@-t $@
 
 ioctlent%.h: ioctlsort%
 	./$< > $@
@@ -695,13 +721,16 @@
 ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
 	cat $^ > $@
 
-BUILT_SOURCES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
-CLEANFILES    = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
+BUILT_SOURCES = $(ioctl_redefs_h) $(ioctlent_h) \
+		native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
+CLEANFILES    = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
+		native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
 DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
 
 # defines mpers_source_files
 include mpers.am
 srcdir_mpers_source_files = $(patsubst %,$(srcdir)/%,$(mpers_source_files))
+mpers_preproc_files = $(mpers_source_files:.c=.c.mpers.i)
 
 mpers_NAME =
 mpers_PREFIX = $(mpers_NAME)_
@@ -729,6 +758,7 @@
 	echo '#undef MPERS_PRINTER_NAME' >> $@-t
 	echo '#define MPERS_PRINTER_NAME(printer_name) printer_name' >> $@-t
 	echo '#include "$(mpers_PREFIX)printer_decls.h"' >> $@-t
+	echo '#include MPERS_$(mpers_PREFIX)IOCTL_MACROS' >> $@-t
 	mv $@-t $@
 
 m%_funcs.h: $(srcdir_mpers_source_files)
@@ -740,28 +770,36 @@
 
 # printers
 
-printers.h: $(srcdir_mpers_source_files)
+%.c.mpers.i: $(srcdir)/%.c
+	$(CPP) -P $(mpers_sh_opts) -DIN_MPERS_BOOTSTRAP $< -o $@
+
+mpers_printer_decl_pattern = ^MPERS_PRINTER_DECL(\([^,)]\+\),[[:space:]]*\([^,)]\+\),[[:space:]]*\([^)]\+\))$$
+
+printers.h: $(mpers_preproc_files)
 	echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
 	echo 'typedef struct {' >> $@-t
 	for f in $^; do \
-		sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/ \1 (*\2) \3;\n#define \2 MPERS_PRINTER_NAME(\2)\n/p' $$f || exit; \
+		sed -n 's/$(mpers_printer_decl_pattern)/ \1 (*\2)(\3);\n#define \2 MPERS_PRINTER_NAME(\2)\n/p' $$f \
+		|| exit; \
 	done >> $@-t
 	echo '} struct_printers;' >> $@-t
 	echo 'extern const struct_printers *printers;' >> $@-t
 	echo '#define MPERS_PRINTER_NAME(printer_name) printers->printer_name' >> $@-t
 	mv $@-t $@
 
-%_printer_decls.h: $(srcdir_mpers_source_files)
+%_printer_decls.h: $(mpers_preproc_files)
 	echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
 	for f in $^; do \
-		sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/extern \1 $(mpers_PREFIX)\2\3;/p' $$f || exit; \
+		sed -n 's/$(mpers_printer_decl_pattern)/extern \1 $(mpers_PREFIX)\2(\3);/p' $$f \
+		|| exit; \
 	done >> $@-t
 	mv $@-t $@
 
-%_printer_defs.h: $(srcdir_mpers_source_files)
+%_printer_defs.h: $(mpers_preproc_files)
 	echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
 	for f in $^; do \
-		sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/\.\2 = $(mpers_PREFIX)\2,/p' $$f || exit; \
+		sed -n 's/$(mpers_printer_decl_pattern)/\.\2 = $(mpers_PREFIX)\2,/p' $$f \
+		|| exit; \
 	done >> $@-t
 	mv $@-t $@
 
diff --git a/NEWS b/NEWS
index 4cd5677..4ffc90c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,23 +1,38 @@
-Noteworthy changes in release ?.?? (????-??-??)
+Noteworthy changes in release 4.12 (2016-05-31)
 ===============================================
 
 * Improvements
   * Implemented simultaneous use of -p option and tracing of a command.
     (addresses Debian bug #549942).
-  * Enhanced decoding of personality, sched_getaffinity,
-    and sched_setaffinity syscalls.
-  * Enhanced decoding of getxpid, getxuid, and getxgid syscalls on alpha.
-  * Added decoding of bind, listen, and setsockopt direct syscalls on sparc.
   * Implemented caching of netlink conversations to reduce amount of time
     spent in decoding socket details in -yy mode.
-  * Implemented decoding of copy_file_range syscall.
-  * Implemented dumping of preadv, pwritev, and vmsplice syscalls.
-  * Updated lists of ioctl commands from Linux 4.5.
+  * Implemented -yy mode decoding of protocol:portid pairs associated with
+    netlink socket descriptors.
+  * Implemented decoding of copy_file_range, preadv2, and pwritev2 syscalls.
+  * Implemented dumping of preadv, preadv2, pwritev, pwritev2, and vmsplice
+    syscalls.
+  * Implemented decoding of BTRFS_* and UFFDIO_* ioctl commands.
+  * Enhanced decoding of BLK*, EVIOC*, RTC_*, and VIDIOC_* ioctl commands.
+  * Enhanced decoding of fstatfs, fstatfs64, get_mempolicy, getdents,
+    getdents64, getgroups, getpriority, kill, mbind, migrate_pages, mknod,
+    mknodat, personality, poll, ppoll, quotactl, rt_sigpending,
+    rt_sigqueueinfo, rt_sigtimedwait, rt_tgsigqueueinfo, sched_getaffinity,
+    sched_setaffinity, seccomp, set_mempolicy, setgroups, setpriority, statfs,
+    statfs64, tgkill, waitid, and xattr family syscalls.
+  * Enhanced decoding of getxpid, getxuid, and getxgid syscalls on alpha.
+  * Enhanced decoding of pipe syscall on alpha, ia64, mips, sh, and sparc.
+  * Added decoding of bind, listen, and setsockopt direct syscalls on sparc.
+  * Added decoding of osf_statfs64 and osf_fstatfs64 syscalls on alpha.
+  * Added decoding of fadvise64 and fadvise64_64 on s390.
+  * Updated lists of AF_*, BPF_MAP_TYPE_*, CLONE_*, EPOLL*, IPV6_*, MADV_*,
+    MSG_*, PTRACE_*, SEGV_*, SO_*, SOL_*, *_MAGIC, and quotactl constants.
+  * Updated lists of ioctl commands from Linux 4.6.
 
 * Bug fixes
   * Fixed build on arc, metag, nios2, or1k, and tile architectures.
   * Fixed decoding of 32-bit times syscall return value on 64-bit architectures.
   * Fixed decoding of mlock2 syscall on sparc.
+  * Fixed decoding of osf_shmat syscall on alpha.
   * Fixed decoding of syscalls unknown to the kernel on s390/s390x.
     (addresses Debian bug #485979 and Fedora bug #1298294).
   * Fixed decoding of preadv syscall in case of short read.
@@ -26,6 +41,7 @@
   * Fixed decoding of mincore syscall's last argument.
   * Fixed remaining errors in mapping between syscall numbers and numbers
     of syscall arguments.
+  * Applied various fixes to strace-graph script.
 
 Noteworthy changes in release 4.11 (2015-12-21)
 ===============================================
diff --git a/README-mpers b/README-mpers
index 8ae418d..ad1ca18 100644
--- a/README-mpers
+++ b/README-mpers
@@ -8,7 +8,7 @@
 (containing definitions of these types or other behaviour-affecting
 defines);
 * printers should be defined
-as MPERS_PRINTER_DECL(return_type, function_name)(args),
+as MPERS_PRINTER_DECL(return_type, function_name, args),
 inside files that include MPERS_DEFS these printers should be called
 as MPERS_FUNC_NAME(function_name)(args), in other files
 they should be called just as function_name(args).
diff --git a/aio.c b/aio.c
index 1cbd533..e02af7d 100644
--- a/aio.c
+++ b/aio.c
@@ -154,52 +154,54 @@
 	}
 }
 
+static bool
+print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	unsigned long addr;
+	struct iocb cb;
+
+	if (elem_size < sizeof(long)) {
+		addr = * (unsigned int *) elem_buf;
+	} else {
+		addr = * (unsigned long *) elem_buf;
+	}
+
+	tprints("{");
+	if (!umove_or_printaddr(tcp, addr, &cb))
+		print_iocb(tcp, &cb);
+	tprints("}");
+
+	return true;
+}
+
 SYS_FUNC(io_submit)
 {
-	long nr = tcp->u_arg[1];
-	/* if nr <= 0, we end up printing just "[]" */
-	tprintf("%lu, %ld, [", tcp->u_arg[0], nr);
-	{
-		long i;
-		long iocbs = tcp->u_arg[2];
+	const long nr = widen_to_long(tcp->u_arg[1]);
+	const unsigned long addr = tcp->u_arg[2];
+	unsigned long iocbp;
 
-		for (i = 0; i < nr; ++i, iocbs += current_wordsize) {
-			unsigned long iocbp;
-			struct iocb cb;
+	tprintf("%lu, %ld, ", tcp->u_arg[0], nr);
 
-			if (i)
-				tprints(", ");
+	if (nr < 0)
+		printaddr(addr);
+	else
+		print_array(tcp, addr, nr, &iocbp, current_wordsize,
+			    umoven_or_printaddr, print_iocbp, 0);
 
-			if (umove_ulong_or_printaddr(tcp, iocbs, &iocbp)) {
-				/*
-				 * No point in trying to read the whole array
-				 * because nr can be ridiculously large.
-				 */
-				break;
-			}
-
-			tprints("{");
-			if (!umove_or_printaddr(tcp, iocbp, &cb))
-				print_iocb(tcp, &cb);
-			tprints("}");
-		}
-	}
-	tprints("]");
 	return RVAL_DECODED;
 }
 
-static int
-print_io_event(struct tcb *tcp, const long addr)
+static bool
+print_io_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
-	struct io_event event;
+	struct io_event *event = elem_buf;
 
-	if (umove_or_printaddr(tcp, addr, &event))
-		return -1;
 	tprintf("{data=%#" PRIx64 ", obj=%#" PRIx64
 		", res=%" PRId64 ", res2=%" PRId64 "}",
-		(uint64_t) event.data, (uint64_t) event.obj,
-		(int64_t) event.res, (int64_t) event.res2);
-	return 0;
+		(uint64_t) event->data, (uint64_t) event->obj,
+		(int64_t) event->res, (int64_t) event->res2);
+
+	return true;
 }
 
 SYS_FUNC(io_cancel)
@@ -215,7 +217,10 @@
 		}
 		tprints(", ");
 	} else {
-		print_io_event(tcp, tcp->u_arg[2]);
+		struct io_event event;
+
+		if (!umove_or_printaddr(tcp, tcp->u_arg[2], &event))
+			print_io_event(tcp, &event, sizeof(event), 0);
 	}
 	return 0;
 }
@@ -224,26 +229,14 @@
 {
 	if (entering(tcp)) {
 		tprintf("%lu, %ld, %ld, ",
-			tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
+			tcp->u_arg[0],
+			widen_to_long(tcp->u_arg[1]),
+			widen_to_long(tcp->u_arg[2]));
 	} else {
-		if (tcp->u_rval == 0) {
-			tprints("[]");
-		} else {
-			struct io_event *events = (void *)tcp->u_arg[3];
-			long i, nr = tcp->u_rval;
-
-			for (i = 0; i < nr; i++, events++) {
-				if (i == 0)
-					tprints("[");
-				else
-					tprints(", ");
-
-				if (print_io_event(tcp, (long)events))
-					break;
-			}
-			tprints("], ");
-		}
-
+		struct io_event buf;
+		print_array(tcp, tcp->u_arg[3], tcp->u_rval, &buf, sizeof(buf),
+			    umoven_or_printaddr, print_io_event, 0);
+		tprints(", ");
 		/*
 		 * Since the timeout parameter is read by the kernel
 		 * on entering syscall, it has to be decoded the same way
diff --git a/alpha.c b/alpha.c
index e343b7e..70d4ca5 100644
--- a/alpha.c
+++ b/alpha.c
@@ -60,4 +60,24 @@
 	return decode_getxxid(tcp, "egid");
 }
 
+SYS_FUNC(osf_statfs)
+{
+	printpath(tcp, tcp->u_arg[0]);
+	tprints(", ");
+	printaddr(tcp->u_arg[1]);
+	tprints(", ");
+	tprintf("%lu", tcp->u_arg[2]);
+	return RVAL_DECODED;
+}
+
+SYS_FUNC(osf_fstatfs)
+{
+	printfd(tcp, tcp->u_arg[0]);
+	tprints(", ");
+	printaddr(tcp->u_arg[1]);
+	tprints(", ");
+	tprintf("%lu", tcp->u_arg[2]);
+	return RVAL_DECODED;
+}
+
 #endif /* ALPHA */
diff --git a/block.c b/block.c
index 1e02fa7..ac33c38 100644
--- a/block.c
+++ b/block.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com>
+ * Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,16 +27,16 @@
  */
 
 #include "defs.h"
+
+#include DEF_MPERS_TYPE(struct_blk_user_trace_setup)
+#include DEF_MPERS_TYPE(struct_blkpg_ioctl_arg)
+#include DEF_MPERS_TYPE(struct_blkpg_partition)
+
 #include <linux/blkpg.h>
 #include <linux/fs.h>
-#include <linux/hdreg.h>
-
-/* ioctls <= 114 are present in Linux 2.4. The following ones have been
- * added since then and headers containing them may not be available on
- * every system. */
 
 #define BLKTRACE_BDEV_SIZE      32
-struct blk_user_trace_setup {
+typedef struct blk_user_trace_setup {
 	char name[BLKTRACE_BDEV_SIZE];	/* output */
 	uint16_t act_mask;		/* input */
 	uint32_t buf_size;		/* input */
@@ -43,10 +44,21 @@
 	uint64_t start_lba;
 	uint64_t end_lba;
 	uint32_t pid;
-};
+} struct_blk_user_trace_setup;
+
+typedef struct blkpg_ioctl_arg struct_blkpg_ioctl_arg;
+typedef struct blkpg_partition struct_blkpg_partition;
+
+#include MPERS_DEFS
+
+/*
+ * ioctl numbers <= 114 are present in Linux 2.4.  The following ones have been
+ * added since then and headers containing them may not be available on every
+ * system.
+ */
 
 #ifndef BLKTRACESETUP
-# define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
+# define BLKTRACESETUP _IOWR(0x12, 115, struct_blk_user_trace_setup)
 #endif
 #ifndef BLKTRACESTART
 # define BLKTRACESTART _IO(0x12,116)
@@ -84,13 +96,16 @@
 #ifndef BLKZEROOUT
 # define BLKZEROOUT _IO(0x12,127)
 #endif
+#ifndef BLKDAXGET
+# define BLKDAXGET _IO(0x12,129)
+#endif
 
 #include "xlat/blkpg_ops.h"
 
 static void
-print_blkpg_req(struct tcb *tcp, const struct blkpg_ioctl_arg *blkpg)
+print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg)
 {
-	struct blkpg_partition p;
+	struct_blkpg_partition p;
 
 	tprints("{");
 	printxval(blkpg_ops, blkpg->op, "BLKPG_???");
@@ -100,7 +115,7 @@
 
 	if (!umove_or_printaddr(tcp, (long) blkpg->data, &p)) {
 		tprintf("{start=%lld, length=%lld, pno=%d, devname=",
-			p.start, p.length, p.pno);
+			(long long) p.start, (long long) p.length, p.pno);
 		print_quoted_string(p.devname, sizeof(p.devname),
 				    QUOTE_0_TERMINATED);
 		tprints(", volname=");
@@ -111,8 +126,8 @@
 	tprints("}");
 }
 
-int
-block_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *tcp,
+		   const unsigned int code, const long arg)
 {
 	switch (code) {
 	/* take arg as a value, not as a pointer */
@@ -121,13 +136,6 @@
 		tprintf(", %lu", arg);
 		break;
 
-	/* take a signed int */
-	case BLKROSET:
-	case BLKBSZSET:
-		tprints(", ");
-		printnum_int(tcp, arg, "%d");
-		break;
-
 	/* return an unsigned short */
 	case BLKSECTGET:
 	case BLKROTATIONAL:
@@ -142,8 +150,13 @@
 	case BLKBSZGET:
 	case BLKSSZGET:
 	case BLKALIGNOFF:
+	case BLKDAXGET:
 		if (entering(tcp))
 			return 0;
+		/* fall through */
+	/* take a signed int */
+	case BLKROSET:
+	case BLKBSZSET:
 		tprints(", ");
 		printnum_int(tcp, arg, "%d");
 		break;
@@ -191,29 +204,12 @@
 	case BLKSECDISCARD:
 	case BLKZEROOUT:
 		tprints(", ");
-		printpair_int64(tcp, arg, "%" PRIx64);
+		printpair_int64(tcp, arg, "%" PRIu64);
 		break;
 
 	/* More complex types */
-	case HDIO_GETGEO:
-		if (entering(tcp))
-			return 0;
-		else {
-			struct hd_geometry geo;
-
-			tprints(", ");
-			if (!umove_or_printaddr(tcp, arg, &geo))
-				tprintf("{heads=%u, sectors=%u, "
-					"cylinders=%u, start=%lu}",
-					(unsigned)geo.heads,
-					(unsigned)geo.sectors,
-					(unsigned)geo.cylinders,
-					geo.start);
-		}
-		break;
-
 	case BLKPG: {
-		struct blkpg_ioctl_arg blkpg;
+		struct_blkpg_ioctl_arg blkpg;
 
 		tprints(", ");
 		if (!umove_or_printaddr(tcp, arg, &blkpg))
@@ -223,7 +219,7 @@
 
 	case BLKTRACESETUP:
 		if (entering(tcp)) {
-			struct blk_user_trace_setup buts;
+			struct_blk_user_trace_setup buts;
 
 			tprints(", ");
 			if (umove_or_printaddr(tcp, arg, &buts))
@@ -236,51 +232,23 @@
 				buts.end_lba, buts.pid);
 			return 1;
 		} else {
-			struct blk_user_trace_setup buts;
+			struct_blk_user_trace_setup buts;
 
-			if (syserror(tcp)) {
-				tprints("}");
-				break;
+			if (!syserror(tcp) && !umove(tcp, arg, &buts)) {
+				tprints(", name=");
+				print_quoted_string(buts.name, sizeof(buts.name),
+						    QUOTE_0_TERMINATED);
 			}
-			tprints(", ");
-			if (umove(tcp, arg, &buts) < 0) {
-				tprints("???}");
-				break;
-			}
-			tprints(", name=");
-			print_quoted_string(buts.name, sizeof(buts.name),
-					    QUOTE_0_TERMINATED);
 			tprints("}");
 			break;
 		}
 
-#ifdef FITRIM
-	/* First seen in linux-2.6.37 */
-	case FITRIM: {
-		struct fstrim_range fstrim;
-
-		tprints(", ");
-		if (!umove_or_printaddr(tcp, arg, &fstrim))
-			tprintf("{start=%#" PRIx64 ", "
-				"len=%#" PRIx64 ", "
-				"minlen=%#" PRIx64 "}",
-				(uint64_t) fstrim.start,
-				(uint64_t) fstrim.len,
-				(uint64_t) fstrim.minlen);
-		break;
-	}
-#endif
-
 	/* No arguments */
 	case BLKRRPART:
 	case BLKFLSBUF:
 	case BLKTRACESTART:
 	case BLKTRACESTOP:
 	case BLKTRACETEARDOWN:
-#ifdef FIFREEZE
-	case FIFREEZE:
-	case FITHAW:
-#endif
 		break;
 	default:
 		return RVAL_DECODED;
diff --git a/bpf.c b/bpf.c
index f7156f0..20070b3 100644
--- a/bpf.c
+++ b/bpf.c
@@ -83,7 +83,7 @@
 	printfd(tcp, attr.map_fd);
 	tprintf(", key=%#" PRIx64 ", value=%#" PRIx64 ", flags=",
 		attr.key, attr.value);
-	printxval(bpf_map_update_elem_flags, attr.flags, "BPF_???");
+	printxval64(bpf_map_update_elem_flags, attr.flags, "BPF_???");
 	tprints("}");
 }
 
diff --git a/btrfs.c b/btrfs.c
new file mode 100644
index 0000000..04c71fc
--- /dev/null
+++ b/btrfs.c
@@ -0,0 +1,1354 @@
+/*
+ * Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+#ifdef HAVE_LINUX_BTRFS_H
+
+#include DEF_MPERS_TYPE(struct_btrfs_ioctl_dev_replace_args)
+#include DEF_MPERS_TYPE(struct_btrfs_ioctl_send_args)
+#include DEF_MPERS_TYPE(struct_btrfs_ioctl_received_subvol_args)
+
+# include <linux/btrfs.h>
+
+typedef struct btrfs_ioctl_dev_replace_args
+	struct_btrfs_ioctl_dev_replace_args;
+typedef struct btrfs_ioctl_send_args
+	struct_btrfs_ioctl_send_args;
+typedef struct btrfs_ioctl_received_subvol_args
+	struct_btrfs_ioctl_received_subvol_args;
+
+#endif /* HAVE_LINUX_BTRFS_H */
+
+#include MPERS_DEFS
+
+#ifdef HAVE_LINUX_BTRFS_H
+
+#include <linux/fs.h>
+
+/*
+ * Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in
+ * its definition, which isn't exported by the kernel.
+ */
+typedef __u64 u64;
+
+#ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS
+struct btrfs_ioctl_feature_flags {
+	uint64_t compat_flags;
+	uint64_t compat_ro_flags;
+	uint64_t incompat_flags;
+};
+#endif
+
+#ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START
+struct btrfs_ioctl_defrag_range_args {
+	uint64_t start;
+	uint64_t len;
+	uint64_t flags;
+	uint32_t extent_thresh;
+	uint32_t compress_type;
+	uint32_t unused[4];
+};
+#endif
+
+#ifndef BTRFS_LABEL_SIZE
+# define BTRFS_LABEL_SIZE 256
+#endif
+
+#ifndef BTRFS_FIRST_FREE_OBJECTID
+# define BTRFS_FIRST_FREE_OBJECTID 256ULL
+#endif
+
+#ifndef BTRFS_IOC_GET_FEATURES
+# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
+					struct btrfs_ioctl_feature_flags)
+# define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
+					struct btrfs_ioctl_feature_flags[2])
+# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
+					struct btrfs_ioctl_feature_flags[3])
+#endif
+
+#ifndef BTRFS_IOC_TREE_SEARCH_V2
+# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
+					struct btrfs_ioctl_search_args_v2)
+struct btrfs_ioctl_search_args_v2 {
+	struct btrfs_ioctl_search_key key; /* in/out - search parameters */
+	uint64_t buf_size;		   /* in - size of buffer
+					    * out - on EOVERFLOW: needed size
+					    *       to store item */
+	uint64_t buf[0];		   /* out - found items */
+};
+#endif
+
+#include "xlat/btrfs_balance_args.h"
+#include "xlat/btrfs_balance_ctl_cmds.h"
+#include "xlat/btrfs_balance_flags.h"
+#include "xlat/btrfs_balance_state.h"
+#include "xlat/btrfs_compress_types.h"
+#include "xlat/btrfs_defrag_flags.h"
+#include "xlat/btrfs_dev_replace_cmds.h"
+#include "xlat/btrfs_dev_replace_results.h"
+#include "xlat/btrfs_dev_replace_state.h"
+#include "xlat/btrfs_dev_stats_flags.h"
+#include "xlat/btrfs_dev_stats_values.h"
+#include "xlat/btrfs_features_compat.h"
+#include "xlat/btrfs_features_compat_ro.h"
+#include "xlat/btrfs_features_incompat.h"
+#include "xlat/btrfs_key_types.h"
+#include "xlat/btrfs_qgroup_ctl_cmds.h"
+#include "xlat/btrfs_qgroup_inherit_flags.h"
+#include "xlat/btrfs_qgroup_limit_flags.h"
+#include "xlat/btrfs_qgroup_status_flags.h"
+#include "xlat/btrfs_scrub_flags.h"
+#include "xlat/btrfs_send_flags.h"
+#include "xlat/btrfs_snap_flags_v2.h"
+#include "xlat/btrfs_space_info_flags.h"
+#include "xlat/btrfs_tree_objectids.h"
+
+static inline char
+prnibble(char v)
+{
+	if (v >= 10)
+		return 'a' + (v - 10);
+	return '0' + v;
+}
+
+/* 8-4-4-4-12 = 36 characters */
+#define UUID_STRING_SIZE 36
+
+/* Formats uuid, returns 0 if it's all zeroes */
+static int
+btrfs_unparse_uuid(unsigned char *uuid, char *out)
+{
+	int i;
+	int ret = 0;
+	for (i = 0; i < BTRFS_UUID_SIZE; i++) {
+		if (i == 4 || i == 6 || i == 8 || i == 10)
+			*out++ = '-';
+		*out++ = prnibble(uuid[i] >> 4);
+		*out++ = prnibble(uuid[i] & 0xf);
+		if (uuid[i])
+			ret = 1;
+	}
+	*out = '\0';
+	return ret;
+}
+
+static void
+print_u64(const char *name, uint64_t value)
+{
+	tprintf(", %s=%" PRIu64, name, value);
+	if (value == UINT64_MAX)
+		tprints(" /* UINT64_MAX */");
+}
+
+#define print_member_u64(obj, name) print_u64(#name, obj->name)
+
+static void
+btrfs_print_balance_args(const char *name, const struct btrfs_balance_args *bba)
+{
+	tprintf(", %s={profiles=", name);
+	printflags64(btrfs_space_info_flags, bba->profiles,
+		     "BTRFS_BLOCK_GROUP_???");
+	print_member_u64(bba, usage);
+	print_member_u64(bba, devid);
+	print_member_u64(bba, pstart);
+	print_member_u64(bba, pend);
+	print_member_u64(bba, vstart);
+	print_member_u64(bba, vend);
+	print_member_u64(bba, target);
+	tprints(", flags=");
+	printflags64(btrfs_balance_args, bba->flags, "BTRFS_BALANCE_ARGS_???");
+	tprints("}");
+}
+
+static void
+btrfs_print_balance(struct tcb *tcp, const long arg, bool out)
+{
+	struct btrfs_ioctl_balance_args balance_args;
+
+	if (umove_or_printaddr(tcp, arg, &balance_args))
+		return;
+
+	tprints("{flags=");
+	printflags64(btrfs_balance_flags, balance_args.flags,
+		     "BTRFS_BALANCE_???");
+	if (out) {
+		tprints(", state=");
+		printflags64(btrfs_balance_state, balance_args.state,
+			     "BTRFS_BALANCE_STATE_???");
+	}
+
+	if (balance_args.flags & BTRFS_BALANCE_DATA)
+		btrfs_print_balance_args("data", &balance_args.data);
+	if (balance_args.flags & BTRFS_BALANCE_METADATA)
+		btrfs_print_balance_args("meta", &balance_args.meta);
+	if (balance_args.flags & BTRFS_BALANCE_SYSTEM)
+		btrfs_print_balance_args("sys", &balance_args.sys);
+	tprints("}");
+}
+
+static void
+btrfs_print_features(const struct btrfs_ioctl_feature_flags *flags)
+{
+	tprints("{compat_flags=");
+	printflags64(btrfs_features_compat, flags->compat_flags,
+		     "BTRFS_FEATURE_COMPAT_???");
+
+	tprints(", compat_ro_flags=");
+	printflags64(btrfs_features_compat_ro, flags->compat_ro_flags,
+		     "BTRFS_FEATURE_COMPAT_RO_???");
+
+	tprints(", incompat_flags=");
+	printflags64(btrfs_features_incompat, flags->incompat_flags,
+		     "BTRFS_FEATURE_INCOMPAT_???");
+	tprints("}");
+}
+
+static void
+btrfs_print_qgroup_limit(const struct btrfs_qgroup_limit *lim)
+{
+	tprints("{flags=");
+	printflags64(btrfs_qgroup_limit_flags, lim->flags,
+		     "BTRFS_QGROUP_LIMIT_???");
+	tprintf(", max_rfer=%" PRI__u64 ", max_excl=%" PRI__u64
+		", rsv_rfer=%" PRI__u64 ", rsv_excl=%" PRI__u64 "}",
+		lim->max_rfer, lim->max_excl,
+		lim->rsv_rfer, lim->rsv_excl);
+}
+
+static void
+btrfs_print_key_type(uint32_t type)
+{
+	const char *str = xlookup(btrfs_key_types, type);
+	tprintf("%u", type);
+	if (str)
+		tprintf(" /* %s */", str);
+}
+
+static void
+btrfs_print_objectid(uint64_t objectid)
+{
+	const char *str = xlookup(btrfs_tree_objectids, objectid);
+	tprintf("%" PRIu64, objectid);
+	if (str)
+		tprintf(" /* %s */", str);
+}
+
+static void
+btrfs_print_data_container_header(const struct btrfs_data_container *container)
+{
+	tprintf("{bytes_left=%u, bytes_missing=%u"
+		", elem_cnt=%u, elem_missed=%u, val=",
+		container->bytes_left, container->bytes_missing,
+		container->elem_cnt, container->elem_missed);
+}
+
+static void
+btrfs_print_data_container_footer(void)
+{
+	tprints("}");
+}
+
+static bool
+print_btrfs_data_container_logical_ino(struct tcb *tcp, void *elem_buf,
+				       size_t elem_size, void *data)
+{
+	const uint64_t *const record = elem_buf;
+
+	tprintf("{inum=%" PRIu64 ", offset=%" PRIu64 ", root=%" PRIu64 "}",
+		record[0], record[1], record[2]);
+
+	return true;
+}
+
+static void
+btrfs_print_logical_ino_container(struct tcb *tcp,
+				  const uint64_t inodes_addr)
+{
+	struct btrfs_data_container container;
+
+	if (umove_or_printaddr(tcp, inodes_addr, &container))
+		return;
+
+	btrfs_print_data_container_header(&container);
+
+	if (abbrev(tcp)) {
+		tprints("...");
+	} else {
+		const uint64_t val_addr =
+			inodes_addr + offsetof(typeof(container), val);
+		uint64_t record[3];
+		print_array(tcp, val_addr, container.elem_cnt / 3,
+			    record, sizeof(record),
+			    umoven_or_printaddr,
+			    print_btrfs_data_container_logical_ino, 0);
+	}
+
+	btrfs_print_data_container_footer();
+}
+
+static bool
+print_btrfs_data_container_ino_path(struct tcb *tcp, void *elem_buf,
+				       size_t elem_size, void *data)
+{
+	const uint64_t *const offset = elem_buf;
+	const uint64_t *const val_addr = data;
+
+	printpath(tcp, *val_addr + *offset);
+
+	return true;
+}
+
+static void
+btrfs_print_ino_path_container(struct tcb *tcp,
+			       const uint64_t fspath_addr)
+{
+	struct btrfs_data_container container;
+
+	if (umove_or_printaddr(tcp, fspath_addr, &container))
+		return;
+
+	btrfs_print_data_container_header(&container);
+
+	if (abbrev(tcp)) {
+		tprints("...");
+	} else {
+		uint64_t val_addr =
+			fspath_addr + offsetof(typeof(container), val);
+		uint64_t offset;
+		print_array(tcp, val_addr, container.elem_cnt,
+			    &offset, sizeof(offset),
+			    umoven_or_printaddr,
+			    print_btrfs_data_container_ino_path, &val_addr);
+	}
+
+	btrfs_print_data_container_footer();
+}
+
+static bool
+print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	tprintf("%" PRIu64, * (uint64_t *) elem_buf);
+
+	return true;
+}
+
+static void
+btrfs_print_qgroup_inherit(struct tcb *tcp, const uint64_t qgi_addr)
+{
+	struct btrfs_qgroup_inherit inherit;
+
+	if (umove_or_printaddr(tcp, qgi_addr, &inherit))
+		return;
+
+	tprintf("{flags=");
+	printflags64(btrfs_qgroup_inherit_flags, inherit.flags,
+		     "BTRFS_QGROUP_INHERIT_???");
+	tprintf(", num_qgroups=%" PRI__u64 ", num_ref_copies=%" PRI__u64
+		", num_excl_copies=%" PRI__u64 ", lim=",
+		inherit.num_qgroups, inherit.num_ref_copies,
+		inherit.num_excl_copies);
+
+	btrfs_print_qgroup_limit(&inherit.lim);
+
+	tprints(", qgroups=");
+
+	if (abbrev(tcp)) {
+		tprints("...");
+	} else {
+		uint64_t record;
+		print_array(tcp, qgi_addr + offsetof(typeof(inherit), qgroups),
+			    inherit.num_qgroups, &record, sizeof(record),
+			    umoven_or_printaddr, print_uint64, 0);
+	}
+	tprints("}");
+}
+
+static void
+print_key_value_internal(struct tcb *tcp, const char *name, uint64_t value)
+{
+	if (value) {
+		tprintf(", %s=%" PRIu64, name, value);
+		if (value == UINT64_MAX)
+			tprints(" /* UINT64_MAX */");
+	}
+}
+#define print_key_value(tcp, key, name)					\
+	print_key_value_internal((tcp), #name, (key)->name)
+
+static void
+btrfs_print_tree_search(struct tcb *tcp, struct btrfs_ioctl_search_key *key,
+			uint64_t buf_addr, uint64_t buf_size, bool print_size)
+{
+	if (entering(tcp)) {
+		tprintf("{key={tree_id=");
+		btrfs_print_objectid(key->tree_id);
+
+		if (key->min_objectid != BTRFS_FIRST_FREE_OBJECTID ||
+		    !abbrev(tcp)) {
+			tprints(", min_objectid=");
+			btrfs_print_objectid(key->min_objectid);
+		}
+
+		if (key->max_objectid != BTRFS_LAST_FREE_OBJECTID ||
+		    !abbrev(tcp)) {
+			tprints(", max_objectid=");
+			btrfs_print_objectid(key->max_objectid);
+		}
+
+		print_key_value(tcp, key, min_offset);
+		print_key_value(tcp, key, max_offset);
+		print_key_value(tcp, key, min_transid);
+		print_key_value(tcp, key, max_transid);
+
+		tprints(", min_type=");
+		btrfs_print_key_type(key->min_type);
+		tprints(", max_type=");
+		btrfs_print_key_type(key->max_type);
+		tprintf(", nr_items=%u}", key->nr_items);
+		if (print_size)
+			tprintf(", buf_size=%" PRIu64, buf_size);
+		tprints("}");
+	} else {
+		tprintf("{key={nr_items=%u}", key->nr_items);
+		if (print_size)
+			tprintf(", buf_size=%" PRIu64, buf_size);
+		tprints(", buf=");
+		if (abbrev(tcp))
+			tprints("...");
+		else {
+			uint64_t i;
+			uint64_t off = 0;
+			tprints("[");
+			for (i = 0; i < key->nr_items; i++) {
+				struct btrfs_ioctl_search_header sh;
+				uint64_t addr = buf_addr + off;
+				if (i)
+					tprints(", ");
+				if (i > max_strlen ||
+				    umove(tcp, addr, &sh)) {
+					tprints("...");
+					break;
+				}
+				tprintf("{transid=%" PRI__u64 ", objectid=",
+					sh.transid);
+				btrfs_print_objectid(sh.objectid);
+				tprintf(", offset=%" PRI__u64 ", type=", sh.offset);
+				btrfs_print_key_type(sh.type);
+				tprintf(", len=%u}", sh.len);
+				off += sizeof(sh) + sh.len;
+
+			}
+			tprints("]");
+		}
+		tprints("}");
+	}
+}
+
+static bool
+print_objectid_callback(struct tcb *tcp, void *elem_buf,
+			size_t elem_size, void *data)
+{
+	btrfs_print_objectid(* (uint64_t *) elem_buf);
+
+	return true;
+}
+
+static bool
+print_btrfs_ioctl_space_info(struct tcb *tcp, void *elem_buf,
+			     size_t elem_size, void *data)
+{
+	const struct btrfs_ioctl_space_info *info = elem_buf;
+
+	tprints("{flags=");
+	printflags64(btrfs_space_info_flags, info->flags,
+		     "BTRFS_SPACE_INFO_???");
+	tprintf(", total_bytes=%" PRI__u64 ", used_bytes=%" PRI__u64 "}",
+		info->total_bytes, info->used_bytes);
+
+	return true;
+}
+
+MPERS_PRINTER_DECL(int, btrfs_ioctl,
+		   struct tcb *tcp, const unsigned int code, const long arg)
+{
+	switch (code) {
+	/* Take no arguments; command only. */
+	case BTRFS_IOC_TRANS_START:
+	case BTRFS_IOC_TRANS_END:
+	case BTRFS_IOC_SYNC:
+	case BTRFS_IOC_SCRUB_CANCEL:
+	case BTRFS_IOC_QUOTA_RESCAN_WAIT:
+	/*
+	 * The codes for these ioctls are based on each accepting a
+	 * vol_args but none of them actually consume an argument.
+	 */
+	case BTRFS_IOC_DEFRAG:
+	case BTRFS_IOC_BALANCE:
+		break;
+
+	/* takes a signed int */
+	case BTRFS_IOC_BALANCE_CTL:
+		tprints(", ");
+		printxval(btrfs_balance_ctl_cmds, arg, "BTRFS_BALANCE_CTL_???");
+		break;
+
+	/* returns a 64 */
+	case BTRFS_IOC_START_SYNC: /* R */
+		if (entering(tcp))
+			return 0;
+	/* fall through */
+	/* takes a u64 */
+	case BTRFS_IOC_DEFAULT_SUBVOL: /* W */
+	case BTRFS_IOC_WAIT_SYNC: /* W */
+		tprints(", ");
+		printnum_int64(tcp, arg, "%" PRIu64);
+		break;
+
+	/* u64 but describe a flags bitfield; we can make that symbolic */
+	case BTRFS_IOC_SUBVOL_GETFLAGS: { /* R */
+		uint64_t flags;
+
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+
+		if (umove_or_printaddr(tcp, arg, &flags))
+			break;
+
+		printflags64(btrfs_snap_flags_v2, flags, "BTRFS_SUBVOL_???");
+		break;
+	}
+
+	case BTRFS_IOC_SUBVOL_SETFLAGS: { /* W */
+		uint64_t flags;
+
+		tprints(", ");
+
+		if (umove_or_printaddr(tcp, arg, &flags))
+			break;
+
+		printflags64(btrfs_snap_flags_v2, flags, "BTRFS_SUBVOL_???");
+		break;
+	}
+
+	/* More complex types */
+	case BTRFS_IOC_BALANCE_V2: /* RW */
+		if (entering(tcp)) {
+			tprints(", ");
+			btrfs_print_balance(tcp, arg, false);
+			return 0;
+		}
+
+		if (syserror(tcp))
+			break;
+
+		tprints(" => ");
+		btrfs_print_balance(tcp, arg, true);
+		break;
+	case BTRFS_IOC_BALANCE_PROGRESS: /* R */
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+		btrfs_print_balance(tcp, arg, true);
+		break;
+
+	case BTRFS_IOC_DEFRAG_RANGE: { /* W */
+		struct btrfs_ioctl_defrag_range_args args;
+
+		tprints(", ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprintf("{start=%" PRIu64 ", len=", (uint64_t)args.start);
+
+		tprintf("%" PRIu64, args.len);
+		if (args.len == UINT64_MAX)
+			tprints(" /* UINT64_MAX */");
+
+		tprints(", flags=");
+		printflags64(btrfs_defrag_flags, args.flags,
+			     "BTRFS_DEFRAG_RANGE_???");
+		tprintf(", extent_thresh=%u, compress_type=",
+			args.extent_thresh);
+		printxval(btrfs_compress_types, args.compress_type,
+			  "BTRFS_COMPRESS_???");
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_DEV_INFO: { /* RW */
+		struct btrfs_ioctl_dev_info_args args;
+		char uuid[UUID_STRING_SIZE+1];
+		int valid;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+		tprints("{");
+
+		valid = btrfs_unparse_uuid(args.uuid, uuid);
+		if (entering(tcp)) {
+			tprintf("devid=%" PRI__u64, args.devid);
+			if (valid)
+				tprintf(", uuid=%s", uuid);
+			tprints("}");
+			return 0;
+		}
+		if (valid)
+			tprintf("uuid=%s, ", uuid);
+		tprintf("bytes_used=%" PRI__u64
+			", total_bytes=%" PRI__u64 ", path=",
+			args.bytes_used, args.total_bytes);
+		print_quoted_string((const char *)args.path, sizeof(args.path),
+				    QUOTE_0_TERMINATED);
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_DEV_REPLACE: { /* RW */
+		struct_btrfs_ioctl_dev_replace_args args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		if (entering(tcp)) {
+			tprints("{cmd=");
+			printxval64(btrfs_dev_replace_cmds, args.cmd,
+				    "BTRFS_IOCTL_DEV_REPLACE_CMD_???");
+			if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_START) {
+				const char *str;
+				tprintf(", start={srcdevid=%" PRIu64
+				   ", cont_reading_from_srcdev_mode=%" PRIu64
+				   ", srcdev_name=",
+				   (uint64_t) args.start.srcdevid,
+				   (uint64_t) args.start.cont_reading_from_srcdev_mode);
+
+				str = (const char*) args.start.srcdev_name;
+				print_quoted_string(str,
+						sizeof(args.start.srcdev_name),
+						QUOTE_0_TERMINATED);
+				tprints(", tgtdev_name=");
+				str = (const char*) args.start.tgtdev_name;
+				print_quoted_string(str,
+						sizeof(args.start.tgtdev_name),
+						QUOTE_0_TERMINATED);
+				tprints("}");
+
+			}
+			tprints("}");
+			return 0;
+		}
+
+		tprints("{result=");
+		printxval64(btrfs_dev_replace_results, args.result,
+			    "BTRFS_IOCTL_DEV_REPLACE_RESULT_???");
+		if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) {
+			char buf[sizeof("HH:MM:SS") + 1];
+			time_t time;
+			tprints(", ");
+			printxval64(btrfs_dev_replace_state,
+				   args.status.replace_state,
+				   "BTRFS_IOCTL_DEV_REPLACE_STATE_???");
+			tprintf(", progress_1000=%" PRIu64 " /* ",
+				(uint64_t) args.status.progress_1000);
+			if (args.status.progress_1000 <= 1000)
+				tprintf("%" PRIu64 ".%.2" PRIu64 "%%",
+					(uint64_t) args.status.progress_1000 / 10,
+					(uint64_t) args.status.progress_1000 % 10);
+			else
+				tprints("???");
+			tprints(" */ ,");
+
+			time = args.status.time_started;
+			strftime(buf, sizeof(buf), "%T",
+				 localtime(&time));
+			tprintf("time_started=%" PRIu64" /* %s */, ",
+				(uint64_t) args.status.time_started, buf);
+
+			time = args.status.time_stopped;
+			strftime(buf, sizeof(buf), "%T",
+				 localtime(&time));
+			tprintf("time_stopped=%" PRIu64" /* %s */, ",
+				(uint64_t) args.status.time_stopped, buf);
+
+			tprintf("num_write_errors=%" PRIu64
+				", num_uncorrectable_read_errors=%" PRIu64,
+				(uint64_t) args.status.num_write_errors,
+				(uint64_t) args.status.num_uncorrectable_read_errors);
+		}
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_GET_FEATURES: { /* R */
+		struct btrfs_ioctl_feature_flags flags;
+
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &flags))
+			break;
+
+		btrfs_print_features(&flags);
+		break;
+	}
+
+	case BTRFS_IOC_SET_FEATURES: { /* W */
+		struct btrfs_ioctl_feature_flags flarg[2];
+
+		tprints(", ");
+
+		if (umove_or_printaddr(tcp, arg, &flarg))
+			break;
+
+		tprints("[");
+		btrfs_print_features(&flarg[0]);
+		tprints(", ");
+		btrfs_print_features(&flarg[1]);
+		tprints("]");
+		break;
+	}
+
+	case BTRFS_IOC_GET_SUPPORTED_FEATURES: { /* R */
+		struct btrfs_ioctl_feature_flags flarg[3];
+
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &flarg))
+			break;
+
+		tprints("[ /* supported */ ");
+		btrfs_print_features(&flarg[0]);
+
+		tprints(", /* safe to set */ ");
+		btrfs_print_features(&flarg[1]);
+
+		tprints(", /* safe to clear */ ");
+		btrfs_print_features(&flarg[2]);
+		tprints("]");
+
+		break;
+	}
+
+	case BTRFS_IOC_FS_INFO: { /* R */
+		struct btrfs_ioctl_fs_info_args args;
+		char uuid[UUID_STRING_SIZE+1];
+		uint32_t nodesize, sectorsize, clone_alignment;
+#ifndef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
+		__u32 *reserved32;
+#endif
+
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+#ifdef HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE
+		nodesize = args.nodesize,
+		sectorsize = args.sectorsize,
+		clone_alignment = args.clone_alignment;
+#else
+		reserved32 = (__u32 *)args.reserved;
+		nodesize = reserved32[0];
+		sectorsize = reserved32[1];
+		clone_alignment = reserved32[2];
+#endif
+		btrfs_unparse_uuid(args.fsid, uuid);
+
+		tprints("{");
+		tprintf("max_id=%" PRI__u64 ", num_devices=%" PRI__u64
+			", fsid=%s, nodesize=%u, sectorsize=%u"
+			", clone_alignment=%u",
+			args.max_id, args.num_devices, uuid,
+			nodesize, sectorsize, clone_alignment);
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_GET_DEV_STATS: { /* RW */
+		struct btrfs_ioctl_get_dev_stats args;
+		uint64_t i;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{");
+
+		if (entering(tcp))
+			tprintf("devid=%" PRI__u64 ", ", args.devid);
+
+		tprintf("nr_items=%" PRI__u64 ", flags=", args.nr_items);
+		printflags64(btrfs_dev_stats_flags, args.flags,
+			     "BTRFS_DEV_STATS_???");
+
+		if (entering(tcp)) {
+			tprints("}");
+			return 0;
+		}
+
+		/*
+		 * The structure has a 1k limit; Let's make sure we don't
+		 * go off into the middle of nowhere with a bad nr_items
+		 * value.
+		 */
+		tprints(", [");
+		for (i = 0; i < args.nr_items; i++) {
+			if (i)
+				tprints(", ");
+			if (i >= ARRAY_SIZE(args.values)) {
+				tprints("...");
+				break;
+			}
+			const char *name = xlookup(btrfs_dev_stats_values, i);
+			if (name)
+				tprintf("/* %s */ ", name);
+			tprintf("%" PRI__u64, args.values[i]);
+		}
+		tprints("]}");
+		break;
+	}
+
+	case BTRFS_IOC_INO_LOOKUP: { /* RW */
+		struct btrfs_ioctl_ino_lookup_args args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		if (entering(tcp)) {
+			/* Use subvolume id of the containing root */
+			if (args.treeid == 0)
+				/* abuse of auxstr to retain state */
+				tcp->auxstr = (void *)1;
+			else
+				tcp->auxstr = NULL;
+
+			tprints("{treeid=");
+			btrfs_print_objectid(args.treeid);
+			tprints(", objectid=");
+			btrfs_print_objectid(args.objectid);
+			tprints("}");
+			return 0;
+		}
+
+		tprints("{");
+		if (tcp->auxstr) {
+			tcp->auxstr = NULL;
+			tprints("treeid=");
+			btrfs_print_objectid(args.treeid);
+			tprints(", ");
+		}
+
+		tprints("name=");
+		print_quoted_string(args.name, sizeof(args.name),
+				    QUOTE_0_TERMINATED);
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_INO_PATHS: { /* RW */
+		struct btrfs_ioctl_ino_path_args args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{");
+
+		if (entering(tcp)) {
+			tprintf("inum=%" PRI__u64 ", size=%" PRI__u64,
+				args.inum, args.size);
+			tprintf(", fspath=0x%" PRI__x64 "}", args.fspath);
+			return 0;
+		}
+
+		tprints("fspath=");
+		btrfs_print_ino_path_container(tcp, args.fspath);
+
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_LOGICAL_INO: { /* RW */
+		struct btrfs_ioctl_logical_ino_args args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{");
+
+		if (entering(tcp)) {
+			tprintf("logical=%" PRI__u64 ", size=%" PRI__u64,
+				args.logical, args.size);
+			tprintf(", inodes=0x%" PRI__x64 "}", args.inodes);
+			return 0;
+		}
+
+		tprints("inodes=");
+		btrfs_print_logical_ino_container(tcp, args.inodes);
+
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_QGROUP_ASSIGN: { /* W */
+		struct btrfs_ioctl_qgroup_assign_args args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprintf("{assign=%" PRI__u64 ", src=%" PRI__u64
+			", dst=%" PRI__u64 "}",
+			args.assign, args.src, args.dst);
+		break;
+	}
+
+	case BTRFS_IOC_QGROUP_CREATE: { /* W */
+		struct btrfs_ioctl_qgroup_create_args args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprintf("{create=%" PRI__u64 ", qgroupid=%" PRI__u64 "}",
+			args.create, args.qgroupid);
+		break;
+	}
+
+	case BTRFS_IOC_QGROUP_LIMIT: { /* R */
+		struct btrfs_ioctl_qgroup_limit_args args;
+
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprintf("{qgroupid=%" PRI__u64 ", lim=", args.qgroupid);
+		btrfs_print_qgroup_limit(&args.lim);
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_QUOTA_CTL: { /* W */
+		struct btrfs_ioctl_quota_ctl_args args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		printxval64(btrfs_qgroup_ctl_cmds, args.cmd,
+			    "BTRFS_QUOTA_CTL_???");
+		tprints("}");
+
+		break;
+	}
+
+	case BTRFS_IOC_QUOTA_RESCAN: { /* W */
+		struct btrfs_ioctl_quota_rescan_args args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprintf("{flags=%" PRI__u64 "}", args.flags);
+		break;
+	}
+
+	case BTRFS_IOC_QUOTA_RESCAN_STATUS: { /* R */
+		struct btrfs_ioctl_quota_rescan_args args;
+
+		if (entering(tcp))
+			return 0;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprintf("{flags=%" PRI__u64 ", progress=", args.flags);
+		btrfs_print_objectid(args.progress);
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_SET_RECEIVED_SUBVOL: { /* RW */
+		struct_btrfs_ioctl_received_subvol_args args;
+		char uuid[UUID_STRING_SIZE+1];
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		if (entering(tcp)) {
+			btrfs_unparse_uuid((unsigned char *)args.uuid, uuid);
+			tprintf("{uuid=%s, stransid=%" PRIu64
+				", stime=%" PRIu64 ".%u, flags=%" PRIu64
+				"}", uuid, (uint64_t) args.stransid,
+				(uint64_t) args.stime.sec, args.stime.nsec,
+				(uint64_t) args.flags);
+			return 0;
+		}
+		tprintf("{rtransid=%" PRIu64 ", rtime=%" PRIu64 ".%u}",
+			(uint64_t) args.rtransid, (uint64_t) args.rtime.sec,
+			args.rtime.nsec);
+		break;
+	}
+
+	case BTRFS_IOC_SCRUB: /* RW */
+	case BTRFS_IOC_SCRUB_PROGRESS: { /* RW */
+		struct btrfs_ioctl_scrub_args args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		if (entering(tcp)) {
+			tprintf("{devid=%" PRI__u64, args.devid);
+			if (code == BTRFS_IOC_SCRUB) {
+				tprintf(", start=%" PRI__u64 ", end=",
+					args.start);
+				tprintf("%" PRI__u64, args.end);
+				if (args.end == UINT64_MAX)
+					tprints(" /* UINT64_MAX */");
+				tprints(", flags=");
+				printflags64(btrfs_scrub_flags, args.flags,
+					     "BTRFS_SCRUB_???");
+			}
+			tprints("}");
+			return 0;
+		}
+		tprintf("{data_extents_scrubbed=%" PRI__u64
+			", tree_extents_scrubbed=%" PRI__u64
+			", data_bytes_scrubbed=%" PRI__u64
+			", tree_bytes_scrubbed=%" PRI__u64
+			", read_errors=%" PRI__u64
+			", csum_errors=%" PRI__u64
+			", verify_errors=%" PRI__u64
+			", no_csum=%" PRI__u64
+			", csum_discards=%" PRI__u64
+			", super_errors=%" PRI__u64
+			", malloc_errors=%" PRI__u64
+			", uncorrectable_errors=%" PRI__u64
+			", corrected_errors=%" PRI__u64
+			", last_physical=%" PRI__u64
+			", unverified_errors=%" PRI__u64 "}",
+			args.progress.data_extents_scrubbed,
+			args.progress.tree_extents_scrubbed,
+			args.progress.data_bytes_scrubbed,
+			args.progress.tree_bytes_scrubbed,
+			args.progress.read_errors,
+			args.progress.csum_errors,
+			args.progress.verify_errors,
+			args.progress.no_csum,
+			args.progress.csum_discards,
+			args.progress.super_errors,
+			args.progress.malloc_errors,
+			args.progress.uncorrectable_errors,
+			args.progress.corrected_errors,
+			args.progress.last_physical,
+			args.progress.unverified_errors);
+		break;
+	}
+
+	case BTRFS_IOC_TREE_SEARCH: { /* RW */
+		struct btrfs_ioctl_search_args args;
+		uint64_t buf_offset;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		buf_offset = offsetof(struct btrfs_ioctl_search_args, buf);
+		btrfs_print_tree_search(tcp, &args.key, arg + buf_offset,
+					sizeof(args.buf), false);
+		if (entering(tcp))
+			return 0;
+		break;
+	}
+
+	case BTRFS_IOC_TREE_SEARCH_V2: { /* RW */
+		struct btrfs_ioctl_search_args_v2 args;
+		uint64_t buf_offset;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp)) {
+			if (tcp->u_error == EOVERFLOW) {
+				tprints(" => ");
+				tcp->u_error = 0;
+				if (!umove_or_printaddr(tcp, arg, &args))
+					tprintf("{buf_size=%" PRIu64 "}",
+						(uint64_t)args.buf_size);
+				tcp->u_error = EOVERFLOW;
+			}
+			break;
+		} else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		buf_offset = offsetof(struct btrfs_ioctl_search_args_v2, buf);
+		btrfs_print_tree_search(tcp, &args.key, arg + buf_offset,
+					args.buf_size, true);
+		if (entering(tcp))
+			return 0;
+		break;
+	}
+
+	case BTRFS_IOC_SEND: { /* W */
+		struct_btrfs_ioctl_send_args args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{send_fd=");
+		printfd(tcp, args.send_fd);
+		tprintf(", clone_sources_count=%" PRIu64 ", clone_sources=",
+			(uint64_t) args.clone_sources_count);
+
+		if (abbrev(tcp))
+			tprints("...");
+		else {
+			uint64_t record;
+			print_array(tcp, (unsigned long) args.clone_sources,
+				    args.clone_sources_count,
+				    &record, sizeof(record),
+				    umoven_or_printaddr,
+				    print_objectid_callback, 0);
+		}
+		tprints(", parent_root=");
+		btrfs_print_objectid(args.parent_root);
+		tprints(", flags=");
+		printflags64(btrfs_send_flags, args.flags,
+			     "BTRFS_SEND_FLAGS_???");
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_SPACE_INFO: { /* RW */
+		struct btrfs_ioctl_space_args args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{");
+		if (entering(tcp)) {
+			tprintf("space_slots=%" PRI__u64 "}", args.space_slots);
+			return 0;
+		}
+
+		tprintf("total_spaces=%" PRI__u64, args.total_spaces);
+
+		if (args.space_slots == 0 && args.total_spaces) {
+			tprints("}");
+			break;
+		}
+
+		tprints(", spaces=");
+
+		if (abbrev(tcp))
+			tprints("...");
+		else {
+			struct btrfs_ioctl_space_info info;
+			print_array(tcp, arg + offsetof(typeof(args), spaces),
+				    args.total_spaces,
+				    &info, sizeof(info), umoven_or_printaddr,
+				    print_btrfs_ioctl_space_info, 0);
+		}
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_SNAP_CREATE:
+	case BTRFS_IOC_RESIZE:
+	case BTRFS_IOC_SCAN_DEV:
+	case BTRFS_IOC_ADD_DEV:
+	case BTRFS_IOC_RM_DEV:
+	case BTRFS_IOC_SUBVOL_CREATE:
+	case BTRFS_IOC_SNAP_DESTROY:
+	case BTRFS_IOC_DEVICES_READY: { /* W */
+		struct btrfs_ioctl_vol_args args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{fd=");
+		printfd(tcp, args.fd);
+		tprints(", name=");
+		print_quoted_string(args.name, sizeof(args.name),
+				    QUOTE_0_TERMINATED);
+		tprints("}");
+		break;
+	}
+
+	case BTRFS_IOC_SNAP_CREATE_V2:
+	case BTRFS_IOC_SUBVOL_CREATE_V2: { /* code is W, but is actually RW */
+		struct btrfs_ioctl_vol_args_v2 args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		if (entering(tcp)) {
+			tprints("{fd=");
+			printfd(tcp, args.fd);
+			tprints(", flags=");
+			printflags64(btrfs_snap_flags_v2, args.flags,
+				     "BTRFS_SUBVOL_???");
+			if (args.flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
+				tprintf(", size=%" PRI__u64 ", qgroup_inherit=",
+					args.size);
+
+				btrfs_print_qgroup_inherit(tcp,
+					(unsigned long)args.qgroup_inherit);
+			}
+			tprintf(", name=");
+			print_quoted_string(args.name, sizeof(args.name),
+					    QUOTE_0_TERMINATED);
+			tprints("}");
+			return 0;
+		}
+		tprintf("{transid=%" PRI__u64 "}", args.transid);
+		break;
+	}
+
+	case BTRFS_IOC_GET_FSLABEL: /* R */
+		if (entering(tcp))
+			return 0;
+		/* fall through */
+	case BTRFS_IOC_SET_FSLABEL: { /* W */
+		char label[BTRFS_LABEL_SIZE];
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &label))
+			break;
+		print_quoted_string(label, sizeof(label), QUOTE_0_TERMINATED);
+		break;
+	}
+
+	case BTRFS_IOC_CLONE:			/* FICLONE */
+	case BTRFS_IOC_CLONE_RANGE:		/* FICLONERANGE */
+#ifdef BTRFS_IOC_FILE_EXTENT_SAME
+	case BTRFS_IOC_FILE_EXTENT_SAME:	/* FIDEDUPERANGE */
+#endif
+		/*
+		 * FICLONE, FICLONERANGE, and FIDEDUPERANGE started out as
+		 * btrfs ioctls and the code was kept for the generic
+		 * implementations.  We use the BTRFS_* names here because
+		 * they will be available on older systems.
+		 */
+		return file_ioctl(tcp, code, arg);
+
+	default:
+		return RVAL_DECODED;
+	};
+	return RVAL_DECODED | 1;
+}
+#endif /* HAVE_LINUX_BTRFS_H */
diff --git a/cacheflush.c b/cacheflush.c
index aa8bc86..8c2c05c 100644
--- a/cacheflush.c
+++ b/cacheflush.c
@@ -81,9 +81,9 @@
 	/* start addr */
 	printaddr(tcp->u_arg[0]);
 	/* length */
-	tprintf(", %ld, ", tcp->u_arg[1]);
+	tprintf(", %lu, ", tcp->u_arg[1]);
 	/* flags */
-	printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE");
+	printxval(cacheflush_flags, tcp->u_arg[2], "?CACHE");
 
 	return RVAL_DECODED;
 }
diff --git a/clone.c b/clone.c
index cf271da..2fad0b8 100644
--- a/clone.c
+++ b/clone.c
@@ -142,7 +142,7 @@
 
 SYS_FUNC(unshare)
 {
-	printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
+	printflags_long(clone_flags, tcp->u_arg[0], "CLONE_???");
 	return RVAL_DECODED;
 }
 
diff --git a/configure.ac b/configure.ac
index 2b29c94..7dfa1d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,8 +304,6 @@
 [#include <sys/types.h>
 #include <asm/stat.h>])
 
-AC_CHECK_TYPES([struct statfs64],,, [#include <sys/vfs.h>])
-
 AC_CHECK_TYPES(m4_normalize([
 	struct pt_all_user_regs,
 	struct ia64_fpreg,
@@ -363,9 +361,9 @@
 	bluetooth/bluetooth.h
 	elf.h
 	inttypes.h
-	ioctls.h
 	linux/bsg.h
 	linux/falloc.h
+	linux/fiemap.h
 	linux/filter.h
 	linux/hiddev.h
 	linux/ip_vs.h
@@ -377,23 +375,21 @@
 	linux/securebits.h
 	linux/sem.h
 	linux/shm.h
+	linux/userfaultfd.h
 	linux/utsname.h
 	mqueue.h
 	netinet/sctp.h
 	scsi/sg.h
 	stropts.h
 	sys/conf.h
-	sys/epoll.h
 	sys/eventfd.h
 	sys/fanotify.h
-	sys/ioctl.h
 	sys/ipc.h
 	sys/msg.h
 	sys/reg.h
 	sys/sem.h
 	sys/shm.h
 	sys/signalfd.h
-	sys/vfs.h
 	sys/xattr.h
 ]))
 
@@ -434,6 +430,44 @@
 	fi
 ])
 
+AC_CHECK_TYPES([struct statfs], [
+	AC_CHECK_MEMBERS([struct statfs.f_frsize],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+	AC_CHECK_MEMBERS([struct statfs.f_flags],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+	AC_CHECK_MEMBERS([struct statfs.f_fsid.val],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+	AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+],, [#include <linux/types.h>
+#include <asm/statfs.h>])
+
+AC_CHECK_TYPES([struct statfs64], [
+	AC_CHECK_MEMBERS([struct statfs64.f_frsize],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+	AC_CHECK_MEMBERS([struct statfs64.f_flags],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+	AC_CHECK_MEMBERS([struct statfs64.f_fsid.val],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+	AC_CHECK_MEMBERS([struct statfs64.f_fsid.__val],,, [#include <linux/types.h>
+#include <asm/statfs.h>])
+],, [#include <linux/types.h>
+#include <asm/statfs.h>])
+
+AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>])
+
+AC_CHECK_HEADERS([linux/btrfs.h], [
+	AC_CHECK_MEMBERS(m4_normalize([
+		struct btrfs_ioctl_feature_flags.compat_flags,
+		struct btrfs_ioctl_fs_info_args.nodesize,
+		struct btrfs_ioctl_defrag_range_args.start
+		struct btrfs_ioctl_search_args_v2.buf_size
+		]),,, [ #include <stdio.h>
+#include <linux/btrfs.h>])
+        AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
+	                        BTRFS_COMPRESS_LZO]),,,[ #include <stdio.h>
+#include <linux/btrfs.h>])])
+
 AC_CHECK_DECLS([sys_errlist])
 AC_CHECK_DECLS(m4_normalize([
 	PTRACE_PEEKUSER,
@@ -818,7 +852,10 @@
 	V4L2_CTRL_TYPE_STRING,
 	V4L2_CTRL_TYPE_BITMASK,
 	V4L2_CTRL_TYPE_INTEGER_MENU
-]),,, [#include <linux/videodev2.h>])
+]),,, [#include <sys/time.h>
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/videodev2.h>])
 
 AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
 	[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
diff --git a/count.c b/count.c
index 4b16ee6..1393b6e 100644
--- a/count.c
+++ b/count.c
@@ -112,8 +112,9 @@
 static int
 syscall_cmp(void *a, void *b)
 {
-	return strcmp(sysent[*((int *) a)].sys_name,
-		      sysent[*((int *) b)].sys_name);
+	const char *a_name = sysent[*((int *) a)].sys_name;
+	const char *b_name = sysent[*((int *) b)].sys_name;
+	return strcmp(a_name ? a_name : "", b_name ? b_name : "");
 }
 
 static int
diff --git a/debian/changelog b/debian/changelog
index e8b3e3b..89157c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,26 @@
+strace (4.12-1) unstable; urgency=low
+
+  [ Dmitry V. Levin ]
+  * New upstream version.
+    + implemented simultaneous use of -p option and tracing of a command,
+      closes: #549942
+    + fixed decoding of syscalls unknown to the kernel on s390/s390x,
+      closes: #485979
+
+ -- Dmitry V. Levin <ldv@altlinux.org>  Tue, 31 May 2016 11:12:13 +0000
+
 strace (4.11-1) unstable; urgency=low
 
   [ Dmitry V. Levin ]
   * New upstream version.
     + fixed decoding of path argument of umount2 syscall, closes: #785050
 
- -- Dmitry V. Levin <ldv@altlinux.org>  Mon, 21 Dec 2015 20:21:22 +0000
+  [ Steve McIntyre ]
+  * Drop patches against old upstream - all upstream now.
+  * Add simple upstream patch to fix printing of 32-bit times syscall
+    return value on 64-bit architectures.
+
+ -- Steve McIntyre <93sam@debian.org>  Fri, 08 Jan 2015 00:52:05 +0000
 
 strace (4.10-3) unstable; urgency=medium
 
diff --git a/defs.h b/defs.h
index ac59349..f7a85ca 100644
--- a/defs.h
+++ b/defs.h
@@ -157,6 +157,7 @@
 #   define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
 #   define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
 #   define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#   define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
 #  endif
 # endif
 #endif
@@ -170,11 +171,13 @@
 #  define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#  define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
 # endif
 # ifdef HAVE_MX32_MPERS
 #  define PERSONALITY2_INCLUDE_FUNCS "mx32_funcs.h"
 #  define PERSONALITY2_INCLUDE_PRINTERS_DECLS "mx32_printer_decls.h"
 #  define PERSONALITY2_INCLUDE_PRINTERS_DEFS "mx32_printer_defs.h"
+#  define MPERS_mx32_IOCTL_MACROS "ioctl_redefs2.h"
 # endif
 #endif
 
@@ -186,6 +189,7 @@
 #  define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#  define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
 # endif
 #endif
 
@@ -202,6 +206,7 @@
 #  define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#  define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
 # endif
 #endif
 
@@ -213,6 +218,7 @@
 #  define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#  define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
 # endif
 #endif
 
@@ -227,6 +233,7 @@
 #  define PERSONALITY1_INCLUDE_FUNCS "m32_funcs.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
 #  define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
+#  define MPERS_m32_IOCTL_MACROS "ioctl_redefs1.h"
 # endif
 #endif
 
@@ -360,16 +367,12 @@
 #define abbrev(tcp)	((tcp)->qual_flg & QUAL_ABBREV)
 #define filtered(tcp)	((tcp)->flags & TCB_FILTERED)
 
-struct xlat {
-	unsigned int val;
-	const char *str;
-};
-#define XLAT(x) { x, #x }
-#define XLAT_END { 0, NULL }
+#include "xlat.h"
 
 extern const struct xlat addrfams[];
 extern const struct xlat at_flags[];
 extern const struct xlat dirent_types[];
+extern const struct xlat evdev_abs[];
 extern const struct xlat open_access_modes[];
 extern const struct xlat open_mode_flags[];
 extern const struct xlat resource_flags[];
@@ -508,11 +511,25 @@
 extern int umoven_or_printaddr(struct tcb *, long, unsigned int, void *);
 #define umove_or_printaddr(pid, addr, objp)	\
 	umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp))
-extern int umove_ulong_or_printaddr(struct tcb *, long, unsigned long *);
-extern int umove_ulong_array_or_printaddr(struct tcb *, long, unsigned long *, size_t);
 extern int umovestr(struct tcb *, long, unsigned int, char *);
 extern int upeek(int pid, long, long *);
 
+extern bool
+print_array(struct tcb *tcp,
+	    const unsigned long start_addr,
+	    const size_t nmemb,
+	    void *const elem_buf,
+	    const size_t elem_size,
+	    int (*const umoven_func)(struct tcb *,
+				     long,
+				     unsigned int,
+				     void *),
+	    bool (*const print_func)(struct tcb *,
+				     void *elem_buf,
+				     size_t elem_size,
+				     void *opaque_data),
+	    void *const opaque_data);
+
 #if defined ALPHA || defined IA64 || defined MIPS \
  || defined SH || defined SPARC || defined SPARC64
 # define HAVE_GETRVAL2
@@ -526,8 +543,8 @@
 extern int pathtrace_match(struct tcb *);
 extern int getfdpath(struct tcb *, int, char *, unsigned);
 
-extern const char *xlookup(const struct xlat *, const unsigned int);
-extern const char *xlat_search(const struct xlat *, const size_t, const unsigned int);
+extern const char *xlookup(const struct xlat *, const uint64_t);
+extern const char *xlat_search(const struct xlat *, const size_t, const uint64_t);
 
 extern unsigned long get_pagesize(void);
 extern int string_to_uint(const char *str);
@@ -554,17 +571,16 @@
 	ATTRIBUTE_FORMAT((printf, 2, 0));
 
 extern void printaddr(long);
-extern void printxvals(const unsigned int, const char *, const struct xlat *, ...)
+extern void printxvals(const uint64_t, const char *, const struct xlat *, ...)
 	ATTRIBUTE_SENTINEL;
-#define printxval(xlat, val, dflt) printxvals(val, dflt, xlat, NULL)
 extern int printargs(struct tcb *);
 extern int printargs_u(struct tcb *);
 extern int printargs_d(struct tcb *);
 
-extern void addflags(const struct xlat *, int);
-extern int printflags(const struct xlat *, int, const char *);
-extern const char *sprintflags(const char *, const struct xlat *, int);
-extern const char *sprintmode(int);
+extern void addflags(const struct xlat *, uint64_t);
+extern int printflags64(const struct xlat *, uint64_t, const char *);
+extern const char *sprintflags(const char *, const struct xlat *, uint64_t);
+extern const char *sprintmode(unsigned int);
 extern const char *sprinttime(time_t);
 extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long);
 extern void dumpiov_in_mmsghdr(struct tcb *, long);
@@ -635,21 +651,24 @@
 extern void printsignal(int);
 extern void tprint_iov(struct tcb *, unsigned long, unsigned long, int decode_iov);
 extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned long, int decode_iov, unsigned long);
-extern void tprint_open_modes(int);
-extern const char *sprint_open_modes(int);
-extern void print_seccomp_filter(struct tcb *tcp, unsigned long);
+extern void tprint_open_modes(unsigned int);
+extern const char *sprint_open_modes(unsigned int);
+extern void print_seccomp_filter(struct tcb *, unsigned long);
+extern void print_seccomp_fprog(struct tcb *, unsigned long, unsigned short);
 
-extern int block_ioctl(struct tcb *, const unsigned int, long);
-extern int evdev_ioctl(struct tcb *, const unsigned int, long);
+struct strace_statfs;
+extern void print_struct_statfs(struct tcb *tcp, long);
+extern void print_struct_statfs64(struct tcb *tcp, long, unsigned long);
+
+extern int file_ioctl(struct tcb *, const unsigned int, long);
+extern int fs_x_ioctl(struct tcb *, const unsigned int, long);
 extern int loop_ioctl(struct tcb *, const unsigned int, long);
-extern int mtd_ioctl(struct tcb *, const unsigned int, long);
 extern int ptp_ioctl(struct tcb *, const unsigned int, long);
-extern int rtc_ioctl(struct tcb *, const unsigned int, long);
 extern int scsi_ioctl(struct tcb *, const unsigned int, long);
 extern int sock_ioctl(struct tcb *, const unsigned int, long);
 extern int term_ioctl(struct tcb *, const unsigned int, long);
 extern int ubi_ioctl(struct tcb *, const unsigned int, long);
-extern int v4l2_ioctl(struct tcb *, const unsigned int, long);
+extern int uffdio_ioctl(struct tcb *, const unsigned int, long);
 
 extern int tv_nz(const struct timeval *);
 extern int tv_cmp(const struct timeval *, const struct timeval *);
@@ -668,6 +687,36 @@
 extern void unwind_capture_stacktrace(struct tcb* tcp);
 #endif
 
+static inline int
+printflags(const struct xlat *x, unsigned int flags, const char *dflt)
+{
+	return printflags64(x, flags, dflt);
+}
+
+static inline int
+printflags_long(const struct xlat *x, unsigned long flags, const char *dflt)
+{
+	return printflags64(x, flags, dflt);
+}
+
+static inline void
+printxval64(const struct xlat *x, const uint64_t val, const char *dflt)
+{
+	printxvals(val, dflt, x, NULL);
+}
+
+static inline void
+printxval(const struct xlat *x, const unsigned int val, const char *dflt)
+{
+	printxvals(val, dflt, x, NULL);
+}
+
+static inline void
+printxval_long(const struct xlat *x, const unsigned long val, const char *dflt)
+{
+	printxvals(val, dflt, x, NULL);
+}
+
 /* Strace log generation machinery.
  *
  * printing_tcp: tcb which has incomplete line being printed right now.
@@ -720,6 +769,14 @@
 # define widen_to_long(v) ((long)(v))
 #endif
 
+/*
+ * Widen without sign-extension a signed integer type to unsigned long long.
+ */
+#define widen_to_ull(v) \
+	(sizeof(v) == sizeof(int) ? (unsigned long long) (unsigned int) (v) : \
+	 sizeof(v) == sizeof(long) ? (unsigned long long) (unsigned long) (v) : \
+	 (unsigned long long) (v))
+
 extern const struct_sysent sysent0[];
 extern const char *const errnoent0[];
 extern const char *const signalent0[];
@@ -745,11 +802,17 @@
 extern unsigned nioctlents;
 extern unsigned num_quals;
 
-#if SUPPORTED_PERSONALITIES > 1
-# include "printers.h"
-#else
-# include "native_printer_decls.h"
-#endif
+#ifdef IN_MPERS_BOOTSTRAP
+/* Transform multi-line MPERS_PRINTER_DECL statements to one-liners.  */
+# define MPERS_PRINTER_DECL(type, name, ...) MPERS_PRINTER_DECL(type, name, __VA_ARGS__)
+#else /* !IN_MPERS_BOOTSTRAP */
+# if SUPPORTED_PERSONALITIES > 1
+#  include "printers.h"
+# else
+#  include "native_printer_decls.h"
+# endif
+# define MPERS_PRINTER_DECL(type, name, ...) type MPERS_FUNC_NAME(name)(__VA_ARGS__)
+#endif /* !IN_MPERS_BOOTSTRAP */
 
 /*
  * If you need non-NULL sysent[scno].sys_func and sysent[scno].sys_name
@@ -769,8 +832,6 @@
 
 #define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp)
 
-#define MPERS_PRINTER_DECL(type, name) type MPERS_FUNC_NAME(name)
-
 /*
  * The kernel used to define 64-bit types on 64-bit systems on a per-arch
  * basis.  Some architectures would use unsigned long and others would use
@@ -787,6 +848,6 @@
 # define PRI__64 "ll"
 #endif
 
-#define PRI__s64 PRI__64"d"
+#define PRI__d64 PRI__64"d"
 #define PRI__u64 PRI__64"u"
 #define PRI__x64 PRI__64"x"
diff --git a/dirent.c b/dirent.c
index ae576c8..75e3635 100644
--- a/dirent.c
+++ b/dirent.c
@@ -48,8 +48,8 @@
 		return;
 
 	tprintf("{d_ino=%llu, d_off=%llu, d_reclen=%u, d_name=",
-		(unsigned long long) d.d_ino,
-		(unsigned long long) d.d_off, d.d_reclen);
+		widen_to_ull(d.d_ino),
+		widen_to_ull(d.d_off), d.d_reclen);
 	if (d.d_reclen > D_NAME_LEN_MAX)
 		d.d_reclen = D_NAME_LEN_MAX;
 	printpathn(tcp, addr + offsetof(kernel_dirent, d_name), d.d_reclen);
@@ -76,16 +76,19 @@
 SYS_FUNC(getdents)
 {
 	unsigned int i, len, dents = 0;
-	char *buf;
+	unsigned char *buf;
 
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
 		tprints(", ");
 		return 0;
 	}
+
+	const unsigned int count = tcp->u_arg[2];
+
 	if (syserror(tcp) || !verbose(tcp)) {
 		printaddr(tcp->u_arg[1]);
-		tprintf(", %lu", tcp->u_arg[2]);
+		tprintf(", %u", count);
 		return 0;
 	}
 
@@ -101,7 +104,7 @@
 		buf = malloc(len);
 		if (!buf || umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
 			printaddr(tcp->u_arg[1]);
-			tprintf(", %lu", tcp->u_arg[2]);
+			tprintf(", %u", count);
 			free(buf);
 			return 0;
 		}
@@ -124,8 +127,8 @@
 
 			tprintf("%s{d_ino=%llu, d_off=%llu, d_reclen=%u"
 				", d_name=", i ? ", " : "",
-				(unsigned long long) d->d_ino,
-				(unsigned long long) d->d_off, d->d_reclen);
+				widen_to_ull(d->d_ino),
+				widen_to_ull(d->d_off), d->d_reclen);
 
 			if (print_quoted_string(d->d_name, d_name_len,
 					        QUOTE_0_TERMINATED) > 0) {
@@ -150,7 +153,7 @@
 		tprints("]");
 	else
 		tprintf("/* %u entries */", dents);
-	tprintf(", %lu", tcp->u_arg[2]);
+	tprintf(", %u", count);
 	free(buf);
 	return 0;
 }
diff --git a/dirent64.c b/dirent64.c
index 3c90a25..448a2f1 100644
--- a/dirent64.c
+++ b/dirent64.c
@@ -49,9 +49,12 @@
 		tprints(", ");
 		return 0;
 	}
+
+	const unsigned int count = tcp->u_arg[2];
+
 	if (syserror(tcp) || !verbose(tcp)) {
 		printaddr(tcp->u_arg[1]);
-		tprintf(", %lu", tcp->u_arg[2]);
+		tprintf(", %u", count);
 		return 0;
 	}
 
@@ -67,7 +70,7 @@
 		buf = malloc(len);
 		if (!buf || umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
 			printaddr(tcp->u_arg[1]);
-			tprintf(", %lu", tcp->u_arg[2]);
+			tprintf(", %u", count);
 			free(buf);
 			return 0;
 		}
@@ -117,7 +120,7 @@
 		tprints("]");
 	else
 		tprintf("/* %u entries */", dents);
-	tprintf(", %lu", tcp->u_arg[2]);
+	tprintf(", %u", count);
 	free(buf);
 	return 0;
 }
diff --git a/epoll.c b/epoll.c
index eed4447..7382e0c 100644
--- a/epoll.c
+++ b/epoll.c
@@ -29,9 +29,7 @@
 
 #include "defs.h"
 #include <fcntl.h>
-#ifdef HAVE_SYS_EPOLL_H
-# include <sys/epoll.h>
-#endif
+#include <sys/epoll.h>
 
 SYS_FUNC(epoll_create)
 {
@@ -49,84 +47,53 @@
 	return RVAL_DECODED | RVAL_FD;
 }
 
-#ifdef HAVE_SYS_EPOLL_H
-# include "xlat/epollevents.h"
+#include "xlat/epollevents.h"
 
-static void
-print_epoll_event(struct epoll_event *ev)
+static bool
+print_epoll_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
+	const struct epoll_event *ev = elem_buf;
+
 	tprints("{");
 	printflags(epollevents, ev->events, "EPOLL???");
 	/* We cannot know what format the program uses, so print u32 and u64
 	   which will cover every value.  */
 	tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
 		ev->data.u32, ev->data.u64);
+
+	return true;
 }
-#endif
 
 #include "xlat/epollctls.h"
 
 SYS_FUNC(epoll_ctl)
 {
-	struct epoll_event ev;
-
 	printfd(tcp, tcp->u_arg[0]);
 	tprints(", ");
-	printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
+	const unsigned int op = tcp->u_arg[1];
+	printxval(epollctls, op, "EPOLL_CTL_???");
 	tprints(", ");
 	printfd(tcp, tcp->u_arg[2]);
 	tprints(", ");
-#ifdef HAVE_SYS_EPOLL_H
-	if (EPOLL_CTL_DEL == tcp->u_arg[1])
+	struct epoll_event ev;
+	if (EPOLL_CTL_DEL == op)
 		printaddr(tcp->u_arg[3]);
 	else if (!umove_or_printaddr(tcp, tcp->u_arg[3], &ev))
-		print_epoll_event(&ev);
-#else
-	printaddr(tcp->u_arg[3]);
-#endif
+		print_epoll_event(tcp, &ev, sizeof(ev), 0);
 
 	return RVAL_DECODED;
 }
 
 static void
-print_epoll_event_array(struct tcb *tcp, const long addr, const long len)
-{
-#ifdef HAVE_SYS_EPOLL_H
-	struct epoll_event ev, *start, *cur, *end;
-
-	if (!len) {
-		tprints("[]");
-		return;
-	}
-
-	if (umove_or_printaddr(tcp, addr, &ev))
-		return;
-
-	tprints("[");
-	print_epoll_event(&ev);
-
-	start = (struct epoll_event *) addr;
-	end = start + len;
-	for (cur = start + 1; cur < end; ++cur) {
-		tprints(", ");
-		if (umove_or_printaddr(tcp, (long) cur, &ev))
-			break;
-		print_epoll_event(&ev);
-	}
-	tprints("]");
-#else
-	printaddr(addr);
-#endif
-}
-
-static void
 epoll_wait_common(struct tcb *tcp)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
 		tprints(", ");
 	} else {
-		print_epoll_event_array(tcp, tcp->u_arg[1], tcp->u_rval);
+		struct epoll_event ev;
+		print_array(tcp, tcp->u_arg[1], tcp->u_rval, &ev, sizeof(ev),
+			    umoven_or_printaddr, print_epoll_event, 0);
 		tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
 	}
 }
diff --git a/evdev.c b/evdev.c
index f89397e..2e436d6 100644
--- a/evdev.c
+++ b/evdev.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015 Etienne Gemsa <etienne.gemsa@lse.epita.fr>
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,33 +28,47 @@
 
 #include "defs.h"
 
-#include <linux/ioctl.h>
+#ifdef HAVE_LINUX_INPUT_H
+
+#include DEF_MPERS_TYPE(struct_ff_effect)
+
+# include <linux/ioctl.h>
+# include <linux/input.h>
+
+typedef struct ff_effect struct_ff_effect;
+
+#endif /* HAVE_LINUX_BTRFS_H */
+
+#include MPERS_DEFS
 
 #ifdef HAVE_LINUX_INPUT_H
-#include <linux/input.h>
-#include "xlat/evdev_abs.h"
-#include "xlat/evdev_autorepeat.h"
-#include "xlat/evdev_ff_status.h"
-#include "xlat/evdev_ff_types.h"
-#include "xlat/evdev_keycode.h"
-#include "xlat/evdev_leds.h"
-#include "xlat/evdev_misc.h"
-#include "xlat/evdev_mtslots.h"
-#include "xlat/evdev_prop.h"
-#include "xlat/evdev_relative_axes.h"
-#include "xlat/evdev_snd.h"
-#include "xlat/evdev_switch.h"
-#include "xlat/evdev_sync.h"
 
-#ifndef SYN_MAX
-# define SYN_MAX 0xf
-#endif
+# include "xlat/evdev_autorepeat.h"
+# include "xlat/evdev_ff_status.h"
+# include "xlat/evdev_ff_types.h"
+# include "xlat/evdev_keycode.h"
+# include "xlat/evdev_leds.h"
+# include "xlat/evdev_misc.h"
+# include "xlat/evdev_mtslots.h"
+# include "xlat/evdev_prop.h"
+# include "xlat/evdev_relative_axes.h"
+# include "xlat/evdev_snd.h"
+# include "xlat/evdev_switch.h"
+# include "xlat/evdev_sync.h"
+
+# ifndef SYN_MAX
+#  define SYN_MAX 0xf
+# endif
 
 static void
-decode_envelope(struct ff_envelope *envelope)
+decode_envelope(void *const data)
 {
-	tprintf(", envelope={attack_length=%" PRIu16 ", attack_level=%" PRIu16
-		", fade_length=%" PRIu16 ", fade_level=%" PRIx32 "}",
+	const struct ff_envelope *const envelope = data;
+
+	tprintf(", envelope={attack_length=%" PRIu16
+		", attack_level=%" PRIu16
+		", fade_length=%" PRIu16
+		", fade_level=%#x}",
 		envelope->attack_length,
 		envelope->attack_level,
 		envelope->fade_length,
@@ -64,136 +78,151 @@
 static int
 ff_effect_ioctl(struct tcb *tcp, long arg)
 {
-	struct ff_effect ffe;
+	tprints(", ");
 
-	if (!verbose(tcp) || umove(tcp, arg, &ffe) < 0)
-		return 0;
+	struct_ff_effect ffe;
 
-	tprints(", {type=");
+	if (umove_or_printaddr(tcp, arg, &ffe))
+		return 1;
+
+	tprints("{type=");
 	printxval(evdev_ff_types, ffe.type, "FF_???");
-	tprintf(", id=%" PRIu16 ", direction=%" PRIu16,
-		ffe.id, ffe.direction);
+	tprintf(", id=%" PRIu16
+		", direction=%" PRIu16 ", ",
+		ffe.id,
+		ffe.direction);
 
-	if (!abbrev(tcp)) {
-		tprintf(", trigger={button=%" PRIu16 ", interval=%" PRIu16 "}",
-			ffe.trigger.button, ffe.trigger.interval);
-		tprintf(", replay={lenght=%" PRIu16 ", delay=%" PRIu16 "}",
-			ffe.replay.length, ffe.replay.delay);
-		switch (ffe.type) {
-			case FF_CONSTANT:
-				tprintf(", constant_ef={%" PRIi16,
-					ffe.u.constant.level);
-				decode_envelope(&ffe.u.constant.envelope);
-				tprints("}");
-				return 1;
-			case FF_RAMP:
-				tprintf(", ramp={start_level=%" PRIi16
-					", end_level=%" PRIi16,
-					ffe.u.ramp.start_level,
-					ffe.u.ramp.end_level);
-				decode_envelope(&ffe.u.ramp.envelope);
-				tprints("}");
-				return 1;
-			case FF_PERIODIC:
-				tprintf(", periodic_ef={waveform=%" PRIu16
-					", period=%" PRIu16
-					", magnitude=%" PRIi16
-					", offset=%" PRIi16
-					", phase=%" PRIu16,
-					ffe.u.periodic.waveform,
-					ffe.u.periodic.period,
-					ffe.u.periodic.magnitude,
-					ffe.u.periodic.offset,
-					ffe.u.periodic.phase);
-				decode_envelope(&ffe.u.periodic.envelope);
-				tprintf(", custom_len=%" PRIu32
-					", *custom_data=%#lx}",
-					ffe.u.periodic.custom_len,
-					(unsigned long)ffe.u.periodic.custom_data);
-				return 1;
-			case FF_RUMBLE:
-				tprintf(", rumble={strong_magnitude=%" PRIu16
-					", weak_magnitude=%" PRIu16 "}",
-					ffe.u.rumble.strong_magnitude,
-					ffe.u.rumble.weak_magnitude);
-				return 1;
-			case FF_SPRING:
-			case FF_FRICTION:
-			case FF_DAMPER:
-			case FF_INERTIA:
-			case FF_CUSTOM:
-				break;
-			default :
-				break;
-		}
+	if (abbrev(tcp)) {
+		tprints("...}");
+		return 1;
 	}
 
-	tprints(", ...}");
+	tprintf("trigger={button=%" PRIu16
+		", interval=%" PRIu16 "}"
+		", replay={length=%" PRIu16
+		", delay=%" PRIu16 "}",
+		ffe.trigger.button,
+		ffe.trigger.interval,
+		ffe.replay.length,
+		ffe.replay.delay);
+
+	switch (ffe.type) {
+		case FF_CONSTANT:
+			tprintf(", constant={level=%" PRId16,
+				ffe.u.constant.level);
+			decode_envelope(&ffe.u.constant.envelope);
+			tprints("}");
+			break;
+		case FF_RAMP:
+			tprintf(", ramp={start_level=%" PRId16
+				", end_level=%" PRId16,
+				ffe.u.ramp.start_level,
+				ffe.u.ramp.end_level);
+			decode_envelope(&ffe.u.ramp.envelope);
+			tprints("}");
+			break;
+		case FF_PERIODIC:
+			tprintf(", periodic={waveform=%" PRIu16
+				", period=%" PRIu16
+				", magnitude=%" PRId16
+				", offset=%" PRId16
+				", phase=%" PRIu16,
+				ffe.u.periodic.waveform,
+				ffe.u.periodic.period,
+				ffe.u.periodic.magnitude,
+				ffe.u.periodic.offset,
+				ffe.u.periodic.phase);
+			decode_envelope(&ffe.u.periodic.envelope);
+			tprintf(", custom_len=%u"
+				", custom_data=%#lx}",
+				ffe.u.periodic.custom_len,
+				(unsigned long) ffe.u.periodic.custom_data);
+			break;
+		case FF_RUMBLE:
+			tprintf(", rumble={strong_magnitude=%" PRIu16
+				", weak_magnitude=%" PRIu16 "}",
+				ffe.u.rumble.strong_magnitude,
+				ffe.u.rumble.weak_magnitude);
+			break;
+		default:
+			break;
+	}
+
+	tprints("}");
+
 	return 1;
 }
 
 static int
 abs_ioctl(struct tcb *tcp, long arg)
 {
+	tprints(", ");
+
 	struct input_absinfo absinfo;
 
-	if (!verbose(tcp) || umove(tcp, arg, &absinfo) < 0)
-		return 0;
+	if (!umove_or_printaddr(tcp, arg, &absinfo)) {
+		tprintf("{value=%u"
+			", minimum=%u, ",
+			absinfo.value,
+			absinfo.minimum);
 
-	tprintf(", {value=%" PRIu32 ", minimum=%" PRIu32,
-		absinfo.value, absinfo.minimum);
-	if (!abbrev(tcp)) {
-		tprintf(", maximum=%" PRIu32 ", fuzz=%" PRIu32,
-			absinfo.maximum, absinfo.fuzz);
-		tprintf(", flat=%" PRIu32, absinfo.flat);
-#ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION
-		tprintf(", resolution=%" PRIu32, absinfo.resolution);
-#endif
+		if (!abbrev(tcp)) {
+			tprintf("maximum=%u"
+				", fuzz=%u"
+				", flat=%u",
+				absinfo.maximum,
+				absinfo.fuzz,
+				absinfo.flat);
+# ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION
+			tprintf(", resolution=%u",
+				absinfo.resolution);
+# endif
+		} else {
+			tprints("...");
+		}
+
 		tprints("}");
-	} else {
-		tprints(", ...}");
 	}
+
 	return 1;
 }
 
 static int
 keycode_ioctl(struct tcb *tcp, long arg)
 {
+	tprints(", ");
+
 	unsigned int keycode[2];
 
-	if (!arg) {
-		tprints(", NULL");
-		return 1;
+	if (!umove_or_printaddr(tcp, arg, &keycode)) {
+		tprintf("[%u, ", keycode[0]);
+		printxval(evdev_keycode, keycode[1], "KEY_???");
+		tprints("]");
 	}
 
-	if (!verbose(tcp) || umove(tcp, arg, &keycode) < 0)
-		return 0;
-
-	tprintf(", [%u, ", keycode[0]);
-	printxval(evdev_keycode, keycode[1], "KEY_???");
-	tprints("]");
 	return 1;
 }
 
-#ifdef EVIOCGKEYCODE_V2
+# ifdef EVIOCGKEYCODE_V2
 static int
 keycode_V2_ioctl(struct tcb *tcp, long arg)
 {
+	tprints(", ");
+
 	struct input_keymap_entry ike;
 
-	if (!arg) {
-		tprints(", NULL");
+	if (umove_or_printaddr(tcp, arg, &ike))
 		return 1;
-	}
 
-	if (!verbose(tcp) || umove(tcp, arg, &ike) < 0)
-		return 0;
+	tprintf("{flags=%" PRIu8
+		", len=%" PRIu8 ", ",
+		ike.flags,
+		ike.len);
 
-	tprintf(", {flags=%" PRIu8 ", len=%" PRIu8, ike.flags, ike.len);
 	if (!abbrev(tcp)) {
 		unsigned int i;
 
-		tprintf(", index=%" PRIu16 ", keycode=", ike.index);
+		tprintf("index=%" PRIu16 ", keycode=", ike.index);
 		printxval(evdev_keycode, ike.keycode, "KEY_???");
 		tprints(", scancode=[");
 		for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
@@ -201,30 +230,34 @@
 				tprints(", ");
 			tprintf("%" PRIx8, ike.scancode[i]);
 		}
-		tprints("]}");
+		tprints("]");
 	} else {
-		tprints(", ...}");
+		tprints("...");
 	}
+
+	tprints("}");
+
 	return 1;
 }
-#endif /* EVIOCGKEYCODE_V2 */
+# endif /* EVIOCGKEYCODE_V2 */
 
 static int
 getid_ioctl(struct tcb *tcp, long arg)
 {
+	tprints(", ");
+
 	struct input_id id;
 
-	if (!verbose(tcp) || umove(tcp, arg, &id) < 0)
-		return 0;
+	if (!umove_or_printaddr(tcp, arg, &id))
+		tprintf("{ID_BUS=%" PRIu16
+			", ID_VENDOR=%" PRIu16
+			", ID_PRODUCT=%" PRIu16
+			", ID_VERSION=%" PRIu16 "}",
+			id.bustype,
+			id.vendor,
+			id.product,
+			id.version);
 
-	tprintf(", {ID_BUS=%" PRIu16 ", ID_VENDOR=%" PRIu16,
-		id.bustype, id.vendor);
-	if (!abbrev(tcp)) {
-		tprintf(", ID_PRODUCT=%" PRIu16 ", ID_VERSION=%" PRIu16 "}",
-			id.product, id.version);
-	} else {
-		tprints(", ...}");
-	}
 	return 1;
 }
 
@@ -232,8 +265,7 @@
 decode_bitset(struct tcb *tcp, long arg, const struct xlat decode_nr[],
 	      const unsigned int max_nr, const char *dflt)
 {
-	if (!verbose(tcp))
-		return 0;
+	tprints(", ");
 
 	unsigned int size;
 	if ((unsigned long) tcp->u_rval > max_nr)
@@ -242,10 +274,10 @@
 		size = tcp->u_rval;
 	char decoded_arg[size];
 
-	if (umoven(tcp, arg, size, decoded_arg) < 0)
-		return 0;
+	if (umove_or_printaddr(tcp, arg, &decoded_arg))
+		return 1;
 
-	tprints(", [");
+	tprints("[");
 
 	int bit_displayed = 0;
 	int i = next_set_bit(decoded_arg, 0, size);
@@ -270,34 +302,39 @@
 	return 1;
 }
 
-#ifdef EVIOCGMTSLOTS
+# ifdef EVIOCGMTSLOTS
 static int
 mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
 {
-	const size_t size = _IOC_SIZE(code) / sizeof(int32_t);
-	if (!size)
-		return 0;
+	tprints(", ");
 
-	int32_t buffer[size];
+	const size_t size = _IOC_SIZE(code) / sizeof(int);
+	if (!size) {
+		printaddr(arg);
+		return 1;
+	}
 
-	if (!verbose(tcp) || umove(tcp, arg, &buffer) < 0)
-		return 0;
+	int buffer[size];
 
-	tprints(", {code=");
+	if (umove_or_printaddr(tcp, arg, &buffer))
+		return 1;
+
+	tprints("{code=");
 	printxval(evdev_mtslots, buffer[0], "ABS_MT_???");
 
-	unsigned int i;
 	tprints(", values=[");
 
+	unsigned int i;
 	for (i = 1; i < ARRAY_SIZE(buffer); i++)
 		tprintf("%s%d", i > 1 ? ", " : "", buffer[i]);
 
 	tprints("]}");
+
 	return 1;
 }
-#endif /* EVIOCGMTSLOTS */
+# endif /* EVIOCGMTSLOTS */
 
-#if defined EVIOCGREP || defined EVIOCSREP
+# if defined EVIOCGREP || defined EVIOCSREP
 static int
 repeat_ioctl(struct tcb *tcp, long arg)
 {
@@ -305,173 +342,185 @@
 	printpair_int(tcp, arg, "%u");
 	return 1;
 }
-#endif /* EVIOCGREP || EVIOCSREP */
+# endif /* EVIOCGREP || EVIOCSREP */
 
 static int
-evdev_read_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+bit_ioctl(struct tcb *tcp, const unsigned int ev_nr, const long arg)
 {
-	if (entering(tcp))
-		return 1;
-
-	if (syserror(tcp))
-		return 0;
-
-	if ((_IOC_NR(code) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0))) {
-		switch (_IOC_NR(code) - 0x20) {
-			case EV_SYN:
-				return decode_bitset(tcp, arg, evdev_sync,
-						SYN_MAX, "SYN_???");
-			case EV_KEY:
-				return decode_bitset(tcp, arg, evdev_keycode,
-						KEY_MAX, "KEY_???");
-			case EV_REL:
-				return decode_bitset(tcp, arg, evdev_relative_axes,
-						REL_MAX, "REL_???");
-			case EV_ABS:
-				return decode_bitset(tcp, arg,
-						evdev_abs, ABS_MAX, "ABS_???");
-			case EV_MSC:
-				return decode_bitset(tcp, arg,
-						evdev_misc, MSC_MAX, "MSC_???");
-#ifdef EV_SW
-			case EV_SW:
-				return decode_bitset(tcp, arg,
-						evdev_switch, SW_MAX, "SW_???");
-#endif
-			case EV_LED:
-				return decode_bitset(tcp, arg,
-						evdev_leds, LED_MAX, "LED_???");
-			case EV_SND:
-				return decode_bitset(tcp, arg,
-						evdev_snd, SND_MAX, "SND_???");
-			case EV_REP:
-				return decode_bitset(tcp, arg, evdev_autorepeat,
-						REP_MAX, "REP_???");
-			case EV_FF:
-				return decode_bitset(tcp, arg, evdev_ff_types,
-						FF_MAX, "FF_???");
-			case EV_PWR:
-				printnum_int(tcp, arg, "%d");
-				return 1;
-			case EV_FF_STATUS:
-				return decode_bitset(tcp, arg, evdev_ff_status,
-						FF_STATUS_MAX, "FF_STATUS_???");
-			default:
-				return 0;
-		}
+	switch (ev_nr) {
+		case EV_SYN:
+			return decode_bitset(tcp, arg, evdev_sync,
+					     SYN_MAX, "SYN_???");
+		case EV_KEY:
+			return decode_bitset(tcp, arg, evdev_keycode,
+					     KEY_MAX, "KEY_???");
+		case EV_REL:
+			return decode_bitset(tcp, arg, evdev_relative_axes,
+					     REL_MAX, "REL_???");
+		case EV_ABS:
+			return decode_bitset(tcp, arg, evdev_abs,
+					     ABS_MAX, "ABS_???");
+		case EV_MSC:
+			return decode_bitset(tcp, arg, evdev_misc,
+					     MSC_MAX, "MSC_???");
+# ifdef EV_SW
+		case EV_SW:
+			return decode_bitset(tcp, arg, evdev_switch,
+					     SW_MAX, "SW_???");
+# endif
+		case EV_LED:
+			return decode_bitset(tcp, arg, evdev_leds,
+					     LED_MAX, "LED_???");
+		case EV_SND:
+			return decode_bitset(tcp, arg, evdev_snd,
+					     SND_MAX, "SND_???");
+		case EV_REP:
+			return decode_bitset(tcp, arg, evdev_autorepeat,
+					     REP_MAX, "REP_???");
+		case EV_FF:
+			return decode_bitset(tcp, arg, evdev_ff_types,
+					     FF_MAX, "FF_???");
+		case EV_PWR:
+			tprints(", ");
+			printnum_int(tcp, arg, "%d");
+			return 1;
+		case EV_FF_STATUS:
+			return decode_bitset(tcp, arg, evdev_ff_status,
+					     FF_STATUS_MAX, "FF_STATUS_???");
+		default:
+			tprints(", ");
+			printaddr(arg);
+			return 1;
 	}
+}
 
-	if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0)))
-		return abs_ioctl(tcp, arg);
-
+static int
+evdev_read_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+{
+	/* fixed-number fixed-length commands */
 	switch (code) {
 		case EVIOCGVERSION:
 			tprints(", ");
-			printnum_int(tcp, arg, "%" PRIx32);
+			printnum_int(tcp, arg, "%#x");
 			return 1;
 		case EVIOCGEFFECTS:
 			tprints(", ");
-			printnum_int(tcp, arg, "%" PRIu32);
+			printnum_int(tcp, arg, "%u");
 			return 1;
 		case EVIOCGID:
 			return getid_ioctl(tcp, arg);
-#ifdef EVIOCGREP
+# ifdef EVIOCGREP
 		case EVIOCGREP:
-			return repeat_ioctl(tcp, arg);;
-#endif
+			return repeat_ioctl(tcp, arg);
+# endif
 		case EVIOCGKEYCODE:
 			return keycode_ioctl(tcp, arg);
-#ifdef EVIOCGKEYCODE_V2
+# ifdef EVIOCGKEYCODE_V2
 		case EVIOCGKEYCODE_V2:
 			return keycode_V2_ioctl(tcp, arg);
-#endif
+# endif
 	}
 
+	/* fixed-number variable-length commands */
 	switch (_IOC_NR(code)) {
-#ifdef EVIOCGMTSLOTS
+# ifdef EVIOCGMTSLOTS
 		case _IOC_NR(EVIOCGMTSLOTS(0)):
 			return mtslots_ioctl(tcp, code, arg);
-#endif
+# endif
 		case _IOC_NR(EVIOCGNAME(0)):
 		case _IOC_NR(EVIOCGPHYS(0)):
 		case _IOC_NR(EVIOCGUNIQ(0)):
 			tprints(", ");
-			printstr(tcp, arg, tcp->u_rval - 1);
+			if (syserror(tcp))
+				printaddr(arg);
+			else
+				printstr(tcp, arg, tcp->u_rval);
 			return 1;
-#ifdef EVIOCGPROP
+# ifdef EVIOCGPROP
 		case _IOC_NR(EVIOCGPROP(0)):
-			return decode_bitset(tcp, arg,
-					evdev_prop, INPUT_PROP_MAX, "PROP_???");
-#endif
+			return decode_bitset(tcp, arg, evdev_prop,
+					     INPUT_PROP_MAX, "PROP_???");
+# endif
 		case _IOC_NR(EVIOCGSND(0)):
-			return decode_bitset(tcp, arg,
-					evdev_snd, SND_MAX, "SND_???");
-#ifdef EVIOCGSW
+			return decode_bitset(tcp, arg, evdev_snd,
+					     SND_MAX, "SND_???");
+# ifdef EVIOCGSW
 		case _IOC_NR(EVIOCGSW(0)):
-			return decode_bitset(tcp, arg,
-					evdev_switch, SW_MAX, "SW_???");
-#endif
+			return decode_bitset(tcp, arg, evdev_switch,
+					     SW_MAX, "SW_???");
+# endif
 		case _IOC_NR(EVIOCGKEY(0)):
-			return decode_bitset(tcp, arg,
-					evdev_keycode, KEY_MAX, "KEY_???");
+			return decode_bitset(tcp, arg, evdev_keycode,
+					     KEY_MAX, "KEY_???");
 		case _IOC_NR(EVIOCGLED(0)):
-			return decode_bitset(tcp, arg,
-					evdev_leds, LED_MAX, "LED_???");
-		default:
-			return 0;
+			return decode_bitset(tcp, arg, evdev_leds,
+					     LED_MAX, "LED_???");
 	}
+
+	/* multi-number fixed-length commands */
+	if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0)))
+		return abs_ioctl(tcp, arg);
+
+	/* multi-number variable-length commands */
+	if ((_IOC_NR(code) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0)))
+		return bit_ioctl(tcp, _IOC_NR(code) & EV_MAX, arg);
+
+	return 0;
 }
 
 static int
-evdev_write_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
 {
-	if (exiting(tcp))
-		return 1;
-
-	if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0)))
-		return abs_ioctl(tcp, arg);
-
+	/* fixed-number fixed-length commands */
 	switch (code) {
-#ifdef EVIOCSREP
+# ifdef EVIOCSREP
 		case EVIOCSREP:
 			return repeat_ioctl(tcp, arg);
-#endif
+# endif
 		case EVIOCSKEYCODE:
 			return keycode_ioctl(tcp, arg);
-#ifdef EVIOCSKEYCODE_V2
+# ifdef EVIOCSKEYCODE_V2
 		case EVIOCSKEYCODE_V2:
 			return keycode_V2_ioctl(tcp, arg);
-#endif
+# endif
 		case EVIOCSFF:
 			return ff_effect_ioctl(tcp, arg);
 		case EVIOCRMFF:
-#ifdef EVIOCSCLOCKID
-		case EVIOCSCLOCKID:
-#endif
+			tprintf(", %d", (int) arg);
+			return 1;
 		case EVIOCGRAB:
-#ifdef EVIOCREVOKE
+# ifdef EVIOCREVOKE
 		case EVIOCREVOKE:
-#endif
+# endif
+			tprintf(", %lu", arg);
+			return 1;
+# ifdef EVIOCSCLOCKID
+		case EVIOCSCLOCKID:
 			tprints(", ");
 			printnum_int(tcp, arg, "%u");
 			return 1;
-		default:
-			return 0;
+# endif
 	}
+
+	/* multi-number fixed-length commands */
+	if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0)))
+		return abs_ioctl(tcp, arg);
+
+	return 0;
 }
 
-int
-evdev_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *tcp,
+		   const unsigned int code, const long arg)
 {
 	switch(_IOC_DIR(code)) {
 		case _IOC_READ:
+			if (entering(tcp))
+				return 0;
 			return evdev_read_ioctl(tcp, code, arg);
 		case _IOC_WRITE:
-			if (!evdev_write_ioctl(tcp, code, arg))
-				tprintf(", %lx", arg);
-			return 1;
+			return evdev_write_ioctl(tcp, code, arg) | RVAL_DECODED;
 		default:
-			return 0;
+			return RVAL_DECODED;
 	}
 }
 
diff --git a/fanotify.c b/fanotify.c
index 715ea63..203e9d2 100644
--- a/fanotify.c
+++ b/fanotify.c
@@ -39,9 +39,8 @@
 
 SYS_FUNC(fanotify_init)
 {
-	unsigned flags;
+	unsigned int flags = tcp->u_arg[0];
 
-	flags = tcp->u_arg[0];
 	printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
 	flags &= ~FAN_ALL_CLASS_BITS;
 	if (flags) {
@@ -59,23 +58,21 @@
 
 SYS_FUNC(fanotify_mark)
 {
-	unsigned long long mask = 0;
-	int argn;
-
 	printfd(tcp, tcp->u_arg[0]);
 	tprints(", ");
-	printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
+	printflags(fan_mark_flags, tcp->u_arg[1], "FAN_MARK_???");
 	tprints(", ");
 	/*
 	 * the mask argument is defined as 64-bit,
 	 * but kernel uses the lower 32 bits only.
 	 */
-	argn = getllval(tcp, &mask, 2);
+	unsigned long long mask = 0;
+	int argn = getllval(tcp, &mask, 2);
 #ifdef HPPA
 	/* Parsic is weird.  See arch/parisc/kernel/sys_parisc32.c.  */
 	mask = (mask << 32) | (mask >> 32);
 #endif
-	printflags(fan_event_flags, mask, "FAN_???");
+	printflags64(fan_event_flags, mask, "FAN_???");
 	tprints(", ");
 	if ((int) tcp->u_arg[argn] == FAN_NOFD)
 		tprints("FAN_NOFD, ");
diff --git a/fcntl.c b/fcntl.c
index 561c164..bfe8b14 100644
--- a/fcntl.c
+++ b/fcntl.c
@@ -43,9 +43,9 @@
 print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
 {
 	tprints("{l_type=");
-	printxval(lockfcmds, fl->l_type, "F_???");
+	printxval(lockfcmds, (unsigned short) fl->l_type, "F_???");
 	tprints(", l_whence=");
-	printxval(whence_codes, fl->l_whence, "SEEK_???");
+	printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???");
 	tprintf(", l_start=%lld, l_len=%lld",
 		(long long) fl->l_start, (long long) fl->l_len);
 	if (getlk)
@@ -87,7 +87,9 @@
 static int
 print_fcntl(struct tcb *tcp)
 {
-	switch (tcp->u_arg[1]) {
+	const unsigned int cmd = tcp->u_arg[1];
+
+	switch (cmd) {
 	case F_SETFD:
 		tprints(", ");
 		printflags(fdflags, tcp->u_arg[2], "FD_???");
@@ -120,15 +122,15 @@
 		break;
 	case F_NOTIFY:
 		tprints(", ");
-		printflags(notifyflags, tcp->u_arg[2], "DN_???");
+		printflags_long(notifyflags, tcp->u_arg[2], "DN_???");
 		break;
 	case F_SETLEASE:
 		tprints(", ");
-		printxval(lockfcmds, tcp->u_arg[2], "F_???");
+		printxval_long(lockfcmds, tcp->u_arg[2], "F_???");
 		break;
 	case F_ADD_SEALS:
 		tprints(", ");
-		printflags(f_seals, tcp->u_arg[2], "F_SEAL_???");
+		printflags_long(f_seals, tcp->u_arg[2], "F_SEAL_???");
 		break;
 	case F_SETSIG:
 		tprints(", ");
@@ -140,7 +142,8 @@
 	case F_GETFD:
 		if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
 			return 0;
-		tcp->auxstr = sprintflags("flags ", fdflags, tcp->u_rval);
+		tcp->auxstr = sprintflags("flags ", fdflags,
+					  (unsigned long) tcp->u_rval);
 		return RVAL_HEX | RVAL_STR;
 	case F_GETFL:
 		if (entering(tcp) || syserror(tcp))
@@ -168,12 +171,13 @@
 	case F_GETLEASE:
 		if (entering(tcp) || syserror(tcp))
 			return 0;
-		tcp->auxstr = xlookup(lockfcmds, tcp->u_rval);
+		tcp->auxstr = xlookup(lockfcmds, (unsigned long) tcp->u_rval);
 		return RVAL_HEX | RVAL_STR;
 	case F_GET_SEALS:
 		if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
 			return 0;
-		tcp->auxstr = sprintflags("seals ", f_seals, tcp->u_rval);
+		tcp->auxstr = sprintflags("seals ", f_seals,
+					  (unsigned long) tcp->u_rval);
 		return RVAL_HEX | RVAL_STR;
 	case F_GETSIG:
 		if (entering(tcp) || syserror(tcp) || tcp->u_rval == 0)
@@ -192,7 +196,8 @@
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
 		tprints(", ");
-		const char *str = xlookup(fcntlcmds, tcp->u_arg[1]);
+		const unsigned int cmd = tcp->u_arg[1];
+		const char *str = xlookup(fcntlcmds, cmd);
 		if (str) {
 			tprints(str);
 		} else {
@@ -201,7 +206,7 @@
 			 * constants, but we would like to show them
 			 * for better debugging experience.
 			 */
-			printxval(fcntl64cmds, tcp->u_arg[1], "F_???");
+			printxval(fcntl64cmds, cmd, "F_???");
 		}
 	}
 	return print_fcntl(tcp);
@@ -209,17 +214,18 @@
 
 SYS_FUNC(fcntl64)
 {
+	const unsigned int cmd = tcp->u_arg[1];
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
 		tprints(", ");
-		const char *str = xlookup(fcntl64cmds, tcp->u_arg[1]);
+		const char *str = xlookup(fcntl64cmds, cmd);
 		if (str) {
 			tprints(str);
 		} else {
-			printxval(fcntlcmds, tcp->u_arg[1], "F_???");
+			printxval(fcntlcmds, cmd, "F_???");
 		}
 	}
-	switch (tcp->u_arg[1]) {
+	switch (cmd) {
 		case F_SETLK64:
 		case F_SETLKW64:
 			tprints(", ");
diff --git a/fetch_seccomp_fprog.c b/fetch_seccomp_fprog.c
index dbaf83a..d54b979 100644
--- a/fetch_seccomp_fprog.c
+++ b/fetch_seccomp_fprog.c
@@ -34,7 +34,8 @@
 
 #include MPERS_DEFS
 
-MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog)(struct tcb *tcp, const long addr, void *p)
+MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog,
+		   struct tcb *tcp, const long addr, void *p)
 {
 	struct seccomp_fprog *pfp = p;
 	seccomp_fprog_t mfp;
diff --git a/fetch_struct_flock.c b/fetch_struct_flock.c
index cd195e2..b5713f4 100644
--- a/fetch_struct_flock.c
+++ b/fetch_struct_flock.c
@@ -51,7 +51,8 @@
 	 && FLOCK_MEMBERS_EQ(type, l_len) \
 	 && FLOCK_MEMBERS_EQ(type, l_pid))
 
-MPERS_PRINTER_DECL(bool, fetch_struct_flock)(struct tcb *tcp, const long addr, void *p)
+MPERS_PRINTER_DECL(bool, fetch_struct_flock,
+		   struct tcb *tcp, const long addr, void *p)
 {
 	struct_kernel_flock64 *pfl = p;
 	struct_flock mfl;
@@ -70,7 +71,8 @@
 	return true;
 }
 
-MPERS_PRINTER_DECL(bool, fetch_struct_flock64)(struct tcb *tcp, const long addr, void *p)
+MPERS_PRINTER_DECL(bool, fetch_struct_flock64,
+		   struct tcb *tcp, const long addr, void *p)
 {
 	struct_kernel_flock64 *pfl = p;
 	struct_flock64 mfl;
diff --git a/fetch_struct_statfs.c b/fetch_struct_statfs.c
new file mode 100644
index 0000000..0cfe5ba
--- /dev/null
+++ b/fetch_struct_statfs.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+#include DEF_MPERS_TYPE(struct_statfs)
+#include DEF_MPERS_TYPE(struct_statfs64)
+
+#include <linux/types.h>
+#include <asm/statfs.h>
+typedef struct statfs struct_statfs;
+typedef struct statfs64 struct_statfs64;
+
+#include MPERS_DEFS
+
+#include "statfs.h"
+
+MPERS_PRINTER_DECL(bool, fetch_struct_statfs,
+		   struct tcb *tcp, const long addr, struct strace_statfs *p)
+{
+	struct_statfs b;
+
+	if (umove_or_printaddr(tcp, addr, &b))
+		return false;
+
+	p->f_type = widen_to_ull(b.f_type);
+	p->f_bsize = widen_to_ull(b.f_bsize);
+	p->f_blocks = widen_to_ull(b.f_blocks);
+	p->f_bfree = widen_to_ull(b.f_bfree);
+	p->f_bavail = widen_to_ull(b.f_bavail);
+	p->f_files = widen_to_ull(b.f_files);
+	p->f_ffree = widen_to_ull(b.f_ffree);
+#if defined HAVE_STRUCT_STATFS_F_FSID_VAL
+	p->f_fsid[0] = widen_to_ull(b.f_fsid.val[0]);
+	p->f_fsid[1] = widen_to_ull(b.f_fsid.val[1]);
+#elif defined HAVE_STRUCT_STATFS_F_FSID___VAL
+	p->f_fsid[0] = widen_to_ull(b.f_fsid.__val[0]);
+	p->f_fsid[1] = widen_to_ull(b.f_fsid.__val[1]);
+#endif
+	p->f_namelen = widen_to_ull(b.f_namelen);
+#ifdef HAVE_STRUCT_STATFS_F_FRSIZE
+	p->f_frsize = widen_to_ull(b.f_frsize);
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_FLAGS
+	p->f_flags = widen_to_ull(b.f_flags);
+#endif
+
+	return true;
+}
+
+#if defined ARM || (defined AARCH64 && defined IN_MPERS)
+/* See arch/arm/kernel/sys_oabi-compat.c for details. */
+# define COMPAT_STATFS64_PADDED_SIZE (sizeof(struct_statfs64) + 4)
+#endif
+
+MPERS_PRINTER_DECL(bool, fetch_struct_statfs64,
+		   struct tcb *tcp, const long addr, const unsigned long size,
+		   struct strace_statfs *p)
+{
+	struct_statfs64 b;
+
+        if (sizeof(b) != size
+#ifdef COMPAT_STATFS64_PADDED_SIZE
+	    && sizeof(b) != COMPAT_STATFS64_PADDED_SIZE
+#endif
+	   ) {
+		printaddr(addr);
+		return false;
+	}
+
+	if (umove_or_printaddr(tcp, addr, &b))
+		return false;
+
+	p->f_type = widen_to_ull(b.f_type);
+	p->f_bsize = widen_to_ull(b.f_bsize);
+	p->f_blocks = widen_to_ull(b.f_blocks);
+	p->f_bfree = widen_to_ull(b.f_bfree);
+	p->f_bavail = widen_to_ull(b.f_bavail);
+	p->f_files = widen_to_ull(b.f_files);
+	p->f_ffree = widen_to_ull(b.f_ffree);
+#if defined HAVE_STRUCT_STATFS64_F_FSID_VAL
+	p->f_fsid[0] = widen_to_ull(b.f_fsid.val[0]);
+	p->f_fsid[1] = widen_to_ull(b.f_fsid.val[1]);
+#elif defined HAVE_STRUCT_STATFS64_F_FSID___VAL
+	p->f_fsid[0] = widen_to_ull(b.f_fsid.__val[0]);
+	p->f_fsid[1] = widen_to_ull(b.f_fsid.__val[1]);
+#endif
+	p->f_namelen = widen_to_ull(b.f_namelen);
+#ifdef HAVE_STRUCT_STATFS64_F_FRSIZE
+	p->f_frsize = widen_to_ull(b.f_frsize);
+#endif
+#ifdef HAVE_STRUCT_STATFS64_F_FLAGS
+	p->f_flags = widen_to_ull(b.f_flags);
+#endif
+
+	return true;
+}
diff --git a/file_ioctl.c b/file_ioctl.c
new file mode 100644
index 0000000..de81019
--- /dev/null
+++ b/file_ioctl.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+#include <linux/ioctl.h>
+#include <linux/fs.h>
+
+#ifdef HAVE_LINUX_FIEMAP_H
+# include <linux/fiemap.h>
+# include "xlat/fiemap_flags.h"
+# include "xlat/fiemap_extent_flags.h"
+#endif
+
+#ifndef FICLONE
+# define FICLONE         _IOW(0x94, 9, int)
+#endif
+
+#ifndef FICLONERANGE
+# define FICLONERANGE    _IOW(0x94, 13, struct file_clone_range)
+struct file_clone_range {
+	int64_t src_fd;
+	uint64_t src_offset;
+	uint64_t src_length;
+	uint64_t dest_offset;
+};
+#endif
+
+#ifndef FIDEDUPERANGE
+# define FIDEDUPERANGE   _IOWR(0x94, 54, struct file_dedupe_range)
+struct file_dedupe_range_info {
+	int64_t dest_fd;	/* in - destination file */
+	uint64_t dest_offset;	/* in - start of extent in destination */
+	uint64_t bytes_deduped;	/* out - total # of bytes we were able
+				 * to dedupe from this file. */
+	/* status of this dedupe operation:
+	 * < 0 for error
+	 * == FILE_DEDUPE_RANGE_SAME if dedupe succeeds
+	 * == FILE_DEDUPE_RANGE_DIFFERS if data differs
+	 */
+	int32_t status;		/* out - see above description */
+	uint32_t reserved;	/* must be zero */
+};
+
+struct file_dedupe_range {
+	uint64_t src_offset;	/* in - start of extent in source */
+	uint64_t src_length;	/* in - length of extent */
+	uint16_t dest_count;	/* in - total elements in info array */
+	uint16_t reserved1;	/* must be zero */
+	uint32_t reserved2;	/* must be zero */
+	struct file_dedupe_range_info info[0];
+};
+#endif
+
+static bool
+print_file_dedupe_range_info(struct tcb *tcp, void *elem_buf,
+			     size_t elem_size, void *data)
+{
+	const struct file_dedupe_range_info *info = elem_buf;
+	unsigned int *count = data;
+
+	if (count) {
+		if (*count == 0) {
+			tprints("...");
+			return false;
+		}
+		--*count;
+	}
+
+	if (entering(tcp)) {
+		tprints("{dest_fd=");
+		printfd(tcp, info->dest_fd);
+		tprintf(", dest_offset=%" PRIu64 "}",
+			(uint64_t) info->dest_offset);
+	} else {
+		tprintf("{bytes_deduped=%" PRIu64 ", status=%d}",
+			(uint64_t) info->bytes_deduped, info->status);
+	}
+
+	return true;
+}
+
+#ifdef HAVE_LINUX_FIEMAP_H
+static bool
+print_fiemap_extent(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	const struct fiemap_extent *fe = elem_buf;
+
+	tprintf("{fe_logical=%" PRI__u64
+		", fe_physical=%" PRI__u64
+		", fe_length=%" PRI__u64 ", ",
+		fe->fe_logical, fe->fe_physical, fe->fe_length);
+
+	printflags64(fiemap_extent_flags, fe->fe_flags,
+		     "FIEMAP_EXTENT_???");
+	tprints("}");
+
+	return true;
+}
+#endif /* HAVE_LINUX_FIEMAP_H */
+
+int
+file_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+{
+	switch (code) {
+	case FICLONE:	/* W */
+		tprintf(", %d", (int) arg);
+		break;
+
+	case FICLONERANGE: { /* W */
+		struct file_clone_range args;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{src_fd=");
+		printfd(tcp, args.src_fd);
+		tprintf(", src_offset=%" PRIu64
+			", src_length=%" PRIu64
+			", dest_offset=%" PRIu64 "}",
+			(uint64_t) args.src_offset,
+			(uint64_t) args.src_length,
+			(uint64_t) args.dest_offset);
+		break;
+	}
+
+	case FIDEDUPERANGE: { /* RW */
+		struct file_dedupe_range args;
+		struct file_dedupe_range_info info;
+		unsigned int *limit = NULL;
+		unsigned int count = 2;
+		bool rc;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		tprints("{");
+		if (entering(tcp)) {
+			tprintf("src_offset=%" PRIu64
+				", src_length=%" PRIu64
+				", dest_count=%hu, ",
+				(uint64_t) args.src_offset,
+				(uint64_t) args.src_length,
+				(uint16_t) args.dest_count);
+		}
+
+		tprints("info=");
+
+		/* Limit how many elements we print in abbrev mode. */
+		if (abbrev(tcp) && args.dest_count > count)
+			limit = &count;
+
+		rc = print_array(tcp, arg + offsetof(typeof(args), info),
+				 args.dest_count, &info, sizeof(info),
+				 umoven_or_printaddr,
+				 print_file_dedupe_range_info, limit);
+
+		tprints("}");
+		if (!rc || exiting(tcp))
+			break;
+
+		return 0;
+	}
+
+#ifdef HAVE_LINUX_FIEMAP_H
+	case FS_IOC_FIEMAP: {
+		struct fiemap args;
+
+		if (entering(tcp))
+			tprints(", ");
+		else if (syserror(tcp))
+			break;
+		else
+			tprints(" => ");
+
+		if (umove_or_printaddr(tcp, arg, &args))
+			break;
+
+		if (entering(tcp)) {
+			tprintf("{fm_start=%" PRI__u64 ", "
+				"fm_length=%" PRI__u64 ", "
+				"fm_flags=",
+				args.fm_start, args.fm_length);
+			printflags64(fiemap_flags, args.fm_flags,
+				     "FIEMAP_FLAG_???");
+			tprintf(", fm_extent_count=%u}", args.fm_extent_count);
+			return 0;
+		}
+
+		tprints("{fm_flags=");
+		printflags64(fiemap_flags, args.fm_flags,
+			     "FIEMAP_FLAG_???");
+		tprintf(", fm_mapped_extents=%u",
+			args.fm_mapped_extents);
+		tprints(", fm_extents=");
+		if (abbrev(tcp)) {
+			tprints("...");
+		} else {
+			struct fiemap_extent fe;
+			print_array(tcp,
+				    arg + offsetof(typeof(args), fm_extents),
+				    args.fm_mapped_extents, &fe, sizeof(fe),
+				    umoven_or_printaddr,
+				    print_fiemap_extent, 0);
+		}
+		tprints("}");
+
+		break;
+	}
+#endif /* HAVE_LINUX_FIEMAP_H */
+
+	default:
+		return RVAL_DECODED;
+	};
+
+	return RVAL_DECODED | 1;
+}
diff --git a/fs_x_ioctl.c b/fs_x_ioctl.c
new file mode 100644
index 0000000..7403e6b
--- /dev/null
+++ b/fs_x_ioctl.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+#include <linux/fs.h>
+
+int
+fs_x_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+{
+	switch (code) {
+#ifdef FITRIM
+	/* First seen in linux-2.6.37 */
+	case FITRIM: {
+		struct fstrim_range fstrim;
+
+		tprints(", ");
+		if (!umove_or_printaddr(tcp, arg, &fstrim))
+			tprintf("{start=%#" PRIx64
+				", len=%#" PRIx64
+				", minlen=%#" PRIx64 "}",
+				(uint64_t) fstrim.start,
+				(uint64_t) fstrim.len,
+				(uint64_t) fstrim.minlen);
+		break;
+	}
+#endif
+
+	/* No arguments */
+#ifdef FIFREEZE
+	case FIFREEZE:
+	case FITHAW:
+		break;
+#endif
+
+	default:
+		return RVAL_DECODED;
+	}
+
+	return RVAL_DECODED | 1;
+}
diff --git a/fstatfs.c b/fstatfs.c
new file mode 100644
index 0000000..1f35824
--- /dev/null
+++ b/fstatfs.c
@@ -0,0 +1,12 @@
+#include "defs.h"
+
+SYS_FUNC(fstatfs)
+{
+	if (entering(tcp)) {
+		printfd(tcp, tcp->u_arg[0]);
+		tprints(", ");
+	} else {
+		print_struct_statfs(tcp, tcp->u_arg[1]);
+	}
+	return 0;
+}
diff --git a/fstatfs64.c b/fstatfs64.c
new file mode 100644
index 0000000..63eb3df
--- /dev/null
+++ b/fstatfs64.c
@@ -0,0 +1,14 @@
+#include "defs.h"
+
+SYS_FUNC(fstatfs64)
+{
+	const unsigned long size = tcp->u_arg[1];
+
+	if (entering(tcp)) {
+		printfd(tcp, tcp->u_arg[0]);
+		tprintf(", %lu, ", size);
+	} else {
+		print_struct_statfs64(tcp, tcp->u_arg[2], size);
+	}
+	return 0;
+}
diff --git a/hdio.c b/hdio.c
new file mode 100644
index 0000000..e9dbdf1
--- /dev/null
+++ b/hdio.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com>
+ * Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+#include DEF_MPERS_TYPE(struct_hd_geometry)
+
+#include <linux/hdreg.h>
+
+typedef struct hd_geometry struct_hd_geometry;
+
+#include MPERS_DEFS
+
+MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *tcp,
+		   const unsigned int code, const long arg)
+{
+	switch (code) {
+	case HDIO_GETGEO:
+		if (entering(tcp))
+			return 0;
+		else {
+			struct_hd_geometry geo;
+
+			tprints(", ");
+			if (!umove_or_printaddr(tcp, arg, &geo))
+				tprintf("{heads=%u, sectors=%u, "
+					"cylinders=%hu, start=%lu}",
+					(unsigned) geo.heads,
+					(unsigned) geo.sectors,
+					geo.cylinders,
+					(unsigned long) geo.start);
+		}
+		break;
+	default:
+		return RVAL_DECODED;
+	}
+
+	return RVAL_DECODED | 1;
+}
diff --git a/io.c b/io.c
index ce787cd..87b5f47 100644
--- a/io.c
+++ b/io.c
@@ -57,65 +57,57 @@
 	return RVAL_DECODED;
 }
 
+struct print_iovec_config {
+	int decode_iov;
+	unsigned long data_size;
+};
+
+static bool
+print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	const unsigned long *iov;
+	unsigned long iov_buf[2];
+	struct print_iovec_config *c = data;
+
+        if (elem_size < sizeof(iov_buf)) {
+		iov_buf[0] = ((unsigned int *) elem_buf)[0];
+		iov_buf[1] = ((unsigned int *) elem_buf)[1];
+		iov = iov_buf;
+	} else {
+		iov = elem_buf;
+	}
+
+	tprints("{");
+
+	if (c->decode_iov) {
+		unsigned long len = iov[1];
+		if (len > c->data_size)
+			len = c->data_size;
+		c->data_size -= len;
+		printstr(tcp, iov[0], len);
+	} else {
+		printaddr(iov[0]);
+	}
+
+	tprintf(", %lu}", iov[1]);
+
+	return true;
+}
+
 /*
  * data_size limits the cumulative size of printed data.
  * Example: recvmsg returing a short read.
  */
 void
-tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int decode_iov, unsigned long data_size)
+tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr,
+		int decode_iov, unsigned long data_size)
 {
 	unsigned long iov[2];
-	unsigned long size, cur, end, abbrev_end;
-	const unsigned long sizeof_iov = current_wordsize * 2;
+	struct print_iovec_config config =
+		{ .decode_iov = decode_iov, .data_size = data_size };
 
-	if (!len) {
-		tprints("[]");
-		return;
-	}
-	size = len * sizeof_iov;
-	end = addr + size;
-	if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
-	    !addr || size / sizeof_iov != len || end < addr) {
-		printaddr(addr);
-		return;
-	}
-	if (abbrev(tcp)) {
-		abbrev_end = addr + max_strlen * sizeof_iov;
-		if (abbrev_end < addr)
-			abbrev_end = end;
-	} else {
-		abbrev_end = end;
-	}
-	if (addr >= abbrev_end) {
-		tprints("[...]");
-		return;
-	}
-	for (cur = addr; cur < end; cur += sizeof_iov) {
-		if (cur > addr) {
-			tprints(", ");
-			if (cur >= abbrev_end) {
-				tprints("...");
-				break;
-			}
-		}
-		if (umove_ulong_array_or_printaddr(tcp, cur, iov,
-						   ARRAY_SIZE(iov)))
-			break;
-		if (cur <= addr)
-			tprints("[");
-		tprints("{");
-		if (decode_iov) {
-			unsigned long len = iov[1];
-			if (len > data_size)
-				len = data_size;
-			data_size -= len;
-			printstr(tcp, iov[0], len);
-		} else
-			printaddr(iov[0]);
-		tprintf(", %lu}", iov[1]);
-	}
-	if (cur > addr)
-		tprints("]");
+	print_array(tcp, addr, len, iov, current_wordsize * 2,
+		    umoven_or_printaddr, print_iovec, &config);
 }
 
 void
@@ -210,12 +202,15 @@
 	else
 # endif
 	tprintf("%lld",
-		((unsigned long long) (unsigned long) tcp->u_arg[arg + 1] << sizeof(long) * 8)
-		| (unsigned long long) (unsigned long) tcp->u_arg[arg]);
+		(widen_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
+		| widen_to_ull(tcp->u_arg[arg]));
 #endif
 }
 
-SYS_FUNC(preadv)
+#include "xlat/rwf_flags.h"
+
+static int
+do_preadv(struct tcb *tcp, const int flags_arg)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -225,21 +220,50 @@
 				tcp->u_rval);
 		tprintf(", %lu, ", tcp->u_arg[2]);
 		print_lld_from_low_high_val(tcp, 3);
+		if (flags_arg >= 0) {
+			tprints(", ");
+			printflags(rwf_flags, tcp->u_arg[flags_arg], "RWF_???");
+		}
 	}
 	return 0;
 }
 
-SYS_FUNC(pwritev)
+SYS_FUNC(preadv)
+{
+	return do_preadv(tcp, -1);
+}
+
+SYS_FUNC(preadv2)
+{
+	return do_preadv(tcp, 5);
+}
+
+static int
+do_pwritev(struct tcb *tcp, const int flags_arg)
 {
 	printfd(tcp, tcp->u_arg[0]);
 	tprints(", ");
 	tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
 	tprintf(", %lu, ", tcp->u_arg[2]);
 	print_lld_from_low_high_val(tcp, 3);
+	if (flags_arg >= 0) {
+		tprints(", ");
+		printflags(rwf_flags, tcp->u_arg[flags_arg], "RWF_???");
+	}
 
 	return RVAL_DECODED;
 }
 
+SYS_FUNC(pwritev)
+{
+	return do_pwritev(tcp, -1);
+}
+
+SYS_FUNC(pwritev2)
+{
+	return do_pwritev(tcp, 5);
+}
+
 #include "xlat/splice_flags.h"
 
 SYS_FUNC(tee)
diff --git a/ioctl.c b/ioctl.c
index f70dc44..e4b20d9 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -91,7 +91,7 @@
 	if (_IOC_DIR(code) == _IOC_WRITE) {
 		if (nr >= 0xc0 && nr <= 0xc0 + 0x3f) {
 			tprints("EVIOCSABS(");
-			printxval(evdev_abs, nr - 0xc0, "EV_???");
+			printxval(evdev_abs, nr - 0xc0, "ABS_???");
 			tprints(")");
 			return 1;
 		}
@@ -231,8 +231,17 @@
 
 	switch (_IOC_TYPE(code)) {
 #if defined(ALPHA) || defined(POWERPC)
-	case 'f': case 't': case 'T':
+	case 'f': {
+		int ret = file_ioctl(tcp, code, arg);
+		if (ret != RVAL_DECODED)
+			return ret;
+	}
+	case 't':
+	case 'T':
+		return term_ioctl(tcp, code, arg);
 #else /* !ALPHA */
+	case 'f':
+		return file_ioctl(tcp, code, arg);
 	case 0x54:
 #endif /* !ALPHA */
 		return term_ioctl(tcp, code, arg);
@@ -241,9 +250,11 @@
 	case 'p':
 		return rtc_ioctl(tcp, code, arg);
 	case 0x03:
+		return hdio_ioctl(tcp, code, arg);
 	case 0x12:
-	case 'X':
 		return block_ioctl(tcp, code, arg);
+	case 'X':
+		return fs_x_ioctl(tcp, code, arg);
 #ifdef HAVE_SCSI_SG_H
 	case 0x22:
 		return scsi_ioctl(tcp, code, arg);
@@ -263,6 +274,14 @@
 	case 'E':
 		return evdev_ioctl(tcp, code, arg);
 #endif
+#ifdef HAVE_LINUX_USERFAULTFD_H
+	case 0xaa:
+		return uffdio_ioctl(tcp, code, arg);
+#endif
+#ifdef HAVE_LINUX_BTRFS_H
+	case 0x94:
+		return btrfs_ioctl(tcp, code, arg);
+#endif
 	default:
 		break;
 	}
diff --git a/ioctl_redefs1.h b/ioctl_redefs1.h
new file mode 100644
index 0000000..4214b1f
--- /dev/null
+++ b/ioctl_redefs1.h
@@ -0,0 +1,1536 @@
+#ifdef AGPIOC_ALLOCATE
+# undef AGPIOC_ALLOCATE
+# define AGPIOC_ALLOCATE 0xc0044106
+#endif
+#ifdef AGPIOC_BIND
+# undef AGPIOC_BIND
+# define AGPIOC_BIND 0x40044108
+#endif
+#ifdef AGPIOC_INFO
+# undef AGPIOC_INFO
+# define AGPIOC_INFO 0x80044100
+#endif
+#ifdef AGPIOC_PROTECT
+# undef AGPIOC_PROTECT
+# define AGPIOC_PROTECT 0x40044105
+#endif
+#ifdef AGPIOC_RESERVE
+# undef AGPIOC_RESERVE
+# define AGPIOC_RESERVE 0x40044104
+#endif
+#ifdef AGPIOC_SETUP
+# undef AGPIOC_SETUP
+# define AGPIOC_SETUP 0x40044103
+#endif
+#ifdef AGPIOC_UNBIND
+# undef AGPIOC_UNBIND
+# define AGPIOC_UNBIND 0x40044109
+#endif
+#ifdef ASHMEM_SET_PROT_MASK
+# undef ASHMEM_SET_PROT_MASK
+# define ASHMEM_SET_PROT_MASK 0x40047705
+#endif
+#ifdef ASHMEM_SET_SIZE
+# undef ASHMEM_SET_SIZE
+# define ASHMEM_SET_SIZE 0x40047703
+#endif
+#ifdef ATM_ADDADDR
+# undef ATM_ADDADDR
+# define ATM_ADDADDR 0x400c6188
+#endif
+#ifdef ATM_ADDLECSADDR
+# undef ATM_ADDLECSADDR
+# define ATM_ADDLECSADDR 0x400c618e
+#endif
+#ifdef ATM_ADDPARTY
+# undef ATM_ADDPARTY
+# define ATM_ADDPARTY 0x400861f4
+#endif
+#ifdef ATM_DELADDR
+# undef ATM_DELADDR
+# define ATM_DELADDR 0x400c6189
+#endif
+#ifdef ATM_DELLECSADDR
+# undef ATM_DELLECSADDR
+# define ATM_DELLECSADDR 0x400c618f
+#endif
+#ifdef ATM_GETADDR
+# undef ATM_GETADDR
+# define ATM_GETADDR 0x400c6186
+#endif
+#ifdef ATM_GETCIRANGE
+# undef ATM_GETCIRANGE
+# define ATM_GETCIRANGE 0x400c618a
+#endif
+#ifdef ATM_GETESI
+# undef ATM_GETESI
+# define ATM_GETESI 0x400c6185
+#endif
+#ifdef ATM_GETLECSADDR
+# undef ATM_GETLECSADDR
+# define ATM_GETLECSADDR 0x400c6190
+#endif
+#ifdef ATM_GETLINKRATE
+# undef ATM_GETLINKRATE
+# define ATM_GETLINKRATE 0x400c6181
+#endif
+#ifdef ATM_GETLOOP
+# undef ATM_GETLOOP
+# define ATM_GETLOOP 0x400c6152
+#endif
+#ifdef ATM_GETNAMES
+# undef ATM_GETNAMES
+# define ATM_GETNAMES 0x40086183
+#endif
+#ifdef ATM_GETSTAT
+# undef ATM_GETSTAT
+# define ATM_GETSTAT 0x400c6150
+#endif
+#ifdef ATM_GETSTATZ
+# undef ATM_GETSTATZ
+# define ATM_GETSTATZ 0x400c6151
+#endif
+#ifdef ATM_GETTYPE
+# undef ATM_GETTYPE
+# define ATM_GETTYPE 0x400c6184
+#endif
+#ifdef ATM_QUERYLOOP
+# undef ATM_QUERYLOOP
+# define ATM_QUERYLOOP 0x400c6154
+#endif
+#ifdef ATM_RSTADDR
+# undef ATM_RSTADDR
+# define ATM_RSTADDR 0x400c6187
+#endif
+#ifdef ATM_SETCIRANGE
+# undef ATM_SETCIRANGE
+# define ATM_SETCIRANGE 0x400c618b
+#endif
+#ifdef ATM_SETESI
+# undef ATM_SETESI
+# define ATM_SETESI 0x400c618c
+#endif
+#ifdef ATM_SETESIF
+# undef ATM_SETESIF
+# define ATM_SETESIF 0x400c618d
+#endif
+#ifdef ATM_SETLOOP
+# undef ATM_SETLOOP
+# define ATM_SETLOOP 0x400c6153
+#endif
+#ifdef AUTOFS_IOC_SETTIMEOUT
+# undef AUTOFS_IOC_SETTIMEOUT
+# define AUTOFS_IOC_SETTIMEOUT 0xc0049364
+#endif
+#ifdef BLKBSZGET
+# undef BLKBSZGET
+# define BLKBSZGET 0x80041270
+#endif
+#ifdef BLKBSZSET
+# undef BLKBSZSET
+# define BLKBSZSET 0x40041271
+#endif
+#ifdef BLKGETSIZE64
+# undef BLKGETSIZE64
+# define BLKGETSIZE64 0x80041272
+#endif
+#ifdef BLKTRACESETUP
+# undef BLKTRACESETUP
+# define BLKTRACESETUP 0xc0401273
+#endif
+#ifdef BR_ATTEMPT_ACQUIRE
+# undef BR_ATTEMPT_ACQUIRE
+# define BR_ATTEMPT_ACQUIRE 0x8014720b
+#endif
+#ifdef BTRFS_IOC_DEV_REPLACE
+# undef BTRFS_IOC_DEV_REPLACE
+# define BTRFS_IOC_DEV_REPLACE 0xca249435
+#endif
+#ifdef BTRFS_IOC_SEND
+# undef BTRFS_IOC_SEND
+# define BTRFS_IOC_SEND 0x40449426
+#endif
+#ifdef BTRFS_IOC_SET_RECEIVED_SUBVOL
+# undef BTRFS_IOC_SET_RECEIVED_SUBVOL
+# define BTRFS_IOC_SET_RECEIVED_SUBVOL 0xc0c09425
+#endif
+#ifdef CAPI_MANUFACTURER_CMD
+# undef CAPI_MANUFACTURER_CMD
+# define CAPI_MANUFACTURER_CMD 0xc0084320
+#endif
+#ifdef CCISS_BIG_PASSTHRU
+# undef CCISS_BIG_PASSTHRU
+# define CCISS_BIG_PASSTHRU 0xc0584212
+#endif
+#ifdef CCISS_PASSTHRU
+# undef CCISS_PASSTHRU
+# define CCISS_PASSTHRU 0xc054420b
+#endif
+#ifdef CHIOGSTATUS
+# undef CHIOGSTATUS
+# define CHIOGSTATUS 0x40086308
+#endif
+#ifdef CIOC_KERNEL_VERSION
+# undef CIOC_KERNEL_VERSION
+# define CIOC_KERNEL_VERSION 0xc004630a
+#endif
+#ifdef CM_IOCGATR
+# undef CM_IOCGATR
+# define CM_IOCGATR 0xc0046301
+#endif
+#ifdef CM_IOCGSTATUS
+# undef CM_IOCGSTATUS
+# define CM_IOCGSTATUS 0x80046300
+#endif
+#ifdef CM_IOCSPTS
+# undef CM_IOCSPTS
+# define CM_IOCSPTS 0x40046302
+#endif
+#ifdef CM_IOSDBGLVL
+# undef CM_IOSDBGLVL
+# define CM_IOSDBGLVL 0x400463fa
+#endif
+#ifdef DRM_IOCTL_ADD_BUFS
+# undef DRM_IOCTL_ADD_BUFS
+# define DRM_IOCTL_ADD_BUFS 0xc0186416
+#endif
+#ifdef DRM_IOCTL_ADD_MAP
+# undef DRM_IOCTL_ADD_MAP
+# define DRM_IOCTL_ADD_MAP 0xc0186415
+#endif
+#ifdef DRM_IOCTL_AGP_ALLOC
+# undef DRM_IOCTL_AGP_ALLOC
+# define DRM_IOCTL_AGP_ALLOC 0xc0106434
+#endif
+#ifdef DRM_IOCTL_AGP_BIND
+# undef DRM_IOCTL_AGP_BIND
+# define DRM_IOCTL_AGP_BIND 0x40086436
+#endif
+#ifdef DRM_IOCTL_AGP_ENABLE
+# undef DRM_IOCTL_AGP_ENABLE
+# define DRM_IOCTL_AGP_ENABLE 0x40046432
+#endif
+#ifdef DRM_IOCTL_AGP_FREE
+# undef DRM_IOCTL_AGP_FREE
+# define DRM_IOCTL_AGP_FREE 0x40106435
+#endif
+#ifdef DRM_IOCTL_AGP_INFO
+# undef DRM_IOCTL_AGP_INFO
+# define DRM_IOCTL_AGP_INFO 0x80206433
+#endif
+#ifdef DRM_IOCTL_AGP_UNBIND
+# undef DRM_IOCTL_AGP_UNBIND
+# define DRM_IOCTL_AGP_UNBIND 0x40086437
+#endif
+#ifdef DRM_IOCTL_AMDGPU_GEM_METADATA
+# undef DRM_IOCTL_AMDGPU_GEM_METADATA
+# define DRM_IOCTL_AMDGPU_GEM_METADATA 0xc11c6446
+#endif
+#ifdef DRM_IOCTL_DMA
+# undef DRM_IOCTL_DMA
+# define DRM_IOCTL_DMA 0xc0286429
+#endif
+#ifdef DRM_IOCTL_FREE_BUFS
+# undef DRM_IOCTL_FREE_BUFS
+# define DRM_IOCTL_FREE_BUFS 0x4008641a
+#endif
+#ifdef DRM_IOCTL_GET_CLIENT
+# undef DRM_IOCTL_GET_CLIENT
+# define DRM_IOCTL_GET_CLIENT 0xc0186405
+#endif
+#ifdef DRM_IOCTL_GET_MAP
+# undef DRM_IOCTL_GET_MAP
+# define DRM_IOCTL_GET_MAP 0xc0186404
+#endif
+#ifdef DRM_IOCTL_GET_SAREA_CTX
+# undef DRM_IOCTL_GET_SAREA_CTX
+# define DRM_IOCTL_GET_SAREA_CTX 0xc008641d
+#endif
+#ifdef DRM_IOCTL_GET_STATS
+# undef DRM_IOCTL_GET_STATS
+# define DRM_IOCTL_GET_STATS 0x807c6406
+#endif
+#ifdef DRM_IOCTL_GET_UNIQUE
+# undef DRM_IOCTL_GET_UNIQUE
+# define DRM_IOCTL_GET_UNIQUE 0xc0086401
+#endif
+#ifdef DRM_IOCTL_I810_COPY
+# undef DRM_IOCTL_I810_COPY
+# define DRM_IOCTL_I810_COPY 0x400c6447
+#endif
+#ifdef DRM_IOCTL_I810_GETBUF
+# undef DRM_IOCTL_I810_GETBUF
+# define DRM_IOCTL_I810_GETBUF 0xc0106445
+#endif
+#ifdef DRM_IOCTL_I810_MC
+# undef DRM_IOCTL_I810_MC
+# define DRM_IOCTL_I810_MC 0x4014644c
+#endif
+#ifdef DRM_IOCTL_I915_ALLOC
+# undef DRM_IOCTL_I915_ALLOC
+# define DRM_IOCTL_I915_ALLOC 0xc0106448
+#endif
+#ifdef DRM_IOCTL_I915_BATCHBUFFER
+# undef DRM_IOCTL_I915_BATCHBUFFER
+# define DRM_IOCTL_I915_BATCHBUFFER 0x40186443
+#endif
+#ifdef DRM_IOCTL_I915_CMDBUFFER
+# undef DRM_IOCTL_I915_CMDBUFFER
+# define DRM_IOCTL_I915_CMDBUFFER 0x4018644b
+#endif
+#ifdef DRM_IOCTL_I915_GETPARAM
+# undef DRM_IOCTL_I915_GETPARAM
+# define DRM_IOCTL_I915_GETPARAM 0xc0086446
+#endif
+#ifdef DRM_IOCTL_I915_IRQ_EMIT
+# undef DRM_IOCTL_I915_IRQ_EMIT
+# define DRM_IOCTL_I915_IRQ_EMIT 0xc0046444
+#endif
+#ifdef DRM_IOCTL_INFO_BUFS
+# undef DRM_IOCTL_INFO_BUFS
+# define DRM_IOCTL_INFO_BUFS 0xc0086418
+#endif
+#ifdef DRM_IOCTL_MAP_BUFS
+# undef DRM_IOCTL_MAP_BUFS
+# define DRM_IOCTL_MAP_BUFS 0xc00c6419
+#endif
+#ifdef DRM_IOCTL_MARK_BUFS
+# undef DRM_IOCTL_MARK_BUFS
+# define DRM_IOCTL_MARK_BUFS 0x40186417
+#endif
+#ifdef DRM_IOCTL_MGA_DMA_BOOTSTRAP
+# undef DRM_IOCTL_MGA_DMA_BOOTSTRAP
+# define DRM_IOCTL_MGA_DMA_BOOTSTRAP 0xc01c644c
+#endif
+#ifdef DRM_IOCTL_MGA_GETPARAM
+# undef DRM_IOCTL_MGA_GETPARAM
+# define DRM_IOCTL_MGA_GETPARAM 0xc0086449
+#endif
+#ifdef DRM_IOCTL_MGA_INIT
+# undef DRM_IOCTL_MGA_INIT
+# define DRM_IOCTL_MGA_INIT 0x405c6440
+#endif
+#ifdef DRM_IOCTL_MODE_ADDFB2
+# undef DRM_IOCTL_MODE_ADDFB2
+# define DRM_IOCTL_MODE_ADDFB2 0xc06464b8
+#endif
+#ifdef DRM_IOCTL_MODE_GETPLANERESOURCES
+# undef DRM_IOCTL_MODE_GETPLANERESOURCES
+# define DRM_IOCTL_MODE_GETPLANERESOURCES 0xc00c64b5
+#endif
+#ifdef DRM_IOCTL_MODE_OBJ_GETPROPERTIES
+# undef DRM_IOCTL_MODE_OBJ_GETPROPERTIES
+# define DRM_IOCTL_MODE_OBJ_GETPROPERTIES 0xc01c64b9
+#endif
+#ifdef DRM_IOCTL_MODE_OBJ_SETPROPERTY
+# undef DRM_IOCTL_MODE_OBJ_SETPROPERTY
+# define DRM_IOCTL_MODE_OBJ_SETPROPERTY 0xc01464ba
+#endif
+#ifdef DRM_IOCTL_R128_DEPTH
+# undef DRM_IOCTL_R128_DEPTH
+# define DRM_IOCTL_R128_DEPTH 0x4018644c
+#endif
+#ifdef DRM_IOCTL_R128_GETPARAM
+# undef DRM_IOCTL_R128_GETPARAM
+# define DRM_IOCTL_R128_GETPARAM 0xc0086452
+#endif
+#ifdef DRM_IOCTL_R128_INIT
+# undef DRM_IOCTL_R128_INIT
+# define DRM_IOCTL_R128_INIT 0x40586440
+#endif
+#ifdef DRM_IOCTL_R128_STIPPLE
+# undef DRM_IOCTL_R128_STIPPLE
+# define DRM_IOCTL_R128_STIPPLE 0x4004644d
+#endif
+#ifdef DRM_IOCTL_RADEON_ALLOC
+# undef DRM_IOCTL_RADEON_ALLOC
+# define DRM_IOCTL_RADEON_ALLOC 0xc0106453
+#endif
+#ifdef DRM_IOCTL_RADEON_CLEAR
+# undef DRM_IOCTL_RADEON_CLEAR
+# define DRM_IOCTL_RADEON_CLEAR 0x40186448
+#endif
+#ifdef DRM_IOCTL_RADEON_CMDBUF
+# undef DRM_IOCTL_RADEON_CMDBUF
+# define DRM_IOCTL_RADEON_CMDBUF 0x40106450
+#endif
+#ifdef DRM_IOCTL_RADEON_CP_INIT
+# undef DRM_IOCTL_RADEON_CP_INIT
+# define DRM_IOCTL_RADEON_CP_INIT 0x40546440
+#endif
+#ifdef DRM_IOCTL_RADEON_GEM_CREATE
+# undef DRM_IOCTL_RADEON_GEM_CREATE
+# define DRM_IOCTL_RADEON_GEM_CREATE 0xc01c645d
+#endif
+#ifdef DRM_IOCTL_RADEON_GETPARAM
+# undef DRM_IOCTL_RADEON_GETPARAM
+# define DRM_IOCTL_RADEON_GETPARAM 0xc0086451
+#endif
+#ifdef DRM_IOCTL_RADEON_IRQ_EMIT
+# undef DRM_IOCTL_RADEON_IRQ_EMIT
+# define DRM_IOCTL_RADEON_IRQ_EMIT 0xc0046456
+#endif
+#ifdef DRM_IOCTL_RADEON_SETPARAM
+# undef DRM_IOCTL_RADEON_SETPARAM
+# define DRM_IOCTL_RADEON_SETPARAM 0x400c6459
+#endif
+#ifdef DRM_IOCTL_RADEON_STIPPLE
+# undef DRM_IOCTL_RADEON_STIPPLE
+# define DRM_IOCTL_RADEON_STIPPLE 0x4004644c
+#endif
+#ifdef DRM_IOCTL_RADEON_TEXTURE
+# undef DRM_IOCTL_RADEON_TEXTURE
+# define DRM_IOCTL_RADEON_TEXTURE 0xc018644e
+#endif
+#ifdef DRM_IOCTL_RADEON_VERTEX2
+# undef DRM_IOCTL_RADEON_VERTEX2
+# define DRM_IOCTL_RADEON_VERTEX2 0x4018644f
+#endif
+#ifdef DRM_IOCTL_RES_CTX
+# undef DRM_IOCTL_RES_CTX
+# define DRM_IOCTL_RES_CTX 0xc0086426
+#endif
+#ifdef DRM_IOCTL_RM_MAP
+# undef DRM_IOCTL_RM_MAP
+# define DRM_IOCTL_RM_MAP 0x4018641b
+#endif
+#ifdef DRM_IOCTL_SAVAGE_BCI_CMDBUF
+# undef DRM_IOCTL_SAVAGE_BCI_CMDBUF
+# define DRM_IOCTL_SAVAGE_BCI_CMDBUF 0x40246441
+#endif
+#ifdef DRM_IOCTL_SAVAGE_BCI_INIT
+# undef DRM_IOCTL_SAVAGE_BCI_INIT
+# define DRM_IOCTL_SAVAGE_BCI_INIT 0x40506440
+#endif
+#ifdef DRM_IOCTL_SET_SAREA_CTX
+# undef DRM_IOCTL_SET_SAREA_CTX
+# define DRM_IOCTL_SET_SAREA_CTX 0x4008641c
+#endif
+#ifdef DRM_IOCTL_SET_UNIQUE
+# undef DRM_IOCTL_SET_UNIQUE
+# define DRM_IOCTL_SET_UNIQUE 0x40086410
+#endif
+#ifdef DRM_IOCTL_SG_ALLOC
+# undef DRM_IOCTL_SG_ALLOC
+# define DRM_IOCTL_SG_ALLOC 0xc0086438
+#endif
+#ifdef DRM_IOCTL_SG_FREE
+# undef DRM_IOCTL_SG_FREE
+# define DRM_IOCTL_SG_FREE 0x40086439
+#endif
+#ifdef DRM_IOCTL_SIS_AGP_ALLOC
+# undef DRM_IOCTL_SIS_AGP_ALLOC
+# define DRM_IOCTL_SIS_AGP_ALLOC 0xc0106454
+#endif
+#ifdef DRM_IOCTL_SIS_AGP_FREE
+# undef DRM_IOCTL_SIS_AGP_FREE
+# define DRM_IOCTL_SIS_AGP_FREE 0x40106455
+#endif
+#ifdef DRM_IOCTL_SIS_AGP_INIT
+# undef DRM_IOCTL_SIS_AGP_INIT
+# define DRM_IOCTL_SIS_AGP_INIT 0xc0086453
+#endif
+#ifdef DRM_IOCTL_SIS_FB_ALLOC
+# undef DRM_IOCTL_SIS_FB_ALLOC
+# define DRM_IOCTL_SIS_FB_ALLOC 0xc0106444
+#endif
+#ifdef DRM_IOCTL_SIS_FB_FREE
+# undef DRM_IOCTL_SIS_FB_FREE
+# define DRM_IOCTL_SIS_FB_FREE 0x40106445
+#endif
+#ifdef DRM_IOCTL_SIS_FB_INIT
+# undef DRM_IOCTL_SIS_FB_INIT
+# define DRM_IOCTL_SIS_FB_INIT 0x40086456
+#endif
+#ifdef DRM_IOCTL_UPDATE_DRAW
+# undef DRM_IOCTL_UPDATE_DRAW
+# define DRM_IOCTL_UPDATE_DRAW 0x4014643f
+#endif
+#ifdef DRM_IOCTL_VERSION
+# undef DRM_IOCTL_VERSION
+# define DRM_IOCTL_VERSION 0xc0246400
+#endif
+#ifdef DRM_IOCTL_VIA_ALLOCMEM
+# undef DRM_IOCTL_VIA_ALLOCMEM
+# define DRM_IOCTL_VIA_ALLOCMEM 0xc0146440
+#endif
+#ifdef DRM_IOCTL_VIA_CMDBUFFER
+# undef DRM_IOCTL_VIA_CMDBUFFER
+# define DRM_IOCTL_VIA_CMDBUFFER 0x40086448
+#endif
+#ifdef DRM_IOCTL_VIA_DMA_BLIT
+# undef DRM_IOCTL_VIA_DMA_BLIT
+# define DRM_IOCTL_VIA_DMA_BLIT 0x4028644e
+#endif
+#ifdef DRM_IOCTL_VIA_DMA_INIT
+# undef DRM_IOCTL_VIA_DMA_INIT
+# define DRM_IOCTL_VIA_DMA_INIT 0xc0106447
+#endif
+#ifdef DRM_IOCTL_VIA_FREEMEM
+# undef DRM_IOCTL_VIA_FREEMEM
+# define DRM_IOCTL_VIA_FREEMEM 0x40146441
+#endif
+#ifdef DRM_IOCTL_VIA_MAP_INIT
+# undef DRM_IOCTL_VIA_MAP_INIT
+# define DRM_IOCTL_VIA_MAP_INIT 0xc0146444
+#endif
+#ifdef DRM_IOCTL_VIA_PCICMD
+# undef DRM_IOCTL_VIA_PCICMD
+# define DRM_IOCTL_VIA_PCICMD 0x4008644a
+#endif
+#ifdef DRM_IOCTL_VIA_WAIT_IRQ
+# undef DRM_IOCTL_VIA_WAIT_IRQ
+# define DRM_IOCTL_VIA_WAIT_IRQ 0xc010644d
+#endif
+#ifdef DRM_IOCTL_WAIT_VBLANK
+# undef DRM_IOCTL_WAIT_VBLANK
+# define DRM_IOCTL_WAIT_VBLANK 0xc010643a
+#endif
+#ifdef ENI_MEMDUMP
+# undef ENI_MEMDUMP
+# define ENI_MEMDUMP 0x400c6160
+#endif
+#ifdef ENI_SETMULT
+# undef ENI_SETMULT
+# define ENI_SETMULT 0x400c6167
+#endif
+#ifdef EVIOCSFF
+# undef EVIOCSFF
+# define EVIOCSFF 0x402c4580
+#endif
+#ifdef FBIO_CURSOR
+# undef FBIO_CURSOR
+# define FBIO_CURSOR 0xc0484608
+#endif
+#ifdef FBIO_GETCONTROL2
+# undef FBIO_GETCONTROL2
+# define FBIO_GETCONTROL2 0x80044689
+#endif
+#ifdef FBIO_RADEON_GET_MIRROR
+# undef FBIO_RADEON_GET_MIRROR
+# define FBIO_RADEON_GET_MIRROR 0x80044003
+#endif
+#ifdef FBIO_RADEON_SET_MIRROR
+# undef FBIO_RADEON_SET_MIRROR
+# define FBIO_RADEON_SET_MIRROR 0x40044004
+#endif
+#ifdef FDDEFPRM
+# undef FDDEFPRM
+# define FDDEFPRM 0x401c0243
+#endif
+#ifdef FDGETDRVPRM
+# undef FDGETDRVPRM
+# define FDGETDRVPRM 0x80580211
+#endif
+#ifdef FDGETDRVSTAT
+# undef FDGETDRVSTAT
+# define FDGETDRVSTAT 0x80340212
+#endif
+#ifdef FDGETFDCSTAT
+# undef FDGETFDCSTAT
+# define FDGETFDCSTAT 0x80200215
+#endif
+#ifdef FDGETPRM
+# undef FDGETPRM
+# define FDGETPRM 0x801c0204
+#endif
+#ifdef FDPOLLDRVSTAT
+# undef FDPOLLDRVSTAT
+# define FDPOLLDRVSTAT 0x80340213
+#endif
+#ifdef FDSETDRVPRM
+# undef FDSETDRVPRM
+# define FDSETDRVPRM 0x40580290
+#endif
+#ifdef FDSETPRM
+# undef FDSETPRM
+# define FDSETPRM 0x401c0242
+#endif
+#ifdef FDWERRORGET
+# undef FDWERRORGET
+# define FDWERRORGET 0x80180217
+#endif
+#ifdef FE_GET_PROPERTY
+# undef FE_GET_PROPERTY
+# define FE_GET_PROPERTY 0x80086f53
+#endif
+#ifdef FE_SET_PROPERTY
+# undef FE_SET_PROPERTY
+# define FE_SET_PROPERTY 0x40086f52
+#endif
+#ifdef FS_IOC_GETFLAGS
+# undef FS_IOC_GETFLAGS
+# define FS_IOC_GETFLAGS 0x80046601
+#endif
+#ifdef FS_IOC_GETVERSION
+# undef FS_IOC_GETVERSION
+# define FS_IOC_GETVERSION 0x80047601
+#endif
+#ifdef FS_IOC_SETFLAGS
+# undef FS_IOC_SETFLAGS
+# define FS_IOC_SETFLAGS 0x40046602
+#endif
+#ifdef FS_IOC_SETVERSION
+# undef FS_IOC_SETVERSION
+# define FS_IOC_SETVERSION 0x40047602
+#endif
+#ifdef FW_CDEV_IOC_CREATE_ISO_CONTEXT
+# undef FW_CDEV_IOC_CREATE_ISO_CONTEXT
+# define FW_CDEV_IOC_CREATE_ISO_CONTEXT 0xc01c2308
+#endif
+#ifdef FW_CDEV_IOC_GET_CYCLE_TIMER
+# undef FW_CDEV_IOC_GET_CYCLE_TIMER
+# define FW_CDEV_IOC_GET_CYCLE_TIMER 0x800c230c
+#endif
+#ifdef FW_CDEV_IOC_GET_CYCLE_TIMER2
+# undef FW_CDEV_IOC_GET_CYCLE_TIMER2
+# define FW_CDEV_IOC_GET_CYCLE_TIMER2 0xc0142314
+#endif
+#ifdef FW_CDEV_IOC_GET_INFO
+# undef FW_CDEV_IOC_GET_INFO
+# define FW_CDEV_IOC_GET_INFO 0xc0242300
+#endif
+#ifdef FW_CDEV_IOC_SEND_BROADCAST_REQUEST
+# undef FW_CDEV_IOC_SEND_BROADCAST_REQUEST
+# define FW_CDEV_IOC_SEND_BROADCAST_REQUEST 0x40242312
+#endif
+#ifdef FW_CDEV_IOC_SEND_PHY_PACKET
+# undef FW_CDEV_IOC_SEND_PHY_PACKET
+# define FW_CDEV_IOC_SEND_PHY_PACKET 0xc0142315
+#endif
+#ifdef FW_CDEV_IOC_SEND_REQUEST
+# undef FW_CDEV_IOC_SEND_REQUEST
+# define FW_CDEV_IOC_SEND_REQUEST 0x40242301
+#endif
+#ifdef FW_CDEV_IOC_SEND_RESPONSE
+# undef FW_CDEV_IOC_SEND_RESPONSE
+# define FW_CDEV_IOC_SEND_RESPONSE 0x40142304
+#endif
+#ifdef FW_CDEV_IOC_SET_ISO_CHANNELS
+# undef FW_CDEV_IOC_SET_ISO_CHANNELS
+# define FW_CDEV_IOC_SET_ISO_CHANNELS 0x400c2317
+#endif
+#ifdef HE_GET_REG
+# undef HE_GET_REG
+# define HE_GET_REG 0x400c6160
+#endif
+#ifdef HPET_INFO
+# undef HPET_INFO
+# define HPET_INFO 0x800c6803
+#endif
+#ifdef HPET_IRQFREQ
+# undef HPET_IRQFREQ
+# define HPET_IRQFREQ 0x40046806
+#endif
+#ifdef I2OHRTGET
+# undef I2OHRTGET
+# define I2OHRTGET 0xc00c6901
+#endif
+#ifdef I2OHTML
+# undef I2OHTML
+# define I2OHTML 0xc01c6909
+#endif
+#ifdef I2OLCTGET
+# undef I2OLCTGET
+# define I2OLCTGET 0xc00c6902
+#endif
+#ifdef I2OPARMGET
+# undef I2OPARMGET
+# define I2OPARMGET 0xc0186904
+#endif
+#ifdef I2OPARMSET
+# undef I2OPARMSET
+# define I2OPARMSET 0xc0186903
+#endif
+#ifdef I2OPASSTHRU
+# undef I2OPASSTHRU
+# define I2OPASSTHRU 0x8008690c
+#endif
+#ifdef I2OSWDEL
+# undef I2OSWDEL
+# define I2OSWDEL 0xc01c6907
+#endif
+#ifdef I2OSWDL
+# undef I2OSWDL
+# define I2OSWDL 0xc01c6905
+#endif
+#ifdef I2OSWUL
+# undef I2OSWUL
+# define I2OSWUL 0xc01c6906
+#endif
+#ifdef I8K_FN_STATUS
+# undef I8K_FN_STATUS
+# define I8K_FN_STATUS 0x80046983
+#endif
+#ifdef I8K_GET_FAN
+# undef I8K_GET_FAN
+# define I8K_GET_FAN 0xc0046986
+#endif
+#ifdef I8K_GET_SPEED
+# undef I8K_GET_SPEED
+# define I8K_GET_SPEED 0xc0046985
+#endif
+#ifdef I8K_GET_TEMP
+# undef I8K_GET_TEMP
+# define I8K_GET_TEMP 0x80046984
+#endif
+#ifdef I8K_POWER_STATUS
+# undef I8K_POWER_STATUS
+# define I8K_POWER_STATUS 0x80046982
+#endif
+#ifdef I8K_SET_FAN
+# undef I8K_SET_FAN
+# define I8K_SET_FAN 0xc0046987
+#endif
+#ifdef IDT77105_GETSTAT
+# undef IDT77105_GETSTAT
+# define IDT77105_GETSTAT 0x400c6132
+#endif
+#ifdef IDT77105_GETSTATZ
+# undef IDT77105_GETSTATZ
+# define IDT77105_GETSTATZ 0x400c6133
+#endif
+#ifdef IOCTL_GNTDEV_GRANT_COPY
+# undef IOCTL_GNTDEV_GRANT_COPY
+# define IOCTL_GNTDEV_GRANT_COPY 0x00084708
+#endif
+#ifdef ION_IOC_ALLOC
+# undef ION_IOC_ALLOC
+# define ION_IOC_ALLOC 0xc0144900
+#endif
+#ifdef ION_IOC_CUSTOM
+# undef ION_IOC_CUSTOM
+# define ION_IOC_CUSTOM 0xc0084906
+#endif
+#ifdef IOW_READ
+# undef IOW_READ
+# define IOW_READ 0x4004c002
+#endif
+#ifdef IOW_WRITE
+# undef IOW_WRITE
+# define IOW_WRITE 0x4004c001
+#endif
+#ifdef IPMICTL_RECEIVE_MSG
+# undef IPMICTL_RECEIVE_MSG
+# define IPMICTL_RECEIVE_MSG 0xc018690c
+#endif
+#ifdef IPMICTL_RECEIVE_MSG_TRUNC
+# undef IPMICTL_RECEIVE_MSG_TRUNC
+# define IPMICTL_RECEIVE_MSG_TRUNC 0xc018690b
+#endif
+#ifdef IPMICTL_SEND_COMMAND
+# undef IPMICTL_SEND_COMMAND
+# define IPMICTL_SEND_COMMAND 0x8014690d
+#endif
+#ifdef IPMICTL_SEND_COMMAND_SETTIME
+# undef IPMICTL_SEND_COMMAND_SETTIME
+# define IPMICTL_SEND_COMMAND_SETTIME 0x801c6915
+#endif
+#ifdef IVTVFB_IOC_DMA_FRAME
+# undef IVTVFB_IOC_DMA_FRAME
+# define IVTVFB_IOC_DMA_FRAME 0x400c56c0
+#endif
+#ifdef IVTV_IOC_DMA_FRAME
+# undef IVTV_IOC_DMA_FRAME
+# define IVTV_IOC_DMA_FRAME 0x403856c0
+#endif
+#ifdef IXJCTL_CID
+# undef IXJCTL_CID
+# define IXJCTL_CID 0x800471d4
+#endif
+#ifdef IXJCTL_CIDCW
+# undef IXJCTL_CIDCW
+# define IXJCTL_CIDCW 0x400471d9
+#endif
+#ifdef IXJCTL_DRYBUFFER_READ
+# undef IXJCTL_DRYBUFFER_READ
+# define IXJCTL_DRYBUFFER_READ 0x800471e6
+#endif
+#ifdef IXJCTL_FILTER_CADENCE
+# undef IXJCTL_FILTER_CADENCE
+# define IXJCTL_FILTER_CADENCE 0x400471d6
+#endif
+#ifdef IXJCTL_FRAMES_READ
+# undef IXJCTL_FRAMES_READ
+# define IXJCTL_FRAMES_READ 0x800471e2
+#endif
+#ifdef IXJCTL_FRAMES_WRITTEN
+# undef IXJCTL_FRAMES_WRITTEN
+# define IXJCTL_FRAMES_WRITTEN 0x800471e3
+#endif
+#ifdef IXJCTL_INIT_TONE
+# undef IXJCTL_INIT_TONE
+# define IXJCTL_INIT_TONE 0x400471c9
+#endif
+#ifdef IXJCTL_READ_WAIT
+# undef IXJCTL_READ_WAIT
+# define IXJCTL_READ_WAIT 0x800471e4
+#endif
+#ifdef IXJCTL_SET_FILTER
+# undef IXJCTL_SET_FILTER
+# define IXJCTL_SET_FILTER 0x400471c7
+#endif
+#ifdef IXJCTL_SET_FILTER_RAW
+# undef IXJCTL_SET_FILTER_RAW
+# define IXJCTL_SET_FILTER_RAW 0x400471dd
+#endif
+#ifdef IXJCTL_SIGCTL
+# undef IXJCTL_SIGCTL
+# define IXJCTL_SIGCTL 0x400471e9
+#endif
+#ifdef IXJCTL_TONE_CADENCE
+# undef IXJCTL_TONE_CADENCE
+# define IXJCTL_TONE_CADENCE 0x400471ca
+#endif
+#ifdef IXJCTL_VERSION
+# undef IXJCTL_VERSION
+# define IXJCTL_VERSION 0x800471da
+#endif
+#ifdef IXJCTL_WRITE_WAIT
+# undef IXJCTL_WRITE_WAIT
+# define IXJCTL_WRITE_WAIT 0x800471e5
+#endif
+#ifdef KCOV_INIT_TRACE
+# undef KCOV_INIT_TRACE
+# define KCOV_INIT_TRACE 0x80046301
+#endif
+#ifdef KVM_DIRTY_TLB
+# undef KVM_DIRTY_TLB
+# define KVM_DIRTY_TLB 0x400caeaa
+#endif
+#ifdef KVM_S390_STORE_STATUS
+# undef KVM_S390_STORE_STATUS
+# define KVM_S390_STORE_STATUS 0x4004ae95
+#endif
+#ifdef KVM_S390_VCPU_FAULT
+# undef KVM_S390_VCPU_FAULT
+# define KVM_S390_VCPU_FAULT 0x4004ae52
+#endif
+#ifdef MATROXFB_GET_ALL_OUTPUTS
+# undef MATROXFB_GET_ALL_OUTPUTS
+# define MATROXFB_GET_ALL_OUTPUTS 0x80046efb
+#endif
+#ifdef MATROXFB_GET_AVAILABLE_OUTPUTS
+# undef MATROXFB_GET_AVAILABLE_OUTPUTS
+# define MATROXFB_GET_AVAILABLE_OUTPUTS 0x80046ef9
+#endif
+#ifdef MATROXFB_GET_OUTPUT_CONNECTION
+# undef MATROXFB_GET_OUTPUT_CONNECTION
+# define MATROXFB_GET_OUTPUT_CONNECTION 0x80046ef8
+#endif
+#ifdef MATROXFB_GET_OUTPUT_MODE
+# undef MATROXFB_GET_OUTPUT_MODE
+# define MATROXFB_GET_OUTPUT_MODE 0xc0046efa
+#endif
+#ifdef MATROXFB_SET_OUTPUT_CONNECTION
+# undef MATROXFB_SET_OUTPUT_CONNECTION
+# define MATROXFB_SET_OUTPUT_CONNECTION 0x40046ef8
+#endif
+#ifdef MATROXFB_SET_OUTPUT_MODE
+# undef MATROXFB_SET_OUTPUT_MODE
+# define MATROXFB_SET_OUTPUT_MODE 0x40046efa
+#endif
+#ifdef MEDIA_IOC_ENUM_LINKS
+# undef MEDIA_IOC_ENUM_LINKS
+# define MEDIA_IOC_ENUM_LINKS 0xc01c7c02
+#endif
+#ifdef MEMREADOOB
+# undef MEMREADOOB
+# define MEMREADOOB 0xc00c4d04
+#endif
+#ifdef MEMWRITEOOB
+# undef MEMWRITEOOB
+# define MEMWRITEOOB 0xc00c4d03
+#endif
+#ifdef MGSL_IOCGPARAMS
+# undef MGSL_IOCGPARAMS
+# define MGSL_IOCGPARAMS 0x80206d01
+#endif
+#ifdef MGSL_IOCSPARAMS
+# undef MGSL_IOCSPARAMS
+# define MGSL_IOCSPARAMS 0x40206d00
+#endif
+#ifdef MIC_VIRTIO_ADD_DEVICE
+# undef MIC_VIRTIO_ADD_DEVICE
+# define MIC_VIRTIO_ADD_DEVICE 0xc0047301
+#endif
+#ifdef MIC_VIRTIO_CONFIG_CHANGE
+# undef MIC_VIRTIO_CONFIG_CHANGE
+# define MIC_VIRTIO_CONFIG_CHANGE 0xc0047305
+#endif
+#ifdef MIC_VIRTIO_COPY_DESC
+# undef MIC_VIRTIO_COPY_DESC
+# define MIC_VIRTIO_COPY_DESC 0xc0047302
+#endif
+#ifdef MMTIMER_GETCOUNTER
+# undef MMTIMER_GETCOUNTER
+# define MMTIMER_GETCOUNTER 0x80046d09
+#endif
+#ifdef MMTIMER_GETFREQ
+# undef MMTIMER_GETFREQ
+# define MMTIMER_GETFREQ 0x80046d02
+#endif
+#ifdef MMTIMER_GETRES
+# undef MMTIMER_GETRES
+# define MMTIMER_GETRES 0x80046d01
+#endif
+#ifdef MTIOCGET
+# undef MTIOCGET
+# define MTIOCGET 0x801c6d02
+#endif
+#ifdef MTIOCPOS
+# undef MTIOCPOS
+# define MTIOCPOS 0x80046d03
+#endif
+#ifdef MTRRIOC_ADD_ENTRY
+# undef MTRRIOC_ADD_ENTRY
+# define MTRRIOC_ADD_ENTRY 0x400c4d00
+#endif
+#ifdef MTRRIOC_ADD_PAGE_ENTRY
+# undef MTRRIOC_ADD_PAGE_ENTRY
+# define MTRRIOC_ADD_PAGE_ENTRY 0x400c4d05
+#endif
+#ifdef MTRRIOC_DEL_ENTRY
+# undef MTRRIOC_DEL_ENTRY
+# define MTRRIOC_DEL_ENTRY 0x400c4d02
+#endif
+#ifdef MTRRIOC_DEL_PAGE_ENTRY
+# undef MTRRIOC_DEL_PAGE_ENTRY
+# define MTRRIOC_DEL_PAGE_ENTRY 0x400c4d07
+#endif
+#ifdef MTRRIOC_GET_ENTRY
+# undef MTRRIOC_GET_ENTRY
+# define MTRRIOC_GET_ENTRY 0xc0104d03
+#endif
+#ifdef MTRRIOC_GET_PAGE_ENTRY
+# undef MTRRIOC_GET_PAGE_ENTRY
+# define MTRRIOC_GET_PAGE_ENTRY 0xc0104d08
+#endif
+#ifdef MTRRIOC_KILL_ENTRY
+# undef MTRRIOC_KILL_ENTRY
+# define MTRRIOC_KILL_ENTRY 0x400c4d04
+#endif
+#ifdef MTRRIOC_KILL_PAGE_ENTRY
+# undef MTRRIOC_KILL_PAGE_ENTRY
+# define MTRRIOC_KILL_PAGE_ENTRY 0x400c4d09
+#endif
+#ifdef MTRRIOC_SET_ENTRY
+# undef MTRRIOC_SET_ENTRY
+# define MTRRIOC_SET_ENTRY 0x400c4d01
+#endif
+#ifdef MTRRIOC_SET_PAGE_ENTRY
+# undef MTRRIOC_SET_PAGE_ENTRY
+# define MTRRIOC_SET_PAGE_ENTRY 0x400c4d06
+#endif
+#ifdef NCIUARTSETDRIVER
+# undef NCIUARTSETDRIVER
+# define NCIUARTSETDRIVER 0x40045500
+#endif
+#ifdef NCP_IOC_GET_FS_INFO_V2
+# undef NCP_IOC_GET_FS_INFO_V2
+# define NCP_IOC_GET_FS_INFO_V2 0xc0246e04
+#endif
+#ifdef NCP_IOC_GETMOUNTUID2
+# undef NCP_IOC_GETMOUNTUID2
+# define NCP_IOC_GETMOUNTUID2 0x40046e02
+#endif
+#ifdef NCP_IOC_GETOBJECTNAME
+# undef NCP_IOC_GETOBJECTNAME
+# define NCP_IOC_GETOBJECTNAME 0xc00c6e09
+#endif
+#ifdef NCP_IOC_GETPRIVATEDATA
+# undef NCP_IOC_GETPRIVATEDATA
+# define NCP_IOC_GETPRIVATEDATA 0xc0086e0a
+#endif
+#ifdef NCP_IOC_NCPREQUEST
+# undef NCP_IOC_NCPREQUEST
+# define NCP_IOC_NCPREQUEST 0x800c6e01
+#endif
+#ifdef NCP_IOC_SETOBJECTNAME
+# undef NCP_IOC_SETOBJECTNAME
+# define NCP_IOC_SETOBJECTNAME 0x800c6e09
+#endif
+#ifdef NCP_IOC_SETPRIVATEDATA
+# undef NCP_IOC_SETPRIVATEDATA
+# define NCP_IOC_SETPRIVATEDATA 0x80086e0a
+#endif
+#ifdef NS_GETPSTAT
+# undef NS_GETPSTAT
+# define NS_GETPSTAT 0xc00c6161
+#endif
+#ifdef NS_SETBUFLEV
+# undef NS_SETBUFLEV
+# define NS_SETBUFLEV 0x400c6162
+#endif
+#ifdef NVME_IOCTL_SUBMIT_IO
+# undef NVME_IOCTL_SUBMIT_IO
+# define NVME_IOCTL_SUBMIT_IO 0x402c4e42
+#endif
+#ifdef OMAPFB_MEMORY_READ
+# undef OMAPFB_MEMORY_READ
+# define OMAPFB_MEMORY_READ 0x80104f3a
+#endif
+#ifdef OSD_GET_CAPABILITY
+# undef OSD_GET_CAPABILITY
+# define OSD_GET_CAPABILITY 0x80086fa1
+#endif
+#ifdef OSD_SEND_CMD
+# undef OSD_SEND_CMD
+# define OSD_SEND_CMD 0x401c6fa0
+#endif
+#ifdef PERF_EVENT_IOC_ID
+# undef PERF_EVENT_IOC_ID
+# define PERF_EVENT_IOC_ID 0x80042407
+#endif
+#ifdef PERF_EVENT_IOC_SET_FILTER
+# undef PERF_EVENT_IOC_SET_FILTER
+# define PERF_EVENT_IOC_SET_FILTER 0x40042406
+#endif
+#ifdef PHN_GET_REG
+# undef PHN_GET_REG
+# define PHN_GET_REG 0xc0047000
+#endif
+#ifdef PHN_GET_REGS
+# undef PHN_GET_REGS
+# define PHN_GET_REGS 0xc0047002
+#endif
+#ifdef PHN_SET_REG
+# undef PHN_SET_REG
+# define PHN_SET_REG 0x40047001
+#endif
+#ifdef PHN_SET_REGS
+# undef PHN_SET_REGS
+# define PHN_SET_REGS 0x40047003
+#endif
+#ifdef PHONE_CAPABILITIES_CHECK
+# undef PHONE_CAPABILITIES_CHECK
+# define PHONE_CAPABILITIES_CHECK 0x40047182
+#endif
+#ifdef PHONE_CAPABILITIES_LIST
+# undef PHONE_CAPABILITIES_LIST
+# define PHONE_CAPABILITIES_LIST 0x80047181
+#endif
+#ifdef PHONE_QUERY_CODEC
+# undef PHONE_QUERY_CODEC
+# define PHONE_QUERY_CODEC 0xc00471a7
+#endif
+#ifdef PHONE_RING_START
+# undef PHONE_RING_START
+# define PHONE_RING_START 0x40047187
+#endif
+#ifdef PMU_IOC_CAN_SLEEP
+# undef PMU_IOC_CAN_SLEEP
+# define PMU_IOC_CAN_SLEEP 0x80044205
+#endif
+#ifdef PMU_IOC_GET_BACKLIGHT
+# undef PMU_IOC_GET_BACKLIGHT
+# define PMU_IOC_GET_BACKLIGHT 0x80044201
+#endif
+#ifdef PMU_IOC_GET_MODEL
+# undef PMU_IOC_GET_MODEL
+# define PMU_IOC_GET_MODEL 0x80044203
+#endif
+#ifdef PMU_IOC_GRAB_BACKLIGHT
+# undef PMU_IOC_GRAB_BACKLIGHT
+# define PMU_IOC_GRAB_BACKLIGHT 0x80044206
+#endif
+#ifdef PMU_IOC_HAS_ADB
+# undef PMU_IOC_HAS_ADB
+# define PMU_IOC_HAS_ADB 0x80044204
+#endif
+#ifdef PMU_IOC_SET_BACKLIGHT
+# undef PMU_IOC_SET_BACKLIGHT
+# define PMU_IOC_SET_BACKLIGHT 0x40044202
+#endif
+#ifdef PPGETTIME
+# undef PPGETTIME
+# define PPGETTIME 0x80087095
+#endif
+#ifdef PPPIOCGCOMPRESSORS
+# undef PPPIOCGCOMPRESSORS
+# define PPPIOCGCOMPRESSORS 0x80207486
+#endif
+#ifdef PPPIOCGIDLE
+# undef PPPIOCGIDLE
+# define PPPIOCGIDLE 0x8008743f
+#endif
+#ifdef PPPIOCSACTIVE
+# undef PPPIOCSACTIVE
+# define PPPIOCSACTIVE 0x40087446
+#endif
+#ifdef PPPIOCSCOMPRESS
+# undef PPPIOCSCOMPRESS
+# define PPPIOCSCOMPRESS 0x400c744d
+#endif
+#ifdef PPPIOCSPASS
+# undef PPPIOCSPASS
+# define PPPIOCSPASS 0x40087447
+#endif
+#ifdef PPPOEIOCSFWD
+# undef PPPOEIOCSFWD
+# define PPPOEIOCSFWD 0x4004b100
+#endif
+#ifdef PPSETTIME
+# undef PPSETTIME
+# define PPSETTIME 0x40087096
+#endif
+#ifdef PPS_FETCH
+# undef PPS_FETCH
+# define PPS_FETCH 0xc00470a4
+#endif
+#ifdef PPS_GETCAP
+# undef PPS_GETCAP
+# define PPS_GETCAP 0x800470a3
+#endif
+#ifdef PPS_GETPARAMS
+# undef PPS_GETPARAMS
+# define PPS_GETPARAMS 0x800470a1
+#endif
+#ifdef PPS_KC_BIND
+# undef PPS_KC_BIND
+# define PPS_KC_BIND 0x400470a5
+#endif
+#ifdef PPS_SETPARAMS
+# undef PPS_SETPARAMS
+# define PPS_SETPARAMS 0x400470a2
+#endif
+#ifdef REISERFS_IOC_UNPACK
+# undef REISERFS_IOC_UNPACK
+# define REISERFS_IOC_UNPACK 0x4004cd01
+#endif
+#ifdef RTC_EPOCH_READ
+# undef RTC_EPOCH_READ
+# define RTC_EPOCH_READ 0x8004700d
+#endif
+#ifdef RTC_EPOCH_SET
+# undef RTC_EPOCH_SET
+# define RTC_EPOCH_SET 0x4004700e
+#endif
+#ifdef RTC_IRQP_READ
+# undef RTC_IRQP_READ
+# define RTC_IRQP_READ 0x8004700b
+#endif
+#ifdef RTC_IRQP_SET
+# undef RTC_IRQP_SET
+# define RTC_IRQP_SET 0x4004700c
+#endif
+#ifdef RTC_PLL_GET
+# undef RTC_PLL_GET
+# define RTC_PLL_GET 0x801c7011
+#endif
+#ifdef RTC_PLL_SET
+# undef RTC_PLL_SET
+# define RTC_PLL_SET 0x401c7012
+#endif
+#ifdef SCIF_FENCE_MARK
+# undef SCIF_FENCE_MARK
+# define SCIF_FENCE_MARK 0xc00c730f
+#endif
+#ifdef SCIF_FENCE_SIGNAL
+# undef SCIF_FENCE_SIGNAL
+# define SCIF_FENCE_SIGNAL 0xc0247311
+#endif
+#ifdef SCIF_GET_NODEIDS
+# undef SCIF_GET_NODEIDS
+# define SCIF_GET_NODEIDS 0xc014730e
+#endif
+#ifdef SCIF_READFROM
+# undef SCIF_READFROM
+# define SCIF_READFROM 0xc024730a
+#endif
+#ifdef SCIF_RECV
+# undef SCIF_RECV
+# define SCIF_RECV 0xc0147307
+#endif
+#ifdef SCIF_SEND
+# undef SCIF_SEND
+# define SCIF_SEND 0xc0147306
+#endif
+#ifdef SCIF_VREADFROM
+# undef SCIF_VREADFROM
+# define SCIF_VREADFROM 0xc024730c
+#endif
+#ifdef SCIF_VWRITETO
+# undef SCIF_VWRITETO
+# define SCIF_VWRITETO 0xc024730d
+#endif
+#ifdef SCIF_WRITETO
+# undef SCIF_WRITETO
+# define SCIF_WRITETO 0xc024730b
+#endif
+#ifdef SNDCTL_DSP_MAPINBUF
+# undef SNDCTL_DSP_MAPINBUF
+# define SNDCTL_DSP_MAPINBUF 0x80085013
+#endif
+#ifdef SNDCTL_DSP_MAPOUTBUF
+# undef SNDCTL_DSP_MAPOUTBUF
+# define SNDCTL_DSP_MAPOUTBUF 0x80085014
+#endif
+#ifdef SNDRV_CTL_IOCTL_ELEM_LIST
+# undef SNDRV_CTL_IOCTL_ELEM_LIST
+# define SNDRV_CTL_IOCTL_ELEM_LIST 0xc0485510
+#endif
+#ifdef SNDRV_CTL_IOCTL_ELEM_READ
+# undef SNDRV_CTL_IOCTL_ELEM_READ
+# define SNDRV_CTL_IOCTL_ELEM_READ 0xc2c45512
+#endif
+#ifdef SNDRV_CTL_IOCTL_ELEM_WRITE
+# undef SNDRV_CTL_IOCTL_ELEM_WRITE
+# define SNDRV_CTL_IOCTL_ELEM_WRITE 0xc2c45513
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_CODE_PEEK
+# undef SNDRV_EMU10K1_IOCTL_CODE_PEEK
+# define SNDRV_EMU10K1_IOCTL_CODE_PEEK 0xc18c4812
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_CODE_POKE
+# undef SNDRV_EMU10K1_IOCTL_CODE_POKE
+# define SNDRV_EMU10K1_IOCTL_CODE_POKE 0x418c4811
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_TRAM_PEEK
+# undef SNDRV_EMU10K1_IOCTL_TRAM_PEEK
+# define SNDRV_EMU10K1_IOCTL_TRAM_PEEK 0xc00c4822
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_TRAM_POKE
+# undef SNDRV_EMU10K1_IOCTL_TRAM_POKE
+# define SNDRV_EMU10K1_IOCTL_TRAM_POKE 0x400c4821
+#endif
+#ifdef SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE
+# undef SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE
+# define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE 0x40044842
+#endif
+#ifdef SNDRV_HDSPM_IOCTL_GET_MIXER
+# undef SNDRV_HDSPM_IOCTL_GET_MIXER
+# define SNDRV_HDSPM_IOCTL_GET_MIXER 0x80044844
+#endif
+#ifdef SNDRV_HDSPM_IOCTL_GET_STATUS
+# undef SNDRV_HDSPM_IOCTL_GET_STATUS
+# define SNDRV_HDSPM_IOCTL_GET_STATUS 0x801c4847
+#endif
+#ifdef SNDRV_HWDEP_IOCTL_DSP_LOAD
+# undef SNDRV_HWDEP_IOCTL_DSP_LOAD
+# define SNDRV_HWDEP_IOCTL_DSP_LOAD 0x40504803
+#endif
+#ifdef SNDRV_PCM_IOCTL_CHANNEL_INFO
+# undef SNDRV_PCM_IOCTL_CHANNEL_INFO
+# define SNDRV_PCM_IOCTL_CHANNEL_INFO 0x80104132
+#endif
+#ifdef SNDRV_PCM_IOCTL_DELAY
+# undef SNDRV_PCM_IOCTL_DELAY
+# define SNDRV_PCM_IOCTL_DELAY 0x80044121
+#endif
+#ifdef SNDRV_PCM_IOCTL_FORWARD
+# undef SNDRV_PCM_IOCTL_FORWARD
+# define SNDRV_PCM_IOCTL_FORWARD 0x40044149
+#endif
+#ifdef SNDRV_PCM_IOCTL_HW_PARAMS
+# undef SNDRV_PCM_IOCTL_HW_PARAMS
+# define SNDRV_PCM_IOCTL_HW_PARAMS 0xc25c4111
+#endif
+#ifdef SNDRV_PCM_IOCTL_HW_REFINE
+# undef SNDRV_PCM_IOCTL_HW_REFINE
+# define SNDRV_PCM_IOCTL_HW_REFINE 0xc25c4110
+#endif
+#ifdef SNDRV_PCM_IOCTL_READI_FRAMES
+# undef SNDRV_PCM_IOCTL_READI_FRAMES
+# define SNDRV_PCM_IOCTL_READI_FRAMES 0x800c4151
+#endif
+#ifdef SNDRV_PCM_IOCTL_READN_FRAMES
+# undef SNDRV_PCM_IOCTL_READN_FRAMES
+# define SNDRV_PCM_IOCTL_READN_FRAMES 0x800c4153
+#endif
+#ifdef SNDRV_PCM_IOCTL_REWIND
+# undef SNDRV_PCM_IOCTL_REWIND
+# define SNDRV_PCM_IOCTL_REWIND 0x40044146
+#endif
+#ifdef SNDRV_PCM_IOCTL_STATUS
+# undef SNDRV_PCM_IOCTL_STATUS
+# define SNDRV_PCM_IOCTL_STATUS 0x806c4120
+#endif
+#ifdef SNDRV_PCM_IOCTL_STATUS_EXT
+# undef SNDRV_PCM_IOCTL_STATUS_EXT
+# define SNDRV_PCM_IOCTL_STATUS_EXT 0xc06c4124
+#endif
+#ifdef SNDRV_PCM_IOCTL_SW_PARAMS
+# undef SNDRV_PCM_IOCTL_SW_PARAMS
+# define SNDRV_PCM_IOCTL_SW_PARAMS 0xc0684113
+#endif
+#ifdef SNDRV_PCM_IOCTL_SYNC_PTR
+# undef SNDRV_PCM_IOCTL_SYNC_PTR
+# define SNDRV_PCM_IOCTL_SYNC_PTR 0xc0844123
+#endif
+#ifdef SNDRV_PCM_IOCTL_WRITEI_FRAMES
+# undef SNDRV_PCM_IOCTL_WRITEI_FRAMES
+# define SNDRV_PCM_IOCTL_WRITEI_FRAMES 0x400c4150
+#endif
+#ifdef SNDRV_PCM_IOCTL_WRITEN_FRAMES
+# undef SNDRV_PCM_IOCTL_WRITEN_FRAMES
+# define SNDRV_PCM_IOCTL_WRITEN_FRAMES 0x400c4152
+#endif
+#ifdef SNDRV_RAWMIDI_IOCTL_PARAMS
+# undef SNDRV_RAWMIDI_IOCTL_PARAMS
+# define SNDRV_RAWMIDI_IOCTL_PARAMS 0xc0205710
+#endif
+#ifdef SNDRV_RAWMIDI_IOCTL_STATUS
+# undef SNDRV_RAWMIDI_IOCTL_STATUS
+# define SNDRV_RAWMIDI_IOCTL_STATUS 0xc0245720
+#endif
+#ifdef SNDRV_SEQ_IOCTL_CREATE_PORT
+# undef SNDRV_SEQ_IOCTL_CREATE_PORT
+# define SNDRV_SEQ_IOCTL_CREATE_PORT 0xc0a45320
+#endif
+#ifdef SNDRV_SEQ_IOCTL_DELETE_PORT
+# undef SNDRV_SEQ_IOCTL_DELETE_PORT
+# define SNDRV_SEQ_IOCTL_DELETE_PORT 0x40a45321
+#endif
+#ifdef SNDRV_SEQ_IOCTL_GET_PORT_INFO
+# undef SNDRV_SEQ_IOCTL_GET_PORT_INFO
+# define SNDRV_SEQ_IOCTL_GET_PORT_INFO 0xc0a45322
+#endif
+#ifdef SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT
+# undef SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT
+# define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT 0xc0a45352
+#endif
+#ifdef SNDRV_SEQ_IOCTL_SET_PORT_INFO
+# undef SNDRV_SEQ_IOCTL_SET_PORT_INFO
+# define SNDRV_SEQ_IOCTL_SET_PORT_INFO 0x40a45323
+#endif
+#ifdef SNDRV_TIMER_IOCTL_GINFO
+# undef SNDRV_TIMER_IOCTL_GINFO
+# define SNDRV_TIMER_IOCTL_GINFO 0xc0e05403
+#endif
+#ifdef SNDRV_TIMER_IOCTL_GPARAMS
+# undef SNDRV_TIMER_IOCTL_GPARAMS
+# define SNDRV_TIMER_IOCTL_GPARAMS 0x403c5404
+#endif
+#ifdef SNDRV_TIMER_IOCTL_GSTATUS
+# undef SNDRV_TIMER_IOCTL_GSTATUS
+# define SNDRV_TIMER_IOCTL_GSTATUS 0xc0405405
+#endif
+#ifdef SNDRV_TIMER_IOCTL_INFO
+# undef SNDRV_TIMER_IOCTL_INFO
+# define SNDRV_TIMER_IOCTL_INFO 0x80e05411
+#endif
+#ifdef SNDRV_TIMER_IOCTL_STATUS
+# undef SNDRV_TIMER_IOCTL_STATUS
+# define SNDRV_TIMER_IOCTL_STATUS 0x80585414
+#endif
+#ifdef SPIOCSTYPE
+# undef SPIOCSTYPE
+# define SPIOCSTYPE 0x40047101
+#endif
+#ifdef TUNATTACHFILTER
+# undef TUNATTACHFILTER
+# define TUNATTACHFILTER 0x400854d5
+#endif
+#ifdef TUNDETACHFILTER
+# undef TUNDETACHFILTER
+# define TUNDETACHFILTER 0x400854d6
+#endif
+#ifdef TUNER_SET_CONFIG
+# undef TUNER_SET_CONFIG
+# define TUNER_SET_CONFIG 0x4008645c
+#endif
+#ifdef TUNGETFILTER
+# undef TUNGETFILTER
+# define TUNGETFILTER 0x800854db
+#endif
+#ifdef UDF_GETEABLOCK
+# undef UDF_GETEABLOCK
+# define UDF_GETEABLOCK 0x80046c41
+#endif
+#ifdef UDF_GETVOLIDENT
+# undef UDF_GETVOLIDENT
+# define UDF_GETVOLIDENT 0x80046c42
+#endif
+#ifdef UDF_RELOCATE_BLOCKS
+# undef UDF_RELOCATE_BLOCKS
+# define UDF_RELOCATE_BLOCKS 0xc0046c43
+#endif
+#ifdef UI_BEGIN_FF_UPLOAD
+# undef UI_BEGIN_FF_UPLOAD
+# define UI_BEGIN_FF_UPLOAD 0xc06055c8
+#endif
+#ifdef UI_END_FF_UPLOAD
+# undef UI_END_FF_UPLOAD
+# define UI_END_FF_UPLOAD 0x406055c9
+#endif
+#ifdef UI_SET_PHYS
+# undef UI_SET_PHYS
+# define UI_SET_PHYS 0x4004556c
+#endif
+#ifdef USBDEVFS_BULK
+# undef USBDEVFS_BULK
+# define USBDEVFS_BULK 0xc0105502
+#endif
+#ifdef USBDEVFS_CONTROL
+# undef USBDEVFS_CONTROL
+# define USBDEVFS_CONTROL 0xc0105500
+#endif
+#ifdef USBDEVFS_DISCSIGNAL
+# undef USBDEVFS_DISCSIGNAL
+# define USBDEVFS_DISCSIGNAL 0x8008550e
+#endif
+#ifdef USBDEVFS_IOCTL
+# undef USBDEVFS_IOCTL
+# define USBDEVFS_IOCTL 0xc00c5512
+#endif
+#ifdef USBDEVFS_REAPURB
+# undef USBDEVFS_REAPURB
+# define USBDEVFS_REAPURB 0x4004550c
+#endif
+#ifdef USBDEVFS_REAPURBNDELAY
+# undef USBDEVFS_REAPURBNDELAY
+# define USBDEVFS_REAPURBNDELAY 0x4004550d
+#endif
+#ifdef USBDEVFS_SUBMITURB
+# undef USBDEVFS_SUBMITURB
+# define USBDEVFS_SUBMITURB 0x802c550a
+#endif
+#ifdef UVCIOC_CTRL_MAP
+# undef UVCIOC_CTRL_MAP
+# define UVCIOC_CTRL_MAP 0xc0587520
+#endif
+#ifdef UVCIOC_CTRL_QUERY
+# undef UVCIOC_CTRL_QUERY
+# define UVCIOC_CTRL_QUERY 0xc00c7521
+#endif
+#ifdef V4L2_DEVICE_NOTIFY_EVENT
+# undef V4L2_DEVICE_NOTIFY_EVENT
+# define V4L2_DEVICE_NOTIFY_EVENT 0x40787602
+#endif
+#ifdef VFAT_IOCTL_READDIR_BOTH
+# undef VFAT_IOCTL_READDIR_BOTH
+# define VFAT_IOCTL_READDIR_BOTH 0x82187201
+#endif
+#ifdef VFAT_IOCTL_READDIR_SHORT
+# undef VFAT_IOCTL_READDIR_SHORT
+# define VFAT_IOCTL_READDIR_SHORT 0x82187202
+#endif
+#ifdef VIDEO_GET_EVENT
+# undef VIDEO_GET_EVENT
+# define VIDEO_GET_EVENT 0x80146f1c
+#endif
+#ifdef VIDEO_SET_SPU_PALETTE
+# undef VIDEO_SET_SPU_PALETTE
+# define VIDEO_SET_SPU_PALETTE 0x40086f33
+#endif
+#ifdef VIDEO_STILLPICTURE
+# undef VIDEO_STILLPICTURE
+# define VIDEO_STILLPICTURE 0x40086f1e
+#endif
+#ifdef VIDIOC_AM437X_CCDC_CFG
+# undef VIDIOC_AM437X_CCDC_CFG
+# define VIDIOC_AM437X_CCDC_CFG 0x400456c1
+#endif
+#ifdef VIDIOC_CREATE_BUFS
+# undef VIDIOC_CREATE_BUFS
+# define VIDIOC_CREATE_BUFS 0xc0f8565c
+#endif
+#ifdef VIDIOC_DQBUF
+# undef VIDIOC_DQBUF
+# define VIDIOC_DQBUF 0xc0445611
+#endif
+#ifdef VIDIOC_DQEVENT
+# undef VIDIOC_DQEVENT
+# define VIDIOC_DQEVENT 0x80785659
+#endif
+#ifdef VIDIOC_ENUMINPUT
+# undef VIDIOC_ENUMINPUT
+# define VIDIOC_ENUMINPUT 0xc04c561a
+#endif
+#ifdef VIDIOC_ENUMSTD
+# undef VIDIOC_ENUMSTD
+# define VIDIOC_ENUMSTD 0xc0405619
+#endif
+#ifdef VIDIOC_G_EDID
+# undef VIDIOC_G_EDID
+# define VIDIOC_G_EDID 0xc0245628
+#endif
+#ifdef VIDIOC_G_EXT_CTRLS
+# undef VIDIOC_G_EXT_CTRLS
+# define VIDIOC_G_EXT_CTRLS 0xc0185647
+#endif
+#ifdef VIDIOC_G_FBUF
+# undef VIDIOC_G_FBUF
+# define VIDIOC_G_FBUF 0x802c560a
+#endif
+#ifdef VIDIOC_G_FMT
+# undef VIDIOC_G_FMT
+# define VIDIOC_G_FMT 0xc0cc5604
+#endif
+#ifdef VIDIOC_OMAP3ISP_CCDC_CFG
+# undef VIDIOC_OMAP3ISP_CCDC_CFG
+# define VIDIOC_OMAP3ISP_CCDC_CFG 0xc02056c1
+#endif
+#ifdef VIDIOC_OMAP3ISP_PRV_CFG
+# undef VIDIOC_OMAP3ISP_PRV_CFG
+# define VIDIOC_OMAP3ISP_PRV_CFG 0xc03c56c2
+#endif
+#ifdef VIDIOC_OMAP3ISP_STAT_EN
+# undef VIDIOC_OMAP3ISP_STAT_EN
+# define VIDIOC_OMAP3ISP_STAT_EN 0xc00456c7
+#endif
+#ifdef VIDIOC_OMAP3ISP_STAT_REQ
+# undef VIDIOC_OMAP3ISP_STAT_REQ
+# define VIDIOC_OMAP3ISP_STAT_REQ 0xc01856c6
+#endif
+#ifdef VIDIOC_PREPARE_BUF
+# undef VIDIOC_PREPARE_BUF
+# define VIDIOC_PREPARE_BUF 0xc044565d
+#endif
+#ifdef VIDIOC_QBUF
+# undef VIDIOC_QBUF
+# define VIDIOC_QBUF 0xc044560f
+#endif
+#ifdef VIDIOC_QUERYBUF
+# undef VIDIOC_QUERYBUF
+# define VIDIOC_QUERYBUF 0xc0445609
+#endif
+#ifdef VIDIOC_S_EDID
+# undef VIDIOC_S_EDID
+# define VIDIOC_S_EDID 0xc0245629
+#endif
+#ifdef VIDIOC_S_EXT_CTRLS
+# undef VIDIOC_S_EXT_CTRLS
+# define VIDIOC_S_EXT_CTRLS 0xc0185648
+#endif
+#ifdef VIDIOC_S_FBUF
+# undef VIDIOC_S_FBUF
+# define VIDIOC_S_FBUF 0x402c560b
+#endif
+#ifdef VIDIOC_S_FMT
+# undef VIDIOC_S_FMT
+# define VIDIOC_S_FMT 0xc0cc5605
+#endif
+#ifdef VIDIOC_SUBDEV_G_EDID
+# undef VIDIOC_SUBDEV_G_EDID
+# define VIDIOC_SUBDEV_G_EDID 0xc0245628
+#endif
+#ifdef VIDIOC_SUBDEV_S_EDID
+# undef VIDIOC_SUBDEV_S_EDID
+# define VIDIOC_SUBDEV_S_EDID 0xc0245629
+#endif
+#ifdef VIDIOC_TRY_EXT_CTRLS
+# undef VIDIOC_TRY_EXT_CTRLS
+# define VIDIOC_TRY_EXT_CTRLS 0xc0185649
+#endif
+#ifdef VIDIOC_TRY_FMT
+# undef VIDIOC_TRY_FMT
+# define VIDIOC_TRY_FMT 0xc0cc5640
+#endif
+#ifdef VPFE_CMD_S_CCDC_RAW_PARAMS
+# undef VPFE_CMD_S_CCDC_RAW_PARAMS
+# define VPFE_CMD_S_CCDC_RAW_PARAMS 0x400456c1
+#endif
+#ifdef ZATM_GETPOOL
+# undef ZATM_GETPOOL
+# define ZATM_GETPOOL 0x400c6161
+#endif
+#ifdef ZATM_GETPOOLZ
+# undef ZATM_GETPOOLZ
+# define ZATM_GETPOOLZ 0x400c6162
+#endif
+#ifdef ZATM_SETPOOL
+# undef ZATM_SETPOOL
+# define ZATM_SETPOOL 0x400c6163
+#endif
diff --git a/ioctl_redefs2.h b/ioctl_redefs2.h
new file mode 100644
index 0000000..8e5503e
--- /dev/null
+++ b/ioctl_redefs2.h
@@ -0,0 +1,1308 @@
+#ifdef AGPIOC_ALLOCATE
+# undef AGPIOC_ALLOCATE
+# define AGPIOC_ALLOCATE 0xc0044106
+#endif
+#ifdef AGPIOC_BIND
+# undef AGPIOC_BIND
+# define AGPIOC_BIND 0x40044108
+#endif
+#ifdef AGPIOC_INFO
+# undef AGPIOC_INFO
+# define AGPIOC_INFO 0x80044100
+#endif
+#ifdef AGPIOC_PROTECT
+# undef AGPIOC_PROTECT
+# define AGPIOC_PROTECT 0x40044105
+#endif
+#ifdef AGPIOC_RESERVE
+# undef AGPIOC_RESERVE
+# define AGPIOC_RESERVE 0x40044104
+#endif
+#ifdef AGPIOC_SETUP
+# undef AGPIOC_SETUP
+# define AGPIOC_SETUP 0x40044103
+#endif
+#ifdef AGPIOC_UNBIND
+# undef AGPIOC_UNBIND
+# define AGPIOC_UNBIND 0x40044109
+#endif
+#ifdef ASHMEM_SET_PROT_MASK
+# undef ASHMEM_SET_PROT_MASK
+# define ASHMEM_SET_PROT_MASK 0x40047705
+#endif
+#ifdef ASHMEM_SET_SIZE
+# undef ASHMEM_SET_SIZE
+# define ASHMEM_SET_SIZE 0x40047703
+#endif
+#ifdef ATM_ADDADDR
+# undef ATM_ADDADDR
+# define ATM_ADDADDR 0x400c6188
+#endif
+#ifdef ATM_ADDLECSADDR
+# undef ATM_ADDLECSADDR
+# define ATM_ADDLECSADDR 0x400c618e
+#endif
+#ifdef ATM_ADDPARTY
+# undef ATM_ADDPARTY
+# define ATM_ADDPARTY 0x400861f4
+#endif
+#ifdef ATM_DELADDR
+# undef ATM_DELADDR
+# define ATM_DELADDR 0x400c6189
+#endif
+#ifdef ATM_DELLECSADDR
+# undef ATM_DELLECSADDR
+# define ATM_DELLECSADDR 0x400c618f
+#endif
+#ifdef ATM_GETADDR
+# undef ATM_GETADDR
+# define ATM_GETADDR 0x400c6186
+#endif
+#ifdef ATM_GETCIRANGE
+# undef ATM_GETCIRANGE
+# define ATM_GETCIRANGE 0x400c618a
+#endif
+#ifdef ATM_GETESI
+# undef ATM_GETESI
+# define ATM_GETESI 0x400c6185
+#endif
+#ifdef ATM_GETLECSADDR
+# undef ATM_GETLECSADDR
+# define ATM_GETLECSADDR 0x400c6190
+#endif
+#ifdef ATM_GETLINKRATE
+# undef ATM_GETLINKRATE
+# define ATM_GETLINKRATE 0x400c6181
+#endif
+#ifdef ATM_GETLOOP
+# undef ATM_GETLOOP
+# define ATM_GETLOOP 0x400c6152
+#endif
+#ifdef ATM_GETNAMES
+# undef ATM_GETNAMES
+# define ATM_GETNAMES 0x40086183
+#endif
+#ifdef ATM_GETSTAT
+# undef ATM_GETSTAT
+# define ATM_GETSTAT 0x400c6150
+#endif
+#ifdef ATM_GETSTATZ
+# undef ATM_GETSTATZ
+# define ATM_GETSTATZ 0x400c6151
+#endif
+#ifdef ATM_GETTYPE
+# undef ATM_GETTYPE
+# define ATM_GETTYPE 0x400c6184
+#endif
+#ifdef ATM_QUERYLOOP
+# undef ATM_QUERYLOOP
+# define ATM_QUERYLOOP 0x400c6154
+#endif
+#ifdef ATM_RSTADDR
+# undef ATM_RSTADDR
+# define ATM_RSTADDR 0x400c6187
+#endif
+#ifdef ATM_SETCIRANGE
+# undef ATM_SETCIRANGE
+# define ATM_SETCIRANGE 0x400c618b
+#endif
+#ifdef ATM_SETESI
+# undef ATM_SETESI
+# define ATM_SETESI 0x400c618c
+#endif
+#ifdef ATM_SETESIF
+# undef ATM_SETESIF
+# define ATM_SETESIF 0x400c618d
+#endif
+#ifdef ATM_SETLOOP
+# undef ATM_SETLOOP
+# define ATM_SETLOOP 0x400c6153
+#endif
+#ifdef AUTOFS_IOC_SETTIMEOUT
+# undef AUTOFS_IOC_SETTIMEOUT
+# define AUTOFS_IOC_SETTIMEOUT 0xc0049364
+#endif
+#ifdef BLKBSZGET
+# undef BLKBSZGET
+# define BLKBSZGET 0x80041270
+#endif
+#ifdef BLKBSZSET
+# undef BLKBSZSET
+# define BLKBSZSET 0x40041271
+#endif
+#ifdef BLKGETSIZE64
+# undef BLKGETSIZE64
+# define BLKGETSIZE64 0x80041272
+#endif
+#ifdef CAPI_MANUFACTURER_CMD
+# undef CAPI_MANUFACTURER_CMD
+# define CAPI_MANUFACTURER_CMD 0xc0084320
+#endif
+#ifdef CCISS_BIG_PASSTHRU
+# undef CCISS_BIG_PASSTHRU
+# define CCISS_BIG_PASSTHRU 0xc0584212
+#endif
+#ifdef CCISS_PASSTHRU
+# undef CCISS_PASSTHRU
+# define CCISS_PASSTHRU 0xc054420b
+#endif
+#ifdef CHIOGSTATUS
+# undef CHIOGSTATUS
+# define CHIOGSTATUS 0x40086308
+#endif
+#ifdef CIOC_KERNEL_VERSION
+# undef CIOC_KERNEL_VERSION
+# define CIOC_KERNEL_VERSION 0xc004630a
+#endif
+#ifdef CM_IOCGATR
+# undef CM_IOCGATR
+# define CM_IOCGATR 0xc0046301
+#endif
+#ifdef CM_IOCGSTATUS
+# undef CM_IOCGSTATUS
+# define CM_IOCGSTATUS 0x80046300
+#endif
+#ifdef CM_IOCSPTS
+# undef CM_IOCSPTS
+# define CM_IOCSPTS 0x40046302
+#endif
+#ifdef CM_IOSDBGLVL
+# undef CM_IOSDBGLVL
+# define CM_IOSDBGLVL 0x400463fa
+#endif
+#ifdef DRM_IOCTL_ADD_BUFS
+# undef DRM_IOCTL_ADD_BUFS
+# define DRM_IOCTL_ADD_BUFS 0xc0186416
+#endif
+#ifdef DRM_IOCTL_ADD_MAP
+# undef DRM_IOCTL_ADD_MAP
+# define DRM_IOCTL_ADD_MAP 0xc0186415
+#endif
+#ifdef DRM_IOCTL_AGP_ALLOC
+# undef DRM_IOCTL_AGP_ALLOC
+# define DRM_IOCTL_AGP_ALLOC 0xc0106434
+#endif
+#ifdef DRM_IOCTL_AGP_BIND
+# undef DRM_IOCTL_AGP_BIND
+# define DRM_IOCTL_AGP_BIND 0x40086436
+#endif
+#ifdef DRM_IOCTL_AGP_ENABLE
+# undef DRM_IOCTL_AGP_ENABLE
+# define DRM_IOCTL_AGP_ENABLE 0x40046432
+#endif
+#ifdef DRM_IOCTL_AGP_FREE
+# undef DRM_IOCTL_AGP_FREE
+# define DRM_IOCTL_AGP_FREE 0x40106435
+#endif
+#ifdef DRM_IOCTL_AGP_INFO
+# undef DRM_IOCTL_AGP_INFO
+# define DRM_IOCTL_AGP_INFO 0x80206433
+#endif
+#ifdef DRM_IOCTL_AGP_UNBIND
+# undef DRM_IOCTL_AGP_UNBIND
+# define DRM_IOCTL_AGP_UNBIND 0x40086437
+#endif
+#ifdef DRM_IOCTL_DMA
+# undef DRM_IOCTL_DMA
+# define DRM_IOCTL_DMA 0xc0286429
+#endif
+#ifdef DRM_IOCTL_FREE_BUFS
+# undef DRM_IOCTL_FREE_BUFS
+# define DRM_IOCTL_FREE_BUFS 0x4008641a
+#endif
+#ifdef DRM_IOCTL_GET_CLIENT
+# undef DRM_IOCTL_GET_CLIENT
+# define DRM_IOCTL_GET_CLIENT 0xc0186405
+#endif
+#ifdef DRM_IOCTL_GET_MAP
+# undef DRM_IOCTL_GET_MAP
+# define DRM_IOCTL_GET_MAP 0xc0186404
+#endif
+#ifdef DRM_IOCTL_GET_SAREA_CTX
+# undef DRM_IOCTL_GET_SAREA_CTX
+# define DRM_IOCTL_GET_SAREA_CTX 0xc008641d
+#endif
+#ifdef DRM_IOCTL_GET_STATS
+# undef DRM_IOCTL_GET_STATS
+# define DRM_IOCTL_GET_STATS 0x807c6406
+#endif
+#ifdef DRM_IOCTL_GET_UNIQUE
+# undef DRM_IOCTL_GET_UNIQUE
+# define DRM_IOCTL_GET_UNIQUE 0xc0086401
+#endif
+#ifdef DRM_IOCTL_I810_COPY
+# undef DRM_IOCTL_I810_COPY
+# define DRM_IOCTL_I810_COPY 0x400c6447
+#endif
+#ifdef DRM_IOCTL_I810_GETBUF
+# undef DRM_IOCTL_I810_GETBUF
+# define DRM_IOCTL_I810_GETBUF 0xc0106445
+#endif
+#ifdef DRM_IOCTL_I810_MC
+# undef DRM_IOCTL_I810_MC
+# define DRM_IOCTL_I810_MC 0x4014644c
+#endif
+#ifdef DRM_IOCTL_I915_ALLOC
+# undef DRM_IOCTL_I915_ALLOC
+# define DRM_IOCTL_I915_ALLOC 0xc0106448
+#endif
+#ifdef DRM_IOCTL_I915_BATCHBUFFER
+# undef DRM_IOCTL_I915_BATCHBUFFER
+# define DRM_IOCTL_I915_BATCHBUFFER 0x40186443
+#endif
+#ifdef DRM_IOCTL_I915_CMDBUFFER
+# undef DRM_IOCTL_I915_CMDBUFFER
+# define DRM_IOCTL_I915_CMDBUFFER 0x4018644b
+#endif
+#ifdef DRM_IOCTL_I915_GETPARAM
+# undef DRM_IOCTL_I915_GETPARAM
+# define DRM_IOCTL_I915_GETPARAM 0xc0086446
+#endif
+#ifdef DRM_IOCTL_I915_IRQ_EMIT
+# undef DRM_IOCTL_I915_IRQ_EMIT
+# define DRM_IOCTL_I915_IRQ_EMIT 0xc0046444
+#endif
+#ifdef DRM_IOCTL_INFO_BUFS
+# undef DRM_IOCTL_INFO_BUFS
+# define DRM_IOCTL_INFO_BUFS 0xc0086418
+#endif
+#ifdef DRM_IOCTL_MAP_BUFS
+# undef DRM_IOCTL_MAP_BUFS
+# define DRM_IOCTL_MAP_BUFS 0xc00c6419
+#endif
+#ifdef DRM_IOCTL_MARK_BUFS
+# undef DRM_IOCTL_MARK_BUFS
+# define DRM_IOCTL_MARK_BUFS 0x40186417
+#endif
+#ifdef DRM_IOCTL_MGA_DMA_BOOTSTRAP
+# undef DRM_IOCTL_MGA_DMA_BOOTSTRAP
+# define DRM_IOCTL_MGA_DMA_BOOTSTRAP 0xc01c644c
+#endif
+#ifdef DRM_IOCTL_MGA_GETPARAM
+# undef DRM_IOCTL_MGA_GETPARAM
+# define DRM_IOCTL_MGA_GETPARAM 0xc0086449
+#endif
+#ifdef DRM_IOCTL_MGA_INIT
+# undef DRM_IOCTL_MGA_INIT
+# define DRM_IOCTL_MGA_INIT 0x405c6440
+#endif
+#ifdef DRM_IOCTL_R128_DEPTH
+# undef DRM_IOCTL_R128_DEPTH
+# define DRM_IOCTL_R128_DEPTH 0x4018644c
+#endif
+#ifdef DRM_IOCTL_R128_GETPARAM
+# undef DRM_IOCTL_R128_GETPARAM
+# define DRM_IOCTL_R128_GETPARAM 0xc0086452
+#endif
+#ifdef DRM_IOCTL_R128_INIT
+# undef DRM_IOCTL_R128_INIT
+# define DRM_IOCTL_R128_INIT 0x40586440
+#endif
+#ifdef DRM_IOCTL_R128_STIPPLE
+# undef DRM_IOCTL_R128_STIPPLE
+# define DRM_IOCTL_R128_STIPPLE 0x4004644d
+#endif
+#ifdef DRM_IOCTL_RADEON_ALLOC
+# undef DRM_IOCTL_RADEON_ALLOC
+# define DRM_IOCTL_RADEON_ALLOC 0xc0106453
+#endif
+#ifdef DRM_IOCTL_RADEON_CLEAR
+# undef DRM_IOCTL_RADEON_CLEAR
+# define DRM_IOCTL_RADEON_CLEAR 0x40186448
+#endif
+#ifdef DRM_IOCTL_RADEON_CMDBUF
+# undef DRM_IOCTL_RADEON_CMDBUF
+# define DRM_IOCTL_RADEON_CMDBUF 0x40106450
+#endif
+#ifdef DRM_IOCTL_RADEON_CP_INIT
+# undef DRM_IOCTL_RADEON_CP_INIT
+# define DRM_IOCTL_RADEON_CP_INIT 0x40546440
+#endif
+#ifdef DRM_IOCTL_RADEON_GETPARAM
+# undef DRM_IOCTL_RADEON_GETPARAM
+# define DRM_IOCTL_RADEON_GETPARAM 0xc0086451
+#endif
+#ifdef DRM_IOCTL_RADEON_IRQ_EMIT
+# undef DRM_IOCTL_RADEON_IRQ_EMIT
+# define DRM_IOCTL_RADEON_IRQ_EMIT 0xc0046456
+#endif
+#ifdef DRM_IOCTL_RADEON_STIPPLE
+# undef DRM_IOCTL_RADEON_STIPPLE
+# define DRM_IOCTL_RADEON_STIPPLE 0x4004644c
+#endif
+#ifdef DRM_IOCTL_RADEON_TEXTURE
+# undef DRM_IOCTL_RADEON_TEXTURE
+# define DRM_IOCTL_RADEON_TEXTURE 0xc018644e
+#endif
+#ifdef DRM_IOCTL_RADEON_VERTEX2
+# undef DRM_IOCTL_RADEON_VERTEX2
+# define DRM_IOCTL_RADEON_VERTEX2 0x4018644f
+#endif
+#ifdef DRM_IOCTL_RES_CTX
+# undef DRM_IOCTL_RES_CTX
+# define DRM_IOCTL_RES_CTX 0xc0086426
+#endif
+#ifdef DRM_IOCTL_RM_MAP
+# undef DRM_IOCTL_RM_MAP
+# define DRM_IOCTL_RM_MAP 0x4018641b
+#endif
+#ifdef DRM_IOCTL_SAVAGE_BCI_CMDBUF
+# undef DRM_IOCTL_SAVAGE_BCI_CMDBUF
+# define DRM_IOCTL_SAVAGE_BCI_CMDBUF 0x40246441
+#endif
+#ifdef DRM_IOCTL_SAVAGE_BCI_INIT
+# undef DRM_IOCTL_SAVAGE_BCI_INIT
+# define DRM_IOCTL_SAVAGE_BCI_INIT 0x40506440
+#endif
+#ifdef DRM_IOCTL_SET_SAREA_CTX
+# undef DRM_IOCTL_SET_SAREA_CTX
+# define DRM_IOCTL_SET_SAREA_CTX 0x4008641c
+#endif
+#ifdef DRM_IOCTL_SET_UNIQUE
+# undef DRM_IOCTL_SET_UNIQUE
+# define DRM_IOCTL_SET_UNIQUE 0x40086410
+#endif
+#ifdef DRM_IOCTL_SG_ALLOC
+# undef DRM_IOCTL_SG_ALLOC
+# define DRM_IOCTL_SG_ALLOC 0xc0086438
+#endif
+#ifdef DRM_IOCTL_SG_FREE
+# undef DRM_IOCTL_SG_FREE
+# define DRM_IOCTL_SG_FREE 0x40086439
+#endif
+#ifdef DRM_IOCTL_SIS_AGP_ALLOC
+# undef DRM_IOCTL_SIS_AGP_ALLOC
+# define DRM_IOCTL_SIS_AGP_ALLOC 0xc0106454
+#endif
+#ifdef DRM_IOCTL_SIS_AGP_FREE
+# undef DRM_IOCTL_SIS_AGP_FREE
+# define DRM_IOCTL_SIS_AGP_FREE 0x40106455
+#endif
+#ifdef DRM_IOCTL_SIS_AGP_INIT
+# undef DRM_IOCTL_SIS_AGP_INIT
+# define DRM_IOCTL_SIS_AGP_INIT 0xc0086453
+#endif
+#ifdef DRM_IOCTL_SIS_FB_ALLOC
+# undef DRM_IOCTL_SIS_FB_ALLOC
+# define DRM_IOCTL_SIS_FB_ALLOC 0xc0106444
+#endif
+#ifdef DRM_IOCTL_SIS_FB_FREE
+# undef DRM_IOCTL_SIS_FB_FREE
+# define DRM_IOCTL_SIS_FB_FREE 0x40106445
+#endif
+#ifdef DRM_IOCTL_SIS_FB_INIT
+# undef DRM_IOCTL_SIS_FB_INIT
+# define DRM_IOCTL_SIS_FB_INIT 0x40086456
+#endif
+#ifdef DRM_IOCTL_VERSION
+# undef DRM_IOCTL_VERSION
+# define DRM_IOCTL_VERSION 0xc0246400
+#endif
+#ifdef DRM_IOCTL_VIA_ALLOCMEM
+# undef DRM_IOCTL_VIA_ALLOCMEM
+# define DRM_IOCTL_VIA_ALLOCMEM 0xc0146440
+#endif
+#ifdef DRM_IOCTL_VIA_CMDBUFFER
+# undef DRM_IOCTL_VIA_CMDBUFFER
+# define DRM_IOCTL_VIA_CMDBUFFER 0x40086448
+#endif
+#ifdef DRM_IOCTL_VIA_DMA_BLIT
+# undef DRM_IOCTL_VIA_DMA_BLIT
+# define DRM_IOCTL_VIA_DMA_BLIT 0x4028644e
+#endif
+#ifdef DRM_IOCTL_VIA_DMA_INIT
+# undef DRM_IOCTL_VIA_DMA_INIT
+# define DRM_IOCTL_VIA_DMA_INIT 0xc0106447
+#endif
+#ifdef DRM_IOCTL_VIA_FREEMEM
+# undef DRM_IOCTL_VIA_FREEMEM
+# define DRM_IOCTL_VIA_FREEMEM 0x40146441
+#endif
+#ifdef DRM_IOCTL_VIA_MAP_INIT
+# undef DRM_IOCTL_VIA_MAP_INIT
+# define DRM_IOCTL_VIA_MAP_INIT 0xc0146444
+#endif
+#ifdef DRM_IOCTL_VIA_PCICMD
+# undef DRM_IOCTL_VIA_PCICMD
+# define DRM_IOCTL_VIA_PCICMD 0x4008644a
+#endif
+#ifdef DRM_IOCTL_VIA_WAIT_IRQ
+# undef DRM_IOCTL_VIA_WAIT_IRQ
+# define DRM_IOCTL_VIA_WAIT_IRQ 0xc010644d
+#endif
+#ifdef DRM_IOCTL_WAIT_VBLANK
+# undef DRM_IOCTL_WAIT_VBLANK
+# define DRM_IOCTL_WAIT_VBLANK 0xc010643a
+#endif
+#ifdef ENI_MEMDUMP
+# undef ENI_MEMDUMP
+# define ENI_MEMDUMP 0x400c6160
+#endif
+#ifdef ENI_SETMULT
+# undef ENI_SETMULT
+# define ENI_SETMULT 0x400c6167
+#endif
+#ifdef EVIOCSFF
+# undef EVIOCSFF
+# define EVIOCSFF 0x402c4580
+#endif
+#ifdef FBIO_CURSOR
+# undef FBIO_CURSOR
+# define FBIO_CURSOR 0xc0484608
+#endif
+#ifdef FBIO_GETCONTROL2
+# undef FBIO_GETCONTROL2
+# define FBIO_GETCONTROL2 0x80044689
+#endif
+#ifdef FBIO_RADEON_GET_MIRROR
+# undef FBIO_RADEON_GET_MIRROR
+# define FBIO_RADEON_GET_MIRROR 0x80044003
+#endif
+#ifdef FBIO_RADEON_SET_MIRROR
+# undef FBIO_RADEON_SET_MIRROR
+# define FBIO_RADEON_SET_MIRROR 0x40044004
+#endif
+#ifdef FDDEFPRM
+# undef FDDEFPRM
+# define FDDEFPRM 0x401c0243
+#endif
+#ifdef FDGETDRVPRM
+# undef FDGETDRVPRM
+# define FDGETDRVPRM 0x80580211
+#endif
+#ifdef FDGETDRVSTAT
+# undef FDGETDRVSTAT
+# define FDGETDRVSTAT 0x80340212
+#endif
+#ifdef FDGETFDCSTAT
+# undef FDGETFDCSTAT
+# define FDGETFDCSTAT 0x80200215
+#endif
+#ifdef FDGETPRM
+# undef FDGETPRM
+# define FDGETPRM 0x801c0204
+#endif
+#ifdef FDPOLLDRVSTAT
+# undef FDPOLLDRVSTAT
+# define FDPOLLDRVSTAT 0x80340213
+#endif
+#ifdef FDSETDRVPRM
+# undef FDSETDRVPRM
+# define FDSETDRVPRM 0x40580290
+#endif
+#ifdef FDSETPRM
+# undef FDSETPRM
+# define FDSETPRM 0x401c0242
+#endif
+#ifdef FDWERRORGET
+# undef FDWERRORGET
+# define FDWERRORGET 0x80180217
+#endif
+#ifdef FE_GET_PROPERTY
+# undef FE_GET_PROPERTY
+# define FE_GET_PROPERTY 0x80086f53
+#endif
+#ifdef FE_SET_PROPERTY
+# undef FE_SET_PROPERTY
+# define FE_SET_PROPERTY 0x40086f52
+#endif
+#ifdef FS_IOC_GETFLAGS
+# undef FS_IOC_GETFLAGS
+# define FS_IOC_GETFLAGS 0x80046601
+#endif
+#ifdef FS_IOC_GETVERSION
+# undef FS_IOC_GETVERSION
+# define FS_IOC_GETVERSION 0x80047601
+#endif
+#ifdef FS_IOC_SETFLAGS
+# undef FS_IOC_SETFLAGS
+# define FS_IOC_SETFLAGS 0x40046602
+#endif
+#ifdef FS_IOC_SETVERSION
+# undef FS_IOC_SETVERSION
+# define FS_IOC_SETVERSION 0x40047602
+#endif
+#ifdef HE_GET_REG
+# undef HE_GET_REG
+# define HE_GET_REG 0x400c6160
+#endif
+#ifdef HPET_INFO
+# undef HPET_INFO
+# define HPET_INFO 0x800c6803
+#endif
+#ifdef HPET_IRQFREQ
+# undef HPET_IRQFREQ
+# define HPET_IRQFREQ 0x40046806
+#endif
+#ifdef I2OHRTGET
+# undef I2OHRTGET
+# define I2OHRTGET 0xc00c6901
+#endif
+#ifdef I2OHTML
+# undef I2OHTML
+# define I2OHTML 0xc01c6909
+#endif
+#ifdef I2OLCTGET
+# undef I2OLCTGET
+# define I2OLCTGET 0xc00c6902
+#endif
+#ifdef I2OPARMGET
+# undef I2OPARMGET
+# define I2OPARMGET 0xc0186904
+#endif
+#ifdef I2OPARMSET
+# undef I2OPARMSET
+# define I2OPARMSET 0xc0186903
+#endif
+#ifdef I2OPASSTHRU
+# undef I2OPASSTHRU
+# define I2OPASSTHRU 0x8008690c
+#endif
+#ifdef I2OSWDEL
+# undef I2OSWDEL
+# define I2OSWDEL 0xc01c6907
+#endif
+#ifdef I2OSWDL
+# undef I2OSWDL
+# define I2OSWDL 0xc01c6905
+#endif
+#ifdef I2OSWUL
+# undef I2OSWUL
+# define I2OSWUL 0xc01c6906
+#endif
+#ifdef I8K_FN_STATUS
+# undef I8K_FN_STATUS
+# define I8K_FN_STATUS 0x80046983
+#endif
+#ifdef I8K_GET_FAN
+# undef I8K_GET_FAN
+# define I8K_GET_FAN 0xc0046986
+#endif
+#ifdef I8K_GET_SPEED
+# undef I8K_GET_SPEED
+# define I8K_GET_SPEED 0xc0046985
+#endif
+#ifdef I8K_GET_TEMP
+# undef I8K_GET_TEMP
+# define I8K_GET_TEMP 0x80046984
+#endif
+#ifdef I8K_POWER_STATUS
+# undef I8K_POWER_STATUS
+# define I8K_POWER_STATUS 0x80046982
+#endif
+#ifdef I8K_SET_FAN
+# undef I8K_SET_FAN
+# define I8K_SET_FAN 0xc0046987
+#endif
+#ifdef IDT77105_GETSTAT
+# undef IDT77105_GETSTAT
+# define IDT77105_GETSTAT 0x400c6132
+#endif
+#ifdef IDT77105_GETSTATZ
+# undef IDT77105_GETSTATZ
+# define IDT77105_GETSTATZ 0x400c6133
+#endif
+#ifdef IOCTL_GNTDEV_GRANT_COPY
+# undef IOCTL_GNTDEV_GRANT_COPY
+# define IOCTL_GNTDEV_GRANT_COPY 0x00084708
+#endif
+#ifdef ION_IOC_ALLOC
+# undef ION_IOC_ALLOC
+# define ION_IOC_ALLOC 0xc0144900
+#endif
+#ifdef ION_IOC_CUSTOM
+# undef ION_IOC_CUSTOM
+# define ION_IOC_CUSTOM 0xc0084906
+#endif
+#ifdef IOW_READ
+# undef IOW_READ
+# define IOW_READ 0x4004c002
+#endif
+#ifdef IOW_WRITE
+# undef IOW_WRITE
+# define IOW_WRITE 0x4004c001
+#endif
+#ifdef IPMICTL_RECEIVE_MSG
+# undef IPMICTL_RECEIVE_MSG
+# define IPMICTL_RECEIVE_MSG 0xc018690c
+#endif
+#ifdef IPMICTL_RECEIVE_MSG_TRUNC
+# undef IPMICTL_RECEIVE_MSG_TRUNC
+# define IPMICTL_RECEIVE_MSG_TRUNC 0xc018690b
+#endif
+#ifdef IPMICTL_SEND_COMMAND
+# undef IPMICTL_SEND_COMMAND
+# define IPMICTL_SEND_COMMAND 0x8014690d
+#endif
+#ifdef IPMICTL_SEND_COMMAND_SETTIME
+# undef IPMICTL_SEND_COMMAND_SETTIME
+# define IPMICTL_SEND_COMMAND_SETTIME 0x801c6915
+#endif
+#ifdef IVTVFB_IOC_DMA_FRAME
+# undef IVTVFB_IOC_DMA_FRAME
+# define IVTVFB_IOC_DMA_FRAME 0x400c56c0
+#endif
+#ifdef IVTV_IOC_DMA_FRAME
+# undef IVTV_IOC_DMA_FRAME
+# define IVTV_IOC_DMA_FRAME 0x403856c0
+#endif
+#ifdef IXJCTL_CID
+# undef IXJCTL_CID
+# define IXJCTL_CID 0x800471d4
+#endif
+#ifdef IXJCTL_CIDCW
+# undef IXJCTL_CIDCW
+# define IXJCTL_CIDCW 0x400471d9
+#endif
+#ifdef IXJCTL_DRYBUFFER_READ
+# undef IXJCTL_DRYBUFFER_READ
+# define IXJCTL_DRYBUFFER_READ 0x800471e6
+#endif
+#ifdef IXJCTL_FILTER_CADENCE
+# undef IXJCTL_FILTER_CADENCE
+# define IXJCTL_FILTER_CADENCE 0x400471d6
+#endif
+#ifdef IXJCTL_FRAMES_READ
+# undef IXJCTL_FRAMES_READ
+# define IXJCTL_FRAMES_READ 0x800471e2
+#endif
+#ifdef IXJCTL_FRAMES_WRITTEN
+# undef IXJCTL_FRAMES_WRITTEN
+# define IXJCTL_FRAMES_WRITTEN 0x800471e3
+#endif
+#ifdef IXJCTL_INIT_TONE
+# undef IXJCTL_INIT_TONE
+# define IXJCTL_INIT_TONE 0x400471c9
+#endif
+#ifdef IXJCTL_READ_WAIT
+# undef IXJCTL_READ_WAIT
+# define IXJCTL_READ_WAIT 0x800471e4
+#endif
+#ifdef IXJCTL_SET_FILTER
+# undef IXJCTL_SET_FILTER
+# define IXJCTL_SET_FILTER 0x400471c7
+#endif
+#ifdef IXJCTL_SET_FILTER_RAW
+# undef IXJCTL_SET_FILTER_RAW
+# define IXJCTL_SET_FILTER_RAW 0x400471dd
+#endif
+#ifdef IXJCTL_SIGCTL
+# undef IXJCTL_SIGCTL
+# define IXJCTL_SIGCTL 0x400471e9
+#endif
+#ifdef IXJCTL_TONE_CADENCE
+# undef IXJCTL_TONE_CADENCE
+# define IXJCTL_TONE_CADENCE 0x400471ca
+#endif
+#ifdef IXJCTL_VERSION
+# undef IXJCTL_VERSION
+# define IXJCTL_VERSION 0x800471da
+#endif
+#ifdef IXJCTL_WRITE_WAIT
+# undef IXJCTL_WRITE_WAIT
+# define IXJCTL_WRITE_WAIT 0x800471e5
+#endif
+#ifdef KCOV_INIT_TRACE
+# undef KCOV_INIT_TRACE
+# define KCOV_INIT_TRACE 0x80046301
+#endif
+#ifdef KVM_S390_STORE_STATUS
+# undef KVM_S390_STORE_STATUS
+# define KVM_S390_STORE_STATUS 0x4004ae95
+#endif
+#ifdef KVM_S390_VCPU_FAULT
+# undef KVM_S390_VCPU_FAULT
+# define KVM_S390_VCPU_FAULT 0x4004ae52
+#endif
+#ifdef MATROXFB_GET_ALL_OUTPUTS
+# undef MATROXFB_GET_ALL_OUTPUTS
+# define MATROXFB_GET_ALL_OUTPUTS 0x80046efb
+#endif
+#ifdef MATROXFB_GET_AVAILABLE_OUTPUTS
+# undef MATROXFB_GET_AVAILABLE_OUTPUTS
+# define MATROXFB_GET_AVAILABLE_OUTPUTS 0x80046ef9
+#endif
+#ifdef MATROXFB_GET_OUTPUT_CONNECTION
+# undef MATROXFB_GET_OUTPUT_CONNECTION
+# define MATROXFB_GET_OUTPUT_CONNECTION 0x80046ef8
+#endif
+#ifdef MATROXFB_GET_OUTPUT_MODE
+# undef MATROXFB_GET_OUTPUT_MODE
+# define MATROXFB_GET_OUTPUT_MODE 0xc0046efa
+#endif
+#ifdef MATROXFB_SET_OUTPUT_CONNECTION
+# undef MATROXFB_SET_OUTPUT_CONNECTION
+# define MATROXFB_SET_OUTPUT_CONNECTION 0x40046ef8
+#endif
+#ifdef MATROXFB_SET_OUTPUT_MODE
+# undef MATROXFB_SET_OUTPUT_MODE
+# define MATROXFB_SET_OUTPUT_MODE 0x40046efa
+#endif
+#ifdef MEDIA_IOC_ENUM_LINKS
+# undef MEDIA_IOC_ENUM_LINKS
+# define MEDIA_IOC_ENUM_LINKS 0xc01c7c02
+#endif
+#ifdef MEMREADOOB
+# undef MEMREADOOB
+# define MEMREADOOB 0xc00c4d04
+#endif
+#ifdef MEMWRITEOOB
+# undef MEMWRITEOOB
+# define MEMWRITEOOB 0xc00c4d03
+#endif
+#ifdef MGSL_IOCGPARAMS
+# undef MGSL_IOCGPARAMS
+# define MGSL_IOCGPARAMS 0x80206d01
+#endif
+#ifdef MGSL_IOCSPARAMS
+# undef MGSL_IOCSPARAMS
+# define MGSL_IOCSPARAMS 0x40206d00
+#endif
+#ifdef MIC_VIRTIO_ADD_DEVICE
+# undef MIC_VIRTIO_ADD_DEVICE
+# define MIC_VIRTIO_ADD_DEVICE 0xc0047301
+#endif
+#ifdef MIC_VIRTIO_CONFIG_CHANGE
+# undef MIC_VIRTIO_CONFIG_CHANGE
+# define MIC_VIRTIO_CONFIG_CHANGE 0xc0047305
+#endif
+#ifdef MIC_VIRTIO_COPY_DESC
+# undef MIC_VIRTIO_COPY_DESC
+# define MIC_VIRTIO_COPY_DESC 0xc0047302
+#endif
+#ifdef MMTIMER_GETCOUNTER
+# undef MMTIMER_GETCOUNTER
+# define MMTIMER_GETCOUNTER 0x80046d09
+#endif
+#ifdef MMTIMER_GETFREQ
+# undef MMTIMER_GETFREQ
+# define MMTIMER_GETFREQ 0x80046d02
+#endif
+#ifdef MMTIMER_GETRES
+# undef MMTIMER_GETRES
+# define MMTIMER_GETRES 0x80046d01
+#endif
+#ifdef MTIOCGET
+# undef MTIOCGET
+# define MTIOCGET 0x801c6d02
+#endif
+#ifdef MTIOCPOS
+# undef MTIOCPOS
+# define MTIOCPOS 0x80046d03
+#endif
+#ifdef NCIUARTSETDRIVER
+# undef NCIUARTSETDRIVER
+# define NCIUARTSETDRIVER 0x40045500
+#endif
+#ifdef NCP_IOC_GET_FS_INFO_V2
+# undef NCP_IOC_GET_FS_INFO_V2
+# define NCP_IOC_GET_FS_INFO_V2 0xc0246e04
+#endif
+#ifdef NCP_IOC_GETMOUNTUID2
+# undef NCP_IOC_GETMOUNTUID2
+# define NCP_IOC_GETMOUNTUID2 0x40046e02
+#endif
+#ifdef NCP_IOC_GETOBJECTNAME
+# undef NCP_IOC_GETOBJECTNAME
+# define NCP_IOC_GETOBJECTNAME 0xc00c6e09
+#endif
+#ifdef NCP_IOC_GETPRIVATEDATA
+# undef NCP_IOC_GETPRIVATEDATA
+# define NCP_IOC_GETPRIVATEDATA 0xc0086e0a
+#endif
+#ifdef NCP_IOC_NCPREQUEST
+# undef NCP_IOC_NCPREQUEST
+# define NCP_IOC_NCPREQUEST 0x800c6e01
+#endif
+#ifdef NCP_IOC_SETOBJECTNAME
+# undef NCP_IOC_SETOBJECTNAME
+# define NCP_IOC_SETOBJECTNAME 0x800c6e09
+#endif
+#ifdef NCP_IOC_SETPRIVATEDATA
+# undef NCP_IOC_SETPRIVATEDATA
+# define NCP_IOC_SETPRIVATEDATA 0x80086e0a
+#endif
+#ifdef NS_GETPSTAT
+# undef NS_GETPSTAT
+# define NS_GETPSTAT 0xc00c6161
+#endif
+#ifdef NS_SETBUFLEV
+# undef NS_SETBUFLEV
+# define NS_SETBUFLEV 0x400c6162
+#endif
+#ifdef OMAPFB_MEMORY_READ
+# undef OMAPFB_MEMORY_READ
+# define OMAPFB_MEMORY_READ 0x80104f3a
+#endif
+#ifdef OSD_GET_CAPABILITY
+# undef OSD_GET_CAPABILITY
+# define OSD_GET_CAPABILITY 0x80086fa1
+#endif
+#ifdef OSD_SEND_CMD
+# undef OSD_SEND_CMD
+# define OSD_SEND_CMD 0x401c6fa0
+#endif
+#ifdef PERF_EVENT_IOC_ID
+# undef PERF_EVENT_IOC_ID
+# define PERF_EVENT_IOC_ID 0x80042407
+#endif
+#ifdef PERF_EVENT_IOC_SET_FILTER
+# undef PERF_EVENT_IOC_SET_FILTER
+# define PERF_EVENT_IOC_SET_FILTER 0x40042406
+#endif
+#ifdef PHN_GET_REG
+# undef PHN_GET_REG
+# define PHN_GET_REG 0xc0047000
+#endif
+#ifdef PHN_GET_REGS
+# undef PHN_GET_REGS
+# define PHN_GET_REGS 0xc0047002
+#endif
+#ifdef PHN_SET_REG
+# undef PHN_SET_REG
+# define PHN_SET_REG 0x40047001
+#endif
+#ifdef PHN_SET_REGS
+# undef PHN_SET_REGS
+# define PHN_SET_REGS 0x40047003
+#endif
+#ifdef PHONE_CAPABILITIES_CHECK
+# undef PHONE_CAPABILITIES_CHECK
+# define PHONE_CAPABILITIES_CHECK 0x40047182
+#endif
+#ifdef PHONE_CAPABILITIES_LIST
+# undef PHONE_CAPABILITIES_LIST
+# define PHONE_CAPABILITIES_LIST 0x80047181
+#endif
+#ifdef PHONE_QUERY_CODEC
+# undef PHONE_QUERY_CODEC
+# define PHONE_QUERY_CODEC 0xc00471a7
+#endif
+#ifdef PHONE_RING_START
+# undef PHONE_RING_START
+# define PHONE_RING_START 0x40047187
+#endif
+#ifdef PMU_IOC_CAN_SLEEP
+# undef PMU_IOC_CAN_SLEEP
+# define PMU_IOC_CAN_SLEEP 0x80044205
+#endif
+#ifdef PMU_IOC_GET_BACKLIGHT
+# undef PMU_IOC_GET_BACKLIGHT
+# define PMU_IOC_GET_BACKLIGHT 0x80044201
+#endif
+#ifdef PMU_IOC_GET_MODEL
+# undef PMU_IOC_GET_MODEL
+# define PMU_IOC_GET_MODEL 0x80044203
+#endif
+#ifdef PMU_IOC_GRAB_BACKLIGHT
+# undef PMU_IOC_GRAB_BACKLIGHT
+# define PMU_IOC_GRAB_BACKLIGHT 0x80044206
+#endif
+#ifdef PMU_IOC_HAS_ADB
+# undef PMU_IOC_HAS_ADB
+# define PMU_IOC_HAS_ADB 0x80044204
+#endif
+#ifdef PMU_IOC_SET_BACKLIGHT
+# undef PMU_IOC_SET_BACKLIGHT
+# define PMU_IOC_SET_BACKLIGHT 0x40044202
+#endif
+#ifdef PPPIOCGCOMPRESSORS
+# undef PPPIOCGCOMPRESSORS
+# define PPPIOCGCOMPRESSORS 0x80207486
+#endif
+#ifdef PPPIOCSACTIVE
+# undef PPPIOCSACTIVE
+# define PPPIOCSACTIVE 0x40087446
+#endif
+#ifdef PPPIOCSCOMPRESS
+# undef PPPIOCSCOMPRESS
+# define PPPIOCSCOMPRESS 0x400c744d
+#endif
+#ifdef PPPIOCSPASS
+# undef PPPIOCSPASS
+# define PPPIOCSPASS 0x40087447
+#endif
+#ifdef PPPOEIOCSFWD
+# undef PPPOEIOCSFWD
+# define PPPOEIOCSFWD 0x4004b100
+#endif
+#ifdef PPS_FETCH
+# undef PPS_FETCH
+# define PPS_FETCH 0xc00470a4
+#endif
+#ifdef PPS_GETCAP
+# undef PPS_GETCAP
+# define PPS_GETCAP 0x800470a3
+#endif
+#ifdef PPS_GETPARAMS
+# undef PPS_GETPARAMS
+# define PPS_GETPARAMS 0x800470a1
+#endif
+#ifdef PPS_KC_BIND
+# undef PPS_KC_BIND
+# define PPS_KC_BIND 0x400470a5
+#endif
+#ifdef PPS_SETPARAMS
+# undef PPS_SETPARAMS
+# define PPS_SETPARAMS 0x400470a2
+#endif
+#ifdef REISERFS_IOC_UNPACK
+# undef REISERFS_IOC_UNPACK
+# define REISERFS_IOC_UNPACK 0x4004cd01
+#endif
+#ifdef RTC_EPOCH_READ
+# undef RTC_EPOCH_READ
+# define RTC_EPOCH_READ 0x8004700d
+#endif
+#ifdef RTC_EPOCH_SET
+# undef RTC_EPOCH_SET
+# define RTC_EPOCH_SET 0x4004700e
+#endif
+#ifdef RTC_IRQP_READ
+# undef RTC_IRQP_READ
+# define RTC_IRQP_READ 0x8004700b
+#endif
+#ifdef RTC_IRQP_SET
+# undef RTC_IRQP_SET
+# define RTC_IRQP_SET 0x4004700c
+#endif
+#ifdef RTC_PLL_GET
+# undef RTC_PLL_GET
+# define RTC_PLL_GET 0x801c7011
+#endif
+#ifdef RTC_PLL_SET
+# undef RTC_PLL_SET
+# define RTC_PLL_SET 0x401c7012
+#endif
+#ifdef SNDCTL_DSP_MAPINBUF
+# undef SNDCTL_DSP_MAPINBUF
+# define SNDCTL_DSP_MAPINBUF 0x80085013
+#endif
+#ifdef SNDCTL_DSP_MAPOUTBUF
+# undef SNDCTL_DSP_MAPOUTBUF
+# define SNDCTL_DSP_MAPOUTBUF 0x80085014
+#endif
+#ifdef SNDRV_CTL_IOCTL_ELEM_LIST
+# undef SNDRV_CTL_IOCTL_ELEM_LIST
+# define SNDRV_CTL_IOCTL_ELEM_LIST 0xc0485510
+#endif
+#ifdef SNDRV_CTL_IOCTL_ELEM_READ
+# undef SNDRV_CTL_IOCTL_ELEM_READ
+# define SNDRV_CTL_IOCTL_ELEM_READ 0xc2c85512
+#endif
+#ifdef SNDRV_CTL_IOCTL_ELEM_WRITE
+# undef SNDRV_CTL_IOCTL_ELEM_WRITE
+# define SNDRV_CTL_IOCTL_ELEM_WRITE 0xc2c85513
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_CODE_PEEK
+# undef SNDRV_EMU10K1_IOCTL_CODE_PEEK
+# define SNDRV_EMU10K1_IOCTL_CODE_PEEK 0xc18c4812
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_CODE_POKE
+# undef SNDRV_EMU10K1_IOCTL_CODE_POKE
+# define SNDRV_EMU10K1_IOCTL_CODE_POKE 0x418c4811
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_TRAM_PEEK
+# undef SNDRV_EMU10K1_IOCTL_TRAM_PEEK
+# define SNDRV_EMU10K1_IOCTL_TRAM_PEEK 0xc00c4822
+#endif
+#ifdef SNDRV_EMU10K1_IOCTL_TRAM_POKE
+# undef SNDRV_EMU10K1_IOCTL_TRAM_POKE
+# define SNDRV_EMU10K1_IOCTL_TRAM_POKE 0x400c4821
+#endif
+#ifdef SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE
+# undef SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE
+# define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE 0x40044842
+#endif
+#ifdef SNDRV_HDSPM_IOCTL_GET_MIXER
+# undef SNDRV_HDSPM_IOCTL_GET_MIXER
+# define SNDRV_HDSPM_IOCTL_GET_MIXER 0x80044844
+#endif
+#ifdef SNDRV_HWDEP_IOCTL_DSP_LOAD
+# undef SNDRV_HWDEP_IOCTL_DSP_LOAD
+# define SNDRV_HWDEP_IOCTL_DSP_LOAD 0x40504803
+#endif
+#ifdef SNDRV_PCM_IOCTL_DELAY
+# undef SNDRV_PCM_IOCTL_DELAY
+# define SNDRV_PCM_IOCTL_DELAY 0x80044121
+#endif
+#ifdef SNDRV_PCM_IOCTL_FORWARD
+# undef SNDRV_PCM_IOCTL_FORWARD
+# define SNDRV_PCM_IOCTL_FORWARD 0x40044149
+#endif
+#ifdef SNDRV_PCM_IOCTL_HW_PARAMS
+# undef SNDRV_PCM_IOCTL_HW_PARAMS
+# define SNDRV_PCM_IOCTL_HW_PARAMS 0xc25c4111
+#endif
+#ifdef SNDRV_PCM_IOCTL_HW_REFINE
+# undef SNDRV_PCM_IOCTL_HW_REFINE
+# define SNDRV_PCM_IOCTL_HW_REFINE 0xc25c4110
+#endif
+#ifdef SNDRV_PCM_IOCTL_READI_FRAMES
+# undef SNDRV_PCM_IOCTL_READI_FRAMES
+# define SNDRV_PCM_IOCTL_READI_FRAMES 0x800c4151
+#endif
+#ifdef SNDRV_PCM_IOCTL_READN_FRAMES
+# undef SNDRV_PCM_IOCTL_READN_FRAMES
+# define SNDRV_PCM_IOCTL_READN_FRAMES 0x800c4153
+#endif
+#ifdef SNDRV_PCM_IOCTL_REWIND
+# undef SNDRV_PCM_IOCTL_REWIND
+# define SNDRV_PCM_IOCTL_REWIND 0x40044146
+#endif
+#ifdef SNDRV_PCM_IOCTL_STATUS
+# undef SNDRV_PCM_IOCTL_STATUS
+# define SNDRV_PCM_IOCTL_STATUS 0x80804120
+#endif
+#ifdef SNDRV_PCM_IOCTL_STATUS_EXT
+# undef SNDRV_PCM_IOCTL_STATUS_EXT
+# define SNDRV_PCM_IOCTL_STATUS_EXT 0xc0804124
+#endif
+#ifdef SNDRV_PCM_IOCTL_SW_PARAMS
+# undef SNDRV_PCM_IOCTL_SW_PARAMS
+# define SNDRV_PCM_IOCTL_SW_PARAMS 0xc0684113
+#endif
+#ifdef SNDRV_PCM_IOCTL_WRITEI_FRAMES
+# undef SNDRV_PCM_IOCTL_WRITEI_FRAMES
+# define SNDRV_PCM_IOCTL_WRITEI_FRAMES 0x400c4150
+#endif
+#ifdef SNDRV_PCM_IOCTL_WRITEN_FRAMES
+# undef SNDRV_PCM_IOCTL_WRITEN_FRAMES
+# define SNDRV_PCM_IOCTL_WRITEN_FRAMES 0x400c4152
+#endif
+#ifdef SNDRV_RAWMIDI_IOCTL_PARAMS
+# undef SNDRV_RAWMIDI_IOCTL_PARAMS
+# define SNDRV_RAWMIDI_IOCTL_PARAMS 0xc0205710
+#endif
+#ifdef SNDRV_RAWMIDI_IOCTL_STATUS
+# undef SNDRV_RAWMIDI_IOCTL_STATUS
+# define SNDRV_RAWMIDI_IOCTL_STATUS 0xc0305720
+#endif
+#ifdef SNDRV_SEQ_IOCTL_CREATE_PORT
+# undef SNDRV_SEQ_IOCTL_CREATE_PORT
+# define SNDRV_SEQ_IOCTL_CREATE_PORT 0xc0a45320
+#endif
+#ifdef SNDRV_SEQ_IOCTL_DELETE_PORT
+# undef SNDRV_SEQ_IOCTL_DELETE_PORT
+# define SNDRV_SEQ_IOCTL_DELETE_PORT 0x40a45321
+#endif
+#ifdef SNDRV_SEQ_IOCTL_GET_PORT_INFO
+# undef SNDRV_SEQ_IOCTL_GET_PORT_INFO
+# define SNDRV_SEQ_IOCTL_GET_PORT_INFO 0xc0a45322
+#endif
+#ifdef SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT
+# undef SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT
+# define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT 0xc0a45352
+#endif
+#ifdef SNDRV_SEQ_IOCTL_SET_PORT_INFO
+# undef SNDRV_SEQ_IOCTL_SET_PORT_INFO
+# define SNDRV_SEQ_IOCTL_SET_PORT_INFO 0x40a45323
+#endif
+#ifdef SNDRV_TIMER_IOCTL_GINFO
+# undef SNDRV_TIMER_IOCTL_GINFO
+# define SNDRV_TIMER_IOCTL_GINFO 0xc0e05403
+#endif
+#ifdef SNDRV_TIMER_IOCTL_GPARAMS
+# undef SNDRV_TIMER_IOCTL_GPARAMS
+# define SNDRV_TIMER_IOCTL_GPARAMS 0x403c5404
+#endif
+#ifdef SNDRV_TIMER_IOCTL_GSTATUS
+# undef SNDRV_TIMER_IOCTL_GSTATUS
+# define SNDRV_TIMER_IOCTL_GSTATUS 0xc0405405
+#endif
+#ifdef SNDRV_TIMER_IOCTL_INFO
+# undef SNDRV_TIMER_IOCTL_INFO
+# define SNDRV_TIMER_IOCTL_INFO 0x80e05411
+#endif
+#ifdef SPIOCSTYPE
+# undef SPIOCSTYPE
+# define SPIOCSTYPE 0x40047101
+#endif
+#ifdef TUNATTACHFILTER
+# undef TUNATTACHFILTER
+# define TUNATTACHFILTER 0x400854d5
+#endif
+#ifdef TUNDETACHFILTER
+# undef TUNDETACHFILTER
+# define TUNDETACHFILTER 0x400854d6
+#endif
+#ifdef TUNER_SET_CONFIG
+# undef TUNER_SET_CONFIG
+# define TUNER_SET_CONFIG 0x4008645c
+#endif
+#ifdef TUNGETFILTER
+# undef TUNGETFILTER
+# define TUNGETFILTER 0x800854db
+#endif
+#ifdef UDF_GETEABLOCK
+# undef UDF_GETEABLOCK
+# define UDF_GETEABLOCK 0x80046c41
+#endif
+#ifdef UDF_GETVOLIDENT
+# undef UDF_GETVOLIDENT
+# define UDF_GETVOLIDENT 0x80046c42
+#endif
+#ifdef UDF_RELOCATE_BLOCKS
+# undef UDF_RELOCATE_BLOCKS
+# define UDF_RELOCATE_BLOCKS 0xc0046c43
+#endif
+#ifdef UI_BEGIN_FF_UPLOAD
+# undef UI_BEGIN_FF_UPLOAD
+# define UI_BEGIN_FF_UPLOAD 0xc06055c8
+#endif
+#ifdef UI_END_FF_UPLOAD
+# undef UI_END_FF_UPLOAD
+# define UI_END_FF_UPLOAD 0x406055c9
+#endif
+#ifdef UI_SET_PHYS
+# undef UI_SET_PHYS
+# define UI_SET_PHYS 0x4004556c
+#endif
+#ifdef USBDEVFS_BULK
+# undef USBDEVFS_BULK
+# define USBDEVFS_BULK 0xc0105502
+#endif
+#ifdef USBDEVFS_CONTROL
+# undef USBDEVFS_CONTROL
+# define USBDEVFS_CONTROL 0xc0105500
+#endif
+#ifdef USBDEVFS_DISCSIGNAL
+# undef USBDEVFS_DISCSIGNAL
+# define USBDEVFS_DISCSIGNAL 0x8008550e
+#endif
+#ifdef USBDEVFS_IOCTL
+# undef USBDEVFS_IOCTL
+# define USBDEVFS_IOCTL 0xc00c5512
+#endif
+#ifdef USBDEVFS_REAPURB
+# undef USBDEVFS_REAPURB
+# define USBDEVFS_REAPURB 0x4004550c
+#endif
+#ifdef USBDEVFS_REAPURBNDELAY
+# undef USBDEVFS_REAPURBNDELAY
+# define USBDEVFS_REAPURBNDELAY 0x4004550d
+#endif
+#ifdef USBDEVFS_SUBMITURB
+# undef USBDEVFS_SUBMITURB
+# define USBDEVFS_SUBMITURB 0x802c550a
+#endif
+#ifdef UVCIOC_CTRL_MAP
+# undef UVCIOC_CTRL_MAP
+# define UVCIOC_CTRL_MAP 0xc0587520
+#endif
+#ifdef UVCIOC_CTRL_QUERY
+# undef UVCIOC_CTRL_QUERY
+# define UVCIOC_CTRL_QUERY 0xc00c7521
+#endif
+#ifdef VIDEO_SET_SPU_PALETTE
+# undef VIDEO_SET_SPU_PALETTE
+# define VIDEO_SET_SPU_PALETTE 0x40086f33
+#endif
+#ifdef VIDEO_STILLPICTURE
+# undef VIDEO_STILLPICTURE
+# define VIDEO_STILLPICTURE 0x40086f1e
+#endif
+#ifdef VIDIOC_AM437X_CCDC_CFG
+# undef VIDIOC_AM437X_CCDC_CFG
+# define VIDIOC_AM437X_CCDC_CFG 0x400456c1
+#endif
+#ifdef VIDIOC_CREATE_BUFS
+# undef VIDIOC_CREATE_BUFS
+# define VIDIOC_CREATE_BUFS 0xc0f8565c
+#endif
+#ifdef VIDIOC_DQBUF
+# undef VIDIOC_DQBUF
+# define VIDIOC_DQBUF 0xc0505611
+#endif
+#ifdef VIDIOC_G_EDID
+# undef VIDIOC_G_EDID
+# define VIDIOC_G_EDID 0xc0245628
+#endif
+#ifdef VIDIOC_G_EXT_CTRLS
+# undef VIDIOC_G_EXT_CTRLS
+# define VIDIOC_G_EXT_CTRLS 0xc0185647
+#endif
+#ifdef VIDIOC_G_FBUF
+# undef VIDIOC_G_FBUF
+# define VIDIOC_G_FBUF 0x802c560a
+#endif
+#ifdef VIDIOC_G_FMT
+# undef VIDIOC_G_FMT
+# define VIDIOC_G_FMT 0xc0cc5604
+#endif
+#ifdef VIDIOC_OMAP3ISP_CCDC_CFG
+# undef VIDIOC_OMAP3ISP_CCDC_CFG
+# define VIDIOC_OMAP3ISP_CCDC_CFG 0xc02056c1
+#endif
+#ifdef VIDIOC_OMAP3ISP_PRV_CFG
+# undef VIDIOC_OMAP3ISP_PRV_CFG
+# define VIDIOC_OMAP3ISP_PRV_CFG 0xc03c56c2
+#endif
+#ifdef VIDIOC_OMAP3ISP_STAT_EN
+# undef VIDIOC_OMAP3ISP_STAT_EN
+# define VIDIOC_OMAP3ISP_STAT_EN 0xc00456c7
+#endif
+#ifdef VIDIOC_OMAP3ISP_STAT_REQ
+# undef VIDIOC_OMAP3ISP_STAT_REQ
+# define VIDIOC_OMAP3ISP_STAT_REQ 0xc02056c6
+#endif
+#ifdef VIDIOC_PREPARE_BUF
+# undef VIDIOC_PREPARE_BUF
+# define VIDIOC_PREPARE_BUF 0xc050565d
+#endif
+#ifdef VIDIOC_QBUF
+# undef VIDIOC_QBUF
+# define VIDIOC_QBUF 0xc050560f
+#endif
+#ifdef VIDIOC_QUERYBUF
+# undef VIDIOC_QUERYBUF
+# define VIDIOC_QUERYBUF 0xc0505609
+#endif
+#ifdef VIDIOC_S_EDID
+# undef VIDIOC_S_EDID
+# define VIDIOC_S_EDID 0xc0245629
+#endif
+#ifdef VIDIOC_S_EXT_CTRLS
+# undef VIDIOC_S_EXT_CTRLS
+# define VIDIOC_S_EXT_CTRLS 0xc0185648
+#endif
+#ifdef VIDIOC_S_FBUF
+# undef VIDIOC_S_FBUF
+# define VIDIOC_S_FBUF 0x402c560b
+#endif
+#ifdef VIDIOC_S_FMT
+# undef VIDIOC_S_FMT
+# define VIDIOC_S_FMT 0xc0cc5605
+#endif
+#ifdef VIDIOC_SUBDEV_G_EDID
+# undef VIDIOC_SUBDEV_G_EDID
+# define VIDIOC_SUBDEV_G_EDID 0xc0245628
+#endif
+#ifdef VIDIOC_SUBDEV_S_EDID
+# undef VIDIOC_SUBDEV_S_EDID
+# define VIDIOC_SUBDEV_S_EDID 0xc0245629
+#endif
+#ifdef VIDIOC_TRY_EXT_CTRLS
+# undef VIDIOC_TRY_EXT_CTRLS
+# define VIDIOC_TRY_EXT_CTRLS 0xc0185649
+#endif
+#ifdef VIDIOC_TRY_FMT
+# undef VIDIOC_TRY_FMT
+# define VIDIOC_TRY_FMT 0xc0cc5640
+#endif
+#ifdef VPFE_CMD_S_CCDC_RAW_PARAMS
+# undef VPFE_CMD_S_CCDC_RAW_PARAMS
+# define VPFE_CMD_S_CCDC_RAW_PARAMS 0x400456c1
+#endif
+#ifdef ZATM_GETPOOL
+# undef ZATM_GETPOOL
+# define ZATM_GETPOOL 0x400c6161
+#endif
+#ifdef ZATM_GETPOOLZ
+# undef ZATM_GETPOOLZ
+# define ZATM_GETPOOLZ 0x400c6162
+#endif
+#ifdef ZATM_SETPOOL
+# undef ZATM_SETPOOL
+# define ZATM_SETPOOL 0x400c6163
+#endif
diff --git a/ioctlent0.h b/ioctlent0.h
index 589615e..8fc03c3 100644
--- a/ioctlent0.h
+++ b/ioctlent0.h
@@ -83,6 +83,7 @@
 { "STOP_ARRAY", 0x00000932 },
 { "STOP_ARRAY_RO", 0x00000933 },
 { "RESTART_ARRAY_RW", 0x00000934 },
+{ "CLUSTERED_DISK_NACK", 0x00000935 },
 { "BLKROSET", 0x0000125d },
 { "BLKROGET", 0x0000125e },
 { "BLKRRPART", 0x0000125f },
@@ -108,6 +109,7 @@
 { "BLKSECDISCARD", 0x0000127d },
 { "BLKROTATIONAL", 0x0000127e },
 { "BLKZEROOUT", 0x0000127f },
+{ "BLKDAXGET", 0x00001281 },
 { "IB_USER_MAD_ENABLE_PKEY", 0x00001b03 },
 { "SG_SET_TIMEOUT", 0x00002201 },
 { "SG_GET_TIMEOUT", 0x00002202 },
@@ -169,6 +171,10 @@
 { "VFIO_IOMMU_UNMAP_DMA", 0x00003b72 },
 { "VFIO_IOMMU_ENABLE", 0x00003b73 },
 { "VFIO_IOMMU_DISABLE", 0x00003b74 },
+{ "VFIO_IOMMU_SPAPR_REGISTER_MEMORY", 0x00003b75 },
+{ "VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY", 0x00003b76 },
+{ "VFIO_IOMMU_SPAPR_TCE_CREATE", 0x00003b77 },
+{ "VFIO_IOMMU_SPAPR_TCE_REMOVE", 0x00003b78 },
 { "VFIO_EEH_PE_OP", 0x00003b79 },
 { "AGPIOC_ACQUIRE", 0x00004101 },
 { "APM_IOC_STANDBY", 0x00004101 },
@@ -317,11 +323,14 @@
 { "LOOP_GET_STATUS64", 0x00004c05 },
 { "LOOP_CHANGE_FD", 0x00004c06 },
 { "LOOP_SET_CAPACITY", 0x00004c07 },
+{ "LOOP_SET_DIRECT_IO", 0x00004c08 },
 { "LOOP_CTL_ADD", 0x00004c80 },
 { "LOOP_CTL_REMOVE", 0x00004c81 },
 { "LOOP_CTL_GET_FREE", 0x00004c82 },
 { "MTDFILEMODE", 0x00004d13 },
 { "NVME_IOCTL_ID", 0x00004e40 },
+{ "NVME_IOCTL_RESET", 0x00004e44 },
+{ "NVME_IOCTL_SUBSYS_RESET", 0x00004e45 },
 { "UBI_IOCVOLRMBLK", 0x00004f08 },
 { "OMAPFB_SYNC_GFX", 0x00004f25 },
 { "OMAPFB_VSYNC", 0x00004f26 },
@@ -490,7 +499,8 @@
 { "USBTMC_IOCTL_ABORT_BULK_IN", 0x00005b04 },
 { "USBTMC_IOCTL_CLEAR_OUT_HALT", 0x00005b06 },
 { "USBTMC_IOCTL_CLEAR_IN_HALT", 0x00005b07 },
-{ "ANDROID_ALARM_WAIT", 0x00006101 },
+{ "USBTMC488_IOCTL_GOTO_LOCAL", 0x00005b14 },
+{ "USBTMC488_IOCTL_LOCAL_LOCKOUT", 0x00005b15 },
 { "NS_ADJBUFLEV", 0x00006163 },
 { "SIOCSIFATMTCP", 0x00006180 },
 { "ATMTCP_CREATE", 0x0000618e },
@@ -514,6 +524,8 @@
 { "BC_ENTER_LOOPER", 0x0000630c },
 { "BC_EXIT_LOOPER", 0x0000630d },
 { "CHIOINITELEM", 0x00006311 },
+{ "KCOV_ENABLE", 0x00006364 },
+{ "KCOV_DISABLE", 0x00006365 },
 { "DRM_IOCTL_SET_MASTER", 0x0000641e },
 { "DRM_IOCTL_DROP_MASTER", 0x0000641f },
 { "DRM_IOCTL_AGP_ACQUIRE", 0x00006430 },
@@ -846,15 +858,9 @@
 { "RAW_GETBIND", 0x0000ac01 },
 { "KVM_GET_API_VERSION", 0x0000ae00 },
 { "KVM_CREATE_VM", 0x0000ae01 },
-{ "LOGGER_GET_LOG_BUF_SIZE", 0x0000ae01 },
-{ "LOGGER_GET_LOG_LEN", 0x0000ae02 },
 { "KVM_CHECK_EXTENSION", 0x0000ae03 },
-{ "LOGGER_GET_NEXT_ENTRY_LEN", 0x0000ae03 },
 { "KVM_GET_VCPU_MMAP_SIZE", 0x0000ae04 },
-{ "LOGGER_FLUSH_LOG", 0x0000ae04 },
-{ "LOGGER_GET_VERSION", 0x0000ae05 },
 { "KVM_S390_ENABLE_SIE", 0x0000ae06 },
-{ "LOGGER_SET_VERSION", 0x0000ae06 },
 { "KVM_CREATE_VCPU", 0x0000ae41 },
 { "KVM_SET_NR_MMU_PAGES", 0x0000ae44 },
 { "KVM_GET_NR_MMU_PAGES", 0x0000ae45 },
@@ -869,6 +875,7 @@
 { "KVM_SET_TSC_KHZ", 0x0000aea2 },
 { "KVM_GET_TSC_KHZ", 0x0000aea3 },
 { "KVM_KVMCLOCK_CTRL", 0x0000aead },
+{ "KVM_SMI", 0x0000aeb7 },
 { "VHOST_SET_OWNER", 0x0000af01 },
 { "VHOST_RESET_OWNER", 0x0000af02 },
 { "PPPOEIOCDFWD", 0x0000b101 },
@@ -876,11 +883,17 @@
 { "IOCTL_EVTCHN_BIND_UNBOUND_PORT", 0x00044502 },
 { "IOCTL_EVTCHN_UNBIND", 0x00044503 },
 { "IOCTL_EVTCHN_NOTIFY", 0x00044504 },
+{ "IOCTL_GNTDEV_SET_MAX_GRANTS", 0x00044703 },
 { "IOCTL_EVTCHN_BIND_INTERDOMAIN", 0x00084501 },
-{ "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", 0x40005344 },
+{ "IOCTL_GNTDEV_UNMAP_GRANT_REF", 0x00104701 },
+{ "IOCTL_GNTDEV_SET_UNMAP_NOTIFY", 0x00104707 },
+{ "IOCTL_GNTDEV_GRANT_COPY", 0x00104708 },
+{ "IOCTL_GNTDEV_MAP_GRANT_REF", 0x00184700 },
+{ "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", 0x00184702 },
 { "MFB_SET_ALPHA", 0x40014d00 },
 { "MFB_SET_GAMMA", 0x40014d01 },
 { "MFB_SET_BRIGHTNESS", 0x40014d03 },
+{ "USBTMC488_IOCTL_REN_CONTROL", 0x40015b13 },
 { "SPI_IOC_WR_MODE", 0x40016b01 },
 { "SPI_IOC_WR_LSB_FIRST", 0x40016b02 },
 { "SPI_IOC_WR_BITS_PER_WORD", 0x40016b03 },
@@ -894,6 +907,7 @@
 { "SONYPI_IOCSFAN", 0x4001760b },
 { "ATM_SETBACKEND", 0x400261f2 },
 { "ATM_NEWBACKENDIF", 0x400261f3 },
+{ "RIO_MPORT_MAINT_HDID_SET", 0x40026d01 },
 { "NCP_IOC_GETMOUNTUID", 0x40026e02 },
 { "AUDIO_SET_ATTRIBUTES", 0x40026f11 },
 { "DMX_ADD_PID", 0x40026f33 },
@@ -908,17 +922,16 @@
 { "FW_CDEV_IOC_STOP_ISO", 0x4004230b },
 { "FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE", 0x4004230e },
 { "FW_CDEV_IOC_FLUSH_ISO", 0x40042318 },
-{ "BLKI2OSRSTRAT", 0x40043203 },
-{ "BLKI2OSWSTRAT", 0x40043204 },
+{ "PERF_EVENT_IOC_SET_BPF", 0x40042408 },
 { "SNAPSHOT_CREATE_IMAGE", 0x40043311 },
 { "PTP_ENABLE_PPS", 0x40043d04 },
-{ "SYNC_IOC_WAIT", 0x40043e00 },
 { "SNDRV_PCM_IOCTL_TSTAMP", 0x40044102 },
 { "SNDRV_PCM_IOCTL_TTSTAMP", 0x40044103 },
 { "AGPIOC_DEALLOCATE", 0x40044107 },
 { "SNDRV_PCM_IOCTL_PAUSE", 0x40044145 },
 { "SNDRV_PCM_IOCTL_LINK", 0x40044160 },
 { "CCISS_REGNEWDISK", 0x4004420d },
+{ "CS_SET_WAKELINE", 0x40044317 },
 { "EVIOCRMFF", 0x40044581 },
 { "EVIOCGRAB", 0x40044590 },
 { "EVIOCREVOKE", 0x40044591 },
@@ -930,6 +943,7 @@
 { "FBIPUT_VSYNC", 0x4004460a },
 { "FBIO_WAITFORVSYNC", 0x40044620 },
 { "SSTFB_SET_VGAPASS", 0x400446dd },
+{ "IOCTL_MEI_NOTIFY_SET", 0x40044802 },
 { "HIDIOCSFLAG", 0x4004480f },
 { "SNDRV_EMU10K1_IOCTL_TRAM_SETUP", 0x40044820 },
 { "SNDRV_DM_FM_IOCTL_SET_MODE", 0x40044825 },
@@ -993,8 +1007,10 @@
 { "TUNSETQUEUE", 0x400454d9 },
 { "TUNSETIFINDEX", 0x400454da },
 { "TUNSETVNETLE", 0x400454dc },
+{ "TUNSETVNETBE", 0x400454de },
 { "USBDEVFS_REAPURB32", 0x4004550c },
 { "USBDEVFS_REAPURBNDELAY32", 0x4004550d },
+{ "USBDEVFS_DROP_PRIVILEGES", 0x4004551e },
 { "SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE", 0x40045532 },
 { "SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE", 0x40045542 },
 { "UI_SET_EVBIT", 0x40045564 },
@@ -1061,8 +1077,8 @@
 { "LIRC_SET_WIDEBAND_RECEIVER", 0x40046923 },
 { "SPI_IOC_WR_MAX_SPEED_HZ", 0x40046b04 },
 { "SPI_IOC_WR_MODE32", 0x40046b05 },
-{ "MSMFB_GRP_DISP", 0x40046d01 },
-{ "MSMFB_BLIT", 0x40046d02 },
+{ "RIO_MPORT_MAINT_COMPTAG_SET", 0x40046d02 },
+{ "RIO_SET_EVENT_MASK", 0x40046d0d },
 { "NCP_IOC_SET_SIGN_WANTED", 0x40046e06 },
 { "NCP_IOC_GETDENTRYTTL", 0x40046e0c },
 { "SISFB_SET_AUTOMAXIMIZE_OLD", 0x40046efa },
@@ -1106,6 +1122,7 @@
 { "IXJCTL_INTERCOM_START", 0x400471fd },
 { "IXJCTL_INTERCOM_STOP", 0x400471fe },
 { "FAT_IOCTL_SET_ATTRIBUTES", 0x40047211 },
+{ "SCIF_LISTEN", 0x40047302 },
 { "PPPIOCATTCHAN", 0x40047438 },
 { "PPPIOCCONNECT", 0x4004743a },
 { "PPPIOCSMRRU", 0x4004743b },
@@ -1130,6 +1147,7 @@
 { "SIOCSNETADDR", 0x400489e0 },
 { "AUTOFS_IOC_EXPIRE_MULTI", 0x40049366 },
 { "BTRFS_IOC_CLONE", 0x40049409 },
+{ "FICLONE", 0x40049409 },
 { "BTRFS_IOC_BALANCE_CTL", 0x40049421 },
 { "KVM_INTERRUPT", 0x4004ae86 },
 { "KVM_SET_SIGNAL_MASK", 0x4004ae8b },
@@ -1148,6 +1166,7 @@
 { "FW_CDEV_IOC_RECEIVE_PHY_PACKETS", 0x40082316 },
 { "PERF_EVENT_IOC_PERIOD", 0x40082404 },
 { "PERF_EVENT_IOC_SET_FILTER", 0x40082406 },
+{ "STP_SET_OPTIONS", 0x40082502 },
 { "FBIO_RADEON_SET_MIRROR", 0x40084004 },
 { "AGPIOC_SETUP", 0x40084103 },
 { "AGPIOC_RESERVE", 0x40084104 },
@@ -1163,6 +1182,11 @@
 { "EVIOCSKEYCODE", 0x40084504 },
 { "SNDRV_SB_CSP_IOCTL_START", 0x40084813 },
 { "SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE", 0x40084842 },
+{ "AMDKFD_IOC_DESTROY_EVENT", 0x40084b09 },
+{ "AMDKFD_IOC_SET_EVENT", 0x40084b0a },
+{ "AMDKFD_IOC_RESET_EVENT", 0x40084b0b },
+{ "AMDKFD_IOC_DBG_REGISTER", 0x40084b0d },
+{ "AMDKFD_IOC_DBG_UNREGISTER", 0x40084b0e },
 { "MEMERASE", 0x40084d02 },
 { "MFB_SET_AOID", 0x40084d04 },
 { "MEMLOCK", 0x40084d05 },
@@ -1177,12 +1201,15 @@
 { "SNDCTL_SEQ_OUTOFBAND", 0x40085112 },
 { "RNDADDENTROPY", 0x40085203 },
 { "TFD_IOC_SET_TICKS", 0x40085400 },
+{ "NCIUARTSETDRIVER", 0x40085500 },
 { "USBDEVFS_REAPURB", 0x4008550c },
 { "USBDEVFS_REAPURBNDELAY", 0x4008550d },
 { "USBDEVFS_CONNECTINFO", 0x40085511 },
 { "UI_SET_PHYS", 0x4008556c },
 { "VIDIOC_S_STD", 0x40085618 },
+{ "VIDIOC_AM437X_CCDC_CFG", 0x400856c1 },
 { "VPFE_CMD_S_CCDC_RAW_PARAMS", 0x400856c1 },
+{ "DMA_BUF_IOCTL_SYNC", 0x40086200 },
 { "BINDER_SET_IDLE_TIMEOUT", 0x40086203 },
 { "CM_IOCSPTS", 0x40086302 },
 { "BC_FREE_BUFFER", 0x40086303 },
@@ -1204,6 +1231,7 @@
 { "DRM_IOCTL_RADEON_CP_STOP", 0x40086442 },
 { "DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT", 0x40086443 },
 { "DRM_IOCTL_OMAP_GEM_CPU_PREP", 0x40086444 },
+{ "DRM_IOCTL_ETNAVIV_GEM_CPU_FINI", 0x40086445 },
 { "DRM_IOCTL_QXL_CLIENTCAP", 0x40086445 },
 { "DRM_IOCTL_I915_SETPARAM", 0x40086447 },
 { "DRM_IOCTL_I915_FREE", 0x40086449 },
@@ -1219,6 +1247,11 @@
 { "FS_IOC_SETFLAGS", 0x40086602 },
 { "HPET_IRQFREQ", 0x40086806 },
 { "MTIOCTOP", 0x40086d01 },
+{ "RIO_ENABLE_DOORBELL_RANGE", 0x40086d09 },
+{ "RIO_DISABLE_DOORBELL_RANGE", 0x40086d0a },
+{ "RIO_UNMAP_INBOUND", 0x40086d12 },
+{ "RIO_FREE_DMA", 0x40086d14 },
+{ "RIO_WAIT_FOR_ASYNC", 0x40086d16 },
 { "NCP_IOC_GETMOUNTUID2", 0x40086e02 },
 { "NILFS_IOCTL_DELETE_CHECKPOINT", 0x40086e81 },
 { "NILFS_IOCTL_RESIZE", 0x40086e8b },
@@ -1269,9 +1302,13 @@
 { "VHOST_SET_LOG_BASE", 0x4008af04 },
 { "VHOST_SET_VRING_NUM", 0x4008af10 },
 { "VHOST_SET_VRING_BASE", 0x4008af12 },
+{ "VHOST_SET_VRING_ENDIAN", 0x4008af13 },
+{ "VHOST_GET_VRING_ENDIAN", 0x4008af14 },
 { "VHOST_SET_VRING_KICK", 0x4008af20 },
 { "VHOST_SET_VRING_CALL", 0x4008af21 },
 { "VHOST_SET_VRING_ERR", 0x4008af22 },
+{ "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", 0x4008af23 },
+{ "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", 0x4008af24 },
 { "VHOST_NET_SET_BACKEND", 0x4008af30 },
 { "PPPOEIOCSFWD", 0x4008b100 },
 { "IOW_WRITE", 0x4008c001 },
@@ -1299,6 +1336,7 @@
 { "DRM_IOCTL_RADEON_INIT_HEAP", 0x400c6455 },
 { "DRM_IOCTL_RADEON_SURF_ALLOC", 0x400c645a },
 { "DRM_IOCTL_I915_GEM_SET_DOMAIN", 0x400c645f },
+{ "FS_IOC_GET_ENCRYPTION_POLICY", 0x400c6615 },
 { "I2OEVTREG", 0x400c690a },
 { "HSC_SET_RX", 0x400c6b13 },
 { "HSC_GET_RX", 0x400c6b14 },
@@ -1311,7 +1349,11 @@
 { "FW_CDEV_IOC_SET_ISO_CHANNELS", 0x40102317 },
 { "PTP_EXTTS_REQUEST", 0x40103d02 },
 { "CCISS_SETNODENAME", 0x40104205 },
+{ "EVIOCSMASK", 0x40104593 },
 { "SNDRV_EMU10K1_IOCTL_TRAM_POKE", 0x40104821 },
+{ "SNDRV_USB_STREAM_IOCTL_SET_PARAMS", 0x40104890 },
+{ "AMDKFD_IOC_DBG_ADDRESS_WATCH", 0x40104b0f },
+{ "AMDKFD_IOC_DBG_WAVE_CONTROL", 0x40104b10 },
 { "MTRRIOC_ADD_ENTRY", 0x40104d00 },
 { "MTRRIOC_SET_ENTRY", 0x40104d01 },
 { "MTRRIOC_DEL_ENTRY", 0x40104d02 },
@@ -1326,7 +1368,6 @@
 { "OMAPFB_GET_COLOR_KEY", 0x40104f33 },
 { "TUNATTACHFILTER", 0x401054d5 },
 { "TUNDETACHFILTER", 0x401054d6 },
-{ "ANDROID_ALARM_SET_RTC", 0x40106105 },
 { "IDT77105_GETSTAT", 0x40106132 },
 { "IDT77105_GETSTATZ", 0x40106133 },
 { "ATM_GETSTAT", 0x40106150 },
@@ -1382,8 +1423,11 @@
 { "DRM_IOCTL_SIS_FB_INIT", 0x40106456 },
 { "DRM_IOCTL_RADEON_SETPARAM", 0x40106459 },
 { "TUNER_SET_CONFIG", 0x4010645c },
+{ "FS_IOC_GET_ENCRYPTION_PWSALT", 0x40106614 },
 { "HSC_SET_TX", 0x40106b15 },
 { "HSC_GET_TX", 0x40106b16 },
+{ "RIO_ENABLE_PORTWRITE_RANGE", 0x40106d0b },
+{ "RIO_DISABLE_PORTWRITE_RANGE", 0x40106d0c },
 { "MGSL_IOCSGPIO", 0x40106d10 },
 { "NILFS_IOCTL_CHANGE_CPMODE", 0x40106e80 },
 { "NILFS_IOCTL_SET_ALLOC_RANGE", 0x40106e8c },
@@ -1393,6 +1437,9 @@
 { "FE_SET_PROPERTY", 0x40106f52 },
 { "CA_SET_DESCR", 0x40106f86 },
 { "PPSETTIME", 0x40107096 },
+{ "IOC_PR_RESERVE", 0x401070c9 },
+{ "IOC_PR_RELEASE", 0x401070ca },
+{ "IOC_PR_CLEAR", 0x401070cd },
 { "PPPIOCSACTIVE", 0x40107446 },
 { "PPPIOCSPASS", 0x40107447 },
 { "PPPIOCSCOMPRESS", 0x4010744d },
@@ -1434,11 +1481,17 @@
 { "IVTVFB_IOC_DMA_FRAME", 0x401856c0 },
 { "DRM_IOCTL_UPDATE_DRAW", 0x4018643f },
 { "DRM_IOCTL_QXL_UPDATE_AREA", 0x40186443 },
+{ "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", 0x40186444 },
 { "DRM_IOCTL_MSM_GEM_CPU_PREP", 0x40186444 },
 { "DRM_IOCTL_MSM_WAIT_FENCE", 0x40186447 },
 { "DRM_IOCTL_R128_BLIT", 0x4018644b },
+{ "RIO_MPORT_MAINT_WRITE_LOCAL", 0x40186d06 },
+{ "RIO_MPORT_MAINT_WRITE_REMOTE", 0x40186d08 },
 { "NILFS_IOCTL_SET_SUINFO", 0x40186e8d },
 { "UBI_IOCATT", 0x40186f40 },
+{ "IOC_PR_REGISTER", 0x401870c8 },
+{ "IOC_PR_PREEMPT", 0x401870cb },
+{ "IOC_PR_PREEMPT_ABORT", 0x401870cc },
 { "BTRFS_IOC_QGROUP_ASSIGN", 0x40189429 },
 { "KVM_SET_MEMORY_REGION", 0x4018ae40 },
 { "KVM_S390_UCAS_MAP", 0x4018ae50 },
@@ -1447,10 +1500,13 @@
 { "KVM_GET_DEVICE_ATTR", 0x4018aee2 },
 { "KVM_HAS_DEVICE_ATTR", 0x4018aee3 },
 { "MBXFB_IOCS_ALPHA", 0x4018f402 },
+{ "UI_ABS_SETUP", 0x401c5504 },
+{ "FS_IOC_FSSETXATTR", 0x401c5820 },
 { "BR2684_SETFILT", 0x401c6190 },
 { "CHIOEXCHANGE", 0x401c6302 },
 { "FDSETPRM", 0x40200242 },
 { "FDDEFPRM", 0x40200243 },
+{ "CS_CONFIG_BUFS", 0x4020431f },
 { "ION_IOC_TEST_DMA_MAPPING", 0x402049f1 },
 { "ION_IOC_TEST_KERNEL_MAPPING", 0x402049f2 },
 { "AMDKFD_IOC_SET_MEMORY_POLICY", 0x40204b04 },
@@ -1459,26 +1515,38 @@
 { "DRM_IOCTL_MARK_BUFS", 0x40206417 },
 { "DRM_IOCTL_AGP_FREE", 0x40206435 },
 { "DRM_IOCTL_VIA_FREEMEM", 0x40206441 },
+{ "DRM_IOCTL_VIRTGPU_EXECBUFFER", 0x40206442 },
 { "DRM_IOCTL_I915_BATCHBUFFER", 0x40206443 },
+{ "DRM_IOCTL_AMDGPU_INFO", 0x40206445 },
 { "DRM_IOCTL_SIS_FB_FREE", 0x40206445 },
+{ "DRM_IOCTL_ETNAVIV_WAIT_FENCE", 0x40206447 },
 { "DRM_IOCTL_RADEON_CLEAR", 0x40206448 },
+{ "DRM_IOCTL_ETNAVIV_GEM_WAIT", 0x40206449 },
 { "DRM_IOCTL_I915_CMDBUFFER", 0x4020644b },
 { "DRM_IOCTL_I810_MC", 0x4020644c },
 { "DRM_IOCTL_RADEON_CMDBUF", 0x40206450 },
 { "DRM_IOCTL_SIS_AGP_FREE", 0x40206455 },
 { "DRM_IOCTL_I915_GEM_PREAD", 0x4020645c },
 { "DRM_IOCTL_I915_GEM_PWRITE", 0x4020645d },
+{ "RIO_DEV_ADD", 0x40206d17 },
+{ "RIO_DEV_DEL", 0x40206d18 },
 { "OSD_SEND_CMD", 0x40206fa0 },
 { "RTC_PLL_SET", 0x40207012 },
 { "PPPIOCSXASYNCMAP", 0x4020744f },
 { "BTRFS_IOC_CLONE_RANGE", 0x4020940d },
+{ "FICLONERANGE", 0x4020940d },
 { "KVM_SET_MEMORY_ALIAS", 0x4020ae43 },
 { "KVM_SET_USER_MEMORY_REGION", 0x4020ae46 },
 { "KVM_IRQFD", 0x4020ae76 },
 { "KVM_SIGNAL_MSI", 0x4020aea5 },
+{ "KVM_CREATE_SPAPR_TCE_64", 0x4020aea8 },
 { "KVM_PPC_GET_HTAB_FD", 0x4020aeaa },
 { "KVM_ARM_VCPU_INIT", 0x4020aeae },
+{ "KVM_S390_SET_IRQ_STATE", 0x4020aeb5 },
+{ "KVM_S390_GET_IRQ_STATE", 0x4020aeb6 },
 { "SNDRV_COMPRESS_SET_METADATA", 0x40244314 },
+{ "NVM_DEV_REMOVE", 0x40244c23 },
+{ "NVM_DEV_FACTORY", 0x40244c25 },
 { "JSIOCSCORR", 0x40246a21 },
 { "FE_SET_FRONTEND", 0x40246f4c },
 { "RTC_ALM_SET", 0x40247007 },
@@ -1489,12 +1557,15 @@
 { "EVIOCSKEYCODE_V2", 0x40284504 },
 { "SNDCTL_FM_LOAD_INSTR", 0x40285107 },
 { "DRM_IOCTL_RM_MAP", 0x4028641b },
+{ "DRM_IOCTL_AMDGPU_GEM_VA", 0x40286448 },
 { "DRM_IOCTL_R128_DEPTH", 0x4028644c },
 { "DRM_IOCTL_RADEON_VERTEX2", 0x4028644f },
 { "DRM_IOCTL_I915_GEM_EXECBUFFER", 0x40286454 },
+{ "RIO_UNMAP_OUTBOUND", 0x40286d10 },
 { "PHN_SETREGS", 0x40287008 },
 { "RTC_WKALM_SET", 0x4028700f },
 { "VHOST_SET_VRING_ADDR", 0x4028af11 },
+{ "NVM_DEV_INIT", 0x402c4c24 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", 0x402c5342 },
 { "TCSETS2", 0x402c542b },
 { "TCSETSW2", 0x402c542c },
@@ -1539,7 +1610,12 @@
 { "KVM_X86_SET_MCE", 0x4040ae9e },
 { "KVM_SET_VCPU_EVENTS", 0x4040aea0 },
 { "KVM_ASSIGN_SET_INTX_MASK", 0x4040aea4 },
+{ "KVM_S390_MEM_OP", 0x4040aeb1 },
+{ "KVM_S390_GET_SKEYS", 0x4040aeb2 },
+{ "KVM_S390_SET_SKEYS", 0x4040aeb3 },
 { "CXL_IOCTL_START_WORK", 0x4040ca00 },
+{ "CXL_IOCTL_DOWNLOAD_IMAGE", 0x4040ca0a },
+{ "CXL_IOCTL_VALIDATE_IMAGE", 0x4040ca0b },
 { "OMAPFB_SETUP_PLANE", 0x40444f34 },
 { "OMAPFB_QUERY_PLANE", 0x40444f35 },
 { "OMAPFB_UPDATE_WINDOW", 0x40444f36 },
@@ -1550,6 +1626,7 @@
 { "SNDRV_TIMER_IOCTL_GPARAMS", 0x40485404 },
 { "BTRFS_IOC_SEND", 0x40489426 },
 { "KVM_SET_GUEST_DEBUG", 0x4048ae9b },
+{ "KVM_S390_IRQ", 0x4048aeb4 },
 { "GSMIOC_SETCONF", 0x404c4701 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", 0x404c534a },
 { "SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT", 0x40505330 },
@@ -1557,6 +1634,7 @@
 { "SNDRV_TIMER_IOCTL_PARAMS", 0x40505412 },
 { "VIDIOC_S_TUNER", 0x4054561e },
 { "SNDRV_SEQ_IOCTL_SET_CLIENT_POOL", 0x4058534c },
+{ "UI_DEV_SETUP", 0x405c5503 },
 { "PTP_PIN_SETFUNC", 0x40603d07 },
 { "SNDRV_HWDEP_IOCTL_DSP_LOAD", 0x40604803 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", 0x40605346 },
@@ -1569,12 +1647,14 @@
 { "DRM_IOCTL_RADEON_CP_INIT", 0x40786440 },
 { "NILFS_IOCTL_CLEAN_SEGMENTS", 0x40786e88 },
 { "FDSETDRVPRM", 0x40800290 },
+{ "NVM_DEV_CREATE", 0x40804c22 },
 { "UBI_IOCVOLCRBLK", 0x40804f07 },
 { "DRM_IOCTL_MGA_INIT", 0x40806440 },
 { "KVM_PPC_GET_PVINFO", 0x4080aea1 },
 { "KVM_SET_DEBUGREGS", 0x4080aea2 },
 { "KVM_PPC_RTAS_DEFINE_TOKEN", 0x4080aeac },
 { "SNDRV_COMPRESS_SET_PARAMS", 0x40844312 },
+{ "V4L2_DEVICE_NOTIFY_EVENT", 0x40887602 },
 { "SNDRV_SEQ_IOCTL_DELETE_QUEUE", 0x408c5333 },
 { "VIDIOC_S_JPEGCOMP", 0x408c563e },
 { "KVM_SET_REGS", 0x4090ae82 },
@@ -1612,6 +1692,8 @@
 { "SNDRV_SB_CSP_IOCTL_LOAD_CODE", 0x70124811 },
 { "MFB_GET_ALPHA", 0x80014d00 },
 { "MFB_GET_GAMMA", 0x80014d01 },
+{ "USBTMC488_IOCTL_GET_CAPS", 0x80015b11 },
+{ "USBTMC488_IOCTL_READ_STB", 0x80015b12 },
 { "GADGET_GET_PRINTER_STATUS", 0x80016721 },
 { "JSIOCGAXES", 0x80016a11 },
 { "JSIOCGBUTTONS", 0x80016a12 },
@@ -1639,14 +1721,14 @@
 { "SONYPI_IOCGBAT2CAP", 0x80027604 },
 { "SONYPI_IOCGBAT2REM", 0x80027605 },
 { "MBXFB_IOCS_PLANEORDER", 0x8002f403 },
-{ "BLKI2OGRSTRAT", 0x80043201 },
-{ "BLKI2OGWSTRAT", 0x80043202 },
 { "SNDRV_PCM_IOCTL_PVERSION", 0x80044100 },
 { "CCISS_GETHEARTBEAT", 0x80044206 },
 { "CCISS_GETBUSTYPES", 0x80044207 },
 { "CCISS_GETFIRMVER", 0x80044208 },
 { "CCISS_GETDRIVVER", 0x80044209 },
 { "SNDRV_COMPRESS_IOCTL_VERSION", 0x80044300 },
+{ "CS_GET_STATE", 0x80044315 },
+{ "CS_GET_IF_VERSION", 0x8004431e },
 { "CAPI_GET_FLAGS", 0x80044323 },
 { "CAPI_SET_FLAGS", 0x80044324 },
 { "CAPI_CLR_FLAGS", 0x80044325 },
@@ -1662,6 +1744,7 @@
 { "SNDRV_HWDEP_IOCTL_PVERSION", 0x80044800 },
 { "HIDIOCGRDESCSIZE", 0x80044801 },
 { "HIDIOCGVERSION", 0x80044801 },
+{ "IOCTL_MEI_NOTIFY_GET", 0x80044803 },
 { "HIDIOCGFLAG", 0x8004480e },
 { "HDA_IOCTL_PVERSION", 0x80044810 },
 { "SNDRV_EMU10K1_IOCTL_PVERSION", 0x80044840 },
@@ -1722,6 +1805,7 @@
 { "TUNGETSNDBUF", 0x800454d3 },
 { "TUNGETVNETHDRSZ", 0x800454d7 },
 { "TUNGETVNETLE", 0x800454dd },
+{ "TUNGETVNETBE", 0x800454df },
 { "SNDRV_CTL_IOCTL_PVERSION", 0x80045500 },
 { "USBDEVFS_RESETEP", 0x80045503 },
 { "USBDEVFS_SETCONFIGURATION", 0x80045505 },
@@ -1785,6 +1869,8 @@
 { "SPI_IOC_RD_MAX_SPEED_HZ", 0x80046b04 },
 { "SPI_IOC_RD_MODE32", 0x80046b05 },
 { "UDF_GETEASIZE", 0x80046c40 },
+{ "RIO_MPORT_MAINT_PORT_IDX_GET", 0x80046d03 },
+{ "RIO_GET_EVENT_MASK", 0x80046d0e },
 { "NCP_IOC_SIGN_WANTED", 0x80046e06 },
 { "NCP_IOC_SETDENTRYTTL", 0x80046e0c },
 { "SISFB_GET_INFO_OLD", 0x80046ef8 },
@@ -1833,6 +1919,7 @@
 { "GENWQE_GET_CARD_STATE", 0x8004a524 },
 { "KVM_GET_MP_STATE", 0x8004ae98 },
 { "CXL_IOCTL_GET_PROCESS_ELEMENT", 0x8004ca01 },
+{ "FUSE_DEV_IOC_CLONE", 0x8004e500 },
 { "SISFB_GET_INFO_SIZE", 0x8004f300 },
 { "SISFB_GET_VBRSTATUS", 0x8004f302 },
 { "SISFB_GET_AUTOMAXIMIZE", 0x8004f303 },
@@ -1874,6 +1961,7 @@
 { "VIDIOC_G_STD", 0x80085617 },
 { "VIDIOC_QUERYSTD", 0x8008563f },
 { "CM_IOCGSTATUS", 0x80086300 },
+{ "KCOV_INIT_TRACE", 0x80086301 },
 { "DRM_IOCTL_I810_OV0INFO", 0x80086449 },
 { "FS_IOC_GETFLAGS", 0x80086601 },
 { "I2OPASSTHRU32", 0x8008690c },
@@ -1925,6 +2013,7 @@
 { "OMAPFB_GET_CAPS", 0x800c4f2a },
 { "SNDCTL_DSP_GETIPTR", 0x800c5011 },
 { "SNDCTL_DSP_GETOPTR", 0x800c5012 },
+{ "FS_IOC_SET_ENCRYPTION_POLICY", 0x800c6613 },
 { "IPMICTL_REGISTER_FOR_CMD_CHANS", 0x800c691c },
 { "IPMICTL_UNREGISTER_FOR_CMD_CHANS", 0x800c691d },
 { "NCP_IOC_SETROOT", 0x800c6e08 },
@@ -1933,7 +2022,9 @@
 { "CA_GET_SLOT_INFO", 0x800c6f82 },
 { "FDGETDRVTYP", 0x8010020f },
 { "FW_CDEV_IOC_GET_CYCLE_TIMER", 0x8010230c },
+{ "STP_POLICY_ID_GET", 0x80102501 },
 { "CCISS_GETNODENAME", 0x80104204 },
+{ "EVIOCGMASK", 0x80104592 },
 { "SNDRV_HDSPM_IOCTL_GET_LTC", 0x80104846 },
 { "ECCGETSTATS", 0x80104d12 },
 { "SNDCTL_DSP_GETOSPACE", 0x8010500c },
@@ -1960,6 +2051,8 @@
 { "GENWQE_READ_REG64", 0x8010a51e },
 { "GENWQE_READ_REG32", 0x8010a520 },
 { "GENWQE_READ_REG16", 0x8010a522 },
+{ "UFFDIO_UNREGISTER", 0x8010aa01 },
+{ "UFFDIO_WAKE", 0x8010aa02 },
 { "FDGETMAXERRS", 0x8014020e },
 { "GET_DISK_INFO", 0x80140912 },
 { "SNDRV_COMPRESS_TSTAMP", 0x80144320 },
@@ -1973,6 +2066,8 @@
 { "IMSETDEVNAME", 0x80184947 },
 { "OMAPFB_MEMORY_READ", 0x80184f3a },
 { "HPET_INFO", 0x80186803 },
+{ "RIO_MPORT_MAINT_READ_LOCAL", 0x80186d05 },
+{ "RIO_MPORT_MAINT_READ_REMOTE", 0x80186d07 },
 { "NCP_IOC_SIGN_INIT", 0x80186e05 },
 { "NCP_IOC_SETOBJECTNAME", 0x80186e09 },
 { "NILFS_IOCTL_GET_CPINFO", 0x80186e82 },
@@ -1983,6 +2078,7 @@
 { "MBXFB_IOCG_ALPHA", 0x8018f401 },
 { "SNDRV_COMPRESS_AVAIL", 0x801c4321 },
 { "HIDIOCGDEVINFO", 0x801c4803 },
+{ "FS_IOC_FSGETXATTR", 0x801c581f },
 { "FDGETPRM", 0x80200204 },
 { "FBIOGET_VBLANK", 0x80204612 },
 { "SNDRV_HDSPM_IOCTL_GET_STATUS", 0x80204847 },
@@ -2021,6 +2117,7 @@
 { "IPMICTL_SEND_COMMAND_SETTIME", 0x80306915 },
 { "MGSL_IOCGPARAMS", 0x80306d01 },
 { "MTIOCGET", 0x80306d02 },
+{ "RIO_MPORT_GET_PROPERTIES", 0x80306d04 },
 { "NILFS_IOCTL_GET_SUSTAT", 0x80306e85 },
 { "BTRFS_IOC_QGROUP_LIMIT", 0x8030942b },
 { "KVM_GET_CLOCK", 0x8030ae7c },
@@ -2037,6 +2134,8 @@
 { "BTRFS_IOC_QUOTA_RESCAN_STATUS", 0x8040942d },
 { "KVM_ASSIGN_PCI_DEVICE", 0x8040ae69 },
 { "KVM_GET_VCPU_EVENTS", 0x8040ae9f },
+{ "CXL_IOCTL_GET_AFU_ID", 0x8040ca02 },
+{ "GPIO_GET_CHIPINFO_IOCTL", 0x8044b401 },
 { "GET_ARRAY_INFO", 0x80480911 },
 { "PPPIOCGL2TPSTATS", 0x80487436 },
 { "BTRFS_IOC_GET_SUPPORTED_FEATURES", 0x80489439 },
@@ -2098,10 +2197,10 @@
 { "SNDCTL_COPR_RCVMSG", 0x8fa44309 },
 { "GET_BITMAP_FILE", 0x90000915 },
 { "SNDRV_HDSP_IOCTL_GET_MIXER", 0x90004844 },
+{ "NVM_GET_DEVICES", 0x90004c21 },
 { "BTRFS_IOC_DEVICES_READY", 0x90009427 },
 { "KVM_GET_XSAVE", 0x9000aea4 },
 { "HIDIOCGRDESC", 0x90044802 },
-{ "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", 0xc0005343 },
 { "GADGET_SET_PRINTER_STATUS", 0xc0016722 },
 { "CAPI_GET_MANUFACTURER", 0xc0044306 },
 { "CAPI_GET_SERIAL", 0xc0044308 },
@@ -2150,11 +2249,12 @@
 { "DRM_IOCTL_MGA_WAIT_FENCE", 0xc004644b },
 { "DRM_IOCTL_MODE_RMFB", 0xc00464af },
 { "DRM_IOCTL_MODE_DESTROY_DUMB", 0xc00464b4 },
+{ "DRM_IOCTL_MODE_DESTROYPROPBLOB", 0xc00464be },
 { "SNDCTL_MIDI_PRETIME", 0xc0046d00 },
 { "SNDCTL_MIDI_MPUMODE", 0xc0046d01 },
 { "MGSL_IOCWAITEVENT", 0xc0046d08 },
+{ "SCIF_FENCE_WAIT", 0xc0047310 },
 { "PPPIOCNEWUNIT", 0xc004743e },
-{ "TOSH_SMM", 0xc0047490 },
 { "MEYEIOC_SYNC", 0xc00476c3 },
 { "AUTOFS_IOC_SETTIMEOUT32", 0xc0049364 },
 { "KVM_GET_MSR_INDEX_LIST", 0xc004ae02 },
@@ -2169,6 +2269,9 @@
 { "ION_IOC_IMPORT", 0xc0084905 },
 { "ION_IOC_SYNC", 0xc0084907 },
 { "AMDKFD_IOC_DESTROY_QUEUE", 0xc0084b03 },
+{ "ND_IOCTL_DIMM_FLAGS", 0xc0084e03 },
+{ "ND_IOCTL_SET_CONFIG_DATA", 0xc0084e06 },
+{ "ND_IOCTL_VENDOR", 0xc0084e09 },
 { "SNDRV_CTL_IOCTL_TLV_READ", 0xc008551a },
 { "SNDRV_CTL_IOCTL_TLV_WRITE", 0xc008551b },
 { "SNDRV_CTL_IOCTL_TLV_COMMAND", 0xc008551c },
@@ -2182,13 +2285,14 @@
 { "DRM_IOCTL_RM_CTX", 0xc0086421 },
 { "DRM_IOCTL_GET_CTX", 0xc0086423 },
 { "DRM_IOCTL_QXL_ALLOC", 0xc0086440 },
-{ "DRM_IOCTL_TEGRA_GEM_MMAP", 0xc0086441 },
+{ "DRM_IOCTL_AMDGPU_GEM_MMAP", 0xc0086441 },
 { "DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT", 0xc0086442 },
 { "DRM_IOCTL_TEGRA_SYNCPT_READ", 0xc0086442 },
 { "DRM_IOCTL_VIA_AGP_INIT", 0xc0086442 },
 { "DRM_IOCTL_TEGRA_SYNCPT_INCR", 0xc0086443 },
 { "DRM_IOCTL_VIA_FB_INIT", 0xc0086443 },
 { "DRM_IOCTL_I915_IRQ_EMIT", 0xc0086444 },
+{ "DRM_IOCTL_VIRTGPU_WAIT", 0xc0086448 },
 { "DRM_IOCTL_TEGRA_GEM_SET_FLAGS", 0xc008644c },
 { "DRM_IOCTL_TEGRA_GEM_GET_FLAGS", 0xc008644d },
 { "DRM_IOCTL_RADEON_IRQ_EMIT", 0xc0086456 },
@@ -2211,8 +2315,11 @@
 { "PPS_FETCH", 0xc00870a4 },
 { "PHONE_QUERY_CODEC", 0xc00871a7 },
 { "MIC_VIRTIO_ADD_DEVICE", 0xc0087301 },
+{ "SCIF_BIND", 0xc0087301 },
 { "MIC_VIRTIO_COPY_DESC", 0xc0087302 },
+{ "SCIF_CONNECT", 0xc0087303 },
 { "MIC_VIRTIO_CONFIG_CHANGE", 0xc0087305 },
+{ "SCIF_ACCEPTREG", 0xc0087305 },
 { "PPPIOCGNPMODE", 0xc008744c },
 { "AUTOFS_IOC_SETTIMEOUT", 0xc0089364 },
 { "KVM_GET_SUPPORTED_CPUID", 0xc008ae05 },
@@ -2225,7 +2332,11 @@
 { "FSL_HV_IOCTL_PARTITION_STOP", 0xc008af04 },
 { "FSL_HV_IOCTL_DOORBELL", 0xc008af06 },
 { "VHOST_GET_VRING_BASE", 0xc008af12 },
+{ "MMC_IOC_MULTI_CMD", 0xc008b301 },
 { "HIDIOCGREPORTINFO", 0xc00c4809 },
+{ "ND_IOCTL_SMART_THRESHOLD", 0xc00c4e02 },
+{ "ND_IOCTL_GET_CONFIG_SIZE", 0xc00c4e04 },
+{ "ND_IOCTL_GET_CONFIG_DATA", 0xc00c4e05 },
 { "SNDCTL_SYNTH_REMOVESAMPLE", 0xc00c5116 },
 { "USBDEVFS_IOCTL32", 0xc00c5512 },
 { "UI_BEGIN_FF_ERASE", 0xc00c55ca },
@@ -2240,6 +2351,7 @@
 { "KVM_CREATE_DEVICE", 0xc00caee0 },
 { "FSL_HV_IOCTL_PARTITION_GET_STATUS", 0xc00caf02 },
 { "MBXFB_IOCX_REG", 0xc00cf405 },
+{ "STP_POLICY_ID_SET", 0xc0102500 },
 { "CAPI_GET_VERSION", 0xc0104307 },
 { "CAPI_MANUFACTURER_CMD", 0xc0104320 },
 { "GIGASET_VERSION", 0xc0104703 },
@@ -2266,20 +2378,34 @@
 { "DRM_IOCTL_GET_SAREA_CTX", 0xc010641d },
 { "DRM_IOCTL_RES_CTX", 0xc0106426 },
 { "DRM_IOCTL_SG_ALLOC", 0xc0106438 },
+{ "DRM_IOCTL_ETNAVIV_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_EXYNOS_GEM_CREATE", 0xc0106440 },
 { "DRM_IOCTL_MSM_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_OMAP_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_TEGRA_GEM_CREATE", 0xc0106440 },
+{ "DRM_IOCTL_EXYNOS_GEM_MAP", 0xc0106441 },
 { "DRM_IOCTL_QXL_MAP", 0xc0106441 },
+{ "DRM_IOCTL_TEGRA_GEM_MMAP", 0xc0106441 },
+{ "DRM_IOCTL_VC4_WAIT_SEQNO", 0xc0106441 },
+{ "DRM_IOCTL_VIRTGPU_MAP", 0xc0106441 },
+{ "DRM_IOCTL_AMDGPU_CTX", 0xc0106442 },
+{ "DRM_IOCTL_ETNAVIV_GEM_NEW", 0xc0106442 },
 { "DRM_IOCTL_MSM_GEM_NEW", 0xc0106442 },
+{ "DRM_IOCTL_VC4_WAIT_BO", 0xc0106442 },
+{ "DRM_IOCTL_ETNAVIV_GEM_INFO", 0xc0106443 },
 { "DRM_IOCTL_MSM_GEM_INFO", 0xc0106443 },
 { "DRM_IOCTL_OMAP_GEM_NEW", 0xc0106443 },
+{ "DRM_IOCTL_VC4_CREATE_BO", 0xc0106443 },
+{ "DRM_IOCTL_VIRTGPU_GETPARAM", 0xc0106443 },
 { "DRM_IOCTL_EXYNOS_GEM_GET", 0xc0106444 },
 { "DRM_IOCTL_QXL_GETPARAM", 0xc0106444 },
 { "DRM_IOCTL_TEGRA_SYNCPT_WAIT", 0xc0106444 },
+{ "DRM_IOCTL_VC4_MMAP_BO", 0xc0106444 },
 { "DRM_IOCTL_TEGRA_OPEN_CHANNEL", 0xc0106445 },
+{ "DRM_IOCTL_VIRTGPU_RESOURCE_INFO", 0xc0106445 },
 { "DRM_IOCTL_I915_GETPARAM", 0xc0106446 },
 { "DRM_IOCTL_TEGRA_CLOSE_CHANNEL", 0xc0106446 },
+{ "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", 0xc0106447 },
 { "DRM_IOCTL_EXYNOS_VIDI_CONNECTION", 0xc0106447 },
 { "DRM_IOCTL_TEGRA_GET_SYNCPT", 0xc0106447 },
 { "DRM_IOCTL_MGA_GETPARAM", 0xc0106449 },
@@ -2288,6 +2414,7 @@
 { "DRM_IOCTL_TEGRA_GEM_GET_TILING", 0xc010644b },
 { "DRM_IOCTL_RADEON_INDIRECT", 0xc010644d },
 { "DRM_IOCTL_R128_INDIRECT", 0xc010644f },
+{ "DRM_IOCTL_AMDGPU_GEM_OP", 0xc0106450 },
 { "DRM_IOCTL_RADEON_GETPARAM", 0xc0106451 },
 { "DRM_IOCTL_R128_GETPARAM", 0xc0106452 },
 { "DRM_IOCTL_SIS_AGP_INIT", 0xc0106453 },
@@ -2303,9 +2430,13 @@
 { "DRM_IOCTL_MODE_GETPROPBLOB", 0xc01064ac },
 { "DRM_IOCTL_MODE_MAP_DUMB", 0xc01064b3 },
 { "DRM_IOCTL_MODE_GETPLANERESOURCES", 0xc01064b5 },
+{ "DRM_IOCTL_MODE_CREATEPROPBLOB", 0xc01064bd },
 { "MGSL_IOCWAITGPIO", 0xc0106d12 },
 { "NCP_IOC_GETPRIVATEDATA", 0xc0106e0a },
 { "DMX_GET_STC", 0xc0106f32 },
+{ "SCIF_ACCEPTREQ", 0xc0107304 },
+{ "SCIF_UNREG", 0xc0107309 },
+{ "SCIF_FENCE_MARK", 0xc010730f },
 { "UVCIOC_CTRL_QUERY", 0xc0107521 },
 { "BTRFS_IOC_SPACE_INFO", 0xc0109414 },
 { "BTRFS_IOC_QUOTA_CTL", 0xc0109428 },
@@ -2317,7 +2448,7 @@
 { "SNDRV_TIMER_IOCTL_NEXT_DEVICE", 0xc0145401 },
 { "VIDIOC_REQBUFS", 0xc0145608 },
 { "VIDIOC_G_CROP", 0xc014563b },
-{ "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", 0xc014646b },
+{ "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", 0xc014646a },
 { "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", 0xc014646b },
 { "DRM_IOCTL_MODE_GETENCODER", 0xc01464a6 },
 { "FW_CDEV_IOC_ADD_DESCRIPTOR", 0xc0182306 },
@@ -2327,6 +2458,7 @@
 { "FW_CDEV_IOC_SEND_PHY_PACKET", 0xc0182315 },
 { "HIDIOCGUSAGE", 0xc018480b },
 { "HIDIOCGUCODE", 0xc018480d },
+{ "AMDKFD_IOC_WAIT_EVENTS", 0xc0184b0c },
 { "MTRRIOC_GET_ENTRY", 0xc0184d03 },
 { "MTRRIOC_GET_PAGE_ENTRY", 0xc0184d08 },
 { "MEMWRITEOOB64", 0xc0184d15 },
@@ -2337,11 +2469,17 @@
 { "FITRIM", 0xc0185879 },
 { "DRM_IOCTL_MAP_BUFS", 0xc0186419 },
 { "DRM_IOCTL_WAIT_VBLANK", 0xc018643a },
+{ "DRM_IOCTL_AMDGPU_BO_LIST", 0xc0186443 },
+{ "DRM_IOCTL_AMDGPU_CS", 0xc0186444 },
 { "DRM_IOCTL_I810_GETBUF", 0xc0186445 },
+{ "DRM_IOCTL_VC4_CREATE_SHADER_BO", 0xc0186445 },
 { "DRM_IOCTL_OMAP_GEM_INFO", 0xc0186446 },
 { "DRM_IOCTL_QXL_ALLOC_SURF", 0xc0186446 },
+{ "DRM_IOCTL_ETNAVIV_GEM_USERPTR", 0xc0186448 },
 { "DRM_IOCTL_I915_ALLOC", 0xc0186448 },
+{ "DRM_IOCTL_VIRTGPU_GET_CAPS", 0xc0186449 },
 { "DRM_IOCTL_VIA_WAIT_IRQ", 0xc018644d },
+{ "DRM_IOCTL_AMDGPU_GEM_USERPTR", 0xc0186451 },
 { "DRM_IOCTL_RADEON_ALLOC", 0xc0186453 },
 { "DRM_IOCTL_I915_GEM_PIN", 0xc0186455 },
 { "DRM_IOCTL_RADEON_GEM_INFO", 0xc018645c },
@@ -2349,14 +2487,23 @@
 { "DRM_IOCTL_RADEON_GEM_USERPTR", 0xc018646d },
 { "DRM_IOCTL_I915_GET_RESET_STATS", 0xc0186472 },
 { "DRM_IOCTL_I915_GEM_USERPTR", 0xc0186473 },
+{ "DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM", 0xc0186474 },
+{ "DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM", 0xc0186475 },
 { "DRM_IOCTL_MODE_PAGE_FLIP", 0xc01864b0 },
 { "DRM_IOCTL_MODE_DIRTYFB", 0xc01864b1 },
 { "DRM_IOCTL_MODE_OBJ_SETPROPERTY", 0xc01864ba },
 { "I2OHRTGET", 0xc0186901 },
 { "I2OLCTGET", 0xc0186902 },
+{ "RIO_ALLOC_DMA", 0xc0186d13 },
+{ "RIO_TRANSFER", 0xc0186d15 },
 { "NCP_IOC_GETOBJECTNAME", 0xc0186e09 },
 { "NILFS_IOCTL_GET_VINFO", 0xc0186e86 },
 { "NILFS_IOCTL_GET_BDESCS", 0xc0186e87 },
+{ "SCIF_SEND", 0xc0187306 },
+{ "SCIF_RECV", 0xc0187307 },
+{ "SCIF_GET_NODEIDS", 0xc018730e },
+{ "TOSH_SMM", 0xc0187490 },
+{ "TOSHIBA_ACPI_SCI", 0xc0187491 },
 { "AUTOFS_DEV_IOCTL_VERSION", 0xc0189371 },
 { "AUTOFS_DEV_IOCTL_PROTOVER", 0xc0189372 },
 { "AUTOFS_DEV_IOCTL_PROTOSUBVER", 0xc0189373 },
@@ -2372,6 +2519,8 @@
 { "AUTOFS_DEV_IOCTL_ASKUMOUNT", 0xc018937d },
 { "AUTOFS_DEV_IOCTL_ISMOUNTPOINT", 0xc018937e },
 { "BTRFS_IOC_FILE_EXTENT_SAME", 0xc0189436 },
+{ "FIDEDUPERANGE", 0xc0189436 },
+{ "UFFDIO_API", 0xc018aa3f },
 { "KVM_TRANSLATE", 0xc018ae85 },
 { "IB_USER_MAD_REGISTER_AGENT", 0xc01c1b01 },
 { "SI4713_IOC_MEASURE_RNL", 0xc01c56c0 },
@@ -2381,6 +2530,10 @@
 { "FW_CDEV_IOC_ALLOCATE", 0xc0202302 },
 { "FW_CDEV_IOC_CREATE_ISO_CONTEXT", 0xc0202308 },
 { "ION_IOC_ALLOC", 0xc0204900 },
+{ "AMDKFD_IOC_CREATE_EVENT", 0xc0204b08 },
+{ "ND_IOCTL_ARS_CAP", 0xc0204e01 },
+{ "ND_IOCTL_ARS_START", 0xc0204e02 },
+{ "ND_IOCTL_CLEAR_ERROR", 0xc0204e04 },
 { "VIDIOC_G_EXT_CTRLS", 0xc0205647 },
 { "VIDIOC_S_EXT_CTRLS", 0xc0205648 },
 { "VIDIOC_TRY_EXT_CTRLS", 0xc0205649 },
@@ -2389,15 +2542,16 @@
 { "X86_IOC_WRMSR_REGS", 0xc02063a1 },
 { "DRM_IOCTL_ADD_BUFS", 0xc0206416 },
 { "DRM_IOCTL_AGP_ALLOC", 0xc0206434 },
+{ "DRM_IOCTL_AMDGPU_GEM_CREATE", 0xc0206440 },
 { "DRM_IOCTL_VIA_ALLOCMEM", 0xc0206440 },
 { "DRM_IOCTL_SIS_FB_ALLOC", 0xc0206444 },
 { "DRM_IOCTL_MSM_GEM_SUBMIT", 0xc0206446 },
 { "DRM_IOCTL_VIA_DMA_INIT", 0xc0206447 },
+{ "DRM_IOCTL_AMDGPU_WAIT_CS", 0xc0206449 },
 { "DRM_IOCTL_MGA_DMA_BOOTSTRAP", 0xc020644c },
 { "DRM_IOCTL_RADEON_TEXTURE", 0xc020644e },
 { "DRM_IOCTL_SIS_AGP_ALLOC", 0xc0206454 },
 { "DRM_IOCTL_RADEON_GEM_CREATE", 0xc020645d },
-{ "DRM_IOCTL_I915_GEM_MMAP", 0xc020645e },
 { "DRM_IOCTL_RADEON_GEM_MMAP", 0xc020645e },
 { "DRM_IOCTL_RADEON_GEM_PREAD", 0xc0206461 },
 { "DRM_IOCTL_RADEON_GEM_PWRITE", 0xc0206462 },
@@ -2410,8 +2564,12 @@
 { "FS_IOC_FIEMAP", 0xc020660b },
 { "GENWQE_PIN_MEM", 0xc020a528 },
 { "GENWQE_UNPIN_MEM", 0xc020a529 },
+{ "UFFDIO_REGISTER", 0xc020aa00 },
+{ "UFFDIO_ZEROPAGE", 0xc020aa04 },
 { "SNDCTL_MIDI_MPUCMD", 0xc0216d02 },
 { "SNDRV_COMPRESS_GET_METADATA", 0xc0244315 },
+{ "DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST", 0xc0246446 },
+{ "DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST", 0xc0246447 },
 { "DRM_IOCTL_MODE_CURSOR2", 0xc02464bb },
 { "IB_USER_MAD_REGISTER_AGENT2", 0xc0281b04 },
 { "FW_CDEV_IOC_GET_INFO", 0xc0282300 },
@@ -2430,14 +2588,24 @@
 { "DRM_IOCTL_GET_CLIENT", 0xc0286405 },
 { "DRM_IOCTL_ADD_MAP", 0xc0286415 },
 { "DRM_IOCTL_VIA_MAP_INIT", 0xc0286444 },
+{ "DRM_IOCTL_I915_GEM_MMAP", 0xc028645e },
 { "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", 0xc0286461 },
 { "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", 0xc0286472 },
 { "DRM_IOCTL_NOUVEAU_GEM_INFO", 0xc0286484 },
 { "I2OPARMSET", 0xc0286903 },
 { "I2OPARMGET", 0xc0286904 },
+{ "RIO_MAP_OUTBOUND", 0xc0286d0f },
+{ "RIO_MAP_INBOUND", 0xc0286d11 },
 { "NCP_IOC_GET_FS_INFO", 0xc0286e04 },
 { "PHN_GETREGS", 0xc0287007 },
+{ "SCIF_REG", 0xc0287308 },
+{ "SCIF_READFROM", 0xc028730a },
+{ "SCIF_WRITETO", 0xc028730b },
+{ "SCIF_VREADFROM", 0xc028730c },
+{ "SCIF_VWRITETO", 0xc028730d },
+{ "SCIF_FENCE_SIGNAL", 0xc0287311 },
 { "MEDIA_IOC_ENUM_LINKS", 0xc0287c02 },
+{ "UFFDIO_COPY", 0xc028aa03 },
 { "KVM_TPR_ACCESS_REPORTING", 0xc028ae92 },
 { "FSL_HV_IOCTL_MEMCPY", 0xc028af05 },
 { "FSL_HV_IOCTL_GETPROP", 0xc028af07 },
@@ -2450,6 +2618,7 @@
 { "VIDIOC_ENUM_FRAMESIZES", 0xc02c564a },
 { "DRM_IOCTL_I915_OVERLAY_ATTRS", 0xc02c6468 },
 { "MEMWRITE", 0xc0304d18 },
+{ "ND_IOCTL_ARS_STATUS", 0xc0304e03 },
 { "SNDRV_SEQ_IOCTL_SYSTEM_INFO", 0xc0305302 },
 { "VIDIOC_SUBDEV_ENUM_MBUS_CODE", 0xc0305602 },
 { "VIDIOC_SUBDEV_G_FRAME_INTERVAL", 0xc0305615 },
@@ -2457,6 +2626,7 @@
 { "VIDIOC_OMAP3ISP_HIST_CFG", 0xc03056c4 },
 { "SNDRV_RAWMIDI_IOCTL_PARAMS", 0xc0305710 },
 { "BINDER_WRITE_READ", 0xc0306201 },
+{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0306446 },
 { "DRM_IOCTL_NOUVEAU_GEM_NEW", 0xc0306480 },
 { "DRM_IOCTL_MODE_SETPLANE", 0xc03064b7 },
 { "I2OSWDL", 0xc0306905 },
@@ -2477,10 +2647,13 @@
 { "VIDIOC_DBG_G_REGISTER", 0xc0385650 },
 { "VIDIOC_OMAP3ISP_CCDC_CFG", 0xc03856c1 },
 { "SNDRV_RAWMIDI_IOCTL_STATUS", 0xc0385720 },
+{ "DRM_IOCTL_VIRTGPU_RESOURCE_CREATE", 0xc0386444 },
+{ "DRM_IOCTL_MODE_ATOMIC", 0xc03864bc },
 { "BTRFS_IOC_INO_PATHS", 0xc0389423 },
 { "BTRFS_IOC_LOGICAL_INO", 0xc0389424 },
 { "GENWQE_SLU_UPDATE", 0xc038a550 },
 { "GENWQE_SLU_READ", 0xc038a551 },
+{ "PTP_SYS_OFFSET_PRECISE", 0xc0403d08 },
 { "CAPI_GET_PROFILE", 0xc0404309 },
 { "SNDRV_CTL_IOCTL_ELEM_REMOVE", 0xc0405519 },
 { "VIDIOC_ENUM_FMT", 0xc0405602 },
@@ -2499,7 +2672,6 @@
 { "DRM_IOCTL_MODE_GETPROPERTY", 0xc04064aa },
 { "VIDIOC_QUERYCTRL", 0xc0445624 },
 { "VIDIOC_G_MODULATOR", 0xc0445636 },
-{ "DRM_IOCTL_MODE_ADDFB2", 0xc04464b8 },
 { "BLKTRACESETUP", 0xc0481273 },
 { "SNDRV_EMU10K1_IOCTL_PCM_PEEK", 0xc0484831 },
 { "NVME_IOCTL_ADMIN_CMD", 0xc0484e41 },
@@ -2512,8 +2684,10 @@
 { "DRM_IOCTL_MODE_DETACHMODE", 0xc04864a9 },
 { "VIDEO_COMMAND", 0xc0486f3b },
 { "VIDEO_TRY_COMMAND", 0xc0486f3c },
+{ "MEDIA_IOC_G_TOPOLOGY", 0xc0487c04 },
 { "KVM_GET_PIT", 0xc048ae65 },
 { "MMC_IOC_CMD", 0xc048b300 },
+{ "GPIO_GET_LINEINFO_IOCTL", 0xc048b402 },
 { "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", 0xc04c5349 },
 { "VIDIOC_OMAP3ISP_AF_CFG", 0xc04c56c5 },
 { "SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION", 0xc0505350 },
@@ -2541,15 +2715,25 @@
 { "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", 0xc0605345 },
 { "DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY", 0xc0606471 },
 { "UVCIOC_CTRL_MAP", 0xc0607520 },
+{ "DK_CXLFLASH_DETACH", 0xc060ca83 },
 { "FBIO_CURSOR", 0xc0684608 },
 { "UI_BEGIN_FF_UPLOAD", 0xc06855c8 },
 { "DRM_IOCTL_MODE_GETCRTC", 0xc06864a1 },
 { "DRM_IOCTL_MODE_SETCRTC", 0xc06864a2 },
+{ "DRM_IOCTL_MODE_ADDFB2", 0xc06864b8 },
+{ "DK_CXLFLASH_RELEASE", 0xc068ca82 },
+{ "DK_CXLFLASH_MANAGE_LUN", 0xc068ca86 },
 { "VIDIOC_OMAP3ISP_PRV_CFG", 0xc07056c2 },
 { "BTRFS_IOC_TREE_SEARCH_V2", 0xc0709411 },
+{ "DK_CXLFLASH_USER_DIRECT", 0xc070ca81 },
+{ "DK_CXLFLASH_VLUN_CLONE", 0xc070ca89 },
 { "SNDCTL_MIDI_INFO", 0xc074510c },
 { "VIDIOC_G_SLICED_VBI_CAP", 0xc0745645 },
+{ "DK_CXLFLASH_RECOVER_AFU", 0xc078ca85 },
+{ "DK_CXLFLASH_USER_VIRTUAL", 0xc078ca87 },
+{ "DK_CXLFLASH_VLUN_RESIZE", 0xc078ca88 },
 { "SOUND_MIXER_ACCESS", 0xc0804d66 },
+{ "ND_IOCTL_SMART", 0xc0844e01 },
 { "VIDIOC_SUBDEV_S_DV_TIMINGS", 0xc0845657 },
 { "VIDIOC_S_DV_TIMINGS", 0xc0845657 },
 { "VIDIOC_G_DV_TIMINGS", 0xc0845658 },
@@ -2565,8 +2749,13 @@
 { "SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE", 0xc08c5336 },
 { "VIDIOC_DV_TIMINGS_CAP", 0xc0905664 },
 { "VIDIOC_SUBDEV_DV_TIMINGS_CAP", 0xc0905664 },
+{ "DK_CXLFLASH_ATTACH", 0xc090ca80 },
+{ "DK_CXLFLASH_VERIFY", 0xc090ca84 },
 { "VIDIOC_ENUM_DV_TIMINGS", 0xc0945662 },
 { "VIDIOC_SUBDEV_ENUM_DV_TIMINGS", 0xc0945662 },
+{ "SNDRV_PCM_IOCTL_STATUS_EXT", 0xc0984124 },
+{ "DRM_IOCTL_VC4_SUBMIT_CL", 0xc0a06440 },
+{ "DRM_IOCTL_VC4_GET_HANG_STATE", 0xc0a06446 },
 { "SOUND_MIXER_GETLEVELS", 0xc0a44d74 },
 { "SOUND_MIXER_SETLEVELS", 0xc0a44d75 },
 { "SNDRV_SEQ_IOCTL_CREATE_PORT", 0xc0a85320 },
@@ -2594,6 +2783,7 @@
 { "SNDRV_CTL_IOCTL_ELEM_ADD", 0xc1105517 },
 { "SNDRV_CTL_IOCTL_ELEM_REPLACE", 0xc1105518 },
 { "SNDRV_CTL_IOCTL_PCM_INFO", 0xc1205531 },
+{ "DRM_IOCTL_AMDGPU_GEM_METADATA", 0xc1206446 },
 { "DM_VERSION", 0xc138fd00 },
 { "DM_REMOVE_ALL", 0xc138fd01 },
 { "DM_LIST_DEVICES", 0xc138fd02 },
@@ -2625,6 +2815,7 @@
 { "SNDCTL_COPR_SENDMSG", 0xcfa44308 },
 { "SNDCTL_SYNTH_CONTROL", 0xcfa45115 },
 { "SNDCTL_COPR_LOAD", 0xcfb04301 },
+{ "NVM_INFO", 0xd0004c20 },
 { "BTRFS_IOC_TREE_SEARCH", 0xd0009411 },
 { "BTRFS_IOC_INO_LOOKUP", 0xd0009412 },
 { "BTRFS_IOC_DEV_INFO", 0xd000941e },
diff --git a/ioctlent1.h b/ioctlent1.h
index c39eb31..856d671 100644
--- a/ioctlent1.h
+++ b/ioctlent1.h
@@ -83,6 +83,7 @@
 { "STOP_ARRAY", 0x00000932 },
 { "STOP_ARRAY_RO", 0x00000933 },
 { "RESTART_ARRAY_RW", 0x00000934 },
+{ "CLUSTERED_DISK_NACK", 0x00000935 },
 { "BLKROSET", 0x0000125d },
 { "BLKROGET", 0x0000125e },
 { "BLKRRPART", 0x0000125f },
@@ -108,6 +109,7 @@
 { "BLKSECDISCARD", 0x0000127d },
 { "BLKROTATIONAL", 0x0000127e },
 { "BLKZEROOUT", 0x0000127f },
+{ "BLKDAXGET", 0x00001281 },
 { "IB_USER_MAD_ENABLE_PKEY", 0x00001b03 },
 { "SG_SET_TIMEOUT", 0x00002201 },
 { "SG_GET_TIMEOUT", 0x00002202 },
@@ -169,6 +171,10 @@
 { "VFIO_IOMMU_UNMAP_DMA", 0x00003b72 },
 { "VFIO_IOMMU_ENABLE", 0x00003b73 },
 { "VFIO_IOMMU_DISABLE", 0x00003b74 },
+{ "VFIO_IOMMU_SPAPR_REGISTER_MEMORY", 0x00003b75 },
+{ "VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY", 0x00003b76 },
+{ "VFIO_IOMMU_SPAPR_TCE_CREATE", 0x00003b77 },
+{ "VFIO_IOMMU_SPAPR_TCE_REMOVE", 0x00003b78 },
 { "VFIO_EEH_PE_OP", 0x00003b79 },
 { "AGPIOC_ACQUIRE", 0x00004101 },
 { "APM_IOC_STANDBY", 0x00004101 },
@@ -317,11 +323,14 @@
 { "LOOP_GET_STATUS64", 0x00004c05 },
 { "LOOP_CHANGE_FD", 0x00004c06 },
 { "LOOP_SET_CAPACITY", 0x00004c07 },
+{ "LOOP_SET_DIRECT_IO", 0x00004c08 },
 { "LOOP_CTL_ADD", 0x00004c80 },
 { "LOOP_CTL_REMOVE", 0x00004c81 },
 { "LOOP_CTL_GET_FREE", 0x00004c82 },
 { "MTDFILEMODE", 0x00004d13 },
 { "NVME_IOCTL_ID", 0x00004e40 },
+{ "NVME_IOCTL_RESET", 0x00004e44 },
+{ "NVME_IOCTL_SUBSYS_RESET", 0x00004e45 },
 { "UBI_IOCVOLRMBLK", 0x00004f08 },
 { "OMAPFB_SYNC_GFX", 0x00004f25 },
 { "OMAPFB_VSYNC", 0x00004f26 },
@@ -490,7 +499,8 @@
 { "USBTMC_IOCTL_ABORT_BULK_IN", 0x00005b04 },
 { "USBTMC_IOCTL_CLEAR_OUT_HALT", 0x00005b06 },
 { "USBTMC_IOCTL_CLEAR_IN_HALT", 0x00005b07 },
-{ "ANDROID_ALARM_WAIT", 0x00006101 },
+{ "USBTMC488_IOCTL_GOTO_LOCAL", 0x00005b14 },
+{ "USBTMC488_IOCTL_LOCAL_LOCKOUT", 0x00005b15 },
 { "NS_ADJBUFLEV", 0x00006163 },
 { "SIOCSIFATMTCP", 0x00006180 },
 { "ATMTCP_CREATE", 0x0000618e },
@@ -514,6 +524,8 @@
 { "BC_ENTER_LOOPER", 0x0000630c },
 { "BC_EXIT_LOOPER", 0x0000630d },
 { "CHIOINITELEM", 0x00006311 },
+{ "KCOV_ENABLE", 0x00006364 },
+{ "KCOV_DISABLE", 0x00006365 },
 { "DRM_IOCTL_SET_MASTER", 0x0000641e },
 { "DRM_IOCTL_DROP_MASTER", 0x0000641f },
 { "DRM_IOCTL_AGP_ACQUIRE", 0x00006430 },
@@ -846,15 +858,9 @@
 { "RAW_GETBIND", 0x0000ac01 },
 { "KVM_GET_API_VERSION", 0x0000ae00 },
 { "KVM_CREATE_VM", 0x0000ae01 },
-{ "LOGGER_GET_LOG_BUF_SIZE", 0x0000ae01 },
-{ "LOGGER_GET_LOG_LEN", 0x0000ae02 },
 { "KVM_CHECK_EXTENSION", 0x0000ae03 },
-{ "LOGGER_GET_NEXT_ENTRY_LEN", 0x0000ae03 },
 { "KVM_GET_VCPU_MMAP_SIZE", 0x0000ae04 },
-{ "LOGGER_FLUSH_LOG", 0x0000ae04 },
-{ "LOGGER_GET_VERSION", 0x0000ae05 },
 { "KVM_S390_ENABLE_SIE", 0x0000ae06 },
-{ "LOGGER_SET_VERSION", 0x0000ae06 },
 { "KVM_CREATE_VCPU", 0x0000ae41 },
 { "KVM_SET_NR_MMU_PAGES", 0x0000ae44 },
 { "KVM_GET_NR_MMU_PAGES", 0x0000ae45 },
@@ -869,6 +875,7 @@
 { "KVM_SET_TSC_KHZ", 0x0000aea2 },
 { "KVM_GET_TSC_KHZ", 0x0000aea3 },
 { "KVM_KVMCLOCK_CTRL", 0x0000aead },
+{ "KVM_SMI", 0x0000aeb7 },
 { "VHOST_SET_OWNER", 0x0000af01 },
 { "VHOST_RESET_OWNER", 0x0000af02 },
 { "PPPOEIOCDFWD", 0x0000b101 },
@@ -876,11 +883,17 @@
 { "IOCTL_EVTCHN_BIND_UNBOUND_PORT", 0x00044502 },
 { "IOCTL_EVTCHN_UNBIND", 0x00044503 },
 { "IOCTL_EVTCHN_NOTIFY", 0x00044504 },
+{ "IOCTL_GNTDEV_SET_MAX_GRANTS", 0x00044703 },
 { "IOCTL_EVTCHN_BIND_INTERDOMAIN", 0x00084501 },
-{ "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", 0x40005344 },
+{ "IOCTL_GNTDEV_GRANT_COPY", 0x00084708 },
+{ "IOCTL_GNTDEV_UNMAP_GRANT_REF", 0x00104701 },
+{ "IOCTL_GNTDEV_SET_UNMAP_NOTIFY", 0x00104707 },
+{ "IOCTL_GNTDEV_MAP_GRANT_REF", 0x00184700 },
+{ "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", 0x00184702 },
 { "MFB_SET_ALPHA", 0x40014d00 },
 { "MFB_SET_GAMMA", 0x40014d01 },
 { "MFB_SET_BRIGHTNESS", 0x40014d03 },
+{ "USBTMC488_IOCTL_REN_CONTROL", 0x40015b13 },
 { "SPI_IOC_WR_MODE", 0x40016b01 },
 { "SPI_IOC_WR_LSB_FIRST", 0x40016b02 },
 { "SPI_IOC_WR_BITS_PER_WORD", 0x40016b03 },
@@ -894,6 +907,7 @@
 { "SONYPI_IOCSFAN", 0x4001760b },
 { "ATM_SETBACKEND", 0x400261f2 },
 { "ATM_NEWBACKENDIF", 0x400261f3 },
+{ "RIO_MPORT_MAINT_HDID_SET", 0x40026d01 },
 { "NCP_IOC_GETMOUNTUID", 0x40026e02 },
 { "AUDIO_SET_ATTRIBUTES", 0x40026f11 },
 { "DMX_ADD_PID", 0x40026f33 },
@@ -910,11 +924,9 @@
 { "FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE", 0x4004230e },
 { "FW_CDEV_IOC_FLUSH_ISO", 0x40042318 },
 { "PERF_EVENT_IOC_SET_FILTER", 0x40042406 },
-{ "BLKI2OSRSTRAT", 0x40043203 },
-{ "BLKI2OSWSTRAT", 0x40043204 },
+{ "PERF_EVENT_IOC_SET_BPF", 0x40042408 },
 { "SNAPSHOT_CREATE_IMAGE", 0x40043311 },
 { "PTP_ENABLE_PPS", 0x40043d04 },
-{ "SYNC_IOC_WAIT", 0x40043e00 },
 { "FBIO_RADEON_SET_MIRROR", 0x40044004 },
 { "SNDRV_PCM_IOCTL_TSTAMP", 0x40044102 },
 { "AGPIOC_SETUP", 0x40044103 },
@@ -930,6 +942,7 @@
 { "SNDRV_PCM_IOCTL_LINK", 0x40044160 },
 { "PMU_IOC_SET_BACKLIGHT", 0x40044202 },
 { "CCISS_REGNEWDISK", 0x4004420d },
+{ "CS_SET_WAKELINE", 0x40044317 },
 { "EVIOCRMFF", 0x40044581 },
 { "EVIOCGRAB", 0x40044590 },
 { "EVIOCREVOKE", 0x40044591 },
@@ -941,6 +954,7 @@
 { "FBIPUT_VSYNC", 0x4004460a },
 { "FBIO_WAITFORVSYNC", 0x40044620 },
 { "SSTFB_SET_VGAPASS", 0x400446dd },
+{ "IOCTL_MEI_NOTIFY_SET", 0x40044802 },
 { "HIDIOCSFLAG", 0x4004480f },
 { "SNDRV_EMU10K1_IOCTL_TRAM_SETUP", 0x40044820 },
 { "SNDRV_DM_FM_IOCTL_SET_MODE", 0x40044825 },
@@ -1005,8 +1019,11 @@
 { "TUNSETQUEUE", 0x400454d9 },
 { "TUNSETIFINDEX", 0x400454da },
 { "TUNSETVNETLE", 0x400454dc },
+{ "TUNSETVNETBE", 0x400454de },
+{ "NCIUARTSETDRIVER", 0x40045500 },
 { "USBDEVFS_REAPURB", 0x4004550c },
 { "USBDEVFS_REAPURBNDELAY", 0x4004550d },
+{ "USBDEVFS_DROP_PRIVILEGES", 0x4004551e },
 { "SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE", 0x40045532 },
 { "SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE", 0x40045542 },
 { "UI_SET_EVBIT", 0x40045564 },
@@ -1025,6 +1042,7 @@
 { "VIDIOC_STREAMOFF", 0x40045613 },
 { "VIDIOC_S_PRIORITY", 0x40045644 },
 { "IVTV_IOC_PASSTHROUGH_MODE", 0x400456c1 },
+{ "VIDIOC_AM437X_CCDC_CFG", 0x400456c1 },
 { "VPFE_CMD_S_CCDC_RAW_PARAMS", 0x400456c1 },
 { "SW_SYNC_IOC_INC", 0x40045701 },
 { "SNDRV_RAWMIDI_IOCTL_DROP", 0x40045730 },
@@ -1082,8 +1100,8 @@
 { "LIRC_SET_WIDEBAND_RECEIVER", 0x40046923 },
 { "SPI_IOC_WR_MAX_SPEED_HZ", 0x40046b04 },
 { "SPI_IOC_WR_MODE32", 0x40046b05 },
-{ "MSMFB_GRP_DISP", 0x40046d01 },
-{ "MSMFB_BLIT", 0x40046d02 },
+{ "RIO_MPORT_MAINT_COMPTAG_SET", 0x40046d02 },
+{ "RIO_SET_EVENT_MASK", 0x40046d0d },
 { "NCP_IOC_GETMOUNTUID2", 0x40046e02 },
 { "NCP_IOC_SET_SIGN_WANTED", 0x40046e06 },
 { "NCP_IOC_GETDENTRYTTL", 0x40046e0c },
@@ -1146,6 +1164,7 @@
 { "IXJCTL_INTERCOM_START", 0x400471fd },
 { "IXJCTL_INTERCOM_STOP", 0x400471fe },
 { "FAT_IOCTL_SET_ATTRIBUTES", 0x40047211 },
+{ "SCIF_LISTEN", 0x40047302 },
 { "PPPIOCATTCHAN", 0x40047438 },
 { "PPPIOCCONNECT", 0x4004743a },
 { "PPPIOCSMRRU", 0x4004743b },
@@ -1173,6 +1192,7 @@
 { "SIOCSNETADDR", 0x400489e0 },
 { "AUTOFS_IOC_EXPIRE_MULTI", 0x40049366 },
 { "BTRFS_IOC_CLONE", 0x40049409 },
+{ "FICLONE", 0x40049409 },
 { "BTRFS_IOC_BALANCE_CTL", 0x40049421 },
 { "KVM_S390_VCPU_FAULT", 0x4004ae52 },
 { "KVM_INTERRUPT", 0x4004ae86 },
@@ -1195,11 +1215,17 @@
 { "FE_DISEQC_SEND_MASTER_CMD", 0x40076f3f },
 { "FW_CDEV_IOC_RECEIVE_PHY_PACKETS", 0x40082316 },
 { "PERF_EVENT_IOC_PERIOD", 0x40082404 },
+{ "STP_SET_OPTIONS", 0x40082502 },
 { "CCISS_SETINTINFO", 0x40084203 },
 { "APEI_ERST_CLEAR_RECORD", 0x40084501 },
 { "EVIOCSREP", 0x40084503 },
 { "EVIOCSKEYCODE", 0x40084504 },
 { "SNDRV_SB_CSP_IOCTL_START", 0x40084813 },
+{ "AMDKFD_IOC_DESTROY_EVENT", 0x40084b09 },
+{ "AMDKFD_IOC_SET_EVENT", 0x40084b0a },
+{ "AMDKFD_IOC_RESET_EVENT", 0x40084b0b },
+{ "AMDKFD_IOC_DBG_REGISTER", 0x40084b0d },
+{ "AMDKFD_IOC_DBG_UNREGISTER", 0x40084b0e },
 { "MEMERASE", 0x40084d02 },
 { "MFB_SET_AOID", 0x40084d04 },
 { "MEMLOCK", 0x40084d05 },
@@ -1218,9 +1244,9 @@
 { "TUNDETACHFILTER", 0x400854d6 },
 { "USBDEVFS_CONNECTINFO", 0x40085511 },
 { "VIDIOC_S_STD", 0x40085618 },
-{ "ANDROID_ALARM_SET_RTC", 0x40086105 },
 { "ATM_GETNAMES", 0x40086183 },
 { "ATM_ADDPARTY", 0x400861f4 },
+{ "DMA_BUF_IOCTL_SYNC", 0x40086200 },
 { "BINDER_SET_IDLE_TIMEOUT", 0x40086203 },
 { "BC_FREE_BUFFER", 0x40086303 },
 { "CHIOGSTATUS", 0x40086308 },
@@ -1246,6 +1272,7 @@
 { "DRM_IOCTL_RADEON_CP_STOP", 0x40086442 },
 { "DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT", 0x40086443 },
 { "DRM_IOCTL_OMAP_GEM_CPU_PREP", 0x40086444 },
+{ "DRM_IOCTL_ETNAVIV_GEM_CPU_FINI", 0x40086445 },
 { "DRM_IOCTL_QXL_CLIENTCAP", 0x40086445 },
 { "DRM_IOCTL_I915_SETPARAM", 0x40086447 },
 { "DRM_IOCTL_VIA_CMDBUFFER", 0x40086448 },
@@ -1261,6 +1288,11 @@
 { "DRM_IOCTL_I915_GEM_SET_CACHING", 0x4008646f },
 { "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", 0x40086482 },
 { "MTIOCTOP", 0x40086d01 },
+{ "RIO_ENABLE_DOORBELL_RANGE", 0x40086d09 },
+{ "RIO_DISABLE_DOORBELL_RANGE", 0x40086d0a },
+{ "RIO_UNMAP_INBOUND", 0x40086d12 },
+{ "RIO_FREE_DMA", 0x40086d14 },
+{ "RIO_WAIT_FOR_ASYNC", 0x40086d16 },
 { "NILFS_IOCTL_DELETE_CHECKPOINT", 0x40086e81 },
 { "NILFS_IOCTL_RESIZE", 0x40086e8b },
 { "AUDIO_SET_MIXER", 0x40086f0e },
@@ -1293,9 +1325,13 @@
 { "VHOST_SET_LOG_BASE", 0x4008af04 },
 { "VHOST_SET_VRING_NUM", 0x4008af10 },
 { "VHOST_SET_VRING_BASE", 0x4008af12 },
+{ "VHOST_SET_VRING_ENDIAN", 0x4008af13 },
+{ "VHOST_GET_VRING_ENDIAN", 0x4008af14 },
 { "VHOST_SET_VRING_KICK", 0x4008af20 },
 { "VHOST_SET_VRING_CALL", 0x4008af21 },
 { "VHOST_SET_VRING_ERR", 0x4008af22 },
+{ "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", 0x4008af23 },
+{ "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", 0x4008af24 },
 { "VHOST_NET_SET_BACKEND", 0x4008af30 },
 { "SNDRV_DM_FM_IOCTL_SET_PARAMS", 0x40094824 },
 { "FDFMTTRK", 0x400c0248 },
@@ -1362,6 +1398,7 @@
 { "DRM_IOCTL_RADEON_SETPARAM", 0x400c6459 },
 { "DRM_IOCTL_RADEON_SURF_ALLOC", 0x400c645a },
 { "DRM_IOCTL_I915_GEM_SET_DOMAIN", 0x400c645f },
+{ "FS_IOC_GET_ENCRYPTION_POLICY", 0x400c6615 },
 { "I2OEVTREG", 0x400c690a },
 { "HSC_SET_RX", 0x400c6b13 },
 { "HSC_GET_RX", 0x400c6b14 },
@@ -1375,6 +1412,10 @@
 { "FW_CDEV_IOC_START_ISO", 0x4010230a },
 { "PTP_EXTTS_REQUEST", 0x40103d02 },
 { "CCISS_SETNODENAME", 0x40104205 },
+{ "EVIOCSMASK", 0x40104593 },
+{ "SNDRV_USB_STREAM_IOCTL_SET_PARAMS", 0x40104890 },
+{ "AMDKFD_IOC_DBG_ADDRESS_WATCH", 0x40104b0f },
+{ "AMDKFD_IOC_DBG_WAVE_CONTROL", 0x40104b10 },
 { "MEMERASE64", 0x40104d14 },
 { "UBI_IOCSETVOLPROP", 0x40104f06 },
 { "OMAPFB_SET_COLOR_KEY", 0x40104f32 },
@@ -1395,13 +1436,19 @@
 { "DRM_IOCTL_I915_HWS_ADDR", 0x40106451 },
 { "DRM_IOCTL_I915_GEM_INIT", 0x40106453 },
 { "DRM_IOCTL_SIS_AGP_FREE", 0x40106455 },
+{ "FS_IOC_GET_ENCRYPTION_PWSALT", 0x40106614 },
 { "HSC_SET_TX", 0x40106b15 },
 { "HSC_GET_TX", 0x40106b16 },
+{ "RIO_ENABLE_PORTWRITE_RANGE", 0x40106d0b },
+{ "RIO_DISABLE_PORTWRITE_RANGE", 0x40106d0c },
 { "MGSL_IOCSGPIO", 0x40106d10 },
 { "NILFS_IOCTL_CHANGE_CPMODE", 0x40106e80 },
 { "NILFS_IOCTL_SET_ALLOC_RANGE", 0x40106e8c },
 { "VIDEO_SET_HIGHLIGHT", 0x40106f27 },
 { "CA_SET_DESCR", 0x40106f86 },
+{ "IOC_PR_RESERVE", 0x401070c9 },
+{ "IOC_PR_RELEASE", 0x401070ca },
+{ "IOC_PR_CLEAR", 0x401070cd },
 { "BTRFS_IOC_QGROUP_CREATE", 0x4010942a },
 { "GENWQE_WRITE_REG64", 0x4010a51f },
 { "GENWQE_WRITE_REG32", 0x4010a521 },
@@ -1441,6 +1488,7 @@
 { "DRM_IOCTL_RM_MAP", 0x4018641b },
 { "DRM_IOCTL_I915_BATCHBUFFER", 0x40186443 },
 { "DRM_IOCTL_QXL_UPDATE_AREA", 0x40186443 },
+{ "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", 0x40186444 },
 { "DRM_IOCTL_MSM_GEM_CPU_PREP", 0x40186444 },
 { "DRM_IOCTL_MSM_WAIT_FENCE", 0x40186447 },
 { "DRM_IOCTL_RADEON_CLEAR", 0x40186448 },
@@ -1448,8 +1496,13 @@
 { "DRM_IOCTL_R128_BLIT", 0x4018644b },
 { "DRM_IOCTL_R128_DEPTH", 0x4018644c },
 { "DRM_IOCTL_RADEON_VERTEX2", 0x4018644f },
+{ "RIO_MPORT_MAINT_WRITE_LOCAL", 0x40186d06 },
+{ "RIO_MPORT_MAINT_WRITE_REMOTE", 0x40186d08 },
 { "NILFS_IOCTL_SET_SUINFO", 0x40186e8d },
 { "UBI_IOCATT", 0x40186f40 },
+{ "IOC_PR_REGISTER", 0x401870c8 },
+{ "IOC_PR_PREEMPT", 0x401870cb },
+{ "IOC_PR_PREEMPT_ABORT", 0x401870cc },
 { "BTRFS_IOC_QGROUP_ASSIGN", 0x40189429 },
 { "KVM_SET_MEMORY_REGION", 0x4018ae40 },
 { "KVM_S390_UCAS_MAP", 0x4018ae50 },
@@ -1460,29 +1513,44 @@
 { "MBXFB_IOCS_ALPHA", 0x4018f402 },
 { "FDSETPRM", 0x401c0242 },
 { "FDDEFPRM", 0x401c0243 },
+{ "UI_ABS_SETUP", 0x401c5504 },
+{ "FS_IOC_FSSETXATTR", 0x401c5820 },
 { "BR2684_SETFILT", 0x401c6190 },
 { "CHIOEXCHANGE", 0x401c6302 },
 { "OSD_SEND_CMD", 0x401c6fa0 },
 { "RTC_PLL_SET", 0x401c7012 },
+{ "CS_CONFIG_BUFS", 0x4020431f },
 { "ION_IOC_TEST_DMA_MAPPING", 0x402049f1 },
 { "ION_IOC_TEST_KERNEL_MAPPING", 0x402049f2 },
 { "AMDKFD_IOC_SET_MEMORY_POLICY", 0x40204b04 },
 { "VIDIOC_SUBSCRIBE_EVENT", 0x4020565a },
 { "VIDIOC_UNSUBSCRIBE_EVENT", 0x4020565b },
+{ "DRM_IOCTL_VIRTGPU_EXECBUFFER", 0x40206442 },
+{ "DRM_IOCTL_AMDGPU_INFO", 0x40206445 },
+{ "DRM_IOCTL_ETNAVIV_WAIT_FENCE", 0x40206447 },
+{ "DRM_IOCTL_ETNAVIV_GEM_WAIT", 0x40206449 },
 { "DRM_IOCTL_I915_GEM_PREAD", 0x4020645c },
 { "DRM_IOCTL_I915_GEM_PWRITE", 0x4020645d },
 { "MGSL_IOCSPARAMS", 0x40206d00 },
+{ "RIO_DEV_ADD", 0x40206d17 },
+{ "RIO_DEV_DEL", 0x40206d18 },
 { "PPPIOCSXASYNCMAP", 0x4020744f },
 { "BTRFS_IOC_CLONE_RANGE", 0x4020940d },
+{ "FICLONERANGE", 0x4020940d },
 { "KVM_SET_MEMORY_ALIAS", 0x4020ae43 },
 { "KVM_SET_USER_MEMORY_REGION", 0x4020ae46 },
 { "KVM_IRQFD", 0x4020ae76 },
 { "KVM_SIGNAL_MSI", 0x4020aea5 },
+{ "KVM_CREATE_SPAPR_TCE_64", 0x4020aea8 },
 { "KVM_PPC_GET_HTAB_FD", 0x4020aeaa },
 { "KVM_ARM_VCPU_INIT", 0x4020aeae },
+{ "KVM_S390_SET_IRQ_STATE", 0x4020aeb5 },
+{ "KVM_S390_GET_IRQ_STATE", 0x4020aeb6 },
 { "FW_CDEV_IOC_SEND_REQUEST", 0x40242301 },
 { "FW_CDEV_IOC_SEND_BROADCAST_REQUEST", 0x40242312 },
 { "SNDRV_COMPRESS_SET_METADATA", 0x40244314 },
+{ "NVM_DEV_REMOVE", 0x40244c23 },
+{ "NVM_DEV_FACTORY", 0x40244c25 },
 { "DRM_IOCTL_SAVAGE_BCI_CMDBUF", 0x40246441 },
 { "JSIOCSCORR", 0x40246a21 },
 { "FE_SET_FRONTEND", 0x40246f4c },
@@ -1491,12 +1559,15 @@
 { "FW_CDEV_IOC_SEND_STREAM_PACKET", 0x40282313 },
 { "EVIOCSKEYCODE_V2", 0x40284504 },
 { "SNDCTL_FM_LOAD_INSTR", 0x40285107 },
+{ "DRM_IOCTL_AMDGPU_GEM_VA", 0x40286448 },
 { "DRM_IOCTL_VIA_DMA_BLIT", 0x4028644e },
 { "DRM_IOCTL_I915_GEM_EXECBUFFER", 0x40286454 },
+{ "RIO_UNMAP_OUTBOUND", 0x40286d10 },
 { "PHN_SETREGS", 0x40287008 },
 { "RTC_WKALM_SET", 0x4028700f },
 { "VHOST_SET_VRING_ADDR", 0x4028af11 },
 { "EVIOCSFF", 0x402c4580 },
+{ "NVM_DEV_INIT", 0x402c4c24 },
 { "NVME_IOCTL_SUBMIT_IO", 0x402c4e42 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", 0x402c5342 },
 { "TCSETS2", 0x402c542b },
@@ -1538,7 +1609,12 @@
 { "KVM_X86_SET_MCE", 0x4040ae9e },
 { "KVM_SET_VCPU_EVENTS", 0x4040aea0 },
 { "KVM_ASSIGN_SET_INTX_MASK", 0x4040aea4 },
+{ "KVM_S390_MEM_OP", 0x4040aeb1 },
+{ "KVM_S390_GET_SKEYS", 0x4040aeb2 },
+{ "KVM_S390_SET_SKEYS", 0x4040aeb3 },
 { "CXL_IOCTL_START_WORK", 0x4040ca00 },
+{ "CXL_IOCTL_DOWNLOAD_IMAGE", 0x4040ca0a },
+{ "CXL_IOCTL_VALIDATE_IMAGE", 0x4040ca0b },
 { "OMAPFB_SETUP_PLANE", 0x40444f34 },
 { "OMAPFB_QUERY_PLANE", 0x40444f35 },
 { "OMAPFB_UPDATE_WINDOW", 0x40444f36 },
@@ -1548,6 +1624,7 @@
 { "SET_ARRAY_INFO", 0x40480923 },
 { "SNDRV_EMU10K1_IOCTL_PCM_POKE", 0x40484830 },
 { "KVM_SET_GUEST_DEBUG", 0x4048ae9b },
+{ "KVM_S390_IRQ", 0x4048aeb4 },
 { "GSMIOC_SETCONF", 0x404c4701 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", 0x404c534a },
 { "SNDRV_HWDEP_IOCTL_DSP_LOAD", 0x40504803 },
@@ -1560,6 +1637,7 @@
 { "FDSETDRVPRM", 0x40580290 },
 { "SNDRV_SEQ_IOCTL_SET_CLIENT_POOL", 0x4058534c },
 { "DRM_IOCTL_R128_INIT", 0x40586440 },
+{ "UI_DEV_SETUP", 0x405c5503 },
 { "DRM_IOCTL_MGA_INIT", 0x405c6440 },
 { "PTP_PIN_SETFUNC", 0x40603d07 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", 0x40605346 },
@@ -1568,6 +1646,8 @@
 { "CHIOGELEM", 0x406c6310 },
 { "KVM_SET_PIT2", 0x4070aea0 },
 { "NILFS_IOCTL_CLEAN_SEGMENTS", 0x40786e88 },
+{ "V4L2_DEVICE_NOTIFY_EVENT", 0x40787602 },
+{ "NVM_DEV_CREATE", 0x40804c22 },
 { "UBI_IOCVOLCRBLK", 0x40804f07 },
 { "KVM_PPC_GET_PVINFO", 0x4080aea1 },
 { "KVM_SET_DEBUGREGS", 0x4080aea2 },
@@ -1610,6 +1690,8 @@
 { "SNDRV_SB_CSP_IOCTL_LOAD_CODE", 0x70124811 },
 { "MFB_GET_ALPHA", 0x80014d00 },
 { "MFB_GET_GAMMA", 0x80014d01 },
+{ "USBTMC488_IOCTL_GET_CAPS", 0x80015b11 },
+{ "USBTMC488_IOCTL_READ_STB", 0x80015b12 },
 { "GADGET_GET_PRINTER_STATUS", 0x80016721 },
 { "JSIOCGAXES", 0x80016a11 },
 { "JSIOCGBUTTONS", 0x80016a12 },
@@ -1640,8 +1722,6 @@
 { "BLKBSZGET", 0x80041270 },
 { "BLKGETSIZE64", 0x80041272 },
 { "PERF_EVENT_IOC_ID", 0x80042407 },
-{ "BLKI2OGRSTRAT", 0x80043201 },
-{ "BLKI2OGWSTRAT", 0x80043202 },
 { "FBIO_RADEON_GET_MIRROR", 0x80044003 },
 { "AGPIOC_INFO", 0x80044100 },
 { "SNDRV_PCM_IOCTL_PVERSION", 0x80044100 },
@@ -1656,6 +1736,8 @@
 { "CCISS_GETFIRMVER", 0x80044208 },
 { "CCISS_GETDRIVVER", 0x80044209 },
 { "SNDRV_COMPRESS_IOCTL_VERSION", 0x80044300 },
+{ "CS_GET_STATE", 0x80044315 },
+{ "CS_GET_IF_VERSION", 0x8004431e },
 { "CAPI_GET_FLAGS", 0x80044323 },
 { "CAPI_SET_FLAGS", 0x80044324 },
 { "CAPI_CLR_FLAGS", 0x80044325 },
@@ -1672,6 +1754,7 @@
 { "SNDRV_HWDEP_IOCTL_PVERSION", 0x80044800 },
 { "HIDIOCGRDESCSIZE", 0x80044801 },
 { "HIDIOCGVERSION", 0x80044801 },
+{ "IOCTL_MEI_NOTIFY_GET", 0x80044803 },
 { "HIDIOCGFLAG", 0x8004480e },
 { "HDA_IOCTL_PVERSION", 0x80044810 },
 { "SNDRV_EMU10K1_IOCTL_PVERSION", 0x80044840 },
@@ -1733,6 +1816,7 @@
 { "TUNGETSNDBUF", 0x800454d3 },
 { "TUNGETVNETHDRSZ", 0x800454d7 },
 { "TUNGETVNETLE", 0x800454dd },
+{ "TUNGETVNETBE", 0x800454df },
 { "SNDRV_CTL_IOCTL_PVERSION", 0x80045500 },
 { "USBDEVFS_RESETEP", 0x80045503 },
 { "USBDEVFS_SETCONFIGURATION", 0x80045505 },
@@ -1760,6 +1844,7 @@
 { "SONET_GETDIAG", 0x80046114 },
 { "SONET_GETFRAMING", 0x80046116 },
 { "CM_IOCGSTATUS", 0x80046300 },
+{ "KCOV_INIT_TRACE", 0x80046301 },
 { "CHIOGPICKER", 0x80046304 },
 { "DRM_IOCTL_GET_MAGIC", 0x80046402 },
 { "DRM_IOCTL_I915_GET_VBLANK_PIPE", 0x8004644e },
@@ -1806,7 +1891,9 @@
 { "MMTIMER_GETRES", 0x80046d01 },
 { "MMTIMER_GETFREQ", 0x80046d02 },
 { "MTIOCPOS", 0x80046d03 },
+{ "RIO_MPORT_MAINT_PORT_IDX_GET", 0x80046d03 },
 { "MMTIMER_GETCOUNTER", 0x80046d09 },
+{ "RIO_GET_EVENT_MASK", 0x80046d0e },
 { "NCP_IOC_SIGN_WANTED", 0x80046e06 },
 { "NCP_IOC_SETDENTRYTTL", 0x80046e0c },
 { "MATROXFB_GET_OUTPUT_CONNECTION", 0x80046ef8 },
@@ -1871,6 +1958,7 @@
 { "GENWQE_GET_CARD_STATE", 0x8004a524 },
 { "KVM_GET_MP_STATE", 0x8004ae98 },
 { "CXL_IOCTL_GET_PROCESS_ELEMENT", 0x8004ca01 },
+{ "FUSE_DEV_IOC_CLONE", 0x8004e500 },
 { "SISFB_GET_INFO_SIZE", 0x8004f300 },
 { "SISFB_GET_VBRSTATUS", 0x8004f302 },
 { "SISFB_GET_AUTOMAXIMIZE", 0x8004f303 },
@@ -1934,6 +2022,7 @@
 { "OMAPFB_GET_CAPS", 0x800c4f2a },
 { "SNDCTL_DSP_GETIPTR", 0x800c5011 },
 { "SNDCTL_DSP_GETOPTR", 0x800c5012 },
+{ "FS_IOC_SET_ENCRYPTION_POLICY", 0x800c6613 },
 { "HPET_INFO", 0x800c6803 },
 { "IPMICTL_REGISTER_FOR_CMD_CHANS", 0x800c691c },
 { "IPMICTL_UNREGISTER_FOR_CMD_CHANS", 0x800c691d },
@@ -1944,8 +2033,10 @@
 { "FE_DISEQC_RECV_SLAVE_REPLY", 0x800c6f40 },
 { "CA_GET_SLOT_INFO", 0x800c6f82 },
 { "FDGETDRVTYP", 0x8010020f },
+{ "STP_POLICY_ID_GET", 0x80102501 },
 { "SNDRV_PCM_IOCTL_CHANNEL_INFO", 0x80104132 },
 { "CCISS_GETNODENAME", 0x80104204 },
+{ "EVIOCGMASK", 0x80104592 },
 { "SNDRV_HDSPM_IOCTL_GET_LTC", 0x80104846 },
 { "ECCGETSTATS", 0x80104d12 },
 { "OMAPFB_MEMORY_READ", 0x80104f3a },
@@ -1962,6 +2053,8 @@
 { "GENWQE_READ_REG64", 0x8010a51e },
 { "GENWQE_READ_REG32", 0x8010a520 },
 { "GENWQE_READ_REG16", 0x8010a522 },
+{ "UFFDIO_UNREGISTER", 0x8010aa01 },
+{ "UFFDIO_WAKE", 0x8010aa02 },
 { "FDGETMAXERRS", 0x8014020e },
 { "GET_DISK_INFO", 0x80140912 },
 { "SNDRV_COMPRESS_TSTAMP", 0x80144320 },
@@ -1974,6 +2067,8 @@
 { "FDWERRORGET", 0x80180217 },
 { "SNDRV_HDSPM_IOCTL_GET_CONFIG", 0x80184841 },
 { "IMSETDEVNAME", 0x80184947 },
+{ "RIO_MPORT_MAINT_READ_LOCAL", 0x80186d05 },
+{ "RIO_MPORT_MAINT_READ_REMOTE", 0x80186d07 },
 { "NCP_IOC_SIGN_INIT", 0x80186e05 },
 { "NILFS_IOCTL_GET_CPINFO", 0x80186e82 },
 { "NILFS_IOCTL_GET_CPSTAT", 0x80186e83 },
@@ -1984,6 +2079,7 @@
 { "SNDRV_COMPRESS_AVAIL", 0x801c4321 },
 { "HIDIOCGDEVINFO", 0x801c4803 },
 { "SNDRV_HDSPM_IOCTL_GET_STATUS", 0x801c4847 },
+{ "FS_IOC_FSGETXATTR", 0x801c581f },
 { "IPMICTL_SEND_COMMAND_SETTIME", 0x801c6915 },
 { "MTIOCGET", 0x801c6d02 },
 { "RTC_PLL_GET", 0x801c7011 },
@@ -2020,6 +2116,7 @@
 { "USBDEVFS_SUBMITURB", 0x802c550a },
 { "VIDIOC_G_FBUF", 0x802c560a },
 { "SOUND_OLD_MIXER_INFO", 0x80304d65 },
+{ "RIO_MPORT_GET_PROPERTIES", 0x80306d04 },
 { "NILFS_IOCTL_GET_SUSTAT", 0x80306e85 },
 { "BTRFS_IOC_QGROUP_LIMIT", 0x8030942b },
 { "KVM_GET_CLOCK", 0x8030ae7c },
@@ -2035,6 +2132,8 @@
 { "BTRFS_IOC_QUOTA_RESCAN_STATUS", 0x8040942d },
 { "KVM_ASSIGN_PCI_DEVICE", 0x8040ae69 },
 { "KVM_GET_VCPU_EVENTS", 0x8040ae9f },
+{ "CXL_IOCTL_GET_AFU_ID", 0x8040ca02 },
+{ "GPIO_GET_CHIPINFO_IOCTL", 0x8044b401 },
 { "GET_ARRAY_INFO", 0x80480911 },
 { "PPPIOCGL2TPSTATS", 0x80487436 },
 { "BTRFS_IOC_GET_SUPPORTED_FEATURES", 0x80489439 },
@@ -2094,10 +2193,10 @@
 { "SNDCTL_COPR_RCVMSG", 0x8fa44309 },
 { "GET_BITMAP_FILE", 0x90000915 },
 { "SNDRV_HDSP_IOCTL_GET_MIXER", 0x90004844 },
+{ "NVM_GET_DEVICES", 0x90004c21 },
 { "BTRFS_IOC_DEVICES_READY", 0x90009427 },
 { "KVM_GET_XSAVE", 0x9000aea4 },
 { "HIDIOCGRDESC", 0x90044802 },
-{ "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", 0xc0005343 },
 { "GADGET_SET_PRINTER_STATUS", 0xc0016722 },
 { "AGPIOC_ALLOCATE", 0xc0044106 },
 { "CAPI_GET_MANUFACTURER", 0xc0044306 },
@@ -2152,6 +2251,7 @@
 { "DRM_IOCTL_RADEON_IRQ_EMIT", 0xc0046456 },
 { "DRM_IOCTL_MODE_RMFB", 0xc00464af },
 { "DRM_IOCTL_MODE_DESTROY_DUMB", 0xc00464b4 },
+{ "DRM_IOCTL_MODE_DESTROYPROPBLOB", 0xc00464be },
 { "I8K_GET_SPEED", 0xc0046985 },
 { "I8K_GET_FAN", 0xc0046986 },
 { "I8K_SET_FAN", 0xc0046987 },
@@ -2167,8 +2267,8 @@
 { "MIC_VIRTIO_ADD_DEVICE", 0xc0047301 },
 { "MIC_VIRTIO_COPY_DESC", 0xc0047302 },
 { "MIC_VIRTIO_CONFIG_CHANGE", 0xc0047305 },
+{ "SCIF_FENCE_WAIT", 0xc0047310 },
 { "PPPIOCNEWUNIT", 0xc004743e },
-{ "TOSH_SMM", 0xc0047490 },
 { "MEYEIOC_SYNC", 0xc00476c3 },
 { "AUTOFS_IOC_SETTIMEOUT", 0xc0049364 },
 { "KVM_GET_MSR_INDEX_LIST", 0xc004ae02 },
@@ -2184,6 +2284,9 @@
 { "ION_IOC_CUSTOM", 0xc0084906 },
 { "ION_IOC_SYNC", 0xc0084907 },
 { "AMDKFD_IOC_DESTROY_QUEUE", 0xc0084b03 },
+{ "ND_IOCTL_DIMM_FLAGS", 0xc0084e03 },
+{ "ND_IOCTL_SET_CONFIG_DATA", 0xc0084e06 },
+{ "ND_IOCTL_VENDOR", 0xc0084e09 },
 { "SNDRV_CTL_IOCTL_TLV_READ", 0xc008551a },
 { "SNDRV_CTL_IOCTL_TLV_WRITE", 0xc008551b },
 { "SNDRV_CTL_IOCTL_TLV_COMMAND", 0xc008551c },
@@ -2199,13 +2302,14 @@
 { "DRM_IOCTL_RES_CTX", 0xc0086426 },
 { "DRM_IOCTL_SG_ALLOC", 0xc0086438 },
 { "DRM_IOCTL_QXL_ALLOC", 0xc0086440 },
-{ "DRM_IOCTL_TEGRA_GEM_MMAP", 0xc0086441 },
+{ "DRM_IOCTL_AMDGPU_GEM_MMAP", 0xc0086441 },
 { "DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT", 0xc0086442 },
 { "DRM_IOCTL_TEGRA_SYNCPT_READ", 0xc0086442 },
 { "DRM_IOCTL_VIA_AGP_INIT", 0xc0086442 },
 { "DRM_IOCTL_TEGRA_SYNCPT_INCR", 0xc0086443 },
 { "DRM_IOCTL_VIA_FB_INIT", 0xc0086443 },
 { "DRM_IOCTL_I915_GETPARAM", 0xc0086446 },
+{ "DRM_IOCTL_VIRTGPU_WAIT", 0xc0086448 },
 { "DRM_IOCTL_MGA_GETPARAM", 0xc0086449 },
 { "DRM_IOCTL_TEGRA_GEM_SET_FLAGS", 0xc008644c },
 { "DRM_IOCTL_TEGRA_GEM_GET_FLAGS", 0xc008644d },
@@ -2222,6 +2326,9 @@
 { "DRM_IOCTL_EXYNOS_IPP_CMD_CTRL", 0xc0086473 },
 { "NCP_IOC_GETPRIVATEDATA", 0xc0086e0a },
 { "PHN_GETREG", 0xc0087005 },
+{ "SCIF_BIND", 0xc0087301 },
+{ "SCIF_CONNECT", 0xc0087303 },
+{ "SCIF_ACCEPTREG", 0xc0087305 },
 { "PPPIOCGNPMODE", 0xc008744c },
 { "KVM_GET_SUPPORTED_CPUID", 0xc008ae05 },
 { "KVM_GET_EMULATED_CPUID", 0xc008ae09 },
@@ -2233,10 +2340,14 @@
 { "FSL_HV_IOCTL_PARTITION_STOP", 0xc008af04 },
 { "FSL_HV_IOCTL_DOORBELL", 0xc008af06 },
 { "VHOST_GET_VRING_BASE", 0xc008af12 },
+{ "MMC_IOC_MULTI_CMD", 0xc008b301 },
 { "HIDIOCGREPORTINFO", 0xc00c4809 },
 { "SNDRV_EMU10K1_IOCTL_TRAM_PEEK", 0xc00c4822 },
 { "MEMWRITEOOB", 0xc00c4d03 },
 { "MEMREADOOB", 0xc00c4d04 },
+{ "ND_IOCTL_SMART_THRESHOLD", 0xc00c4e02 },
+{ "ND_IOCTL_GET_CONFIG_SIZE", 0xc00c4e04 },
+{ "ND_IOCTL_GET_CONFIG_DATA", 0xc00c4e05 },
 { "SNDCTL_SYNTH_REMOVESAMPLE", 0xc00c5116 },
 { "USBDEVFS_IOCTL", 0xc00c5512 },
 { "UI_BEGIN_FF_ERASE", 0xc00c55ca },
@@ -2254,10 +2365,12 @@
 { "I2OHRTGET", 0xc00c6901 },
 { "I2OLCTGET", 0xc00c6902 },
 { "NCP_IOC_GETOBJECTNAME", 0xc00c6e09 },
+{ "SCIF_FENCE_MARK", 0xc00c730f },
 { "UVCIOC_CTRL_QUERY", 0xc00c7521 },
 { "KVM_CREATE_DEVICE", 0xc00caee0 },
 { "FSL_HV_IOCTL_PARTITION_GET_STATUS", 0xc00caf02 },
 { "MBXFB_IOCX_REG", 0xc00cf405 },
+{ "STP_POLICY_ID_SET", 0xc0102500 },
 { "CAPI_GET_VERSION", 0xc0104307 },
 { "GIGASET_VERSION", 0xc0104703 },
 { "IOCTL_MEI_CONNECT_CLIENT", 0xc0104801 },
@@ -2276,21 +2389,35 @@
 { "DRM_IOCTL_GET_CAP", 0xc010640c },
 { "DRM_IOCTL_AGP_ALLOC", 0xc0106434 },
 { "DRM_IOCTL_WAIT_VBLANK", 0xc010643a },
+{ "DRM_IOCTL_ETNAVIV_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_EXYNOS_GEM_CREATE", 0xc0106440 },
 { "DRM_IOCTL_MSM_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_OMAP_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_TEGRA_GEM_CREATE", 0xc0106440 },
+{ "DRM_IOCTL_EXYNOS_GEM_MAP", 0xc0106441 },
 { "DRM_IOCTL_QXL_MAP", 0xc0106441 },
+{ "DRM_IOCTL_TEGRA_GEM_MMAP", 0xc0106441 },
+{ "DRM_IOCTL_VC4_WAIT_SEQNO", 0xc0106441 },
+{ "DRM_IOCTL_VIRTGPU_MAP", 0xc0106441 },
+{ "DRM_IOCTL_AMDGPU_CTX", 0xc0106442 },
+{ "DRM_IOCTL_ETNAVIV_GEM_NEW", 0xc0106442 },
 { "DRM_IOCTL_MSM_GEM_NEW", 0xc0106442 },
+{ "DRM_IOCTL_VC4_WAIT_BO", 0xc0106442 },
+{ "DRM_IOCTL_ETNAVIV_GEM_INFO", 0xc0106443 },
 { "DRM_IOCTL_MSM_GEM_INFO", 0xc0106443 },
 { "DRM_IOCTL_OMAP_GEM_NEW", 0xc0106443 },
+{ "DRM_IOCTL_VC4_CREATE_BO", 0xc0106443 },
+{ "DRM_IOCTL_VIRTGPU_GETPARAM", 0xc0106443 },
 { "DRM_IOCTL_EXYNOS_GEM_GET", 0xc0106444 },
 { "DRM_IOCTL_QXL_GETPARAM", 0xc0106444 },
 { "DRM_IOCTL_SIS_FB_ALLOC", 0xc0106444 },
 { "DRM_IOCTL_TEGRA_SYNCPT_WAIT", 0xc0106444 },
+{ "DRM_IOCTL_VC4_MMAP_BO", 0xc0106444 },
 { "DRM_IOCTL_I810_GETBUF", 0xc0106445 },
 { "DRM_IOCTL_TEGRA_OPEN_CHANNEL", 0xc0106445 },
+{ "DRM_IOCTL_VIRTGPU_RESOURCE_INFO", 0xc0106445 },
 { "DRM_IOCTL_TEGRA_CLOSE_CHANNEL", 0xc0106446 },
+{ "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", 0xc0106447 },
 { "DRM_IOCTL_EXYNOS_VIDI_CONNECTION", 0xc0106447 },
 { "DRM_IOCTL_TEGRA_GET_SYNCPT", 0xc0106447 },
 { "DRM_IOCTL_VIA_DMA_INIT", 0xc0106447 },
@@ -2301,6 +2428,7 @@
 { "DRM_IOCTL_RADEON_INDIRECT", 0xc010644d },
 { "DRM_IOCTL_VIA_WAIT_IRQ", 0xc010644d },
 { "DRM_IOCTL_R128_INDIRECT", 0xc010644f },
+{ "DRM_IOCTL_AMDGPU_GEM_OP", 0xc0106450 },
 { "DRM_IOCTL_RADEON_ALLOC", 0xc0106453 },
 { "DRM_IOCTL_SIS_AGP_ALLOC", 0xc0106454 },
 { "DRM_IOCTL_I915_GEM_CREATE", 0xc010645b },
@@ -2314,8 +2442,11 @@
 { "DRM_IOCTL_MODE_SETPROPERTY", 0xc01064ab },
 { "DRM_IOCTL_MODE_GETPROPBLOB", 0xc01064ac },
 { "DRM_IOCTL_MODE_MAP_DUMB", 0xc01064b3 },
+{ "DRM_IOCTL_MODE_CREATEPROPBLOB", 0xc01064bd },
 { "MGSL_IOCWAITGPIO", 0xc0106d12 },
 { "DMX_GET_STC", 0xc0106f32 },
+{ "SCIF_ACCEPTREQ", 0xc0107304 },
+{ "SCIF_UNREG", 0xc0107309 },
 { "BTRFS_IOC_SPACE_INFO", 0xc0109414 },
 { "BTRFS_IOC_QUOTA_CTL", 0xc0109428 },
 { "FSL_HV_IOCTL_PARTITION_START", 0xc010af03 },
@@ -2331,15 +2462,19 @@
 { "VIDIOC_G_CROP", 0xc014563b },
 { "DRM_IOCTL_VIA_ALLOCMEM", 0xc0146440 },
 { "DRM_IOCTL_VIA_MAP_INIT", 0xc0146444 },
-{ "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", 0xc014646b },
+{ "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", 0xc014646a },
 { "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", 0xc014646b },
 { "DRM_IOCTL_MODE_GETENCODER", 0xc01464a6 },
 { "DRM_IOCTL_MODE_OBJ_SETPROPERTY", 0xc01464ba },
+{ "SCIF_SEND", 0xc0147306 },
+{ "SCIF_RECV", 0xc0147307 },
+{ "SCIF_GET_NODEIDS", 0xc014730e },
 { "FW_CDEV_IOC_ADD_DESCRIPTOR", 0xc0182306 },
 { "FW_CDEV_IOC_QUEUE_ISO", 0xc0182309 },
 { "FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE", 0xc018230d },
 { "HIDIOCGUSAGE", 0xc018480b },
 { "HIDIOCGUCODE", 0xc018480d },
+{ "AMDKFD_IOC_WAIT_EVENTS", 0xc0184b0c },
 { "MEMWRITEOOB64", 0xc0184d15 },
 { "MEMREADOOB64", 0xc0184d16 },
 { "VIDIOC_G_EXT_CTRLS", 0xc0185647 },
@@ -2352,23 +2487,35 @@
 { "DRM_IOCTL_GET_CLIENT", 0xc0186405 },
 { "DRM_IOCTL_ADD_MAP", 0xc0186415 },
 { "DRM_IOCTL_ADD_BUFS", 0xc0186416 },
+{ "DRM_IOCTL_AMDGPU_BO_LIST", 0xc0186443 },
+{ "DRM_IOCTL_AMDGPU_CS", 0xc0186444 },
+{ "DRM_IOCTL_VC4_CREATE_SHADER_BO", 0xc0186445 },
 { "DRM_IOCTL_OMAP_GEM_INFO", 0xc0186446 },
 { "DRM_IOCTL_QXL_ALLOC_SURF", 0xc0186446 },
+{ "DRM_IOCTL_ETNAVIV_GEM_USERPTR", 0xc0186448 },
+{ "DRM_IOCTL_VIRTGPU_GET_CAPS", 0xc0186449 },
 { "DRM_IOCTL_RADEON_TEXTURE", 0xc018644e },
+{ "DRM_IOCTL_AMDGPU_GEM_USERPTR", 0xc0186451 },
 { "DRM_IOCTL_I915_GEM_PIN", 0xc0186455 },
 { "DRM_IOCTL_RADEON_GEM_INFO", 0xc018645c },
 { "DRM_IOCTL_RADEON_GEM_VA", 0xc018646b },
 { "DRM_IOCTL_RADEON_GEM_USERPTR", 0xc018646d },
 { "DRM_IOCTL_I915_GET_RESET_STATS", 0xc0186472 },
 { "DRM_IOCTL_I915_GEM_USERPTR", 0xc0186473 },
+{ "DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM", 0xc0186474 },
+{ "DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM", 0xc0186475 },
 { "DRM_IOCTL_MODE_PAGE_FLIP", 0xc01864b0 },
 { "DRM_IOCTL_MODE_DIRTYFB", 0xc01864b1 },
 { "I2OPARMSET", 0xc0186903 },
 { "I2OPARMGET", 0xc0186904 },
 { "IPMICTL_RECEIVE_MSG_TRUNC", 0xc018690b },
 { "IPMICTL_RECEIVE_MSG", 0xc018690c },
+{ "RIO_ALLOC_DMA", 0xc0186d13 },
+{ "RIO_TRANSFER", 0xc0186d15 },
 { "NILFS_IOCTL_GET_VINFO", 0xc0186e86 },
 { "NILFS_IOCTL_GET_BDESCS", 0xc0186e87 },
+{ "TOSH_SMM", 0xc0187490 },
+{ "TOSHIBA_ACPI_SCI", 0xc0187491 },
 { "AUTOFS_DEV_IOCTL_VERSION", 0xc0189371 },
 { "AUTOFS_DEV_IOCTL_PROTOVER", 0xc0189372 },
 { "AUTOFS_DEV_IOCTL_PROTOSUBVER", 0xc0189373 },
@@ -2384,6 +2531,8 @@
 { "AUTOFS_DEV_IOCTL_ASKUMOUNT", 0xc018937d },
 { "AUTOFS_DEV_IOCTL_ISMOUNTPOINT", 0xc018937e },
 { "BTRFS_IOC_FILE_EXTENT_SAME", 0xc0189436 },
+{ "FIDEDUPERANGE", 0xc0189436 },
+{ "UFFDIO_API", 0xc018aa3f },
 { "KVM_TRANSLATE", 0xc018ae85 },
 { "IB_USER_MAD_REGISTER_AGENT", 0xc01c1b01 },
 { "FW_CDEV_IOC_CREATE_ISO_CONTEXT", 0xc01c2308 },
@@ -2400,13 +2549,18 @@
 { "I2OHTML", 0xc01c6909 },
 { "MEDIA_IOC_ENUM_LINKS", 0xc01c7c02 },
 { "FW_CDEV_IOC_ALLOCATE", 0xc0202302 },
+{ "AMDKFD_IOC_CREATE_EVENT", 0xc0204b08 },
+{ "ND_IOCTL_ARS_CAP", 0xc0204e01 },
+{ "ND_IOCTL_ARS_START", 0xc0204e02 },
+{ "ND_IOCTL_CLEAR_ERROR", 0xc0204e04 },
 { "VIDIOC_OMAP3ISP_CCDC_CFG", 0xc02056c1 },
 { "VIDIOC_OMAP3ISP_AEWB_CFG", 0xc02056c3 },
 { "SNDRV_RAWMIDI_IOCTL_PARAMS", 0xc0205710 },
 { "X86_IOC_RDMSR_REGS", 0xc02063a0 },
 { "X86_IOC_WRMSR_REGS", 0xc02063a1 },
+{ "DRM_IOCTL_AMDGPU_GEM_CREATE", 0xc0206440 },
 { "DRM_IOCTL_MSM_GEM_SUBMIT", 0xc0206446 },
-{ "DRM_IOCTL_I915_GEM_MMAP", 0xc020645e },
+{ "DRM_IOCTL_AMDGPU_WAIT_CS", 0xc0206449 },
 { "DRM_IOCTL_RADEON_GEM_MMAP", 0xc020645e },
 { "DRM_IOCTL_RADEON_GEM_PREAD", 0xc0206461 },
 { "DRM_IOCTL_RADEON_GEM_PWRITE", 0xc0206462 },
@@ -2418,6 +2572,8 @@
 { "FS_IOC_FIEMAP", 0xc020660b },
 { "GENWQE_PIN_MEM", 0xc020a528 },
 { "GENWQE_UNPIN_MEM", 0xc020a529 },
+{ "UFFDIO_REGISTER", 0xc020aa00 },
+{ "UFFDIO_ZEROPAGE", 0xc020aa04 },
 { "SNDCTL_MIDI_MPUCMD", 0xc0216d02 },
 { "FW_CDEV_IOC_GET_INFO", 0xc0242300 },
 { "SNDRV_COMPRESS_GET_METADATA", 0xc0244315 },
@@ -2427,8 +2583,15 @@
 { "VIDIOC_S_EDID", 0xc0245629 },
 { "SNDRV_RAWMIDI_IOCTL_STATUS", 0xc0245720 },
 { "DRM_IOCTL_VERSION", 0xc0246400 },
+{ "DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST", 0xc0246446 },
+{ "DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST", 0xc0246447 },
 { "DRM_IOCTL_MODE_CURSOR2", 0xc02464bb },
 { "NCP_IOC_GET_FS_INFO_V2", 0xc0246e04 },
+{ "SCIF_READFROM", 0xc024730a },
+{ "SCIF_WRITETO", 0xc024730b },
+{ "SCIF_VREADFROM", 0xc024730c },
+{ "SCIF_VWRITETO", 0xc024730d },
+{ "SCIF_FENCE_SIGNAL", 0xc0247311 },
 { "IB_USER_MAD_REGISTER_AGENT2", 0xc0281b04 },
 { "SYNC_IOC_MERGE", 0xc0283e01 },
 { "SYNC_IOC_FENCE_INFO", 0xc0283e02 },
@@ -2437,11 +2600,16 @@
 { "VIDIOC_TRY_ENCODER_CMD", 0xc028564e },
 { "SW_SYNC_IOC_CREATE_FENCE", 0xc0285700 },
 { "DRM_IOCTL_DMA", 0xc0286429 },
+{ "DRM_IOCTL_I915_GEM_MMAP", 0xc028645e },
 { "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", 0xc0286461 },
 { "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", 0xc0286472 },
 { "DRM_IOCTL_NOUVEAU_GEM_INFO", 0xc0286484 },
+{ "RIO_MAP_OUTBOUND", 0xc0286d0f },
+{ "RIO_MAP_INBOUND", 0xc0286d11 },
 { "NCP_IOC_GET_FS_INFO", 0xc0286e04 },
 { "PHN_GETREGS", 0xc0287007 },
+{ "SCIF_REG", 0xc0287308 },
+{ "UFFDIO_COPY", 0xc028aa03 },
 { "KVM_TPR_ACCESS_REPORTING", 0xc028ae92 },
 { "FSL_HV_IOCTL_MEMCPY", 0xc028af05 },
 { "FSL_HV_IOCTL_GETPROP", 0xc028af07 },
@@ -2454,12 +2622,14 @@
 { "VIDIOC_ENUM_FRAMESIZES", 0xc02c564a },
 { "DRM_IOCTL_I915_OVERLAY_ATTRS", 0xc02c6468 },
 { "MEMWRITE", 0xc0304d18 },
+{ "ND_IOCTL_ARS_STATUS", 0xc0304e03 },
 { "SNDRV_SEQ_IOCTL_SYSTEM_INFO", 0xc0305302 },
 { "VIDIOC_SUBDEV_ENUM_MBUS_CODE", 0xc0305602 },
 { "VIDIOC_SUBDEV_G_FRAME_INTERVAL", 0xc0305615 },
 { "VIDIOC_SUBDEV_S_FRAME_INTERVAL", 0xc0305616 },
 { "VIDIOC_OMAP3ISP_HIST_CFG", 0xc03056c4 },
 { "BINDER_WRITE_READ", 0xc0306201 },
+{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0306446 },
 { "DRM_IOCTL_NOUVEAU_GEM_NEW", 0xc0306480 },
 { "DRM_IOCTL_MODE_SETPLANE", 0xc03064b7 },
 { "MBXFB_IOCX_OVERLAY", 0xc030f400 },
@@ -2471,12 +2641,15 @@
 { "VIDIOC_SUBDEV_G_CROP", 0xc038563b },
 { "VIDIOC_SUBDEV_S_CROP", 0xc038563c },
 { "VIDIOC_DBG_G_REGISTER", 0xc0385650 },
+{ "DRM_IOCTL_VIRTGPU_RESOURCE_CREATE", 0xc0386444 },
+{ "DRM_IOCTL_MODE_ATOMIC", 0xc03864bc },
 { "BTRFS_IOC_INO_PATHS", 0xc0389423 },
 { "BTRFS_IOC_LOGICAL_INO", 0xc0389424 },
 { "GENWQE_SLU_UPDATE", 0xc038a550 },
 { "GENWQE_SLU_READ", 0xc038a551 },
 { "VIDIOC_OMAP3ISP_PRV_CFG", 0xc03c56c2 },
 { "BLKTRACESETUP", 0xc0401273 },
+{ "PTP_SYS_OFFSET_PRECISE", 0xc0403d08 },
 { "CAPI_GET_PROFILE", 0xc0404309 },
 { "SNDRV_TIMER_IOCTL_GSTATUS", 0xc0405405 },
 { "SNDRV_CTL_IOCTL_ELEM_REMOVE", 0xc0405519 },
@@ -2499,7 +2672,6 @@
 { "VIDIOC_QUERYCTRL", 0xc0445624 },
 { "VIDIOC_G_MODULATOR", 0xc0445636 },
 { "VIDIOC_PREPARE_BUF", 0xc044565d },
-{ "DRM_IOCTL_MODE_ADDFB2", 0xc04464b8 },
 { "FBIO_CURSOR", 0xc0484608 },
 { "SNDRV_EMU10K1_IOCTL_PCM_PEEK", 0xc0484831 },
 { "NVME_IOCTL_ADMIN_CMD", 0xc0484e41 },
@@ -2512,8 +2684,10 @@
 { "DRM_IOCTL_MODE_DETACHMODE", 0xc04864a9 },
 { "VIDEO_COMMAND", 0xc0486f3b },
 { "VIDEO_TRY_COMMAND", 0xc0486f3c },
+{ "MEDIA_IOC_G_TOPOLOGY", 0xc0487c04 },
 { "KVM_GET_PIT", 0xc048ae65 },
 { "MMC_IOC_CMD", 0xc048b300 },
+{ "GPIO_GET_LINEINFO_IOCTL", 0xc048b402 },
 { "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", 0xc04c5349 },
 { "VIDIOC_ENUMINPUT", 0xc04c561a },
 { "VIDIOC_OMAP3ISP_AF_CFG", 0xc04c56c5 },
@@ -2536,14 +2710,25 @@
 { "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", 0xc0605345 },
 { "UI_BEGIN_FF_UPLOAD", 0xc06055c8 },
 { "DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY", 0xc0606471 },
+{ "DK_CXLFLASH_DETACH", 0xc060ca83 },
+{ "DRM_IOCTL_MODE_ADDFB2", 0xc06464b8 },
 { "SNDRV_PCM_IOCTL_SW_PARAMS", 0xc0684113 },
 { "DRM_IOCTL_MODE_GETCRTC", 0xc06864a1 },
 { "DRM_IOCTL_MODE_SETCRTC", 0xc06864a2 },
+{ "DK_CXLFLASH_RELEASE", 0xc068ca82 },
+{ "DK_CXLFLASH_MANAGE_LUN", 0xc068ca86 },
+{ "SNDRV_PCM_IOCTL_STATUS_EXT", 0xc06c4124 },
 { "BTRFS_IOC_TREE_SEARCH_V2", 0xc0709411 },
+{ "DK_CXLFLASH_USER_DIRECT", 0xc070ca81 },
+{ "DK_CXLFLASH_VLUN_CLONE", 0xc070ca89 },
 { "SNDCTL_MIDI_INFO", 0xc074510c },
 { "VIDIOC_G_SLICED_VBI_CAP", 0xc0745645 },
+{ "DK_CXLFLASH_RECOVER_AFU", 0xc078ca85 },
+{ "DK_CXLFLASH_USER_VIRTUAL", 0xc078ca87 },
+{ "DK_CXLFLASH_VLUN_RESIZE", 0xc078ca88 },
 { "SOUND_MIXER_ACCESS", 0xc0804d66 },
 { "SNDRV_PCM_IOCTL_SYNC_PTR", 0xc0844123 },
+{ "ND_IOCTL_SMART", 0xc0844e01 },
 { "VIDIOC_SUBDEV_S_DV_TIMINGS", 0xc0845657 },
 { "VIDIOC_S_DV_TIMINGS", 0xc0845657 },
 { "VIDIOC_G_DV_TIMINGS", 0xc0845658 },
@@ -2557,8 +2742,12 @@
 { "SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE", 0xc08c5336 },
 { "VIDIOC_DV_TIMINGS_CAP", 0xc0905664 },
 { "VIDIOC_SUBDEV_DV_TIMINGS_CAP", 0xc0905664 },
+{ "DK_CXLFLASH_ATTACH", 0xc090ca80 },
+{ "DK_CXLFLASH_VERIFY", 0xc090ca84 },
 { "VIDIOC_ENUM_DV_TIMINGS", 0xc0945662 },
 { "VIDIOC_SUBDEV_ENUM_DV_TIMINGS", 0xc0945662 },
+{ "DRM_IOCTL_VC4_SUBMIT_CL", 0xc0a06440 },
+{ "DRM_IOCTL_VC4_GET_HANG_STATE", 0xc0a06446 },
 { "SOUND_MIXER_GETLEVELS", 0xc0a44d74 },
 { "SOUND_MIXER_SETLEVELS", 0xc0a44d75 },
 { "SNDRV_SEQ_IOCTL_CREATE_PORT", 0xc0a45320 },
@@ -2585,6 +2774,7 @@
 { "SNDRV_CTL_IOCTL_ELEM_INFO", 0xc1105511 },
 { "SNDRV_CTL_IOCTL_ELEM_ADD", 0xc1105517 },
 { "SNDRV_CTL_IOCTL_ELEM_REPLACE", 0xc1105518 },
+{ "DRM_IOCTL_AMDGPU_GEM_METADATA", 0xc11c6446 },
 { "SNDRV_CTL_IOCTL_PCM_INFO", 0xc1205531 },
 { "DM_VERSION", 0xc138fd00 },
 { "DM_REMOVE_ALL", 0xc138fd01 },
@@ -2617,6 +2807,7 @@
 { "SNDCTL_COPR_SENDMSG", 0xcfa44308 },
 { "SNDCTL_SYNTH_CONTROL", 0xcfa45115 },
 { "SNDCTL_COPR_LOAD", 0xcfb04301 },
+{ "NVM_INFO", 0xd0004c20 },
 { "BTRFS_IOC_TREE_SEARCH", 0xd0009411 },
 { "BTRFS_IOC_INO_LOOKUP", 0xd0009412 },
 { "BTRFS_IOC_DEV_INFO", 0xd000941e },
diff --git a/ioctlent2.h b/ioctlent2.h
index e7a3e8e..06e2e7f 100644
--- a/ioctlent2.h
+++ b/ioctlent2.h
@@ -83,6 +83,7 @@
 { "STOP_ARRAY", 0x00000932 },
 { "STOP_ARRAY_RO", 0x00000933 },
 { "RESTART_ARRAY_RW", 0x00000934 },
+{ "CLUSTERED_DISK_NACK", 0x00000935 },
 { "BLKROSET", 0x0000125d },
 { "BLKROGET", 0x0000125e },
 { "BLKRRPART", 0x0000125f },
@@ -108,6 +109,7 @@
 { "BLKSECDISCARD", 0x0000127d },
 { "BLKROTATIONAL", 0x0000127e },
 { "BLKZEROOUT", 0x0000127f },
+{ "BLKDAXGET", 0x00001281 },
 { "IB_USER_MAD_ENABLE_PKEY", 0x00001b03 },
 { "SG_SET_TIMEOUT", 0x00002201 },
 { "SG_GET_TIMEOUT", 0x00002202 },
@@ -169,6 +171,10 @@
 { "VFIO_IOMMU_UNMAP_DMA", 0x00003b72 },
 { "VFIO_IOMMU_ENABLE", 0x00003b73 },
 { "VFIO_IOMMU_DISABLE", 0x00003b74 },
+{ "VFIO_IOMMU_SPAPR_REGISTER_MEMORY", 0x00003b75 },
+{ "VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY", 0x00003b76 },
+{ "VFIO_IOMMU_SPAPR_TCE_CREATE", 0x00003b77 },
+{ "VFIO_IOMMU_SPAPR_TCE_REMOVE", 0x00003b78 },
 { "VFIO_EEH_PE_OP", 0x00003b79 },
 { "AGPIOC_ACQUIRE", 0x00004101 },
 { "APM_IOC_STANDBY", 0x00004101 },
@@ -317,11 +323,14 @@
 { "LOOP_GET_STATUS64", 0x00004c05 },
 { "LOOP_CHANGE_FD", 0x00004c06 },
 { "LOOP_SET_CAPACITY", 0x00004c07 },
+{ "LOOP_SET_DIRECT_IO", 0x00004c08 },
 { "LOOP_CTL_ADD", 0x00004c80 },
 { "LOOP_CTL_REMOVE", 0x00004c81 },
 { "LOOP_CTL_GET_FREE", 0x00004c82 },
 { "MTDFILEMODE", 0x00004d13 },
 { "NVME_IOCTL_ID", 0x00004e40 },
+{ "NVME_IOCTL_RESET", 0x00004e44 },
+{ "NVME_IOCTL_SUBSYS_RESET", 0x00004e45 },
 { "UBI_IOCVOLRMBLK", 0x00004f08 },
 { "OMAPFB_SYNC_GFX", 0x00004f25 },
 { "OMAPFB_VSYNC", 0x00004f26 },
@@ -490,7 +499,8 @@
 { "USBTMC_IOCTL_ABORT_BULK_IN", 0x00005b04 },
 { "USBTMC_IOCTL_CLEAR_OUT_HALT", 0x00005b06 },
 { "USBTMC_IOCTL_CLEAR_IN_HALT", 0x00005b07 },
-{ "ANDROID_ALARM_WAIT", 0x00006101 },
+{ "USBTMC488_IOCTL_GOTO_LOCAL", 0x00005b14 },
+{ "USBTMC488_IOCTL_LOCAL_LOCKOUT", 0x00005b15 },
 { "NS_ADJBUFLEV", 0x00006163 },
 { "SIOCSIFATMTCP", 0x00006180 },
 { "ATMTCP_CREATE", 0x0000618e },
@@ -514,6 +524,8 @@
 { "BC_ENTER_LOOPER", 0x0000630c },
 { "BC_EXIT_LOOPER", 0x0000630d },
 { "CHIOINITELEM", 0x00006311 },
+{ "KCOV_ENABLE", 0x00006364 },
+{ "KCOV_DISABLE", 0x00006365 },
 { "DRM_IOCTL_SET_MASTER", 0x0000641e },
 { "DRM_IOCTL_DROP_MASTER", 0x0000641f },
 { "DRM_IOCTL_AGP_ACQUIRE", 0x00006430 },
@@ -846,15 +858,9 @@
 { "RAW_GETBIND", 0x0000ac01 },
 { "KVM_GET_API_VERSION", 0x0000ae00 },
 { "KVM_CREATE_VM", 0x0000ae01 },
-{ "LOGGER_GET_LOG_BUF_SIZE", 0x0000ae01 },
-{ "LOGGER_GET_LOG_LEN", 0x0000ae02 },
 { "KVM_CHECK_EXTENSION", 0x0000ae03 },
-{ "LOGGER_GET_NEXT_ENTRY_LEN", 0x0000ae03 },
 { "KVM_GET_VCPU_MMAP_SIZE", 0x0000ae04 },
-{ "LOGGER_FLUSH_LOG", 0x0000ae04 },
-{ "LOGGER_GET_VERSION", 0x0000ae05 },
 { "KVM_S390_ENABLE_SIE", 0x0000ae06 },
-{ "LOGGER_SET_VERSION", 0x0000ae06 },
 { "KVM_CREATE_VCPU", 0x0000ae41 },
 { "KVM_SET_NR_MMU_PAGES", 0x0000ae44 },
 { "KVM_GET_NR_MMU_PAGES", 0x0000ae45 },
@@ -869,6 +875,7 @@
 { "KVM_SET_TSC_KHZ", 0x0000aea2 },
 { "KVM_GET_TSC_KHZ", 0x0000aea3 },
 { "KVM_KVMCLOCK_CTRL", 0x0000aead },
+{ "KVM_SMI", 0x0000aeb7 },
 { "VHOST_SET_OWNER", 0x0000af01 },
 { "VHOST_RESET_OWNER", 0x0000af02 },
 { "PPPOEIOCDFWD", 0x0000b101 },
@@ -876,11 +883,17 @@
 { "IOCTL_EVTCHN_BIND_UNBOUND_PORT", 0x00044502 },
 { "IOCTL_EVTCHN_UNBIND", 0x00044503 },
 { "IOCTL_EVTCHN_NOTIFY", 0x00044504 },
+{ "IOCTL_GNTDEV_SET_MAX_GRANTS", 0x00044703 },
 { "IOCTL_EVTCHN_BIND_INTERDOMAIN", 0x00084501 },
-{ "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", 0x40005344 },
+{ "IOCTL_GNTDEV_GRANT_COPY", 0x00084708 },
+{ "IOCTL_GNTDEV_UNMAP_GRANT_REF", 0x00104701 },
+{ "IOCTL_GNTDEV_SET_UNMAP_NOTIFY", 0x00104707 },
+{ "IOCTL_GNTDEV_MAP_GRANT_REF", 0x00184700 },
+{ "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", 0x00184702 },
 { "MFB_SET_ALPHA", 0x40014d00 },
 { "MFB_SET_GAMMA", 0x40014d01 },
 { "MFB_SET_BRIGHTNESS", 0x40014d03 },
+{ "USBTMC488_IOCTL_REN_CONTROL", 0x40015b13 },
 { "SPI_IOC_WR_MODE", 0x40016b01 },
 { "SPI_IOC_WR_LSB_FIRST", 0x40016b02 },
 { "SPI_IOC_WR_BITS_PER_WORD", 0x40016b03 },
@@ -894,6 +907,7 @@
 { "SONYPI_IOCSFAN", 0x4001760b },
 { "ATM_SETBACKEND", 0x400261f2 },
 { "ATM_NEWBACKENDIF", 0x400261f3 },
+{ "RIO_MPORT_MAINT_HDID_SET", 0x40026d01 },
 { "NCP_IOC_GETMOUNTUID", 0x40026e02 },
 { "AUDIO_SET_ATTRIBUTES", 0x40026f11 },
 { "DMX_ADD_PID", 0x40026f33 },
@@ -910,11 +924,9 @@
 { "FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE", 0x4004230e },
 { "FW_CDEV_IOC_FLUSH_ISO", 0x40042318 },
 { "PERF_EVENT_IOC_SET_FILTER", 0x40042406 },
-{ "BLKI2OSRSTRAT", 0x40043203 },
-{ "BLKI2OSWSTRAT", 0x40043204 },
+{ "PERF_EVENT_IOC_SET_BPF", 0x40042408 },
 { "SNAPSHOT_CREATE_IMAGE", 0x40043311 },
 { "PTP_ENABLE_PPS", 0x40043d04 },
-{ "SYNC_IOC_WAIT", 0x40043e00 },
 { "FBIO_RADEON_SET_MIRROR", 0x40044004 },
 { "SNDRV_PCM_IOCTL_TSTAMP", 0x40044102 },
 { "AGPIOC_SETUP", 0x40044103 },
@@ -930,6 +942,7 @@
 { "SNDRV_PCM_IOCTL_LINK", 0x40044160 },
 { "PMU_IOC_SET_BACKLIGHT", 0x40044202 },
 { "CCISS_REGNEWDISK", 0x4004420d },
+{ "CS_SET_WAKELINE", 0x40044317 },
 { "EVIOCRMFF", 0x40044581 },
 { "EVIOCGRAB", 0x40044590 },
 { "EVIOCREVOKE", 0x40044591 },
@@ -941,6 +954,7 @@
 { "FBIPUT_VSYNC", 0x4004460a },
 { "FBIO_WAITFORVSYNC", 0x40044620 },
 { "SSTFB_SET_VGAPASS", 0x400446dd },
+{ "IOCTL_MEI_NOTIFY_SET", 0x40044802 },
 { "HIDIOCSFLAG", 0x4004480f },
 { "SNDRV_EMU10K1_IOCTL_TRAM_SETUP", 0x40044820 },
 { "SNDRV_DM_FM_IOCTL_SET_MODE", 0x40044825 },
@@ -1005,8 +1019,11 @@
 { "TUNSETQUEUE", 0x400454d9 },
 { "TUNSETIFINDEX", 0x400454da },
 { "TUNSETVNETLE", 0x400454dc },
+{ "TUNSETVNETBE", 0x400454de },
+{ "NCIUARTSETDRIVER", 0x40045500 },
 { "USBDEVFS_REAPURB", 0x4004550c },
 { "USBDEVFS_REAPURBNDELAY", 0x4004550d },
+{ "USBDEVFS_DROP_PRIVILEGES", 0x4004551e },
 { "SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE", 0x40045532 },
 { "SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE", 0x40045542 },
 { "UI_SET_EVBIT", 0x40045564 },
@@ -1025,6 +1042,7 @@
 { "VIDIOC_STREAMOFF", 0x40045613 },
 { "VIDIOC_S_PRIORITY", 0x40045644 },
 { "IVTV_IOC_PASSTHROUGH_MODE", 0x400456c1 },
+{ "VIDIOC_AM437X_CCDC_CFG", 0x400456c1 },
 { "VPFE_CMD_S_CCDC_RAW_PARAMS", 0x400456c1 },
 { "SW_SYNC_IOC_INC", 0x40045701 },
 { "SNDRV_RAWMIDI_IOCTL_DROP", 0x40045730 },
@@ -1082,8 +1100,8 @@
 { "LIRC_SET_WIDEBAND_RECEIVER", 0x40046923 },
 { "SPI_IOC_WR_MAX_SPEED_HZ", 0x40046b04 },
 { "SPI_IOC_WR_MODE32", 0x40046b05 },
-{ "MSMFB_GRP_DISP", 0x40046d01 },
-{ "MSMFB_BLIT", 0x40046d02 },
+{ "RIO_MPORT_MAINT_COMPTAG_SET", 0x40046d02 },
+{ "RIO_SET_EVENT_MASK", 0x40046d0d },
 { "NCP_IOC_GETMOUNTUID2", 0x40046e02 },
 { "NCP_IOC_SET_SIGN_WANTED", 0x40046e06 },
 { "NCP_IOC_GETDENTRYTTL", 0x40046e0c },
@@ -1146,6 +1164,7 @@
 { "IXJCTL_INTERCOM_START", 0x400471fd },
 { "IXJCTL_INTERCOM_STOP", 0x400471fe },
 { "FAT_IOCTL_SET_ATTRIBUTES", 0x40047211 },
+{ "SCIF_LISTEN", 0x40047302 },
 { "PPPIOCATTCHAN", 0x40047438 },
 { "PPPIOCCONNECT", 0x4004743a },
 { "PPPIOCSMRRU", 0x4004743b },
@@ -1173,6 +1192,7 @@
 { "SIOCSNETADDR", 0x400489e0 },
 { "AUTOFS_IOC_EXPIRE_MULTI", 0x40049366 },
 { "BTRFS_IOC_CLONE", 0x40049409 },
+{ "FICLONE", 0x40049409 },
 { "BTRFS_IOC_BALANCE_CTL", 0x40049421 },
 { "KVM_S390_VCPU_FAULT", 0x4004ae52 },
 { "KVM_INTERRUPT", 0x4004ae86 },
@@ -1195,11 +1215,17 @@
 { "FE_DISEQC_SEND_MASTER_CMD", 0x40076f3f },
 { "FW_CDEV_IOC_RECEIVE_PHY_PACKETS", 0x40082316 },
 { "PERF_EVENT_IOC_PERIOD", 0x40082404 },
+{ "STP_SET_OPTIONS", 0x40082502 },
 { "CCISS_SETINTINFO", 0x40084203 },
 { "APEI_ERST_CLEAR_RECORD", 0x40084501 },
 { "EVIOCSREP", 0x40084503 },
 { "EVIOCSKEYCODE", 0x40084504 },
 { "SNDRV_SB_CSP_IOCTL_START", 0x40084813 },
+{ "AMDKFD_IOC_DESTROY_EVENT", 0x40084b09 },
+{ "AMDKFD_IOC_SET_EVENT", 0x40084b0a },
+{ "AMDKFD_IOC_RESET_EVENT", 0x40084b0b },
+{ "AMDKFD_IOC_DBG_REGISTER", 0x40084b0d },
+{ "AMDKFD_IOC_DBG_UNREGISTER", 0x40084b0e },
 { "MEMERASE", 0x40084d02 },
 { "MFB_SET_AOID", 0x40084d04 },
 { "MEMLOCK", 0x40084d05 },
@@ -1220,6 +1246,7 @@
 { "VIDIOC_S_STD", 0x40085618 },
 { "ATM_GETNAMES", 0x40086183 },
 { "ATM_ADDPARTY", 0x400861f4 },
+{ "DMA_BUF_IOCTL_SYNC", 0x40086200 },
 { "BINDER_SET_IDLE_TIMEOUT", 0x40086203 },
 { "BC_FREE_BUFFER", 0x40086303 },
 { "CHIOGSTATUS", 0x40086308 },
@@ -1245,6 +1272,7 @@
 { "DRM_IOCTL_RADEON_CP_STOP", 0x40086442 },
 { "DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT", 0x40086443 },
 { "DRM_IOCTL_OMAP_GEM_CPU_PREP", 0x40086444 },
+{ "DRM_IOCTL_ETNAVIV_GEM_CPU_FINI", 0x40086445 },
 { "DRM_IOCTL_QXL_CLIENTCAP", 0x40086445 },
 { "DRM_IOCTL_I915_SETPARAM", 0x40086447 },
 { "DRM_IOCTL_VIA_CMDBUFFER", 0x40086448 },
@@ -1260,6 +1288,11 @@
 { "DRM_IOCTL_I915_GEM_SET_CACHING", 0x4008646f },
 { "DRM_IOCTL_NOUVEAU_GEM_CPU_PREP", 0x40086482 },
 { "MTIOCTOP", 0x40086d01 },
+{ "RIO_ENABLE_DOORBELL_RANGE", 0x40086d09 },
+{ "RIO_DISABLE_DOORBELL_RANGE", 0x40086d0a },
+{ "RIO_UNMAP_INBOUND", 0x40086d12 },
+{ "RIO_FREE_DMA", 0x40086d14 },
+{ "RIO_WAIT_FOR_ASYNC", 0x40086d16 },
 { "NILFS_IOCTL_DELETE_CHECKPOINT", 0x40086e81 },
 { "NILFS_IOCTL_RESIZE", 0x40086e8b },
 { "AUDIO_SET_MIXER", 0x40086f0e },
@@ -1291,9 +1324,13 @@
 { "VHOST_SET_LOG_BASE", 0x4008af04 },
 { "VHOST_SET_VRING_NUM", 0x4008af10 },
 { "VHOST_SET_VRING_BASE", 0x4008af12 },
+{ "VHOST_SET_VRING_ENDIAN", 0x4008af13 },
+{ "VHOST_GET_VRING_ENDIAN", 0x4008af14 },
 { "VHOST_SET_VRING_KICK", 0x4008af20 },
 { "VHOST_SET_VRING_CALL", 0x4008af21 },
 { "VHOST_SET_VRING_ERR", 0x4008af22 },
+{ "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", 0x4008af23 },
+{ "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", 0x4008af24 },
 { "VHOST_NET_SET_BACKEND", 0x4008af30 },
 { "SNDRV_DM_FM_IOCTL_SET_PARAMS", 0x40094824 },
 { "FDFMTTRK", 0x400c0248 },
@@ -1350,6 +1387,7 @@
 { "DRM_IOCTL_RADEON_INIT_HEAP", 0x400c6455 },
 { "DRM_IOCTL_RADEON_SURF_ALLOC", 0x400c645a },
 { "DRM_IOCTL_I915_GEM_SET_DOMAIN", 0x400c645f },
+{ "FS_IOC_GET_ENCRYPTION_POLICY", 0x400c6615 },
 { "I2OEVTREG", 0x400c690a },
 { "HSC_SET_RX", 0x400c6b13 },
 { "HSC_GET_RX", 0x400c6b14 },
@@ -1363,6 +1401,10 @@
 { "FW_CDEV_IOC_SET_ISO_CHANNELS", 0x40102317 },
 { "PTP_EXTTS_REQUEST", 0x40103d02 },
 { "CCISS_SETNODENAME", 0x40104205 },
+{ "EVIOCSMASK", 0x40104593 },
+{ "SNDRV_USB_STREAM_IOCTL_SET_PARAMS", 0x40104890 },
+{ "AMDKFD_IOC_DBG_ADDRESS_WATCH", 0x40104b0f },
+{ "AMDKFD_IOC_DBG_WAVE_CONTROL", 0x40104b10 },
 { "MTRRIOC_ADD_ENTRY", 0x40104d00 },
 { "MTRRIOC_SET_ENTRY", 0x40104d01 },
 { "MTRRIOC_DEL_ENTRY", 0x40104d02 },
@@ -1375,7 +1417,6 @@
 { "UBI_IOCSETVOLPROP", 0x40104f06 },
 { "OMAPFB_SET_COLOR_KEY", 0x40104f32 },
 { "OMAPFB_GET_COLOR_KEY", 0x40104f33 },
-{ "ANDROID_ALARM_SET_RTC", 0x40106105 },
 { "BC_INCREFS_DONE", 0x40106308 },
 { "BC_ACQUIRE_DONE", 0x40106309 },
 { "DRM_IOCTL_SET_CLIENT_CAP", 0x4010640d },
@@ -1393,14 +1434,20 @@
 { "DRM_IOCTL_I915_GEM_INIT", 0x40106453 },
 { "DRM_IOCTL_SIS_AGP_FREE", 0x40106455 },
 { "DRM_IOCTL_RADEON_SETPARAM", 0x40106459 },
+{ "FS_IOC_GET_ENCRYPTION_PWSALT", 0x40106614 },
 { "HSC_SET_TX", 0x40106b15 },
 { "HSC_GET_TX", 0x40106b16 },
+{ "RIO_ENABLE_PORTWRITE_RANGE", 0x40106d0b },
+{ "RIO_DISABLE_PORTWRITE_RANGE", 0x40106d0c },
 { "MGSL_IOCSGPIO", 0x40106d10 },
 { "NILFS_IOCTL_CHANGE_CPMODE", 0x40106e80 },
 { "NILFS_IOCTL_SET_ALLOC_RANGE", 0x40106e8c },
 { "VIDEO_SET_HIGHLIGHT", 0x40106f27 },
 { "CA_SET_DESCR", 0x40106f86 },
 { "PPSETTIME", 0x40107096 },
+{ "IOC_PR_RESERVE", 0x401070c9 },
+{ "IOC_PR_RELEASE", 0x401070ca },
+{ "IOC_PR_CLEAR", 0x401070cd },
 { "BTRFS_IOC_QGROUP_CREATE", 0x4010942a },
 { "GENWQE_WRITE_REG64", 0x4010a51f },
 { "GENWQE_WRITE_REG32", 0x4010a521 },
@@ -1441,6 +1488,7 @@
 { "DRM_IOCTL_UPDATE_DRAW", 0x4018643f },
 { "DRM_IOCTL_I915_BATCHBUFFER", 0x40186443 },
 { "DRM_IOCTL_QXL_UPDATE_AREA", 0x40186443 },
+{ "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", 0x40186444 },
 { "DRM_IOCTL_MSM_GEM_CPU_PREP", 0x40186444 },
 { "DRM_IOCTL_MSM_WAIT_FENCE", 0x40186447 },
 { "DRM_IOCTL_RADEON_CLEAR", 0x40186448 },
@@ -1448,8 +1496,13 @@
 { "DRM_IOCTL_R128_BLIT", 0x4018644b },
 { "DRM_IOCTL_R128_DEPTH", 0x4018644c },
 { "DRM_IOCTL_RADEON_VERTEX2", 0x4018644f },
+{ "RIO_MPORT_MAINT_WRITE_LOCAL", 0x40186d06 },
+{ "RIO_MPORT_MAINT_WRITE_REMOTE", 0x40186d08 },
 { "NILFS_IOCTL_SET_SUINFO", 0x40186e8d },
 { "UBI_IOCATT", 0x40186f40 },
+{ "IOC_PR_REGISTER", 0x401870c8 },
+{ "IOC_PR_PREEMPT", 0x401870cb },
+{ "IOC_PR_PREEMPT_ABORT", 0x401870cc },
 { "BTRFS_IOC_QGROUP_ASSIGN", 0x40189429 },
 { "KVM_SET_MEMORY_REGION", 0x4018ae40 },
 { "KVM_S390_UCAS_MAP", 0x4018ae50 },
@@ -1460,27 +1513,42 @@
 { "MBXFB_IOCS_ALPHA", 0x4018f402 },
 { "FDSETPRM", 0x401c0242 },
 { "FDDEFPRM", 0x401c0243 },
+{ "UI_ABS_SETUP", 0x401c5504 },
+{ "FS_IOC_FSSETXATTR", 0x401c5820 },
 { "BR2684_SETFILT", 0x401c6190 },
 { "CHIOEXCHANGE", 0x401c6302 },
 { "OSD_SEND_CMD", 0x401c6fa0 },
 { "RTC_PLL_SET", 0x401c7012 },
+{ "CS_CONFIG_BUFS", 0x4020431f },
 { "ION_IOC_TEST_DMA_MAPPING", 0x402049f1 },
 { "ION_IOC_TEST_KERNEL_MAPPING", 0x402049f2 },
 { "AMDKFD_IOC_SET_MEMORY_POLICY", 0x40204b04 },
 { "VIDIOC_SUBSCRIBE_EVENT", 0x4020565a },
 { "VIDIOC_UNSUBSCRIBE_EVENT", 0x4020565b },
+{ "DRM_IOCTL_VIRTGPU_EXECBUFFER", 0x40206442 },
+{ "DRM_IOCTL_AMDGPU_INFO", 0x40206445 },
+{ "DRM_IOCTL_ETNAVIV_WAIT_FENCE", 0x40206447 },
+{ "DRM_IOCTL_ETNAVIV_GEM_WAIT", 0x40206449 },
 { "DRM_IOCTL_I915_GEM_PREAD", 0x4020645c },
 { "DRM_IOCTL_I915_GEM_PWRITE", 0x4020645d },
 { "MGSL_IOCSPARAMS", 0x40206d00 },
+{ "RIO_DEV_ADD", 0x40206d17 },
+{ "RIO_DEV_DEL", 0x40206d18 },
 { "PPPIOCSXASYNCMAP", 0x4020744f },
 { "BTRFS_IOC_CLONE_RANGE", 0x4020940d },
+{ "FICLONERANGE", 0x4020940d },
 { "KVM_SET_MEMORY_ALIAS", 0x4020ae43 },
 { "KVM_SET_USER_MEMORY_REGION", 0x4020ae46 },
 { "KVM_IRQFD", 0x4020ae76 },
 { "KVM_SIGNAL_MSI", 0x4020aea5 },
+{ "KVM_CREATE_SPAPR_TCE_64", 0x4020aea8 },
 { "KVM_PPC_GET_HTAB_FD", 0x4020aeaa },
 { "KVM_ARM_VCPU_INIT", 0x4020aeae },
+{ "KVM_S390_SET_IRQ_STATE", 0x4020aeb5 },
+{ "KVM_S390_GET_IRQ_STATE", 0x4020aeb6 },
 { "SNDRV_COMPRESS_SET_METADATA", 0x40244314 },
+{ "NVM_DEV_REMOVE", 0x40244c23 },
+{ "NVM_DEV_FACTORY", 0x40244c25 },
 { "DRM_IOCTL_SAVAGE_BCI_CMDBUF", 0x40246441 },
 { "JSIOCSCORR", 0x40246a21 },
 { "FE_SET_FRONTEND", 0x40246f4c },
@@ -1491,12 +1559,15 @@
 { "FW_CDEV_IOC_SEND_STREAM_PACKET", 0x40282313 },
 { "EVIOCSKEYCODE_V2", 0x40284504 },
 { "SNDCTL_FM_LOAD_INSTR", 0x40285107 },
+{ "DRM_IOCTL_AMDGPU_GEM_VA", 0x40286448 },
 { "DRM_IOCTL_VIA_DMA_BLIT", 0x4028644e },
 { "DRM_IOCTL_I915_GEM_EXECBUFFER", 0x40286454 },
+{ "RIO_UNMAP_OUTBOUND", 0x40286d10 },
 { "PHN_SETREGS", 0x40287008 },
 { "RTC_WKALM_SET", 0x4028700f },
 { "VHOST_SET_VRING_ADDR", 0x4028af11 },
 { "EVIOCSFF", 0x402c4580 },
+{ "NVM_DEV_INIT", 0x402c4c24 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", 0x402c5342 },
 { "TCSETS2", 0x402c542b },
 { "TCSETSW2", 0x402c542c },
@@ -1538,7 +1609,12 @@
 { "KVM_X86_SET_MCE", 0x4040ae9e },
 { "KVM_SET_VCPU_EVENTS", 0x4040aea0 },
 { "KVM_ASSIGN_SET_INTX_MASK", 0x4040aea4 },
+{ "KVM_S390_MEM_OP", 0x4040aeb1 },
+{ "KVM_S390_GET_SKEYS", 0x4040aeb2 },
+{ "KVM_S390_SET_SKEYS", 0x4040aeb3 },
 { "CXL_IOCTL_START_WORK", 0x4040ca00 },
+{ "CXL_IOCTL_DOWNLOAD_IMAGE", 0x4040ca0a },
+{ "CXL_IOCTL_VALIDATE_IMAGE", 0x4040ca0b },
 { "OMAPFB_SETUP_PLANE", 0x40444f34 },
 { "OMAPFB_QUERY_PLANE", 0x40444f35 },
 { "OMAPFB_UPDATE_WINDOW", 0x40444f36 },
@@ -1548,6 +1624,7 @@
 { "SNDRV_EMU10K1_IOCTL_PCM_POKE", 0x40484830 },
 { "BTRFS_IOC_SEND", 0x40489426 },
 { "KVM_SET_GUEST_DEBUG", 0x4048ae9b },
+{ "KVM_S390_IRQ", 0x4048aeb4 },
 { "GSMIOC_SETCONF", 0x404c4701 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", 0x404c534a },
 { "SNDRV_HWDEP_IOCTL_DSP_LOAD", 0x40504803 },
@@ -1560,6 +1637,7 @@
 { "FDSETDRVPRM", 0x40580290 },
 { "SNDRV_SEQ_IOCTL_SET_CLIENT_POOL", 0x4058534c },
 { "DRM_IOCTL_R128_INIT", 0x40586440 },
+{ "UI_DEV_SETUP", 0x405c5503 },
 { "DRM_IOCTL_MGA_INIT", 0x405c6440 },
 { "PTP_PIN_SETFUNC", 0x40603d07 },
 { "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", 0x40605346 },
@@ -1568,11 +1646,13 @@
 { "CHIOGELEM", 0x406c6310 },
 { "KVM_SET_PIT2", 0x4070aea0 },
 { "NILFS_IOCTL_CLEAN_SEGMENTS", 0x40786e88 },
+{ "NVM_DEV_CREATE", 0x40804c22 },
 { "UBI_IOCVOLCRBLK", 0x40804f07 },
 { "KVM_PPC_GET_PVINFO", 0x4080aea1 },
 { "KVM_SET_DEBUGREGS", 0x4080aea2 },
 { "KVM_PPC_RTAS_DEFINE_TOKEN", 0x4080aeac },
 { "SNDRV_COMPRESS_SET_PARAMS", 0x40844312 },
+{ "V4L2_DEVICE_NOTIFY_EVENT", 0x40887602 },
 { "SNDRV_SEQ_IOCTL_DELETE_QUEUE", 0x408c5333 },
 { "VIDIOC_S_JPEGCOMP", 0x408c563e },
 { "KVM_SET_REGS", 0x4090ae82 },
@@ -1610,6 +1690,8 @@
 { "SNDRV_SB_CSP_IOCTL_LOAD_CODE", 0x70124811 },
 { "MFB_GET_ALPHA", 0x80014d00 },
 { "MFB_GET_GAMMA", 0x80014d01 },
+{ "USBTMC488_IOCTL_GET_CAPS", 0x80015b11 },
+{ "USBTMC488_IOCTL_READ_STB", 0x80015b12 },
 { "GADGET_GET_PRINTER_STATUS", 0x80016721 },
 { "JSIOCGAXES", 0x80016a11 },
 { "JSIOCGBUTTONS", 0x80016a12 },
@@ -1640,8 +1722,6 @@
 { "BLKBSZGET", 0x80041270 },
 { "BLKGETSIZE64", 0x80041272 },
 { "PERF_EVENT_IOC_ID", 0x80042407 },
-{ "BLKI2OGRSTRAT", 0x80043201 },
-{ "BLKI2OGWSTRAT", 0x80043202 },
 { "FBIO_RADEON_GET_MIRROR", 0x80044003 },
 { "AGPIOC_INFO", 0x80044100 },
 { "SNDRV_PCM_IOCTL_PVERSION", 0x80044100 },
@@ -1656,6 +1736,8 @@
 { "CCISS_GETFIRMVER", 0x80044208 },
 { "CCISS_GETDRIVVER", 0x80044209 },
 { "SNDRV_COMPRESS_IOCTL_VERSION", 0x80044300 },
+{ "CS_GET_STATE", 0x80044315 },
+{ "CS_GET_IF_VERSION", 0x8004431e },
 { "CAPI_GET_FLAGS", 0x80044323 },
 { "CAPI_SET_FLAGS", 0x80044324 },
 { "CAPI_CLR_FLAGS", 0x80044325 },
@@ -1672,6 +1754,7 @@
 { "SNDRV_HWDEP_IOCTL_PVERSION", 0x80044800 },
 { "HIDIOCGRDESCSIZE", 0x80044801 },
 { "HIDIOCGVERSION", 0x80044801 },
+{ "IOCTL_MEI_NOTIFY_GET", 0x80044803 },
 { "HIDIOCGFLAG", 0x8004480e },
 { "HDA_IOCTL_PVERSION", 0x80044810 },
 { "SNDRV_EMU10K1_IOCTL_PVERSION", 0x80044840 },
@@ -1733,6 +1816,7 @@
 { "TUNGETSNDBUF", 0x800454d3 },
 { "TUNGETVNETHDRSZ", 0x800454d7 },
 { "TUNGETVNETLE", 0x800454dd },
+{ "TUNGETVNETBE", 0x800454df },
 { "SNDRV_CTL_IOCTL_PVERSION", 0x80045500 },
 { "USBDEVFS_RESETEP", 0x80045503 },
 { "USBDEVFS_SETCONFIGURATION", 0x80045505 },
@@ -1760,6 +1844,7 @@
 { "SONET_GETDIAG", 0x80046114 },
 { "SONET_GETFRAMING", 0x80046116 },
 { "CM_IOCGSTATUS", 0x80046300 },
+{ "KCOV_INIT_TRACE", 0x80046301 },
 { "CHIOGPICKER", 0x80046304 },
 { "DRM_IOCTL_GET_MAGIC", 0x80046402 },
 { "DRM_IOCTL_I915_GET_VBLANK_PIPE", 0x8004644e },
@@ -1806,7 +1891,9 @@
 { "MMTIMER_GETRES", 0x80046d01 },
 { "MMTIMER_GETFREQ", 0x80046d02 },
 { "MTIOCPOS", 0x80046d03 },
+{ "RIO_MPORT_MAINT_PORT_IDX_GET", 0x80046d03 },
 { "MMTIMER_GETCOUNTER", 0x80046d09 },
+{ "RIO_GET_EVENT_MASK", 0x80046d0e },
 { "NCP_IOC_SIGN_WANTED", 0x80046e06 },
 { "NCP_IOC_SETDENTRYTTL", 0x80046e0c },
 { "MATROXFB_GET_OUTPUT_CONNECTION", 0x80046ef8 },
@@ -1871,6 +1958,7 @@
 { "GENWQE_GET_CARD_STATE", 0x8004a524 },
 { "KVM_GET_MP_STATE", 0x8004ae98 },
 { "CXL_IOCTL_GET_PROCESS_ELEMENT", 0x8004ca01 },
+{ "FUSE_DEV_IOC_CLONE", 0x8004e500 },
 { "SISFB_GET_INFO_SIZE", 0x8004f300 },
 { "SISFB_GET_VBRSTATUS", 0x8004f302 },
 { "SISFB_GET_AUTOMAXIMIZE", 0x8004f303 },
@@ -1931,6 +2019,7 @@
 { "OMAPFB_GET_CAPS", 0x800c4f2a },
 { "SNDCTL_DSP_GETIPTR", 0x800c5011 },
 { "SNDCTL_DSP_GETOPTR", 0x800c5012 },
+{ "FS_IOC_SET_ENCRYPTION_POLICY", 0x800c6613 },
 { "HPET_INFO", 0x800c6803 },
 { "IPMICTL_REGISTER_FOR_CMD_CHANS", 0x800c691c },
 { "IPMICTL_UNREGISTER_FOR_CMD_CHANS", 0x800c691d },
@@ -1942,7 +2031,9 @@
 { "CA_GET_SLOT_INFO", 0x800c6f82 },
 { "FDGETDRVTYP", 0x8010020f },
 { "FW_CDEV_IOC_GET_CYCLE_TIMER", 0x8010230c },
+{ "STP_POLICY_ID_GET", 0x80102501 },
 { "CCISS_GETNODENAME", 0x80104204 },
+{ "EVIOCGMASK", 0x80104592 },
 { "SNDRV_HDSPM_IOCTL_GET_LTC", 0x80104846 },
 { "ECCGETSTATS", 0x80104d12 },
 { "OMAPFB_MEMORY_READ", 0x80104f3a },
@@ -1961,6 +2052,8 @@
 { "GENWQE_READ_REG64", 0x8010a51e },
 { "GENWQE_READ_REG32", 0x8010a520 },
 { "GENWQE_READ_REG16", 0x8010a522 },
+{ "UFFDIO_UNREGISTER", 0x8010aa01 },
+{ "UFFDIO_WAKE", 0x8010aa02 },
 { "FDGETMAXERRS", 0x8014020e },
 { "GET_DISK_INFO", 0x80140912 },
 { "SNDRV_COMPRESS_TSTAMP", 0x80144320 },
@@ -1972,6 +2065,8 @@
 { "SNDRV_PCM_IOCTL_CHANNEL_INFO", 0x80184132 },
 { "SNDRV_HDSPM_IOCTL_GET_CONFIG", 0x80184841 },
 { "IMSETDEVNAME", 0x80184947 },
+{ "RIO_MPORT_MAINT_READ_LOCAL", 0x80186d05 },
+{ "RIO_MPORT_MAINT_READ_REMOTE", 0x80186d07 },
 { "NCP_IOC_SIGN_INIT", 0x80186e05 },
 { "NILFS_IOCTL_GET_CPINFO", 0x80186e82 },
 { "NILFS_IOCTL_GET_CPSTAT", 0x80186e83 },
@@ -1982,6 +2077,7 @@
 { "FDGETPRM", 0x801c0204 },
 { "SNDRV_COMPRESS_AVAIL", 0x801c4321 },
 { "HIDIOCGDEVINFO", 0x801c4803 },
+{ "FS_IOC_FSGETXATTR", 0x801c581f },
 { "IPMICTL_SEND_COMMAND_SETTIME", 0x801c6915 },
 { "MTIOCGET", 0x801c6d02 },
 { "RTC_PLL_GET", 0x801c7011 },
@@ -2020,6 +2116,7 @@
 { "USBDEVFS_SUBMITURB", 0x802c550a },
 { "VIDIOC_G_FBUF", 0x802c560a },
 { "SOUND_OLD_MIXER_INFO", 0x80304d65 },
+{ "RIO_MPORT_GET_PROPERTIES", 0x80306d04 },
 { "NILFS_IOCTL_GET_SUSTAT", 0x80306e85 },
 { "BTRFS_IOC_QGROUP_LIMIT", 0x8030942b },
 { "KVM_GET_CLOCK", 0x8030ae7c },
@@ -2035,6 +2132,8 @@
 { "BTRFS_IOC_QUOTA_RESCAN_STATUS", 0x8040942d },
 { "KVM_ASSIGN_PCI_DEVICE", 0x8040ae69 },
 { "KVM_GET_VCPU_EVENTS", 0x8040ae9f },
+{ "CXL_IOCTL_GET_AFU_ID", 0x8040ca02 },
+{ "GPIO_GET_CHIPINFO_IOCTL", 0x8044b401 },
 { "GET_ARRAY_INFO", 0x80480911 },
 { "PPPIOCGL2TPSTATS", 0x80487436 },
 { "BTRFS_IOC_GET_SUPPORTED_FEATURES", 0x80489439 },
@@ -2094,10 +2193,10 @@
 { "SNDCTL_COPR_RCVMSG", 0x8fa44309 },
 { "GET_BITMAP_FILE", 0x90000915 },
 { "SNDRV_HDSP_IOCTL_GET_MIXER", 0x90004844 },
+{ "NVM_GET_DEVICES", 0x90004c21 },
 { "BTRFS_IOC_DEVICES_READY", 0x90009427 },
 { "KVM_GET_XSAVE", 0x9000aea4 },
 { "HIDIOCGRDESC", 0x90044802 },
-{ "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", 0xc0005343 },
 { "GADGET_SET_PRINTER_STATUS", 0xc0016722 },
 { "AGPIOC_ALLOCATE", 0xc0044106 },
 { "CAPI_GET_MANUFACTURER", 0xc0044306 },
@@ -2152,6 +2251,7 @@
 { "DRM_IOCTL_RADEON_IRQ_EMIT", 0xc0046456 },
 { "DRM_IOCTL_MODE_RMFB", 0xc00464af },
 { "DRM_IOCTL_MODE_DESTROY_DUMB", 0xc00464b4 },
+{ "DRM_IOCTL_MODE_DESTROYPROPBLOB", 0xc00464be },
 { "I8K_GET_SPEED", 0xc0046985 },
 { "I8K_GET_FAN", 0xc0046986 },
 { "I8K_SET_FAN", 0xc0046987 },
@@ -2167,8 +2267,8 @@
 { "MIC_VIRTIO_ADD_DEVICE", 0xc0047301 },
 { "MIC_VIRTIO_COPY_DESC", 0xc0047302 },
 { "MIC_VIRTIO_CONFIG_CHANGE", 0xc0047305 },
+{ "SCIF_FENCE_WAIT", 0xc0047310 },
 { "PPPIOCNEWUNIT", 0xc004743e },
-{ "TOSH_SMM", 0xc0047490 },
 { "MEYEIOC_SYNC", 0xc00476c3 },
 { "AUTOFS_IOC_SETTIMEOUT", 0xc0049364 },
 { "KVM_GET_MSR_INDEX_LIST", 0xc004ae02 },
@@ -2184,6 +2284,9 @@
 { "ION_IOC_CUSTOM", 0xc0084906 },
 { "ION_IOC_SYNC", 0xc0084907 },
 { "AMDKFD_IOC_DESTROY_QUEUE", 0xc0084b03 },
+{ "ND_IOCTL_DIMM_FLAGS", 0xc0084e03 },
+{ "ND_IOCTL_SET_CONFIG_DATA", 0xc0084e06 },
+{ "ND_IOCTL_VENDOR", 0xc0084e09 },
 { "SNDRV_CTL_IOCTL_TLV_READ", 0xc008551a },
 { "SNDRV_CTL_IOCTL_TLV_WRITE", 0xc008551b },
 { "SNDRV_CTL_IOCTL_TLV_COMMAND", 0xc008551c },
@@ -2199,13 +2302,14 @@
 { "DRM_IOCTL_RES_CTX", 0xc0086426 },
 { "DRM_IOCTL_SG_ALLOC", 0xc0086438 },
 { "DRM_IOCTL_QXL_ALLOC", 0xc0086440 },
-{ "DRM_IOCTL_TEGRA_GEM_MMAP", 0xc0086441 },
+{ "DRM_IOCTL_AMDGPU_GEM_MMAP", 0xc0086441 },
 { "DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT", 0xc0086442 },
 { "DRM_IOCTL_TEGRA_SYNCPT_READ", 0xc0086442 },
 { "DRM_IOCTL_VIA_AGP_INIT", 0xc0086442 },
 { "DRM_IOCTL_TEGRA_SYNCPT_INCR", 0xc0086443 },
 { "DRM_IOCTL_VIA_FB_INIT", 0xc0086443 },
 { "DRM_IOCTL_I915_GETPARAM", 0xc0086446 },
+{ "DRM_IOCTL_VIRTGPU_WAIT", 0xc0086448 },
 { "DRM_IOCTL_MGA_GETPARAM", 0xc0086449 },
 { "DRM_IOCTL_TEGRA_GEM_SET_FLAGS", 0xc008644c },
 { "DRM_IOCTL_TEGRA_GEM_GET_FLAGS", 0xc008644d },
@@ -2222,6 +2326,9 @@
 { "DRM_IOCTL_EXYNOS_IPP_CMD_CTRL", 0xc0086473 },
 { "NCP_IOC_GETPRIVATEDATA", 0xc0086e0a },
 { "PHN_GETREG", 0xc0087005 },
+{ "SCIF_BIND", 0xc0087301 },
+{ "SCIF_CONNECT", 0xc0087303 },
+{ "SCIF_ACCEPTREG", 0xc0087305 },
 { "PPPIOCGNPMODE", 0xc008744c },
 { "KVM_GET_SUPPORTED_CPUID", 0xc008ae05 },
 { "KVM_GET_EMULATED_CPUID", 0xc008ae09 },
@@ -2233,10 +2340,14 @@
 { "FSL_HV_IOCTL_PARTITION_STOP", 0xc008af04 },
 { "FSL_HV_IOCTL_DOORBELL", 0xc008af06 },
 { "VHOST_GET_VRING_BASE", 0xc008af12 },
+{ "MMC_IOC_MULTI_CMD", 0xc008b301 },
 { "HIDIOCGREPORTINFO", 0xc00c4809 },
 { "SNDRV_EMU10K1_IOCTL_TRAM_PEEK", 0xc00c4822 },
 { "MEMWRITEOOB", 0xc00c4d03 },
 { "MEMREADOOB", 0xc00c4d04 },
+{ "ND_IOCTL_SMART_THRESHOLD", 0xc00c4e02 },
+{ "ND_IOCTL_GET_CONFIG_SIZE", 0xc00c4e04 },
+{ "ND_IOCTL_GET_CONFIG_DATA", 0xc00c4e05 },
 { "SNDCTL_SYNTH_REMOVESAMPLE", 0xc00c5116 },
 { "USBDEVFS_IOCTL", 0xc00c5512 },
 { "UI_BEGIN_FF_ERASE", 0xc00c55ca },
@@ -2257,6 +2368,7 @@
 { "KVM_CREATE_DEVICE", 0xc00caee0 },
 { "FSL_HV_IOCTL_PARTITION_GET_STATUS", 0xc00caf02 },
 { "MBXFB_IOCX_REG", 0xc00cf405 },
+{ "STP_POLICY_ID_SET", 0xc0102500 },
 { "CAPI_GET_VERSION", 0xc0104307 },
 { "GIGASET_VERSION", 0xc0104703 },
 { "IOCTL_MEI_CONNECT_CLIENT", 0xc0104801 },
@@ -2273,21 +2385,35 @@
 { "DRM_IOCTL_GET_CAP", 0xc010640c },
 { "DRM_IOCTL_AGP_ALLOC", 0xc0106434 },
 { "DRM_IOCTL_WAIT_VBLANK", 0xc010643a },
+{ "DRM_IOCTL_ETNAVIV_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_EXYNOS_GEM_CREATE", 0xc0106440 },
 { "DRM_IOCTL_MSM_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_OMAP_GET_PARAM", 0xc0106440 },
 { "DRM_IOCTL_TEGRA_GEM_CREATE", 0xc0106440 },
+{ "DRM_IOCTL_EXYNOS_GEM_MAP", 0xc0106441 },
 { "DRM_IOCTL_QXL_MAP", 0xc0106441 },
+{ "DRM_IOCTL_TEGRA_GEM_MMAP", 0xc0106441 },
+{ "DRM_IOCTL_VC4_WAIT_SEQNO", 0xc0106441 },
+{ "DRM_IOCTL_VIRTGPU_MAP", 0xc0106441 },
+{ "DRM_IOCTL_AMDGPU_CTX", 0xc0106442 },
+{ "DRM_IOCTL_ETNAVIV_GEM_NEW", 0xc0106442 },
 { "DRM_IOCTL_MSM_GEM_NEW", 0xc0106442 },
+{ "DRM_IOCTL_VC4_WAIT_BO", 0xc0106442 },
+{ "DRM_IOCTL_ETNAVIV_GEM_INFO", 0xc0106443 },
 { "DRM_IOCTL_MSM_GEM_INFO", 0xc0106443 },
 { "DRM_IOCTL_OMAP_GEM_NEW", 0xc0106443 },
+{ "DRM_IOCTL_VC4_CREATE_BO", 0xc0106443 },
+{ "DRM_IOCTL_VIRTGPU_GETPARAM", 0xc0106443 },
 { "DRM_IOCTL_EXYNOS_GEM_GET", 0xc0106444 },
 { "DRM_IOCTL_QXL_GETPARAM", 0xc0106444 },
 { "DRM_IOCTL_SIS_FB_ALLOC", 0xc0106444 },
 { "DRM_IOCTL_TEGRA_SYNCPT_WAIT", 0xc0106444 },
+{ "DRM_IOCTL_VC4_MMAP_BO", 0xc0106444 },
 { "DRM_IOCTL_I810_GETBUF", 0xc0106445 },
 { "DRM_IOCTL_TEGRA_OPEN_CHANNEL", 0xc0106445 },
+{ "DRM_IOCTL_VIRTGPU_RESOURCE_INFO", 0xc0106445 },
 { "DRM_IOCTL_TEGRA_CLOSE_CHANNEL", 0xc0106446 },
+{ "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", 0xc0106447 },
 { "DRM_IOCTL_EXYNOS_VIDI_CONNECTION", 0xc0106447 },
 { "DRM_IOCTL_TEGRA_GET_SYNCPT", 0xc0106447 },
 { "DRM_IOCTL_VIA_DMA_INIT", 0xc0106447 },
@@ -2298,6 +2424,7 @@
 { "DRM_IOCTL_RADEON_INDIRECT", 0xc010644d },
 { "DRM_IOCTL_VIA_WAIT_IRQ", 0xc010644d },
 { "DRM_IOCTL_R128_INDIRECT", 0xc010644f },
+{ "DRM_IOCTL_AMDGPU_GEM_OP", 0xc0106450 },
 { "DRM_IOCTL_RADEON_ALLOC", 0xc0106453 },
 { "DRM_IOCTL_SIS_AGP_ALLOC", 0xc0106454 },
 { "DRM_IOCTL_I915_GEM_CREATE", 0xc010645b },
@@ -2312,8 +2439,12 @@
 { "DRM_IOCTL_MODE_GETPROPBLOB", 0xc01064ac },
 { "DRM_IOCTL_MODE_MAP_DUMB", 0xc01064b3 },
 { "DRM_IOCTL_MODE_GETPLANERESOURCES", 0xc01064b5 },
+{ "DRM_IOCTL_MODE_CREATEPROPBLOB", 0xc01064bd },
 { "MGSL_IOCWAITGPIO", 0xc0106d12 },
 { "DMX_GET_STC", 0xc0106f32 },
+{ "SCIF_ACCEPTREQ", 0xc0107304 },
+{ "SCIF_UNREG", 0xc0107309 },
+{ "SCIF_FENCE_MARK", 0xc010730f },
 { "BTRFS_IOC_SPACE_INFO", 0xc0109414 },
 { "BTRFS_IOC_QUOTA_CTL", 0xc0109428 },
 { "FSL_HV_IOCTL_PARTITION_START", 0xc010af03 },
@@ -2327,7 +2458,7 @@
 { "VIDIOC_G_CROP", 0xc014563b },
 { "DRM_IOCTL_VIA_ALLOCMEM", 0xc0146440 },
 { "DRM_IOCTL_VIA_MAP_INIT", 0xc0146444 },
-{ "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", 0xc014646b },
+{ "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", 0xc014646a },
 { "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", 0xc014646b },
 { "DRM_IOCTL_MODE_GETENCODER", 0xc01464a6 },
 { "FW_CDEV_IOC_ADD_DESCRIPTOR", 0xc0182306 },
@@ -2337,6 +2468,7 @@
 { "FW_CDEV_IOC_SEND_PHY_PACKET", 0xc0182315 },
 { "HIDIOCGUSAGE", 0xc018480b },
 { "HIDIOCGUCODE", 0xc018480d },
+{ "AMDKFD_IOC_WAIT_EVENTS", 0xc0184b0c },
 { "MTRRIOC_GET_ENTRY", 0xc0184d03 },
 { "MTRRIOC_GET_PAGE_ENTRY", 0xc0184d08 },
 { "MEMWRITEOOB64", 0xc0184d15 },
@@ -2350,15 +2482,23 @@
 { "DRM_IOCTL_GET_CLIENT", 0xc0186405 },
 { "DRM_IOCTL_ADD_MAP", 0xc0186415 },
 { "DRM_IOCTL_ADD_BUFS", 0xc0186416 },
+{ "DRM_IOCTL_AMDGPU_BO_LIST", 0xc0186443 },
+{ "DRM_IOCTL_AMDGPU_CS", 0xc0186444 },
+{ "DRM_IOCTL_VC4_CREATE_SHADER_BO", 0xc0186445 },
 { "DRM_IOCTL_OMAP_GEM_INFO", 0xc0186446 },
 { "DRM_IOCTL_QXL_ALLOC_SURF", 0xc0186446 },
+{ "DRM_IOCTL_ETNAVIV_GEM_USERPTR", 0xc0186448 },
+{ "DRM_IOCTL_VIRTGPU_GET_CAPS", 0xc0186449 },
 { "DRM_IOCTL_RADEON_TEXTURE", 0xc018644e },
+{ "DRM_IOCTL_AMDGPU_GEM_USERPTR", 0xc0186451 },
 { "DRM_IOCTL_I915_GEM_PIN", 0xc0186455 },
 { "DRM_IOCTL_RADEON_GEM_INFO", 0xc018645c },
 { "DRM_IOCTL_RADEON_GEM_VA", 0xc018646b },
 { "DRM_IOCTL_RADEON_GEM_USERPTR", 0xc018646d },
 { "DRM_IOCTL_I915_GET_RESET_STATS", 0xc0186472 },
 { "DRM_IOCTL_I915_GEM_USERPTR", 0xc0186473 },
+{ "DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM", 0xc0186474 },
+{ "DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM", 0xc0186475 },
 { "DRM_IOCTL_MODE_PAGE_FLIP", 0xc01864b0 },
 { "DRM_IOCTL_MODE_DIRTYFB", 0xc01864b1 },
 { "DRM_IOCTL_MODE_OBJ_SETPROPERTY", 0xc01864ba },
@@ -2366,8 +2506,15 @@
 { "I2OPARMGET", 0xc0186904 },
 { "IPMICTL_RECEIVE_MSG_TRUNC", 0xc018690b },
 { "IPMICTL_RECEIVE_MSG", 0xc018690c },
+{ "RIO_ALLOC_DMA", 0xc0186d13 },
+{ "RIO_TRANSFER", 0xc0186d15 },
 { "NILFS_IOCTL_GET_VINFO", 0xc0186e86 },
 { "NILFS_IOCTL_GET_BDESCS", 0xc0186e87 },
+{ "SCIF_SEND", 0xc0187306 },
+{ "SCIF_RECV", 0xc0187307 },
+{ "SCIF_GET_NODEIDS", 0xc018730e },
+{ "TOSH_SMM", 0xc0187490 },
+{ "TOSHIBA_ACPI_SCI", 0xc0187491 },
 { "AUTOFS_DEV_IOCTL_VERSION", 0xc0189371 },
 { "AUTOFS_DEV_IOCTL_PROTOVER", 0xc0189372 },
 { "AUTOFS_DEV_IOCTL_PROTOSUBVER", 0xc0189373 },
@@ -2383,6 +2530,8 @@
 { "AUTOFS_DEV_IOCTL_ASKUMOUNT", 0xc018937d },
 { "AUTOFS_DEV_IOCTL_ISMOUNTPOINT", 0xc018937e },
 { "BTRFS_IOC_FILE_EXTENT_SAME", 0xc0189436 },
+{ "FIDEDUPERANGE", 0xc0189436 },
+{ "UFFDIO_API", 0xc018aa3f },
 { "KVM_TRANSLATE", 0xc018ae85 },
 { "IB_USER_MAD_REGISTER_AGENT", 0xc01c1b01 },
 { "SI4713_IOC_MEASURE_RNL", 0xc01c56c0 },
@@ -2397,15 +2546,20 @@
 { "MEDIA_IOC_ENUM_LINKS", 0xc01c7c02 },
 { "FW_CDEV_IOC_ALLOCATE", 0xc0202302 },
 { "FW_CDEV_IOC_CREATE_ISO_CONTEXT", 0xc0202308 },
+{ "AMDKFD_IOC_CREATE_EVENT", 0xc0204b08 },
+{ "ND_IOCTL_ARS_CAP", 0xc0204e01 },
+{ "ND_IOCTL_ARS_START", 0xc0204e02 },
+{ "ND_IOCTL_CLEAR_ERROR", 0xc0204e04 },
 { "VIDIOC_OMAP3ISP_CCDC_CFG", 0xc02056c1 },
 { "VIDIOC_OMAP3ISP_AEWB_CFG", 0xc02056c3 },
 { "VIDIOC_OMAP3ISP_STAT_REQ", 0xc02056c6 },
 { "SNDRV_RAWMIDI_IOCTL_PARAMS", 0xc0205710 },
 { "X86_IOC_RDMSR_REGS", 0xc02063a0 },
 { "X86_IOC_WRMSR_REGS", 0xc02063a1 },
+{ "DRM_IOCTL_AMDGPU_GEM_CREATE", 0xc0206440 },
 { "DRM_IOCTL_MSM_GEM_SUBMIT", 0xc0206446 },
+{ "DRM_IOCTL_AMDGPU_WAIT_CS", 0xc0206449 },
 { "DRM_IOCTL_RADEON_GEM_CREATE", 0xc020645d },
-{ "DRM_IOCTL_I915_GEM_MMAP", 0xc020645e },
 { "DRM_IOCTL_RADEON_GEM_MMAP", 0xc020645e },
 { "DRM_IOCTL_RADEON_GEM_PREAD", 0xc0206461 },
 { "DRM_IOCTL_RADEON_GEM_PWRITE", 0xc0206462 },
@@ -2418,6 +2572,8 @@
 { "FS_IOC_FIEMAP", 0xc020660b },
 { "GENWQE_PIN_MEM", 0xc020a528 },
 { "GENWQE_UNPIN_MEM", 0xc020a529 },
+{ "UFFDIO_REGISTER", 0xc020aa00 },
+{ "UFFDIO_ZEROPAGE", 0xc020aa04 },
 { "SNDCTL_MIDI_MPUCMD", 0xc0216d02 },
 { "SNDRV_COMPRESS_GET_METADATA", 0xc0244315 },
 { "VIDIOC_G_EDID", 0xc0245628 },
@@ -2425,6 +2581,8 @@
 { "VIDIOC_SUBDEV_S_EDID", 0xc0245629 },
 { "VIDIOC_S_EDID", 0xc0245629 },
 { "DRM_IOCTL_VERSION", 0xc0246400 },
+{ "DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST", 0xc0246446 },
+{ "DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST", 0xc0246447 },
 { "DRM_IOCTL_MODE_CURSOR2", 0xc02464bb },
 { "NCP_IOC_GET_FS_INFO_V2", 0xc0246e04 },
 { "IB_USER_MAD_REGISTER_AGENT2", 0xc0281b04 },
@@ -2436,11 +2594,21 @@
 { "VIDIOC_TRY_ENCODER_CMD", 0xc028564e },
 { "SW_SYNC_IOC_CREATE_FENCE", 0xc0285700 },
 { "DRM_IOCTL_DMA", 0xc0286429 },
+{ "DRM_IOCTL_I915_GEM_MMAP", 0xc028645e },
 { "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", 0xc0286461 },
 { "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", 0xc0286472 },
 { "DRM_IOCTL_NOUVEAU_GEM_INFO", 0xc0286484 },
+{ "RIO_MAP_OUTBOUND", 0xc0286d0f },
+{ "RIO_MAP_INBOUND", 0xc0286d11 },
 { "NCP_IOC_GET_FS_INFO", 0xc0286e04 },
 { "PHN_GETREGS", 0xc0287007 },
+{ "SCIF_REG", 0xc0287308 },
+{ "SCIF_READFROM", 0xc028730a },
+{ "SCIF_WRITETO", 0xc028730b },
+{ "SCIF_VREADFROM", 0xc028730c },
+{ "SCIF_VWRITETO", 0xc028730d },
+{ "SCIF_FENCE_SIGNAL", 0xc0287311 },
+{ "UFFDIO_COPY", 0xc028aa03 },
 { "KVM_TPR_ACCESS_REPORTING", 0xc028ae92 },
 { "FSL_HV_IOCTL_MEMCPY", 0xc028af05 },
 { "FSL_HV_IOCTL_GETPROP", 0xc028af07 },
@@ -2453,6 +2621,7 @@
 { "VIDIOC_ENUM_FRAMESIZES", 0xc02c564a },
 { "DRM_IOCTL_I915_OVERLAY_ATTRS", 0xc02c6468 },
 { "MEMWRITE", 0xc0304d18 },
+{ "ND_IOCTL_ARS_STATUS", 0xc0304e03 },
 { "SNDRV_SEQ_IOCTL_SYSTEM_INFO", 0xc0305302 },
 { "VIDIOC_SUBDEV_ENUM_MBUS_CODE", 0xc0305602 },
 { "VIDIOC_SUBDEV_G_FRAME_INTERVAL", 0xc0305615 },
@@ -2460,6 +2629,7 @@
 { "VIDIOC_OMAP3ISP_HIST_CFG", 0xc03056c4 },
 { "SNDRV_RAWMIDI_IOCTL_STATUS", 0xc0305720 },
 { "BINDER_WRITE_READ", 0xc0306201 },
+{ "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", 0xc0306446 },
 { "DRM_IOCTL_NOUVEAU_GEM_NEW", 0xc0306480 },
 { "DRM_IOCTL_MODE_SETPLANE", 0xc03064b7 },
 { "MBXFB_IOCX_OVERLAY", 0xc030f400 },
@@ -2471,11 +2641,14 @@
 { "VIDIOC_SUBDEV_G_CROP", 0xc038563b },
 { "VIDIOC_SUBDEV_S_CROP", 0xc038563c },
 { "VIDIOC_DBG_G_REGISTER", 0xc0385650 },
+{ "DRM_IOCTL_VIRTGPU_RESOURCE_CREATE", 0xc0386444 },
+{ "DRM_IOCTL_MODE_ATOMIC", 0xc03864bc },
 { "BTRFS_IOC_INO_PATHS", 0xc0389423 },
 { "BTRFS_IOC_LOGICAL_INO", 0xc0389424 },
 { "GENWQE_SLU_UPDATE", 0xc038a550 },
 { "GENWQE_SLU_READ", 0xc038a551 },
 { "VIDIOC_OMAP3ISP_PRV_CFG", 0xc03c56c2 },
+{ "PTP_SYS_OFFSET_PRECISE", 0xc0403d08 },
 { "CAPI_GET_PROFILE", 0xc0404309 },
 { "SNDRV_TIMER_IOCTL_GSTATUS", 0xc0405405 },
 { "SNDRV_CTL_IOCTL_ELEM_REMOVE", 0xc0405519 },
@@ -2493,7 +2666,6 @@
 { "DRM_IOCTL_MODE_GETPROPERTY", 0xc04064aa },
 { "VIDIOC_QUERYCTRL", 0xc0445624 },
 { "VIDIOC_G_MODULATOR", 0xc0445636 },
-{ "DRM_IOCTL_MODE_ADDFB2", 0xc04464b8 },
 { "BLKTRACESETUP", 0xc0481273 },
 { "FBIO_CURSOR", 0xc0484608 },
 { "SNDRV_EMU10K1_IOCTL_PCM_PEEK", 0xc0484831 },
@@ -2508,8 +2680,10 @@
 { "DRM_IOCTL_MODE_DETACHMODE", 0xc04864a9 },
 { "VIDEO_COMMAND", 0xc0486f3b },
 { "VIDEO_TRY_COMMAND", 0xc0486f3c },
+{ "MEDIA_IOC_G_TOPOLOGY", 0xc0487c04 },
 { "KVM_GET_PIT", 0xc048ae65 },
 { "MMC_IOC_CMD", 0xc048b300 },
+{ "GPIO_GET_LINEINFO_IOCTL", 0xc048b402 },
 { "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", 0xc04c5349 },
 { "VIDIOC_OMAP3ISP_AF_CFG", 0xc04c56c5 },
 { "SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION", 0xc0505350 },
@@ -2536,13 +2710,24 @@
 { "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", 0xc0605345 },
 { "UI_BEGIN_FF_UPLOAD", 0xc06055c8 },
 { "DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY", 0xc0606471 },
+{ "DK_CXLFLASH_DETACH", 0xc060ca83 },
 { "SNDRV_PCM_IOCTL_SW_PARAMS", 0xc0684113 },
 { "DRM_IOCTL_MODE_GETCRTC", 0xc06864a1 },
 { "DRM_IOCTL_MODE_SETCRTC", 0xc06864a2 },
+{ "DRM_IOCTL_MODE_ADDFB2", 0xc06864b8 },
+{ "DK_CXLFLASH_RELEASE", 0xc068ca82 },
+{ "DK_CXLFLASH_MANAGE_LUN", 0xc068ca86 },
 { "BTRFS_IOC_TREE_SEARCH_V2", 0xc0709411 },
+{ "DK_CXLFLASH_USER_DIRECT", 0xc070ca81 },
+{ "DK_CXLFLASH_VLUN_CLONE", 0xc070ca89 },
 { "SNDCTL_MIDI_INFO", 0xc074510c },
 { "VIDIOC_G_SLICED_VBI_CAP", 0xc0745645 },
+{ "DK_CXLFLASH_RECOVER_AFU", 0xc078ca85 },
+{ "DK_CXLFLASH_USER_VIRTUAL", 0xc078ca87 },
+{ "DK_CXLFLASH_VLUN_RESIZE", 0xc078ca88 },
+{ "SNDRV_PCM_IOCTL_STATUS_EXT", 0xc0804124 },
 { "SOUND_MIXER_ACCESS", 0xc0804d66 },
+{ "ND_IOCTL_SMART", 0xc0844e01 },
 { "VIDIOC_SUBDEV_S_DV_TIMINGS", 0xc0845657 },
 { "VIDIOC_S_DV_TIMINGS", 0xc0845657 },
 { "VIDIOC_G_DV_TIMINGS", 0xc0845658 },
@@ -2557,8 +2742,12 @@
 { "SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE", 0xc08c5336 },
 { "VIDIOC_DV_TIMINGS_CAP", 0xc0905664 },
 { "VIDIOC_SUBDEV_DV_TIMINGS_CAP", 0xc0905664 },
+{ "DK_CXLFLASH_ATTACH", 0xc090ca80 },
+{ "DK_CXLFLASH_VERIFY", 0xc090ca84 },
 { "VIDIOC_ENUM_DV_TIMINGS", 0xc0945662 },
 { "VIDIOC_SUBDEV_ENUM_DV_TIMINGS", 0xc0945662 },
+{ "DRM_IOCTL_VC4_SUBMIT_CL", 0xc0a06440 },
+{ "DRM_IOCTL_VC4_GET_HANG_STATE", 0xc0a06446 },
 { "SOUND_MIXER_GETLEVELS", 0xc0a44d74 },
 { "SOUND_MIXER_SETLEVELS", 0xc0a44d75 },
 { "SNDRV_SEQ_IOCTL_CREATE_PORT", 0xc0a45320 },
@@ -2586,6 +2775,7 @@
 { "SNDRV_CTL_IOCTL_ELEM_ADD", 0xc1105517 },
 { "SNDRV_CTL_IOCTL_ELEM_REPLACE", 0xc1105518 },
 { "SNDRV_CTL_IOCTL_PCM_INFO", 0xc1205531 },
+{ "DRM_IOCTL_AMDGPU_GEM_METADATA", 0xc1206446 },
 { "DM_VERSION", 0xc138fd00 },
 { "DM_REMOVE_ALL", 0xc138fd01 },
 { "DM_LIST_DEVICES", 0xc138fd02 },
@@ -2617,6 +2807,7 @@
 { "SNDCTL_COPR_SENDMSG", 0xcfa44308 },
 { "SNDCTL_SYNTH_CONTROL", 0xcfa45115 },
 { "SNDCTL_COPR_LOAD", 0xcfb04301 },
+{ "NVM_INFO", 0xd0004c20 },
 { "BTRFS_IOC_TREE_SEARCH", 0xd0009411 },
 { "BTRFS_IOC_INO_LOOKUP", 0xd0009412 },
 { "BTRFS_IOC_DEV_INFO", 0xd000941e },
diff --git a/ioprio.c b/ioprio.c
index 0a1a596..0b83be7 100644
--- a/ioprio.c
+++ b/ioprio.c
@@ -51,19 +51,19 @@
 #define IOPRIO_PRIO_DATA(mask)	((mask) & IOPRIO_PRIO_MASK)
 
 static const char *
-sprint_ioprio(int ioprio)
+sprint_ioprio(unsigned int ioprio)
 {
 	static char outstr[256];
 	const char *str;
-	int class, data;
+	unsigned int class, data;
 
 	class = IOPRIO_PRIO_CLASS(ioprio);
 	data = IOPRIO_PRIO_DATA(ioprio);
 	str = xlookup(ioprio_class, class);
 	if (str)
-		sprintf(outstr, "IOPRIO_PRIO_VALUE(%s,%d)", str, data);
+		sprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data);
 	else
-		sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */,%d)",
+		sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)",
 			class, "IOPRIO_CLASS_???", data);
 
 	return outstr;
diff --git a/ipc_sem.c b/ipc_sem.c
index c7351ae..ba21b7b 100644
--- a/ipc_sem.c
+++ b/ipc_sem.c
@@ -43,12 +43,16 @@
 #include "xlat/semop_flags.h"
 
 #if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
-static void
-tprint_sembuf(const struct sembuf *sb)
+static bool
+print_sembuf(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
+	const struct sembuf *sb = elem_buf;
+
 	tprintf("{%u, %d, ", sb->sem_num, sb->sem_op);
-	printflags(semop_flags, sb->sem_flg, "SEM_???");
+	printflags(semop_flags, (unsigned short) sb->sem_flg, "SEM_???");
 	tprints("}");
+
+	return true;
 }
 #endif
 
@@ -56,35 +60,9 @@
 tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned long count)
 {
 #if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
-	unsigned long max_count;
 	struct sembuf sb;
-
-	if (abbrev(tcp))
-		max_count = (max_strlen < count) ? max_strlen : count;
-	else
-		max_count = count;
-
-	if (!max_count)
-		printaddr(addr);
-	else if (!umove_or_printaddr(tcp, addr, &sb)) {
-		unsigned long i;
-
-		tprints("[");
-		tprint_sembuf(&sb);
-
-		for (i = 1; i < max_count; ++i) {
-			tprints(", ");
-			if (umove_or_printaddr(tcp, addr + i * sizeof(sb), &sb))
-				break;
-			else
-				tprint_sembuf(&sb);
-		}
-
-		if (i < max_count || max_count < count)
-			tprints(", ...");
-
-		tprints("]");
-	}
+	print_array(tcp, addr, count, &sb, sizeof(sb),
+		    umoven_or_printaddr, print_sembuf, 0);
 #else
 	printaddr(addr);
 #endif
diff --git a/kexec.c b/kexec.c
index 89b7528..128b1df 100644
--- a/kexec.c
+++ b/kexec.c
@@ -37,56 +37,49 @@
 # define KEXEC_SEGMENT_MAX 16
 #endif
 
-static void
-print_seg(const unsigned long *seg)
+static bool
+print_seg(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
+	const unsigned long *seg;
+	unsigned long seg_buf[4];
+
+        if (elem_size < sizeof(seg_buf)) {
+		unsigned int i;
+
+		for (i = 0; i < ARRAY_SIZE(seg_buf); ++i)
+			seg_buf[i] = ((unsigned int *) elem_buf)[i];
+		seg = seg_buf;
+	} else {
+		seg = elem_buf;
+	}
+
 	tprints("{");
 	printaddr(seg[0]);
 	tprintf(", %lu, ", seg[1]);
 	printaddr(seg[2]);
 	tprintf(", %lu}", seg[3]);
+
+	return true;
 }
 
 static void
 print_kexec_segments(struct tcb *tcp, const unsigned long addr,
 		     const unsigned long len)
 {
-	unsigned long seg[4];
-	const size_t sizeof_seg = ARRAY_SIZE(seg) * current_wordsize;
-	unsigned int i;
-
-	if (!len) {
-		tprints("[]");
-		return;
-	}
-
 	if (len > KEXEC_SEGMENT_MAX) {
 		printaddr(addr);
 		return;
 	}
 
-	if (umove_ulong_array_or_printaddr(tcp, addr, seg, ARRAY_SIZE(seg)))
-		return;
+	unsigned long seg[4];
+	const size_t sizeof_seg = ARRAY_SIZE(seg) * current_wordsize;
 
-	tprints("[");
-	print_seg(seg);
-
-	for (i = 1; i < len; ++i) {
-		tprints(", ");
-		if (umove_ulong_array_or_printaddr(tcp,
-						   addr + i * sizeof_seg,
-						   seg, ARRAY_SIZE(seg)))
-			break;
-		print_seg(seg);
-	}
-
-	tprints("]");
+	print_array(tcp, addr, len, seg, sizeof_seg,
+		    umoven_or_printaddr, print_seg, 0);
 }
 
 SYS_FUNC(kexec_load)
 {
-	unsigned long n;
-
 	/* entry, nr_segments */
 	printaddr(tcp->u_arg[0]);
 	tprintf(", %lu, ", tcp->u_arg[1]);
@@ -96,12 +89,12 @@
 	tprints(", ");
 
 	/* flags */
-	n = tcp->u_arg[3];
-	printxval(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
+	unsigned long n = tcp->u_arg[3];
+	printxval_long(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
 	n &= ~KEXEC_ARCH_MASK;
 	if (n) {
 		tprints("|");
-		printflags(kexec_load_flags, n, "KEXEC_???");
+		printflags_long(kexec_load_flags, n, "KEXEC_???");
 	}
 
 	return RVAL_DECODED;
@@ -123,7 +116,7 @@
 	printstr(tcp, tcp->u_arg[3], tcp->u_arg[2]);
 	tprints(", ");
 	/* flags */
-	printflags(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
+	printflags_long(kexec_file_load_flags, tcp->u_arg[4], "KEXEC_FILE_???");
 
 	return RVAL_DECODED;
 }
diff --git a/keyctl.c b/keyctl.c
index 81391a3..50d6fb4 100644
--- a/keyctl.c
+++ b/keyctl.c
@@ -34,7 +34,7 @@
 static void
 print_keyring_serial_number(key_serial_t id)
 {
-	const char *str = xlookup(key_spec, id);
+	const char *str = xlookup(key_spec, (unsigned int) id);
 
 	if (str)
 		tprints(str);
diff --git a/linux/32/ioctls_inc_align32.h b/linux/32/ioctls_inc_align32.h
index be42188..70ec077 100644
--- a/linux/32/ioctls_inc_align32.h
+++ b/linux/32/ioctls_inc_align32.h
@@ -195,6 +195,7 @@
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", _IOC_READ|_IOC_WRITE, 0x6461, 0x28 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_GET", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
+{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_MAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_CMD_CTRL", _IOC_READ|_IOC_WRITE, 0x6473, 0x08 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY", _IOC_READ|_IOC_WRITE, 0x6470, 0x50 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", _IOC_READ|_IOC_WRITE, 0x6472, 0x28 },
@@ -715,6 +716,7 @@
 { "linux/dm-ioctl.h", "DM_TABLE_STATUS", _IOC_READ|_IOC_WRITE, 0xfd0c, 0x138 },
 { "linux/dm-ioctl.h", "DM_TARGET_MSG", _IOC_READ|_IOC_WRITE, 0xfd0e, 0x138 },
 { "linux/dm-ioctl.h", "DM_VERSION", _IOC_READ|_IOC_WRITE, 0xfd00, 0x138 },
+{ "linux/dma-buf.h", "DMA_BUF_IOCTL_SYNC", _IOC_WRITE, 0x6200, 0x08 },
 { "linux/dn.h", "OSIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
 { "linux/dn.h", "OSIOCSNETADDR", _IOC_WRITE, 0x89e0, 0x04 },
 { "linux/dn.h", "SIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
@@ -926,8 +928,11 @@
 { "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
 { "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
 { "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
 { "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
 { "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
+{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
 { "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },
 { "linux/fsl-diu-fb.h", "MFB_GET_AOID", _IOC_READ, 0x4d04, 0x08 },
 { "linux/fsl-diu-fb.h", "MFB_GET_GAMMA", _IOC_READ, 0x4d01, 0x01 },
@@ -964,6 +969,8 @@
 { "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
+{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
+{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
 { "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
 { "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
 { "linux/gsmmux.h", "GSMIOC_GETCONF", _IOC_READ, 0x4700, 0x4c },
@@ -1221,6 +1228,9 @@
 { "linux/joystick.h", "JSIOCSAXMAP", _IOC_WRITE, 0x6a31, 0x40 },
 { "linux/joystick.h", "JSIOCSBTNMAP", _IOC_WRITE, 0x6a33, 0x400 },
 { "linux/joystick.h", "JSIOCSCORR", _IOC_WRITE, 0x6a21, 0x24 },
+{ "linux/kcov.h", "KCOV_DISABLE", _IOC_NONE, 0x6365, 0x00 },
+{ "linux/kcov.h", "KCOV_ENABLE", _IOC_NONE, 0x6364, 0x00 },
+{ "linux/kcov.h", "KCOV_INIT_TRACE", _IOC_READ, 0x6301, 0x04 },
 { "linux/kd.h", "GIO_CMAP", 0, 0x4B70, 0 },
 { "linux/kd.h", "GIO_FONT", 0, 0x4B60, 0 },
 { "linux/kd.h", "GIO_FONTX", 0, 0x4B6B, 0 },
@@ -1298,6 +1308,7 @@
 { "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
 { "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
+{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
 { "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
 { "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
@@ -1469,6 +1480,7 @@
 { "linux/media.h", "MEDIA_IOC_DEVICE_INFO", _IOC_READ|_IOC_WRITE, 0x7c00, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_ENTITIES", _IOC_READ|_IOC_WRITE, 0x7c01, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_LINKS", _IOC_READ|_IOC_WRITE, 0x7c02, 0x1c },
+{ "linux/media.h", "MEDIA_IOC_G_TOPOLOGY", _IOC_READ|_IOC_WRITE, 0x7c04, 0x48 },
 { "linux/media.h", "MEDIA_IOC_SETUP_LINK", _IOC_READ|_IOC_WRITE, 0x7c03, 0x34 },
 { "linux/mei.h", "IOCTL_MEI_CONNECT_CLIENT", _IOC_READ|_IOC_WRITE, 0x4801, 0x10 },
 { "linux/mei.h", "IOCTL_MEI_NOTIFY_GET", _IOC_READ, 0x4803, 0x04 },
@@ -1532,6 +1544,7 @@
 { "linux/ndctl.h", "ND_IOCTL_ARS_CAP", _IOC_READ|_IOC_WRITE, 0x4e01, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_ARS_START", _IOC_READ|_IOC_WRITE, 0x4e02, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_ARS_STATUS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x30 },
+{ "linux/ndctl.h", "ND_IOCTL_CLEAR_ERROR", _IOC_READ|_IOC_WRITE, 0x4e04, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_DIMM_FLAGS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x08 },
 { "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_DATA", _IOC_READ|_IOC_WRITE, 0x4e05, 0x0c },
 { "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_SIZE", _IOC_READ|_IOC_WRITE, 0x4e04, 0x0c },
@@ -1688,6 +1701,7 @@
 { "linux/ptp_clock.h", "PTP_PIN_GETFUNC", _IOC_READ|_IOC_WRITE, 0x3d06, 0x60 },
 { "linux/ptp_clock.h", "PTP_PIN_SETFUNC", _IOC_WRITE, 0x3d07, 0x60 },
 { "linux/ptp_clock.h", "PTP_SYS_OFFSET", _IOC_WRITE, 0x3d05, 0x340 },
+{ "linux/ptp_clock.h", "PTP_SYS_OFFSET_PRECISE", _IOC_READ|_IOC_WRITE, 0x3d08, 0x40 },
 { "linux/radeonfb.h", "FBIO_RADEON_GET_MIRROR", _IOC_READ, 0x4003, 0x04 },
 { "linux/radeonfb.h", "FBIO_RADEON_SET_MIRROR", _IOC_WRITE, 0x4004, 0x04 },
 { "linux/raid/md_u.h", "ADD_NEW_DISK", _IOC_WRITE, 0x0921, 0x14 },
@@ -1722,6 +1736,30 @@
 { "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
 { "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x04 },
 { "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
+{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d0a, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0c, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d09, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0b, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_FREE_DMA", _IOC_WRITE, 0x6d14, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_GET_EVENT_MASK", _IOC_READ, 0x6d0e, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_INBOUND", _IOC_READ|_IOC_WRITE, 0x6d11, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_OUTBOUND", _IOC_READ|_IOC_WRITE, 0x6d0f, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_GET_PROPERTIES", _IOC_READ, 0x6d04, 0x30 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_COMPTAG_SET", _IOC_WRITE, 0x6d02, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_HDID_SET", _IOC_WRITE, 0x6d01, 0x02 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_PORT_IDX_GET", _IOC_READ, 0x6d03, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_LOCAL", _IOC_READ, 0x6d05, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_REMOTE", _IOC_READ, 0x6d07, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_LOCAL", _IOC_WRITE, 0x6d06, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_REMOTE", _IOC_WRITE, 0x6d08, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_SET_EVENT_MASK", _IOC_WRITE, 0x6d0d, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_TRANSFER", _IOC_READ|_IOC_WRITE, 0x6d15, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
 { "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
 { "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
 { "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@@ -2081,6 +2119,11 @@
 { "linux/usb/iowarrior.h", "IOW_GETINFO", _IOC_READ, 0xc003, 0x28 },
 { "linux/usb/iowarrior.h", "IOW_READ", _IOC_WRITE, 0xc002, 0x04 },
 { "linux/usb/iowarrior.h", "IOW_WRITE", _IOC_WRITE, 0xc001, 0x04 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GET_CAPS", _IOC_READ, 0x5b11, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GOTO_LOCAL", _IOC_NONE, 0x5b14, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_LOCAL_LOCKOUT", _IOC_NONE, 0x5b15, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_READ_STB", _IOC_READ, 0x5b12, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_REN_CONTROL", _IOC_WRITE, 0x5b13, 0x01 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_IN", _IOC_NONE, 0x5b04, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_OUT", _IOC_NONE, 0x5b03, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_CLEAR", _IOC_NONE, 0x5b02, 0x00 },
@@ -2102,6 +2145,7 @@
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCONNECT_CLAIM", _IOC_READ, 0x551b, 0x108 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL", _IOC_READ, 0x550e, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL32", _IOC_READ, 0x550e, 0x08 },
+{ "linux/usbdevice_fs.h", "USBDEVFS_DROP_PRIVILEGES", _IOC_WRITE, 0x551e, 0x04 },
 { "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
@@ -2173,6 +2217,7 @@
 { "linux/vfio.h", "VFIO_SET_IOMMU", _IOC_NONE, 0x3b66, 0x00 },
 { "linux/vhost.h", "VHOST_GET_FEATURES", _IOC_READ, 0xaf00, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_BASE", _IOC_READ|_IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf24, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_ENDIAN", _IOC_WRITE, 0xaf14, 0x08 },
 { "linux/vhost.h", "VHOST_NET_SET_BACKEND", _IOC_WRITE, 0xaf30, 0x08 },
 { "linux/vhost.h", "VHOST_RESET_OWNER", _IOC_NONE, 0xaf02, 0x00 },
@@ -2188,6 +2233,7 @@
 { "linux/vhost.h", "VHOST_SET_OWNER", _IOC_NONE, 0xaf01, 0x00 },
 { "linux/vhost.h", "VHOST_SET_VRING_ADDR", _IOC_WRITE, 0xaf11, 0x28 },
 { "linux/vhost.h", "VHOST_SET_VRING_BASE", _IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf23, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_CALL", _IOC_WRITE, 0xaf21, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ENDIAN", _IOC_WRITE, 0xaf13, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
@@ -2392,9 +2438,11 @@
 { "media/v4l2-subdev.h", "V4L2_DEVICE_NOTIFY_EVENT", _IOC_WRITE, 0x7602, 0x78 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_RX_NOTIFY", _IOC_WRITE, 0x7600, 0x04 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_TX_NOTIFY", _IOC_WRITE, 0x7601, 0x04 },
+{ "misc/cxl.h", "CXL_IOCTL_DOWNLOAD_IMAGE", _IOC_WRITE, 0xca0a, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_AFU_ID", _IOC_READ, 0xca02, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_PROCESS_ELEMENT", _IOC_READ, 0xca01, 0x04 },
 { "misc/cxl.h", "CXL_IOCTL_START_WORK", _IOC_WRITE, 0xca00, 0x40 },
+{ "misc/cxl.h", "CXL_IOCTL_VALIDATE_IMAGE", _IOC_WRITE, 0xca0b, 0x40 },
 { "mtd/mtd-abi.h", "ECCGETLAYOUT", _IOC_READ, 0x4d11, 0x148 },
 { "mtd/mtd-abi.h", "ECCGETSTATS", _IOC_READ, 0x4d12, 0x10 },
 { "mtd/mtd-abi.h", "MEMERASE", _IOC_WRITE, 0x4d02, 0x08 },
@@ -2516,7 +2564,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_PORT_INFO", _IOC_READ|_IOC_WRITE, 0x5322, 0xa4 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", _IOC_READ|_IOC_WRITE, 0x5349, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5334, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", _IOC_READ|_IOC_WRITE, 0x5343, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS", _IOC_READ|_IOC_WRITE, 0x5340, 0x5c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO", _IOC_READ|_IOC_WRITE, 0x5341, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", _IOC_READ|_IOC_WRITE, 0x5345, 0x60 },
@@ -2532,7 +2579,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_PORT_INFO", _IOC_WRITE, 0x5323, 0xa4 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", _IOC_WRITE, 0x534a, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5335, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", _IOC_WRITE, 0x5344, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", _IOC_WRITE, 0x5342, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", _IOC_WRITE, 0x5346, 0x60 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT", _IOC_WRITE, 0x5330, 0x50 },
@@ -2711,7 +2757,6 @@
 { "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
 { "staging/android/sync.h", "SYNC_IOC_FENCE_INFO", _IOC_READ|_IOC_WRITE, 0x3e02, 0x28 },
 { "staging/android/sync.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e01, 0x28 },
-{ "staging/android/sync.h", "SYNC_IOC_WAIT", _IOC_WRITE, 0x3e00, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
 { "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
diff --git a/linux/32/ioctls_inc_align64.h b/linux/32/ioctls_inc_align64.h
index 0465c37..5dd46e3 100644
--- a/linux/32/ioctls_inc_align64.h
+++ b/linux/32/ioctls_inc_align64.h
@@ -195,6 +195,7 @@
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", _IOC_READ|_IOC_WRITE, 0x6461, 0x28 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_GET", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
+{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_MAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_CMD_CTRL", _IOC_READ|_IOC_WRITE, 0x6473, 0x08 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY", _IOC_READ|_IOC_WRITE, 0x6470, 0x50 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", _IOC_READ|_IOC_WRITE, 0x6472, 0x28 },
@@ -715,6 +716,7 @@
 { "linux/dm-ioctl.h", "DM_TABLE_STATUS", _IOC_READ|_IOC_WRITE, 0xfd0c, 0x138 },
 { "linux/dm-ioctl.h", "DM_TARGET_MSG", _IOC_READ|_IOC_WRITE, 0xfd0e, 0x138 },
 { "linux/dm-ioctl.h", "DM_VERSION", _IOC_READ|_IOC_WRITE, 0xfd00, 0x138 },
+{ "linux/dma-buf.h", "DMA_BUF_IOCTL_SYNC", _IOC_WRITE, 0x6200, 0x08 },
 { "linux/dn.h", "OSIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
 { "linux/dn.h", "OSIOCSNETADDR", _IOC_WRITE, 0x89e0, 0x04 },
 { "linux/dn.h", "SIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
@@ -926,8 +928,11 @@
 { "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
 { "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
 { "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
 { "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
 { "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
+{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
 { "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },
 { "linux/fsl-diu-fb.h", "MFB_GET_AOID", _IOC_READ, 0x4d04, 0x08 },
 { "linux/fsl-diu-fb.h", "MFB_GET_GAMMA", _IOC_READ, 0x4d01, 0x01 },
@@ -964,6 +969,8 @@
 { "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
+{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
+{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
 { "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
 { "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
 { "linux/gsmmux.h", "GSMIOC_GETCONF", _IOC_READ, 0x4700, 0x4c },
@@ -1221,6 +1228,9 @@
 { "linux/joystick.h", "JSIOCSAXMAP", _IOC_WRITE, 0x6a31, 0x40 },
 { "linux/joystick.h", "JSIOCSBTNMAP", _IOC_WRITE, 0x6a33, 0x400 },
 { "linux/joystick.h", "JSIOCSCORR", _IOC_WRITE, 0x6a21, 0x24 },
+{ "linux/kcov.h", "KCOV_DISABLE", _IOC_NONE, 0x6365, 0x00 },
+{ "linux/kcov.h", "KCOV_ENABLE", _IOC_NONE, 0x6364, 0x00 },
+{ "linux/kcov.h", "KCOV_INIT_TRACE", _IOC_READ, 0x6301, 0x04 },
 { "linux/kd.h", "GIO_CMAP", 0, 0x4B70, 0 },
 { "linux/kd.h", "GIO_FONT", 0, 0x4B60, 0 },
 { "linux/kd.h", "GIO_FONTX", 0, 0x4B6B, 0 },
@@ -1298,6 +1308,7 @@
 { "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
 { "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
+{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
 { "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
 { "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
@@ -1342,7 +1353,7 @@
 { "linux/kvm.h", "KVM_PPC_GET_HTAB_FD", _IOC_WRITE, 0xaeaa, 0x20 },
 { "linux/kvm.h", "KVM_PPC_GET_PVINFO", _IOC_WRITE, 0xaea1, 0x80 },
 { "linux/kvm.h", "KVM_PPC_GET_SMMU_INFO", _IOC_READ, 0xaea6, 0x250 },
-{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x200 },
+{ "linux/kvm.h", "KVM_PPC_RTAS_DEFINE_TOKEN", _IOC_WRITE, 0xaeac, 0x80 },
 { "linux/kvm.h", "KVM_REGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae67, 0x10 },
 { "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
 { "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
@@ -1469,6 +1480,7 @@
 { "linux/media.h", "MEDIA_IOC_DEVICE_INFO", _IOC_READ|_IOC_WRITE, 0x7c00, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_ENTITIES", _IOC_READ|_IOC_WRITE, 0x7c01, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_LINKS", _IOC_READ|_IOC_WRITE, 0x7c02, 0x1c },
+{ "linux/media.h", "MEDIA_IOC_G_TOPOLOGY", _IOC_READ|_IOC_WRITE, 0x7c04, 0x48 },
 { "linux/media.h", "MEDIA_IOC_SETUP_LINK", _IOC_READ|_IOC_WRITE, 0x7c03, 0x34 },
 { "linux/mei.h", "IOCTL_MEI_CONNECT_CLIENT", _IOC_READ|_IOC_WRITE, 0x4801, 0x10 },
 { "linux/mei.h", "IOCTL_MEI_NOTIFY_GET", _IOC_READ, 0x4803, 0x04 },
@@ -1532,6 +1544,7 @@
 { "linux/ndctl.h", "ND_IOCTL_ARS_CAP", _IOC_READ|_IOC_WRITE, 0x4e01, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_ARS_START", _IOC_READ|_IOC_WRITE, 0x4e02, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_ARS_STATUS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x30 },
+{ "linux/ndctl.h", "ND_IOCTL_CLEAR_ERROR", _IOC_READ|_IOC_WRITE, 0x4e04, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_DIMM_FLAGS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x08 },
 { "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_DATA", _IOC_READ|_IOC_WRITE, 0x4e05, 0x0c },
 { "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_SIZE", _IOC_READ|_IOC_WRITE, 0x4e04, 0x0c },
@@ -1688,6 +1701,7 @@
 { "linux/ptp_clock.h", "PTP_PIN_GETFUNC", _IOC_READ|_IOC_WRITE, 0x3d06, 0x60 },
 { "linux/ptp_clock.h", "PTP_PIN_SETFUNC", _IOC_WRITE, 0x3d07, 0x60 },
 { "linux/ptp_clock.h", "PTP_SYS_OFFSET", _IOC_WRITE, 0x3d05, 0x340 },
+{ "linux/ptp_clock.h", "PTP_SYS_OFFSET_PRECISE", _IOC_READ|_IOC_WRITE, 0x3d08, 0x40 },
 { "linux/radeonfb.h", "FBIO_RADEON_GET_MIRROR", _IOC_READ, 0x4003, 0x04 },
 { "linux/radeonfb.h", "FBIO_RADEON_SET_MIRROR", _IOC_WRITE, 0x4004, 0x04 },
 { "linux/raid/md_u.h", "ADD_NEW_DISK", _IOC_WRITE, 0x0921, 0x14 },
@@ -1722,6 +1736,30 @@
 { "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
 { "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x04 },
 { "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
+{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d0a, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0c, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d09, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0b, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_FREE_DMA", _IOC_WRITE, 0x6d14, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_GET_EVENT_MASK", _IOC_READ, 0x6d0e, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_INBOUND", _IOC_READ|_IOC_WRITE, 0x6d11, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_OUTBOUND", _IOC_READ|_IOC_WRITE, 0x6d0f, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_GET_PROPERTIES", _IOC_READ, 0x6d04, 0x30 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_COMPTAG_SET", _IOC_WRITE, 0x6d02, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_HDID_SET", _IOC_WRITE, 0x6d01, 0x02 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_PORT_IDX_GET", _IOC_READ, 0x6d03, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_LOCAL", _IOC_READ, 0x6d05, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_REMOTE", _IOC_READ, 0x6d07, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_LOCAL", _IOC_WRITE, 0x6d06, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_REMOTE", _IOC_WRITE, 0x6d08, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_SET_EVENT_MASK", _IOC_WRITE, 0x6d0d, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_TRANSFER", _IOC_READ|_IOC_WRITE, 0x6d15, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
 { "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
 { "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
 { "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@@ -2081,6 +2119,11 @@
 { "linux/usb/iowarrior.h", "IOW_GETINFO", _IOC_READ, 0xc003, 0x28 },
 { "linux/usb/iowarrior.h", "IOW_READ", _IOC_WRITE, 0xc002, 0x04 },
 { "linux/usb/iowarrior.h", "IOW_WRITE", _IOC_WRITE, 0xc001, 0x04 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GET_CAPS", _IOC_READ, 0x5b11, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GOTO_LOCAL", _IOC_NONE, 0x5b14, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_LOCAL_LOCKOUT", _IOC_NONE, 0x5b15, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_READ_STB", _IOC_READ, 0x5b12, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_REN_CONTROL", _IOC_WRITE, 0x5b13, 0x01 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_IN", _IOC_NONE, 0x5b04, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_OUT", _IOC_NONE, 0x5b03, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_CLEAR", _IOC_NONE, 0x5b02, 0x00 },
@@ -2102,6 +2145,7 @@
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCONNECT_CLAIM", _IOC_READ, 0x551b, 0x108 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL", _IOC_READ, 0x550e, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL32", _IOC_READ, 0x550e, 0x08 },
+{ "linux/usbdevice_fs.h", "USBDEVFS_DROP_PRIVILEGES", _IOC_WRITE, 0x551e, 0x04 },
 { "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
@@ -2173,6 +2217,7 @@
 { "linux/vfio.h", "VFIO_SET_IOMMU", _IOC_NONE, 0x3b66, 0x00 },
 { "linux/vhost.h", "VHOST_GET_FEATURES", _IOC_READ, 0xaf00, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_BASE", _IOC_READ|_IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf24, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_ENDIAN", _IOC_WRITE, 0xaf14, 0x08 },
 { "linux/vhost.h", "VHOST_NET_SET_BACKEND", _IOC_WRITE, 0xaf30, 0x08 },
 { "linux/vhost.h", "VHOST_RESET_OWNER", _IOC_NONE, 0xaf02, 0x00 },
@@ -2188,6 +2233,7 @@
 { "linux/vhost.h", "VHOST_SET_OWNER", _IOC_NONE, 0xaf01, 0x00 },
 { "linux/vhost.h", "VHOST_SET_VRING_ADDR", _IOC_WRITE, 0xaf11, 0x28 },
 { "linux/vhost.h", "VHOST_SET_VRING_BASE", _IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf23, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_CALL", _IOC_WRITE, 0xaf21, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ENDIAN", _IOC_WRITE, 0xaf13, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
@@ -2392,9 +2438,11 @@
 { "media/v4l2-subdev.h", "V4L2_DEVICE_NOTIFY_EVENT", _IOC_WRITE, 0x7602, 0x80 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_RX_NOTIFY", _IOC_WRITE, 0x7600, 0x04 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_TX_NOTIFY", _IOC_WRITE, 0x7601, 0x04 },
+{ "misc/cxl.h", "CXL_IOCTL_DOWNLOAD_IMAGE", _IOC_WRITE, 0xca0a, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_AFU_ID", _IOC_READ, 0xca02, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_PROCESS_ELEMENT", _IOC_READ, 0xca01, 0x04 },
 { "misc/cxl.h", "CXL_IOCTL_START_WORK", _IOC_WRITE, 0xca00, 0x40 },
+{ "misc/cxl.h", "CXL_IOCTL_VALIDATE_IMAGE", _IOC_WRITE, 0xca0b, 0x40 },
 { "mtd/mtd-abi.h", "ECCGETLAYOUT", _IOC_READ, 0x4d11, 0x148 },
 { "mtd/mtd-abi.h", "ECCGETSTATS", _IOC_READ, 0x4d12, 0x10 },
 { "mtd/mtd-abi.h", "MEMERASE", _IOC_WRITE, 0x4d02, 0x08 },
@@ -2516,7 +2564,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_PORT_INFO", _IOC_READ|_IOC_WRITE, 0x5322, 0xa4 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", _IOC_READ|_IOC_WRITE, 0x5349, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5334, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", _IOC_READ|_IOC_WRITE, 0x5343, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS", _IOC_READ|_IOC_WRITE, 0x5340, 0x5c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO", _IOC_READ|_IOC_WRITE, 0x5341, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", _IOC_READ|_IOC_WRITE, 0x5345, 0x60 },
@@ -2532,7 +2579,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_PORT_INFO", _IOC_WRITE, 0x5323, 0xa4 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", _IOC_WRITE, 0x534a, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5335, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", _IOC_WRITE, 0x5344, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", _IOC_WRITE, 0x5342, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", _IOC_WRITE, 0x5346, 0x60 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT", _IOC_WRITE, 0x5330, 0x50 },
@@ -2711,7 +2757,6 @@
 { "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
 { "staging/android/sync.h", "SYNC_IOC_FENCE_INFO", _IOC_READ|_IOC_WRITE, 0x3e02, 0x28 },
 { "staging/android/sync.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e01, 0x28 },
-{ "staging/android/sync.h", "SYNC_IOC_WAIT", _IOC_WRITE, 0x3e00, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
 { "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h
index 03874ac..9c86485 100644
--- a/linux/32/syscallent.h
+++ b/linux/32/syscallent.h
@@ -276,6 +276,8 @@
 [283] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [284] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [285] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
+[286] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[287] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #undef sys_ARCH_mmap
 #undef ARCH_WANT_SYNC_FILE_RANGE2
diff --git a/linux/64/ioctls_inc.h b/linux/64/ioctls_inc.h
index 796a49f..4386e34 100644
--- a/linux/64/ioctls_inc.h
+++ b/linux/64/ioctls_inc.h
@@ -195,6 +195,7 @@
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", _IOC_READ|_IOC_WRITE, 0x6461, 0x28 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_GET", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
+{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_MAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_CMD_CTRL", _IOC_READ|_IOC_WRITE, 0x6473, 0x08 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY", _IOC_READ|_IOC_WRITE, 0x6470, 0x50 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", _IOC_READ|_IOC_WRITE, 0x6472, 0x28 },
@@ -715,6 +716,7 @@
 { "linux/dm-ioctl.h", "DM_TABLE_STATUS", _IOC_READ|_IOC_WRITE, 0xfd0c, 0x138 },
 { "linux/dm-ioctl.h", "DM_TARGET_MSG", _IOC_READ|_IOC_WRITE, 0xfd0e, 0x138 },
 { "linux/dm-ioctl.h", "DM_VERSION", _IOC_READ|_IOC_WRITE, 0xfd00, 0x138 },
+{ "linux/dma-buf.h", "DMA_BUF_IOCTL_SYNC", _IOC_WRITE, 0x6200, 0x08 },
 { "linux/dn.h", "OSIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
 { "linux/dn.h", "OSIOCSNETADDR", _IOC_WRITE, 0x89e0, 0x04 },
 { "linux/dn.h", "SIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
@@ -926,8 +928,11 @@
 { "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
 { "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x08 },
 { "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x08 },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
 { "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x08 },
 { "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x08 },
+{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
 { "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },
 { "linux/fsl-diu-fb.h", "MFB_GET_AOID", _IOC_READ, 0x4d04, 0x08 },
 { "linux/fsl-diu-fb.h", "MFB_GET_GAMMA", _IOC_READ, 0x4d01, 0x01 },
@@ -964,6 +969,8 @@
 { "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
+{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
+{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
 { "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
 { "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
 { "linux/gsmmux.h", "GSMIOC_GETCONF", _IOC_READ, 0x4700, 0x4c },
@@ -1221,6 +1228,9 @@
 { "linux/joystick.h", "JSIOCSAXMAP", _IOC_WRITE, 0x6a31, 0x40 },
 { "linux/joystick.h", "JSIOCSBTNMAP", _IOC_WRITE, 0x6a33, 0x400 },
 { "linux/joystick.h", "JSIOCSCORR", _IOC_WRITE, 0x6a21, 0x24 },
+{ "linux/kcov.h", "KCOV_DISABLE", _IOC_NONE, 0x6365, 0x00 },
+{ "linux/kcov.h", "KCOV_ENABLE", _IOC_NONE, 0x6364, 0x00 },
+{ "linux/kcov.h", "KCOV_INIT_TRACE", _IOC_READ, 0x6301, 0x08 },
 { "linux/kd.h", "GIO_CMAP", 0, 0x4B70, 0 },
 { "linux/kd.h", "GIO_FONT", 0, 0x4B60, 0 },
 { "linux/kd.h", "GIO_FONTX", 0, 0x4B6B, 0 },
@@ -1298,6 +1308,7 @@
 { "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
 { "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
+{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
 { "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
 { "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
@@ -1469,6 +1480,7 @@
 { "linux/media.h", "MEDIA_IOC_DEVICE_INFO", _IOC_READ|_IOC_WRITE, 0x7c00, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_ENTITIES", _IOC_READ|_IOC_WRITE, 0x7c01, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_LINKS", _IOC_READ|_IOC_WRITE, 0x7c02, 0x28 },
+{ "linux/media.h", "MEDIA_IOC_G_TOPOLOGY", _IOC_READ|_IOC_WRITE, 0x7c04, 0x48 },
 { "linux/media.h", "MEDIA_IOC_SETUP_LINK", _IOC_READ|_IOC_WRITE, 0x7c03, 0x34 },
 { "linux/mei.h", "IOCTL_MEI_CONNECT_CLIENT", _IOC_READ|_IOC_WRITE, 0x4801, 0x10 },
 { "linux/mei.h", "IOCTL_MEI_NOTIFY_GET", _IOC_READ, 0x4803, 0x04 },
@@ -1532,6 +1544,7 @@
 { "linux/ndctl.h", "ND_IOCTL_ARS_CAP", _IOC_READ|_IOC_WRITE, 0x4e01, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_ARS_START", _IOC_READ|_IOC_WRITE, 0x4e02, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_ARS_STATUS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x30 },
+{ "linux/ndctl.h", "ND_IOCTL_CLEAR_ERROR", _IOC_READ|_IOC_WRITE, 0x4e04, 0x20 },
 { "linux/ndctl.h", "ND_IOCTL_DIMM_FLAGS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x08 },
 { "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_DATA", _IOC_READ|_IOC_WRITE, 0x4e05, 0x0c },
 { "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_SIZE", _IOC_READ|_IOC_WRITE, 0x4e04, 0x0c },
@@ -1688,6 +1701,7 @@
 { "linux/ptp_clock.h", "PTP_PIN_GETFUNC", _IOC_READ|_IOC_WRITE, 0x3d06, 0x60 },
 { "linux/ptp_clock.h", "PTP_PIN_SETFUNC", _IOC_WRITE, 0x3d07, 0x60 },
 { "linux/ptp_clock.h", "PTP_SYS_OFFSET", _IOC_WRITE, 0x3d05, 0x340 },
+{ "linux/ptp_clock.h", "PTP_SYS_OFFSET_PRECISE", _IOC_READ|_IOC_WRITE, 0x3d08, 0x40 },
 { "linux/radeonfb.h", "FBIO_RADEON_GET_MIRROR", _IOC_READ, 0x4003, 0x08 },
 { "linux/radeonfb.h", "FBIO_RADEON_SET_MIRROR", _IOC_WRITE, 0x4004, 0x08 },
 { "linux/raid/md_u.h", "ADD_NEW_DISK", _IOC_WRITE, 0x0921, 0x14 },
@@ -1722,6 +1736,30 @@
 { "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
 { "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x08 },
 { "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
+{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d0a, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0c, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d09, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0b, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_FREE_DMA", _IOC_WRITE, 0x6d14, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_GET_EVENT_MASK", _IOC_READ, 0x6d0e, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_INBOUND", _IOC_READ|_IOC_WRITE, 0x6d11, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_OUTBOUND", _IOC_READ|_IOC_WRITE, 0x6d0f, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_GET_PROPERTIES", _IOC_READ, 0x6d04, 0x30 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_COMPTAG_SET", _IOC_WRITE, 0x6d02, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_HDID_SET", _IOC_WRITE, 0x6d01, 0x02 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_PORT_IDX_GET", _IOC_READ, 0x6d03, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_LOCAL", _IOC_READ, 0x6d05, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_REMOTE", _IOC_READ, 0x6d07, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_LOCAL", _IOC_WRITE, 0x6d06, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_REMOTE", _IOC_WRITE, 0x6d08, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_SET_EVENT_MASK", _IOC_WRITE, 0x6d0d, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_TRANSFER", _IOC_READ|_IOC_WRITE, 0x6d15, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
 { "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
 { "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
 { "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@@ -2081,6 +2119,11 @@
 { "linux/usb/iowarrior.h", "IOW_GETINFO", _IOC_READ, 0xc003, 0x28 },
 { "linux/usb/iowarrior.h", "IOW_READ", _IOC_WRITE, 0xc002, 0x08 },
 { "linux/usb/iowarrior.h", "IOW_WRITE", _IOC_WRITE, 0xc001, 0x08 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GET_CAPS", _IOC_READ, 0x5b11, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GOTO_LOCAL", _IOC_NONE, 0x5b14, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_LOCAL_LOCKOUT", _IOC_NONE, 0x5b15, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_READ_STB", _IOC_READ, 0x5b12, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_REN_CONTROL", _IOC_WRITE, 0x5b13, 0x01 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_IN", _IOC_NONE, 0x5b04, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_OUT", _IOC_NONE, 0x5b03, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_CLEAR", _IOC_NONE, 0x5b02, 0x00 },
@@ -2102,6 +2145,7 @@
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCONNECT_CLAIM", _IOC_READ, 0x551b, 0x108 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL", _IOC_READ, 0x550e, 0x10 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL32", _IOC_READ, 0x550e, 0x08 },
+{ "linux/usbdevice_fs.h", "USBDEVFS_DROP_PRIVILEGES", _IOC_WRITE, 0x551e, 0x04 },
 { "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
@@ -2173,6 +2217,7 @@
 { "linux/vfio.h", "VFIO_SET_IOMMU", _IOC_NONE, 0x3b66, 0x00 },
 { "linux/vhost.h", "VHOST_GET_FEATURES", _IOC_READ, 0xaf00, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_BASE", _IOC_READ|_IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf24, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_ENDIAN", _IOC_WRITE, 0xaf14, 0x08 },
 { "linux/vhost.h", "VHOST_NET_SET_BACKEND", _IOC_WRITE, 0xaf30, 0x08 },
 { "linux/vhost.h", "VHOST_RESET_OWNER", _IOC_NONE, 0xaf02, 0x00 },
@@ -2188,6 +2233,7 @@
 { "linux/vhost.h", "VHOST_SET_OWNER", _IOC_NONE, 0xaf01, 0x00 },
 { "linux/vhost.h", "VHOST_SET_VRING_ADDR", _IOC_WRITE, 0xaf11, 0x28 },
 { "linux/vhost.h", "VHOST_SET_VRING_BASE", _IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf23, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_CALL", _IOC_WRITE, 0xaf21, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ENDIAN", _IOC_WRITE, 0xaf13, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
@@ -2392,9 +2438,11 @@
 { "media/v4l2-subdev.h", "V4L2_DEVICE_NOTIFY_EVENT", _IOC_WRITE, 0x7602, 0x88 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_RX_NOTIFY", _IOC_WRITE, 0x7600, 0x04 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_TX_NOTIFY", _IOC_WRITE, 0x7601, 0x04 },
+{ "misc/cxl.h", "CXL_IOCTL_DOWNLOAD_IMAGE", _IOC_WRITE, 0xca0a, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_AFU_ID", _IOC_READ, 0xca02, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_PROCESS_ELEMENT", _IOC_READ, 0xca01, 0x04 },
 { "misc/cxl.h", "CXL_IOCTL_START_WORK", _IOC_WRITE, 0xca00, 0x40 },
+{ "misc/cxl.h", "CXL_IOCTL_VALIDATE_IMAGE", _IOC_WRITE, 0xca0b, 0x40 },
 { "mtd/mtd-abi.h", "ECCGETLAYOUT", _IOC_READ, 0x4d11, 0x148 },
 { "mtd/mtd-abi.h", "ECCGETSTATS", _IOC_READ, 0x4d12, 0x10 },
 { "mtd/mtd-abi.h", "MEMERASE", _IOC_WRITE, 0x4d02, 0x08 },
@@ -2516,7 +2564,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_PORT_INFO", _IOC_READ|_IOC_WRITE, 0x5322, 0xa8 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", _IOC_READ|_IOC_WRITE, 0x5349, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5334, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", _IOC_READ|_IOC_WRITE, 0x5343, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS", _IOC_READ|_IOC_WRITE, 0x5340, 0x5c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO", _IOC_READ|_IOC_WRITE, 0x5341, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", _IOC_READ|_IOC_WRITE, 0x5345, 0x60 },
@@ -2532,7 +2579,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_PORT_INFO", _IOC_WRITE, 0x5323, 0xa8 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", _IOC_WRITE, 0x534a, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5335, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", _IOC_WRITE, 0x5344, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", _IOC_WRITE, 0x5342, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", _IOC_WRITE, 0x5346, 0x60 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT", _IOC_WRITE, 0x5330, 0x50 },
@@ -2711,7 +2757,6 @@
 { "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
 { "staging/android/sync.h", "SYNC_IOC_FENCE_INFO", _IOC_READ|_IOC_WRITE, 0x3e02, 0x28 },
 { "staging/android/sync.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e01, 0x28 },
-{ "staging/android/sync.h", "SYNC_IOC_WAIT", _IOC_WRITE, 0x3e00, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
 { "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
diff --git a/linux/64/syscallent.h b/linux/64/syscallent.h
index fc78605..55c011c 100644
--- a/linux/64/syscallent.h
+++ b/linux/64/syscallent.h
@@ -269,3 +269,5 @@
 [283] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [284] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [285] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
+[286] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[287] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
diff --git a/linux/alpha/syscallent.h b/linux/alpha/syscallent.h
index 1bddd24..eaa316f 100644
--- a/linux/alpha/syscallent.h
+++ b/linux/alpha/syscallent.h
@@ -212,7 +212,7 @@
 [206] = { 3,	TI,		SEN(semop),			"semop"			},
 [207] = { 1,	0,		SEN(printargs),			"osf_utsname"		},
 [208] = { 3,	TF,		SEN(chown),			"lchown"		},
-[209] = { 3,	TI|TM,		SEN(printargs),			"osf_shmat"		},
+[209] = { 3,	TI|TM|SI,	SEN(shmat),			"osf_shmat"		},
 [210] = { 3,	TI,		SEN(shmctl),			"shmctl"		},
 [211] = { 1,	TI|TM|SI,	SEN(shmdt),			"shmdt"			},
 [212] = { 3,	TI,		SEN(shmget),			"shmget"		},
@@ -230,8 +230,8 @@
 [224] = { 5,	0,		SEN(printargs),			"osf_stat"		}, /*not implemented */
 [225] = { 5,	0,		SEN(printargs),			"osf_lstat"		}, /*not implemented */
 [226] = { 5,	0,		SEN(printargs),			"osf_fstat"		}, /*not implemented */
-[227] = { 5,	0,		SEN(printargs),			"osf_statfs64"		}, /*not implemented */
-[228] = { 5,	0,		SEN(printargs),			"osf_fstatfs64"		}, /*not implemented */
+[227] = { 3,	0,		SEN(osf_statfs),		"osf_statfs64"		}, /*not implemented */
+[228] = { 3,	0,		SEN(osf_fstatfs),		"osf_fstatfs64"		}, /*not implemented */
 [229 ... 232] = { },
 [233] = { 1,	0,		SEN(getpgid),			"getpgid"		},
 [234] = { 1,	0,		SEN(getsid),			"getsid"		},
diff --git a/linux/arc/syscallent.h b/linux/arc/syscallent.h
index 1100008..c2db91a 100644
--- a/linux/arc/syscallent.h
+++ b/linux/arc/syscallent.h
@@ -1,6 +1,6 @@
 #define sys_ARCH_mmap sys_mmap_pgoff
 #include "32/syscallent.h"
+/* [244 ... 259] are arch specific */
 [244] = { 3,	0,	SEN(printargs),	"arc_cacheflush"},
 [245] = { 1,	0,	SEN(printargs),	"arc_settls"	},
 [246] = { 0,	0,	SEN(printargs),	"arc_gettls"	},
-[247 ... 259] = { },
diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
index a94bedc..18910e4 100644
--- a/linux/arm/syscallent.h
+++ b/linux/arm/syscallent.h
@@ -416,7 +416,8 @@
 [389] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [390] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [391] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[392 ... 399] = { },
+[392] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[393] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #ifdef __ARM_EABI__
 # define ARM_FIRST_SHUFFLED_SYSCALL 400
diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h
index de90634..0b4ceac 100644
--- a/linux/avr32/syscallent.h
+++ b/linux/avr32/syscallent.h
@@ -305,7 +305,7 @@
 [277] = { 3,	TI,		SEN(shmctl),			"shmctl"		},
 [278] = { 4,	TD|TF,		SEN(utimensat),			"utimensat"		},
 [279] = { 3,	TD|TS,		SEN(signalfd),			"signalfd"		},
-[280] = { 2,	TD,		SEN(timerfd),			"timerfd"		},
+[280] = { 4,	TD,		SEN(timerfd),			"timerfd"		},
 [281] = { 1,	TD,		SEN(eventfd),			"eventfd"		},
 [282] = { },
 [283] = { 2,	TD,		SEN(setns),			"setns"			},
diff --git a/linux/dummy.h b/linux/dummy.h
index 984b290..bb23f5d 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -147,6 +147,7 @@
 #define	sys_query_module	printargs
 #define	sys_security		printargs
 #define	sys_stty		printargs
+#define	sys_timerfd		printargs
 #define	sys_tuxcall		printargs
 #define	sys_ulimit		printargs
 #define	sys_ustat		printargs
diff --git a/linux/hppa/errnoent.h b/linux/hppa/errnoent.h
index c78c03f..896980b 100644
--- a/linux/hppa/errnoent.h
+++ b/linux/hppa/errnoent.h
@@ -128,7 +128,7 @@
 [249] = "ELOOP",
 [251] = "ENOSYS",
 [252] = "ENOTSUP",
-[253] = "ECANCELLED",
+[253] = "ECANCELED",
 [254] = "EOWNERDEAD",
 [255] = "ENOTRECOVERABLE",
 [256] = "ERFKILL",
diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h
index a22e73e..4928047 100644
--- a/linux/hppa/syscallent.h
+++ b/linux/hppa/syscallent.h
@@ -349,3 +349,5 @@
 [344] = { 1,	TD,		SEN(userfaultfd),		"userfaultfd",		},
 [345] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [346] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
+[347] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[348] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h
index f91fe1d..d6175fa 100644
--- a/linux/i386/syscallent.h
+++ b/linux/i386/syscallent.h
@@ -403,7 +403,8 @@
 [375] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [376] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [377] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[378 ... 399] = { },
+[378] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[379] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h
index 911e21f..713cab8 100644
--- a/linux/ia64/syscallent.h
+++ b/linux/ia64/syscallent.h
@@ -364,3 +364,5 @@
 [1345] = { 5,	0,		SEN(kcmp),			"kcmp"			},
 [1346] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [1347] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
+[1348] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[1349] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h
index 23d507d..0f4895c 100644
--- a/linux/m68k/syscallent.h
+++ b/linux/m68k/syscallent.h
@@ -402,7 +402,8 @@
 [374] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [375] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [376] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[377 ... 399] = { },
+[377] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[378] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/metag/syscallent.h b/linux/metag/syscallent.h
index b2d1e66..82ad55b 100644
--- a/linux/metag/syscallent.h
+++ b/linux/metag/syscallent.h
@@ -1,7 +1,6 @@
 #include "32/syscallent.h"
-[244] = { },
+/* [244 ... 259] are arch specific */
 [245] = { 2,	0,	SEN(printargs),	"metag_setglobalbit"	},
 [246] = { 1,	0,	SEN(printargs),	"metag_set_fpu_flags"	},
 [247] = { 1,	0,	SEN(printargs),	"metag_set_tls"		},
 [248] = { 0,	NF,	SEN(printargs),	"metag_get_tls"		},
-[249 ... 259] = { },
diff --git a/linux/mips/syscallent-compat.h b/linux/mips/syscallent-compat.h
index 85bbff1..82a373b 100644
--- a/linux/mips/syscallent-compat.h
+++ b/linux/mips/syscallent-compat.h
@@ -149,8 +149,6 @@
 [ 207] = { 0,	0,	SEN(printargs),		"svr4_areadv"	},
 [ 208] = { 0,	0,	SEN(printargs),		"svr4_awritev"	},
 
-[209 ... 999] = { }, /* end of SVR4 */
-
 [1000] = { 0,	0,	SEN(printargs),		"sysv_syscall"	}, /* start of SYSV */
 [1001] = { 0,	0,	SEN(printargs),		"sysv_exit"	},
 [1002] = { 0,	0,	SEN(printargs),		"sysv_fork"	},
@@ -336,8 +334,6 @@
 [1187] = { 0,	0,	SEN(printargs),		"sysv_pread"	},
 [1188] = { 0,	0,	SEN(printargs),		"sysv_pwrite"	},
 
-[1189 ... 1999] = { }, /* end of SYSV */
-
 [2000] = { 0,	0,	SEN(printargs),		"bsd43_syscall"	}, /* start of BSD 4.3 */
 [2001] = { 0,	0,	SEN(printargs),		"bsd43_exit"	},
 [2002] = { 0,	0,	SEN(printargs),		"bsd43_fork"	},
@@ -531,8 +527,6 @@
 [2190] = { 0,	0,	SEN(printargs),		"bsd43_areadv"	},
 [2191] = { 0,	0,	SEN(printargs),		"bsd43_awritev"	},
 
-[2192 ... 2999] = { }, /* end of BSD 4.3 */
-
 [3000] = { 0,	0,	SEN(printargs),		"posix_syscall"	}, /* start of POSIX */
 [3001] = { 0,	0,	SEN(printargs),		"posix_exit"	},
 [3002] = { 0,	0,	SEN(printargs),		"posix_fork"	},
@@ -704,5 +698,3 @@
 [3266] = { 0,	0,	SEN(printargs),		"posix_sigprocmask"	},
 [3267] = { 0,	0,	SEN(printargs),		"posix_sigsuspend"	},
 [3268] = { 0,	0,	SEN(printargs),		"posix_sigaction"	},
-
-[3269 ... 3999] = { }, /* end of POSIX */
diff --git a/linux/mips/syscallent-n32.h b/linux/mips/syscallent-n32.h
index 57d9fb1..398b12c 100644
--- a/linux/mips/syscallent-n32.h
+++ b/linux/mips/syscallent-n32.h
@@ -325,7 +325,8 @@
 [6322] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [6323] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [6324] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[6325 ... 6399] = { },
+[6325] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[6326] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 # define SYS_socket_subcall      6400
 # include "subcall.h"
diff --git a/linux/mips/syscallent-n64.h b/linux/mips/syscallent-n64.h
index 170b6ee..7321f0e 100644
--- a/linux/mips/syscallent-n64.h
+++ b/linux/mips/syscallent-n64.h
@@ -321,16 +321,14 @@
 [5318] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [5319] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [5320] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[5321 ... 5399] = { },
+[5321] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[5322] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 # define SYS_socket_subcall      5400
 # include "subcall.h"
 
-/* end of Linux N64 */ [SYS_socket_subcall + SYS_socket_nsubcalls + SYS_ipc_nsubcalls ... 5999] = { },
-
 #else
 
 # include "syscallent-n64-stub.h"
-/* end of Linux N64 */ [5400 ... 5999] = { },
 
 #endif
diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h
index 7a75abd..cb8afb9 100644
--- a/linux/mips/syscallent-o32.h
+++ b/linux/mips/syscallent-o32.h
@@ -110,7 +110,7 @@
 [4107] = { 2,	TF,		SEN(lstat),			"lstat"			},
 [4108] = { 2,	TD,		SEN(fstat),			"fstat"			},
 [4109] = { 1,	0,		SEN(olduname),			"olduname"		},
-[4110] = { 0,	0,		SEN(iopl),			"iopl"			},
+[4110] = { 1,	0,		SEN(iopl),			"iopl"			},
 [4111] = { 0,	0,		SEN(vhangup),			"vhangup"		},
 [4112] = { 0,	0,		SEN(idle),			"idle"			},
 [4113] = { 5,	0,		SEN(vm86old),			"vm86"			},
@@ -361,16 +361,14 @@
 [4358] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [4359] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [4360] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[4361 ... 4399] = { },
+[4361] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[4362] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 # define SYS_socket_subcall      4400
 # include "subcall.h"
 
-/* end of Linux o32 */ [SYS_socket_subcall + SYS_socket_nsubcalls + SYS_ipc_nsubcalls ... 4999] = { },
-
 #else
 
 # include "syscallent-o32-stub.h"
-/* end of Linux o32 */ [4400 ... 4999] = { },
 
 #endif
diff --git a/linux/netlink_diag.h b/linux/netlink_diag.h
new file mode 100644
index 0000000..276baa7
--- /dev/null
+++ b/linux/netlink_diag.h
@@ -0,0 +1,24 @@
+struct netlink_diag_req {
+	uint8_t sdiag_family;
+	uint8_t sdiag_protocol;
+	uint16_t pad;
+	uint32_t ndiag_ino;
+	uint32_t ndiag_show;
+	uint32_t ndiag_cookie[2];
+};
+
+struct netlink_diag_msg {
+	uint8_t ndiag_family;
+	uint8_t ndiag_type;
+	uint8_t ndiag_protocol;
+	uint8_t ndiag_state;
+
+	uint32_t ndiag_portid;
+	uint32_t ndiag_dst_portid;
+	uint32_t ndiag_dst_group;
+	uint32_t ndiag_ino;
+	uint32_t ndiag_cookie[2];
+};
+
+#define NDIAG_SHOW_MEMINFO           0x00000001
+#define NDIAG_PROTO_ALL              ((uint8_t) ~0)
diff --git a/linux/nios2/syscallent.h b/linux/nios2/syscallent.h
index 01efe3a..301fd0e 100644
--- a/linux/nios2/syscallent.h
+++ b/linux/nios2/syscallent.h
@@ -1,4 +1,4 @@
 #define sys_ARCH_mmap sys_mmap_pgoff
 #include "32/syscallent.h"
+/* [244 ... 259] are arch specific */
 [244] = {4,    0,	SEN(cacheflush), "cacheflush"},
-[245 ... 259] = { },
diff --git a/linux/or1k/syscallent.h b/linux/or1k/syscallent.h
index 351fe25..10af205 100644
--- a/linux/or1k/syscallent.h
+++ b/linux/or1k/syscallent.h
@@ -1,4 +1,4 @@
 #define sys_ARCH_mmap sys_mmap_pgoff
 #include "32/syscallent.h"
+/* [244 ... 259] are arch specific */
 [244] = { 3,	NF,	SEN(or1k_atomic),	"or1k_atomic"	},
-[245 ... 259] = { },
diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h
index 8a79c9f..b6dfb85 100644
--- a/linux/powerpc/syscallent.h
+++ b/linux/powerpc/syscallent.h
@@ -136,7 +136,7 @@
 [107] = { 2,	TF,		SEN(lstat),			"lstat"			},
 [108] = { 2,	TD,		SEN(fstat),			"fstat"			},
 [109] = { 1,	0,		SEN(olduname),			"olduname"		},
-[110] = { 5,	0,		SEN(printargs),			"iopl"			},
+[110] = { 1,	0,		SEN(iopl),			"iopl"			},
 [111] = { 0,	0,		SEN(vhangup),			"vhangup"		},
 [112] = { 0,	0,		SEN(idle),			"idle"			},
 [113] = { 5,	0,		SEN(vm86),			"vm86"			},
@@ -406,7 +406,8 @@
 [377] = { 3,	TI,		SEN(shmctl),			"shmctl"		},
 [378] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [379] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[380 ... 399] = { },
+[380] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[381] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/powerpc64/syscallent.h b/linux/powerpc64/syscallent.h
index 685ee23..e0c18af 100644
--- a/linux/powerpc64/syscallent.h
+++ b/linux/powerpc64/syscallent.h
@@ -136,7 +136,7 @@
 [107] = { 2,	TF,		SEN(lstat),			"lstat"			},
 [108] = { 2,	TD,		SEN(fstat),			"fstat"			},
 [109] = { 1,	0,		SEN(olduname),			"olduname"		},
-[110] = { 5,	0,		SEN(printargs),			"iopl"			},
+[110] = { 1,	0,		SEN(iopl),			"iopl"			},
 [111] = { 0,	0,		SEN(vhangup),			"vhangup"		},
 [112] = { 0,	0,		SEN(idle),			"idle"			},
 [113] = { 5,	0,		SEN(vm86),			"vm86"			},
@@ -401,7 +401,8 @@
 [377] = { 3,	TI,		SEN(shmctl),			"shmctl"		},
 [378] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [379] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[380 ... 399] = { },
+[380] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[381] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h
index 68ae7cb..af300e9 100644
--- a/linux/s390/syscallent.h
+++ b/linux/s390/syscallent.h
@@ -404,7 +404,8 @@
 [373] = { 2,	TN,		SEN(shutdown),			"shutdown"		},
 [374] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [375] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[376 ... 399] = { },
+[376] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[377] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h
index 00ce24e..f41f2eb 100644
--- a/linux/s390x/syscallent.h
+++ b/linux/s390x/syscallent.h
@@ -388,7 +388,8 @@
 [373] = { 2,	TN,		SEN(shutdown),			"shutdown"		},
 [374] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [375] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[376 ... 399] = { },
+[376] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[377] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/sh/syscallent.h b/linux/sh/syscallent.h
index 95b1b59..d2b462d 100644
--- a/linux/sh/syscallent.h
+++ b/linux/sh/syscallent.h
@@ -394,6 +394,6 @@
 [366] = { 6,	0,		SEN(process_vm_writev),		"process_vm_writev"	},
 [367] = { 5,	0,		SEN(kcmp),			"kcmp"			},
 [368] = { 3,	TD,		SEN(finit_module),		"finit_module"		},
-[369 ... 399] = { },
+
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/sh64/syscallent.h b/linux/sh64/syscallent.h
index 0f9ad1a..3504881 100644
--- a/linux/sh64/syscallent.h
+++ b/linux/sh64/syscallent.h
@@ -403,6 +403,6 @@
 [377] = { 6,	0,		SEN(process_vm_writev),		"process_vm_writev"	},
 [378] = { 5,	0,		SEN(kcmp),			"kcmp"			},
 [379] = { 3,	TD,		SEN(finit_module),		"finit_module"		},
-[380 ... 399] = { },
+
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/sparc/syscallent.h b/linux/sparc/syscallent.h
index 4404b95..ec86f7e 100644
--- a/linux/sparc/syscallent.h
+++ b/linux/sparc/syscallent.h
@@ -356,7 +356,8 @@
 [355] = { 5,	TN,		SEN(setsockopt),		"setsockopt"		},
 [356] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [357] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[358 ... 399] = { },
+[358] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[359] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/sparc64/syscallent.h b/linux/sparc64/syscallent.h
index 2953215..8bf5c3a 100644
--- a/linux/sparc64/syscallent.h
+++ b/linux/sparc64/syscallent.h
@@ -354,7 +354,8 @@
 [355] = { 5,	TN,		SEN(setsockopt),		"setsockopt"		},
 [356] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [357] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
-[358 ... 399] = { },
+[358] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[359] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
 
 #define SYS_socket_subcall	400
 #include "subcall.h"
diff --git a/linux/tile/syscallent.h b/linux/tile/syscallent.h
index ee235f3..eb518fb 100644
--- a/linux/tile/syscallent.h
+++ b/linux/tile/syscallent.h
@@ -1,4 +1,4 @@
 #include "64/syscallent.h"
+/* [244 ... 259] are arch specific */
 [244] = { 1,	0,	SEN(printargs),	"cmpxchg_badaddr"	},
 [245] = { 3,	0,	SEN(printargs),	"cacheflush"		},
-[246 ... 259] = { },
diff --git a/linux/tile/syscallent1.h b/linux/tile/syscallent1.h
index 28dbab4..b305f06 100644
--- a/linux/tile/syscallent1.h
+++ b/linux/tile/syscallent1.h
@@ -1,6 +1,6 @@
 #define sys_ARCH_mmap sys_mmap_4koff
 #define ARCH_WANT_SYNC_FILE_RANGE2 1
 #include "32/syscallent.h"
+/* [244 ... 259] are arch specific */
 [244] = { 1,	0,	SEN(printargs),	"cmpxchg_badaddr"	},
 [245] = { 3,	0,	SEN(printargs),	"cacheflush"		},
-[246 ... 259] = { },
diff --git a/linux/x32/ioctls_inc0.h b/linux/x32/ioctls_inc0.h
index 5176116..5684dc6 100644
--- a/linux/x32/ioctls_inc0.h
+++ b/linux/x32/ioctls_inc0.h
@@ -81,6 +81,18 @@
 { "asm-generic/sockios.h", "SIOCGSTAMP", 0, 0x8906, 0 },
 { "asm-generic/sockios.h", "SIOCGSTAMPNS", 0, 0x8907, 0 },
 { "asm-generic/sockios.h", "SIOCSPGRP", 0, 0x8902, 0 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_BO_LIST", _IOC_READ|_IOC_WRITE, 0x6443, 0x18 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CS", _IOC_READ|_IOC_WRITE, 0x6444, 0x18 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_CTX", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x20 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_METADATA", _IOC_READ|_IOC_WRITE, 0x6446, 0x120 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_OP", _IOC_READ|_IOC_WRITE, 0x6450, 0x10 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6451, 0x18 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
+{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
 { "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
 { "drm/drm.h", "DRM_IOCTL_ADD_CTX", _IOC_READ|_IOC_WRITE, 0x6420, 0x08 },
 { "drm/drm.h", "DRM_IOCTL_ADD_DRAW", _IOC_READ|_IOC_WRITE, 0x6427, 0x04 },
@@ -118,11 +130,14 @@
 { "drm/drm.h", "DRM_IOCTL_MARK_BUFS", _IOC_WRITE, 0x6417, 0x18 },
 { "drm/drm.h", "DRM_IOCTL_MODESET_CTL", _IOC_WRITE, 0x6408, 0x08 },
 { "drm/drm.h", "DRM_IOCTL_MODE_ADDFB", _IOC_READ|_IOC_WRITE, 0x64ae, 0x1c },
-{ "drm/drm.h", "DRM_IOCTL_MODE_ADDFB2", _IOC_READ|_IOC_WRITE, 0x64b8, 0x44 },
+{ "drm/drm.h", "DRM_IOCTL_MODE_ADDFB2", _IOC_READ|_IOC_WRITE, 0x64b8, 0x68 },
+{ "drm/drm.h", "DRM_IOCTL_MODE_ATOMIC", _IOC_READ|_IOC_WRITE, 0x64bc, 0x38 },
 { "drm/drm.h", "DRM_IOCTL_MODE_ATTACHMODE", _IOC_READ|_IOC_WRITE, 0x64a8, 0x48 },
+{ "drm/drm.h", "DRM_IOCTL_MODE_CREATEPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64bd, 0x10 },
 { "drm/drm.h", "DRM_IOCTL_MODE_CREATE_DUMB", _IOC_READ|_IOC_WRITE, 0x64b2, 0x20 },
 { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR", _IOC_READ|_IOC_WRITE, 0x64a3, 0x1c },
 { "drm/drm.h", "DRM_IOCTL_MODE_CURSOR2", _IOC_READ|_IOC_WRITE, 0x64bb, 0x24 },
+{ "drm/drm.h", "DRM_IOCTL_MODE_DESTROYPROPBLOB", _IOC_READ|_IOC_WRITE, 0x64be, 0x04 },
 { "drm/drm.h", "DRM_IOCTL_MODE_DESTROY_DUMB", _IOC_READ|_IOC_WRITE, 0x64b4, 0x04 },
 { "drm/drm.h", "DRM_IOCTL_MODE_DETACHMODE", _IOC_READ|_IOC_WRITE, 0x64a9, 0x48 },
 { "drm/drm.h", "DRM_IOCTL_MODE_DIRTYFB", _IOC_READ|_IOC_WRITE, 0x64b1, 0x18 },
@@ -166,11 +181,21 @@
 { "drm/drm.h", "DRM_IOCTL_UPDATE_DRAW", _IOC_WRITE, 0x643f, 0x18 },
 { "drm/drm.h", "DRM_IOCTL_VERSION", _IOC_READ|_IOC_WRITE, 0x6400, 0x24 },
 { "drm/drm.h", "DRM_IOCTL_WAIT_VBLANK", _IOC_READ|_IOC_WRITE, 0x643a, 0x10 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_FINI", _IOC_WRITE, 0x6445, 0x08 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_CPU_PREP", _IOC_WRITE, 0x6444, 0x18 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_INFO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_NEW", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_SUBMIT", _IOC_READ|_IOC_WRITE, 0x6446, 0x30 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_USERPTR", _IOC_READ|_IOC_WRITE, 0x6448, 0x18 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GEM_WAIT", _IOC_WRITE, 0x6449, 0x20 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
+{ "drm/etnaviv_drm.h", "DRM_IOCTL_ETNAVIV_WAIT_FENCE", _IOC_WRITE, 0x6447, 0x20 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_EXEC", _IOC_READ|_IOC_WRITE, 0x6462, 0x08 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_GET_VER", _IOC_READ|_IOC_WRITE, 0x6460, 0x08 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST", _IOC_READ|_IOC_WRITE, 0x6461, 0x28 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_GET", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
+{ "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_GEM_MAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_CMD_CTRL", _IOC_READ|_IOC_WRITE, 0x6473, 0x08 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY", _IOC_READ|_IOC_WRITE, 0x6470, 0x50 },
 { "drm/exynos_drm.h", "DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF", _IOC_READ|_IOC_WRITE, 0x6472, 0x28 },
@@ -201,6 +226,8 @@
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_BUSY", _IOC_READ|_IOC_WRITE, 0x6457, 0x08 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_CONTEXT_CREATE", _IOC_READ|_IOC_WRITE, 0x646d, 0x08 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY", _IOC_WRITE, 0x646e, 0x08 },
+{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM", _IOC_READ|_IOC_WRITE, 0x6474, 0x18 },
+{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM", _IOC_READ|_IOC_WRITE, 0x6475, 0x18 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x645b, 0x10 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_ENTERVT", _IOC_NONE, 0x6459, 0x00 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_EXECBUFFER", _IOC_WRITE, 0x6454, 0x28 },
@@ -211,7 +238,7 @@
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_INIT", _IOC_WRITE, 0x6453, 0x10 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_LEAVEVT", _IOC_NONE, 0x645a, 0x00 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_MADVISE", _IOC_READ|_IOC_WRITE, 0x6466, 0x0c },
-{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x645e, 0x20 },
+{ "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x645e, 0x28 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_MMAP_GTT", _IOC_READ|_IOC_WRITE, 0x6464, 0x10 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_PIN", _IOC_READ|_IOC_WRITE, 0x6455, 0x18 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GEM_PREAD", _IOC_WRITE, 0x645c, 0x20 },
@@ -227,7 +254,7 @@
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GETPARAM", _IOC_READ|_IOC_WRITE, 0x6446, 0x08 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID", _IOC_READ|_IOC_WRITE, 0x6465, 0x08 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GET_RESET_STATS", _IOC_READ|_IOC_WRITE, 0x6472, 0x18 },
-{ "drm/i915_drm.h", "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
+{ "drm/i915_drm.h", "DRM_IOCTL_I915_GET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646a, 0x14 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_GET_VBLANK_PIPE", _IOC_READ, 0x644e, 0x04 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_HWS_ADDR", _IOC_WRITE, 0x6451, 0x10 },
 { "drm/i915_drm.h", "DRM_IOCTL_I915_INIT", _IOC_WRITE, 0x6440, 0x44 },
@@ -352,7 +379,7 @@
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_CREATE", _IOC_READ|_IOC_WRITE, 0x6440, 0x10 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_GET_FLAGS", _IOC_READ|_IOC_WRITE, 0x644d, 0x08 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_GET_TILING", _IOC_READ|_IOC_WRITE, 0x644b, 0x10 },
-{ "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x08 },
+{ "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_MMAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_SET_FLAGS", _IOC_READ|_IOC_WRITE, 0x644c, 0x08 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GEM_SET_TILING", _IOC_READ|_IOC_WRITE, 0x644a, 0x10 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_GET_SYNCPT", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
@@ -362,6 +389,13 @@
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_INCR", _IOC_READ|_IOC_WRITE, 0x6443, 0x08 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_READ", _IOC_READ|_IOC_WRITE, 0x6442, 0x08 },
 { "drm/tegra_drm.h", "DRM_IOCTL_TEGRA_SYNCPT_WAIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_BO", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
+{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
 { "drm/via_drm.h", "DRM_IOCTL_VIA_AGP_INIT", _IOC_READ|_IOC_WRITE, 0x6442, 0x08 },
 { "drm/via_drm.h", "DRM_IOCTL_VIA_ALLOCMEM", _IOC_READ|_IOC_WRITE, 0x6440, 0x14 },
 { "drm/via_drm.h", "DRM_IOCTL_VIA_BLIT_SYNC", _IOC_WRITE, 0x644f, 0x08 },
@@ -376,6 +410,15 @@
 { "drm/via_drm.h", "DRM_IOCTL_VIA_MAP_INIT", _IOC_READ|_IOC_WRITE, 0x6444, 0x14 },
 { "drm/via_drm.h", "DRM_IOCTL_VIA_PCICMD", _IOC_WRITE, 0x644a, 0x08 },
 { "drm/via_drm.h", "DRM_IOCTL_VIA_WAIT_IRQ", _IOC_READ|_IOC_WRITE, 0x644d, 0x10 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_EXECBUFFER", _IOC_WRITE, 0x6442, 0x20 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_GETPARAM", _IOC_READ|_IOC_WRITE, 0x6443, 0x10 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_GET_CAPS", _IOC_READ|_IOC_WRITE, 0x6449, 0x18 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_MAP", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_RESOURCE_CREATE", _IOC_READ|_IOC_WRITE, 0x6444, 0x38 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_RESOURCE_INFO", _IOC_READ|_IOC_WRITE, 0x6445, 0x10 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST", _IOC_READ|_IOC_WRITE, 0x6446, 0x24 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST", _IOC_READ|_IOC_WRITE, 0x6447, 0x24 },
+{ "drm/virtgpu_drm.h", "DRM_IOCTL_VIRTGPU_WAIT", _IOC_READ|_IOC_WRITE, 0x6448, 0x08 },
 { "linux/agpgart.h", "AGPIOC_ACQUIRE", _IOC_NONE, 0x4101, 0x00 },
 { "linux/agpgart.h", "AGPIOC_ALLOCATE", _IOC_READ|_IOC_WRITE, 0x4106, 0x04 },
 { "linux/agpgart.h", "AGPIOC_BIND", _IOC_WRITE, 0x4108, 0x04 },
@@ -387,6 +430,7 @@
 { "linux/agpgart.h", "AGPIOC_RESERVE", _IOC_WRITE, 0x4104, 0x04 },
 { "linux/agpgart.h", "AGPIOC_SETUP", _IOC_WRITE, 0x4103, 0x04 },
 { "linux/agpgart.h", "AGPIOC_UNBIND", _IOC_WRITE, 0x4109, 0x04 },
+{ "linux/am437x-vpfe.h", "VIDIOC_AM437X_CCDC_CFG", _IOC_WRITE, 0x56c1, 0x04 },
 { "linux/android/binder.h", "BC_ACQUIRE", _IOC_WRITE, 0x6305, 0x04 },
 { "linux/android/binder.h", "BC_ACQUIRE_DONE", _IOC_WRITE, 0x6309, 0x10 },
 { "linux/android/binder.h", "BC_ACQUIRE_RESULT", _IOC_WRITE, 0x6302, 0x04 },
@@ -672,6 +716,7 @@
 { "linux/dm-ioctl.h", "DM_TABLE_STATUS", _IOC_READ|_IOC_WRITE, 0xfd0c, 0x138 },
 { "linux/dm-ioctl.h", "DM_TARGET_MSG", _IOC_READ|_IOC_WRITE, 0xfd0e, 0x138 },
 { "linux/dm-ioctl.h", "DM_VERSION", _IOC_READ|_IOC_WRITE, 0xfd00, 0x138 },
+{ "linux/dma-buf.h", "DMA_BUF_IOCTL_SYNC", _IOC_WRITE, 0x6200, 0x08 },
 { "linux/dn.h", "OSIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
 { "linux/dn.h", "OSIOCSNETADDR", _IOC_WRITE, 0x89e0, 0x04 },
 { "linux/dn.h", "SIOCGNETADDR", _IOC_READ, 0x89e1, 0x04 },
@@ -840,6 +885,7 @@
 { "linux/fs.h", "BLKALIGNOFF", _IOC_NONE, 0x127a, 0x00 },
 { "linux/fs.h", "BLKBSZGET", _IOC_READ, 0x1270, 0x04 },
 { "linux/fs.h", "BLKBSZSET", _IOC_WRITE, 0x1271, 0x04 },
+{ "linux/fs.h", "BLKDAXGET", _IOC_NONE, 0x1281, 0x00 },
 { "linux/fs.h", "BLKDISCARD", _IOC_NONE, 0x1277, 0x00 },
 { "linux/fs.h", "BLKDISCARDZEROES", _IOC_NONE, 0x127c, 0x00 },
 { "linux/fs.h", "BLKFLSBUF", _IOC_NONE, 0x1261, 0x00 },
@@ -866,6 +912,9 @@
 { "linux/fs.h", "BLKTRACETEARDOWN", _IOC_NONE, 0x1276, 0x00 },
 { "linux/fs.h", "BLKZEROOUT", _IOC_NONE, 0x127f, 0x00 },
 { "linux/fs.h", "FIBMAP", _IOC_NONE, 0x0001, 0x00 },
+{ "linux/fs.h", "FICLONE", _IOC_WRITE, 0x9409, 0x04 },
+{ "linux/fs.h", "FICLONERANGE", _IOC_WRITE, 0x940d, 0x20 },
+{ "linux/fs.h", "FIDEDUPERANGE", _IOC_READ|_IOC_WRITE, 0x9436, 0x18 },
 { "linux/fs.h", "FIFREEZE", _IOC_READ|_IOC_WRITE, 0x5877, 0x04 },
 { "linux/fs.h", "FIGETBSZ", _IOC_NONE, 0x0002, 0x00 },
 { "linux/fs.h", "FITHAW", _IOC_READ|_IOC_WRITE, 0x5878, 0x04 },
@@ -875,10 +924,15 @@
 { "linux/fs.h", "FS_IOC32_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
 { "linux/fs.h", "FS_IOC32_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
 { "linux/fs.h", "FS_IOC_FIEMAP", _IOC_READ|_IOC_WRITE, 0x660b, 0x20 },
+{ "linux/fs.h", "FS_IOC_FSGETXATTR", _IOC_READ, 0x581f, 0x1c },
+{ "linux/fs.h", "FS_IOC_FSSETXATTR", _IOC_WRITE, 0x5820, 0x1c },
 { "linux/fs.h", "FS_IOC_GETFLAGS", _IOC_READ, 0x6601, 0x04 },
 { "linux/fs.h", "FS_IOC_GETVERSION", _IOC_READ, 0x7601, 0x04 },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_POLICY", _IOC_WRITE, 0x6615, 0x0c },
+{ "linux/fs.h", "FS_IOC_GET_ENCRYPTION_PWSALT", _IOC_WRITE, 0x6614, 0x10 },
 { "linux/fs.h", "FS_IOC_SETFLAGS", _IOC_WRITE, 0x6602, 0x04 },
 { "linux/fs.h", "FS_IOC_SETVERSION", _IOC_WRITE, 0x7602, 0x04 },
+{ "linux/fs.h", "FS_IOC_SET_ENCRYPTION_POLICY", _IOC_READ, 0x6613, 0x0c },
 { "linux/fsl-diu-fb.h", "MFB_GET_ALPHA", _IOC_READ, 0x4d00, 0x01 },
 { "linux/fsl-diu-fb.h", "MFB_GET_AOID", _IOC_READ, 0x4d04, 0x08 },
 { "linux/fsl-diu-fb.h", "MFB_GET_GAMMA", _IOC_READ, 0x4d01, 0x01 },
@@ -897,6 +951,7 @@
 { "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_START", _IOC_READ|_IOC_WRITE, 0xaf03, 0x10 },
 { "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_PARTITION_STOP", _IOC_READ|_IOC_WRITE, 0xaf04, 0x08 },
 { "linux/fsl_hypervisor.h", "FSL_HV_IOCTL_SETPROP", _IOC_READ|_IOC_WRITE, 0xaf08, 0x28 },
+{ "linux/fuse.h", "FUSE_DEV_IOC_CLONE", _IOC_READ, 0xe500, 0x04 },
 { "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_DDCB", _IOC_READ|_IOC_WRITE, 0xa532, 0xe8 },
 { "linux/genwqe/genwqe_card.h", "GENWQE_EXECUTE_RAW_DDCB", _IOC_READ|_IOC_WRITE, 0xa533, 0xe8 },
 { "linux/genwqe/genwqe_card.h", "GENWQE_GET_CARD_STATE", _IOC_READ, 0xa524, 0x04 },
@@ -914,6 +969,8 @@
 { "linux/gigaset_dev.h", "GIGASET_CONFIG", _IOC_READ|_IOC_WRITE, 0x4701, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_REDIR", _IOC_READ|_IOC_WRITE, 0x4700, 0x04 },
 { "linux/gigaset_dev.h", "GIGASET_VERSION", _IOC_READ|_IOC_WRITE, 0x4703, 0x10 },
+{ "linux/gpio.h", "GPIO_GET_CHIPINFO_IOCTL", _IOC_READ, 0xb401, 0x44 },
+{ "linux/gpio.h", "GPIO_GET_LINEINFO_IOCTL", _IOC_READ|_IOC_WRITE, 0xb402, 0x48 },
 { "linux/gsmmux.h", "GSMIOC_DISABLE_NET", _IOC_NONE, 0x4703, 0x00 },
 { "linux/gsmmux.h", "GSMIOC_ENABLE_NET", _IOC_WRITE, 0x4702, 0x34 },
 { "linux/gsmmux.h", "GSMIOC_GETCONF", _IOC_READ, 0x4700, 0x4c },
@@ -982,6 +1039,10 @@
 { "linux/hpet.h", "HPET_IE_ON", _IOC_NONE, 0x6801, 0x00 },
 { "linux/hpet.h", "HPET_INFO", _IOC_READ, 0x6803, 0x0c },
 { "linux/hpet.h", "HPET_IRQFREQ", _IOC_WRITE, 0x6806, 0x04 },
+{ "linux/hsi/cs-protocol.h", "CS_CONFIG_BUFS", _IOC_WRITE, 0x431f, 0x20 },
+{ "linux/hsi/cs-protocol.h", "CS_GET_IF_VERSION", _IOC_READ, 0x431e, 0x04 },
+{ "linux/hsi/cs-protocol.h", "CS_GET_STATE", _IOC_READ, 0x4315, 0x04 },
+{ "linux/hsi/cs-protocol.h", "CS_SET_WAKELINE", _IOC_WRITE, 0x4317, 0x04 },
 { "linux/hsi/hsi_char.h", "HSC_GET_RX", _IOC_WRITE, 0x6b14, 0x0c },
 { "linux/hsi/hsi_char.h", "HSC_GET_TX", _IOC_WRITE, 0x6b16, 0x10 },
 { "linux/hsi/hsi_char.h", "HSC_RESET", _IOC_NONE, 0x6b10, 0x00 },
@@ -1003,10 +1064,6 @@
 { "linux/i2o-dev.h", "I2OSWDL", _IOC_READ|_IOC_WRITE, 0x6905, 0x1c },
 { "linux/i2o-dev.h", "I2OSWUL", _IOC_READ|_IOC_WRITE, 0x6906, 0x1c },
 { "linux/i2o-dev.h", "I2OVALIDATE", _IOC_READ, 0x6908, 0x04 },
-{ "linux/i2o.h", "BLKI2OGRSTRAT", _IOC_READ, 0x3201, 0x04 },
-{ "linux/i2o.h", "BLKI2OGWSTRAT", _IOC_READ, 0x3202, 0x04 },
-{ "linux/i2o.h", "BLKI2OSRSTRAT", _IOC_WRITE, 0x3203, 0x04 },
-{ "linux/i2o.h", "BLKI2OSWSTRAT", _IOC_WRITE, 0x3204, 0x04 },
 { "linux/i8k.h", "I8K_BIOS_VERSION", _IOC_READ, 0x6980, 0x04 },
 { "linux/i8k.h", "I8K_FN_STATUS", _IOC_READ, 0x6983, 0x04 },
 { "linux/i8k.h", "I8K_GET_FAN", _IOC_READ|_IOC_WRITE, 0x6986, 0x04 },
@@ -1023,6 +1080,7 @@
 { "linux/if_tun.h", "TUNGETFILTER", _IOC_READ, 0x54db, 0x08 },
 { "linux/if_tun.h", "TUNGETIFF", _IOC_READ, 0x54d2, 0x04 },
 { "linux/if_tun.h", "TUNGETSNDBUF", _IOC_READ, 0x54d3, 0x04 },
+{ "linux/if_tun.h", "TUNGETVNETBE", _IOC_READ, 0x54df, 0x04 },
 { "linux/if_tun.h", "TUNGETVNETHDRSZ", _IOC_READ, 0x54d7, 0x04 },
 { "linux/if_tun.h", "TUNGETVNETLE", _IOC_READ, 0x54dd, 0x04 },
 { "linux/if_tun.h", "TUNSETDEBUG", _IOC_WRITE, 0x54c9, 0x04 },
@@ -1037,6 +1095,7 @@
 { "linux/if_tun.h", "TUNSETQUEUE", _IOC_WRITE, 0x54d9, 0x04 },
 { "linux/if_tun.h", "TUNSETSNDBUF", _IOC_WRITE, 0x54d4, 0x04 },
 { "linux/if_tun.h", "TUNSETTXFILTER", _IOC_WRITE, 0x54d1, 0x04 },
+{ "linux/if_tun.h", "TUNSETVNETBE", _IOC_WRITE, 0x54de, 0x04 },
 { "linux/if_tun.h", "TUNSETVNETHDRSZ", _IOC_WRITE, 0x54d8, 0x04 },
 { "linux/if_tun.h", "TUNSETVNETLE", _IOC_WRITE, 0x54dc, 0x04 },
 { "linux/iio/events.h", "IIO_GET_EVENT_FD_IOCTL", _IOC_READ, 0x6990, 0x04 },
@@ -1044,6 +1103,7 @@
 { "linux/input.h", "EVIOCGID", _IOC_READ, 0x4502, 0x08 },
 { "linux/input.h", "EVIOCGKEYCODE", _IOC_READ, 0x4504, 0x08 },
 { "linux/input.h", "EVIOCGKEYCODE_V2", _IOC_READ, 0x4504, 0x28 },
+{ "linux/input.h", "EVIOCGMASK", _IOC_READ, 0x4592, 0x10 },
 { "linux/input.h", "EVIOCGRAB", _IOC_WRITE, 0x4590, 0x04 },
 { "linux/input.h", "EVIOCGREP", _IOC_READ, 0x4503, 0x08 },
 { "linux/input.h", "EVIOCGVERSION", _IOC_READ, 0x4501, 0x04 },
@@ -1053,6 +1113,7 @@
 { "linux/input.h", "EVIOCSFF", _IOC_WRITE, 0x4580, 0x2c },
 { "linux/input.h", "EVIOCSKEYCODE", _IOC_WRITE, 0x4504, 0x08 },
 { "linux/input.h", "EVIOCSKEYCODE_V2", _IOC_WRITE, 0x4504, 0x28 },
+{ "linux/input.h", "EVIOCSMASK", _IOC_WRITE, 0x4593, 0x10 },
 { "linux/input.h", "EVIOCSREP", _IOC_WRITE, 0x4503, 0x08 },
 { "linux/ipmi.h", "IPMICTL_GET_MAINTENANCE_MODE_CMD", _IOC_READ, 0x691e, 0x04 },
 { "linux/ipmi.h", "IPMICTL_GET_MY_ADDRESS_CMD", _IOC_READ, 0x6912, 0x04 },
@@ -1167,6 +1228,9 @@
 { "linux/joystick.h", "JSIOCSAXMAP", _IOC_WRITE, 0x6a31, 0x40 },
 { "linux/joystick.h", "JSIOCSBTNMAP", _IOC_WRITE, 0x6a33, 0x400 },
 { "linux/joystick.h", "JSIOCSCORR", _IOC_WRITE, 0x6a21, 0x24 },
+{ "linux/kcov.h", "KCOV_DISABLE", _IOC_NONE, 0x6365, 0x00 },
+{ "linux/kcov.h", "KCOV_ENABLE", _IOC_NONE, 0x6364, 0x00 },
+{ "linux/kcov.h", "KCOV_INIT_TRACE", _IOC_READ, 0x6301, 0x04 },
 { "linux/kd.h", "GIO_CMAP", 0, 0x4B70, 0 },
 { "linux/kd.h", "GIO_FONT", 0, 0x4B60, 0 },
 { "linux/kd.h", "GIO_FONTX", 0, 0x4B6B, 0 },
@@ -1213,13 +1277,22 @@
 { "linux/kd.h", "PIO_UNIMAP", 0, 0x4B67, 0 },
 { "linux/kd.h", "PIO_UNIMAPCLR", 0, 0x4B68, 0 },
 { "linux/kd.h", "PIO_UNISCRNMAP", 0, 0x4B6A, 0 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_EVENT", _IOC_READ|_IOC_WRITE, 0x4b08, 0x20 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b02, 0x58 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_ADDRESS_WATCH", _IOC_WRITE, 0x4b0f, 0x10 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_REGISTER", _IOC_WRITE, 0x4b0d, 0x08 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_UNREGISTER", _IOC_WRITE, 0x4b0e, 0x08 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_WAVE_CONTROL", _IOC_WRITE, 0x4b10, 0x10 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_EVENT", _IOC_WRITE, 0x4b09, 0x08 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b03, 0x08 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_CLOCK_COUNTERS", _IOC_READ|_IOC_WRITE, 0x4b05, 0x28 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES", _IOC_READ, 0x4b06, 0x190 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_VERSION", _IOC_READ, 0x4b01, 0x08 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_RESET_EVENT", _IOC_WRITE, 0x4b0b, 0x08 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_EVENT", _IOC_WRITE, 0x4b0a, 0x08 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
 { "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
+{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
 { "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
 { "linux/kvm.h", "KVM_ARM_PREFERRED_TARGET", _IOC_READ, 0xaeaf, 0x20 },
 { "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
@@ -1235,6 +1308,7 @@
 { "linux/kvm.h", "KVM_CREATE_PIT", _IOC_NONE, 0xae64, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_PIT2", _IOC_WRITE, 0xae77, 0x40 },
 { "linux/kvm.h", "KVM_CREATE_SPAPR_TCE", _IOC_WRITE, 0xaea8, 0x0c },
+{ "linux/kvm.h", "KVM_CREATE_SPAPR_TCE_64", _IOC_WRITE, 0xaea8, 0x20 },
 { "linux/kvm.h", "KVM_CREATE_VCPU", _IOC_NONE, 0xae41, 0x00 },
 { "linux/kvm.h", "KVM_CREATE_VM", _IOC_NONE, 0xae01, 0x00 },
 { "linux/kvm.h", "KVM_DEASSIGN_DEV_IRQ", _IOC_WRITE, 0xae75, 0x40 },
@@ -1284,9 +1358,15 @@
 { "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
 { "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
 { "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
+{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
+{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
 { "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
 { "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
+{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
+{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
 { "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
+{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
+{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },
 { "linux/kvm.h", "KVM_S390_STORE_STATUS", _IOC_WRITE, 0xae95, 0x04 },
 { "linux/kvm.h", "KVM_S390_UCAS_MAP", _IOC_WRITE, 0xae50, 0x18 },
 { "linux/kvm.h", "KVM_S390_UCAS_UNMAP", _IOC_WRITE, 0xae51, 0x18 },
@@ -1322,6 +1402,7 @@
 { "linux/kvm.h", "KVM_SET_XCRS", _IOC_WRITE, 0xaea7, 0x188 },
 { "linux/kvm.h", "KVM_SET_XSAVE", _IOC_WRITE, 0xaea5, 0x1000 },
 { "linux/kvm.h", "KVM_SIGNAL_MSI", _IOC_WRITE, 0xaea5, 0x20 },
+{ "linux/kvm.h", "KVM_SMI", _IOC_NONE, 0xaeb7, 0x00 },
 { "linux/kvm.h", "KVM_TPR_ACCESS_REPORTING", _IOC_READ|_IOC_WRITE, 0xae92, 0x28 },
 { "linux/kvm.h", "KVM_TRANSLATE", _IOC_READ|_IOC_WRITE, 0xae85, 0x18 },
 { "linux/kvm.h", "KVM_UNREGISTER_COALESCED_MMIO", _IOC_WRITE, 0xae68, 0x10 },
@@ -1329,6 +1410,46 @@
 { "linux/kvm.h", "KVM_X86_SETUP_MCE", _IOC_WRITE, 0xae9c, 0x08 },
 { "linux/kvm.h", "KVM_X86_SET_MCE", _IOC_WRITE, 0xae9e, 0x40 },
 { "linux/kvm.h", "KVM_XEN_HVM_CONFIG", _IOC_WRITE, 0xae7a, 0x38 },
+{ "linux/lightnvm.h", "NVM_DEV_CREATE", _IOC_WRITE, 0x4c22, 0x80 },
+{ "linux/lightnvm.h", "NVM_DEV_FACTORY", _IOC_WRITE, 0x4c25, 0x24 },
+{ "linux/lightnvm.h", "NVM_DEV_INIT", _IOC_WRITE, 0x4c24, 0x2c },
+{ "linux/lightnvm.h", "NVM_DEV_REMOVE", _IOC_WRITE, 0x4c23, 0x24 },
+{ "linux/lightnvm.h", "NVM_GET_DEVICES", _IOC_READ, 0x4c21, 0x1000 },
+{ "linux/lightnvm.h", "NVM_INFO", _IOC_READ|_IOC_WRITE, 0x4c20, 0x1000 },
+{ "linux/lirc.h", "LIRC_GET_FEATURES", _IOC_READ, 0x6900, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_LENGTH", _IOC_READ, 0x690f, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_PULSE", _IOC_READ, 0x690b, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_MAX_FILTER_SPACE", _IOC_READ, 0x690d, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_MAX_TIMEOUT", _IOC_READ, 0x6909, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_PULSE", _IOC_READ, 0x690a, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_MIN_FILTER_SPACE", _IOC_READ, 0x690c, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_MIN_TIMEOUT", _IOC_READ, 0x6908, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_REC_CARRIER", _IOC_READ, 0x6904, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_REC_DUTY_CYCLE", _IOC_READ, 0x6906, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_REC_MODE", _IOC_READ, 0x6902, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_REC_RESOLUTION", _IOC_READ, 0x6907, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_SEND_CARRIER", _IOC_READ, 0x6903, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_SEND_DUTY_CYCLE", _IOC_READ, 0x6905, 0x04 },
+{ "linux/lirc.h", "LIRC_GET_SEND_MODE", _IOC_READ, 0x6901, 0x04 },
+{ "linux/lirc.h", "LIRC_NOTIFY_DECODE", _IOC_NONE, 0x6920, 0x00 },
+{ "linux/lirc.h", "LIRC_SETUP_END", _IOC_NONE, 0x6922, 0x00 },
+{ "linux/lirc.h", "LIRC_SETUP_START", _IOC_NONE, 0x6921, 0x00 },
+{ "linux/lirc.h", "LIRC_SET_MEASURE_CARRIER_MODE", _IOC_WRITE, 0x691d, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_CARRIER", _IOC_WRITE, 0x6914, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_CARRIER_RANGE", _IOC_WRITE, 0x691f, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE", _IOC_WRITE, 0x6916, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_DUTY_CYCLE_RANGE", _IOC_WRITE, 0x691e, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_FILTER", _IOC_WRITE, 0x691c, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_FILTER_PULSE", _IOC_WRITE, 0x691a, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_FILTER_SPACE", _IOC_WRITE, 0x691b, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_MODE", _IOC_WRITE, 0x6912, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT", _IOC_WRITE, 0x6918, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_REC_TIMEOUT_REPORTS", _IOC_WRITE, 0x6919, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_SEND_CARRIER", _IOC_WRITE, 0x6913, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_SEND_DUTY_CYCLE", _IOC_WRITE, 0x6915, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_SEND_MODE", _IOC_WRITE, 0x6911, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_TRANSMITTER_MASK", _IOC_WRITE, 0x6917, 0x04 },
+{ "linux/lirc.h", "LIRC_SET_WIDEBAND_RECEIVER", _IOC_WRITE, 0x6923, 0x04 },
 { "linux/loop.h", "LOOP_CHANGE_FD", 0, 0x4C06, 0 },
 { "linux/loop.h", "LOOP_CLR_FD", 0, 0x4C01, 0 },
 { "linux/loop.h", "LOOP_CTL_ADD", 0, 0x4C80, 0 },
@@ -1337,6 +1458,7 @@
 { "linux/loop.h", "LOOP_GET_STATUS", 0, 0x4C03, 0 },
 { "linux/loop.h", "LOOP_GET_STATUS64", 0, 0x4C05, 0 },
 { "linux/loop.h", "LOOP_SET_CAPACITY", 0, 0x4C07, 0 },
+{ "linux/loop.h", "LOOP_SET_DIRECT_IO", 0, 0x4C08, 0 },
 { "linux/loop.h", "LOOP_SET_FD", 0, 0x4C00, 0 },
 { "linux/loop.h", "LOOP_SET_STATUS", 0, 0x4C02, 0 },
 { "linux/loop.h", "LOOP_SET_STATUS64", 0, 0x4C04, 0 },
@@ -1358,8 +1480,11 @@
 { "linux/media.h", "MEDIA_IOC_DEVICE_INFO", _IOC_READ|_IOC_WRITE, 0x7c00, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_ENTITIES", _IOC_READ|_IOC_WRITE, 0x7c01, 0x100 },
 { "linux/media.h", "MEDIA_IOC_ENUM_LINKS", _IOC_READ|_IOC_WRITE, 0x7c02, 0x1c },
+{ "linux/media.h", "MEDIA_IOC_G_TOPOLOGY", _IOC_READ|_IOC_WRITE, 0x7c04, 0x48 },
 { "linux/media.h", "MEDIA_IOC_SETUP_LINK", _IOC_READ|_IOC_WRITE, 0x7c03, 0x34 },
 { "linux/mei.h", "IOCTL_MEI_CONNECT_CLIENT", _IOC_READ|_IOC_WRITE, 0x4801, 0x10 },
+{ "linux/mei.h", "IOCTL_MEI_NOTIFY_GET", _IOC_READ, 0x4803, 0x04 },
+{ "linux/mei.h", "IOCTL_MEI_NOTIFY_SET", _IOC_WRITE, 0x4802, 0x04 },
 { "linux/meye.h", "MEYEIOC_G_PARAMS", _IOC_READ, 0x76c0, 0x06 },
 { "linux/meye.h", "MEYEIOC_QBUF_CAPT", _IOC_WRITE, 0x76c2, 0x04 },
 { "linux/meye.h", "MEYEIOC_STILLCAPT", _IOC_NONE, 0x76c4, 0x00 },
@@ -1370,6 +1495,7 @@
 { "linux/mic_ioctl.h", "MIC_VIRTIO_CONFIG_CHANGE", _IOC_READ|_IOC_WRITE, 0x7305, 0x04 },
 { "linux/mic_ioctl.h", "MIC_VIRTIO_COPY_DESC", _IOC_READ|_IOC_WRITE, 0x7302, 0x04 },
 { "linux/mmc/ioctl.h", "MMC_IOC_CMD", _IOC_READ|_IOC_WRITE, 0xb300, 0x48 },
+{ "linux/mmc/ioctl.h", "MMC_IOC_MULTI_CMD", _IOC_READ|_IOC_WRITE, 0xb301, 0x08 },
 { "linux/mmtimer.h", "MMTIMER_GETBITS", _IOC_NONE, 0x6d04, 0x00 },
 { "linux/mmtimer.h", "MMTIMER_GETCOUNTER", _IOC_READ, 0x6d09, 0x04 },
 { "linux/mmtimer.h", "MMTIMER_GETFREQ", _IOC_READ, 0x6d02, 0x04 },
@@ -1381,8 +1507,6 @@
 { "linux/msdos_fs.h", "FAT_IOCTL_SET_ATTRIBUTES", _IOC_WRITE, 0x7211, 0x04 },
 { "linux/msdos_fs.h", "VFAT_IOCTL_READDIR_BOTH", _IOC_READ, 0x7201, 0x230 },
 { "linux/msdos_fs.h", "VFAT_IOCTL_READDIR_SHORT", _IOC_READ, 0x7202, 0x230 },
-{ "linux/msm_mdp.h", "MSMFB_BLIT", _IOC_WRITE, 0x6d02, 0x04 },
-{ "linux/msm_mdp.h", "MSMFB_GRP_DISP", _IOC_WRITE, 0x6d01, 0x04 },
 { "linux/mtio.h", "MTIOCGET", _IOC_READ, 0x6d02, 0x1c },
 { "linux/mtio.h", "MTIOCPOS", _IOC_READ, 0x6d03, 0x04 },
 { "linux/mtio.h", "MTIOCTOP", _IOC_WRITE, 0x6d01, 0x08 },
@@ -1417,6 +1541,17 @@
 { "linux/ncp_fs.h", "NCP_IOC_SET_SIGN_WANTED", _IOC_WRITE, 0x6e06, 0x04 },
 { "linux/ncp_fs.h", "NCP_IOC_SIGN_INIT", _IOC_READ, 0x6e05, 0x18 },
 { "linux/ncp_fs.h", "NCP_IOC_SIGN_WANTED", _IOC_READ, 0x6e06, 0x04 },
+{ "linux/ndctl.h", "ND_IOCTL_ARS_CAP", _IOC_READ|_IOC_WRITE, 0x4e01, 0x20 },
+{ "linux/ndctl.h", "ND_IOCTL_ARS_START", _IOC_READ|_IOC_WRITE, 0x4e02, 0x20 },
+{ "linux/ndctl.h", "ND_IOCTL_ARS_STATUS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x30 },
+{ "linux/ndctl.h", "ND_IOCTL_CLEAR_ERROR", _IOC_READ|_IOC_WRITE, 0x4e04, 0x20 },
+{ "linux/ndctl.h", "ND_IOCTL_DIMM_FLAGS", _IOC_READ|_IOC_WRITE, 0x4e03, 0x08 },
+{ "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_DATA", _IOC_READ|_IOC_WRITE, 0x4e05, 0x0c },
+{ "linux/ndctl.h", "ND_IOCTL_GET_CONFIG_SIZE", _IOC_READ|_IOC_WRITE, 0x4e04, 0x0c },
+{ "linux/ndctl.h", "ND_IOCTL_SET_CONFIG_DATA", _IOC_READ|_IOC_WRITE, 0x4e06, 0x08 },
+{ "linux/ndctl.h", "ND_IOCTL_SMART", _IOC_READ|_IOC_WRITE, 0x4e01, 0x84 },
+{ "linux/ndctl.h", "ND_IOCTL_SMART_THRESHOLD", _IOC_READ|_IOC_WRITE, 0x4e02, 0x0c },
+{ "linux/ndctl.h", "ND_IOCTL_VENDOR", _IOC_READ|_IOC_WRITE, 0x4e09, 0x08 },
 { "linux/nilfs2_fs.h", "NILFS_IOCTL_CHANGE_CPMODE", _IOC_WRITE, 0x6e80, 0x10 },
 { "linux/nilfs2_fs.h", "NILFS_IOCTL_CLEAN_SEGMENTS", _IOC_WRITE, 0x6e88, 0x78 },
 { "linux/nilfs2_fs.h", "NILFS_IOCTL_DELETE_CHECKPOINT", _IOC_WRITE, 0x6e81, 0x08 },
@@ -1430,10 +1565,12 @@
 { "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_ALLOC_RANGE", _IOC_WRITE, 0x6e8c, 0x10 },
 { "linux/nilfs2_fs.h", "NILFS_IOCTL_SET_SUINFO", _IOC_WRITE, 0x6e8d, 0x18 },
 { "linux/nilfs2_fs.h", "NILFS_IOCTL_SYNC", _IOC_READ, 0x6e8a, 0x08 },
-{ "linux/nvme.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
-{ "linux/nvme.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
-{ "linux/nvme.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
-{ "linux/nvme.h", "NVME_IOCTL_SUBMIT_IO", _IOC_WRITE, 0x4e42, 0x30 },
+{ "linux/nvme_ioctl.h", "NVME_IOCTL_ADMIN_CMD", _IOC_READ|_IOC_WRITE, 0x4e41, 0x48 },
+{ "linux/nvme_ioctl.h", "NVME_IOCTL_ID", _IOC_NONE, 0x4e40, 0x00 },
+{ "linux/nvme_ioctl.h", "NVME_IOCTL_IO_CMD", _IOC_READ|_IOC_WRITE, 0x4e43, 0x48 },
+{ "linux/nvme_ioctl.h", "NVME_IOCTL_RESET", _IOC_NONE, 0x4e44, 0x00 },
+{ "linux/nvme_ioctl.h", "NVME_IOCTL_SUBMIT_IO", _IOC_WRITE, 0x4e42, 0x30 },
+{ "linux/nvme_ioctl.h", "NVME_IOCTL_SUBSYS_RESET", _IOC_NONE, 0x4e45, 0x00 },
 { "linux/nvram.h", "NVRAM_INIT", _IOC_NONE, 0x7040, 0x00 },
 { "linux/nvram.h", "NVRAM_SETCKS", _IOC_NONE, 0x7041, 0x00 },
 { "linux/omap3isp.h", "VIDIOC_OMAP3ISP_AEWB_CFG", _IOC_READ|_IOC_WRITE, 0x56c3, 0x20 },
@@ -1472,6 +1609,7 @@
 { "linux/perf_event.h", "PERF_EVENT_IOC_PERIOD", _IOC_WRITE, 0x2404, 0x08 },
 { "linux/perf_event.h", "PERF_EVENT_IOC_REFRESH", _IOC_NONE, 0x2402, 0x00 },
 { "linux/perf_event.h", "PERF_EVENT_IOC_RESET", _IOC_NONE, 0x2403, 0x00 },
+{ "linux/perf_event.h", "PERF_EVENT_IOC_SET_BPF", _IOC_WRITE, 0x2408, 0x04 },
 { "linux/perf_event.h", "PERF_EVENT_IOC_SET_FILTER", _IOC_WRITE, 0x2406, 0x04 },
 { "linux/perf_event.h", "PERF_EVENT_IOC_SET_OUTPUT", _IOC_NONE, 0x2405, 0x00 },
 { "linux/phantom.h", "PHN_GETREG", _IOC_READ|_IOC_WRITE, 0x7005, 0x08 },
@@ -1484,6 +1622,7 @@
 { "linux/phantom.h", "PHN_SET_REG", _IOC_WRITE, 0x7001, 0x04 },
 { "linux/phantom.h", "PHN_SET_REGS", _IOC_WRITE, 0x7003, 0x04 },
 { "linux/pktcdvd.h", "PACKET_CTRL_CMD", _IOC_READ|_IOC_WRITE, 0x5801, 0x18 },
+{ "linux/platform_data/media/si4713.h", "SI4713_IOC_MEASURE_RNL", _IOC_READ|_IOC_WRITE, 0x56c0, 0x1c },
 { "linux/pmu.h", "PMU_IOC_CAN_SLEEP", _IOC_READ, 0x4205, 0x04 },
 { "linux/pmu.h", "PMU_IOC_GET_BACKLIGHT", _IOC_READ, 0x4201, 0x04 },
 { "linux/pmu.h", "PMU_IOC_GET_MODEL", _IOC_READ, 0x4203, 0x04 },
@@ -1549,6 +1688,12 @@
 { "linux/pps.h", "PPS_GETPARAMS", _IOC_READ, 0x70a1, 0x04 },
 { "linux/pps.h", "PPS_KC_BIND", _IOC_WRITE, 0x70a5, 0x04 },
 { "linux/pps.h", "PPS_SETPARAMS", _IOC_WRITE, 0x70a2, 0x04 },
+{ "linux/pr.h", "IOC_PR_CLEAR", _IOC_WRITE, 0x70cd, 0x10 },
+{ "linux/pr.h", "IOC_PR_PREEMPT", _IOC_WRITE, 0x70cb, 0x18 },
+{ "linux/pr.h", "IOC_PR_PREEMPT_ABORT", _IOC_WRITE, 0x70cc, 0x18 },
+{ "linux/pr.h", "IOC_PR_REGISTER", _IOC_WRITE, 0x70c8, 0x18 },
+{ "linux/pr.h", "IOC_PR_RELEASE", _IOC_WRITE, 0x70ca, 0x10 },
+{ "linux/pr.h", "IOC_PR_RESERVE", _IOC_WRITE, 0x70c9, 0x10 },
 { "linux/ptp_clock.h", "PTP_CLOCK_GETCAPS", _IOC_READ, 0x3d01, 0x50 },
 { "linux/ptp_clock.h", "PTP_ENABLE_PPS", _IOC_WRITE, 0x3d04, 0x04 },
 { "linux/ptp_clock.h", "PTP_EXTTS_REQUEST", _IOC_WRITE, 0x3d02, 0x10 },
@@ -1556,10 +1701,12 @@
 { "linux/ptp_clock.h", "PTP_PIN_GETFUNC", _IOC_READ|_IOC_WRITE, 0x3d06, 0x60 },
 { "linux/ptp_clock.h", "PTP_PIN_SETFUNC", _IOC_WRITE, 0x3d07, 0x60 },
 { "linux/ptp_clock.h", "PTP_SYS_OFFSET", _IOC_WRITE, 0x3d05, 0x340 },
+{ "linux/ptp_clock.h", "PTP_SYS_OFFSET_PRECISE", _IOC_READ|_IOC_WRITE, 0x3d08, 0x40 },
 { "linux/radeonfb.h", "FBIO_RADEON_GET_MIRROR", _IOC_READ, 0x4003, 0x04 },
 { "linux/radeonfb.h", "FBIO_RADEON_SET_MIRROR", _IOC_WRITE, 0x4004, 0x04 },
 { "linux/raid/md_u.h", "ADD_NEW_DISK", _IOC_WRITE, 0x0921, 0x14 },
 { "linux/raid/md_u.h", "CLEAR_ARRAY", _IOC_NONE, 0x0920, 0x00 },
+{ "linux/raid/md_u.h", "CLUSTERED_DISK_NACK", _IOC_NONE, 0x0935, 0x00 },
 { "linux/raid/md_u.h", "GET_ARRAY_INFO", _IOC_READ, 0x0911, 0x48 },
 { "linux/raid/md_u.h", "GET_BITMAP_FILE", _IOC_READ, 0x0915, 0x1000 },
 { "linux/raid/md_u.h", "GET_DISK_INFO", _IOC_READ, 0x0912, 0x14 },
@@ -1589,6 +1736,30 @@
 { "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
 { "linux/reiserfs_fs.h", "REISERFS_IOC_UNPACK", _IOC_WRITE, 0xcd01, 0x04 },
 { "linux/rfkill.h", "RFKILL_IOCTL_NOINPUT", _IOC_NONE, 0x5201, 0x00 },
+{ "linux/rio_mport_cdev.h", "RIO_ALLOC_DMA", _IOC_READ|_IOC_WRITE, 0x6d13, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_ADD", _IOC_WRITE, 0x6d17, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DEV_DEL", _IOC_WRITE, 0x6d18, 0x20 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d0a, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_DISABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0c, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_DOORBELL_RANGE", _IOC_WRITE, 0x6d09, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_ENABLE_PORTWRITE_RANGE", _IOC_WRITE, 0x6d0b, 0x10 },
+{ "linux/rio_mport_cdev.h", "RIO_FREE_DMA", _IOC_WRITE, 0x6d14, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_GET_EVENT_MASK", _IOC_READ, 0x6d0e, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_INBOUND", _IOC_READ|_IOC_WRITE, 0x6d11, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MAP_OUTBOUND", _IOC_READ|_IOC_WRITE, 0x6d0f, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_GET_PROPERTIES", _IOC_READ, 0x6d04, 0x30 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_COMPTAG_SET", _IOC_WRITE, 0x6d02, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_HDID_SET", _IOC_WRITE, 0x6d01, 0x02 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_PORT_IDX_GET", _IOC_READ, 0x6d03, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_LOCAL", _IOC_READ, 0x6d05, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_READ_REMOTE", _IOC_READ, 0x6d07, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_LOCAL", _IOC_WRITE, 0x6d06, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_MPORT_MAINT_WRITE_REMOTE", _IOC_WRITE, 0x6d08, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_SET_EVENT_MASK", _IOC_WRITE, 0x6d0d, 0x04 },
+{ "linux/rio_mport_cdev.h", "RIO_TRANSFER", _IOC_READ|_IOC_WRITE, 0x6d15, 0x18 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_INBOUND", _IOC_WRITE, 0x6d12, 0x08 },
+{ "linux/rio_mport_cdev.h", "RIO_UNMAP_OUTBOUND", _IOC_WRITE, 0x6d10, 0x28 },
+{ "linux/rio_mport_cdev.h", "RIO_WAIT_FOR_ASYNC", _IOC_WRITE, 0x6d16, 0x08 },
 { "linux/rtc.h", "RTC_AIE_OFF", _IOC_NONE, 0x7002, 0x00 },
 { "linux/rtc.h", "RTC_AIE_ON", _IOC_NONE, 0x7001, 0x00 },
 { "linux/rtc.h", "RTC_ALM_READ", _IOC_READ, 0x7008, 0x24 },
@@ -1611,6 +1782,23 @@
 { "linux/rtc.h", "RTC_WIE_ON", _IOC_NONE, 0x700f, 0x00 },
 { "linux/rtc.h", "RTC_WKALM_RD", _IOC_READ, 0x7010, 0x28 },
 { "linux/rtc.h", "RTC_WKALM_SET", _IOC_WRITE, 0x700f, 0x28 },
+{ "linux/scif_ioctl.h", "SCIF_ACCEPTREG", _IOC_READ|_IOC_WRITE, 0x7305, 0x08 },
+{ "linux/scif_ioctl.h", "SCIF_ACCEPTREQ", _IOC_READ|_IOC_WRITE, 0x7304, 0x10 },
+{ "linux/scif_ioctl.h", "SCIF_BIND", _IOC_READ|_IOC_WRITE, 0x7301, 0x08 },
+{ "linux/scif_ioctl.h", "SCIF_CONNECT", _IOC_READ|_IOC_WRITE, 0x7303, 0x08 },
+{ "linux/scif_ioctl.h", "SCIF_FENCE_MARK", _IOC_READ|_IOC_WRITE, 0x730f, 0x10 },
+{ "linux/scif_ioctl.h", "SCIF_FENCE_SIGNAL", _IOC_READ|_IOC_WRITE, 0x7311, 0x28 },
+{ "linux/scif_ioctl.h", "SCIF_FENCE_WAIT", _IOC_READ|_IOC_WRITE, 0x7310, 0x04 },
+{ "linux/scif_ioctl.h", "SCIF_GET_NODEIDS", _IOC_READ|_IOC_WRITE, 0x730e, 0x18 },
+{ "linux/scif_ioctl.h", "SCIF_LISTEN", _IOC_WRITE, 0x7302, 0x04 },
+{ "linux/scif_ioctl.h", "SCIF_READFROM", _IOC_READ|_IOC_WRITE, 0x730a, 0x28 },
+{ "linux/scif_ioctl.h", "SCIF_RECV", _IOC_READ|_IOC_WRITE, 0x7307, 0x18 },
+{ "linux/scif_ioctl.h", "SCIF_REG", _IOC_READ|_IOC_WRITE, 0x7308, 0x28 },
+{ "linux/scif_ioctl.h", "SCIF_SEND", _IOC_READ|_IOC_WRITE, 0x7306, 0x18 },
+{ "linux/scif_ioctl.h", "SCIF_UNREG", _IOC_READ|_IOC_WRITE, 0x7309, 0x10 },
+{ "linux/scif_ioctl.h", "SCIF_VREADFROM", _IOC_READ|_IOC_WRITE, 0x730c, 0x28 },
+{ "linux/scif_ioctl.h", "SCIF_VWRITETO", _IOC_READ|_IOC_WRITE, 0x730d, 0x28 },
+{ "linux/scif_ioctl.h", "SCIF_WRITETO", _IOC_READ|_IOC_WRITE, 0x730b, 0x28 },
 { "linux/serio.h", "SPIOCSTYPE", _IOC_WRITE, 0x7101, 0x04 },
 { "linux/sockios.h", "SIOCADDDLCI", 0, 0x8980, 0 },
 { "linux/sockios.h", "SIOCADDMULTI", 0, 0x8931, 0 },
@@ -1805,6 +1993,9 @@
 { "linux/spi/spidev.h", "SPI_IOC_WR_MAX_SPEED_HZ", _IOC_WRITE, 0x6b04, 0x04 },
 { "linux/spi/spidev.h", "SPI_IOC_WR_MODE", _IOC_WRITE, 0x6b01, 0x01 },
 { "linux/spi/spidev.h", "SPI_IOC_WR_MODE32", _IOC_WRITE, 0x6b05, 0x04 },
+{ "linux/stm.h", "STP_POLICY_ID_GET", _IOC_READ, 0x2501, 0x10 },
+{ "linux/stm.h", "STP_POLICY_ID_SET", _IOC_READ|_IOC_WRITE, 0x2500, 0x10 },
+{ "linux/stm.h", "STP_SET_OPTIONS", _IOC_WRITE, 0x2502, 0x08 },
 { "linux/suspend_ioctls.h", "SNAPSHOT_ALLOC_SWAP_PAGE", _IOC_READ, 0x3314, 0x08 },
 { "linux/suspend_ioctls.h", "SNAPSHOT_ATOMIC_RESTORE", _IOC_NONE, 0x3304, 0x00 },
 { "linux/suspend_ioctls.h", "SNAPSHOT_AVAIL_SWAP_SIZE", _IOC_READ, 0x3313, 0x08 },
@@ -1887,15 +2078,18 @@
 { "linux/telephony.h", "PHONE_WINK", _IOC_WRITE, 0x71aa, 0x04 },
 { "linux/telephony.h", "PHONE_WINK_DURATION", _IOC_WRITE, 0x71a6, 0x04 },
 { "linux/timerfd.h", "TFD_IOC_SET_TICKS", _IOC_WRITE, 0x5400, 0x08 },
-{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x04 },
+{ "linux/toshiba.h", "TOSHIBA_ACPI_SCI", _IOC_READ|_IOC_WRITE, 0x7491, 0x18 },
+{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x18 },
 { "linux/udf_fs_i.h", "UDF_GETEABLOCK", _IOC_READ, 0x6c41, 0x04 },
 { "linux/udf_fs_i.h", "UDF_GETEASIZE", _IOC_READ, 0x6c40, 0x04 },
 { "linux/udf_fs_i.h", "UDF_GETVOLIDENT", _IOC_READ, 0x6c42, 0x04 },
 { "linux/udf_fs_i.h", "UDF_RELOCATE_BLOCKS", _IOC_READ|_IOC_WRITE, 0x6c43, 0x04 },
+{ "linux/uinput.h", "UI_ABS_SETUP", _IOC_WRITE, 0x5504, 0x1c },
 { "linux/uinput.h", "UI_BEGIN_FF_ERASE", _IOC_READ|_IOC_WRITE, 0x55ca, 0x0c },
 { "linux/uinput.h", "UI_BEGIN_FF_UPLOAD", _IOC_READ|_IOC_WRITE, 0x55c8, 0x60 },
 { "linux/uinput.h", "UI_DEV_CREATE", _IOC_NONE, 0x5501, 0x00 },
 { "linux/uinput.h", "UI_DEV_DESTROY", _IOC_NONE, 0x5502, 0x00 },
+{ "linux/uinput.h", "UI_DEV_SETUP", _IOC_WRITE, 0x5503, 0x5c },
 { "linux/uinput.h", "UI_END_FF_ERASE", _IOC_WRITE, 0x55cb, 0x0c },
 { "linux/uinput.h", "UI_END_FF_UPLOAD", _IOC_WRITE, 0x55c9, 0x60 },
 { "linux/uinput.h", "UI_GET_VERSION", _IOC_READ, 0x552d, 0x04 },
@@ -1925,6 +2119,11 @@
 { "linux/usb/iowarrior.h", "IOW_GETINFO", _IOC_READ, 0xc003, 0x28 },
 { "linux/usb/iowarrior.h", "IOW_READ", _IOC_WRITE, 0xc002, 0x04 },
 { "linux/usb/iowarrior.h", "IOW_WRITE", _IOC_WRITE, 0xc001, 0x04 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GET_CAPS", _IOC_READ, 0x5b11, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_GOTO_LOCAL", _IOC_NONE, 0x5b14, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_LOCAL_LOCKOUT", _IOC_NONE, 0x5b15, 0x00 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_READ_STB", _IOC_READ, 0x5b12, 0x01 },
+{ "linux/usb/tmc.h", "USBTMC488_IOCTL_REN_CONTROL", _IOC_WRITE, 0x5b13, 0x01 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_IN", _IOC_NONE, 0x5b04, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_ABORT_BULK_OUT", _IOC_NONE, 0x5b03, 0x00 },
 { "linux/usb/tmc.h", "USBTMC_IOCTL_CLEAR", _IOC_NONE, 0x5b02, 0x00 },
@@ -1946,6 +2145,7 @@
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCONNECT_CLAIM", _IOC_READ, 0x551b, 0x108 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL", _IOC_READ, 0x550e, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_DISCSIGNAL32", _IOC_READ, 0x550e, 0x08 },
+{ "linux/usbdevice_fs.h", "USBDEVFS_DROP_PRIVILEGES", _IOC_WRITE, 0x551e, 0x04 },
 { "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
 { "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
@@ -1964,6 +2164,12 @@
 { "linux/usbdevice_fs.h", "USBDEVFS_SETINTERFACE", _IOC_READ, 0x5504, 0x08 },
 { "linux/usbdevice_fs.h", "USBDEVFS_SUBMITURB", _IOC_READ, 0x550a, 0x2c },
 { "linux/usbdevice_fs.h", "USBDEVFS_SUBMITURB32", _IOC_READ, 0x550a, 0x2a },
+{ "linux/userfaultfd.h", "UFFDIO_API", _IOC_READ|_IOC_WRITE, 0xaa3f, 0x18 },
+{ "linux/userfaultfd.h", "UFFDIO_COPY", _IOC_READ|_IOC_WRITE, 0xaa03, 0x28 },
+{ "linux/userfaultfd.h", "UFFDIO_REGISTER", _IOC_READ|_IOC_WRITE, 0xaa00, 0x20 },
+{ "linux/userfaultfd.h", "UFFDIO_UNREGISTER", _IOC_READ, 0xaa01, 0x10 },
+{ "linux/userfaultfd.h", "UFFDIO_WAKE", _IOC_READ, 0xaa02, 0x10 },
+{ "linux/userfaultfd.h", "UFFDIO_ZEROPAGE", _IOC_READ|_IOC_WRITE, 0xaa04, 0x20 },
 { "linux/uvcvideo.h", "UVCIOC_CTRL_MAP", _IOC_READ|_IOC_WRITE, 0x7520, 0x58 },
 { "linux/uvcvideo.h", "UVCIOC_CTRL_QUERY", _IOC_READ|_IOC_WRITE, 0x7521, 0x0c },
 { "linux/v4l2-subdev.h", "VIDIOC_SUBDEV_DV_TIMINGS_CAP", _IOC_READ|_IOC_WRITE, 0x5664, 0x90 },
@@ -2002,11 +2208,17 @@
 { "linux/vfio.h", "VFIO_IOMMU_ENABLE", _IOC_NONE, 0x3b73, 0x00 },
 { "linux/vfio.h", "VFIO_IOMMU_GET_INFO", _IOC_NONE, 0x3b70, 0x00 },
 { "linux/vfio.h", "VFIO_IOMMU_MAP_DMA", _IOC_NONE, 0x3b71, 0x00 },
+{ "linux/vfio.h", "VFIO_IOMMU_SPAPR_REGISTER_MEMORY", _IOC_NONE, 0x3b75, 0x00 },
+{ "linux/vfio.h", "VFIO_IOMMU_SPAPR_TCE_CREATE", _IOC_NONE, 0x3b77, 0x00 },
 { "linux/vfio.h", "VFIO_IOMMU_SPAPR_TCE_GET_INFO", _IOC_NONE, 0x3b70, 0x00 },
+{ "linux/vfio.h", "VFIO_IOMMU_SPAPR_TCE_REMOVE", _IOC_NONE, 0x3b78, 0x00 },
+{ "linux/vfio.h", "VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY", _IOC_NONE, 0x3b76, 0x00 },
 { "linux/vfio.h", "VFIO_IOMMU_UNMAP_DMA", _IOC_NONE, 0x3b72, 0x00 },
 { "linux/vfio.h", "VFIO_SET_IOMMU", _IOC_NONE, 0x3b66, 0x00 },
 { "linux/vhost.h", "VHOST_GET_FEATURES", _IOC_READ, 0xaf00, 0x08 },
 { "linux/vhost.h", "VHOST_GET_VRING_BASE", _IOC_READ|_IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_GET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf24, 0x08 },
+{ "linux/vhost.h", "VHOST_GET_VRING_ENDIAN", _IOC_WRITE, 0xaf14, 0x08 },
 { "linux/vhost.h", "VHOST_NET_SET_BACKEND", _IOC_WRITE, 0xaf30, 0x08 },
 { "linux/vhost.h", "VHOST_RESET_OWNER", _IOC_NONE, 0xaf02, 0x00 },
 { "linux/vhost.h", "VHOST_SCSI_CLEAR_ENDPOINT", _IOC_WRITE, 0xaf41, 0xe8 },
@@ -2021,7 +2233,9 @@
 { "linux/vhost.h", "VHOST_SET_OWNER", _IOC_NONE, 0xaf01, 0x00 },
 { "linux/vhost.h", "VHOST_SET_VRING_ADDR", _IOC_WRITE, 0xaf11, 0x28 },
 { "linux/vhost.h", "VHOST_SET_VRING_BASE", _IOC_WRITE, 0xaf12, 0x08 },
+{ "linux/vhost.h", "VHOST_SET_VRING_BUSYLOOP_TIMEOUT", _IOC_WRITE, 0xaf23, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_CALL", _IOC_WRITE, 0xaf21, 0x08 },
+{ "linux/vhost.h", "VHOST_SET_VRING_ENDIAN", _IOC_WRITE, 0xaf13, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_ERR", _IOC_WRITE, 0xaf22, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_KICK", _IOC_WRITE, 0xaf20, 0x08 },
 { "linux/vhost.h", "VHOST_SET_VRING_NUM", _IOC_WRITE, 0xaf10, 0x08 },
@@ -2211,55 +2425,24 @@
 { "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
 { "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
 { "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
-{ "media/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
-{ "media/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },
-{ "media/bt819.h", "BT819_FIFO_RESET_LOW", _IOC_NONE, 0x6200, 0x00 },
 { "media/davinci/vpfe_capture.h", "VPFE_CMD_S_CCDC_RAW_PARAMS", _IOC_WRITE, 0x56c1, 0x04 },
-{ "media/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
-{ "media/lirc.h", "LIRC_GET_FEATURES", _IOC_READ, 0x6900, 0x04 },
-{ "media/lirc.h", "LIRC_GET_LENGTH", _IOC_READ, 0x690f, 0x04 },
-{ "media/lirc.h", "LIRC_GET_MAX_FILTER_PULSE", _IOC_READ, 0x690b, 0x04 },
-{ "media/lirc.h", "LIRC_GET_MAX_FILTER_SPACE", _IOC_READ, 0x690d, 0x04 },
-{ "media/lirc.h", "LIRC_GET_MAX_TIMEOUT", _IOC_READ, 0x6909, 0x04 },
-{ "media/lirc.h", "LIRC_GET_MIN_FILTER_PULSE", _IOC_READ, 0x690a, 0x04 },
-{ "media/lirc.h", "LIRC_GET_MIN_FILTER_SPACE", _IOC_READ, 0x690c, 0x04 },
-{ "media/lirc.h", "LIRC_GET_MIN_TIMEOUT", _IOC_READ, 0x6908, 0x04 },
-{ "media/lirc.h", "LIRC_GET_REC_CARRIER", _IOC_READ, 0x6904, 0x04 },
-{ "media/lirc.h", "LIRC_GET_REC_DUTY_CYCLE", _IOC_READ, 0x6906, 0x04 },
-{ "media/lirc.h", "LIRC_GET_REC_MODE", _IOC_READ, 0x6902, 0x04 },
-{ "media/lirc.h", "LIRC_GET_REC_RESOLUTION", _IOC_READ, 0x6907, 0x04 },
-{ "media/lirc.h", "LIRC_GET_SEND_CARRIER", _IOC_READ, 0x6903, 0x04 },
-{ "media/lirc.h", "LIRC_GET_SEND_DUTY_CYCLE", _IOC_READ, 0x6905, 0x04 },
-{ "media/lirc.h", "LIRC_GET_SEND_MODE", _IOC_READ, 0x6901, 0x04 },
-{ "media/lirc.h", "LIRC_NOTIFY_DECODE", _IOC_NONE, 0x6920, 0x00 },
-{ "media/lirc.h", "LIRC_SETUP_END", _IOC_NONE, 0x6922, 0x00 },
-{ "media/lirc.h", "LIRC_SETUP_START", _IOC_NONE, 0x6921, 0x00 },
-{ "media/lirc.h", "LIRC_SET_MEASURE_CARRIER_MODE", _IOC_WRITE, 0x691d, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_CARRIER", _IOC_WRITE, 0x6914, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_CARRIER_RANGE", _IOC_WRITE, 0x691f, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_DUTY_CYCLE", _IOC_WRITE, 0x6916, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_DUTY_CYCLE_RANGE", _IOC_WRITE, 0x691e, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_FILTER", _IOC_WRITE, 0x691c, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_FILTER_PULSE", _IOC_WRITE, 0x691a, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_FILTER_SPACE", _IOC_WRITE, 0x691b, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_MODE", _IOC_WRITE, 0x6912, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_TIMEOUT", _IOC_WRITE, 0x6918, 0x04 },
-{ "media/lirc.h", "LIRC_SET_REC_TIMEOUT_REPORTS", _IOC_WRITE, 0x6919, 0x04 },
-{ "media/lirc.h", "LIRC_SET_SEND_CARRIER", _IOC_WRITE, 0x6913, 0x04 },
-{ "media/lirc.h", "LIRC_SET_SEND_DUTY_CYCLE", _IOC_WRITE, 0x6915, 0x04 },
-{ "media/lirc.h", "LIRC_SET_SEND_MODE", _IOC_WRITE, 0x6911, 0x04 },
-{ "media/lirc.h", "LIRC_SET_TRANSMITTER_MASK", _IOC_WRITE, 0x6917, 0x04 },
-{ "media/lirc.h", "LIRC_SET_WIDEBAND_RECEIVER", _IOC_WRITE, 0x6923, 0x04 },
-{ "media/saa6588.h", "SAA6588_CMD_CLOSE", _IOC_WRITE, 0x5202, 0x04 },
-{ "media/saa6588.h", "SAA6588_CMD_POLL", _IOC_READ, 0x5204, 0x04 },
-{ "media/saa6588.h", "SAA6588_CMD_READ", _IOC_READ, 0x5203, 0x04 },
-{ "media/si4713.h", "SI4713_IOC_MEASURE_RNL", _IOC_READ|_IOC_WRITE, 0x56c0, 0x1c },
+{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
+{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
+{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },
+{ "media/i2c/bt819.h", "BT819_FIFO_RESET_LOW", _IOC_NONE, 0x6200, 0x00 },
+{ "media/i2c/saa6588.h", "SAA6588_CMD_CLOSE", _IOC_WRITE, 0x5202, 0x04 },
+{ "media/i2c/saa6588.h", "SAA6588_CMD_POLL", _IOC_READ, 0x5204, 0x04 },
+{ "media/i2c/saa6588.h", "SAA6588_CMD_READ", _IOC_READ, 0x5203, 0x04 },
 { "media/v4l2-common.h", "TUNER_SET_CONFIG", _IOC_WRITE, 0x645c, 0x08 },
 { "media/v4l2-common.h", "VIDIOC_INT_RESET", _IOC_WRITE, 0x6466, 0x04 },
+{ "media/v4l2-subdev.h", "V4L2_DEVICE_NOTIFY_EVENT", _IOC_WRITE, 0x7602, 0x88 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_RX_NOTIFY", _IOC_WRITE, 0x7600, 0x04 },
 { "media/v4l2-subdev.h", "V4L2_SUBDEV_IR_TX_NOTIFY", _IOC_WRITE, 0x7601, 0x04 },
+{ "misc/cxl.h", "CXL_IOCTL_DOWNLOAD_IMAGE", _IOC_WRITE, 0xca0a, 0x40 },
+{ "misc/cxl.h", "CXL_IOCTL_GET_AFU_ID", _IOC_READ, 0xca02, 0x40 },
 { "misc/cxl.h", "CXL_IOCTL_GET_PROCESS_ELEMENT", _IOC_READ, 0xca01, 0x04 },
 { "misc/cxl.h", "CXL_IOCTL_START_WORK", _IOC_WRITE, 0xca00, 0x40 },
+{ "misc/cxl.h", "CXL_IOCTL_VALIDATE_IMAGE", _IOC_WRITE, 0xca0b, 0x40 },
 { "mtd/mtd-abi.h", "ECCGETLAYOUT", _IOC_READ, 0x4d11, 0x148 },
 { "mtd/mtd-abi.h", "ECCGETSTATS", _IOC_READ, 0x4d12, 0x10 },
 { "mtd/mtd-abi.h", "MEMERASE", _IOC_WRITE, 0x4d02, 0x08 },
@@ -2324,10 +2507,21 @@
 { "net/bluetooth/rfcomm.h", "RFCOMMGETDEVLIST", _IOC_READ, 0x52d2, 0x04 },
 { "net/bluetooth/rfcomm.h", "RFCOMMRELEASEDEV", _IOC_WRITE, 0x52c9, 0x04 },
 { "net/bluetooth/rfcomm.h", "RFCOMMSTEALDLC", _IOC_WRITE, 0x52dc, 0x04 },
+{ "net/nfc/nci_core.h", "NCIUARTSETDRIVER", _IOC_WRITE, 0x5500, 0x04 },
 { "rdma/ib_user_mad.h", "IB_USER_MAD_ENABLE_PKEY", _IOC_NONE, 0x1b03, 0x00 },
 { "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
 { "rdma/ib_user_mad.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
 { "rdma/ib_user_mad.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_RECOVER_AFU", _IOC_READ|_IOC_WRITE, 0xca85, 0x78 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_RELEASE", _IOC_READ|_IOC_WRITE, 0xca82, 0x68 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_USER_DIRECT", _IOC_READ|_IOC_WRITE, 0xca81, 0x70 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_USER_VIRTUAL", _IOC_READ|_IOC_WRITE, 0xca87, 0x78 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VERIFY", _IOC_READ|_IOC_WRITE, 0xca84, 0x90 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_CLONE", _IOC_READ|_IOC_WRITE, 0xca89, 0x70 },
+{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_RESIZE", _IOC_READ|_IOC_WRITE, 0xca88, 0x78 },
 { "scsi/scsi.h", "SCSI_IOCTL_GET_BUS_NUMBER", 0, 0x5386, 0 },
 { "scsi/scsi.h", "SCSI_IOCTL_GET_IDLUN", 0, 0x5382, 0 },
 { "scsi/scsi.h", "SCSI_IOCTL_GET_PCI", 0, 0x5387, 0 },
@@ -2370,7 +2564,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_PORT_INFO", _IOC_READ|_IOC_WRITE, 0x5322, 0xa4 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT", _IOC_READ|_IOC_WRITE, 0x5349, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5334, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER", _IOC_READ|_IOC_WRITE, 0x5343, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS", _IOC_READ|_IOC_WRITE, 0x5340, 0x5c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO", _IOC_READ|_IOC_WRITE, 0x5341, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER", _IOC_READ|_IOC_WRITE, 0x5345, 0x60 },
@@ -2386,7 +2579,6 @@
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_PORT_INFO", _IOC_WRITE, 0x5323, 0xa4 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT", _IOC_WRITE, 0x534a, 0x4c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_INFO", _IOC_READ|_IOC_WRITE, 0x5335, 0x8c },
-{ "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER", _IOC_WRITE, 0x5344, 0x00 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO", _IOC_WRITE, 0x5342, 0x2c },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER", _IOC_WRITE, 0x5346, 0x60 },
 { "sound/asequencer.h", "SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT", _IOC_WRITE, 0x5330, 0x50 },
@@ -2442,6 +2634,7 @@
 { "sound/asound.h", "SNDRV_PCM_IOCTL_REWIND", _IOC_WRITE, 0x4146, 0x04 },
 { "sound/asound.h", "SNDRV_PCM_IOCTL_START", _IOC_NONE, 0x4142, 0x00 },
 { "sound/asound.h", "SNDRV_PCM_IOCTL_STATUS", _IOC_READ, 0x4120, 0x80 },
+{ "sound/asound.h", "SNDRV_PCM_IOCTL_STATUS_EXT", _IOC_READ|_IOC_WRITE, 0x4124, 0x80 },
 { "sound/asound.h", "SNDRV_PCM_IOCTL_SW_PARAMS", _IOC_READ|_IOC_WRITE, 0x4113, 0x68 },
 { "sound/asound.h", "SNDRV_PCM_IOCTL_SYNC_PTR", _IOC_READ|_IOC_WRITE, 0x4123, 0x88 },
 { "sound/asound.h", "SNDRV_PCM_IOCTL_TSTAMP", _IOC_WRITE, 0x4102, 0x04 },
@@ -2539,8 +2732,7 @@
 { "sound/sfnt_info.h", "SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES", _IOC_NONE, 0x4883, 0x00 },
 { "sound/sfnt_info.h", "SNDRV_EMUX_IOCTL_RESET_SAMPLES", _IOC_NONE, 0x4882, 0x00 },
 { "sound/sfnt_info.h", "SNDRV_EMUX_IOCTL_VERSION", _IOC_READ, 0x4880, 0x04 },
-{ "staging/android/android_alarm.h", "ANDROID_ALARM_SET_RTC", _IOC_WRITE, 0x6105, 0x10 },
-{ "staging/android/android_alarm.h", "ANDROID_ALARM_WAIT", _IOC_NONE, 0x6101, 0x00 },
+{ "sound/usb_stream.h", "SNDRV_USB_STREAM_IOCTL_SET_PARAMS", _IOC_WRITE, 0x4890, 0x10 },
 { "staging/android/ashmem.h", "ASHMEM_GET_NAME", _IOC_READ, 0x7702, 0x100 },
 { "staging/android/ashmem.h", "ASHMEM_GET_PIN_STATUS", _IOC_NONE, 0x7709, 0x00 },
 { "staging/android/ashmem.h", "ASHMEM_GET_PROT_MASK", _IOC_NONE, 0x7706, 0x00 },
@@ -2561,17 +2753,10 @@
 { "staging/android/ion_test.h", "ION_IOC_TEST_DMA_MAPPING", _IOC_WRITE, 0x49f1, 0x20 },
 { "staging/android/ion_test.h", "ION_IOC_TEST_KERNEL_MAPPING", _IOC_WRITE, 0x49f2, 0x20 },
 { "staging/android/ion_test.h", "ION_IOC_TEST_SET_FD", _IOC_NONE, 0x49f0, 0x00 },
-{ "staging/android/logger.h", "LOGGER_FLUSH_LOG", _IOC_NONE, 0xae04, 0x00 },
-{ "staging/android/logger.h", "LOGGER_GET_LOG_BUF_SIZE", _IOC_NONE, 0xae01, 0x00 },
-{ "staging/android/logger.h", "LOGGER_GET_LOG_LEN", _IOC_NONE, 0xae02, 0x00 },
-{ "staging/android/logger.h", "LOGGER_GET_NEXT_ENTRY_LEN", _IOC_NONE, 0xae03, 0x00 },
-{ "staging/android/logger.h", "LOGGER_GET_VERSION", _IOC_NONE, 0xae05, 0x00 },
-{ "staging/android/logger.h", "LOGGER_SET_VERSION", _IOC_NONE, 0xae06, 0x00 },
 { "staging/android/sw_sync.h", "SW_SYNC_IOC_CREATE_FENCE", _IOC_READ|_IOC_WRITE, 0x5700, 0x28 },
 { "staging/android/sw_sync.h", "SW_SYNC_IOC_INC", _IOC_WRITE, 0x5701, 0x04 },
 { "staging/android/sync.h", "SYNC_IOC_FENCE_INFO", _IOC_READ|_IOC_WRITE, 0x3e02, 0x28 },
 { "staging/android/sync.h", "SYNC_IOC_MERGE", _IOC_READ|_IOC_WRITE, 0x3e01, 0x28 },
-{ "staging/android/sync.h", "SYNC_IOC_WAIT", _IOC_WRITE, 0x3e00, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_BRIGHTNESS", _IOC_READ, 0x4603, 0x04 },
 { "video/da8xx-fb.h", "FBIGET_COLOR", _IOC_READ, 0x4605, 0x04 },
 { "video/da8xx-fb.h", "FBIOGET_CONTRAST", _IOC_READ, 0x4601, 0x04 },
@@ -2613,5 +2798,11 @@
 { "xen/evtchn.h", "IOCTL_EVTCHN_NOTIFY", _IOC_NONE, 0x4504, 0x04 },
 { "xen/evtchn.h", "IOCTL_EVTCHN_RESET", _IOC_NONE, 0x4505, 0x00 },
 { "xen/evtchn.h", "IOCTL_EVTCHN_UNBIND", _IOC_NONE, 0x4503, 0x04 },
+{ "xen/gntdev.h", "IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR", _IOC_NONE, 0x4702, 0x18 },
+{ "xen/gntdev.h", "IOCTL_GNTDEV_GRANT_COPY", _IOC_NONE, 0x4708, 0x08 },
+{ "xen/gntdev.h", "IOCTL_GNTDEV_MAP_GRANT_REF", _IOC_NONE, 0x4700, 0x18 },
+{ "xen/gntdev.h", "IOCTL_GNTDEV_SET_MAX_GRANTS", _IOC_NONE, 0x4703, 0x04 },
+{ "xen/gntdev.h", "IOCTL_GNTDEV_SET_UNMAP_NOTIFY", _IOC_NONE, 0x4707, 0x10 },
+{ "xen/gntdev.h", "IOCTL_GNTDEV_UNMAP_GRANT_REF", _IOC_NONE, 0x4701, 0x10 },
 { "xen/xenbus_dev.h", "IOCTL_XENBUS_BACKEND_EVTCHN", _IOC_NONE, 0x4200, 0x00 },
 { "xen/xenbus_dev.h", "IOCTL_XENBUS_BACKEND_SETUP", _IOC_NONE, 0x4201, 0x00 },
diff --git a/linux/x32/syscallent.h b/linux/x32/syscallent.h
index 5ef4a66..965a5dc 100644
--- a/linux/x32/syscallent.h
+++ b/linux/x32/syscallent.h
@@ -325,6 +325,8 @@
 [324] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [325] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [326] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
+[327] = { 6,	TD,		SEN(printargs),			"64:preadv2"		},
+[328] = { 6,	TD,		SEN(printargs),			"64:pwritev2"		},
 [327 ... 511] = { },
 /*
  * x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h
index 52d73bf..265d55f 100644
--- a/linux/x86_64/syscallent.h
+++ b/linux/x86_64/syscallent.h
@@ -325,3 +325,5 @@
 [324] = { 2,	0,		SEN(membarrier),		"membarrier",		},
 [325] = { 3,	TM,		SEN(mlock2),			"mlock2"		},
 [326] = { 6,	TD,		SEN(copy_file_range),		"copy_file_range"	},
+[327] = { 6,	TD,		SEN(preadv2),			"preadv2"		},
+[328] = { 6,	TD,		SEN(pwritev2),			"pwritev2"		},
diff --git a/loop.c b/loop.c
index 26aaca0..2de33c5 100644
--- a/loop.c
+++ b/loop.c
@@ -41,40 +41,40 @@
 	if (umove_or_printaddr(tcp, addr, &info))
 		return;
 
-	tprintf("{number=%d", info.lo_number);
+	tprintf("{lo_number=%d", info.lo_number);
 
 	if (!abbrev(tcp)) {
-		tprintf(", device=%#lx, inode=%lu, rdevice=%#lx",
+		tprintf(", lo_device=%#lx, lo_inode=%lu, lo_rdevice=%#lx",
 			(unsigned long) info.lo_device,
 			info.lo_inode,
 			(unsigned long) info.lo_rdevice);
 	}
 
-	tprintf(", offset=%#x", info.lo_offset);
+	tprintf(", lo_offset=%#x", info.lo_offset);
 
 	if (!abbrev(tcp) || info.lo_encrypt_type != LO_CRYPT_NONE) {
-		tprints(", encrypt_type=");
+		tprints(", lo_encrypt_type=");
 		printxval(loop_crypt_type_options, info.lo_encrypt_type,
 			"LO_CRYPT_???");
-		tprintf(", encrypt_key_size=%d", info.lo_encrypt_key_size);
+		tprintf(", lo_encrypt_key_size=%d", info.lo_encrypt_key_size);
 	}
 
-	tprints(", flags=");
+	tprints(", lo_flags=");
 	printflags(loop_flags_options, info.lo_flags, "LO_FLAGS_???");
 
-	tprints(", name=");
+	tprints(", lo_name=");
 	print_quoted_string(info.lo_name, LO_NAME_SIZE,
 			    QUOTE_0_TERMINATED);
 
 	if (!abbrev(tcp) || info.lo_encrypt_type != LO_CRYPT_NONE) {
-		tprints(", encrypt_key=");
+		tprints(", lo_encrypt_key=");
 		print_quoted_string((void *) info.lo_encrypt_key,
 				    LO_KEY_SIZE, 0);
 	}
 
 	if (!abbrev(tcp))
-		tprintf(", init={%#lx, %#lx}"
-			", reserved={%#x, %#x, %#x, %#x}}",
+		tprintf(", lo_init=[%#lx, %#lx]"
+			", reserved=[%#x, %#x, %#x, %#x]}",
 			info.lo_init[0], info.lo_init[1],
 			info.reserved[0], info.reserved[1],
 			info.reserved[2], info.reserved[3]);
@@ -92,9 +92,9 @@
 		return;
 
 	if (!abbrev(tcp)) {
-		tprintf("{device=%" PRIu64 ", inode=%" PRIu64 ", "
-			"rdevice=%" PRIu64 ", offset=%#" PRIx64 ", "
-			"sizelimit=%" PRIu64 ", number=%" PRIu32,
+		tprintf("{lo_device=%" PRIu64 ", lo_inode=%" PRIu64
+			", lo_rdevice=%" PRIu64 ", lo_offset=%#" PRIx64
+			", lo_sizelimit=%" PRIu64 ", lo_number=%" PRIu32,
 			(uint64_t) info64.lo_device,
 			(uint64_t) info64.lo_inode,
 			(uint64_t) info64.lo_rdevice,
@@ -102,37 +102,37 @@
 			(uint64_t) info64.lo_sizelimit,
 			(uint32_t) info64.lo_number);
 	} else {
-		tprintf("{offset=%#" PRIx64 ", number=%" PRIu32,
+		tprintf("{lo_offset=%#" PRIx64 ", lo_number=%" PRIu32,
 			(uint64_t) info64.lo_offset,
 			(uint32_t) info64.lo_number);
 	}
 
 	if (!abbrev(tcp) || info64.lo_encrypt_type != LO_CRYPT_NONE) {
-		tprints(", encrypt_type=");
+		tprints(", lo_encrypt_type=");
 		printxval(loop_crypt_type_options, info64.lo_encrypt_type,
 			"LO_CRYPT_???");
-		tprintf(", encrypt_key_size=%" PRIu32,
+		tprintf(", lo_encrypt_key_size=%" PRIu32,
 			info64.lo_encrypt_key_size);
 	}
 
-	tprints(", flags=");
+	tprints(", lo_flags=");
 	printflags(loop_flags_options, info64.lo_flags, "LO_FLAGS_???");
 
-	tprints(", file_name=");
+	tprints(", lo_file_name=");
 	print_quoted_string((void *) info64.lo_file_name,
 			    LO_NAME_SIZE, QUOTE_0_TERMINATED);
 
 	if (!abbrev(tcp) || info64.lo_encrypt_type != LO_CRYPT_NONE) {
-		tprints(", crypt_name=");
+		tprints(", lo_crypt_name=");
 		print_quoted_string((void *) info64.lo_crypt_name,
 				    LO_NAME_SIZE, QUOTE_0_TERMINATED);
-		tprints(", encrypt_key=");
+		tprints(", lo_encrypt_key=");
 		print_quoted_string((void *) info64.lo_encrypt_key,
 				    LO_KEY_SIZE, 0);
 	}
 
 	if (!abbrev(tcp))
-		tprintf(", init={%#" PRIx64 ", %#" PRIx64 "}}",
+		tprintf(", lo_init=[%#" PRIx64 ", %#" PRIx64 "]}",
 			(uint64_t) info64.lo_init[0],
 			(uint64_t) info64.lo_init[1]);
 	else
@@ -146,23 +146,19 @@
 		return RVAL_DECODED;
 
 	switch (code) {
-	case LOOP_SET_STATUS:
-		decode_loop_info(tcp, arg);
-		break;
-
 	case LOOP_GET_STATUS:
 		if (entering(tcp))
 			return 0;
+		/* fall through */
+	case LOOP_SET_STATUS:
 		decode_loop_info(tcp, arg);
 		break;
 
-	case LOOP_SET_STATUS64:
-		decode_loop_info64(tcp, arg);
-		break;
-
 	case LOOP_GET_STATUS64:
 		if (entering(tcp))
 			return 0;
+		/* fall through */
+	case LOOP_SET_STATUS64:
 		decode_loop_info64(tcp, arg);
 		break;
 
@@ -191,6 +187,12 @@
 		break;
 #endif
 
+#ifdef LOOP_SET_DIRECT_IO
+	case LOOP_SET_DIRECT_IO:
+		tprintf(", %lu", arg);
+		break;
+#endif
+
 	default:
 		return RVAL_DECODED;
 	}
diff --git a/lseek.c b/lseek.c
index cfc6b58..133ddd8 100644
--- a/lseek.c
+++ b/lseek.c
@@ -108,8 +108,8 @@
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
 		tprintf(", %lld, ",
-			((unsigned long long) (unsigned long) tcp->u_arg[1]) << 32
-			| (unsigned long long) (unsigned long) tcp->u_arg[2]);
+			(widen_to_ull(tcp->u_arg[1]) << 32)
+			| widen_to_ull(tcp->u_arg[2]));
 	} else {
 		printnum_int64(tcp, tcp->u_arg[3], "%" PRIu64);
 		tprints(", ");
diff --git a/m32_funcs.h b/m32_funcs.h
new file mode 100644
index 0000000..f4b8672
--- /dev/null
+++ b/m32_funcs.h
@@ -0,0 +1,19 @@
+#undef sys_readdir
+#define sys_readdir m32_sys_readdir
+#undef sys_getdents
+#define sys_getdents m32_sys_getdents
+#undef sys_msgctl
+#define sys_msgctl m32_sys_msgctl
+#undef sys_shmctl
+#define sys_shmctl m32_sys_shmctl
+#undef sys_time
+#define sys_time m32_sys_time
+#undef sys_sigaltstack
+#define sys_sigaltstack m32_sys_sigaltstack
+#undef sys_sysinfo
+#define sys_sysinfo m32_sys_sysinfo
+#undef sys_times
+#define sys_times m32_sys_times
+#undef sys_utime
+#define sys_utime m32_sys_utime
+#include "sys_func.h"
diff --git a/m32_printer_decls.h b/m32_printer_decls.h
new file mode 100644
index 0000000..bd2c6fa
--- /dev/null
+++ b/m32_printer_decls.h
@@ -0,0 +1,28 @@
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
+extern int m32_block_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int m32_btrfs_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int m32_evdev_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern _Bool m32_fetch_seccomp_fprog(struct tcb *tcp, const long addr, void *p);
+extern _Bool m32_fetch_struct_flock(struct tcb *tcp, const long addr, void *p);
+extern _Bool m32_fetch_struct_flock64(struct tcb *tcp, const long addr, void *p);
+extern _Bool m32_fetch_struct_statfs(struct tcb *tcp, const long addr, struct strace_statfs *p);
+extern _Bool m32_fetch_struct_statfs64(struct tcb *tcp, const long addr, const unsigned long size, struct strace_statfs *p);
+extern int m32_hdio_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int m32_mtd_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern void m32_printmqattr(struct tcb *tcp, const long addr);
+extern void m32_tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count);
+extern void m32_print_sigevent(struct tcb *tcp, const long addr);
+extern void m32_print_timespec(struct tcb *tcp, const long addr);
+extern const char * m32_sprint_timespec(struct tcb *tcp, const long addr);
+extern void m32_print_timespec_utime_pair(struct tcb *tcp, const long addr);
+extern void m32_print_itimerspec(struct tcb *tcp, const long addr);
+extern void m32_print_timeval(struct tcb *tcp, const long addr);
+extern void m32_print_timeval_pair(struct tcb *tcp, const long addr);
+extern const char * m32_sprint_timeval(struct tcb *tcp, const long addr);
+extern void m32_print_itimerval(struct tcb *tcp, const long addr);
+extern int m32_print_timex(struct tcb *tcp, const long addr);
+extern void m32_printrusage(struct tcb *tcp, long addr);
+extern void m32_printsiginfo_at(struct tcb *tcp, long addr);
+extern void m32_print_siginfo_array(struct tcb *tcp, unsigned long addr, unsigned long len);
+extern int m32_rtc_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int m32_v4l2_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
diff --git a/m32_printer_defs.h b/m32_printer_defs.h
new file mode 100644
index 0000000..8d3ea27
--- /dev/null
+++ b/m32_printer_defs.h
@@ -0,0 +1,28 @@
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
+.block_ioctl = m32_block_ioctl,
+.btrfs_ioctl = m32_btrfs_ioctl,
+.evdev_ioctl = m32_evdev_ioctl,
+.fetch_seccomp_fprog = m32_fetch_seccomp_fprog,
+.fetch_struct_flock = m32_fetch_struct_flock,
+.fetch_struct_flock64 = m32_fetch_struct_flock64,
+.fetch_struct_statfs = m32_fetch_struct_statfs,
+.fetch_struct_statfs64 = m32_fetch_struct_statfs64,
+.hdio_ioctl = m32_hdio_ioctl,
+.mtd_ioctl = m32_mtd_ioctl,
+.printmqattr = m32_printmqattr,
+.tprint_msgbuf = m32_tprint_msgbuf,
+.print_sigevent = m32_print_sigevent,
+.print_timespec = m32_print_timespec,
+.sprint_timespec = m32_sprint_timespec,
+.print_timespec_utime_pair = m32_print_timespec_utime_pair,
+.print_itimerspec = m32_print_itimerspec,
+.print_timeval = m32_print_timeval,
+.print_timeval_pair = m32_print_timeval_pair,
+.sprint_timeval = m32_sprint_timeval,
+.print_itimerval = m32_print_itimerval,
+.print_timex = m32_print_timex,
+.printrusage = m32_printrusage,
+.printsiginfo_at = m32_printsiginfo_at,
+.print_siginfo_array = m32_print_siginfo_array,
+.rtc_ioctl = m32_rtc_ioctl,
+.v4l2_ioctl = m32_v4l2_ioctl,
diff --git a/m32_type_defs.h b/m32_type_defs.h
new file mode 100644
index 0000000..62edb7b
--- /dev/null
+++ b/m32_type_defs.h
@@ -0,0 +1,121 @@
+#ifdef MPERS_m32_struct_blk_user_trace_setup
+# define struct_blk_user_trace_setup MPERS_m32_struct_blk_user_trace_setup
+#endif
+#ifdef MPERS_m32_struct_blkpg_ioctl_arg
+# define struct_blkpg_ioctl_arg MPERS_m32_struct_blkpg_ioctl_arg
+#endif
+#ifdef MPERS_m32_struct_blkpg_partition
+# define struct_blkpg_partition MPERS_m32_struct_blkpg_partition
+#endif
+#ifdef MPERS_m32_struct_btrfs_ioctl_dev_replace_args
+# define struct_btrfs_ioctl_dev_replace_args MPERS_m32_struct_btrfs_ioctl_dev_replace_args
+#endif
+#ifdef MPERS_m32_struct_btrfs_ioctl_send_args
+# define struct_btrfs_ioctl_send_args MPERS_m32_struct_btrfs_ioctl_send_args
+#endif
+#ifdef MPERS_m32_struct_btrfs_ioctl_received_subvol_args
+# define struct_btrfs_ioctl_received_subvol_args MPERS_m32_struct_btrfs_ioctl_received_subvol_args
+#endif
+#ifdef MPERS_m32_kernel_dirent
+# define kernel_dirent MPERS_m32_kernel_dirent
+#endif
+#ifdef MPERS_m32_struct_ff_effect
+# define struct_ff_effect MPERS_m32_struct_ff_effect
+#endif
+#ifdef MPERS_m32_seccomp_fprog_t
+# define seccomp_fprog_t MPERS_m32_seccomp_fprog_t
+#endif
+#ifdef MPERS_m32_struct_flock
+# define struct_flock MPERS_m32_struct_flock
+#endif
+#ifdef MPERS_m32_struct_flock64
+# define struct_flock64 MPERS_m32_struct_flock64
+#endif
+#ifdef MPERS_m32_struct_statfs
+# define struct_statfs MPERS_m32_struct_statfs
+#endif
+#ifdef MPERS_m32_struct_statfs64
+# define struct_statfs64 MPERS_m32_struct_statfs64
+#endif
+#ifdef MPERS_m32_struct_hd_geometry
+# define struct_hd_geometry MPERS_m32_struct_hd_geometry
+#endif
+#ifdef MPERS_m32_msqid_ds_t
+# define msqid_ds_t MPERS_m32_msqid_ds_t
+#endif
+#ifdef MPERS_m32_shmid_ds_t
+# define shmid_ds_t MPERS_m32_shmid_ds_t
+#endif
+#ifdef MPERS_m32_struct_mtd_oob_buf
+# define struct_mtd_oob_buf MPERS_m32_struct_mtd_oob_buf
+#endif
+#ifdef MPERS_m32_mq_attr_t
+# define mq_attr_t MPERS_m32_mq_attr_t
+#endif
+#ifdef MPERS_m32_msgbuf_t
+# define msgbuf_t MPERS_m32_msgbuf_t
+#endif
+#ifdef MPERS_m32_struct_sigevent
+# define struct_sigevent MPERS_m32_struct_sigevent
+#endif
+#ifdef MPERS_m32_time_t
+# define time_t MPERS_m32_time_t
+#endif
+#ifdef MPERS_m32_timespec_t
+# define timespec_t MPERS_m32_timespec_t
+#endif
+#ifdef MPERS_m32_timeval_t
+# define timeval_t MPERS_m32_timeval_t
+#endif
+#ifdef MPERS_m32_struct_timex
+# define struct_timex MPERS_m32_struct_timex
+#endif
+#ifdef MPERS_m32_rusage_t
+# define rusage_t MPERS_m32_rusage_t
+#endif
+#ifdef MPERS_m32_siginfo_t
+# define siginfo_t MPERS_m32_siginfo_t
+#endif
+#ifdef MPERS_m32_struct_rtc_pll_info
+# define struct_rtc_pll_info MPERS_m32_struct_rtc_pll_info
+#endif
+#ifdef MPERS_m32_stack_t
+# define stack_t MPERS_m32_stack_t
+#endif
+#ifdef MPERS_m32_sysinfo_t
+# define sysinfo_t MPERS_m32_sysinfo_t
+#endif
+#ifdef MPERS_m32_tms_t
+# define tms_t MPERS_m32_tms_t
+#endif
+#ifdef MPERS_m32_utimbuf_t
+# define utimbuf_t MPERS_m32_utimbuf_t
+#endif
+#ifdef MPERS_m32_struct_v4l2_buffer
+# define struct_v4l2_buffer MPERS_m32_struct_v4l2_buffer
+#endif
+#ifdef MPERS_m32_struct_v4l2_create_buffers
+# define struct_v4l2_create_buffers MPERS_m32_struct_v4l2_create_buffers
+#endif
+#ifdef MPERS_m32_struct_v4l2_ext_control
+# define struct_v4l2_ext_control MPERS_m32_struct_v4l2_ext_control
+#endif
+#ifdef MPERS_m32_struct_v4l2_ext_controls
+# define struct_v4l2_ext_controls MPERS_m32_struct_v4l2_ext_controls
+#endif
+#ifdef MPERS_m32_struct_v4l2_format
+# define struct_v4l2_format MPERS_m32_struct_v4l2_format
+#endif
+#ifdef MPERS_m32_struct_v4l2_framebuffer
+# define struct_v4l2_framebuffer MPERS_m32_struct_v4l2_framebuffer
+#endif
+#ifdef MPERS_m32_struct_v4l2_input
+# define struct_v4l2_input MPERS_m32_struct_v4l2_input
+#endif
+#ifdef MPERS_m32_struct_v4l2_standard
+# define struct_v4l2_standard MPERS_m32_struct_v4l2_standard
+#endif
+#undef MPERS_PRINTER_NAME
+#define MPERS_PRINTER_NAME(printer_name) printer_name
+#include "m32_printer_decls.h"
+#include MPERS_m32_IOCTL_MACROS
diff --git a/m4/ax_code_coverage.m4 b/m4/ax_code_coverage.m4
index b621fdd..93dfce3 100644
--- a/m4/ax_code_coverage.m4
+++ b/m4/ax_code_coverage.m4
@@ -8,15 +8,15 @@
 #
 # DESCRIPTION
 #
-#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS and
-#   CODE_COVERAGE_LDFLAGS which should be included in the CPPFLAGS, CFLAGS
-#   and LIBS/LDFLAGS variables of every build target (program or library)
-#   which should be built with code coverage support. Also defines
-#   CODE_COVERAGE_RULES which should be substituted in your Makefile; and
-#   $enable_code_coverage which can be used in subsequent configure output.
-#   CODE_COVERAGE_ENABLED is defined and substituted, and corresponds to the
-#   value of the --enable-code-coverage option, which defaults to being
-#   disabled.
+#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
+#   CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LDFLAGS which should be
+#   included in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LDFLAGS variables of
+#   every build target (program or library) which should be built with code
+#   coverage support. Also defines CODE_COVERAGE_RULES which should be
+#   substituted in your Makefile; and $enable_code_coverage which can be
+#   used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
+#   and substituted, and corresponds to the value of the
+#   --enable-code-coverage option, which defaults to being disabled.
 #
 #   Test also for gcov program and create GCOV variable that could be
 #   substituted.
@@ -36,6 +36,7 @@
 #     my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ...
 #     my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
 #     my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
+#     my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
 #
 #   This results in a "check-code-coverage" rule being added to any
 #   Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
@@ -49,7 +50,7 @@
 #
 # LICENSE
 #
-#   Copyright (c) 2012 Philip Withnall
+#   Copyright (c) 2012, 2016 Philip Withnall
 #   Copyright (c) 2012 Xan Lopez
 #   Copyright (c) 2012 Christian Persch
 #   Copyright (c) 2012 Paolo Borelli
@@ -69,7 +70,7 @@
 #   You should have received a copy of the GNU Lesser General Public License
 #   along with this program. If not, see <http://www.gnu.org/licenses/>.
 
-#serial 9
+#serial 16
 
 AC_DEFUN([AX_CODE_COVERAGE],[
 	dnl Check for --enable-code-coverage
@@ -141,18 +142,21 @@
 		dnl Build the code coverage flags
 		CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
 		CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+		CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
 		CODE_COVERAGE_LDFLAGS="-lgcov"
 
 		AC_SUBST([CODE_COVERAGE_CPPFLAGS])
 		AC_SUBST([CODE_COVERAGE_CFLAGS])
+		AC_SUBST([CODE_COVERAGE_CXXFLAGS])
 		AC_SUBST([CODE_COVERAGE_LDFLAGS])
 	])
 
-CODE_COVERAGE_RULES='
+[CODE_COVERAGE_RULES='
 # Code coverage
 #
 # Optional:
 #  - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
+#    Multiple directories may be specified, separated by whitespace.
 #    (Default: $(top_builddir))
 #  - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
 #    by lcov for code coverage. (Default:
@@ -160,13 +164,26 @@
 #  - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
 #    reports to be created. (Default:
 #    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
+#  - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
+#    set to 0 to disable it and leave empty to stay with the default.
+#    (Default: empty)
+#  - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
+#    instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
+#  - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
+#    instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
 #  - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
-#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the lcov instance.
-#    (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
-#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance.
-#    (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
+#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
+#    collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
+#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
+#    instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
+#  - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
+#    lcov instance. (Default: empty)
+#  - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
+#    instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
+#  - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
+#    genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
 #  - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
-#    instance. (Default: empty)
+#    instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
 #  - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
 #
 # The generated report will be titled using the $(PACKAGE_NAME) and
@@ -177,10 +194,19 @@
 CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
 CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
 CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
+CODE_COVERAGE_BRANCH_COVERAGE ?=
+CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
+--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
+CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
 CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
 CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
 CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
-CODE_COVERAGE_GENHTML_OPTIONS ?=
+CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
+CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
+CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
+$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
+--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
+CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
 CODE_COVERAGE_IGNORE_PATTERN ?=
 
 code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
@@ -198,6 +224,9 @@
 code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
 code_coverage_quiet_0 = --quiet
 
+# sanitizes the test-name: replaces with underscores: dashes and dots
+code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
+
 # Use recursive makes in order to ignore errors during check
 check-code-coverage:
 ifeq ($(CODE_COVERAGE_ENABLED),yes)
@@ -210,10 +239,10 @@
 # Capture code coverage data
 code-coverage-capture: code-coverage-capture-hook
 ifeq ($(CODE_COVERAGE_ENABLED),yes)
-	$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS)
-	$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_OPTIONS)
+	$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
+	$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
 	-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
-	$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
+	$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
 	@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
 else
 	@echo "Need to reconfigure with --enable-code-coverage"
@@ -224,20 +253,21 @@
 
 ifeq ($(CODE_COVERAGE_ENABLED),yes)
 clean: code-coverage-clean
+distclean: code-coverage-clean
 code-coverage-clean:
 	-$(LCOV) --directory $(top_builddir) -z
 	-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-	-find . -name "*.gcda" -o -name "*.gcov" -delete
+	-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
 endif
 
 GITIGNOREFILES ?=
 GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
 
-DISTCHECK_CONFIGURE_FLAGS ?=
-DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
+A''M_DISTCHECK_CONFIGURE_FLAGS ?=
+A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
 
 .PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
-'
+']
 
 	AC_SUBST([CODE_COVERAGE_RULES])
 	m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
diff --git a/maint/ioctls_sym.sh b/maint/ioctls_sym.sh
index c408b91..7fff303 100755
--- a/maint/ioctls_sym.sh
+++ b/maint/ioctls_sym.sh
@@ -239,26 +239,28 @@
 			;;
 		*linux/kvm.h)
 			cat <<'__EOF__'
-#if defined __x86_64__ || defined __i386__
+#if !(defined __powerpc__)
 struct kvm_allocate_rma { __u32 unused[2]; };
 struct kvm_create_spapr_tce { __u32 unused[3]; };
+struct kvm_create_spapr_tce_64 { __u32 unused[8]; };
 struct kvm_get_htab_fd { __u32 unused[8]; };
 struct kvm_rtas_token_args { __u8 unused[128]; };
+#endif
+
+#if !(defined __arm64__ || defined __arm__)
 struct kvm_vcpu_init { __u32 unused[8]; };
-#elif defined __arm64__ || defined __arm__
-struct kvm_allocate_rma { __u32 unused[2]; };
+#endif
+
+#if !(defined __x86_64__ || defined __i386__)
 struct kvm_cpuid { __u32 unused[2]; };
 struct kvm_cpuid2 { __u32 unused[2]; };
-struct kvm_create_spapr_tce { __u32 unused[3]; };
 struct kvm_debugregs { __u32 unused[32]; };
-struct kvm_get_htab_fd { __u32 unused[8]; };
 struct kvm_lapic_state { __u32 unused[256]; };
 struct kvm_memory_alias { __u32 unused[8]; };
 struct kvm_msr_list { __u32 unused[1]; };
 struct kvm_msrs { __u32 unused[2]; };
 struct kvm_pit_state { __u32 unused[18]; };
 struct kvm_pit_state2 { __u32 unused[28]; };
-struct kvm_rtas_token_args { __u32 unused[128]; };
 struct kvm_vcpu_events { __u32 unused[16]; };
 struct kvm_x86_mce { __u32 unused[16]; };
 struct kvm_xcrs { __u32 unused[98]; };
diff --git a/mem.c b/mem.c
index 53793e6..b2c7abb 100644
--- a/mem.c
+++ b/mem.c
@@ -65,13 +65,13 @@
 
 	printaddr(addr);
 	tprintf(", %lu, ", len);
-	printflags(mmap_prot, prot, "PROT_???");
+	printflags_long(mmap_prot, prot, "PROT_???");
 	tprints(", ");
 #ifdef MAP_TYPE
-	printxval(mmap_flags, flags & MAP_TYPE, "MAP_???");
+	printxval_long(mmap_flags, flags & MAP_TYPE, "MAP_???");
 	addflags(mmap_flags, flags & ~MAP_TYPE);
 #else
-	printflags(mmap_flags, flags, "MAP_???");
+	printflags_long(mmap_flags, flags, "MAP_???");
 #endif
 	tprints(", ");
 	printfd(tcp, fd);
@@ -86,37 +86,31 @@
  * Confused? Me too!
  */
 
+#if defined AARCH64 || defined ARM \
+ || defined I386 || defined X86_64 || defined X32 \
+ || defined M68K \
+ || defined S390 || defined S390X
 /* Params are pointed to by u_arg[0], offset is in bytes */
 SYS_FUNC(old_mmap)
 {
 	long u_arg[6];
-#if defined(IA64)
-	/*
-	 * IA64 processes never call this routine, they only use the
-	 * new 'sys_mmap' interface. Only IA32 processes come here.
-	 */
-	int i;
-	unsigned narrow_arg[6];
-	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
-		return 0;
+# if defined AARCH64 || defined X86_64
+	/* We are here only in a 32-bit personality. */
+	unsigned int narrow_arg[6];
+	if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg))
+		return RVAL_DECODED | RVAL_HEX;
+	unsigned int i;
 	for (i = 0; i < 6; i++)
-		u_arg[i] = (unsigned long) narrow_arg[i];
-#elif defined(X86_64)
-	/* We are here only in personality 1 (i386) */
-	int i;
-	unsigned narrow_arg[6];
-	if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
-		return 0;
-	for (i = 0; i < 6; ++i)
-		u_arg[i] = (unsigned long) narrow_arg[i];
-#else
-	if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), u_arg) == -1)
-		return 0;
-#endif
+		u_arg[i] = narrow_arg[i];
+# else
+	if (umove_or_printaddr(tcp, tcp->u_arg[0], &u_arg))
+		return RVAL_DECODED | RVAL_HEX;
+# endif
 	print_mmap(tcp, u_arg, (unsigned long) u_arg[5]);
 
 	return RVAL_DECODED | RVAL_HEX;
 }
+#endif /* old_mmap architectures */
 
 #if defined(S390)
 /* Params are pointed to by u_arg[0], offset is in pages */
@@ -191,7 +185,7 @@
 {
 	printaddr(tcp->u_arg[0]);
 	tprintf(", %lu, ", tcp->u_arg[1]);
-	printflags(mmap_prot, tcp->u_arg[2], "PROT_???");
+	printflags_long(mmap_prot, tcp->u_arg[2], "PROT_???");
 
 	return RVAL_DECODED;
 }
@@ -202,7 +196,7 @@
 {
 	printaddr(tcp->u_arg[0]);
 	tprintf(", %lu, %lu, ", tcp->u_arg[1], tcp->u_arg[2]);
-	printflags(mremap_flags, tcp->u_arg[3], "MREMAP_???");
+	printflags_long(mremap_flags, tcp->u_arg[3], "MREMAP_???");
 #ifdef MREMAP_FIXED
 	if ((tcp->u_arg[3] & (MREMAP_MAYMOVE | MREMAP_FIXED)) ==
 	    (MREMAP_MAYMOVE | MREMAP_FIXED)) {
@@ -309,240 +303,40 @@
 
 	printaddr(addr);
 	tprintf(", %lu, ", size);
-	printflags(mmap_prot, prot, "PROT_???");
+	printflags_long(mmap_prot, prot, "PROT_???");
 	tprintf(", %lu, ", pgoff);
 #ifdef MAP_TYPE
-	printxval(mmap_flags, flags & MAP_TYPE, "MAP_???");
+	printxval_long(mmap_flags, flags & MAP_TYPE, "MAP_???");
 	addflags(mmap_flags, flags & ~MAP_TYPE);
 #else
-	printflags(mmap_flags, flags, "MAP_???");
+	printflags_long(mmap_flags, flags, "MAP_???");
 #endif
 
 	return RVAL_DECODED;
 }
 
-#define MPOL_DEFAULT    0
-#define MPOL_PREFERRED  1
-#define MPOL_BIND       2
-#define MPOL_INTERLEAVE 3
-
-#define MPOL_F_NODE     (1<<0)
-#define MPOL_F_ADDR     (1<<1)
-
-#define MPOL_MF_STRICT  (1<<0)
-#define MPOL_MF_MOVE	(1<<1)
-#define MPOL_MF_MOVE_ALL (1<<2)
-
-#include "xlat/policies.h"
-#include "xlat/mbindflags.h"
-#include "xlat/mempolicyflags.h"
-#include "xlat/move_pages_flags.h"
-
-static void
-get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err)
-{
-	unsigned long nlongs, size, end;
-
-	nlongs = (maxnodes + 8 * sizeof(long) - 1) / (8 * sizeof(long));
-	size = nlongs * sizeof(long);
-	end = ptr + size;
-	if (nlongs == 0 || ((err || verbose(tcp)) && (size * 8 == maxnodes)
-			    && (end > ptr))) {
-		unsigned long n, cur, abbrev_end;
-		int failed = 0;
-
-		if (abbrev(tcp)) {
-			abbrev_end = ptr + max_strlen * sizeof(long);
-			if (abbrev_end < ptr)
-				abbrev_end = end;
-		} else {
-			abbrev_end = end;
-		}
-		tprints(", {");
-		for (cur = ptr; cur < end; cur += sizeof(long)) {
-			if (cur > ptr)
-				tprints(", ");
-			if (cur >= abbrev_end) {
-				tprints("...");
-				break;
-			}
-			if (umoven(tcp, cur, sizeof(n), &n) < 0) {
-				tprints("?");
-				failed = 1;
-				break;
-			}
-			tprintf("%#0*lx", (int) sizeof(long) * 2 + 2, n);
-		}
-		tprints("}");
-		if (failed) {
-			tprints(" ");
-			printaddr(ptr);
-		}
-	} else {
-		tprints(" ");
-		printaddr(ptr);
-	}
-	tprintf(", %lu", maxnodes);
-}
-
-SYS_FUNC(mbind)
-{
-	printaddr(tcp->u_arg[0]);
-	tprintf(", %lu, ", tcp->u_arg[1]);
-	printxval(policies, tcp->u_arg[2], "MPOL_???");
-	get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[4], 0);
-	tprints(", ");
-	printflags(mbindflags, tcp->u_arg[5], "MPOL_???");
-
-	return RVAL_DECODED;
-}
-
-SYS_FUNC(set_mempolicy)
-{
-	printxval(policies, tcp->u_arg[0], "MPOL_???");
-	get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], 0);
-
-	return RVAL_DECODED;
-}
-
-SYS_FUNC(get_mempolicy)
-{
-	if (exiting(tcp)) {
-		int pol;
-		if (!umove_or_printaddr(tcp, tcp->u_arg[0], &pol))
-			printxval(policies, pol, "MPOL_???");
-		get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], syserror(tcp));
-		tprints(", ");
-		printaddr(tcp->u_arg[3]);
-		tprints(", ");
-		printflags(mempolicyflags, tcp->u_arg[4], "MPOL_???");
-	}
-	return 0;
-}
-
-SYS_FUNC(migrate_pages)
-{
-	tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
-	get_nodes(tcp, tcp->u_arg[2], tcp->u_arg[1], 0);
-	tprints(", ");
-	get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[1], 0);
-
-	return RVAL_DECODED;
-}
-
-SYS_FUNC(move_pages)
-{
-	if (entering(tcp)) {
-		unsigned long npages = tcp->u_arg[1];
-		tprintf("%ld, %lu, ", tcp->u_arg[0], npages);
-		if (tcp->u_arg[2] == 0)
-			tprints("NULL, ");
-		else {
-			unsigned int i;
-			long puser = tcp->u_arg[2];
-			tprints("{");
-			for (i = 0; i < npages; ++i) {
-				void *p;
-				if (i > 0)
-					tprints(", ");
-				if (umove(tcp, puser, &p) < 0) {
-					tprints("???");
-					break;
-				}
-				tprintf("%p", p);
-				puser += sizeof(void *);
-			}
-			tprints("}, ");
-		}
-		if (tcp->u_arg[3] == 0)
-			tprints("NULL, ");
-		else {
-			unsigned int i;
-			long nodeuser = tcp->u_arg[3];
-			tprints("{");
-			for (i = 0; i < npages; ++i) {
-				int node;
-				if (i > 0)
-					tprints(", ");
-				if (umove(tcp, nodeuser, &node) < 0) {
-					tprints("???");
-					break;
-				}
-				tprintf("%#x", node);
-				nodeuser += sizeof(int);
-			}
-			tprints("}, ");
-		}
-	} else {
-		unsigned long npages = tcp->u_arg[1];
-		if (tcp->u_arg[4] == 0)
-			tprints("NULL, ");
-		else {
-			unsigned int i;
-			long statususer = tcp->u_arg[4];
-			tprints("{");
-			for (i = 0; i < npages; ++i) {
-				int status;
-				if (i > 0)
-					tprints(", ");
-				if (umove(tcp, statususer, &status) < 0) {
-					tprints("???");
-					break;
-				}
-				tprintf("%#x", status);
-				statususer += sizeof(int);
-			}
-			tprints("}, ");
-		}
-		printflags(move_pages_flags, tcp->u_arg[5], "MPOL_???");
-	}
-	return 0;
-}
-
 #if defined(POWERPC)
+static bool
+print_protmap_entry(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	tprintf("%#08x", * (unsigned int *) elem_buf);
+
+	return true;
+}
+
 SYS_FUNC(subpage_prot)
 {
-	unsigned long cur, end, abbrev_end, entries;
-	unsigned int entry;
+	unsigned long addr = tcp->u_arg[0];
+	unsigned long len = tcp->u_arg[1];
+	unsigned long nmemb = len >> 16;
+	unsigned long map = tcp->u_arg[2];
 
-	printaddr(tcp->u_arg[0]);
-	tprints(", ");
-	printaddr(tcp->u_arg[1]);
-	tprints(", ");
-	entries = tcp->u_arg[1] >> 16;
-	if (!entries || !tcp->u_arg[2]) {
-		tprints("{}");
-		return 0;
-	}
-	cur = tcp->u_arg[2];
-	end = cur + (sizeof(int) * entries);
-	if (!verbose(tcp) || end < (unsigned long) tcp->u_arg[2]) {
-		printaddr(tcp->u_arg[2]);
-		return 0;
-	}
-	if (abbrev(tcp)) {
-		abbrev_end = cur + (sizeof(int) * max_strlen);
-		if (abbrev_end > end)
-			abbrev_end = end;
-	}
-	else
-		abbrev_end = end;
-	tprints("{");
-	for (; cur < end; cur += sizeof(int)) {
-		if (cur > (unsigned long) tcp->u_arg[2])
-			tprints(", ");
-		if (cur >= abbrev_end) {
-			tprints("...");
-			break;
-		}
-		if (umove(tcp, cur, &entry) < 0) {
-			tprintf("??? [%#lx]", cur);
-			break;
-		}
-		else
-			tprintf("%#08x", entry);
-	}
-	tprints("}");
+	printaddr(addr);
+	tprintf(", %lu, ", len);
+
+	unsigned int entry;
+	print_array(tcp, map, nmemb, &entry, sizeof(entry),
+		    umoven_or_printaddr, print_protmap_entry, 0);
 
 	return RVAL_DECODED;
 }
diff --git a/membarrier.c b/membarrier.c
index 485c62a..3bc5764 100644
--- a/membarrier.c
+++ b/membarrier.c
@@ -43,6 +43,7 @@
 	if (syserror(tcp) || !tcp->u_rval)
 		return 0;
 
-	tcp->auxstr = sprintflags("", membarrier_cmds, tcp->u_rval);
+	tcp->auxstr = sprintflags("", membarrier_cmds,
+				  (unsigned long) tcp->u_rval);
 	return RVAL_HEX | RVAL_STR;
 }
diff --git a/mount.c b/mount.c
index 84e79d6..1ae445d 100644
--- a/mount.c
+++ b/mount.c
@@ -74,7 +74,7 @@
 			tprints("|");
 	}
 	if (flags || !old_magic)
-		printflags(mount_flags, flags, "MS_???");
+		printflags_long(mount_flags, flags, "MS_???");
 	tprints(", ");
 
 	if (ignore_data)
diff --git a/mpers_type.h b/mpers_type.h
index adbefd5..4ce569b 100644
--- a/mpers_type.h
+++ b/mpers_type.h
@@ -39,5 +39,9 @@
 #else
 # define MPERS_PREFIX
 # define DEF_MPERS_TYPE(args) "empty.h"
-# define MPERS_DEFS "native_defs.h"
+# if IN_MPERS_BOOTSTRAP
+#  define MPERS_DEFS "empty.h"
+# else
+#  define MPERS_DEFS "native_defs.h"
+# endif
 #endif
diff --git a/mpers_xlat.h b/mpers_xlat.h
new file mode 100644
index 0000000..266faec
--- /dev/null
+++ b/mpers_xlat.h
@@ -0,0 +1,77 @@
+extern const struct xlat blkpg_ops[];
+extern const struct xlat btrfs_balance_args[];
+extern const struct xlat btrfs_balance_ctl_cmds[];
+extern const struct xlat btrfs_balance_flags[];
+extern const struct xlat btrfs_balance_state[];
+extern const struct xlat btrfs_compress_types[];
+extern const struct xlat btrfs_defrag_flags[];
+extern const struct xlat btrfs_dev_replace_cmds[];
+extern const struct xlat btrfs_dev_replace_results[];
+extern const struct xlat btrfs_dev_replace_state[];
+extern const struct xlat btrfs_dev_stats_flags[];
+extern const struct xlat btrfs_dev_stats_values[];
+extern const struct xlat btrfs_features_compat[];
+extern const struct xlat btrfs_features_compat_ro[];
+extern const struct xlat btrfs_features_incompat[];
+extern const struct xlat btrfs_key_types[];
+extern const struct xlat btrfs_qgroup_ctl_cmds[];
+extern const struct xlat btrfs_qgroup_inherit_flags[];
+extern const struct xlat btrfs_qgroup_limit_flags[];
+extern const struct xlat btrfs_qgroup_status_flags[];
+extern const struct xlat btrfs_scrub_flags[];
+extern const struct xlat btrfs_send_flags[];
+extern const struct xlat btrfs_snap_flags_v2[];
+extern const struct xlat btrfs_space_info_flags[];
+extern const struct xlat btrfs_tree_objectids[];
+extern const struct xlat evdev_autorepeat[];
+extern const struct xlat evdev_ff_status[];
+extern const struct xlat evdev_ff_types[];
+extern const struct xlat evdev_keycode[];
+extern const struct xlat evdev_leds[];
+extern const struct xlat evdev_misc[];
+extern const struct xlat evdev_mtslots[];
+extern const struct xlat evdev_prop[];
+extern const struct xlat evdev_relative_axes[];
+extern const struct xlat evdev_snd[];
+extern const struct xlat evdev_switch[];
+extern const struct xlat evdev_sync[];
+extern const struct xlat msgctl_flags[];
+extern const struct xlat shmctl_flags[];
+extern const struct xlat mtd_mode_options[];
+extern const struct xlat mtd_file_mode_options[];
+extern const struct xlat mtd_type_options[];
+extern const struct xlat mtd_flags_options[];
+extern const struct xlat mtd_otp_options[];
+extern const struct xlat mtd_nandecc_options[];
+extern const struct xlat sigev_value[];
+extern const struct xlat adjtimex_modes[];
+extern const struct xlat adjtimex_status[];
+extern const struct xlat audit_arch[];
+extern const struct xlat sigbus_codes[];
+extern const struct xlat sigchld_codes[];
+extern const struct xlat sigfpe_codes[];
+extern const struct xlat sigill_codes[];
+extern const struct xlat siginfo_codes[];
+extern const struct xlat sigpoll_codes[];
+extern const struct xlat sigprof_codes[];
+extern const struct xlat sigsegv_codes[];
+extern const struct xlat sigsys_codes[];
+extern const struct xlat sigtrap_codes[];
+extern const struct xlat sigemt_codes[];
+extern const struct xlat sigaltstack_flags[];
+extern const struct xlat v4l2_device_capabilities_flags[];
+extern const struct xlat v4l2_buf_types[];
+extern const struct xlat v4l2_format_description_flags[];
+extern const struct xlat v4l2_fields[];
+extern const struct xlat v4l2_colorspaces[];
+extern const struct xlat v4l2_memories[];
+extern const struct xlat v4l2_buf_flags[];
+extern const struct xlat v4l2_streaming_capabilities[];
+extern const struct xlat v4l2_capture_modes[];
+extern const struct xlat v4l2_input_types[];
+extern const struct xlat v4l2_control_ids[];
+extern const struct xlat v4l2_control_types[];
+extern const struct xlat v4l2_control_flags[];
+extern const struct xlat v4l2_control_classes[];
+extern const struct xlat v4l2_framesize_types[];
+extern const struct xlat v4l2_frameinterval_types[];
diff --git a/mtd.c b/mtd.c
index 2502536..52714ae 100644
--- a/mtd.c
+++ b/mtd.c
@@ -26,6 +26,8 @@
 
 #include "defs.h"
 
+#include DEF_MPERS_TYPE(struct_mtd_oob_buf)
+
 #include <linux/ioctl.h>
 
 /* The mtd api changes quickly, so we have to keep a local copy */
@@ -35,11 +37,10 @@
 #else
 # include <mtd/mtd-abi.h>
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
-# include "ubi-user.h"
-#else
-# include <mtd/ubi-user.h>
-#endif
+
+typedef struct mtd_oob_buf struct_mtd_oob_buf;
+
+#include MPERS_DEFS
 
 #include "xlat/mtd_mode_options.h"
 #include "xlat/mtd_file_mode_options.h"
@@ -48,136 +49,242 @@
 #include "xlat/mtd_otp_options.h"
 #include "xlat/mtd_nandecc_options.h"
 
-int
-mtd_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+static void
+decode_erase_info_user(struct tcb *tcp, const long addr)
 {
-	if (!verbose(tcp))
-		return RVAL_DECODED;
+	struct erase_info_user einfo;
 
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &einfo))
+		return;
+
+	tprintf("{start=%#x, length=%#x}", einfo.start, einfo.length);
+}
+
+static void
+decode_erase_info_user64(struct tcb *tcp, const long addr)
+{
+	struct erase_info_user64 einfo64;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &einfo64))
+		return;
+
+	tprintf("{start=%#" PRIx64 ", length=%#" PRIx64 "}",
+		(uint64_t) einfo64.start, (uint64_t) einfo64.length);
+}
+
+static void
+decode_mtd_oob_buf(struct tcb *tcp, const long addr)
+{
+	struct_mtd_oob_buf mbuf;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &mbuf))
+		return;
+
+	tprintf("{start=%#x, length=%#x, ptr=%#lx}",
+		mbuf.start, mbuf.length, (unsigned long) mbuf.ptr);
+}
+
+static void
+decode_mtd_oob_buf64(struct tcb *tcp, const long addr)
+{
+	struct mtd_oob_buf64 mbuf64;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &mbuf64))
+		return;
+
+	tprintf("{start=%#" PRIx64 ", length=%#x, usr_ptr=%#" PRIx64 "}",
+		(uint64_t) mbuf64.start, mbuf64.length,
+		(uint64_t) mbuf64.usr_ptr);
+}
+
+static void
+decode_otp_info(struct tcb *tcp, const long addr)
+{
+	struct otp_info oinfo;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &oinfo))
+		return;
+
+	tprintf("{start=%#x, length=%#x, locked=%u}",
+		oinfo.start, oinfo.length, oinfo.locked);
+}
+
+static void
+decode_otp_select(struct tcb *tcp, const long addr)
+{
+	unsigned int i;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &i))
+		return;
+
+	tprints("[");
+	printxval(mtd_otp_options, i, "MTD_OTP_???");
+	tprints("]");
+}
+
+static void
+decode_mtd_write_req(struct tcb *tcp, const long addr)
+{
+	struct mtd_write_req mreq;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &mreq))
+		return;
+
+	tprintf("{start=%#" PRIx64 ", len=%#" PRIx64
+		", ooblen=%#" PRIx64 ", usr_data=%#" PRIx64
+		", usr_oob=%#" PRIx64 ", mode=",
+		(uint64_t) mreq.start, (uint64_t) mreq.len,
+		(uint64_t) mreq.ooblen, (uint64_t) mreq.usr_data,
+		(uint64_t) mreq.usr_oob);
+	printxval(mtd_mode_options, mreq.mode, "MTD_OPS_???");
+	tprints("}");
+}
+
+static void
+decode_mtd_info_user(struct tcb *tcp, const long addr)
+{
+	struct mtd_info_user minfo;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &minfo))
+		return;
+
+	tprints("{type=");
+	printxval(mtd_type_options, minfo.type, "MTD_???");
+	tprints(", flags=");
+	printflags(mtd_flags_options, minfo.flags, "MTD_???");
+	tprintf(", size=%#x, erasesize=%#x, writesize=%#x, oobsize=%#x"
+		", padding=%#" PRIx64 "}",
+		minfo.size, minfo.erasesize, minfo.writesize, minfo.oobsize,
+		(uint64_t) minfo.padding);
+}
+
+static void
+decode_nand_oobinfo(struct tcb *tcp, const long addr)
+{
+	struct nand_oobinfo ninfo;
+	unsigned int i, j;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &ninfo))
+		return;
+
+	tprints("{useecc=");
+	printxval(mtd_nandecc_options, ninfo.useecc, "MTD_NANDECC_???");
+	tprintf(", eccbytes=%#x", ninfo.eccbytes);
+
+	tprints(", oobfree={");
+	for (i = 0; i < ARRAY_SIZE(ninfo.oobfree); ++i) {
+		if (i)
+			tprints("}, ");
+		tprints("{");
+		for (j = 0; j < ARRAY_SIZE(ninfo.oobfree[0]); ++j) {
+			if (j)
+				tprints(", ");
+			tprintf("%#x", ninfo.oobfree[i][j]);
+		}
+	}
+
+	tprints("}}, eccpos={");
+	for (i = 0; i < ARRAY_SIZE(ninfo.eccpos); ++i) {
+		if (i)
+			tprints(", ");
+		tprintf("%#x", ninfo.eccpos[i]);
+	}
+
+	tprints("}");
+}
+
+static void
+decode_nand_ecclayout_user(struct tcb *tcp, const long addr)
+{
+	struct nand_ecclayout_user nlay;
+	unsigned int i;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &nlay))
+		return;
+
+	tprintf("{eccbytes=%#x, eccpos={", nlay.eccbytes);
+	for (i = 0; i < ARRAY_SIZE(nlay.eccpos); ++i) {
+		if (i)
+			tprints(", ");
+		tprintf("%#x", nlay.eccpos[i]);
+	}
+	tprintf("}, oobavail=%#x, oobfree={", nlay.oobavail);
+	for (i = 0; i < ARRAY_SIZE(nlay.oobfree); ++i) {
+		if (i)
+			tprints(", ");
+		tprintf("{offset=%#x, length=%#x}",
+			nlay.oobfree[i].offset, nlay.oobfree[i].length);
+	}
+	tprints("}");
+}
+
+static void
+decode_mtd_ecc_stats(struct tcb *tcp, const long addr)
+{
+	struct mtd_ecc_stats es;
+
+	tprints(", ");
+	if (umove_or_printaddr(tcp, addr, &es))
+		return;
+
+	tprintf("{corrected=%#x, failed=%#x, badblocks=%#x, bbtblocks=%#x}",
+		es.corrected, es.failed, es.badblocks, es.bbtblocks);
+}
+
+MPERS_PRINTER_DECL(int, mtd_ioctl, struct tcb *tcp,
+		   const unsigned int code, const long arg)
+{
 	switch (code) {
 	case MEMERASE:
 	case MEMLOCK:
 	case MEMUNLOCK:
-	case MEMISLOCKED: {
-		struct erase_info_user einfo;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &einfo))
-			break;
-
-		tprintf("{start=%#" PRIx32 ", length=%#" PRIx32 "}",
-			einfo.start, einfo.length);
+	case MEMISLOCKED:
+		decode_erase_info_user(tcp, arg);
 		break;
-	}
 
-	case MEMERASE64: {
-		struct erase_info_user64 einfo64;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &einfo64))
-			break;
-
-		tprintf("{start=%#" PRIx64 ", length=%#" PRIx64 "}",
-			(uint64_t) einfo64.start, (uint64_t) einfo64.length);
+	case MEMERASE64:
+		decode_erase_info_user64(tcp, arg);
 		break;
-	}
 
 	case MEMWRITEOOB:
-	case MEMREADOOB: {
-		struct mtd_oob_buf mbuf;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &mbuf))
-			break;
-
-		tprintf("{start=%#" PRIx32 ", length=%#" PRIx32 ", ptr=...}",
-			mbuf.start, mbuf.length);
+	case MEMREADOOB:
+		decode_mtd_oob_buf(tcp, arg);
 		break;
-	}
 
 	case MEMWRITEOOB64:
-	case MEMREADOOB64: {
-		struct mtd_oob_buf64 mbuf64;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &mbuf64))
-			break;
-
-		tprintf("{start=%#" PRIx64 ", length=%#" PRIx64 ", ptr=...}",
-			(uint64_t) mbuf64.start, (uint64_t) mbuf64.length);
+	case MEMREADOOB64:
+		decode_mtd_oob_buf64(tcp, arg);
 		break;
-	}
 
-	case MEMGETREGIONINFO: {
-		struct region_info_user rinfo;
-
-		if (entering(tcp)) {
-			tprints(", ");
-			if (umove_or_printaddr(tcp, arg, &rinfo))
-				break;
-			tprintf("{regionindex=%#x", rinfo.regionindex);
-			return 1;
-		} else {
-			if (syserror(tcp)) {
-				tprints("}");
-				break;
-			}
-			if (umove(tcp, arg, &rinfo) < 0) {
-				tprints(", ???}");
-				break;
-			}
-			tprintf(", offset=%#x, erasesize=%#x, numblocks=%#x}",
-				rinfo.offset, rinfo.erasesize, rinfo.numblocks);
-			break;
-		}
-	}
-
-	case OTPLOCK: {
-		struct otp_info oinfo;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &oinfo))
-			break;
-
-		tprintf("{start=%#" PRIx32 ", length=%#" PRIx32 ", locked=%" PRIu32 "}",
-			oinfo.start, oinfo.length, oinfo.locked);
+	case MEMWRITE:
+		decode_mtd_write_req(tcp, arg);
 		break;
-	}
 
-	case MEMWRITE: {
-		struct mtd_write_req mreq;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &mreq))
-			break;
-
-		tprintf("{start=%#" PRIx64 ", len=%#" PRIx64,
-			(uint64_t) mreq.start, (uint64_t) mreq.len);
-		tprintf(", ooblen=%#" PRIx64 ", usr_data=%#" PRIx64,
-			(uint64_t) mreq.ooblen, (uint64_t) mreq.usr_data);
-		tprintf(", usr_oob=%#" PRIx64 ", mode=",
-			(uint64_t) mreq.usr_oob);
-		printxval(mtd_mode_options, mreq.mode, "MTD_OPS_???");
-		tprints(", padding=...}");
+	case OTPGETREGIONINFO:
+		if (entering(tcp))
+			return 0;
+		/* fall through */
+	case OTPLOCK:
+		decode_otp_info(tcp, arg);
 		break;
-	}
 
-	case OTPSELECT: {
-		unsigned int i;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &i))
-			break;
-
-		tprints("[");
-		printxval(mtd_otp_options, i, "MTD_OTP_???");
-		tprints("]");
+	case OTPSELECT:
+		decode_otp_select(tcp, arg);
 		break;
-	}
 
 	case MTDFILEMODE:
 		tprints(", ");
-		printxval(mtd_file_mode_options, arg, "MTD_FILE_MODE_???");
+		printxval_long(mtd_file_mode_options, arg, "MTD_FILE_MODE_???");
 		break;
 
 	case MEMGETBADBLOCK:
@@ -186,133 +293,33 @@
 		printnum_int64(tcp, arg, "%" PRIu64);
 		break;
 
-	case MEMGETINFO: {
-		struct mtd_info_user minfo;
-
+	case MEMGETINFO:
 		if (entering(tcp))
 			return 0;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &minfo))
-			break;
-
-		tprints("{type=");
-		printxval(mtd_type_options, minfo.type, "MTD_???");
-		tprints(", flags=");
-		printflags(mtd_flags_options, minfo.flags, "MTD_???");
-		tprintf(", size=%#" PRIx32 ", erasesize=%#" PRIx32,
-			minfo.size, minfo.erasesize);
-		tprintf(", writesize=%#" PRIx32 ", oobsize=%#" PRIx32,
-			minfo.writesize, minfo.oobsize);
-		tprintf(", padding=%#" PRIx64 "}",
-			(uint64_t) minfo.padding);
+		decode_mtd_info_user(tcp, arg);
 		break;
-	}
 
-	case MEMGETOOBSEL: {
-		struct nand_oobinfo ninfo;
-		unsigned int i;
-
+	case MEMGETOOBSEL:
 		if (entering(tcp))
 			return 0;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &ninfo))
-			break;
-
-		tprints("{useecc=");
-		printxval(mtd_nandecc_options, ninfo.useecc, "MTD_NANDECC_???");
-		tprintf(", eccbytes=%#" PRIx32, ninfo.eccbytes);
-
-		tprints(", oobfree={");
-		for (i = 0; i < ARRAY_SIZE(ninfo.oobfree); ++i) {
-			unsigned int j;
-
-			if (i)
-				tprints("}, ");
-			tprints("{");
-			for (j = 0; j < ARRAY_SIZE(ninfo.oobfree[0]); ++j) {
-				if (j)
-					tprints(", ");
-				tprintf("%#" PRIx32, ninfo.oobfree[i][j]);
-			}
-		}
-
-		tprints("}}, eccpos={");
-		for (i = 0; i < ARRAY_SIZE(ninfo.eccpos); ++i) {
-			if (i)
-				tprints(", ");
-			tprintf("%#" PRIx32, ninfo.eccpos[i]);
-		}
-
-		tprints("}");
+		decode_nand_oobinfo(tcp, arg);
 		break;
-	}
 
-	case OTPGETREGIONINFO: {
-		struct otp_info oinfo;
-
+	case ECCGETLAYOUT:
 		if (entering(tcp))
 			return 0;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &oinfo))
-			break;
-
-		tprintf("{start=%#" PRIx32 ", length=%#" PRIx32 ", locked=%" PRIu32 "}",
-			oinfo.start, oinfo.length, oinfo.locked);
+		decode_nand_ecclayout_user(tcp, arg);
 		break;
-	}
 
-	case ECCGETLAYOUT: {
-		struct nand_ecclayout_user nlay;
-		unsigned int i;
-
+	case ECCGETSTATS:
 		if (entering(tcp))
 			return 0;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &nlay))
-			break;
-
-		tprintf("{eccbytes=%#" PRIx32 ", eccpos={", nlay.eccbytes);
-		for (i = 0; i < ARRAY_SIZE(nlay.eccpos); ++i) {
-			if (i)
-				tprints(", ");
-			tprintf("%#" PRIx32, nlay.eccpos[i]);
-		}
-		tprintf("}, oobavail=%#" PRIx32 ", oobfree={", nlay.oobavail);
-		for (i = 0; i < ARRAY_SIZE(nlay.oobfree); ++i) {
-			if (i)
-				tprints(", ");
-			tprintf("{offset=%#" PRIx32 ", length=%#" PRIx32 "}",
-				nlay.oobfree[i].offset, nlay.oobfree[i].length);
-		}
-		tprints("}");
+		decode_mtd_ecc_stats(tcp, arg);
 		break;
-	}
-
-	case ECCGETSTATS: {
-		struct mtd_ecc_stats estat;
-
-		if (entering(tcp))
-			return 0;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &estat))
-			break;
-
-		tprintf("{corrected=%#" PRIx32 ", failed=%#" PRIx32,
-			estat.corrected, estat.failed);
-		tprintf(", badblocks=%#" PRIx32 ", bbtblocks=%#" PRIx32 "}",
-			estat.badblocks, estat.bbtblocks);
-		break;
-	}
 
 	case OTPGETREGIONCOUNT:
 		if (entering(tcp))
 			return 0;
-
 		tprints(", ");
 		printnum_int(tcp, arg, "%u");
 		break;
@@ -320,173 +327,32 @@
 	case MEMGETREGIONCOUNT:
 		if (entering(tcp))
 			return 0;
-
 		tprints(", ");
 		printnum_int(tcp, arg, "%d");
 		break;
 
-	default:
-		return RVAL_DECODED;
-	}
-
-	return RVAL_DECODED | 1;
-}
-
-#include "xlat/ubi_volume_types.h"
-#include "xlat/ubi_volume_props.h"
-
-int
-ubi_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
-{
-	if (!verbose(tcp))
-		return RVAL_DECODED;
-
-	switch (code) {
-	case UBI_IOCMKVOL:
+	case MEMGETREGIONINFO:
 		if (entering(tcp)) {
-			struct ubi_mkvol_req mkvol;
+			struct region_info_user rinfo;
 
 			tprints(", ");
-			if (umove_or_printaddr(tcp, arg, &mkvol))
+			if (umove_or_printaddr(tcp, arg, &rinfo))
 				break;
+			tprintf("{regionindex=%#x", rinfo.regionindex);
+			return 0;
+		} else {
+			struct region_info_user rinfo;
 
-			tprintf("{vol_id=%" PRIi32 ", alignment=%" PRIi32
-				", bytes=%" PRIi64 ", vol_type=", mkvol.vol_id,
-				mkvol.alignment, (int64_t)mkvol.bytes);
-			printxval(ubi_volume_types, mkvol.vol_type, "UBI_???_VOLUME");
-			tprintf(", name_len=%" PRIi16 ", name=", mkvol.name_len);
-			if (print_quoted_string(mkvol.name,
-					CLAMP(mkvol.name_len, 0, UBI_MAX_VOLUME_NAME),
-					QUOTE_0_TERMINATED) > 0) {
-				tprints("...");
-			}
+			if (!syserror(tcp) && !umove(tcp, arg, &rinfo))
+				tprintf(", offset=%#x"
+					", erasesize=%#x"
+					", numblocks=%#x}",
+					rinfo.offset,
+					rinfo.erasesize,
+					rinfo.numblocks);
 			tprints("}");
-			return 1;
-		}
-		if (!syserror(tcp)) {
-			tprints(" => ");
-			printnum_int(tcp, arg, "%d");
-		}
-		break;
-
-	case UBI_IOCRSVOL: {
-		struct ubi_rsvol_req rsvol;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &rsvol))
 			break;
-
-		tprintf("{vol_id=%" PRIi32 ", bytes=%" PRIi64 "}",
-			rsvol.vol_id, (int64_t)rsvol.bytes);
-		break;
-	}
-
-	case UBI_IOCRNVOL: {
-		struct ubi_rnvol_req rnvol;
-		int c;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &rnvol))
-			break;
-
-		tprintf("{count=%" PRIi32 ", ents=[", rnvol.count);
-		for (c = 0; c < CLAMP(rnvol.count, 0, UBI_MAX_RNVOL); ++c) {
-			if (c)
-				tprints(", ");
-			tprintf("{vol_id=%" PRIi32 ", name_len=%" PRIi16
-				", name=", rnvol.ents[c].vol_id,
-				rnvol.ents[c].name_len);
-			if (print_quoted_string(rnvol.ents[c].name,
-					CLAMP(rnvol.ents[c].name_len, 0, UBI_MAX_VOLUME_NAME),
-					QUOTE_0_TERMINATED) > 0) {
-				tprints("...");
-			}
-			tprints("}");
 		}
-		tprints("]}");
-		break;
-	}
-
-	case UBI_IOCEBCH: {
-		struct ubi_leb_change_req leb;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &leb))
-			break;
-
-		tprintf("{lnum=%d, bytes=%d}", leb.lnum, leb.bytes);
-		break;
-	}
-
-	case UBI_IOCATT:
-		if (entering(tcp)) {
-			struct ubi_attach_req attach;
-
-			tprints(", ");
-			if (umove_or_printaddr(tcp, arg, &attach))
-				break;
-
-			tprintf("{ubi_num=%" PRIi32 ", mtd_num=%" PRIi32
-				", vid_hdr_offset=%" PRIi32
-				", max_beb_per1024=%" PRIi16 "}",
-				attach.ubi_num, attach.mtd_num,
-				attach.vid_hdr_offset, attach.max_beb_per1024);
-			return 1;
-		}
-		if (!syserror(tcp)) {
-			tprints(" => ");
-			printnum_int(tcp, arg, "%d");
-		}
-		break;
-
-	case UBI_IOCEBMAP: {
-		struct ubi_map_req map;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &map))
-			break;
-
-		tprintf("{lnum=%" PRIi32 ", dtype=%" PRIi8 "}",
-			map.lnum, map.dtype);
-		break;
-	}
-
-	case UBI_IOCSETVOLPROP: {
-		struct ubi_set_vol_prop_req prop;
-
-		tprints(", ");
-		if (umove_or_printaddr(tcp, arg, &prop))
-			break;
-
-		tprints("{property=");
-		printxval(ubi_volume_props, prop.property, "UBI_VOL_PROP_???");
-		tprintf(", value=%#" PRIx64 "}", (uint64_t)prop.value);
-		break;
-	}
-
-
-	case UBI_IOCVOLUP:
-		tprints(", ");
-		printnum_int64(tcp, arg, "%" PRIi64);
-		break;
-
-	case UBI_IOCDET:
-	case UBI_IOCEBER:
-	case UBI_IOCEBISMAP:
-	case UBI_IOCEBUNMAP:
-	case UBI_IOCRMVOL:
-		tprints(", ");
-		printnum_int(tcp, arg, "%d");
-		break;
-
-#ifdef UBI_IOCVOLCRBLK
-	case UBI_IOCVOLCRBLK:
-#endif
-#ifdef UBI_IOCVOLRMBLK
-	case UBI_IOCVOLRMBLK:
-#endif
-		/* no arguments */
-		break;
 
 	default:
 		return RVAL_DECODED;
diff --git a/mx32_funcs.h b/mx32_funcs.h
new file mode 100644
index 0000000..9cea9ad
--- /dev/null
+++ b/mx32_funcs.h
@@ -0,0 +1,19 @@
+#undef sys_readdir
+#define sys_readdir mx32_sys_readdir
+#undef sys_getdents
+#define sys_getdents mx32_sys_getdents
+#undef sys_msgctl
+#define sys_msgctl mx32_sys_msgctl
+#undef sys_shmctl
+#define sys_shmctl mx32_sys_shmctl
+#undef sys_time
+#define sys_time mx32_sys_time
+#undef sys_sigaltstack
+#define sys_sigaltstack mx32_sys_sigaltstack
+#undef sys_sysinfo
+#define sys_sysinfo mx32_sys_sysinfo
+#undef sys_times
+#define sys_times mx32_sys_times
+#undef sys_utime
+#define sys_utime mx32_sys_utime
+#include "sys_func.h"
diff --git a/mx32_printer_decls.h b/mx32_printer_decls.h
new file mode 100644
index 0000000..cb6409f
--- /dev/null
+++ b/mx32_printer_decls.h
@@ -0,0 +1,28 @@
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
+extern int mx32_block_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int mx32_btrfs_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int mx32_evdev_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern _Bool mx32_fetch_seccomp_fprog(struct tcb *tcp, const long addr, void *p);
+extern _Bool mx32_fetch_struct_flock(struct tcb *tcp, const long addr, void *p);
+extern _Bool mx32_fetch_struct_flock64(struct tcb *tcp, const long addr, void *p);
+extern _Bool mx32_fetch_struct_statfs(struct tcb *tcp, const long addr, struct strace_statfs *p);
+extern _Bool mx32_fetch_struct_statfs64(struct tcb *tcp, const long addr, const unsigned long size, struct strace_statfs *p);
+extern int mx32_hdio_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int mx32_mtd_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern void mx32_printmqattr(struct tcb *tcp, const long addr);
+extern void mx32_tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count);
+extern void mx32_print_sigevent(struct tcb *tcp, const long addr);
+extern void mx32_print_timespec(struct tcb *tcp, const long addr);
+extern const char * mx32_sprint_timespec(struct tcb *tcp, const long addr);
+extern void mx32_print_timespec_utime_pair(struct tcb *tcp, const long addr);
+extern void mx32_print_itimerspec(struct tcb *tcp, const long addr);
+extern void mx32_print_timeval(struct tcb *tcp, const long addr);
+extern void mx32_print_timeval_pair(struct tcb *tcp, const long addr);
+extern const char * mx32_sprint_timeval(struct tcb *tcp, const long addr);
+extern void mx32_print_itimerval(struct tcb *tcp, const long addr);
+extern int mx32_print_timex(struct tcb *tcp, const long addr);
+extern void mx32_printrusage(struct tcb *tcp, long addr);
+extern void mx32_printsiginfo_at(struct tcb *tcp, long addr);
+extern void mx32_print_siginfo_array(struct tcb *tcp, unsigned long addr, unsigned long len);
+extern int mx32_rtc_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int mx32_v4l2_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
diff --git a/mx32_printer_defs.h b/mx32_printer_defs.h
new file mode 100644
index 0000000..07228ed
--- /dev/null
+++ b/mx32_printer_defs.h
@@ -0,0 +1,28 @@
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
+.block_ioctl = mx32_block_ioctl,
+.btrfs_ioctl = mx32_btrfs_ioctl,
+.evdev_ioctl = mx32_evdev_ioctl,
+.fetch_seccomp_fprog = mx32_fetch_seccomp_fprog,
+.fetch_struct_flock = mx32_fetch_struct_flock,
+.fetch_struct_flock64 = mx32_fetch_struct_flock64,
+.fetch_struct_statfs = mx32_fetch_struct_statfs,
+.fetch_struct_statfs64 = mx32_fetch_struct_statfs64,
+.hdio_ioctl = mx32_hdio_ioctl,
+.mtd_ioctl = mx32_mtd_ioctl,
+.printmqattr = mx32_printmqattr,
+.tprint_msgbuf = mx32_tprint_msgbuf,
+.print_sigevent = mx32_print_sigevent,
+.print_timespec = mx32_print_timespec,
+.sprint_timespec = mx32_sprint_timespec,
+.print_timespec_utime_pair = mx32_print_timespec_utime_pair,
+.print_itimerspec = mx32_print_itimerspec,
+.print_timeval = mx32_print_timeval,
+.print_timeval_pair = mx32_print_timeval_pair,
+.sprint_timeval = mx32_sprint_timeval,
+.print_itimerval = mx32_print_itimerval,
+.print_timex = mx32_print_timex,
+.printrusage = mx32_printrusage,
+.printsiginfo_at = mx32_printsiginfo_at,
+.print_siginfo_array = mx32_print_siginfo_array,
+.rtc_ioctl = mx32_rtc_ioctl,
+.v4l2_ioctl = mx32_v4l2_ioctl,
diff --git a/mx32_type_defs.h b/mx32_type_defs.h
new file mode 100644
index 0000000..088219f
--- /dev/null
+++ b/mx32_type_defs.h
@@ -0,0 +1,121 @@
+#ifdef MPERS_mx32_struct_blk_user_trace_setup
+# define struct_blk_user_trace_setup MPERS_mx32_struct_blk_user_trace_setup
+#endif
+#ifdef MPERS_mx32_struct_blkpg_ioctl_arg
+# define struct_blkpg_ioctl_arg MPERS_mx32_struct_blkpg_ioctl_arg
+#endif
+#ifdef MPERS_mx32_struct_blkpg_partition
+# define struct_blkpg_partition MPERS_mx32_struct_blkpg_partition
+#endif
+#ifdef MPERS_mx32_struct_btrfs_ioctl_dev_replace_args
+# define struct_btrfs_ioctl_dev_replace_args MPERS_mx32_struct_btrfs_ioctl_dev_replace_args
+#endif
+#ifdef MPERS_mx32_struct_btrfs_ioctl_send_args
+# define struct_btrfs_ioctl_send_args MPERS_mx32_struct_btrfs_ioctl_send_args
+#endif
+#ifdef MPERS_mx32_struct_btrfs_ioctl_received_subvol_args
+# define struct_btrfs_ioctl_received_subvol_args MPERS_mx32_struct_btrfs_ioctl_received_subvol_args
+#endif
+#ifdef MPERS_mx32_kernel_dirent
+# define kernel_dirent MPERS_mx32_kernel_dirent
+#endif
+#ifdef MPERS_mx32_struct_ff_effect
+# define struct_ff_effect MPERS_mx32_struct_ff_effect
+#endif
+#ifdef MPERS_mx32_seccomp_fprog_t
+# define seccomp_fprog_t MPERS_mx32_seccomp_fprog_t
+#endif
+#ifdef MPERS_mx32_struct_flock
+# define struct_flock MPERS_mx32_struct_flock
+#endif
+#ifdef MPERS_mx32_struct_flock64
+# define struct_flock64 MPERS_mx32_struct_flock64
+#endif
+#ifdef MPERS_mx32_struct_statfs
+# define struct_statfs MPERS_mx32_struct_statfs
+#endif
+#ifdef MPERS_mx32_struct_statfs64
+# define struct_statfs64 MPERS_mx32_struct_statfs64
+#endif
+#ifdef MPERS_mx32_struct_hd_geometry
+# define struct_hd_geometry MPERS_mx32_struct_hd_geometry
+#endif
+#ifdef MPERS_mx32_msqid_ds_t
+# define msqid_ds_t MPERS_mx32_msqid_ds_t
+#endif
+#ifdef MPERS_mx32_shmid_ds_t
+# define shmid_ds_t MPERS_mx32_shmid_ds_t
+#endif
+#ifdef MPERS_mx32_struct_mtd_oob_buf
+# define struct_mtd_oob_buf MPERS_mx32_struct_mtd_oob_buf
+#endif
+#ifdef MPERS_mx32_mq_attr_t
+# define mq_attr_t MPERS_mx32_mq_attr_t
+#endif
+#ifdef MPERS_mx32_msgbuf_t
+# define msgbuf_t MPERS_mx32_msgbuf_t
+#endif
+#ifdef MPERS_mx32_struct_sigevent
+# define struct_sigevent MPERS_mx32_struct_sigevent
+#endif
+#ifdef MPERS_mx32_time_t
+# define time_t MPERS_mx32_time_t
+#endif
+#ifdef MPERS_mx32_timespec_t
+# define timespec_t MPERS_mx32_timespec_t
+#endif
+#ifdef MPERS_mx32_timeval_t
+# define timeval_t MPERS_mx32_timeval_t
+#endif
+#ifdef MPERS_mx32_struct_timex
+# define struct_timex MPERS_mx32_struct_timex
+#endif
+#ifdef MPERS_mx32_rusage_t
+# define rusage_t MPERS_mx32_rusage_t
+#endif
+#ifdef MPERS_mx32_siginfo_t
+# define siginfo_t MPERS_mx32_siginfo_t
+#endif
+#ifdef MPERS_mx32_struct_rtc_pll_info
+# define struct_rtc_pll_info MPERS_mx32_struct_rtc_pll_info
+#endif
+#ifdef MPERS_mx32_stack_t
+# define stack_t MPERS_mx32_stack_t
+#endif
+#ifdef MPERS_mx32_sysinfo_t
+# define sysinfo_t MPERS_mx32_sysinfo_t
+#endif
+#ifdef MPERS_mx32_tms_t
+# define tms_t MPERS_mx32_tms_t
+#endif
+#ifdef MPERS_mx32_utimbuf_t
+# define utimbuf_t MPERS_mx32_utimbuf_t
+#endif
+#ifdef MPERS_mx32_struct_v4l2_buffer
+# define struct_v4l2_buffer MPERS_mx32_struct_v4l2_buffer
+#endif
+#ifdef MPERS_mx32_struct_v4l2_create_buffers
+# define struct_v4l2_create_buffers MPERS_mx32_struct_v4l2_create_buffers
+#endif
+#ifdef MPERS_mx32_struct_v4l2_ext_control
+# define struct_v4l2_ext_control MPERS_mx32_struct_v4l2_ext_control
+#endif
+#ifdef MPERS_mx32_struct_v4l2_ext_controls
+# define struct_v4l2_ext_controls MPERS_mx32_struct_v4l2_ext_controls
+#endif
+#ifdef MPERS_mx32_struct_v4l2_format
+# define struct_v4l2_format MPERS_mx32_struct_v4l2_format
+#endif
+#ifdef MPERS_mx32_struct_v4l2_framebuffer
+# define struct_v4l2_framebuffer MPERS_mx32_struct_v4l2_framebuffer
+#endif
+#ifdef MPERS_mx32_struct_v4l2_input
+# define struct_v4l2_input MPERS_mx32_struct_v4l2_input
+#endif
+#ifdef MPERS_mx32_struct_v4l2_standard
+# define struct_v4l2_standard MPERS_mx32_struct_v4l2_standard
+#endif
+#undef MPERS_PRINTER_NAME
+#define MPERS_PRINTER_NAME(printer_name) printer_name
+#include "mx32_printer_decls.h"
+#include MPERS_mx32_IOCTL_MACROS
diff --git a/native_printer_decls.h b/native_printer_decls.h
index a1c60f9..e9cbe3e 100644
--- a/native_printer_decls.h
+++ b/native_printer_decls.h
@@ -1,7 +1,14 @@
-/* Generated by Makefile from dirent.c fetch_seccomp_fprog.c fetch_struct_flock.c ipc_msgctl.c ipc_shmctl.c print_mq_attr.c print_msgbuf.c print_sigevent.c print_time.c print_timex.c printrusage.c printsiginfo.c sigaltstack.c sysinfo.c times.c utime.c; do not edit. */
-extern bool fetch_seccomp_fprog(struct tcb *tcp, const long addr, void *p);
-extern bool fetch_struct_flock(struct tcb *tcp, const long addr, void *p);
-extern bool fetch_struct_flock64(struct tcb *tcp, const long addr, void *p);
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
+extern int block_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int btrfs_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int evdev_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern _Bool fetch_seccomp_fprog(struct tcb *tcp, const long addr, void *p);
+extern _Bool fetch_struct_flock(struct tcb *tcp, const long addr, void *p);
+extern _Bool fetch_struct_flock64(struct tcb *tcp, const long addr, void *p);
+extern _Bool fetch_struct_statfs(struct tcb *tcp, const long addr, struct strace_statfs *p);
+extern _Bool fetch_struct_statfs64(struct tcb *tcp, const long addr, const unsigned long size, struct strace_statfs *p);
+extern int hdio_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int mtd_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
 extern void printmqattr(struct tcb *tcp, const long addr);
 extern void tprint_msgbuf(struct tcb *tcp, const long addr, const unsigned long count);
 extern void print_sigevent(struct tcb *tcp, const long addr);
@@ -16,3 +23,6 @@
 extern int print_timex(struct tcb *tcp, const long addr);
 extern void printrusage(struct tcb *tcp, long addr);
 extern void printsiginfo_at(struct tcb *tcp, long addr);
+extern void print_siginfo_array(struct tcb *tcp, unsigned long addr, unsigned long len);
+extern int rtc_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
+extern int v4l2_ioctl(struct tcb *tcp, const unsigned int code, const long arg);
diff --git a/native_printer_defs.h b/native_printer_defs.h
index 285bb44..69b58a8 100644
--- a/native_printer_defs.h
+++ b/native_printer_defs.h
@@ -1,7 +1,14 @@
-/* Generated by Makefile from dirent.c fetch_seccomp_fprog.c fetch_struct_flock.c ipc_msgctl.c ipc_shmctl.c print_mq_attr.c print_msgbuf.c print_sigevent.c print_time.c print_timex.c printrusage.c printsiginfo.c sigaltstack.c sysinfo.c times.c utime.c; do not edit. */
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
+.block_ioctl = block_ioctl,
+.btrfs_ioctl = btrfs_ioctl,
+.evdev_ioctl = evdev_ioctl,
 .fetch_seccomp_fprog = fetch_seccomp_fprog,
 .fetch_struct_flock = fetch_struct_flock,
 .fetch_struct_flock64 = fetch_struct_flock64,
+.fetch_struct_statfs = fetch_struct_statfs,
+.fetch_struct_statfs64 = fetch_struct_statfs64,
+.hdio_ioctl = hdio_ioctl,
+.mtd_ioctl = mtd_ioctl,
 .printmqattr = printmqattr,
 .tprint_msgbuf = tprint_msgbuf,
 .print_sigevent = print_sigevent,
@@ -16,3 +23,6 @@
 .print_timex = print_timex,
 .printrusage = printrusage,
 .printsiginfo_at = printsiginfo_at,
+.print_siginfo_array = print_siginfo_array,
+.rtc_ioctl = rtc_ioctl,
+.v4l2_ioctl = v4l2_ioctl,
diff --git a/net.c b/net.c
index f6d8c7d..3349758 100644
--- a/net.c
+++ b/net.c
@@ -770,7 +770,7 @@
  * other bits are socket type flags.
  */
 static void
-tprint_sock_type(int flags)
+tprint_sock_type(unsigned int flags)
 {
 	const char *str = xlookup(socktypes, flags & SOCK_TYPE_MASK);
 
@@ -1249,16 +1249,20 @@
 # include "xlat/icmpfilterflags.h"
 
 static void
-print_icmp_filter(struct tcb *tcp, long addr, int len)
+print_icmp_filter(struct tcb *tcp, const long addr, int len)
 {
-	struct icmp_filter	filter;
+	struct icmp_filter filter = {};
 
-	if (len != sizeof(filter) ||
-	    umove(tcp, addr, &filter) < 0) {
+	if (len > (int) sizeof(filter))
+		len = sizeof(filter);
+	else if (len <= 0) {
 		printaddr(addr);
 		return;
 	}
 
+	if (umoven_or_printaddr(tcp, addr, len, &filter))
+		return;
+
 	tprints("~(");
 	printflags(icmpfilterflags, ~filter.data, "ICMP_???");
 	tprints(")");
diff --git a/numa.c b/numa.c
new file mode 100644
index 0000000..b46fc7f
--- /dev/null
+++ b/numa.c
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2003-2007 Ulrich Drepper <drepper@redhat.com>
+ * Copyright (c) 2005-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+static bool
+print_node(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	if (elem_size < sizeof(long)) {
+		tprintf("%#0*x", (int) elem_size * 2 + 2,
+			* (unsigned int *) elem_buf);
+	} else {
+		tprintf("%#0*lx", (int) elem_size * 2 + 2,
+			* (unsigned long *) elem_buf);
+	}
+
+	return true;
+}
+
+static void
+print_nodemask(struct tcb *tcp, unsigned long addr, unsigned long maxnodes)
+{
+	const unsigned long nmemb =
+		(maxnodes + 8 * current_wordsize - 2) / (8 * current_wordsize);
+
+	if (nmemb < maxnodes / (8 * current_wordsize) ||
+	    (maxnodes && !nmemb)) {
+		printaddr(addr);
+		return;
+	}
+
+	unsigned long buf;
+	print_array(tcp, addr, nmemb, &buf, current_wordsize,
+		    umoven_or_printaddr, print_node, 0);
+}
+
+SYS_FUNC(migrate_pages)
+{
+	tprintf("%d, %lu, ", (int) tcp->u_arg[0], tcp->u_arg[1]);
+	print_nodemask(tcp, tcp->u_arg[2], tcp->u_arg[1]);
+	tprints(", ");
+	print_nodemask(tcp, tcp->u_arg[3], tcp->u_arg[1]);
+
+	return RVAL_DECODED;
+}
+
+#include "xlat/policies.h"
+#include "xlat/mbindflags.h"
+
+SYS_FUNC(mbind)
+{
+	printaddr(tcp->u_arg[0]);
+	tprintf(", %lu, ", tcp->u_arg[1]);
+	printxval_long(policies, tcp->u_arg[2], "MPOL_???");
+	tprints(", ");
+	print_nodemask(tcp, tcp->u_arg[3], tcp->u_arg[4]);
+	tprintf(", %lu, ", tcp->u_arg[4]);
+	printflags(mbindflags, tcp->u_arg[5], "MPOL_???");
+
+	return RVAL_DECODED;
+}
+
+SYS_FUNC(set_mempolicy)
+{
+	printxval(policies, tcp->u_arg[0], "MPOL_???");
+	tprints(", ");
+	print_nodemask(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+	tprintf(", %lu", tcp->u_arg[2]);
+
+	return RVAL_DECODED;
+}
+
+#include "xlat/mempolicyflags.h"
+
+SYS_FUNC(get_mempolicy)
+{
+	if (exiting(tcp)) {
+		int pol;
+		if (!umove_or_printaddr(tcp, tcp->u_arg[0], &pol)) {
+			tprints("[");
+			printxval(policies, pol, "MPOL_???");
+			tprints("]");
+		}
+		tprints(", ");
+		print_nodemask(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+		tprintf(", %lu, ", tcp->u_arg[2]);
+		printaddr(tcp->u_arg[3]);
+		tprints(", ");
+		printflags_long(mempolicyflags, tcp->u_arg[4], "MPOL_???");
+	}
+	return 0;
+}
+
+#include "xlat/move_pages_flags.h"
+
+static bool
+print_addr(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	unsigned long addr;
+
+	if (elem_size < sizeof(long)) {
+		addr = * (unsigned int *) elem_buf;
+	} else {
+		addr = * (unsigned long *) elem_buf;
+	}
+
+	printaddr(addr);
+
+	return true;
+}
+
+static bool
+print_status(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	const int status = * (int *) elem_buf;
+
+	if (status < 0 && (unsigned) -status < nerrnos)
+		tprintf("%s", errnoent[-status]);
+	else
+		tprintf("%d", status);
+
+	return true;
+}
+
+static bool
+print_int(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	tprintf("%d", * (int *) elem_buf);
+
+	return true;
+}
+
+SYS_FUNC(move_pages)
+{
+	const unsigned long npages = tcp->u_arg[1];
+	long buf;
+
+	if (entering(tcp)) {
+		tprintf("%d, %lu, ", (int) tcp->u_arg[0], npages);
+		print_array(tcp, tcp->u_arg[2], npages, &buf, current_wordsize,
+			    umoven_or_printaddr, print_addr, 0);
+		tprints(", ");
+		print_array(tcp, tcp->u_arg[3], npages, &buf, sizeof(int),
+			    umoven_or_printaddr, print_int, 0);
+		tprints(", ");
+	} else {
+		print_array(tcp, tcp->u_arg[4], npages, &buf, sizeof(int),
+			    umoven_or_printaddr, print_status, 0);
+		tprints(", ");
+		printflags(move_pages_flags, tcp->u_arg[5], "MPOL_???");
+	}
+	return 0;
+}
diff --git a/open.c b/open.c
index 9bd1b95..90dd10f 100644
--- a/open.c
+++ b/open.c
@@ -73,7 +73,7 @@
  * other bits are real flags.
  */
 const char *
-sprint_open_modes(int flags)
+sprint_open_modes(unsigned int flags)
 {
 	static char outstr[(1 + ARRAY_SIZE(open_mode_flags)) * sizeof("O_LARGEFILE")];
 	char *p;
@@ -110,7 +110,7 @@
 }
 
 void
-tprint_open_modes(int flags)
+tprint_open_modes(unsigned int flags)
 {
 	tprints(sprint_open_modes(flags) + sizeof("flags"));
 }
diff --git a/or1k_atomic.c b/or1k_atomic.c
index a5755c6..54d3a0d 100644
--- a/or1k_atomic.c
+++ b/or1k_atomic.c
@@ -44,7 +44,7 @@
 
 SYS_FUNC(or1k_atomic)
 {
-	printxval(atomic_ops, tcp->u_arg[0], "???");
+	printxval_long(atomic_ops, tcp->u_arg[0], "???");
 	switch(tcp->u_arg[0]) {
 	case OR1K_ATOMIC_SWAP:
 		tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
diff --git a/perf.c b/perf.c
index f91b9d3..8ab58a0 100644
--- a/perf.c
+++ b/perf.c
@@ -41,7 +41,7 @@
 		(int) tcp->u_arg[1],
 		(int) tcp->u_arg[2],
 		(int) tcp->u_arg[3]);
-	printflags(perf_event_open_flags, tcp->u_arg[4], "PERF_FLAG_???");
+	printflags_long(perf_event_open_flags, tcp->u_arg[4], "PERF_FLAG_???");
 
 	return RVAL_DECODED | RVAL_FD;
 }
diff --git a/poll.c b/poll.c
index f72c985..b66c46d 100644
--- a/poll.c
+++ b/poll.c
@@ -31,65 +31,32 @@
 
 #include "xlat/pollflags.h"
 
-static void
-print_pollfd(struct tcb *tcp, const struct pollfd *fds)
+static bool
+print_pollfd(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
+	const struct pollfd *fds = elem_buf;
+
 	tprints("{fd=");
 	printfd(tcp, fds->fd);
 	if (fds->fd >= 0) {
 		tprints(", events=");
-		printflags(pollflags, fds->events, "POLL???");
+		printflags(pollflags, (unsigned short) fds->events, "POLL???");
 	}
 	tprints("}");
+
+	return true;
 }
 
-static int
+static void
 decode_poll_entering(struct tcb *tcp)
 {
-	struct pollfd fds;
+	const unsigned long addr = tcp->u_arg[0];
 	const unsigned int nfds = tcp->u_arg[1];
-	const unsigned long size = sizeof(fds) * nfds;
-	const unsigned long start = tcp->u_arg[0];
-	const unsigned long end = start + size;
-	const unsigned long max_printed =
-		abbrev(tcp) ? max_strlen : (unsigned int) -1;
+	struct pollfd fds;
 
-	if (!verbose(tcp) || !start || !nfds ||
-	    size / sizeof(fds) != nfds || end < start) {
-		printaddr(start);
-		tprintf(", %u, ", nfds);
-		return 0;
-	}
-
-	if (umove(tcp, start, &fds) < 0) {
-		printaddr(start);
-		tprintf(", %u, ", nfds);
-		return 0;
-	}
-
-	tprints("[");
-	if (max_printed) {
-		unsigned long printed = 1;
-		unsigned long cur = start + sizeof(fds);
-
-		print_pollfd(tcp, &fds);
-		for (; cur < end; ++printed, cur += sizeof(fds)) {
-			tprints(", ");
-			if (printed >= max_printed) {
-				tprints("...");
-				break;
-			}
-			if (umove_or_printaddr(tcp, cur, &fds))
-				break;
-			print_pollfd(tcp, &fds);
-
-		}
-	} else {
-		tprints("...");
-	}
-	tprintf("], %u, ", nfds);
-
-	return 0;
+	print_array(tcp, addr, nfds, &fds, sizeof(fds),
+		    umoven_or_printaddr, print_pollfd, 0);
+	tprintf(", %u, ", nfds);
 }
 
 static int
@@ -145,7 +112,8 @@
 		char fdstr[sizeof(fmt) + sizeof(int) * 3];
 		sprintf(fdstr, fmt, fds.fd);
 
-		const char *flagstr = sprintflags("", pollflags, fds.revents);
+		const char *flagstr = sprintflags("", pollflags,
+						  (unsigned short) fds.revents);
 
 		if (outptr + strlen(fdstr) + strlen(flagstr) + 1 >=
 		    end_outstr - (2 + 2 * sizeof(long) + sizeof(", ], ..."))) {
@@ -184,16 +152,17 @@
 SYS_FUNC(poll)
 {
 	if (entering(tcp)) {
-		int rc = decode_poll_entering(tcp);
+		decode_poll_entering(tcp);
+		int timeout = tcp->u_arg[2];
 
 #ifdef INFTIM
-		if (INFTIM == (int) tcp->u_arg[2])
+		if (INFTIM == timeout)
 			tprints("INFTIM");
 		else
 #endif
-			tprintf("%d", (int) tcp->u_arg[2]);
+			tprintf("%d", timeout);
 
-		return rc;
+		return 0;
 	} else {
 		return decode_poll_exiting(tcp, 0);
 	}
@@ -202,7 +171,7 @@
 SYS_FUNC(ppoll)
 {
 	if (entering(tcp)) {
-		int rc = decode_poll_entering(tcp);
+		decode_poll_entering(tcp);
 
 		print_timespec(tcp, tcp->u_arg[2]);
 		tprints(", ");
@@ -210,7 +179,7 @@
 		print_sigset_addr_len(tcp, tcp->u_arg[3], tcp->u_arg[4]);
 		tprintf(", %lu", tcp->u_arg[4]);
 
-		return rc;
+		return 0;
 	} else {
 		return decode_poll_exiting(tcp, tcp->u_arg[2]);
 	}
diff --git a/prctl.c b/prctl.c
index da7d265..cd51d4c 100644
--- a/prctl.c
+++ b/prctl.c
@@ -73,12 +73,13 @@
 
 SYS_FUNC(prctl)
 {
+	const unsigned int option = tcp->u_arg[0];
 	unsigned int i;
 
 	if (entering(tcp))
-		printxval(prctl_options, tcp->u_arg[0], "PR_???");
+		printxval(prctl_options, option, "PR_???");
 
-	switch (tcp->u_arg[0]) {
+	switch (option) {
 	case PR_GET_DUMPABLE:
 	case PR_GET_KEEPCAPS:
 	case PR_GET_SECCOMP:
@@ -122,7 +123,8 @@
 			break;
 		if (syserror(tcp) || tcp->u_rval == 0)
 			return 0;
-		tcp->auxstr = sprintflags("", secbits, tcp->u_rval);
+		tcp->auxstr = sprintflags("", secbits,
+					  (unsigned long) tcp->u_rval);
 		return RVAL_STR;
 
 	case PR_GET_TID_ADDRESS:
@@ -170,18 +172,19 @@
 	case PR_CAPBSET_DROP:
 	case PR_CAPBSET_READ:
 		tprints(", ");
-		printxval(cap, tcp->u_arg[1], "CAP_???");
+		printxval_long(cap, tcp->u_arg[1], "CAP_???");
 		return RVAL_DECODED;
 
 	case PR_CAP_AMBIENT:
 		tprints(", ");
-		printxval(pr_cap_ambient, tcp->u_arg[1], "PR_CAP_AMBIENT_???");
+		printxval_long(pr_cap_ambient, tcp->u_arg[1],
+			       "PR_CAP_AMBIENT_???");
 		switch (tcp->u_arg[1]) {
 		case PR_CAP_AMBIENT_RAISE:
 		case PR_CAP_AMBIENT_LOWER:
 		case PR_CAP_AMBIENT_IS_SET:
 			tprints(", ");
-			printxval(cap, tcp->u_arg[2], "CAP_???");
+			printxval_long(cap, tcp->u_arg[2], "CAP_???");
 			print_prctl_args(tcp, 3);
 			break;
 		default:
@@ -192,10 +195,10 @@
 
 	case PR_MCE_KILL:
 		tprints(", ");
-		printxval(pr_mce_kill, tcp->u_arg[1], "PR_MCE_KILL_???");
+		printxval_long(pr_mce_kill, tcp->u_arg[1], "PR_MCE_KILL_???");
 		tprints(", ");
 		if (PR_MCE_KILL_SET == tcp->u_arg[1])
-			printxval(pr_mce_kill_policy, tcp->u_arg[2],
+			printxval_long(pr_mce_kill_policy, tcp->u_arg[2],
 				   "PR_MCE_KILL_???");
 		else
 			tprintf("%#lx", tcp->u_arg[2]);
@@ -248,7 +251,7 @@
 
 	case PR_SET_SECCOMP:
 		tprints(", ");
-		printxval(seccomp_mode, tcp->u_arg[1],
+		printxval_long(seccomp_mode, tcp->u_arg[1],
 			  "SECCOMP_MODE_???");
 		if (SECCOMP_MODE_STRICT == tcp->u_arg[1])
 			return RVAL_DECODED;
@@ -262,7 +265,7 @@
 
 	case PR_SET_SECUREBITS:
 		tprints(", ");
-		printflags(secbits, tcp->u_arg[1], "SECBIT_???");
+		printflags_long(secbits, tcp->u_arg[1], "SECBIT_???");
 		return RVAL_DECODED;
 
 	case PR_SET_TIMERSLACK:
@@ -292,7 +295,8 @@
 		}
 		if (syserror(tcp))
 			return 0;
-		tcp->auxstr = xlookup(pr_mce_kill_policy, tcp->u_rval);
+		tcp->auxstr = xlookup(pr_mce_kill_policy,
+				      (unsigned long) tcp->u_rval);
 		return tcp->auxstr ? RVAL_STR : RVAL_UDECIMAL;
 
 	case PR_GET_NO_NEW_PRIVS:
@@ -312,10 +316,12 @@
 
 SYS_FUNC(arch_prctl)
 {
-	if (entering(tcp))
-		printxval(archvals, tcp->u_arg[0], "ARCH_???");
+	const unsigned int option = tcp->u_arg[0];
 
-	switch (tcp->u_arg[0]) {
+	if (entering(tcp))
+		printxval(archvals, option, "ARCH_???");
+
+	switch (option) {
 	case ARCH_GET_GS:
 	case ARCH_GET_FS:
 		if (entering(tcp))
diff --git a/print_mq_attr.c b/print_mq_attr.c
index a43d437..1807834 100644
--- a/print_mq_attr.c
+++ b/print_mq_attr.c
@@ -41,7 +41,7 @@
 
 #include MPERS_DEFS
 
-MPERS_PRINTER_DECL(void, printmqattr)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, printmqattr, struct tcb *tcp, const long addr)
 {
 #if defined HAVE_MQUEUE_H || defined HAVE_LINUX_MQUEUE_H
 	mq_attr_t attr;
diff --git a/print_msgbuf.c b/print_msgbuf.c
index c7e87e4..68d8741 100644
--- a/print_msgbuf.c
+++ b/print_msgbuf.c
@@ -38,7 +38,8 @@
 typedef struct msgbuf msgbuf_t;
 #include MPERS_DEFS
 
-MPERS_PRINTER_DECL(void, tprint_msgbuf)(struct tcb *tcp, const long addr, const unsigned long count)
+MPERS_PRINTER_DECL(void, tprint_msgbuf,
+		   struct tcb *tcp, const long addr, const unsigned long count)
 {
 	msgbuf_t msg;
 
diff --git a/print_sigevent.c b/print_sigevent.c
index f8eb8a0..1c2b174 100644
--- a/print_sigevent.c
+++ b/print_sigevent.c
@@ -35,7 +35,7 @@
 #include <signal.h>
 #include "xlat/sigev_value.h"
 
-MPERS_PRINTER_DECL(void, print_sigevent)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_sigevent, struct tcb *tcp, const long addr)
 {
 	struct_sigevent sev;
 
diff --git a/print_statfs.c b/print_statfs.c
new file mode 100644
index 0000000..2661d07
--- /dev/null
+++ b/print_statfs.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+#include "statfs.h"
+#include "xlat/fsmagic.h"
+#include "xlat/statfs_flags.h"
+
+static void
+print_statfs_type(const char *const prefix, const unsigned long long magic)
+{
+	tprints(prefix);
+	const char *s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic);
+	if (s)
+		tprints(s);
+	else
+		tprintf("%#llx", magic);
+}
+
+#if defined HAVE_STRUCT_STATFS_F_FLAGS || defined HAVE_STRUCT_STATFS64_F_FLAGS
+static void
+print_statfs_flags(const char *const prefix, const unsigned long long flags)
+{
+	if (flags & ST_VALID) {
+		tprints(prefix);
+		printflags64(statfs_flags, flags, "ST_???");
+	}
+}
+#endif /* HAVE_STRUCT_STATFS_F_FLAGS || HAVE_STRUCT_STATFS64_F_FLAGS */
+
+static void
+print_statfs_number(const char *const prefix, const unsigned long long number)
+{
+	tprints(prefix);
+	tprintf("%llu",  number);
+}
+
+void
+print_struct_statfs(struct tcb *tcp, const long addr)
+{
+#ifdef HAVE_STRUCT_STATFS
+	struct strace_statfs b;
+
+	if (!fetch_struct_statfs(tcp, addr, &b))
+		return;
+
+	print_statfs_type("{f_type=", b.f_type);
+	print_statfs_number(", f_bsize=", b.f_bsize);
+	print_statfs_number(", f_blocks=", b.f_blocks);
+	print_statfs_number(", f_bfree=", b.f_bfree);
+	print_statfs_number(", f_bavail=", b.f_bavail);
+	print_statfs_number(", f_files=", b.f_files);
+	print_statfs_number(", f_ffree=", b.f_ffree);
+# if defined HAVE_STRUCT_STATFS_F_FSID_VAL \
+  || defined HAVE_STRUCT_STATFS_F_FSID___VAL
+	print_statfs_number(", f_fsid={", b.f_fsid[0]);
+	print_statfs_number(", ", b.f_fsid[1]);
+	tprints("}");
+# endif
+	print_statfs_number(", f_namelen=", b.f_namelen);
+# ifdef HAVE_STRUCT_STATFS_F_FRSIZE
+	print_statfs_number(", f_frsize=", b.f_frsize);
+# endif
+# ifdef HAVE_STRUCT_STATFS_F_FLAGS
+	print_statfs_flags(", f_flags=", b.f_flags);
+# endif
+	tprints("}");
+#else
+	printaddr(addr);
+#endif
+}
+
+void
+print_struct_statfs64(struct tcb *tcp, const long addr, const unsigned long size)
+{
+#ifdef HAVE_STRUCT_STATFS64
+	struct strace_statfs b;
+
+	if (!fetch_struct_statfs64(tcp, addr, size, &b))
+		return;
+
+	print_statfs_type("{f_type=", b.f_type);
+	print_statfs_number(", f_bsize=", b.f_bsize);
+	print_statfs_number(", f_blocks=", b.f_blocks);
+	print_statfs_number(", f_bfree=", b.f_bfree);
+	print_statfs_number(", f_bavail=", b.f_bavail);
+	print_statfs_number(", f_files=", b.f_files);
+	print_statfs_number(", f_ffree=", b.f_ffree);
+# if defined HAVE_STRUCT_STATFS64_F_FSID_VAL \
+  || defined HAVE_STRUCT_STATFS64_F_FSID___VAL
+	print_statfs_number(", f_fsid={", b.f_fsid[0]);
+	print_statfs_number(", ", b.f_fsid[1]);
+	tprints("}");
+# endif
+	print_statfs_number(", f_namelen=", b.f_namelen);
+# ifdef HAVE_STRUCT_STATFS64_F_FRSIZE
+	print_statfs_number(", f_frsize=", b.f_frsize);
+# endif
+# ifdef HAVE_STRUCT_STATFS64_F_FLAGS
+	print_statfs_flags(", f_flags=", b.f_flags);
+# endif
+	tprints("}");
+#else
+	printaddr(addr);
+#endif
+}
diff --git a/print_time.c b/print_time.c
index dddb3f1..500ce8e 100644
--- a/print_time.c
+++ b/print_time.c
@@ -73,7 +73,8 @@
 	tprintf(time_fmt, (intmax_t) t->tv_sec, (intmax_t) t->tv_usec);
 }
 
-MPERS_PRINTER_DECL(void, print_timespec)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timespec,
+		   struct tcb *tcp, const long addr)
 {
 	timespec_t t;
 
@@ -83,7 +84,8 @@
 	print_timespec_t(&t);
 }
 
-MPERS_PRINTER_DECL(const char *, sprint_timespec)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(const char *, sprint_timespec,
+		   struct tcb *tcp, const long addr)
 {
 	timespec_t t;
 	static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
@@ -101,7 +103,8 @@
 	return buf;
 }
 
-MPERS_PRINTER_DECL(void, print_timespec_utime_pair)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timespec_utime_pair,
+		   struct tcb *tcp, const long addr)
 {
 	timespec_t t[2];
 
@@ -115,7 +118,8 @@
 	tprints("]");
 }
 
-MPERS_PRINTER_DECL(void, print_itimerspec)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_itimerspec,
+		   struct tcb *tcp, const long addr)
 {
 	timespec_t t[2];
 
@@ -129,7 +133,8 @@
 	tprints("}");
 }
 
-MPERS_PRINTER_DECL(void, print_timeval)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timeval,
+		   struct tcb *tcp, const long addr)
 {
 	timeval_t t;
 
@@ -139,7 +144,8 @@
 	print_timeval_t(&t);
 }
 
-MPERS_PRINTER_DECL(void, print_timeval_pair)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timeval_pair,
+		   struct tcb *tcp, const long addr)
 {
 	timeval_t t[2];
 
@@ -153,7 +159,8 @@
 	tprints("]");
 }
 
-MPERS_PRINTER_DECL(const char *, sprint_timeval)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(const char *, sprint_timeval,
+		   struct tcb *tcp, const long addr)
 {
 	timeval_t t;
 	static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
@@ -171,7 +178,8 @@
 	return buf;
 }
 
-MPERS_PRINTER_DECL(void, print_itimerval)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_itimerval,
+		   struct tcb *tcp, const long addr)
 {
 	timeval_t t[2];
 
diff --git a/print_timex.c b/print_timex.c
index 4eac54d..ad6a711 100644
--- a/print_timex.c
+++ b/print_timex.c
@@ -40,7 +40,7 @@
 #include "xlat/adjtimex_modes.h"
 #include "xlat/adjtimex_status.h"
 
-MPERS_PRINTER_DECL(int, print_timex)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(int, print_timex, struct tcb *tcp, const long addr)
 {
 	struct_timex tx;
 
diff --git a/printers.h b/printers.h
index f63140a..b902331 100644
--- a/printers.h
+++ b/printers.h
@@ -1,56 +1,86 @@
-/* Generated by Makefile from dirent.c fetch_seccomp_fprog.c fetch_struct_flock.c ipc_msgctl.c ipc_shmctl.c print_mq_attr.c print_msgbuf.c print_sigevent.c print_time.c print_timex.c printrusage.c printsiginfo.c sigaltstack.c sysinfo.c times.c utime.c; do not edit. */
+/* Generated by Makefile from block.c.mpers.i btrfs.c.mpers.i dirent.c.mpers.i evdev.c.mpers.i fetch_seccomp_fprog.c.mpers.i fetch_struct_flock.c.mpers.i fetch_struct_statfs.c.mpers.i hdio.c.mpers.i ipc_msgctl.c.mpers.i ipc_shmctl.c.mpers.i mtd.c.mpers.i print_mq_attr.c.mpers.i print_msgbuf.c.mpers.i print_sigevent.c.mpers.i print_time.c.mpers.i print_timex.c.mpers.i printrusage.c.mpers.i printsiginfo.c.mpers.i rtc.c.mpers.i sigaltstack.c.mpers.i sysinfo.c.mpers.i times.c.mpers.i utime.c.mpers.i v4l2.c.mpers.i; do not edit. */
 typedef struct {
- bool (*fetch_seccomp_fprog) (struct tcb *tcp, const long addr, void *p);
+ int (*block_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define block_ioctl MPERS_PRINTER_NAME(block_ioctl)
+
+ int (*btrfs_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define btrfs_ioctl MPERS_PRINTER_NAME(btrfs_ioctl)
+
+ int (*evdev_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define evdev_ioctl MPERS_PRINTER_NAME(evdev_ioctl)
+
+ _Bool (*fetch_seccomp_fprog)(struct tcb *tcp, const long addr, void *p);
 #define fetch_seccomp_fprog MPERS_PRINTER_NAME(fetch_seccomp_fprog)
 
- bool (*fetch_struct_flock) (struct tcb *tcp, const long addr, void *p);
+ _Bool (*fetch_struct_flock)(struct tcb *tcp, const long addr, void *p);
 #define fetch_struct_flock MPERS_PRINTER_NAME(fetch_struct_flock)
 
- bool (*fetch_struct_flock64) (struct tcb *tcp, const long addr, void *p);
+ _Bool (*fetch_struct_flock64)(struct tcb *tcp, const long addr, void *p);
 #define fetch_struct_flock64 MPERS_PRINTER_NAME(fetch_struct_flock64)
 
- void (*printmqattr) (struct tcb *tcp, const long addr);
+ _Bool (*fetch_struct_statfs)(struct tcb *tcp, const long addr, struct strace_statfs *p);
+#define fetch_struct_statfs MPERS_PRINTER_NAME(fetch_struct_statfs)
+
+ _Bool (*fetch_struct_statfs64)(struct tcb *tcp, const long addr, const unsigned long size, struct strace_statfs *p);
+#define fetch_struct_statfs64 MPERS_PRINTER_NAME(fetch_struct_statfs64)
+
+ int (*hdio_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define hdio_ioctl MPERS_PRINTER_NAME(hdio_ioctl)
+
+ int (*mtd_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define mtd_ioctl MPERS_PRINTER_NAME(mtd_ioctl)
+
+ void (*printmqattr)(struct tcb *tcp, const long addr);
 #define printmqattr MPERS_PRINTER_NAME(printmqattr)
 
- void (*tprint_msgbuf) (struct tcb *tcp, const long addr, const unsigned long count);
+ void (*tprint_msgbuf)(struct tcb *tcp, const long addr, const unsigned long count);
 #define tprint_msgbuf MPERS_PRINTER_NAME(tprint_msgbuf)
 
- void (*print_sigevent) (struct tcb *tcp, const long addr);
+ void (*print_sigevent)(struct tcb *tcp, const long addr);
 #define print_sigevent MPERS_PRINTER_NAME(print_sigevent)
 
- void (*print_timespec) (struct tcb *tcp, const long addr);
+ void (*print_timespec)(struct tcb *tcp, const long addr);
 #define print_timespec MPERS_PRINTER_NAME(print_timespec)
 
- const char * (*sprint_timespec) (struct tcb *tcp, const long addr);
+ const char * (*sprint_timespec)(struct tcb *tcp, const long addr);
 #define sprint_timespec MPERS_PRINTER_NAME(sprint_timespec)
 
- void (*print_timespec_utime_pair) (struct tcb *tcp, const long addr);
+ void (*print_timespec_utime_pair)(struct tcb *tcp, const long addr);
 #define print_timespec_utime_pair MPERS_PRINTER_NAME(print_timespec_utime_pair)
 
- void (*print_itimerspec) (struct tcb *tcp, const long addr);
+ void (*print_itimerspec)(struct tcb *tcp, const long addr);
 #define print_itimerspec MPERS_PRINTER_NAME(print_itimerspec)
 
- void (*print_timeval) (struct tcb *tcp, const long addr);
+ void (*print_timeval)(struct tcb *tcp, const long addr);
 #define print_timeval MPERS_PRINTER_NAME(print_timeval)
 
- void (*print_timeval_pair) (struct tcb *tcp, const long addr);
+ void (*print_timeval_pair)(struct tcb *tcp, const long addr);
 #define print_timeval_pair MPERS_PRINTER_NAME(print_timeval_pair)
 
- const char * (*sprint_timeval) (struct tcb *tcp, const long addr);
+ const char * (*sprint_timeval)(struct tcb *tcp, const long addr);
 #define sprint_timeval MPERS_PRINTER_NAME(sprint_timeval)
 
- void (*print_itimerval) (struct tcb *tcp, const long addr);
+ void (*print_itimerval)(struct tcb *tcp, const long addr);
 #define print_itimerval MPERS_PRINTER_NAME(print_itimerval)
 
- int (*print_timex) (struct tcb *tcp, const long addr);
+ int (*print_timex)(struct tcb *tcp, const long addr);
 #define print_timex MPERS_PRINTER_NAME(print_timex)
 
- void (*printrusage) (struct tcb *tcp, long addr);
+ void (*printrusage)(struct tcb *tcp, long addr);
 #define printrusage MPERS_PRINTER_NAME(printrusage)
 
- void (*printsiginfo_at) (struct tcb *tcp, long addr);
+ void (*printsiginfo_at)(struct tcb *tcp, long addr);
 #define printsiginfo_at MPERS_PRINTER_NAME(printsiginfo_at)
 
+ void (*print_siginfo_array)(struct tcb *tcp, unsigned long addr, unsigned long len);
+#define print_siginfo_array MPERS_PRINTER_NAME(print_siginfo_array)
+
+ int (*rtc_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define rtc_ioctl MPERS_PRINTER_NAME(rtc_ioctl)
+
+ int (*v4l2_ioctl)(struct tcb *tcp, const unsigned int code, const long arg);
+#define v4l2_ioctl MPERS_PRINTER_NAME(v4l2_ioctl)
+
 } struct_printers;
 extern const struct_printers *printers;
 #define MPERS_PRINTER_NAME(printer_name) printers->printer_name
diff --git a/printmode.c b/printmode.c
index 8ff05fc..ad87507 100644
--- a/printmode.c
+++ b/printmode.c
@@ -37,7 +37,7 @@
 #include "xlat/modetypes.h"
 
 const char *
-sprintmode(int mode)
+sprintmode(unsigned int mode)
 {
 	static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
 			+ sizeof(int)*3
diff --git a/printrusage.c b/printrusage.c
index be56e66..0375f8f 100644
--- a/printrusage.c
+++ b/printrusage.c
@@ -37,7 +37,7 @@
 
 #include MPERS_DEFS
 
-MPERS_PRINTER_DECL(void, printrusage)(struct tcb *tcp, long addr)
+MPERS_PRINTER_DECL(void, printrusage, struct tcb *tcp, long addr)
 {
 	rusage_t ru;
 
diff --git a/printsiginfo.c b/printsiginfo.c
index 4083e19..98755b2 100644
--- a/printsiginfo.c
+++ b/printsiginfo.c
@@ -74,18 +74,14 @@
 }
 
 static void
-printsigval(const siginfo_t *sip, bool verbose)
+printsigval(const siginfo_t *sip)
 {
-	if (!verbose)
-		tprints(", ...");
-	else
-		tprintf(", si_value={int=%d, ptr=%#lx}",
-			sip->si_int,
-			(unsigned long) sip->si_ptr);
+	tprintf(", si_value={int=%d, ptr=%#lx}",
+		sip->si_int, (unsigned long) sip->si_ptr);
 }
 
 static void
-print_si_code(int si_signo, int si_code)
+print_si_code(int si_signo, unsigned int si_code)
 {
 	const char *code = xlookup(siginfo_codes, si_code);
 
@@ -133,7 +129,7 @@
 }
 
 static void
-print_si_info(const siginfo_t *sip, bool verbose)
+print_si_info(const siginfo_t *sip)
 {
 	if (sip->si_errno) {
 		tprints(", si_errno=");
@@ -156,13 +152,13 @@
 		case SI_TIMER:
 			tprintf(", si_timerid=%#x, si_overrun=%d",
 				sip->si_timerid, sip->si_overrun);
-			printsigval(sip, verbose);
+			printsigval(sip);
 			break;
 #endif
 		default:
 			printsigsource(sip);
 			if (sip->si_ptr)
-				printsigval(sip, verbose);
+				printsigval(sip);
 			break;
 		}
 	} else {
@@ -174,12 +170,9 @@
 				tprintf("%d", sip->si_status);
 			else
 				printsignal(sip->si_status);
-			if (!verbose)
-				tprints(", ...");
-			else
-				tprintf(", si_utime=%llu, si_stime=%llu",
-					(unsigned long long) sip->si_utime,
-					(unsigned long long) sip->si_stime);
+			tprintf(", si_utime=%llu, si_stime=%llu",
+				widen_to_ull(sip->si_utime),
+				widen_to_ull(sip->si_stime));
 			break;
 		case SIGILL: case SIGFPE:
 		case SIGSEGV: case SIGBUS:
@@ -198,7 +191,7 @@
 		case SIGSYS:
 			tprintf(", si_call_addr=%#lx, si_syscall=__NR_%s, si_arch=",
 				(unsigned long) sip->si_call_addr,
-				syscall_name(sip->si_syscall));
+				syscall_name((unsigned) sip->si_syscall));
 			printxval(audit_arch, sip->si_arch, "AUDIT_ARCH_???");
 			break;
 #endif
@@ -206,7 +199,7 @@
 			if (sip->si_pid || sip->si_uid)
 				printsigsource(sip);
 			if (sip->si_ptr)
-				printsigval(sip, verbose);
+				printsigval(sip);
 		}
 	}
 }
@@ -215,7 +208,7 @@
 static
 #endif
 void
-printsiginfo(const siginfo_t *sip, bool verbose)
+printsiginfo(const siginfo_t *sip)
 {
 	if (sip->si_signo == 0) {
 		tprints("{}");
@@ -230,15 +223,32 @@
 #ifdef SI_NOINFO
 	if (sip->si_code != SI_NOINFO)
 #endif
-		print_si_info(sip, verbose);
+		print_si_info(sip);
 
 	tprints("}");
 }
 
-MPERS_PRINTER_DECL(void, printsiginfo_at)(struct tcb *tcp, long addr)
+MPERS_PRINTER_DECL(void, printsiginfo_at,
+		   struct tcb *tcp, long addr)
 {
 	siginfo_t si;
 
 	if (!umove_or_printaddr(tcp, addr, &si))
-		printsiginfo(&si, verbose(tcp));
+		printsiginfo(&si);
+}
+
+static bool
+print_siginfo_t(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	printsiginfo((const siginfo_t *) elem_buf);
+	return true;
+}
+
+MPERS_PRINTER_DECL(void, print_siginfo_array,
+		   struct tcb *tcp, unsigned long addr, unsigned long len)
+{
+	siginfo_t si;
+
+	print_array(tcp, addr, len, &si, sizeof(si),
+		    umoven_or_printaddr, print_siginfo_t, 0);
 }
diff --git a/printsiginfo.h b/printsiginfo.h
index b36b3d6..cb2d99d 100644
--- a/printsiginfo.h
+++ b/printsiginfo.h
@@ -1 +1 @@
-extern void printsiginfo(const siginfo_t *, bool);
+extern void printsiginfo(const siginfo_t *);
diff --git a/printstat.h b/printstat.h
index c7e1bb2..5bf745c 100644
--- a/printstat.h
+++ b/printstat.h
@@ -55,7 +55,7 @@
 		tprintf("{st_dev=makedev(%u, %u), st_ino=%llu, st_mode=%s, ",
 			(unsigned int) STAT_MAJOR(statbuf->st_dev),
 			(unsigned int) STAT_MINOR(statbuf->st_dev),
-			(unsigned long long) statbuf->st_ino,
+			widen_to_ull(statbuf->st_ino),
 			sprintmode(statbuf->st_mode));
 		tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
 			(unsigned int) statbuf->st_nlink,
@@ -65,8 +65,7 @@
 		tprintf("st_blksize=%u, ", (unsigned int) statbuf->st_blksize);
 #endif
 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
-		tprintf("st_blocks=%llu, ",
-			(unsigned long long) statbuf->st_blocks);
+		tprintf("st_blocks=%llu, ", widen_to_ull(statbuf->st_blocks));
 #endif
 	} else {
 		tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
@@ -85,8 +84,7 @@
 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
 		break;
 	default:
-		tprintf("st_size=%llu, ",
-			(unsigned long long) statbuf->st_size);
+		tprintf("st_size=%llu, ", widen_to_ull(statbuf->st_size));
 		break;
 	}
 
diff --git a/process.c b/process.c
index 1526dd6..3aecf08 100644
--- a/process.c
+++ b/process.c
@@ -46,6 +46,7 @@
 #include "ptrace.h"
 #include "xlat/ptrace_cmds.h"
 #include "xlat/ptrace_setoptions_flags.h"
+#include "xlat/ptrace_peeksiginfo_flags.h"
 
 #define uoff(member)	offsetof(struct user, member)
 #define XLAT_UOFF(member)	{ uoff(member), "offsetof(struct user, " #member ")" }
@@ -82,77 +83,181 @@
 
 SYS_FUNC(ptrace)
 {
-	const long request = tcp->u_arg[0];
+	const unsigned long request = tcp->u_arg[0];
 	const int pid = tcp->u_arg[1];
 	const unsigned long addr = tcp->u_arg[2];
 	const unsigned long data = tcp->u_arg[3];
 
 	if (entering(tcp)) {
-		printxval(ptrace_cmds, request, "PTRACE_???");
-		tprintf(", %d, ", pid);
+		/* request */
+		printxval64(ptrace_cmds, request, "PTRACE_???");
 
+		if (request == PTRACE_TRACEME) {
+			/* pid, addr, and data are ignored. */
+			return RVAL_DECODED;
+		}
+
+		/* pid */
+		tprintf(", %d", pid);
+
+		/* addr */
 		switch (request) {
+		case PTRACE_ATTACH:
+		case PTRACE_INTERRUPT:
+		case PTRACE_KILL:
+		case PTRACE_LISTEN:
+			/* addr and data are ignored */
+			return RVAL_DECODED;
 		case PTRACE_PEEKUSER:
 		case PTRACE_POKEUSER:
+			tprints(", ");
 			print_user_offset_addr(addr);
 			break;
 		case PTRACE_GETREGSET:
 		case PTRACE_SETREGSET:
+			tprints(", ");
 			printxval(nt_descriptor_types, addr, "NT_???");
 			break;
+		case PTRACE_GETSIGMASK:
+		case PTRACE_SETSIGMASK:
+		case PTRACE_SECCOMP_GET_FILTER:
+			tprintf(", %lu", addr);
+			break;
+		case PTRACE_PEEKSIGINFO: {
+			tprints(", ");
+			struct {
+				uint64_t off;
+				uint32_t flags;
+				uint32_t nr;
+			} psi;
+			if (umove_or_printaddr(tcp, addr, &psi)) {
+				tprints(", ");
+				printaddr(data);
+				return RVAL_DECODED;
+			}
+			tprintf("{off=%" PRIu64 ", flags=", psi.off);
+			printflags(ptrace_peeksiginfo_flags, psi.flags,
+				   "PTRACE_PEEKSIGINFO_???");
+			tprintf(", nr=%u}", psi.nr);
+			break;
+		}
 		default:
+			tprints(", ");
 			printaddr(addr);
 		}
 
+# if defined IA64 || defined SPARC || defined SPARC64
+		switch (request) {
+#  ifdef IA64
+		case PTRACE_PEEKDATA:
+		case PTRACE_PEEKTEXT:
+		case PTRACE_PEEKUSER:
+			/* data is ignored */
+			return RVAL_DECODED | RVAL_HEX;
+#  endif /* IA64 */
+#  if defined SPARC || defined SPARC64
+		case PTRACE_GETREGS:
+		case PTRACE_SETREGS:
+		case PTRACE_GETFPREGS:
+		case PTRACE_SETFPREGS:
+			/* data is ignored */
+			return RVAL_DECODED;
+#  endif /* SPARC || SPARC64 */
+		}
+# endif /* IA64 || SPARC || SPARC64 */
+
 		tprints(", ");
 
+		/* data */
+		switch (request) {
+		case PTRACE_CONT:
+		case PTRACE_DETACH:
+		case PTRACE_SYSCALL:
+#ifdef PTRACE_SINGLESTEP
+		case PTRACE_SINGLESTEP:
+#endif
+#ifdef PTRACE_SINGLEBLOCK
+		case PTRACE_SINGLEBLOCK:
+#endif
+#ifdef PTRACE_SYSEMU
+		case PTRACE_SYSEMU:
+#endif
+#ifdef PTRACE_SYSEMU_SINGLESTEP
+		case PTRACE_SYSEMU_SINGLESTEP:
+#endif
+			printsignal(data);
+			break;
+		case PTRACE_SEIZE:
+		case PTRACE_SETOPTIONS:
+#ifdef PTRACE_OLDSETOPTIONS
+		case PTRACE_OLDSETOPTIONS:
+#endif
+			printflags64(ptrace_setoptions_flags, data, "PTRACE_O_???");
+			break;
+		case PTRACE_SETSIGINFO:
+			printsiginfo_at(tcp, data);
+			break;
+		case PTRACE_SETSIGMASK:
+			print_sigset_addr_len(tcp, data, addr);
+			break;
+		case PTRACE_SETREGSET:
+			tprint_iov(tcp, /*len:*/ 1, data, /*as string:*/ 0);
+			break;
+#ifndef IA64
+		case PTRACE_PEEKDATA:
+		case PTRACE_PEEKTEXT:
+		case PTRACE_PEEKUSER:
+#endif
+		case PTRACE_GETEVENTMSG:
+		case PTRACE_GETREGSET:
+		case PTRACE_GETSIGINFO:
+		case PTRACE_GETSIGMASK:
+		case PTRACE_PEEKSIGINFO:
+		case PTRACE_SECCOMP_GET_FILTER:
+			if (verbose(tcp)) {
+				/* print data on exiting syscall */
+				return 0;
+			}
+			/* fall through */
+		default:
+			printaddr(data);
+			break;
+		}
+
+		return RVAL_DECODED;
+	} else {
 		switch (request) {
 #ifndef IA64
 		case PTRACE_PEEKDATA:
 		case PTRACE_PEEKTEXT:
 		case PTRACE_PEEKUSER:
-			break;
-#endif
-		case PTRACE_CONT:
-		case PTRACE_SINGLESTEP:
-		case PTRACE_SYSCALL:
-		case PTRACE_DETACH:
-			printsignal(data);
-			break;
-		case PTRACE_SETOPTIONS:
-			printflags(ptrace_setoptions_flags, data, "PTRACE_O_???");
-			break;
-		case PTRACE_SETSIGINFO:
-			printsiginfo_at(tcp, data);
-			break;
-		case PTRACE_SETREGSET:
-			tprint_iov(tcp, /*len:*/ 1, data, /*as string:*/ 0);
-			break;
-		case PTRACE_GETSIGINFO:
-		case PTRACE_GETREGSET:
-			/* Don't print anything, do it at syscall return. */
-			break;
-		default:
-			printaddr(data);
-			break;
-		}
-	} else {
-		switch (request) {
-		case PTRACE_PEEKDATA:
-		case PTRACE_PEEKTEXT:
-		case PTRACE_PEEKUSER:
-#ifdef IA64
-			return RVAL_HEX;
-#else
 			printnum_ptr(tcp, data);
 			break;
 #endif
-		case PTRACE_GETSIGINFO:
-			printsiginfo_at(tcp, data);
+		case PTRACE_GETEVENTMSG:
+			printnum_ulong(tcp, data);
 			break;
 		case PTRACE_GETREGSET:
 			tprint_iov(tcp, /*len:*/ 1, data, /*as string:*/ 0);
 			break;
+		case PTRACE_GETSIGINFO:
+			printsiginfo_at(tcp, data);
+			break;
+		case PTRACE_GETSIGMASK:
+			print_sigset_addr_len(tcp, data, addr);
+			break;
+		case PTRACE_PEEKSIGINFO:
+			if (syserror(tcp))
+				printaddr(data);
+			else
+				print_siginfo_array(tcp, data, tcp->u_rval);
+			break;
+		case PTRACE_SECCOMP_GET_FILTER:
+			if (syserror(tcp))
+				printaddr(data);
+			else
+				print_seccomp_fprog(tcp, data, tcp->u_rval);
+			break;
 		}
 	}
 	return 0;
diff --git a/quota.c b/quota.c
index c73ac6d..0a388b2 100644
--- a/quota.c
+++ b/quota.c
@@ -317,7 +317,7 @@
 			tprintf("{version=%d, ", dq.d_version);
 			tprints("flags=");
 			printflags(xfs_dqblk_flags,
-				   dq.d_flags, "XFS_???_QUOTA");
+				   (uint8_t) dq.d_flags, "XFS_???_QUOTA");
 			tprintf(", fieldmask=%#x, ", dq.d_fieldmask);
 			tprintf("id=%u, ", dq.d_id);
 			tprintf("blk_hardlimit=%" PRIu64 ", ", dq.d_blk_hardlimit);
diff --git a/reboot.c b/reboot.c
index ebe3def..1669a3d 100644
--- a/reboot.c
+++ b/reboot.c
@@ -6,12 +6,16 @@
 
 SYS_FUNC(reboot)
 {
-	printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
+	const unsigned int magic1 = tcp->u_arg[0];
+	const unsigned int magic2 = tcp->u_arg[1];
+	const unsigned int cmd = tcp->u_arg[2];
+
+	printflags(bootflags1, magic1, "LINUX_REBOOT_MAGIC_???");
 	tprints(", ");
-	printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
+	printflags(bootflags2, magic2, "LINUX_REBOOT_MAGIC_???");
 	tprints(", ");
-	printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
-	if (tcp->u_arg[2] == (long) LINUX_REBOOT_CMD_RESTART2) {
+	printflags(bootflags3, cmd, "LINUX_REBOOT_CMD_???");
+	if (cmd == LINUX_REBOOT_CMD_RESTART2) {
 		tprints(", ");
 		printstr(tcp, tcp->u_arg[3], -1);
 	}
diff --git a/rtc.c b/rtc.c
index 0806b0e..7f123e4 100644
--- a/rtc.c
+++ b/rtc.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
- * Copyright (c) 2004 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2004-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,9 +27,16 @@
  */
 
 #include "defs.h"
+
+#include DEF_MPERS_TYPE(struct_rtc_pll_info)
+
 #include <linux/ioctl.h>
 #include <linux/rtc.h>
 
+typedef struct rtc_pll_info struct_rtc_pll_info;
+
+#include MPERS_DEFS
+
 static void
 print_rtc_time(struct tcb *tcp, const struct rtc_time *rt)
 {
@@ -49,7 +56,6 @@
 {
 	struct rtc_time rt;
 
-	tprints(", ");
 	if (!umove_or_printaddr(tcp, addr, &rt))
 		print_rtc_time(tcp, &rt);
 }
@@ -59,26 +65,37 @@
 {
 	struct rtc_wkalrm wk;
 
-	tprints(", ");
 	if (!umove_or_printaddr(tcp, addr, &wk)) {
-		tprintf("{enabled=%d, pending=%d, ", wk.enabled, wk.pending);
+		tprintf("{enabled=%d, pending=%d, time=", wk.enabled, wk.pending);
 		print_rtc_time(tcp, &wk.time);
 		tprints("}");
 	}
 }
 
-int
-rtc_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+static void
+decode_rtc_pll_info(struct tcb *tcp, const long addr)
+{
+	struct_rtc_pll_info pll;
+
+	if (!umove_or_printaddr(tcp, addr, &pll))
+		tprintf("{pll_ctrl=%d, pll_value=%d, pll_max=%d, pll_min=%d"
+			", pll_posmult=%d, pll_negmult=%d, pll_clock=%ld}",
+			pll.pll_ctrl, pll.pll_value, pll.pll_max, pll.pll_min,
+			pll.pll_posmult, pll.pll_negmult, (long) pll.pll_clock);
+}
+
+MPERS_PRINTER_DECL(int, rtc_ioctl, struct tcb *tcp,
+		   const unsigned int code, const long arg)
 {
 	switch (code) {
-	case RTC_ALM_SET:
-	case RTC_SET_TIME:
-		decode_rtc_time(tcp, arg);
-		break;
 	case RTC_ALM_READ:
 	case RTC_RD_TIME:
 		if (entering(tcp))
 			return 0;
+		/* fall through */
+	case RTC_ALM_SET:
+	case RTC_SET_TIME:
+		tprints(", ");
 		decode_rtc_time(tcp, arg);
 		break;
 	case RTC_IRQP_SET:
@@ -92,14 +109,22 @@
 		tprints(", ");
 		printnum_ulong(tcp, arg);
 		break;
-	case RTC_WKALM_SET:
-		decode_rtc_wkalrm(tcp, arg);
-		break;
 	case RTC_WKALM_RD:
 		if (entering(tcp))
 			return 0;
+		/* fall through */
+	case RTC_WKALM_SET:
+		tprints(", ");
 		decode_rtc_wkalrm(tcp, arg);
 		break;
+	case RTC_PLL_GET:
+		if (entering(tcp))
+			return 0;
+		/* fall through */
+	case RTC_PLL_SET:
+		tprints(", ");
+		decode_rtc_pll_info(tcp, arg);
+		break;
 #ifdef RTC_VL_READ
 	case RTC_VL_READ:
 		if (entering(tcp))
@@ -108,6 +133,19 @@
 		printnum_int(tcp, arg, "%d");
 		break;
 #endif
+	case RTC_AIE_ON:
+	case RTC_AIE_OFF:
+	case RTC_UIE_ON:
+	case RTC_UIE_OFF:
+	case RTC_PIE_ON:
+	case RTC_PIE_OFF:
+	case RTC_WIE_ON:
+	case RTC_WIE_OFF:
+#ifdef RTC_VL_CLR
+	case RTC_VL_CLR:
+#endif
+		/* no args */
+		break;
 	default:
 		return RVAL_DECODED;
 	}
diff --git a/sched.c b/sched.c
index e193498..86d4c22 100644
--- a/sched.c
+++ b/sched.c
@@ -39,7 +39,7 @@
 	if (entering(tcp)) {
 		tprintf("%d", (int) tcp->u_arg[0]);
 	} else if (!syserror(tcp)) {
-		tcp->auxstr = xlookup(schedulers, tcp->u_rval);
+		tcp->auxstr = xlookup(schedulers, (unsigned long) tcp->u_rval);
 		if (tcp->auxstr != NULL)
 			return RVAL_STR;
 	}
@@ -115,7 +115,7 @@
 	tprintf("{size=%u, sched_policy=", attr.size);
 	printxval(schedulers, attr.sched_policy, "SCHED_???");
 	tprints(", sched_flags=");
-	printflags(sched_flags, attr.sched_flags, "SCHED_FLAG_???");
+	printflags64(sched_flags, attr.sched_flags, "SCHED_FLAG_???");
 	tprintf(", sched_nice=%d", attr.sched_nice);
 	tprintf(", sched_priority=%u", attr.sched_priority);
 	tprintf(", sched_runtime=%" PRIu64, attr.sched_runtime);
diff --git a/scsi.c b/scsi.c
index 9038c3c..83ff8fe 100644
--- a/scsi.c
+++ b/scsi.c
@@ -42,29 +42,21 @@
 #  include "xlat/bsg_subprotocol.h"
 # endif
 
-static void
-print_sg_io_buffer(struct tcb *tcp, unsigned long addr, const unsigned int len)
+static bool
+print_uchar(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
-	unsigned char *buf = NULL;
-	unsigned int allocated, i;
+	tprintf("%02x", (unsigned int) (* (unsigned char *) elem_buf));
 
-	tprints("[");
-	if (len == 0)
-		goto out;
-	allocated = (len > max_strlen) ? max_strlen : len;
-	buf = malloc(allocated);
-	if (!buf || umoven(tcp, addr, allocated, buf) < 0) {
-		printaddr(addr);
-		goto out;
-	}
-	tprintf("%02x", buf[0]);
-	for (i = 1; i < allocated; ++i)
-		tprintf(", %02x", buf[i]);
-	if (allocated != len)
-		tprints(", ...");
-out:
-	free(buf);
-	tprints("]");
+	return true;
+}
+
+static void
+print_sg_io_buffer(struct tcb *tcp, const unsigned long addr, const unsigned int len)
+{
+	unsigned char buf;
+
+	print_array(tcp, addr, len, &buf, sizeof(buf),
+		    umoven_or_printaddr, print_uchar, 0);
 }
 
 static int
@@ -154,7 +146,7 @@
 	printxval(bsg_subprotocol, sg_io.subprotocol, "BSG_SUB_PROTOCOL_???");
 	tprintf(", request[%u]=", sg_io.request_len);
 	print_sg_io_buffer(tcp, sg_io.request, sg_io.request_len);
-	tprintf(", request_tag=%llu", (unsigned long long) sg_io.request_tag);
+	tprintf(", request_tag=%" PRI__u64, sg_io.request_tag);
 	tprintf(", request_attr=%u", sg_io.request_attr);
 	tprintf(", request_priority=%u", sg_io.request_priority);
 	tprintf(", request_extra=%u", sg_io.request_extra);
@@ -166,7 +158,7 @@
 	tprintf(", din_xfer_len=%u", sg_io.din_xfer_len);
 	tprintf(", timeout=%u", sg_io.timeout);
 	tprintf(", flags=%u", sg_io.flags);
-	tprintf(", usr_ptr=%llu", (unsigned long long) sg_io.usr_ptr);
+	tprintf(", usr_ptr=%" PRI__u64, sg_io.usr_ptr);
 	tprintf(", spare_in=%u", sg_io.spare_in);
 	tprintf(", dout[%u]=", sg_io.dout_xfer_len);
 	if (sg_io.dout_iovec_count)
@@ -208,7 +200,7 @@
 	tprintf(", response_len=%u", sg_io.response_len);
 	tprintf(", din_resid=%u", sg_io.din_resid);
 	tprintf(", dout_resid=%u", sg_io.dout_resid);
-	tprintf(", generated_tag=%llu", (unsigned long long) sg_io.generated_tag);
+	tprintf(", generated_tag=%" PRI__u64, sg_io.generated_tag);
 	tprintf(", spare_out=%u", sg_io.spare_out);
 }
 
diff --git a/seccomp.c b/seccomp.c
index 71cda7d..4d8d7e4 100644
--- a/seccomp.c
+++ b/seccomp.c
@@ -68,46 +68,48 @@
 	switch (BPF_CLASS(code)) {
 		case BPF_LD:
 		case BPF_LDX:
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_size, BPF_SIZE(code), "BPF_???");
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_mode, BPF_MODE(code), "BPF_???");
 			break;
 		case BPF_ST:
 		case BPF_STX:
 			if (i)
-				tprintf(" | %#x /* %s */", i, "BPF_???");
+				tprintf("|%#x /* %s */", i, "BPF_???");
 			break;
 		case BPF_ALU:
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_src, BPF_SRC(code), "BPF_???");
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_op_alu, BPF_OP(code), "BPF_???");
 			break;
 		case BPF_JMP:
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_src, BPF_SRC(code), "BPF_???");
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_op_jmp, BPF_OP(code), "BPF_???");
 			break;
 		case BPF_RET:
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_rval, BPF_RVAL(code), "BPF_???");
 			i &= ~BPF_RVAL(code);
 			if (i)
-				tprintf(" | %#x /* %s */", i, "BPF_???");
+				tprintf("|%#x /* %s */", i, "BPF_???");
 			break;
 		case BPF_MISC:
-			tprints(" | ");
+			tprints("|");
 			printxval(bpf_miscop, BPF_MISCOP(code), "BPF_???");
 			i &= ~BPF_MISCOP(code);
 			if (i)
-				tprintf(" | %#x /* %s */", i, "BPF_???");
+				tprintf("|%#x /* %s */", i, "BPF_???");
 			break;
 	}
 
 }
 
+#endif /* HAVE_LINUX_FILTER_H */
+
 static void
 decode_bpf_stmt(const struct bpf_filter *filter)
 {
@@ -121,7 +123,7 @@
 
 		printxval(seccomp_ret_action, action, "SECCOMP_RET_???");
 		if (data)
-			tprintf(" | %#x)", data);
+			tprintf("|%#x)", data);
 		else
 			tprints(")");
 	} else {
@@ -146,47 +148,40 @@
 #endif /* HAVE_LINUX_FILTER_H */
 }
 
-static void
-decode_filter(const struct bpf_filter *filter)
-{
-	if (filter->jt || filter->jf)
-		decode_bpf_jump(filter);
-	else
-		decode_bpf_stmt(filter);
-}
-
-#endif /* HAVE_LINUX_FILTER_H */
-
 #ifndef BPF_MAXINSNS
 # define BPF_MAXINSNS 4096
 #endif
 
-static void
-decode_fprog(struct tcb *tcp, unsigned short len, unsigned long addr)
+static bool
+print_bpf_filter(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
-	if (!len || abbrev(tcp)) {
-		tprintf("{len = %u, filter = ", len);
+	const struct bpf_filter *filter = elem_buf;
+	unsigned int *pn = data;
+
+	if ((*pn)++ >= BPF_MAXINSNS) {
+		tprints("...");
+		return false;
+	}
+
+	if (filter->jt || filter->jf)
+		decode_bpf_jump(filter);
+	else
+		decode_bpf_stmt(filter);
+
+	return true;
+}
+
+void
+print_seccomp_fprog(struct tcb *tcp, unsigned long addr, unsigned short len)
+{
+	if (abbrev(tcp)) {
 		printaddr(addr);
-		tprints("}");
 	} else {
-		unsigned int i = 0;
+		unsigned int insns = 0;
+		struct bpf_filter filter;
 
-		tprints("[");
-		while (i < len && i < BPF_MAXINSNS) {
-			struct bpf_filter filter;
-
-			if (umove(tcp, addr, &filter) < 0)
-				break;
-			if (i)
-				tprints(", ");
-			decode_filter(&filter);
-
-			addr += sizeof(filter);
-			++i;
-		}
-		if (i < len)
-			tprints("...");
-		tprints("]");
+		print_array(tcp, addr, len, &filter, sizeof(filter),
+			    umoven_or_printaddr, print_bpf_filter, &insns);
 	}
 }
 
@@ -197,8 +192,11 @@
 {
 	struct seccomp_fprog fprog;
 
-	if (fetch_seccomp_fprog(tcp, addr, &fprog))
-		decode_fprog(tcp, fprog.len, fprog.filter);
+	if (fetch_seccomp_fprog(tcp, addr, &fprog)) {
+		tprintf("{len=%hu, filter=", fprog.len);
+		print_seccomp_fprog(tcp, fprog.filter, fprog.len);
+		tprints("}");
+	}
 }
 
 static void
diff --git a/sen.h b/sen.h
index 36c177c..bf6cdfd 100644
--- a/sen.h
+++ b/sen.h
@@ -233,6 +233,7 @@
 SEN_prctl,
 SEN_pread,
 SEN_preadv,
+SEN_preadv2,
 SEN_prlimit64,
 SEN_process_vm_readv,
 SEN_process_vm_writev,
@@ -243,6 +244,7 @@
 SEN_putpmsg,
 SEN_pwrite,
 SEN_pwritev,
+SEN_pwritev2,
 SEN_query_module,
 SEN_quotactl,
 SEN_read,
diff --git a/signal.c b/signal.c
index ad1d967..f089050 100644
--- a/signal.c
+++ b/signal.c
@@ -451,8 +451,8 @@
 
 SYS_FUNC(kill)
 {
-	tprintf("%ld, %s",
-		widen_to_long(tcp->u_arg[0]),
+	tprintf("%d, %s",
+		(int) tcp->u_arg[0],
 		signame(tcp->u_arg[1]));
 
 	return RVAL_DECODED;
@@ -460,9 +460,9 @@
 
 SYS_FUNC(tgkill)
 {
-	tprintf("%ld, %ld, %s",
-		widen_to_long(tcp->u_arg[0]),
-		widen_to_long(tcp->u_arg[1]),
+	tprintf("%d, %d, %s",
+		(int) tcp->u_arg[0],
+		(int) tcp->u_arg[1],
 		signame(tcp->u_arg[2]));
 
 	return RVAL_DECODED;
diff --git a/sock.c b/sock.c
index 4da5302..c948294 100644
--- a/sock.c
+++ b/sock.c
@@ -27,15 +27,11 @@
 
 #include "defs.h"
 #include <sys/socket.h>
+#if defined ALPHA || defined SH || defined SH64
+# include <linux/ioctl.h>
+#endif
 #include <linux/sockios.h>
 #include <arpa/inet.h>
-#if defined(ALPHA) || defined(SH) || defined(SH64)
-# if defined(HAVE_SYS_IOCTL_H)
-#  include <sys/ioctl.h>
-# elif defined(HAVE_IOCTLS_H)
-#  include <ioctls.h>
-# endif
-#endif
 #include <net/if.h>
 
 #include "xlat/iffflags.h"
@@ -101,7 +97,7 @@
 	case SIOCSIFFLAGS:
 	case SIOCGIFFLAGS:
 		tprints("ifr_flags=");
-		printflags(iffflags, ifr->ifr_flags, "IFF_???");
+		printflags(iffflags, (unsigned short) ifr->ifr_flags, "IFF_???");
 		break;
 	case SIOCSIFMETRIC:
 	case SIOCGIFMETRIC:
diff --git a/socketutils.c b/socketutils.c
index 640c673..5d8d3ed 100644
--- a/socketutils.c
+++ b/socketutils.c
@@ -34,7 +34,9 @@
 #include <linux/sock_diag.h>
 #include <linux/inet_diag.h>
 #include <linux/unix_diag.h>
+#include <linux/netlink_diag.h>
 #include <linux/rtnetlink.h>
+#include "xlat/netlink_protocols.h"
 
 #if !defined NETLINK_SOCK_DIAG && defined NETLINK_INET_DIAG
 # define NETLINK_SOCK_DIAG NETLINK_INET_DIAG
@@ -78,29 +80,14 @@
 }
 
 static bool
-inet_send_query(const int fd, const int family, const int proto)
+send_query(const int fd, void *req, size_t req_size)
 {
 	struct sockaddr_nl nladdr = {
 		.nl_family = AF_NETLINK
 	};
-	struct {
-		const struct nlmsghdr nlh;
-		const struct inet_diag_req_v2 idr;
-	} req = {
-		.nlh = {
-			.nlmsg_len = sizeof(req),
-			.nlmsg_type = SOCK_DIAG_BY_FAMILY,
-			.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST
-		},
-		.idr = {
-			.sdiag_family = family,
-			.sdiag_protocol = proto,
-			.idiag_states = -1
-		}
-	};
 	struct iovec iov = {
-		.iov_base = &req,
-		.iov_len = sizeof(req)
+		.iov_base = req,
+		.iov_len = req_size
 	};
 	const struct msghdr msg = {
 		.msg_name = &nladdr,
@@ -119,6 +106,27 @@
 	}
 }
 
+static bool
+inet_send_query(const int fd, const int family, const int proto)
+{
+	struct {
+		const struct nlmsghdr nlh;
+		const struct inet_diag_req_v2 idr;
+	} req = {
+		.nlh = {
+			.nlmsg_len = sizeof(req),
+			.nlmsg_type = SOCK_DIAG_BY_FAMILY,
+			.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST
+		},
+		.idr = {
+			.sdiag_family = family,
+			.sdiag_protocol = proto,
+			.idiag_states = -1
+		}
+	};
+	return send_query(fd, &req, sizeof(req));
+}
+
 static int
 inet_parse_response(const char *const proto_name, const void *const data,
 		    const int data_len, const unsigned long inode)
@@ -179,13 +187,17 @@
 		  int (* parser) (const char *, const void *,
 				  int, unsigned long))
 {
-	static long buf[8192 / sizeof(long)];
+	static union {
+		struct nlmsghdr hdr;
+		long buf[8192 / sizeof(long)];
+	} hdr_buf;
+
 	struct sockaddr_nl nladdr = {
 		.nl_family = AF_NETLINK
 	};
 	struct iovec iov = {
-		.iov_base = buf,
-		.iov_len = sizeof(buf)
+		.iov_base = hdr_buf.buf,
+		.iov_len = sizeof(hdr_buf.buf)
 	};
 	int flags = 0;
 
@@ -204,7 +216,7 @@
 			return false;
 		}
 
-		const struct nlmsghdr *h = (struct nlmsghdr *) buf;
+		const struct nlmsghdr *h = &hdr_buf.hdr;
 		if (!NLMSG_OK(h, ret))
 			return false;
 		for (; NLMSG_OK(h, ret); h = NLMSG_NEXT(h, ret)) {
@@ -232,9 +244,6 @@
 static bool
 unix_send_query(const int fd, const unsigned long inode)
 {
-	struct sockaddr_nl nladdr = {
-		.nl_family = AF_NETLINK
-	};
 	struct {
 		const struct nlmsghdr nlh;
 		const struct unix_diag_req udr;
@@ -251,25 +260,7 @@
 			.udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_PEER
 		}
 	};
-	struct iovec iov = {
-		.iov_base = &req,
-		.iov_len = sizeof(req)
-	};
-	const struct msghdr msg = {
-		.msg_name = &nladdr,
-		.msg_namelen = sizeof(nladdr),
-		.msg_iov = &iov,
-		.msg_iovlen = 1
-	};
-
-	for (;;) {
-		if (sendmsg(fd, &msg, 0) < 0) {
-			if (errno == EINTR)
-				continue;
-			return false;
-		}
-		return true;
-	}
+	return send_query(fd, &req, sizeof(req));
 }
 
 static int
@@ -350,6 +341,65 @@
 }
 
 static bool
+netlink_send_query(const int fd, const unsigned long inode)
+{
+	struct {
+		const struct nlmsghdr nlh;
+		const struct netlink_diag_req ndr;
+	} req = {
+		.nlh = {
+			.nlmsg_len = sizeof(req),
+			.nlmsg_type = SOCK_DIAG_BY_FAMILY,
+			.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST
+		},
+		.ndr = {
+			.sdiag_family = AF_NETLINK,
+			.sdiag_protocol = NDIAG_PROTO_ALL,
+			.ndiag_show = NDIAG_SHOW_MEMINFO
+		}
+	};
+	return send_query(fd, &req, sizeof(req));
+}
+
+static int
+netlink_parse_response(const char *proto_name, const void *data,
+		    const int data_len, const unsigned long inode)
+{
+	const struct netlink_diag_msg *const diag_msg = data;
+	const char *netlink_proto;
+	char *details;
+
+	if (data_len < (int) NLMSG_LENGTH(sizeof(*diag_msg)))
+		return -1;
+	if (diag_msg->ndiag_ino != inode)
+		return 0;
+
+	if (diag_msg->ndiag_family != AF_NETLINK)
+		return -1;
+
+	netlink_proto = xlookup(netlink_protocols,
+				diag_msg->ndiag_protocol);
+
+	if (netlink_proto) {
+		static const char netlink_prefix[] = "NETLINK_";
+		const size_t netlink_prefix_len =
+			sizeof(netlink_prefix) -1;
+		if (strncmp(netlink_proto, netlink_prefix,
+			    netlink_prefix_len) == 0)
+			netlink_proto += netlink_prefix_len;
+		if (asprintf(&details, "%s:[%s:%u]", proto_name,
+			     netlink_proto, diag_msg->ndiag_portid) < 0)
+			return -1;
+	} else {
+		if (asprintf(&details, "%s:[%u]", proto_name,
+			     (unsigned) diag_msg->ndiag_protocol) < 0)
+			return -1;
+	}
+
+	return cache_and_print_inode_details(inode, details);
+}
+
+static bool
 unix_print(const int fd, const unsigned long inode)
 {
 	return unix_send_query(fd, inode)
@@ -380,6 +430,14 @@
 	return inet_print(fd, AF_INET6, IPPROTO_UDP, inode, "UDPv6");
 }
 
+static bool
+netlink_print(const int fd, const unsigned long inode)
+{
+	return netlink_send_query(fd, inode)
+		&& receive_responses(fd, inode, "NETLINK",
+				     netlink_parse_response);
+}
+
 /* Given an inode number of a socket, print out the details
  * of the ip address and port. */
 bool
@@ -393,7 +451,8 @@
 		{ "UDP", udp_v4_print },
 		{ "TCPv6", tcp_v6_print },
 		{ "UDPv6", udp_v6_print },
-		{ "UNIX", unix_print }
+		{ "UNIX", unix_print },
+		{ "NETLINK", netlink_print }
 	};
 
 	const int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG);
diff --git a/sram_alloc.c b/sram_alloc.c
index ec463a6..969e10e 100644
--- a/sram_alloc.c
+++ b/sram_alloc.c
@@ -11,7 +11,7 @@
 	/* size */
 	tprintf("%lu, ", tcp->u_arg[0]);
 	/* flags */
-	printflags(sram_alloc_flags, tcp->u_arg[1], "???_SRAM");
+	printflags_long(sram_alloc_flags, tcp->u_arg[1], "???_SRAM");
 
 	return RVAL_DECODED | RVAL_HEX;
 }
diff --git a/statfs.c b/statfs.c
index bd3c7ba..00dd04c 100644
--- a/statfs.c
+++ b/statfs.c
@@ -1,83 +1,4 @@
-/*
- * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
- * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
- * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
- * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
- * Copyright (c) 2003 Ulrich Drepper <drepper@redhat.com>
- * Copyright (c) 2012 Andreas Schwab <schwab@linux-m68k.org>
- * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
 #include "defs.h"
-#ifdef HAVE_SYS_VFS_H
-# include <sys/vfs.h>
-#endif
-#include "xlat/fsmagic.h"
-
-static const char *
-sprintfstype(const unsigned int magic)
-{
-	static char buf[32];
-	const char *s;
-
-	s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic);
-	if (s) {
-		sprintf(buf, "\"%s\"", s);
-		return buf;
-	}
-	sprintf(buf, "%#x", magic);
-	return buf;
-}
-
-static void
-printstatfs(struct tcb *tcp, const long addr)
-{
-	struct statfs statbuf;
-
-	if (umove_or_printaddr(tcp, addr, &statbuf))
-		return;
-	tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
-		sprintfstype(statbuf.f_type),
-		(unsigned long)statbuf.f_bsize,
-		(unsigned long)statbuf.f_blocks,
-		(unsigned long)statbuf.f_bfree);
-	tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
-		(unsigned long)statbuf.f_bavail,
-		(unsigned long)statbuf.f_files,
-		(unsigned long)statbuf.f_ffree,
-		statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
-	tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
-#ifdef _STATFS_F_FRSIZE
-	tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
-#endif
-#ifdef _STATFS_F_FLAGS
-	tprintf(", f_flags=%lu", (unsigned long)statbuf.f_flags);
-#endif
-	tprints("}");
-}
 
 SYS_FUNC(statfs)
 {
@@ -85,151 +6,7 @@
 		printpath(tcp, tcp->u_arg[0]);
 		tprints(", ");
 	} else {
-		printstatfs(tcp, tcp->u_arg[1]);
+		print_struct_statfs(tcp, tcp->u_arg[1]);
 	}
 	return 0;
 }
-
-SYS_FUNC(fstatfs)
-{
-	if (entering(tcp)) {
-		printfd(tcp, tcp->u_arg[0]);
-		tprints(", ");
-	} else {
-		printstatfs(tcp, tcp->u_arg[1]);
-	}
-	return 0;
-}
-
-#ifdef HAVE_STRUCT_STATFS64
-static void
-printstatfs64(struct tcb *tcp, long addr)
-{
-	struct statfs64 statbuf;
-
-	if (umove_or_printaddr(tcp, addr, &statbuf))
-		return;
-	tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
-		sprintfstype(statbuf.f_type),
-		(unsigned long long)statbuf.f_bsize,
-		(unsigned long long)statbuf.f_blocks,
-		(unsigned long long)statbuf.f_bfree);
-	tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
-		(unsigned long long)statbuf.f_bavail,
-		(unsigned long long)statbuf.f_files,
-		(unsigned long long)statbuf.f_ffree,
-		statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
-	tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
-#ifdef _STATFS_F_FRSIZE
-	tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
-#endif
-#ifdef _STATFS_F_FLAGS
-	tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
-#endif
-	tprints("}");
-}
-
-struct compat_statfs64 {
-	uint32_t f_type;
-	uint32_t f_bsize;
-	uint64_t f_blocks;
-	uint64_t f_bfree;
-	uint64_t f_bavail;
-	uint64_t f_files;
-	uint64_t f_ffree;
-	fsid_t f_fsid;
-	uint32_t f_namelen;
-	uint32_t f_frsize;
-	uint32_t f_flags;
-	uint32_t f_spare[4];
-}
-#if defined AARCH64 || defined X86_64 || defined X32 || defined IA64
-  ATTRIBUTE_PACKED ATTRIBUTE_ALIGNED(4)
-#endif
-;
-#if defined AARCH64 || defined ARM
-/* See arch/arm/kernel/sys_oabi-compat.c for details. */
-# define COMPAT_STATFS64_PADDED_SIZE (sizeof(struct compat_statfs64) + 4)
-#endif
-
-static void
-printcompat_statfs64(struct tcb *tcp, const long addr)
-{
-	struct compat_statfs64 statbuf;
-
-	if (umove_or_printaddr(tcp, addr, &statbuf))
-		return;
-	tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
-		sprintfstype(statbuf.f_type),
-		(unsigned long)statbuf.f_bsize,
-		(unsigned long long)statbuf.f_blocks,
-		(unsigned long long)statbuf.f_bfree);
-	tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
-		(unsigned long long)statbuf.f_bavail,
-		(unsigned long long)statbuf.f_files,
-		(unsigned long long)statbuf.f_ffree,
-		statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
-	tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
-	tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
-	tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
-}
-
-static int
-do_statfs64_fstatfs64(struct tcb *tcp)
-{
-	if (entering(tcp)) {
-		tprintf(", %lu, ", tcp->u_arg[1]);
-	} else {
-		if (tcp->u_arg[1] == sizeof(struct statfs64))
-			printstatfs64(tcp, tcp->u_arg[2]);
-		else if (tcp->u_arg[1] == sizeof(struct compat_statfs64)
-#ifdef COMPAT_STATFS64_PADDED_SIZE
-			 || tcp->u_arg[1] == COMPAT_STATFS64_PADDED_SIZE
-#endif
-									)
-			printcompat_statfs64(tcp, tcp->u_arg[2]);
-		else
-			tprints("{???}");
-	}
-	return 0;
-}
-
-SYS_FUNC(statfs64)
-{
-	if (entering(tcp))
-		printpath(tcp, tcp->u_arg[0]);
-	return do_statfs64_fstatfs64(tcp);
-}
-
-SYS_FUNC(fstatfs64)
-{
-	if (entering(tcp))
-		printfd(tcp, tcp->u_arg[0]);
-	return do_statfs64_fstatfs64(tcp);
-}
-#endif /* HAVE_STRUCT_STATFS64 */
-
-#ifdef ALPHA
-SYS_FUNC(osf_statfs)
-{
-	if (entering(tcp)) {
-		printpath(tcp, tcp->u_arg[0]);
-		tprints(", ");
-	} else {
-		printstatfs(tcp, tcp->u_arg[1]);
-		tprintf(", %lu", tcp->u_arg[2]);
-	}
-	return 0;
-}
-
-SYS_FUNC(osf_fstatfs)
-{
-	if (entering(tcp)) {
-		tprintf("%lu, ", tcp->u_arg[0]);
-	} else {
-		printstatfs(tcp, tcp->u_arg[1]);
-		tprintf(", %lu", tcp->u_arg[2]);
-	}
-	return 0;
-}
-#endif /* ALPHA */
diff --git a/statfs.h b/statfs.h
new file mode 100644
index 0000000..9341687
--- /dev/null
+++ b/statfs.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef STRACE_STATFS_H
+#define STRACE_STATFS_H
+
+struct strace_statfs {
+	unsigned long long f_type;
+	unsigned long long f_bsize;
+	unsigned long long f_blocks;
+	unsigned long long f_bfree;
+	unsigned long long f_bavail;
+	unsigned long long f_files;
+	unsigned long long f_ffree;
+	unsigned long f_fsid[2];
+	unsigned long long f_namelen;
+	unsigned long long f_frsize;
+	unsigned long long f_flags;
+};
+
+#endif /* STRACE_STATFS_H */
diff --git a/statfs64.c b/statfs64.c
new file mode 100644
index 0000000..f459831
--- /dev/null
+++ b/statfs64.c
@@ -0,0 +1,14 @@
+#include "defs.h"
+
+SYS_FUNC(statfs64)
+{
+	const unsigned long size = tcp->u_arg[1];
+
+	if (entering(tcp)) {
+		printpath(tcp, tcp->u_arg[0]);
+		tprintf(", %lu, ", size);
+	} else {
+		print_struct_statfs64(tcp, tcp->u_arg[2], size);
+	}
+	return 0;
+}
diff --git a/strace.1 b/strace.1
index 429cdfc..b7dddc0 100644
--- a/strace.1
+++ b/strace.1
@@ -325,7 +325,7 @@
 Print paths associated with file descriptor arguments.
 .TP
 .B \-yy
-Print ip:port pairs associated with socket file descriptors.
+Print protocol specific information associated with socket file descriptors.
 .TP
 .BI "\-a " column
 Align return values in a specific column (default column 40).
diff --git a/strace.c b/strace.c
index 49d6f3d..72343aa 100644
--- a/strace.c
+++ b/strace.c
@@ -218,7 +218,7 @@
   -x             print non-ascii strings in hex\n\
   -xx            print all strings in hex\n\
   -y             print paths associated with file descriptor arguments\n\
-  -yy            print ip:port pairs associated with socket file descriptors\n\
+  -yy            print protocol specific information associated with socket file descriptors\n\
 \n\
 Statistics:\n\
   -c             count time, calls, and errors for each syscall and report summary\n\
@@ -2066,7 +2066,7 @@
 		printleader(tcp);
 		if (si) {
 			tprintf("--- %s ", signame(sig));
-			printsiginfo(si, verbose(tcp));
+			printsiginfo(si);
 			tprints(" ---\n");
 		} else
 			tprintf("--- stopped by %s ---\n", signame(sig));
diff --git a/strace.spec b/strace.spec
index 1f14eb7..2548d55 100644
--- a/strace.spec
+++ b/strace.spec
@@ -1,11 +1,12 @@
 Summary: Tracks and displays system calls associated with a running process
 Name: strace
-Version: 4.11
-Release: 2%{?dist}
+Version: 4.12
+Release: 1%{?dist}
+%define srcname %name-%version
 License: BSD
 Group: Development/Debuggers
 URL: http://sourceforge.net/projects/strace/
-Source: http://downloads.sourceforge.net/strace/%{name}-%{version}.tar.xz
+Source: http://downloads.sourceforge.net/strace/%{srcname}.tar.xz
 BuildRequires: time
 %ifarch x86_64
 # for experimental -k option
@@ -43,9 +44,19 @@
 %endif
 
 %prep
-%setup -q
+%setup -q -n %{srcname}
 
 %build
+echo 'BEGIN OF BUILD ENVIRONMENT INFORMATION'
+uname -a |head -1
+libc="$(ldd /bin/sh |sed -n 's|^[^/]*\(/[^ ]*/libc\.so[^ ]*\).*|\1|p' |head -1)"
+$libc |head -1
+file -L /bin/sh
+gcc --version |head -1
+kver="$(echo -e '#include <linux/version.h>\nLINUX_VERSION_CODE' | gcc -E -P -)"
+printf 'kernel-headers %%s.%%s.%%s\n' $(($kver/65536)) $(($kver/256%%256)) $(($kver%%256))
+echo 'END OF BUILD ENVIRONMENT INFORMATION'
+
 %configure
 make %{?_smp_mflags}
 
@@ -67,7 +78,10 @@
 %endif
 
 %check
-make -k check VERBOSE=1
+make %{?_smp_mflags} -k check VERBOSE=1
+echo 'BEGIN OF TEST SUITE INFORMATION'
+tail -n 99999 -- tests*/test-suite.log tests*/ksysent.log
+echo 'END OF TEST SUITE INFORMATION'
 
 %files
 %doc CREDITS ChangeLog ChangeLog-CVS COPYING NEWS README
@@ -81,6 +95,16 @@
 %endif
 
 %changelog
+* Tue May 31 2016 Dmitry V. Levin <ldv@altlinux.org> - 4.12-1
+- 4.11.0.163.9720 -> 4.12.
+
+* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 4.11.0.163.9720-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Fri Jan 15 2016 Dmitry V. Levin <ldv@altlinux.org> - 4.11.0.163.9720-1
+- New upstream snapshot v4.11-163-g972018f:
+  + fixed decoding of syscalls unknown to the kernel on s390/s390x (#1298294).
+
 * Wed Dec 23 2015 Dmitry V. Levin <ldv@altlinux.org> - 4.11-2
 - Enabled experimental -k option on x86_64 (#1170296).
 
diff --git a/sync_file_range.c b/sync_file_range.c
index 17efa57..855e8af 100644
--- a/sync_file_range.c
+++ b/sync_file_range.c
@@ -27,9 +27,7 @@
  */
 
 #include "defs.h"
-
 #include <fcntl.h>
-
 #include "xlat/sync_file_range_flags.h"
 
 SYS_FUNC(sync_file_range)
@@ -44,17 +42,3 @@
 
 	return RVAL_DECODED;
 }
-
-SYS_FUNC(sync_file_range2)
-{
-	int argn;
-
-	printfd(tcp, tcp->u_arg[0]);
-	tprints(", ");
-	printflags(sync_file_range_flags, tcp->u_arg[1],
-		   "SYNC_FILE_RANGE_???");
-	argn = printllval(tcp, ", %lld, ", 2);
-	argn = printllval(tcp, "%lld", argn);
-
-	return RVAL_DECODED;
-}
diff --git a/sync_file_range2.c b/sync_file_range2.c
new file mode 100644
index 0000000..a1ef091
--- /dev/null
+++ b/sync_file_range2.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013 William Manley <william.manley@youview.com>
+ * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+#include <fcntl.h>
+#include "xlat/sync_file_range_flags.h"
+
+SYS_FUNC(sync_file_range2)
+{
+	int argn;
+
+	printfd(tcp, tcp->u_arg[0]);
+	tprints(", ");
+	printflags(sync_file_range_flags, tcp->u_arg[1],
+		   "SYNC_FILE_RANGE_???");
+	argn = printllval(tcp, ", %lld, ", 2);
+	argn = printllval(tcp, "%lld", argn);
+
+	return RVAL_DECODED;
+}
diff --git a/sys_func.h b/sys_func.h
index 17c1874..2e07b16 100644
--- a/sys_func.h
+++ b/sys_func.h
@@ -175,6 +175,7 @@
 extern SYS_FUNC(prctl);
 extern SYS_FUNC(pread);
 extern SYS_FUNC(preadv);
+extern SYS_FUNC(preadv2);
 extern SYS_FUNC(prlimit64);
 extern SYS_FUNC(process_vm_readv);
 extern SYS_FUNC(process_vm_writev);
@@ -182,6 +183,7 @@
 extern SYS_FUNC(ptrace);
 extern SYS_FUNC(pwrite);
 extern SYS_FUNC(pwritev);
+extern SYS_FUNC(pwritev2);
 extern SYS_FUNC(quotactl);
 extern SYS_FUNC(read);
 extern SYS_FUNC(readahead);
@@ -281,7 +283,6 @@
 extern SYS_FUNC(tgkill);
 extern SYS_FUNC(time);
 extern SYS_FUNC(timer_create);
-extern SYS_FUNC(timerfd);
 extern SYS_FUNC(timerfd_create);
 extern SYS_FUNC(timerfd_gettime);
 extern SYS_FUNC(timerfd_settime);
diff --git a/syscall.c b/syscall.c
index 6c5119f..d71ead3 100644
--- a/syscall.c
+++ b/syscall.c
@@ -686,6 +686,7 @@
 			return;
 		case SEN_readv:
 		case SEN_preadv:
+		case SEN_preadv2:
 			dumpiov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
 				     tcp->u_rval);
 			return;
@@ -707,6 +708,7 @@
 			break;
 		case SEN_writev:
 		case SEN_pwritev:
+		case SEN_pwritev2:
 		case SEN_vmsplice:
 			dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
 			break;
diff --git a/sysinfo.c b/sysinfo.c
index e418f95..c3cb9ad 100644
--- a/sysinfo.c
+++ b/sysinfo.c
@@ -59,19 +59,19 @@
 			", freehigh=%llu"
 			", mem_unit=%u"
 			"}",
-			(unsigned long long) si.uptime
-			, (unsigned long long) si.loads[0]
-			, (unsigned long long) si.loads[1]
-			, (unsigned long long) si.loads[2]
-			, (unsigned long long) si.totalram
-			, (unsigned long long) si.freeram
-			, (unsigned long long) si.sharedram
-			, (unsigned long long) si.bufferram
-			, (unsigned long long) si.totalswap
-			, (unsigned long long) si.freeswap
+			widen_to_ull(si.uptime)
+			, widen_to_ull(si.loads[0])
+			, widen_to_ull(si.loads[1])
+			, widen_to_ull(si.loads[2])
+			, widen_to_ull(si.totalram)
+			, widen_to_ull(si.freeram)
+			, widen_to_ull(si.sharedram)
+			, widen_to_ull(si.bufferram)
+			, widen_to_ull(si.totalswap)
+			, widen_to_ull(si.freeswap)
 			, (unsigned) si.procs
-			, (unsigned long long) si.totalhigh
-			, (unsigned long long) si.freehigh
+			, widen_to_ull(si.totalhigh)
+			, widen_to_ull(si.freehigh)
 			, si.mem_unit
 			);
 	}
diff --git a/sysmips.c b/sysmips.c
index 10b102a..bc3cb8d 100644
--- a/sysmips.c
+++ b/sysmips.c
@@ -45,7 +45,7 @@
 
 SYS_FUNC(sysmips)
 {
-	printxval(sysmips_operations, tcp->u_arg[0], "???");
+	printxval_long(sysmips_operations, tcp->u_arg[0], "???");
 	tprints(", ");
 
 	switch (tcp->u_arg[0]) {
diff --git a/term.c b/term.c
index c913a46..530ffc4 100644
--- a/term.c
+++ b/term.c
@@ -222,11 +222,11 @@
 	/* ioctls with a direct decodable arg */
 	case TCXONC:
 		tprints(", ");
-		printxval(tcxonc_options, arg, "TC???");
+		printxval_long(tcxonc_options, arg, "TC???");
 		break;
 	case TCFLSH:
 		tprints(", ");
-		printxval(tcflsh_options, arg, "TC???");
+		printxval_long(tcflsh_options, arg, "TC???");
 		break;
 	case TCSBRK:
 	case TCSBRKP:
diff --git a/tests/.gitignore b/tests/.gitignore
index ea67040..8f4d6f0 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -6,6 +6,7 @@
 *.tmp.*
 *.trs
 _newselect
+access
 acct
 adjtimex
 aio
@@ -14,9 +15,14 @@
 attach-p-cmd-cmd
 attach-p-cmd-p
 bpf
+brk
+btrfs
 caps
 chmod
+chown
+chown32
 chroot
+clock_adjtime
 clock_nanosleep
 clock_xettime
 copy_file_range
@@ -25,7 +31,11 @@
 dup
 dup2
 dup3
+epoll_create
 epoll_create1
+epoll_ctl
+epoll_pwait
+epoll_wait
 eventfd
 execve
 execve-v
@@ -33,83 +43,144 @@
 execveat-v
 faccessat
 fanotify_mark
+fchdir
 fchmod
 fchmodat
+fchown
+fchown32
 fchownat
 fcntl
 fcntl64
 fdatasync
 file_handle
+file_ioctl
 filter-unavailable
 flock
 fork-f
 fstat
 fstat64
 fstatat64
+fstatfs
+fstatfs64
 fsync
 ftruncate
 ftruncate64
+futimesat
+get_mempolicy
 getcwd
 getdents
 getdents64
+getegid
+getegid32
+geteuid
+geteuid32
+getgid
+getgid32
+getgroups
+getgroups32
+getpgrp
 getrandom
+getresgid
+getresgid32
+getresuid
+getresuid32
 getrusage
+getsid
+getuid
+getuid32
 getxxid
 inet-cmsg
 ioctl
+ioctl_block
+ioctl_evdev
+ioctl_evdev-v
+ioctl_mtd
+ioctl_rtc
+ioctl_rtc-v
+ioctl_uffdio
+ioctl_v4l2
+ioperm
+iopl
 ip_mreq
 ipc_msg
 ipc_msgbuf
 ipc_sem
 ipc_shm
+kill
 ksysent
 ksysent.h
+lchown
+lchown32
 libtests.a
+link
 linkat
 llseek
 lseek
 lstat
 lstat64
+mbind
 membarrier
 memfd_create
+migrate_pages
 mincore
+mkdir
 mkdirat
 mknod
+mknodat
+mlock
 mlock2
+mlockall
 mmap
 mmap64
 mmsg
+mount
+move_pages
 mq
+munlockall
 nanosleep
 net-accept-connect
+net-icmp_filter
 net-y-unix
 net-yy-inet
+net-yy-netlink
 net-yy-unix
 netlink_inet_diag
+netlink_netlink_diag
 netlink_unix_diag
 newfstatat
+nsyscalls
+old_mmap
 oldselect
 open
 openat
+pause
 pc
 personality
 pipe
 poll
 ppoll
+prctl-seccomp-filter-v
+prctl-seccomp-strict
 pread64-pwrite64
 preadv
 preadv-pwritev
+preadv2-pwritev2
 pselect6
+ptrace
 pwritev
 read-write
 readdir
 readlink
 readlinkat
 readv
+reboot
 recvmsg
+remap_file_pages
 rename
 renameat
+renameat2
 restart_syscall
+rmdir
 rt_sigpending
 rt_sigprocmask
 rt_sigqueueinfo
@@ -117,17 +188,43 @@
 rt_sigtimedwait
 rt_tgsigqueueinfo
 sched_get_priority_mxx
+sched_rr_get_interval
 sched_xetaffinity
 sched_xetattr
 sched_xetparam
 sched_xetscheduler
+sched_yield
 scm_rights
-seccomp
+seccomp-filter
+seccomp-filter-v
+seccomp-strict
 select
+semop
 sendfile
 sendfile64
+set_mempolicy
 set_ptracer_any
+setdomainname
+setfsgid
+setfsgid32
+setfsuid
+setfsuid32
+setgid
+setgid32
+setgroups
+setgroups32
 sethostname
+setregid
+setregid32
+setresgid
+setresgid32
+setresuid
+setresuid32
+setreuid
+setreuid32
+setuid
+setuid32
+shmxt
 sigaction
 sigaltstack
 signalfd
@@ -138,7 +235,11 @@
 stat
 stat64
 statfs
+statfs64
 swap
+symlink
+symlinkat
+sync
 sync_file_range
 sync_file_range2
 sysinfo
@@ -152,22 +253,23 @@
 times-fail
 truncate
 truncate64
-uid
-uid16
-uid32
 uio
 umask
 umount
 umount2
 umovestr
 umovestr2
+umovestr3
 uname
-unlinkat
 unix-pair-send-recv
+unlink
+unlinkat
 userfaultfd
 utime
 utimensat
+utimes
 vfork-f
+vhangup
 vmsplice
 wait
 xattr
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3d0b5d1..9eba306 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,12 +41,16 @@
 AM_LDFLAGS = $(ARCH_MFLAGS)
 
 libtests_a_SOURCES = \
+	errno2name.c \
 	error_msg.c \
 	get_page_size.c \
 	hexdump_strdup.c \
 	hexquote_strndup.c \
 	inode_of_sockfd.c \
+	overflowuid.c \
 	print_quoted_string.c \
+	printflags.c \
+	printxval.c \
 	tail_alloc.c \
 	tests.h \
 	tprintf.c \
@@ -57,6 +61,7 @@
 
 check_PROGRAMS = \
 	_newselect \
+	access \
 	acct \
 	adjtimex \
 	aio \
@@ -65,9 +70,14 @@
 	attach-p-cmd-cmd \
 	attach-p-cmd-p \
 	bpf \
+	brk \
+	btrfs \
 	caps \
 	chmod \
+	chown \
+	chown32 \
 	chroot \
+	clock_adjtime \
 	clock_nanosleep \
 	clock_xettime \
 	copy_file_range \
@@ -76,7 +86,11 @@
 	dup \
 	dup2 \
 	dup3 \
+	epoll_create \
 	epoll_create1 \
+	epoll_ctl \
+	epoll_pwait \
+	epoll_wait \
 	eventfd \
 	execve \
 	execve-v \
@@ -84,81 +98,142 @@
 	execveat-v \
 	faccessat \
 	fanotify_mark \
+	fchdir \
 	fchmod \
 	fchmodat \
+	fchown \
+	fchown32 \
 	fchownat \
 	fcntl \
 	fcntl64 \
 	fdatasync \
 	file_handle \
+	file_ioctl \
 	filter-unavailable \
 	flock \
 	fork-f \
 	fstat \
 	fstat64 \
 	fstatat64 \
+	fstatfs \
+	fstatfs64 \
 	fsync \
 	ftruncate \
 	ftruncate64 \
+	futimesat \
+	get_mempolicy \
 	getcwd \
 	getdents \
 	getdents64 \
+	getegid \
+	getegid32 \
+	geteuid \
+	geteuid32 \
+	getgid \
+	getgid32 \
+	getgroups \
+	getgroups32 \
+	getpgrp \
 	getrandom \
+	getresgid \
+	getresgid32 \
+	getresuid \
+	getresuid32 \
 	getrusage \
+	getsid \
+	getuid \
+	getuid32 \
 	getxxid \
 	inet-cmsg \
 	ioctl \
+	ioctl_block \
+	ioctl_evdev \
+	ioctl_evdev-v \
+	ioctl_mtd \
+	ioctl_rtc \
+	ioctl_rtc-v \
+	ioctl_uffdio \
+	ioctl_v4l2 \
+	ioperm \
+	iopl \
 	ip_mreq \
 	ipc_msg \
 	ipc_msgbuf \
 	ipc_sem \
 	ipc_shm \
+	kill \
 	ksysent \
+	lchown \
+	lchown32 \
+	link \
 	linkat \
 	llseek \
 	lseek \
 	lstat \
 	lstat64 \
+	mbind \
 	membarrier \
 	memfd_create \
+	migrate_pages \
 	mincore \
+	mkdir \
 	mkdirat \
 	mknod \
+	mknodat \
+	mlock \
 	mlock2 \
+	mlockall \
 	mmap \
 	mmap64 \
 	mmsg \
+	mount \
+	move_pages \
 	mq \
+	munlockall \
 	nanosleep \
 	net-accept-connect \
+	net-icmp_filter \
 	net-y-unix \
 	net-yy-inet \
+	net-yy-netlink \
 	net-yy-unix \
 	netlink_inet_diag \
+	netlink_netlink_diag \
 	netlink_unix_diag \
 	newfstatat \
+	nsyscalls \
+	old_mmap \
 	oldselect \
 	open \
 	openat \
+	pause \
 	pc \
 	personality \
 	pipe \
 	poll \
 	ppoll \
+	prctl-seccomp-filter-v \
+	prctl-seccomp-strict \
 	pread64-pwrite64 \
 	preadv \
 	preadv-pwritev \
+	preadv2-pwritev2 \
 	pselect6 \
+	ptrace \
 	pwritev \
 	read-write \
 	readdir \
 	readlink \
 	readlinkat \
 	readv \
+	reboot \
 	recvmsg \
+	remap_file_pages \
 	rename \
-	renameat\
+	renameat \
+	renameat2 \
 	restart_syscall \
+	rmdir \
 	rt_sigpending \
 	rt_sigprocmask \
 	rt_sigqueueinfo \
@@ -166,28 +241,58 @@
 	rt_sigtimedwait \
 	rt_tgsigqueueinfo \
 	sched_get_priority_mxx \
+	sched_rr_get_interval \
 	sched_xetaffinity \
 	sched_xetattr \
 	sched_xetparam \
 	sched_xetscheduler \
+	sched_yield \
 	scm_rights \
-	seccomp \
+	seccomp-filter \
+	seccomp-filter-v \
+	seccomp-strict \
 	select \
+	semop \
 	sendfile \
 	sendfile64 \
+	set_mempolicy \
 	set_ptracer_any \
+	setdomainname \
+	setfsgid \
+	setfsgid32 \
+	setfsuid \
+	setfsuid32 \
+	setgid \
+	setgid32 \
+	setgroups \
+	setgroups32 \
 	sethostname \
+	setregid \
+	setregid32 \
+	setresgid \
+	setresgid32 \
+	setresuid \
+	setresuid32 \
+	setreuid \
+	setreuid32 \
+	setuid \
+	setuid32 \
+	shmxt \
 	sigaction \
 	sigaltstack \
 	signalfd \
 	sigreturn \
+	sleep \
 	splice \
 	stack-fcall \
-	sleep \
 	stat \
 	stat64 \
 	statfs \
+	statfs64 \
 	swap \
+	symlink \
+	symlinkat \
+	sync \
 	sync_file_range \
 	sync_file_range2 \
 	sysinfo \
@@ -201,22 +306,23 @@
 	times-fail \
 	truncate \
 	truncate64 \
-	uid \
-	uid16 \
-	uid32 \
 	uio \
 	umask \
 	umount \
 	umount2 \
 	umovestr \
 	umovestr2 \
+	umovestr3 \
 	uname \
-	unlinkat \
 	unix-pair-send-recv \
+	unlink \
+	unlinkat \
 	userfaultfd \
 	utime \
 	utimensat \
+	utimes \
 	vfork-f \
+	vhangup \
 	vmsplice \
 	wait \
 	xattr \
@@ -260,14 +366,23 @@
 
 DECODER_TESTS = \
 	_newselect.test \
+	access.test \
 	acct.test \
 	adjtimex.test \
 	aio.test \
 	alarm.test \
 	bpf.test \
+	brk.test \
+	btrfs.test \
+	btrfs-v.test \
+	btrfs-w.test \
+	btrfs-vw.test \
 	caps.test \
 	chmod.test \
+	chown.test \
+	chown32.test \
 	chroot.test \
+	clock_adjtime.test \
 	clock_nanosleep.test \
 	clock_xettime.test \
 	copy_file_range.test \
@@ -275,82 +390,146 @@
 	dup.test \
 	dup2.test \
 	dup3.test \
+	epoll_create.test \
 	epoll_create1.test \
+	epoll_ctl.test \
+	epoll_pwait.test \
+	epoll_wait.test \
 	eventfd.test \
-	execve.test \
 	execve-v.test \
-	execveat.test \
+	execve.test \
 	execveat-v.test \
+	execveat.test \
 	faccessat.test \
 	fanotify_mark.test \
+	fchdir.test \
 	fchmod.test \
 	fchmodat.test \
+	fchown.test \
+	fchown32.test \
 	fchownat.test \
 	fcntl.test \
 	fcntl64.test \
 	fdatasync.test \
 	file_handle.test \
+	file_ioctl.test \
 	flock.test \
 	fstat.test \
 	fstat64.test \
 	fstatat64.test \
+	fstatfs.test \
+	fstatfs64.test \
 	fsync.test \
 	ftruncate.test \
 	ftruncate64.test \
+	futimesat.test \
+	get_mempolicy.test \
 	getcwd.test \
 	getdents.test \
 	getdents64.test \
+	getegid.test \
+	getegid32.test \
+	geteuid.test \
+	geteuid32.test \
+	getgid.test \
+	getgid32.test \
+	getgroups.test \
+	getgroups32.test \
+	getpgrp.test \
 	getrandom.test \
+	getresgid.test \
+	getresgid32.test \
+	getresuid.test \
+	getresuid32.test \
 	getrusage.test \
+	getsid.test \
+	getuid.test \
+	getuid32.test \
 	getxxid.test \
 	inet-cmsg.test \
 	ioctl.test \
+	ioctl_block.test \
+	ioctl_evdev.test \
+	ioctl_evdev-v.test \
+	ioctl_mtd.test \
+	ioctl_rtc.test \
+	ioctl_rtc-v.test \
+	ioctl_uffdio.test \
+	ioctl_v4l2.test \
+	ioperm.test \
+	iopl.test \
 	ip_mreq.test \
 	ipc_msg.test \
 	ipc_msgbuf.test \
 	ipc_sem.test \
 	ipc_shm.test \
+	kill.test \
+	lchown.test \
+	lchown32.test \
+	link.test \
 	linkat.test \
 	llseek.test \
 	lseek.test \
 	lstat.test \
 	lstat64.test \
+	mbind.test \
 	membarrier.test \
 	memfd_create.test \
+	migrate_pages.test \
 	mincore.test \
+	mkdir.test \
 	mkdirat.test \
 	mknod.test \
+	mknodat.test \
+	mlock.test \
 	mlock2.test \
+	mlockall.test \
 	mmap.test \
 	mmap64.test \
 	mmsg.test \
+	mount.test \
+	move_pages.test \
 	mq.test \
+	munlockall.test \
 	nanosleep.test \
+	net-icmp_filter.test \
 	net-y-unix.test \
 	net-yy-inet.test \
+	net-yy-netlink.test \
 	net-yy-unix.test \
 	net.test \
 	newfstatat.test \
+	nsyscalls.test \
+	old_mmap.test \
 	oldselect.test \
 	open.test \
 	openat.test \
+	pause.test \
 	personality.test \
 	pipe.test \
 	poll.test \
 	ppoll.test \
+	prctl-seccomp-filter-v.test \
+	prctl-seccomp-strict.test \
 	pread64-pwrite64.test \
-	preadv.test \
 	preadv-pwritev.test \
+	preadv2-pwritev2.test \
+	preadv.test \
 	pselect6.test \
+	ptrace.test \
 	pwritev.test \
 	read-write.test \
 	readdir.test \
 	readlink.test \
 	readlinkat.test \
 	readv.test \
+	reboot.test \
 	recvmsg.test \
+	remap_file_pages.test \
 	rename.test \
 	renameat.test \
+	renameat2.test \
+	rmdir.test \
 	rt_sigpending.test \
 	rt_sigprocmask.test \
 	rt_sigqueueinfo.test \
@@ -358,16 +537,42 @@
 	rt_sigtimedwait.test \
 	rt_tgsigqueueinfo.test \
 	sched_get_priority_mxx.test \
+	sched_rr_get_interval.test \
 	sched_xetaffinity.test \
 	sched_xetattr.test \
 	sched_xetparam.test \
 	sched_xetscheduler.test \
+	sched_yield.test \
 	scm_rights-fd.test \
-	seccomp.test \
+	seccomp-filter-v.test \
+	seccomp-filter.test \
+	seccomp-strict.test \
 	select.test \
+	semop.test \
 	sendfile.test \
 	sendfile64.test \
+	set_mempolicy.test \
+	setdomainname.test \
+	setfsgid.test \
+	setfsgid32.test \
+	setfsuid.test \
+	setfsuid32.test \
+	setgid.test \
+	setgid32.test \
+	setgroups.test \
+	setgroups32.test \
 	sethostname.test \
+	setregid.test \
+	setregid32.test \
+	setresgid.test \
+	setresgid32.test \
+	setresuid.test \
+	setresuid32.test \
+	setreuid.test \
+	setreuid32.test \
+	setuid.test \
+	setuid32.test \
+	shmxt.test \
 	sigaction.test \
 	sigaltstack.test \
 	signalfd.test \
@@ -376,8 +581,12 @@
 	stat.test \
 	stat64.test \
 	statfs.test \
+	statfs64.test \
 	sun_path.test \
 	swap.test \
+	symlink.test \
+	symlinkat.test \
+	sync.test \
 	sync_file_range.test \
 	sync_file_range2.test \
 	sysinfo.test \
@@ -391,20 +600,21 @@
 	times.test \
 	truncate.test \
 	truncate64.test \
-	uid.test \
-	uid16.test \
-	uid32.test \
 	uio.test \
 	umask.test \
 	umount.test \
 	umount2.test \
 	umovestr.test \
 	umovestr2.test \
+	umovestr3.test \
 	uname.test \
+	unlink.test \
 	unlinkat.test \
 	userfaultfd.test \
 	utime.test \
 	utimensat.test \
+	utimes.test \
+	vhangup.test \
 	vmsplice.test \
 	wait.test \
 	xattr.test \
@@ -433,8 +643,11 @@
 	qual_syscall.test \
 	redirect.test \
 	restart_syscall.test \
+	strace-S.test \
 	strace-T.test \
+	strace-V.test \
 	strace-f.test \
+	strace-ff.test \
 	strace-r.test \
 	strace-t.test \
 	strace-tt.test \
@@ -461,6 +674,7 @@
 	     filter-unavailable.expected \
 	     fstatat.c \
 	     fstatx.c \
+	     getresugid.c \
 	     ip_mreq.expected \
 	     ipc.sh \
 	     ipc_msgbuf.expected \
@@ -473,21 +687,28 @@
 	     pipe.expected \
 	     ppoll.expected \
 	     ppoll-v.expected \
+	     setfsugid.c \
+	     setreugid.c \
+	     setresugid.c \
+	     setugid.c \
 	     sigaction.awk \
 	     sigaltstack.expected \
 	     signalfd.expected \
 	     statfs.expected \
 	     statx.sh \
 	     strace-T.expected \
+	     strace-ff.expected \
 	     strace-r.expected \
 	     struct_flock.c \
 	     sun_path.expected \
-	     uid.awk \
 	     uio.expected \
 	     umovestr.expected \
 	     wait.expected \
-	     xattr.expected \
+	     xchownx.c \
 	     xselect.c \
+	     xstatfs.c \
+	     xstatfs64.c \
+	     xstatfsx.c \
 	     xstatx.c \
 	     $(TESTS)
 
diff --git a/tests/access.c b/tests/access.c
new file mode 100644
index 0000000..2920db5
--- /dev/null
+++ b/tests/access.c
@@ -0,0 +1,29 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_access
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "access_sample";
+
+	long rc = syscall(__NR_access, sample, F_OK);
+	printf("access(\"%s\", F_OK) = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	rc = syscall(__NR_access, sample, R_OK|W_OK|X_OK);
+	printf("access(\"%s\", R_OK|W_OK|X_OK) = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_access")
+
+#endif
diff --git a/tests/access.test b/tests/access.test
new file mode 100755
index 0000000..3ab2eb4
--- /dev/null
+++ b/tests/access.test
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Check access syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+check_prog grep
+run_prog > /dev/null
+run_strace -eaccess -a30 $args > "$EXP"
+
+# Filter out access() calls made by libc.
+grep -F access_sample < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
diff --git a/tests/acct.c b/tests/acct.c
index 5a9545a..ef11b0b 100644
--- a/tests/acct.c
+++ b/tests/acct.c
@@ -3,30 +3,17 @@
 
 #ifdef __NR_acct
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
-# define TMP_FILE "acct_tmpfile"
-
 int
 main(void)
 {
-	assert(syscall(__NR_acct, TMP_FILE) == -1);
-	const char *errno_text;
-	switch(errno) {
-		case ENOSYS:
-			errno_text = "ENOSYS";
-			break;
-		case EPERM:
-			errno_text = "EPERM";
-			break;
-		default:
-			errno_text = "ENOENT";
-	}
-	printf("acct(\"%s\") = -1 %s (%m)\n",
-	       TMP_FILE, errno_text);
+	const char sample[] = "acct_sample";
+
+	long rc = syscall(__NR_acct, sample);
+	printf("acct(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/acct.test b/tests/acct.test
index e68a6ca..b9bca75 100755
--- a/tests/acct.test
+++ b/tests/acct.test
@@ -3,4 +3,4 @@
 # Check acct syscall decoding.
 
 . "${srcdir=.}/init.sh"
-run_strace_match_diff -a21
+run_strace_match_diff -a20
diff --git a/tests/aio.c b/tests/aio.c
index 5335a26..63a0fcb 100644
--- a/tests/aio.c
+++ b/tests/aio.c
@@ -27,7 +27,6 @@
 
 #include "tests.h"
 #include <assert.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <stdio.h>
@@ -147,6 +146,10 @@
 		perror_msg_and_skip("io_setup");
 	printf("io_setup(%u, [%lu]) = 0\n", nr, *ctx);
 
+	assert(syscall(__NR_io_submit, *ctx, -1L, cbs) == -1);
+	printf("io_submit(%lu, -1, %p) = -1 %s (%m)\n",
+	       *ctx, cbs, errno2name());
+
 	if (syscall(__NR_io_submit, *ctx, nr, cbs) != (long) nr)
 		perror_msg_and_skip("io_submit");
 	printf("io_submit(%lu, %u, ["
@@ -172,10 +175,10 @@
 	       (unsigned long long) cb[1].aio_data, &cb[1], sizeof_data1,
 	       nr);
 
-	assert(syscall(__NR_io_cancel, *ctx, cbc, ev) == -1 && EINVAL == errno);
+	assert(syscall(__NR_io_cancel, *ctx, cbc, ev) == -1);
 	printf("io_cancel(%lu, {data=%#llx, pread, reqprio=99, fildes=-42}, %p) "
-		"= -1 EINVAL (%m)\n",
-	       *ctx, (unsigned long long) cbc->aio_data, ev);
+		"= -1 %s (%m)\n",
+	       *ctx, (unsigned long long) cbc->aio_data, ev, errno2name());
 
 	if (syscall(__NR_io_submit, *ctx, nr, cbvs) != (long) nr)
 		perror_msg_and_skip("io_submit");
diff --git a/tests/attach-f-p.c b/tests/attach-f-p.c
index 51a5333..2184990 100644
--- a/tests/attach-f-p.c
+++ b/tests/attach-f-p.c
@@ -58,9 +58,9 @@
 };
 static const int sigs[N] = { SIGALRM, SIGUSR1, SIGUSR2 };
 static const struct itimerspec its[N] = {
-	{ .it_value.tv_nsec = 500000000 },
-	{ .it_value.tv_nsec = 700000000 },
-	{ .it_value.tv_nsec = 900000000 },
+	{ .it_value.tv_sec = 1 },
+	{ .it_value.tv_sec = 2 },
+	{ .it_value.tv_sec = 3 }
 };
 static thread_arg_t args[N] = {
 	{ .no = 0 },
@@ -84,6 +84,7 @@
 int
 main(void)
 {
+	static timer_t timerid[N];
 	pthread_t t[N];
 	unsigned int i;
 
@@ -101,11 +102,10 @@
 			.sigev_notify = SIGEV_SIGNAL,
 			.sigev_signo = sigs[i]
 		};
-		timer_t timerid;
-		if (timer_create(CLOCK_MONOTONIC, &sev, &timerid))
+		if (timer_create(CLOCK_MONOTONIC, &sev, &timerid[i]))
 			perror_msg_and_skip("timer_create");
 
-		if (timer_settime(timerid, 0, &its[i], NULL))
+		if (timer_settime(timerid[i], 0, &its[i], NULL))
 			perror_msg_and_fail("timer_settime");
 
 		errno = pthread_create(&t[i], NULL, thread, (void *) &args[i]);
@@ -127,6 +127,14 @@
 		       retval.pid, child[i], retval.pid);
 	}
 
+	/* sleep a bit more to late the tracer catch up */
+	if (timer_settime(timerid[0], 0, &its[0], NULL))
+		perror_msg_and_fail("timer_settime");
+	int signo;
+	errno = sigwait(&args[0].set, &signo);
+	if (errno)
+		perror_msg_and_fail("sigwait");
+
 	pid_t pid = getpid();
 	assert(chdir(text_parent) == -1);
 
diff --git a/tests/attach-p-cmd-cmd.c b/tests/attach-p-cmd-cmd.c
index 28f5e35..d2b3ca1 100644
--- a/tests/attach-p-cmd-cmd.c
+++ b/tests/attach-p-cmd-cmd.c
@@ -36,8 +36,8 @@
 main(void)
 {
 	static const char text[] = "attach-p-cmd.test cmd";
-	assert(chdir(text) == -1);
 	pid_t pid = getpid();
+	assert(chdir(text) == -1);
 	printf("%-5d chdir(\"%s\") = -1 ENOENT (%m)\n"
 	       "%-5d +++ exited with 0 +++\n", pid, text, pid);
 	return 0;
diff --git a/tests/brk.c b/tests/brk.c
new file mode 100644
index 0000000..ed311aa
--- /dev/null
+++ b/tests/brk.c
@@ -0,0 +1,22 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_brk
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	long rc = syscall(__NR_brk, NULL);
+	printf("brk\\(NULL\\) = %#lx\n", rc);
+
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_brk")
+
+#endif
diff --git a/tests/brk.test b/tests/brk.test
new file mode 100755
index 0000000..8c0e2e4
--- /dev/null
+++ b/tests/brk.test
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Check brk syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+run_strace -a10 -ebrk $args > "$EXP"
+match_grep "$LOG" "$EXP"
+rm -f "$EXP"
diff --git a/tests/btrfs-v.test b/tests/btrfs-v.test
new file mode 100755
index 0000000..1ee17b4
--- /dev/null
+++ b/tests/btrfs-v.test
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Check verbose decoding of btrfs ioctl
+
+. "${srcdir=.}/init.sh"
+
+run_prog ./btrfs -v > /dev/null
+run_strace -a16 -veioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
+
+exit 0
diff --git a/tests/btrfs-vw.test b/tests/btrfs-vw.test
new file mode 100755
index 0000000..c7e40ad
--- /dev/null
+++ b/tests/btrfs-vw.test
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check verbose decoding of btrfs ioctl w/ live ioctls.
+
+# WARNING: USE OF THIS TEST WILL MODIFY AN EXISTING BTRFS FILE SYSTEM
+
+# Typical usage:
+# mkfs.btrfs <dev>
+# mount <dev> /mnt
+# BTRFS_MOUNTPOINT=/mnt make check TESTS="btrfs-vw"
+# umount /mnt
+
+. "${srcdir=.}/init.sh"
+
+if [ -z "${BTRFS_MOUNTPOINT}" ]; then
+    skip_ "\$BTRFS_MOUNTPOINT not set"
+elif [ ! -d "${BTRFS_MOUNTPOINT}" ]; then
+    skip_ "\$BTRFS_MOUNTPOINT does not point to a directory"
+fi
+
+run_prog ./btrfs -v -w "${BTRFS_MOUNTPOINT}" > /dev/null
+run_strace -a16 -veioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
+
+exit 0
diff --git a/tests/btrfs-w.test b/tests/btrfs-w.test
new file mode 100755
index 0000000..6238dca
--- /dev/null
+++ b/tests/btrfs-w.test
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check decoding of btrfs ioctl w/ live ioctls.
+
+# WARNING: USE OF THIS TEST WILL MODIFY AN EXISTING BTRFS FILE SYSTEM
+
+# Typical usage:
+# mkfs.btrfs <dev>
+# mount <dev> /mnt
+# BTRFS_MOUNTPOINT=/mnt make check TESTS="btrfs-w"
+# umount /mnt
+
+. "${srcdir=.}/init.sh"
+
+if [ -z "${BTRFS_MOUNTPOINT}" ]; then
+    skip_ "\$BTRFS_MOUNTPOINT not set"
+elif [ ! -d "${BTRFS_MOUNTPOINT}" ]; then
+    skip_ "\$BTRFS_MOUNTPOINT does not point to a directory"
+fi
+
+run_prog ./btrfs -w "${BTRFS_MOUNTPOINT}" > /dev/null
+run_strace -a16 -eioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
+
+exit 0
diff --git a/tests/btrfs.c b/tests/btrfs.c
new file mode 100644
index 0000000..4014c88
--- /dev/null
+++ b/tests/btrfs.c
@@ -0,0 +1,1920 @@
+#include "tests.h"
+
+#ifdef HAVE_LINUX_BTRFS_H
+
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/vfs.h>
+#include <linux/fs.h>
+#include <linux/btrfs.h>
+#include <linux/magic.h>
+#include "xlat.h"
+
+#include "xlat/btrfs_balance_args.h"
+#include "xlat/btrfs_balance_flags.h"
+#include "xlat/btrfs_balance_state.h"
+#include "xlat/btrfs_compress_types.h"
+#include "xlat/btrfs_defrag_flags.h"
+#include "xlat/btrfs_dev_stats_values.h"
+#include "xlat/btrfs_dev_stats_flags.h"
+#include "xlat/btrfs_qgroup_inherit_flags.h"
+#include "xlat/btrfs_qgroup_limit_flags.h"
+#include "xlat/btrfs_scrub_flags.h"
+#include "xlat/btrfs_send_flags.h"
+#include "xlat/btrfs_space_info_flags.h"
+#include "xlat/btrfs_snap_flags_v2.h"
+#include "xlat/btrfs_tree_objectids.h"
+#include "xlat/btrfs_features_compat.h"
+#include "xlat/btrfs_features_compat_ro.h"
+#include "xlat/btrfs_features_incompat.h"
+#include "xlat/btrfs_key_types.h"
+
+#ifdef HAVE_LINUX_FIEMAP_H
+# include <linux/fiemap.h>
+# include "xlat/fiemap_flags.h"
+# include "xlat/fiemap_extent_flags.h"
+#endif
+
+#ifndef BTRFS_LABEL_SIZE
+# define BTRFS_LABEL_SIZE 256
+#endif
+
+#ifndef BTRFS_NAME_LEN
+# define BTRFS_NAME_LEN 255
+#endif
+
+/*
+ * Prior to Linux 3.12, the BTRFS_IOC_DEFAULT_SUBVOL used u64 in
+ * its definition, which isn't exported by the kernel.
+ */
+typedef __u64 u64;
+
+static const char *btrfs_test_root;
+static int btrfs_test_dir_fd;
+static bool verbose = false;
+static bool write_ok = false;
+
+const unsigned char uuid_reference[BTRFS_UUID_SIZE] = {
+	0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
+	0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
+};
+
+const char uuid_reference_string[] = "01234567-89ab-cdef-fedc-ba9876543210";
+
+#ifndef BTRFS_IOC_GET_FEATURES
+# define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
+                                   struct btrfs_ioctl_feature_flags)
+# define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
+                                   struct btrfs_ioctl_feature_flags[2])
+# define BTRFS_IOC_GET_SUPPORTED_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \
+                                   struct btrfs_ioctl_feature_flags[3])
+#endif
+
+#ifndef HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS
+struct btrfs_ioctl_feature_flags {
+        uint64_t compat_flags;
+        uint64_t compat_ro_flags;
+        uint64_t incompat_flags;
+};
+#endif
+
+#ifndef HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START
+struct btrfs_ioctl_defrag_range_args {
+        uint64_t start;
+        uint64_t len;
+        uint64_t flags;
+        uint32_t extent_thresh;
+        uint32_t compress_type;
+        uint32_t unused[4];
+};
+#endif
+
+#ifndef FIDEDUPERANGE
+# define FIDEDUPERANGE   _IOWR(0x94, 54, struct file_dedupe_range)
+struct file_dedupe_range_info {
+	int64_t dest_fd;	/* in - destination file */
+	uint64_t dest_offset;	/* in - start of extent in destination */
+	uint64_t bytes_deduped;	/* out - total # of bytes we were able
+				 * to dedupe from this file. */
+	/* status of this dedupe operation:
+	 * < 0 for error
+	 * == FILE_DEDUPE_RANGE_SAME if dedupe succeeds
+	 * == FILE_DEDUPE_RANGE_DIFFERS if data differs
+	 */
+	int32_t status;		/* out - see above description */
+	uint32_t reserved;	/* must be zero */
+};
+
+struct file_dedupe_range {
+	uint64_t src_offset;	/* in - start of extent in source */
+	uint64_t src_length;	/* in - length of extent */
+	uint16_t dest_count;	/* in - total elements in info array */
+	uint16_t reserved1;	/* must be zero */
+	uint32_t reserved2;	/* must be zero */
+	struct file_dedupe_range_info info[0];
+};
+#endif
+
+#ifndef BTRFS_IOC_TREE_SEARCH_V2
+# define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
+                                           struct btrfs_ioctl_search_args_v2)
+struct btrfs_ioctl_search_args_v2 {
+	struct btrfs_ioctl_search_key key; /* in/out - search parameters */
+	uint64_t buf_size;		   /* in - size of buffer
+					    * out - on EOVERFLOW: needed size
+					    *       to store item */
+        uint64_t buf[0];		   /* out - found items */
+};
+#endif
+
+
+static const char *
+maybe_print_uint64max(uint64_t val)
+{
+	if (val == UINT64_MAX)
+		return " /* UINT64_MAX */";
+	return "";
+}
+
+/* takes highest valid flag bit */
+static uint64_t
+max_flags_plus_one(int bit)
+{
+	int i;
+	uint64_t val = 0;
+	if (bit == -1)
+		return 1;
+	for (i = 0; i <= bit + 1 && i < 64; i++)
+		val |= (1ULL << i);
+	return val;
+}
+
+/*
+ * Consumes no arguments, returns nothing:
+ *
+ * - BTRFS_IOC_TRANS_START
+ * - BTRFS_IOC_TRANS_END
+ */
+static void
+btrfs_test_trans_ioctls(void)
+{
+	ioctl(-1, BTRFS_IOC_TRANS_START, NULL);
+	printf("ioctl(-1, BTRFS_IOC_TRANS_START) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_TRANS_END, NULL);
+	printf("ioctl(-1, BTRFS_IOC_TRANS_END) = -1 EBADF (%m)\n");
+}
+
+/*
+ * Consumes no arguments, returns nothing:
+ * - BTRFS_IOC_SYNC
+ *
+ * Consumes argument, returns nothing
+ * - BTRFS_IOC_WAIT_SYNC
+ */
+static void
+btrfs_test_sync_ioctls(void)
+{
+	uint64_t u64val = 0xdeadbeefbadc0ded;
+
+	ioctl(-1, BTRFS_IOC_SYNC, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SYNC) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_WAIT_SYNC, NULL);
+	printf("ioctl(-1, BTRFS_IOC_WAIT_SYNC, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_WAIT_SYNC, &u64val);
+	printf("ioctl(-1, BTRFS_IOC_WAIT_SYNC, [%" PRIu64
+	       "]) = -1 EBADF (%m)\n", u64val);
+
+	/*
+	 * The live test of BTRFS_IOC_SYNC happens as a part of the test
+	 * for BTRFS_IOC_LOGICAL_INO
+	 */
+}
+
+static void
+btrfs_print_qgroup_inherit(struct btrfs_qgroup_inherit *inherit)
+{
+	printf("{flags=");
+	printflags(btrfs_qgroup_inherit_flags, inherit->flags,
+		   "BTRFS_QGROUP_INHERIT_???");
+	printf(", num_qgroups=%" PRI__u64
+	       ", num_ref_copies=%" PRI__u64
+	       ", num_excl_copies=%" PRI__u64", lim={flags=",
+	       inherit->num_qgroups, inherit->num_ref_copies,
+	       inherit->num_excl_copies);
+	printflags(btrfs_qgroup_limit_flags,
+		   inherit->lim.flags,
+		   "BTRFS_QGROUP_LIMIT_???");
+	printf(", max_rfer=%" PRI__u64 ", max_excl=%" PRI__u64
+	       ", rsv_rfer=%" PRI__u64 ", rsv_excl=%" PRI__u64
+	       "}, qgroups=",
+	       inherit->lim.max_rfer, inherit->lim.max_excl,
+	       inherit->lim.rsv_rfer, inherit->lim.rsv_excl);
+	if (verbose) {
+		unsigned int i;
+		printf("[");
+		for (i = 0; i < inherit->num_qgroups; i++) {
+			if (i > 0)
+				printf(", ");
+			printf("%" PRI__u64, inherit->qgroups[i]);
+		}
+		printf("]");
+	} else
+		printf("...");
+	printf("}");
+}
+
+
+static void
+btrfs_print_vol_args_v2(struct btrfs_ioctl_vol_args_v2 *args, int print_qgroups)
+{
+	printf("{fd=%d, flags=", (int) args->fd);
+	printflags(btrfs_snap_flags_v2, args->flags, "BTRFS_SUBVOL_???");
+
+	if (args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
+		printf(", size=%" PRI__u64 ", qgroup_inherit=", args->size);
+		if (args->qgroup_inherit && print_qgroups)
+			btrfs_print_qgroup_inherit(args->qgroup_inherit);
+		else if (args->qgroup_inherit)
+			printf("%p", args->qgroup_inherit);
+		else
+			printf("NULL");
+	}
+	printf(", name=\"%s\"}", args->name);
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_SNAP_CREATE
+ * - BTRFS_IOC_SUBVOL_CREATE
+ * - BTRFS_IOC_SNAP_DESTROY
+ * - BTRFS_IOC_DEFAULT_SUBVOL
+ *
+ * Consumes argument, returns u64:
+ * - BTRFS_IOC_SNAP_CREATE_V2
+ * - BTRFS_IOC_SUBVOL_CREATE_V2
+ */
+
+static void
+btrfs_test_subvol_ioctls(void)
+{
+	const char *subvol_name = "subvol-name";
+	char *long_subvol_name;
+	void *bad_pointer = (void *) (unsigned long) 0xdeadbeeffffffeed;
+	uint64_t u64val = 0xdeadbeefbadc0ded;
+	struct btrfs_ioctl_vol_args vol_args = {};
+	struct btrfs_ioctl_vol_args_v2 vol_args_v2 = {
+		.fd = 2,
+		.flags = max_flags_plus_one(2),
+	};
+
+	long_subvol_name = malloc(BTRFS_PATH_NAME_MAX);
+	if (!long_subvol_name)
+		perror_msg_and_fail("malloc failed");
+	memset(long_subvol_name, 'f', BTRFS_PATH_NAME_MAX);
+	long_subvol_name[BTRFS_PATH_NAME_MAX - 1] = '\0';
+
+	strcpy(vol_args.name, subvol_name);
+
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE, "
+	       "{fd=0, name=\"%s\"}) = -1 EBADF (%m)\n", vol_args.name);
+
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE, "
+	       "{fd=0, name=\"%s\"}) = -1 EBADF (%m)\n", vol_args.name);
+
+	ioctl(-1, BTRFS_IOC_SNAP_DESTROY, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_DESTROY,"
+	       " {fd=0, name=\"%s\"}) = -1 EBADF (%m)\n", vol_args.name);
+
+	strncpy(vol_args.name, long_subvol_name, BTRFS_PATH_NAME_MAX);
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE,"
+	       " {fd=0, name=\"%s\"}) = -1 EBADF (%m)\n", vol_args.name);
+
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE,"
+	       " {fd=0, name=\"%s\"}) = -1 EBADF (%m)\n", vol_args.name);
+
+	ioctl(-1, BTRFS_IOC_SNAP_DESTROY, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_DESTROY,"
+	       " {fd=0, name=\"%s\"}) = -1 EBADF (%m)\n", vol_args.name);
+
+	long_subvol_name = realloc(long_subvol_name, BTRFS_SUBVOL_NAME_MAX);
+	if (!long_subvol_name)
+		perror_msg_and_fail("realloc failed");
+
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, NULL) = -1 EBADF (%m)\n");
+
+	strcpy(vol_args_v2.name, subvol_name);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 1);
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 1);
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	strncpy(vol_args_v2.name, long_subvol_name, BTRFS_SUBVOL_NAME_MAX);
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 1);
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 1);
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	strcpy(vol_args_v2.name, subvol_name);
+	vol_args_v2.qgroup_inherit = bad_pointer;
+
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 0);
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 0);
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	const unsigned int n_qgroups = 8;
+	unsigned int i;
+	struct btrfs_qgroup_inherit *inherit;
+	vol_args_v2.size =
+		sizeof(*inherit) + n_qgroups * sizeof(inherit->qgroups[0]);
+	inherit = tail_alloc(vol_args_v2.size);
+
+	inherit->flags = 0x3;
+	inherit->num_ref_copies = 0;
+	inherit->num_excl_copies = 0;
+	inherit->num_qgroups = n_qgroups;
+	for (i = 0; i < n_qgroups; i++)
+		inherit->qgroups[i] = 1ULL << i;
+	inherit->lim.flags = 0x7f;
+	inherit->lim.max_rfer = u64val;
+	inherit->lim.max_excl = u64val;
+	inherit->lim.rsv_rfer = u64val;
+	inherit->lim.rsv_excl = u64val;
+	vol_args_v2.qgroup_inherit = inherit;
+
+	printf("ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 1);
+	ioctl(-1, BTRFS_IOC_SNAP_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, ");
+	btrfs_print_vol_args_v2(&vol_args_v2, 1);
+	ioctl(-1, BTRFS_IOC_SUBVOL_CREATE_V2, &vol_args_v2);
+	printf(") = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_DEFAULT_SUBVOL, NULL);
+	printf("ioctl(-1, BTRFS_IOC_DEFAULT_SUBVOL, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_DEFAULT_SUBVOL, &u64val);
+	printf("ioctl(-1, BTRFS_IOC_DEFAULT_SUBVOL, [%"
+	       PRIu64 "]) = -1 EBADF (%m)\n", u64val);
+
+	printf("ioctl(-1, BTRFS_IOC_SUBVOL_SETFLAGS, ");
+	printflags(btrfs_snap_flags_v2, vol_args_v2.flags,
+		   "BTRFS_SUBVOL_???");
+	ioctl(-1, BTRFS_IOC_SUBVOL_SETFLAGS, &vol_args_v2.flags);
+	printf(") = -1 EBADF (%m)\n");
+
+	if (write_ok) {
+		struct btrfs_ioctl_vol_args_v2 args_passed;
+		/*
+		 * Returns transid if flags & BTRFS_SUBVOL_CREATE_ASYNC
+		 * - BTRFS_IOC_SNAP_CREATE_V2
+		 * - BTRFS_IOC_SUBVOL_CREATE_V2
+		 */
+		int subvolfd;
+
+		strncpy(vol_args_v2.name, subvol_name,
+			sizeof(vol_args_v2.name));
+		vol_args_v2.flags = BTRFS_SUBVOL_CREATE_ASYNC;
+		vol_args_v2.size = 0;
+		vol_args_v2.qgroup_inherit = NULL;
+		args_passed = vol_args_v2;
+		printf("ioctl(%d, BTRFS_IOC_SUBVOL_CREATE_V2, ",
+			btrfs_test_dir_fd);
+		btrfs_print_vol_args_v2(&vol_args_v2, 1);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SUBVOL_CREATE_V2,
+		      &args_passed);
+		printf(" => {transid=%" PRI__u64"}) = 0\n",
+			args_passed.transid);
+
+		subvolfd = openat(btrfs_test_dir_fd, subvol_name,
+				  O_RDONLY|O_DIRECTORY);
+		if (subvolfd < 0)
+			perror_msg_and_fail("openat(%s) failed", subvol_name);
+
+		strncpy(vol_args_v2.name, long_subvol_name, BTRFS_NAME_LEN);
+		vol_args_v2.fd = subvolfd;
+		args_passed = vol_args_v2;
+		printf("ioctl(%d, BTRFS_IOC_SNAP_CREATE_V2, ",
+		       btrfs_test_dir_fd);
+		btrfs_print_vol_args_v2(&args_passed, 1);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SNAP_CREATE_V2,
+		      &args_passed);
+		printf(" => {transid=%" PRI__u64"}) = 0\n",
+			args_passed.transid);
+
+		/* This only works when mounted w/ -ouser_subvol_rm_allowed */
+		strncpy(vol_args.name, long_subvol_name, 255);
+		vol_args.name[255] = 0;
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SNAP_DESTROY, &vol_args);
+		printf("ioctl(%d, BTRFS_IOC_SNAP_DESTROY, "
+		       "{fd=%d, name=\"%.*s\"}) = 0\n",
+		       btrfs_test_dir_fd, (int) vol_args.fd, 255, long_subvol_name);
+
+		strcpy(vol_args.name, subvol_name);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SNAP_DESTROY, &vol_args);
+		printf("ioctl(%d, BTRFS_IOC_SNAP_DESTROY, "
+		       "{fd=%d, name=\"%s\"}) = 0\n",
+		       btrfs_test_dir_fd, (int) vol_args.fd, subvol_name);
+
+		close(subvolfd);
+	}
+	free(long_subvol_name);
+}
+
+static void
+btrfs_print_balance_args(struct btrfs_balance_args *args)
+{
+	printf("{profiles=");
+	printflags(btrfs_space_info_flags, args->profiles,
+		   "BTRFS_BLOCK_GROUP_???");
+	printf(", usage=%"PRI__u64 "%s, devid=%"PRI__u64 "%s, pstart=%"PRI__u64
+	       "%s, pend=%"PRI__u64 "%s, vstart=%"PRI__u64 "%s, vend=%"PRI__u64
+	       "%s, target=%"PRI__u64 "%s, flags=",
+		args->usage, maybe_print_uint64max(args->usage),
+		args->devid, maybe_print_uint64max(args->devid),
+		args->pstart, maybe_print_uint64max(args->pstart),
+		args->pend, maybe_print_uint64max(args->pend),
+		args->vstart, maybe_print_uint64max(args->vstart),
+		args->vend, maybe_print_uint64max(args->vend),
+		args->target, maybe_print_uint64max(args->target));
+	printflags(btrfs_balance_args, args->flags, "BTRFS_BALANCE_ARGS_???");
+	printf("}");
+}
+
+/*
+ * Accepts argument, returns nothing
+ * - BTRFS_IOC_BALANCE
+ * - BTRFS_IOC_BALANCE_CTL
+ *
+ * Accepts argument, returns argument
+ * - BTRFS_IOC_BALANCE_V2
+ */
+static void
+btrfs_test_balance_ioctls(void)
+{
+	struct btrfs_ioctl_balance_args args = {
+		.flags = 0x3f,
+		.data = {
+			.profiles = 0x7,
+			.flags = 0x7,
+			.devid = 1,
+			.pend = -1ULL,
+			.vend = -1ULL,
+		},
+
+		.meta = {
+			.profiles = 0x38,
+			.flags = 0x38,
+			.devid = 1,
+		},
+
+		.sys = {
+			.profiles = 0x1c0 | (1ULL << 48),
+			.flags = 0x4c0,
+			.devid = 1,
+		},
+	};
+	struct btrfs_ioctl_vol_args vol_args = {};
+
+	ioctl(-1, BTRFS_IOC_BALANCE_CTL, 1);
+	printf("ioctl(-1, BTRFS_IOC_BALANCE_CTL, "
+	       "BTRFS_BALANCE_CTL_PAUSE) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_BALANCE_CTL, 2);
+	printf("ioctl(-1, BTRFS_IOC_BALANCE_CTL, "
+	       "BTRFS_BALANCE_CTL_CANCEL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_BALANCE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_BALANCE) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_BALANCE, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_BALANCE) = -1 EBADF (%m)\n");
+
+	/* struct btrfs_ioctl_balance_args */
+	ioctl(-1, BTRFS_IOC_BALANCE_V2, NULL);
+	printf("ioctl(-1, BTRFS_IOC_BALANCE_V2, NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_BALANCE_V2, {flags=");
+	printflags(btrfs_balance_flags, args.flags, "BTRFS_BALANCE_???");
+	printf(", data=");
+	btrfs_print_balance_args(&args.data);
+	printf(", meta=");
+	btrfs_print_balance_args(&args.meta);
+	printf(", sys=");
+	btrfs_print_balance_args(&args.sys);
+	ioctl(-1, BTRFS_IOC_BALANCE_V2, &args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	if (write_ok) {
+		args.flags = BTRFS_BALANCE_DATA | BTRFS_BALANCE_METADATA |
+			     BTRFS_BALANCE_SYSTEM;
+		args.data.flags = 0;
+		args.data.profiles = 0;
+		args.meta.flags = 0;
+		args.meta.profiles = 0;
+		args.sys.flags = 0;
+		args.sys.profiles = 0;
+		printf("ioctl(%d, BTRFS_IOC_BALANCE_V2, {flags=",
+			btrfs_test_dir_fd);
+
+		printflags(btrfs_balance_flags, args.flags,
+			   "BTRFS_BALANCE_???");
+		printf(", data=");
+		btrfs_print_balance_args(&args.data);
+		printf(", meta=");
+		btrfs_print_balance_args(&args.meta);
+		printf(", sys=");
+		btrfs_print_balance_args(&args.sys);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_BALANCE_V2,  &args);
+		printf("} => {flags=");
+		printflags(btrfs_balance_flags, args.flags,
+			   "BTRFS_BALANCE_???");
+		printf(", state=");
+		printflags(btrfs_balance_state, args.state,
+			   "BTRFS_BALANCE_STATE_???");
+		printf(", data=");
+		btrfs_print_balance_args(&args.data);
+		printf(", meta=");
+		btrfs_print_balance_args(&args.meta);
+		printf(", sys=");
+		btrfs_print_balance_args(&args.sys);
+		printf("}) = 0\n");
+	}
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_RESIZE
+ *
+ * Requires /dev/btrfs-control, consumes argument, returns nothing:
+ * - BTRFS_IOC_SCAN_DEV
+ * - BTRFS_IOC_DEVICES_READY
+ *
+ */
+static void
+btrfs_test_device_ioctls(void)
+{
+	const char *devid = "1";
+	const char *devname = "/dev/sda1";
+	struct btrfs_ioctl_vol_args args = {
+		.fd = 2,
+	};
+
+	ioctl(-1, BTRFS_IOC_RESIZE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_RESIZE, NULL) = -1 EBADF (%m)\n");
+
+	strcpy(args.name, devid);
+	ioctl(-1, BTRFS_IOC_RESIZE, &args);
+	printf("ioctl(-1, BTRFS_IOC_RESIZE, "
+	       "{fd=%d, name=\"%s\"}) = -1 EBADF (%m)\n",
+	       (int) args.fd, args.name);
+
+	ioctl(-1, BTRFS_IOC_SCAN_DEV, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SCAN_DEV, NULL) = -1 EBADF (%m)\n");
+
+	strcpy(args.name, devname);
+	ioctl(-1, BTRFS_IOC_SCAN_DEV, &args);
+	printf("ioctl(-1, BTRFS_IOC_SCAN_DEV, "
+	       "{fd=%d, name=\"%s\"}) = -1 EBADF (%m)\n",
+	       (int) args.fd, args.name);
+
+	ioctl(-1, BTRFS_IOC_ADD_DEV, NULL);
+	printf("ioctl(-1, BTRFS_IOC_ADD_DEV, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_ADD_DEV, &args);
+	printf("ioctl(-1, BTRFS_IOC_ADD_DEV, "
+	       "{fd=%d, name=\"%s\"}) = -1 EBADF (%m)\n",
+	       (int) args.fd, args.name);
+
+	ioctl(-1, BTRFS_IOC_RM_DEV, NULL);
+	printf("ioctl(-1, BTRFS_IOC_RM_DEV, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_RM_DEV, &args);
+	printf("ioctl(-1, BTRFS_IOC_RM_DEV, "
+	       "{fd=%d, name=\"%s\"}) = -1 EBADF (%m)\n",
+	       (int) args.fd, args.name);
+
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_CLONE
+ * - BTRFS_IOC_CLONE_RANGE
+ */
+static void
+btrfs_test_clone_ioctls(void)
+{
+	int clone_fd = 4;
+	struct btrfs_ioctl_clone_range_args args = {
+		.src_fd = clone_fd,
+		.src_offset = 4096,
+		.src_length = 16384,
+		.dest_offset = 128 * 1024,
+	};
+
+	ioctl(-1, BTRFS_IOC_CLONE, clone_fd);
+	printf("ioctl(-1, BTRFS_IOC_CLONE or FICLONE, %x) = -1 EBADF (%m)\n",
+		clone_fd);
+
+	ioctl(-1, BTRFS_IOC_CLONE_RANGE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, "
+	       "NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_CLONE_RANGE, &args);
+	printf("ioctl(-1, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, "
+	       "{src_fd=%d, src_offset=%" PRI__u64 ", src_length=%" PRI__u64
+	       ", dest_offset=%" PRI__u64 "}) = -1 EBADF (%m)\n",
+		(int) args.src_fd, args.src_offset, args.src_length,
+		args.dest_offset);
+}
+
+#define BTRFS_COMPRESS_TYPES 2
+#define BTRFS_INVALID_COMPRESS (BTRFS_COMPRESS_TYPES + 1)
+
+static void
+btrfs_print_defrag_range_args(struct btrfs_ioctl_defrag_range_args *args)
+{
+	printf("{start=%" PRIu64", len=%" PRIu64 "%s, flags=",
+		args->start, args->len, maybe_print_uint64max(args->len));
+
+	printflags(btrfs_defrag_flags, args->flags, "BTRFS_DEFRAG_RANGE_???");
+	printf(", extent_thresh=%u, compress_type=", args->extent_thresh);
+	printxval(btrfs_compress_types, args->compress_type,
+		  "BTRFS_COMPRESS_???");
+	printf("}");
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_DEFRAG
+ * - BTRFS_DEFRAG_RANGE
+ */
+static void
+btrfs_test_defrag_ioctls(void)
+{
+	struct btrfs_ioctl_vol_args vol_args = {};
+	struct btrfs_ioctl_defrag_range_args args = {
+		.start = 0,
+		.len = -1ULL,
+		.flags = max_flags_plus_one(1),
+		.extent_thresh = 128 * 1024,
+		.compress_type = 2, /* BTRFS_COMPRESS_LZO */
+	};
+
+	/*
+	 * These are documented as using vol_args but don't
+	 * actually consume it.
+	 */
+	ioctl(-1, BTRFS_IOC_DEFRAG, NULL);
+	printf("ioctl(-1, BTRFS_IOC_DEFRAG) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_DEFRAG, &vol_args);
+	printf("ioctl(-1, BTRFS_IOC_DEFRAG) = -1 EBADF (%m)\n");
+
+	/* struct btrfs_ioctl_defrag_range_args */
+	ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, ");
+	btrfs_print_defrag_range_args(&args);
+	ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, &args);
+	printf(") = -1 EBADF (%m)\n");
+
+	args.compress_type = BTRFS_INVALID_COMPRESS;
+	printf("ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, ");
+	btrfs_print_defrag_range_args(&args);
+	ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, &args);
+	printf(") = -1 EBADF (%m)\n");
+
+	args.len--;
+	printf("ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, ");
+	btrfs_print_defrag_range_args(&args);
+	ioctl(-1, BTRFS_IOC_DEFRAG_RANGE, &args);
+	printf(") = -1 EBADF (%m)\n");
+}
+
+static const char *
+xlookup(const struct xlat *xlat, const uint64_t val)
+{
+	for (; xlat->str != NULL; xlat++)
+		if (xlat->val == val)
+			return xlat->str;
+	return NULL;
+}
+
+static void
+btrfs_print_objectid(uint64_t objectid)
+{
+	const char *str = xlookup(btrfs_tree_objectids, objectid);
+	printf("%" PRIu64, objectid);
+	if (str)
+		printf(" /* %s */", str);
+}
+
+static void
+btrfs_print_key_type(uint32_t type)
+{
+	const char *str = xlookup(btrfs_key_types, type);
+	printf("%u", type);
+	if (str)
+		printf(" /* %s */", str);
+}
+
+static void
+btrfs_print_search_key(struct btrfs_ioctl_search_key *key)
+{
+	printf("key={tree_id=");
+	btrfs_print_objectid(key->tree_id);
+	if (verbose || key->min_objectid != 256) {
+		printf(", min_objectid=");
+		btrfs_print_objectid(key->min_objectid);
+	}
+	if (verbose || key->max_objectid != -256ULL) {
+		printf(", max_objectid=");
+		btrfs_print_objectid(key->max_objectid);
+	}
+	if (key->min_offset)
+		printf(", min_offset=%" PRI__u64 "%s",
+		       key->min_offset, maybe_print_uint64max(key->min_offset));
+	if (key->max_offset)
+		printf(", max_offset=%" PRI__u64 "%s",
+		       key->max_offset, maybe_print_uint64max(key->max_offset));
+	if (key->min_transid)
+		printf(", min_transid=%" PRI__u64"%s", key->min_transid,
+		       maybe_print_uint64max(key->min_transid));
+	if (key->max_transid)
+		printf(", max_transid=%" PRI__u64"%s", key->max_transid,
+		       maybe_print_uint64max(key->max_transid));
+	printf(", min_type=");
+	btrfs_print_key_type(key->min_type);
+	printf(", max_type=");
+	btrfs_print_key_type(key->max_type);
+	printf(", nr_items=%u}", key->nr_items);
+}
+
+static void
+btrfs_print_tree_search_buf(struct btrfs_ioctl_search_key *key,
+			    void *buf, uint64_t buf_size)
+{
+	if (verbose) {
+		uint64_t i;
+		uint64_t off = 0;
+		printf("[");
+		for (i = 0; i < key->nr_items; i++) {
+			struct btrfs_ioctl_search_header *sh;
+			sh = (typeof(sh))(buf + off);
+			if (i)
+				printf(", ");
+			printf("{transid=%" PRI__u64 ", objectid=",
+				sh->transid);
+			btrfs_print_objectid(sh->objectid);
+			printf(", offset=%" PRI__u64 ", type=", sh->offset);
+			btrfs_print_key_type(sh->type);
+			printf(", len=%u}", sh->len);
+			off += sizeof(*sh) + sh->len;
+		}
+		printf("]");
+	} else
+		printf("...");
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_TREE_SEARCH
+ * - BTRFS_IOC_TREE_SEARCH_V2
+ */
+static void
+btrfs_test_search_ioctls(void)
+{
+	struct btrfs_ioctl_search_key key_reference = {
+		.tree_id = 5,
+		.min_objectid = 256,
+		.max_objectid = -1ULL,
+		.min_offset = 0,
+		.max_offset = -1ULL,
+		.min_transid = 0,
+		.max_transid = -1ULL,
+		.min_type = 0,
+		.max_type = -1U,
+		.nr_items = 10,
+	};
+	struct btrfs_ioctl_search_args search_args;
+	struct btrfs_ioctl_search_args_v2 search_args_v2 = {
+		.buf_size = 4096,
+	};
+
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH, NULL);
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, NULL);
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, NULL) = -1 EBADF (%m)\n");
+
+	search_args.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH, {");
+	btrfs_print_search_key(&search_args.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH, &search_args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	search_args_v2.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, {");
+	btrfs_print_search_key(&search_args_v2.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, &search_args_v2);
+	printf(", buf_size=%" PRIu64 "}) = -1 EBADF (%m)\n",
+	       (uint64_t)search_args_v2.buf_size);
+
+	key_reference.min_objectid = 6;
+	key_reference.max_objectid = 7;
+	search_args.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH, {");
+	btrfs_print_search_key(&search_args.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH, &search_args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	search_args_v2.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, {");
+	btrfs_print_search_key(&search_args_v2.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, &search_args_v2);
+	printf(", buf_size=%" PRIu64 "}) = -1 EBADF (%m)\n",
+	       (uint64_t)search_args_v2.buf_size);
+
+	key_reference.min_offset++;
+	key_reference.max_offset--;
+	search_args.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH, {");
+	btrfs_print_search_key(&search_args.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH, &search_args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	search_args_v2.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, {");
+	btrfs_print_search_key(&search_args_v2.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, &search_args_v2);
+	printf(", buf_size=%" PRIu64 "}) = -1 EBADF (%m)\n",
+	       (uint64_t)search_args_v2.buf_size);
+
+	key_reference.min_transid++;
+	key_reference.max_transid--;
+	search_args.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH, {");
+	btrfs_print_search_key(&search_args.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH, &search_args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	search_args_v2.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, {");
+	btrfs_print_search_key(&search_args_v2.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, &search_args_v2);
+	printf(", buf_size=%" PRIu64 "}) = -1 EBADF (%m)\n",
+	       (uint64_t)search_args_v2.buf_size);
+
+	key_reference.min_type = 1;
+	key_reference.max_type = 12;
+	search_args.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH, {");
+	btrfs_print_search_key(&search_args.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH, &search_args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	search_args_v2.key = key_reference;
+	printf("ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, {");
+	btrfs_print_search_key(&search_args_v2.key);
+	ioctl(-1, BTRFS_IOC_TREE_SEARCH_V2, &search_args_v2);
+	printf(", buf_size=%" PRIu64 "}) = -1 EBADF (%m)\n",
+	       (uint64_t)search_args_v2.buf_size);
+
+	if (btrfs_test_root) {
+		struct btrfs_ioctl_search_args_v2 *args;
+		int bufsize = 4096;
+
+		key_reference.tree_id = 5;
+		key_reference.min_type = 1;
+		key_reference.max_type = 1;
+		key_reference.min_objectid = 256;
+		key_reference.max_objectid = 357;
+		key_reference.min_offset = 0;
+		key_reference.max_offset = -1ULL;
+
+		search_args.key = key_reference;
+		printf("ioctl(%d, BTRFS_IOC_TREE_SEARCH, {",
+			btrfs_test_dir_fd);
+		btrfs_print_search_key(&search_args.key);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_TREE_SEARCH, &search_args);
+		printf("} => {key={nr_items=%u}, buf=",
+			search_args.key.nr_items);
+		btrfs_print_tree_search_buf(&search_args.key, search_args.buf,
+					    sizeof(search_args.buf));
+		printf("}) = 0\n");
+
+		args = malloc(sizeof(*args) + bufsize);
+		if (!args)
+			perror_msg_and_fail("malloc failed");
+
+		args->key = key_reference;
+		args->buf_size = bufsize;
+		printf("ioctl(%d, BTRFS_IOC_TREE_SEARCH_V2, {",
+			btrfs_test_dir_fd);
+		btrfs_print_search_key(&key_reference);
+		printf(", buf_size=%" PRIu64 "}", (uint64_t) args->buf_size);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_TREE_SEARCH_V2, args);
+		printf(" => {key={nr_items=%u}, buf_size=%" PRIu64 ", buf=",
+			args->key.nr_items, (uint64_t)args->buf_size);
+		btrfs_print_tree_search_buf(&args->key, args->buf,
+					    args->buf_size);
+		printf("}) = 0\n");
+
+		args->key = key_reference;
+		args->buf_size = sizeof(struct btrfs_ioctl_search_header);
+		printf("ioctl(%d, BTRFS_IOC_TREE_SEARCH_V2, {",
+			btrfs_test_dir_fd);
+		btrfs_print_search_key(&args->key);
+		printf(", buf_size=%" PRIu64 "}", (uint64_t)args->buf_size);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_TREE_SEARCH_V2, args);
+		printf(" => {buf_size=%" PRIu64 "}) = -1 EOVERFLOW (%m)\n",
+			(uint64_t)args->buf_size);
+		free(args);
+	}
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_INO_LOOKUP
+ */
+static void
+btrfs_test_ino_lookup_ioctl(void)
+{
+	struct btrfs_ioctl_ino_lookup_args args = {
+		.treeid = 5,
+		.objectid = 256,
+	};
+
+	ioctl(-1, BTRFS_IOC_INO_LOOKUP, NULL);
+	printf("ioctl(-1, BTRFS_IOC_INO_LOOKUP, NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_INO_LOOKUP, {treeid=");
+	btrfs_print_objectid(args.treeid);
+	printf(", objectid=");
+	btrfs_print_objectid(args.objectid);
+	ioctl(-1, BTRFS_IOC_INO_LOOKUP, &args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	if (btrfs_test_root) {
+		printf("ioctl(%d, BTRFS_IOC_INO_LOOKUP, {treeid=",
+		       btrfs_test_dir_fd);
+		btrfs_print_objectid(args.treeid);
+		printf(", objectid=");
+		btrfs_print_objectid(args.objectid);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_INO_LOOKUP, &args);
+		printf("} => {name=\"%s\"}) = 0\n", args.name);
+	}
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_SPACE_INFO
+ */
+static void
+btrfs_test_space_info_ioctl(void)
+{
+	struct btrfs_ioctl_space_args args = {};
+
+	ioctl(-1, BTRFS_IOC_SPACE_INFO, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SPACE_INFO, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SPACE_INFO, &args);
+	printf("ioctl(-1, BTRFS_IOC_SPACE_INFO, "
+	       "{space_slots=%" PRI__u64 "}) = -1 EBADF (%m)\n",
+		args.space_slots);
+
+	if (btrfs_test_root) {
+		struct btrfs_ioctl_space_args args_passed;
+		struct btrfs_ioctl_space_args *argsp;
+		args_passed = args;
+		printf("ioctl(%d, BTRFS_IOC_SPACE_INFO, "
+		       "{space_slots=%" PRI__u64 "}",
+		       btrfs_test_dir_fd, args_passed.space_slots);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SPACE_INFO, &args_passed);
+		printf(" => {total_spaces=%" PRI__u64 "}) = 0\n",
+			args_passed.total_spaces);
+
+		argsp = malloc(sizeof(args) +
+			args_passed.total_spaces * sizeof(args.spaces[0]));
+		if (!argsp)
+			perror_msg_and_fail("malloc failed");
+
+		*argsp = args;
+		argsp->space_slots = args_passed.total_spaces;
+		printf("ioctl(%d, BTRFS_IOC_SPACE_INFO, "
+		       "{space_slots=%" PRI__u64 "}",
+		       btrfs_test_dir_fd, argsp->space_slots);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SPACE_INFO, argsp);
+		printf(" => {total_spaces=%" PRI__u64 ", spaces=",
+			argsp->total_spaces);
+		if (verbose) {
+			unsigned int i;
+			printf("[");
+			for (i = 0; i < argsp->total_spaces; i++) {
+				struct btrfs_ioctl_space_info *info;
+				info = &argsp->spaces[i];
+				if (i)
+					printf(", ");
+				printf("{flags=");
+				printflags(btrfs_space_info_flags, info->flags,
+					   "BTRFS_SPACE_INFO_???");
+				printf(", total_bytes=%" PRI__u64
+				       ", used_bytes=%" PRI__u64 "}",
+				       info->total_bytes, info->used_bytes);
+			}
+
+			printf("]");
+		} else
+			printf("...");
+		printf("}) = 0\n");
+		free(argsp);
+	}
+}
+
+/*
+ * Consumes no arguments, returns nothing:
+ * - BTRFS_IOC_SCRUB_CANCEL
+ * Consumes argument, returns argument:
+ - * BTRFS_IOC_SCRUB
+ - * BTRFS_IOC_SCRUB_PROGRESS
+ */
+static void
+btrfs_test_scrub_ioctls(void)
+{
+	struct btrfs_ioctl_scrub_args args = {
+		.devid = 1,
+		.start = 0,
+		.end = -1ULL,
+		.flags = max_flags_plus_one(0),
+	};
+
+	ioctl(-1, BTRFS_IOC_SCRUB, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SCRUB, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SCRUB_CANCEL, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SCRUB_CANCEL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SCRUB, {devid=%" PRI__u64 ", start=%"
+		PRI__u64 "%s, end=%" PRI__u64"%s, flags=",
+		args.devid, args.start, maybe_print_uint64max(args.start),
+		args.end, maybe_print_uint64max(args.end));
+	printflags(btrfs_scrub_flags, args.flags, "BTRFS_SCRUB_???");
+	ioctl(-1, BTRFS_IOC_SCRUB, &args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SCRUB_PROGRESS, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SCRUB_PROGRESS, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SCRUB_PROGRESS, &args);
+	printf("ioctl(-1, BTRFS_IOC_SCRUB_PROGRESS, "
+	       "{devid=%" PRI__u64 "}) = -1 EBADF (%m)\n", args.devid);
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_DEV_INFO
+ */
+static void
+btrfs_test_dev_info_ioctl(void)
+{
+	struct btrfs_ioctl_dev_info_args args = {
+		.devid = 1,
+	};
+	memcpy(&args.uuid, uuid_reference, BTRFS_UUID_SIZE);
+
+	ioctl(-1, BTRFS_IOC_DEV_INFO, NULL);
+	printf("ioctl(-1, BTRFS_IOC_DEV_INFO, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_DEV_INFO, &args);
+	printf("ioctl(-1, BTRFS_IOC_DEV_INFO, "
+	       "{devid=%" PRI__u64", uuid=%s}) = -1 EBADF (%m)\n",
+		args.devid, uuid_reference_string);
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_INO_PATHS
+ * - BTRFS_IOC_LOGICAL_INO
+ */
+static void
+btrfs_test_ino_path_ioctls(void)
+{
+	char buf[16384];
+	struct btrfs_ioctl_ino_path_args args = {
+		.inum = 256,
+		.size = sizeof(buf),
+		.fspath = (unsigned long)buf,
+	};
+
+	ioctl(-1, BTRFS_IOC_INO_PATHS, NULL);
+	printf("ioctl(-1, BTRFS_IOC_INO_PATHS, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_LOGICAL_INO, NULL);
+	printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_INO_PATHS, &args);
+	printf("ioctl(-1, BTRFS_IOC_INO_PATHS, "
+	       "{inum=%" PRI__u64", size=%" PRI__u64
+	       ", fspath=0x%" PRI__x64 "}) = -1 EBADF (%m)\n",
+	       args.inum, args.size, args.fspath);
+
+	ioctl(-1, BTRFS_IOC_LOGICAL_INO, &args);
+	printf("ioctl(-1, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64
+	       ", size=%" PRI__u64", inodes=0x%" PRI__x64
+	       "}) = -1 EBADF (%m)\n", args.inum, args.size, args.fspath);
+
+#ifdef HAVE_LINUX_FIEMAP_H
+	if (btrfs_test_root) {
+		int size;
+		struct stat si;
+		int ret;
+		struct btrfs_data_container *data = (void *)buf;
+		struct fiemap *fiemap;
+		int fd;
+
+		ret = fstat(btrfs_test_dir_fd, &si);
+		if (ret)
+			perror_msg_and_fail("fstat failed");
+
+		args.inum = si.st_ino;
+		printf("ioctl(%d, BTRFS_IOC_INO_PATHS, "
+		       "{inum=%" PRI__u64", size=%" PRI__u64
+		       ", fspath=0x%" PRI__x64"}",
+		       btrfs_test_dir_fd, args.inum, args.size,
+		       args.fspath);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_INO_PATHS, &args);
+		printf(" => {fspath={bytes_left=%u, bytes_missing=%u, elem_cnt=%u, elem_missed=%u, val=",
+			data->bytes_left, data->bytes_missing, data->elem_cnt,
+			data->elem_missed);
+		if (verbose) {
+			printf("[\"strace-test\"]");
+		} else
+			printf("...");
+		printf("}}) = 0\n");
+
+		fd = openat(btrfs_test_dir_fd, "file1", O_RDWR|O_CREAT, 0600);
+		if (fd < 0)
+			perror_msg_and_fail("openat(file1) failed");
+
+		ret = fstat(fd, &si);
+		if (ret)
+			perror_msg_and_fail("fstat failed");
+
+		if (write(fd, buf, sizeof(buf)) < 0)
+			perror_msg_and_fail("write: fd");
+
+		/*
+		 * Force delalloc so we can actually
+		 * search for the extent.
+		 */
+		fsync(fd);
+		ioctl(fd, BTRFS_IOC_SYNC, NULL);
+		printf("ioctl(%d, BTRFS_IOC_SYNC) = 0\n", fd);
+
+		size = sizeof(*fiemap) + 2 * sizeof(fiemap->fm_extents[0]);
+		fiemap = malloc(size);
+		if (!fiemap)
+			perror_msg_and_fail("malloc failed");
+		memset(fiemap, 0, size);
+
+		fiemap->fm_length = sizeof(buf);
+		fiemap->fm_extent_count = 2;
+
+		/* This is also a live test for FIEMAP */
+		printf("ioctl(%d, FS_IOC_FIEMAP, {fm_start=%" PRI__u64
+		       ", fm_length=%" PRI__u64", fm_flags=",
+		       fd, fiemap->fm_start, fiemap->fm_length);
+		printflags(fiemap_flags, fiemap->fm_flags, "FIEMAP_FLAG_???");
+		printf(", fm_extent_count=%u}", fiemap->fm_extent_count);
+		ioctl(fd, FS_IOC_FIEMAP, fiemap);
+		printf(" => {fm_flags=");
+		printflags(fiemap_flags, fiemap->fm_flags, "FIEMAP_FLAG_???");
+		printf(", fm_mapped_extents=%u, fm_extents=",
+			fiemap->fm_mapped_extents);
+		if (verbose) {
+			printf("[");
+			unsigned int i;
+			for (i = 0; i < fiemap->fm_mapped_extents; i++) {
+				struct fiemap_extent *fe;
+				fe = &fiemap->fm_extents[i];
+				if (i)
+					printf(", ");
+				printf("{fe_logical=%" PRI__u64
+				       ", fe_physical=%" PRI__u64
+				       ", fe_length=%" PRI__u64
+				       ", ",
+				       fe->fe_logical, fe->fe_physical,
+				       fe->fe_length);
+				printflags(fiemap_extent_flags, fe->fe_flags,
+					   "FIEMAP_EXTENT_???");
+				printf("}");
+			}
+			printf("]");
+		} else
+			printf("...");
+		printf("}) = 0\n");
+
+		args.inum = fiemap->fm_extents[0].fe_physical;
+		printf("ioctl(%d, BTRFS_IOC_LOGICAL_INO, {logical=%" PRI__u64
+		       ", size=%" PRI__u64", inodes=0x%" PRI__x64"}",
+		       fd, args.inum, args.size, args.fspath);
+		ioctl(fd, BTRFS_IOC_LOGICAL_INO, &args);
+		printf(" => {inodes={bytes_left=%u, bytes_missing=%u, elem_cnt=%u, elem_missed=%u, val=",
+			data->bytes_left, data->bytes_missing, data->elem_cnt,
+			data->elem_missed);
+		if (verbose) {
+			printf("[{inum=%llu, offset=0, root=5}]",
+			       (unsigned long long) si.st_ino);
+		} else
+			printf("...");
+		printf("}}) = 0\n");
+		close(fd);
+		free(fiemap);
+	}
+#endif /* HAVE_LINUX_FIEMAP_H */
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_SET_RECEIVED_SUBVOL
+ */
+static void
+btrfs_test_set_received_subvol_ioctl(void)
+{
+	struct btrfs_ioctl_received_subvol_args args = {
+		.stransid = 0x12345,
+		.stime = {
+			.sec = 1463193386,
+			.nsec = 12345,
+		},
+	};
+	memcpy(&args.uuid, uuid_reference, BTRFS_UUID_SIZE);
+
+	ioctl(-1, BTRFS_IOC_SET_RECEIVED_SUBVOL, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SET_RECEIVED_SUBVOL, "
+	       "NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SET_RECEIVED_SUBVOL, &args);
+	printf("ioctl(-1, BTRFS_IOC_SET_RECEIVED_SUBVOL, "
+	       "{uuid=%s, stransid=%" PRI__u64", stime=%" PRI__u64
+	       ".%u, flags=0}) = -1 EBADF (%m)\n",
+	       uuid_reference_string, args.stransid, args.stime.sec,
+	       args.stime.nsec);
+}
+
+/*
+ * Consumes argument, returns nothing (output is via send_fd)
+ * - BTRFS_IOC_SEND
+ */
+static void
+btrfs_test_send_ioctl(void)
+{
+	uint64_t u64_array[2] = { 256, 257 };
+	struct btrfs_ioctl_send_args args = {
+		.send_fd = 4,
+		.parent_root = 257,
+		.flags = max_flags_plus_one(2),
+	};
+
+	ioctl(-1, BTRFS_IOC_SEND, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SEND, NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SEND, "
+	       "{send_fd=%d, clone_sources_count=%" PRI__u64
+	       ", clone_sources=",
+	       (int) args.send_fd, args.clone_sources_count);
+	if (verbose)
+		printf("NULL");
+	else
+		printf("...");
+	printf(", parent_root=");
+	btrfs_print_objectid(args.parent_root);
+	printf(", flags=");
+	printflags(btrfs_send_flags, args.flags, "BTRFS_SEND_FLAGS_???");
+	ioctl(-1, BTRFS_IOC_SEND, &args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	args.clone_sources_count = 2;
+	args.clone_sources = (__u64 *)u64_array;
+
+	printf("ioctl(-1, BTRFS_IOC_SEND, "
+	       "{send_fd=%d, clone_sources_count=%" PRI__u64
+	       ", clone_sources=",
+	       (int) args.send_fd, args.clone_sources_count);
+	if (verbose) {
+		printf("[");
+		btrfs_print_objectid(u64_array[0]);
+		printf(", ");
+		btrfs_print_objectid(u64_array[1]);
+		printf("]");
+	} else
+		printf("...");
+	printf(", parent_root=");
+	btrfs_print_objectid(args.parent_root);
+	printf(", flags=");
+	printflags(btrfs_send_flags, args.flags, "BTRFS_SEND_FLAGS_???");
+	ioctl(-1, BTRFS_IOC_SEND, &args);
+	printf("}) = -1 EBADF (%m)\n");
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_QUOTA_CTL
+ */
+static void
+btrfs_test_quota_ctl_ioctl(void)
+{
+	struct btrfs_ioctl_quota_ctl_args args = {
+		.cmd = 1,
+	};
+
+	ioctl(-1, BTRFS_IOC_QUOTA_CTL, NULL);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_CTL, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_QUOTA_CTL, &args);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_CTL, "
+	       "BTRFS_QUOTA_CTL_ENABLE}) = -1 EBADF (%m)\n");
+
+	args.cmd = 2;
+	ioctl(-1, BTRFS_IOC_QUOTA_CTL, &args);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_CTL, "
+	       "BTRFS_QUOTA_CTL_DISABLE}) = -1 EBADF (%m)\n");
+
+	args.cmd = 3;
+	ioctl(-1, BTRFS_IOC_QUOTA_CTL, &args);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_CTL, "
+	       "BTRFS_QUOTA_CTL_RESCAN__NOTUSED}) = -1 EBADF (%m)\n");
+
+	args.cmd = 4;
+	ioctl(-1, BTRFS_IOC_QUOTA_CTL, &args);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_CTL, "
+	       "0x4 /* BTRFS_QUOTA_CTL_??? */}) = -1 EBADF (%m)\n");
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_QGROUP_ASSIGN
+ */
+static void
+btrfs_test_qgroup_assign_ioctl(void)
+{
+	struct btrfs_ioctl_qgroup_assign_args args = {
+		.assign = 1,
+		.src = 257,
+		.dst = 258,
+	};
+
+	ioctl(-1, BTRFS_IOC_QGROUP_ASSIGN, NULL);
+	printf("ioctl(-1, BTRFS_IOC_QGROUP_ASSIGN, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_QGROUP_ASSIGN, &args);
+	printf("ioctl(-1, BTRFS_IOC_QGROUP_ASSIGN, "
+	       "{assign=%" PRI__u64", src=%" PRI__u64", dst=%" PRI__u64
+	       "}) = -1 EBADF (%m)\n", args.assign, args.src, args.dst);
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_QGROUP_CREATE
+  */
+static void
+btrfs_test_qgroup_create_ioctl(void)
+{
+	struct btrfs_ioctl_qgroup_create_args args = {
+		.create = 1,
+		.qgroupid = 257,
+	};
+
+	ioctl(-1, BTRFS_IOC_QGROUP_CREATE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_QGROUP_CREATE, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_QGROUP_CREATE, &args);
+	printf("ioctl(-1, BTRFS_IOC_QGROUP_CREATE, "
+	       "{create=%" PRI__u64", qgroupid=%" PRI__u64
+	       "}) = -1 EBADF (%m)\n", args.create, args.qgroupid);
+}
+
+/*
+ * Consumes nothing, returns nothing:
+ * - BTRFS_IOC_QUOTA_RESCAN_WAIT
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_QUOTA_RESCAN
+ */
+static void
+btrfs_test_quota_rescan_ioctl(void)
+{
+	struct btrfs_ioctl_quota_rescan_args args = {
+		.progress = 1,
+	};
+
+	ioctl(-1, BTRFS_IOC_QUOTA_RESCAN, NULL);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_RESCAN, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_QUOTA_RESCAN, &args);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_RESCAN, "
+	       "{flags=0}) = -1 EBADF (%m)\n");
+	ioctl(-1, BTRFS_IOC_QUOTA_RESCAN_WAIT, NULL);
+	printf("ioctl(-1, BTRFS_IOC_QUOTA_RESCAN_WAIT) = -1 EBADF (%m)\n");
+
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_SET_FSLABEL
+ *
+ * Consumes no argument, returns argument:
+ * - BTRFS_IOC_GET_FS_LABEL
+ */
+static void
+btrfs_test_label_ioctls(void)
+{
+	char label[BTRFS_LABEL_SIZE] = "btrfs-label";
+
+	ioctl(-1, BTRFS_IOC_SET_FSLABEL, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SET_FSLABEL, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_SET_FSLABEL, label);
+	printf("ioctl(-1, BTRFS_IOC_SET_FSLABEL, \"%s\") = -1 EBADF (%m)\n",
+		label);
+
+	if (write_ok) {
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_SET_FSLABEL, label);
+		printf("ioctl(%d, BTRFS_IOC_SET_FSLABEL, \"%s\") = 0\n",
+			btrfs_test_dir_fd, label);
+
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_GET_FSLABEL, label);
+		printf("ioctl(%d, BTRFS_IOC_GET_FSLABEL, \"%s\") = 0\n",
+			btrfs_test_dir_fd, label);
+	}
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_GET_DEV_STATS
+ */
+static void
+btrfs_test_get_dev_stats_ioctl(void)
+{
+	struct btrfs_ioctl_get_dev_stats args = {
+		.devid = 1,
+		.nr_items = 5,
+		.flags = max_flags_plus_one(0),
+	};
+
+	ioctl(-1, BTRFS_IOC_GET_DEV_STATS, NULL);
+	printf("ioctl(-1, BTRFS_IOC_GET_DEV_STATS, NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_GET_DEV_STATS, {devid=%" PRI__u64
+		", nr_items=%" PRI__u64", flags=",
+		args.devid, args.nr_items);
+	printflags(btrfs_dev_stats_flags, args.flags,
+		     "BTRFS_DEV_STATS_???");
+	ioctl(-1, BTRFS_IOC_GET_DEV_STATS, &args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	if (write_ok) {
+		unsigned int i;
+		args.flags = BTRFS_DEV_STATS_RESET;
+		printf("ioctl(%d, BTRFS_IOC_GET_DEV_STATS, {devid=%" PRI__u64
+			", nr_items=%" PRI__u64", flags=",
+			btrfs_test_dir_fd, args.devid, args.nr_items);
+		printflags(btrfs_dev_stats_flags, args.flags,
+			     "BTRFS_DEV_STATS_???");
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_GET_DEV_STATS, &args);
+		printf("} => {nr_items=%" PRI__u64 ", flags=",
+			args.nr_items);
+		printflags(btrfs_dev_stats_flags, args.flags,
+			   "BTRFS_DEV_STATS_???");
+		printf(", [");
+		for (i = 0; i < args.nr_items; i++) {
+			const char *name = xlookup(btrfs_dev_stats_values, i);
+			if (i)
+				printf(", ");
+			if (name)
+				printf("/* %s */ ", name);
+			printf("%" PRI__u64, args.values[i]);
+		}
+		printf("]}) = 0\n");
+	}
+}
+
+/*
+ * Consumes argument, returns argument:
+ * - BTRFS_IOC_DEV_REPLACE
+ *
+ * Test environment for this is more difficult; It's better to do it by hand.
+ */
+static void
+btrfs_test_dev_replace_ioctl(void)
+{
+	struct btrfs_ioctl_dev_replace_args args = {
+		.cmd = BTRFS_IOCTL_DEV_REPLACE_CMD_START,
+		.start = {
+			.srcdevid = 1,
+		},
+	};
+	strcpy((char *)args.start.srcdev_name, "/dev/sda1");
+	strcpy((char *)args.start.tgtdev_name, "/dev/sdb1");
+
+	/* struct btrfs_ioctl_dev_replace_args */
+	ioctl(-1, BTRFS_IOC_DEV_REPLACE, NULL);
+	printf("ioctl(-1, BTRFS_IOC_DEV_REPLACE, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, BTRFS_IOC_DEV_REPLACE, &args);
+	printf("ioctl(-1, BTRFS_IOC_DEV_REPLACE, "
+	       "{cmd=BTRFS_IOCTL_DEV_REPLACE_CMD_START, start={srcdevid=%"
+	       PRI__u64", cont_reading_from_srcdev_mode=%" PRI__u64
+	       ", srcdev_name=\"%s\", tgtdev_name=\"%s\"}}) = -1 EBADF (%m)\n",
+	       args.start.srcdevid,
+	       args.start.cont_reading_from_srcdev_mode,
+	       (char *)args.start.srcdev_name,
+	       (char *)args.start.tgtdev_name);
+
+	args.cmd = 1;
+	ioctl(-1, BTRFS_IOC_DEV_REPLACE, &args);
+	printf("ioctl(-1, BTRFS_IOC_DEV_REPLACE, "
+	       "{cmd=BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS}) = -1 EBADF (%m)\n");
+}
+
+static void
+btrfs_test_extent_same_ioctl(void)
+{
+#ifdef BTRFS_IOC_FILE_EXTENT_SAME
+	struct file_dedupe_range args = {
+		.src_offset = 1024,
+		.src_length = 10240,
+	};
+	struct file_dedupe_range *argsp;
+
+	ioctl(-1, BTRFS_IOC_FILE_EXTENT_SAME, NULL);
+	printf("ioctl(-1, BTRFS_IOC_FILE_EXTENT_SAME or FIDEDUPERANGE, "
+	       "NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_FILE_EXTENT_SAME or FIDEDUPERANGE, "
+	       "{src_offset=%" PRIu64
+	       ", src_length=%" PRIu64
+	       ", dest_count=%hu, info=[]",
+		(uint64_t)args.src_offset,
+		(uint64_t)args.src_length, args.dest_count);
+	ioctl(-1, BTRFS_IOC_FILE_EXTENT_SAME, &args);
+	printf("}) = -1 EBADF (%m)\n");
+
+	argsp = malloc(sizeof(*argsp) + sizeof(argsp->info[0]) * 3);
+	if (!argsp)
+		perror_msg_and_fail("malloc failed");
+	memset(argsp, 0, sizeof(*argsp) + sizeof(argsp->info[0]) * 3);
+
+	*argsp = args;
+	argsp->dest_count = 3;
+	argsp->info[0].dest_fd = 2;
+	argsp->info[0].dest_offset = 0;
+	argsp->info[1].dest_fd = 2;
+	argsp->info[1].dest_offset = 10240;
+	argsp->info[2].dest_fd = 2;
+	argsp->info[2].dest_offset = 20480;
+
+	printf("ioctl(-1, BTRFS_IOC_FILE_EXTENT_SAME or FIDEDUPERANGE, "
+	       "{src_offset=%" PRIu64
+	       ", src_length=%" PRIu64
+	       ", dest_count=%hu, info=",
+		(int64_t)argsp->src_offset,
+		(uint64_t)argsp->src_length, argsp->dest_count);
+		printf("[{dest_fd=%" PRId64 ", dest_offset=%" PRIu64
+		       "}, {dest_fd=%" PRId64 ", dest_offset=%"PRIu64 "}",
+		       (int64_t)argsp->info[0].dest_fd,
+		       (uint64_t)argsp->info[0].dest_offset,
+		       (int64_t)argsp->info[1].dest_fd,
+		       (uint64_t)argsp->info[1].dest_offset);
+	if (verbose)
+		printf(", {dest_fd=%" PRId64 ", dest_offset=%" PRIu64 "}",
+		       (int64_t)argsp->info[2].dest_fd,
+		       (uint64_t)argsp->info[2].dest_offset);
+	else
+		printf(", ...");
+	printf("]");
+	ioctl(-1, BTRFS_IOC_FILE_EXTENT_SAME, argsp);
+	printf("}) = -1 EBADF (%m)\n");
+
+	if (write_ok) {
+		int fd1, fd2;
+		char buf[16384];
+
+		memset(buf, 0, sizeof(buf));
+
+		fd1 = openat(btrfs_test_dir_fd, "file1", O_RDWR|O_CREAT, 0600);
+		if (fd1 < 0)
+			perror_msg_and_fail("open file1 failed");
+
+		fd2 = openat(btrfs_test_dir_fd, "file2", O_RDWR|O_CREAT, 0600);
+		if (fd2 < 0)
+			perror_msg_and_fail("open file2 failed");
+
+		if (write(fd1, buf, sizeof(buf)) < 0)
+			perror_msg_and_fail("write: fd1");
+		if (write(fd1, buf, sizeof(buf)) < 0)
+			perror_msg_and_fail("write: fd1");
+		if (write(fd2, buf, sizeof(buf)) < 0)
+			perror_msg_and_fail("write: fd2");
+		if (write(fd2, buf, sizeof(buf)) < 0)
+			perror_msg_and_fail("write: fd2");
+
+		close(fd2);
+		fd2 = openat(btrfs_test_dir_fd, "file2", O_RDONLY);
+		if (fd2 < 0)
+			perror_msg_and_fail("open file2 failed");
+
+		memset(argsp, 0, sizeof(*argsp) + sizeof(argsp->info[0]) * 3);
+
+		argsp->src_offset = 0;
+		argsp->src_length = 4096;
+		argsp->dest_count = 3;
+		argsp->info[0].dest_fd = fd2;
+		argsp->info[0].dest_offset = 0;
+		argsp->info[1].dest_fd = fd2;
+		argsp->info[1].dest_offset = 10240;
+		argsp->info[2].dest_fd = fd2;
+		argsp->info[2].dest_offset = 20480;
+
+		printf("ioctl(%d, BTRFS_IOC_FILE_EXTENT_SAME or FIDEDUPERANGE, "
+		       "{src_offset=%" PRIu64 ", src_length=%" PRIu64
+		       ", dest_count=%hu, info=", fd1,
+		       (uint64_t)argsp->src_offset,
+		       (uint64_t)argsp->src_length, argsp->dest_count);
+		printf("[{dest_fd=%" PRId64 ", dest_offset=%" PRIu64
+		       "}, {dest_fd=%" PRId64 ", dest_offset=%"PRIu64 "}",
+		       (int64_t)argsp->info[0].dest_fd,
+		       (uint64_t)argsp->info[0].dest_offset,
+		       (int64_t)argsp->info[1].dest_fd,
+		       (uint64_t)argsp->info[1].dest_offset);
+		if (verbose)
+			printf(", {dest_fd=%" PRId64
+			       ", dest_offset=%" PRIu64 "}",
+			       (int64_t)argsp->info[2].dest_fd,
+			       (uint64_t)argsp->info[2].dest_offset);
+		else
+			printf(", ...");
+
+		ioctl(fd1, BTRFS_IOC_FILE_EXTENT_SAME, argsp);
+		printf("]} => {info=");
+		printf("[{bytes_deduped=%" PRIu64 ", status=%d}, "
+			"{bytes_deduped=%" PRIu64 ", status=%d}",
+		       (uint64_t)argsp->info[0].bytes_deduped,
+		       argsp->info[0].status,
+		       (uint64_t)argsp->info[1].bytes_deduped,
+		       argsp->info[1].status);
+		if (verbose)
+			printf(", {bytes_deduped=%" PRIu64 ", status=%d}",
+			       (uint64_t)argsp->info[2].bytes_deduped,
+			       argsp->info[2].status);
+		else
+			printf(", ...");
+		printf("]}) = 0\n");
+		close(fd1);
+		close(fd2);
+		unlinkat(btrfs_test_dir_fd, "file1", 0);
+		unlinkat(btrfs_test_dir_fd, "file2", 0);
+		close(fd1);
+		close(fd2);
+	}
+	free(argsp);
+#endif /* BTRFS_IOC_FILE_EXTENT_SAME */
+}
+
+static void
+btrfs_print_features(struct btrfs_ioctl_feature_flags *flags)
+{
+	printf("{compat_flags=");
+	printflags(btrfs_features_compat, flags->compat_flags,
+		   "BTRFS_FEATURE_COMPAT_???");
+
+	printf(", compat_ro_flags=");
+	printflags(btrfs_features_compat_ro, flags->compat_ro_flags,
+		   "BTRFS_FEATURE_COMPAT_RO_???");
+
+	printf(", incompat_flags=");
+	printflags(btrfs_features_incompat, flags->incompat_flags,
+		   "BTRFS_FEATURE_INCOMPAT_???");
+	printf("}");
+}
+
+/*
+ * Consumes argument, returns nothing:
+ * - BTRFS_IOC_SET_FEATURES
+ *
+ * Consumes nothing, returns argument:
+ * - BTRFS_IOC_GET_FEATURES
+ * - BTRFS_IOC_GET_SUPPORTED_FEATURES
+ */
+static void
+btrfs_test_features_ioctls(void)
+{
+	struct btrfs_ioctl_feature_flags args[2] = {
+		{
+			.compat_flags = max_flags_plus_one(-1),
+			.incompat_flags = max_flags_plus_one(9),
+			.compat_ro_flags = max_flags_plus_one(0),
+		}, {
+			.compat_flags = max_flags_plus_one(-1),
+			.incompat_flags = max_flags_plus_one(9),
+			.compat_ro_flags = max_flags_plus_one(0),
+		},
+	};
+	struct btrfs_ioctl_feature_flags supported_features[3];
+
+	ioctl(-1, BTRFS_IOC_SET_FEATURES, NULL);
+	printf("ioctl(-1, BTRFS_IOC_SET_FEATURES, NULL) = -1 EBADF (%m)\n");
+
+	printf("ioctl(-1, BTRFS_IOC_SET_FEATURES, [");
+	btrfs_print_features(&args[0]);
+	printf(", ");
+	btrfs_print_features(&args[1]);
+	ioctl(-1, BTRFS_IOC_SET_FEATURES, &args);
+	printf("]) = -1 EBADF (%m)\n");
+
+	if (btrfs_test_root) {
+		printf("ioctl(%d, BTRFS_IOC_GET_FEATURES, ",
+		       btrfs_test_dir_fd);
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_GET_FEATURES,
+		      &supported_features);
+		btrfs_print_features(&supported_features[0]);
+		printf(") = 0\n");
+
+		ioctl(btrfs_test_dir_fd, BTRFS_IOC_GET_SUPPORTED_FEATURES,
+		      &supported_features);
+		printf("ioctl(%d, BTRFS_IOC_GET_SUPPORTED_FEATURES, ",
+		       btrfs_test_dir_fd);
+		printf("[ /* supported */ ");
+		btrfs_print_features(&supported_features[0]);
+		printf(", /* safe to set */ ");
+		btrfs_print_features(&supported_features[1]);
+		printf(", /* safe to clear */ ");
+		btrfs_print_features(&supported_features[2]);
+		printf("]) = 0\n");
+	}
+}
+
+static void
+btrfs_test_read_ioctls(void)
+{
+	static const struct xlat btrfs_read_cmd[] = {
+		XLAT(BTRFS_IOC_BALANCE_PROGRESS),
+		XLAT(BTRFS_IOC_FS_INFO),
+		XLAT(BTRFS_IOC_GET_FEATURES),
+		XLAT(BTRFS_IOC_GET_FSLABEL),
+		XLAT(BTRFS_IOC_GET_SUPPORTED_FEATURES),
+		XLAT(BTRFS_IOC_QGROUP_LIMIT),
+		XLAT(BTRFS_IOC_QUOTA_RESCAN_STATUS),
+		XLAT(BTRFS_IOC_START_SYNC),
+		XLAT(BTRFS_IOC_SUBVOL_GETFLAGS),
+	};
+
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(btrfs_read_cmd); ++i) {
+		ioctl(-1, (unsigned long) btrfs_read_cmd[i].val, 0);
+		printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", btrfs_read_cmd[i].str);
+	}
+}
+
+int
+main(int argc, char *argv[])
+{
+
+	int opt;
+	int ret;
+	const char *path;
+
+	while ((opt = getopt(argc, argv, "wv")) != -1) {
+		switch (opt) {
+		case 'v':
+			/*
+			 * These tests are incomplete, especially when
+			 * printing arrays of objects are involved.
+			 */
+			verbose = true;
+			break;
+		case 'w':
+			write_ok = true;
+			break;
+		default:
+			error_msg_and_fail("usage: btrfs [-v] [-w] [path]");
+		}
+	}
+
+	/*
+	 * This will enable optional tests that require a valid file descriptor
+	 */
+	if (optind < argc) {
+		int rootfd;
+		struct statfs sfi;
+		path = argv[optind];
+
+		ret = statfs(path, &sfi);
+		if (ret)
+			perror_msg_and_fail("statfs(%s) failed", path);
+
+		if ((unsigned) sfi.f_type != BTRFS_SUPER_MAGIC)
+			error_msg_and_fail("%s is not a btrfs file system",
+					   path);
+
+		btrfs_test_root = path;
+		rootfd = open(path, O_RDONLY|O_DIRECTORY);
+		if (rootfd < 0)
+			perror_msg_and_fail("open(%s) failed", path);
+
+		ret = mkdirat(rootfd, "strace-test", 0755);
+		if (ret < 0 && errno != EEXIST)
+			perror_msg_and_fail("mkdirat(strace-test) failed");
+
+		btrfs_test_dir_fd = openat(rootfd, "strace-test",
+					   O_RDONLY|O_DIRECTORY);
+		if (btrfs_test_dir_fd < 0)
+			perror_msg_and_fail("openat(strace-test) failed");
+		close(rootfd);
+	} else
+		write_ok = false;
+
+	if (btrfs_test_root) {
+		fprintf(stderr, "Testing live ioctls on %s (%s)\n",
+			btrfs_test_root, write_ok ? "read/write" : "read only");
+	}
+
+	btrfs_test_read_ioctls();
+	btrfs_test_trans_ioctls();
+	btrfs_test_sync_ioctls();
+	btrfs_test_subvol_ioctls();
+	btrfs_test_balance_ioctls();
+	btrfs_test_device_ioctls();
+	btrfs_test_clone_ioctls();
+	btrfs_test_defrag_ioctls();
+	btrfs_test_search_ioctls();
+	btrfs_test_ino_lookup_ioctl();
+	btrfs_test_space_info_ioctl();
+	btrfs_test_scrub_ioctls();
+	btrfs_test_dev_info_ioctl();
+	btrfs_test_ino_path_ioctls();
+	btrfs_test_set_received_subvol_ioctl();
+	btrfs_test_send_ioctl();
+	btrfs_test_quota_ctl_ioctl();
+	btrfs_test_qgroup_assign_ioctl();
+	btrfs_test_qgroup_create_ioctl();
+	btrfs_test_quota_rescan_ioctl();
+	btrfs_test_label_ioctls();
+	btrfs_test_get_dev_stats_ioctl();
+	btrfs_test_dev_replace_ioctl();
+	btrfs_test_extent_same_ioctl();
+	btrfs_test_features_ioctls();
+
+	puts("+++ exited with 0 +++");
+
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("HAVE_LINUX_BTRFS_H")
+
+#endif
diff --git a/tests/btrfs.test b/tests/btrfs.test
new file mode 100755
index 0000000..2121b5b
--- /dev/null
+++ b/tests/btrfs.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check basic btrfs ioctl decoding.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/caps.awk b/tests/caps.awk
index ecf1a28..67003ac 100644
--- a/tests/caps.awk
+++ b/tests/caps.awk
@@ -28,7 +28,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 BEGIN {
-	cap = "(0|CAP_[A-Z_]+(\\|CAP_[A-Z_]+)*|CAP_[A-Z_]+(\\|CAP_[A-Z_]+){37}\\|0xffffffc0)"
+	cap = "(0|1<<CAP_[A-Z_]+(\\|1<<CAP_[A-Z_]+)*|1<<CAP_[A-Z_]+(\\|1<<CAP_[A-Z_]+){37}\\|0xffffffc0)"
 	s_efault = "-1 EFAULT (Bad address)"
 	r_efault = "-1 EFAULT \\(Bad address\\)"
 	r_addr = "0x[[:xdigit:]]+"
@@ -36,7 +36,7 @@
 	r[2] = "^capget\\(" r_addr ", " r_addr "\\) = " r_efault
 	r[3] = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, " r_addr "\\) = " r_efault
 	r[4] = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, \\{" cap ", " cap ", " cap "\\}\\) = 0$"
-	capset_data = "{CAP_DAC_OVERRIDE|CAP_WAKE_ALARM, CAP_DAC_READ_SEARCH|CAP_BLOCK_SUSPEND, 0}"
+	capset_data = "{1<<CAP_DAC_OVERRIDE|1<<CAP_WAKE_ALARM, 1<<CAP_DAC_READ_SEARCH|1<<CAP_BLOCK_SUSPEND, 0}"
 	s[5] = "capset({_LINUX_CAPABILITY_VERSION_3, 0}, " capset_data ") = -1 EPERM (Operation not permitted)"
 	s[6] = "+++ exited with 0 +++"
 
diff --git a/tests/chown.c b/tests/chown.c
new file mode 100644
index 0000000..59a4d63
--- /dev/null
+++ b/tests/chown.c
@@ -0,0 +1,19 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_chown
+
+# define SYSCALL_NR __NR_chown
+# define SYSCALL_NAME "chown"
+
+# if defined __NR_chown32 && __NR_chown != __NR_chown32
+#  define UGID_TYPE_IS_SHORT
+# endif
+
+# include "xchownx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_chown")
+
+#endif
diff --git a/tests/chown.test b/tests/chown.test
new file mode 100755
index 0000000..1a94c32
--- /dev/null
+++ b/tests/chown.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check chown syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a29
diff --git a/tests/chown32.c b/tests/chown32.c
new file mode 100644
index 0000000..5e590a8
--- /dev/null
+++ b/tests/chown32.c
@@ -0,0 +1,14 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_chown32
+
+# define SYSCALL_NR __NR_chown32
+# define SYSCALL_NAME "chown32"
+# include "xchownx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_chown32")
+
+#endif
diff --git a/tests/chown32.test b/tests/chown32.test
new file mode 100755
index 0000000..0fa04c2
--- /dev/null
+++ b/tests/chown32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check chown32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a31
diff --git a/tests/chroot.c b/tests/chroot.c
index fb12a31..fb9548c 100644
--- a/tests/chroot.c
+++ b/tests/chroot.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_chroot
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -11,20 +10,10 @@
 main(void)
 {
 	static const char sample[] = "chroot.sample";
-	int rc = syscall(__NR_chroot ,sample);
-	const char *errno_text;
-	switch (errno) {
-		case ENOSYS:
-			errno_text = "ENOSYS";
-			break;
-		case EPERM:
-			errno_text = "EPERM";
-			break;
-		default:
-			errno_text = "ENOENT";
-	}
-	printf("chroot(\"%s\") = %d %s (%m)\n",
-	       sample, rc, errno_text);
+
+	long rc = syscall(__NR_chroot, sample);
+	printf("chroot(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/uid32.c b/tests/clock_adjtime.c
similarity index 61%
copy from tests/uid32.c
copy to tests/clock_adjtime.c
index 9c30d92..93c58b7 100644
--- a/tests/uid32.c
+++ b/tests/clock_adjtime.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * This file is part of clock_adjtime strace test.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,41 +30,31 @@
 #include "tests.h"
 #include <sys/syscall.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
+#ifdef __NR_clock_adjtime
 
-# include <assert.h>
-# include <stdlib.h>
+# include <stdio.h>
+# include <time.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	long rc = syscall(__NR_clock_adjtime, CLOCK_MONOTONIC, NULL);
+	printf("clock_adjtime(CLOCK_MONOTONIC, NULL) = %ld %s (%m)\n",
+	       rc, errno2name());
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
+	void *efault = tail_alloc(1);
+
+	rc = syscall(__NR_clock_adjtime, CLOCK_REALTIME, efault);
+	printf("clock_adjtime(CLOCK_REALTIME, %p) = %ld %s (%m)\n",
+	       efault, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
+SKIP_MAIN_UNDEFINED("__NR_clock_adjtime")
 
 #endif
diff --git a/tests/clock_adjtime.test b/tests/clock_adjtime.test
new file mode 100755
index 0000000..df2c060
--- /dev/null
+++ b/tests/clock_adjtime.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check clock_adjtime syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a37
diff --git a/tests/copy_file_range.c b/tests/copy_file_range.c
index e90bf6a..0e563d6 100644
--- a/tests/copy_file_range.c
+++ b/tests/copy_file_range.c
@@ -32,8 +32,6 @@
 
 #if defined __NR_copy_file_range
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -49,11 +47,13 @@
 	const size_t len = (size_t) 0xdeadbef3facefed3ULL;
 	const unsigned int flags = 0;
 
-	assert(syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out,
-		       len, flags) == -1);
-	printf("copy_file_range(%d, [%lld], %d, [%lld], %zu, %u) = -1 %s (%m)\n",
+	long rc = syscall(__NR_copy_file_range,
+			  fd_in, off_in, fd_out, off_out, len, flags);
+	printf("copy_file_range(%d, [%lld], %d, [%lld], %zu, %u)"
+	       " = %ld %s (%m)\n",
 	       (int) fd_in, *off_in, (int) fd_out, *off_out, len, flags,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	       rc, errno2name());
+
 	puts("+++ exited with 0 +++");
 	return 0;
 }
diff --git a/tests/count.test b/tests/count.test
index cfd9e83..e75dc6b 100755
--- a/tests/count.test
+++ b/tests/count.test
@@ -50,7 +50,7 @@
 
 grep_log ' *[^ ]+ +0\.0[^n]*nanosleep'		-c
 grep_log ' *[^ ]+ +0\.0[^n]*nanosleep'		-c -enanosleep
-grep_log ' *[^ ]+ +(1\.0|0\.99)[^n]*nanosleep'	-cw
-grep_log '100\.00 +(1\.0|0\.99)[^n]*nanosleep'	-cw -enanosleep
+grep_log ' *[^ ]+ +(1\.[01]|0\.99)[^n]*nanosleep'	-cw
+grep_log '100\.00 +(1\.[01]|0\.99)[^n]*nanosleep'	-cw -enanosleep
 
 exit 0
diff --git a/tests/creat.c b/tests/creat.c
index d922dd7..8572e7f 100644
--- a/tests/creat.c
+++ b/tests/creat.c
@@ -3,9 +3,7 @@
 
 #ifdef __NR_creat
 
-# include <errno.h>
 # include <stdio.h>
-# include <sys/stat.h>
 # include <unistd.h>
 
 # define TMP_FILE "creat"
@@ -13,10 +11,9 @@
 int
 main(void)
 {
-	int rc = syscall(__NR_creat, TMP_FILE, S_IRUSR);
-	printf("creat(\"%s\", %#o) = %d %s (%m)\n",
-	       TMP_FILE, S_IRUSR, rc,
-	       errno == ENOSYS ? "ENOSYS" : "ETXTBSY");
+	long rc = syscall(__NR_creat, TMP_FILE, 0400);
+	printf("creat(\"%s\", %#o) = %ld %s (%m)\n",
+	       TMP_FILE, 0400, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/dup.c b/tests/dup.c
index 7497269..62157e2 100644
--- a/tests/dup.c
+++ b/tests/dup.c
@@ -1,15 +1,12 @@
-#include <errno.h>
+#include "tests.h"
 #include <stdio.h>
 #include <unistd.h>
 
 int
 main(void)
 {
-	const int fd = -1;
-	int rc = dup(fd);
-	printf("dup(%d) = %d %s (%m)\n",
-	       fd, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	int rc = dup(-1);
+	printf("dup(-1) = %d %s (%m)\n", rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/dup2.c b/tests/dup2.c
index 0705af6..70d8f3e 100644
--- a/tests/dup2.c
+++ b/tests/dup2.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_dup2
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -12,10 +11,10 @@
 {
 	const long int fd_old = (long int) 0xdeadbeefffffffff;
 	const long int fd_new = (long int) 0xdeadbeeffffffffe;
-	int rc = syscall(__NR_dup2, fd_old, fd_new);
-	printf("dup2(%d, %d) = %d %s (%m)\n",
-	       (int) fd_old, (int) fd_new, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_dup2, fd_old, fd_new);
+	printf("dup2(%d, %d) = %ld %s (%m)\n",
+	       (int) fd_old, (int) fd_new, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/dup3.c b/tests/dup3.c
index b57f05a..884331a 100644
--- a/tests/dup3.c
+++ b/tests/dup3.c
@@ -4,7 +4,6 @@
 
 #if defined __NR_dup3 && defined O_CLOEXEC
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -13,10 +12,10 @@
 {
 	const long int fd_old = (long int) 0xdeadbeefffffffff;
 	const long int fd_new = (long int) 0xdeadbeeffffffffe;
-	int rc = syscall(__NR_dup3, fd_old, fd_new, O_CLOEXEC);
-	printf("dup3(%d, %d, O_CLOEXEC) = %d %s (%m)\n",
-	       (int) fd_old, (int) fd_new, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_dup3, fd_old, fd_new, O_CLOEXEC);
+	printf("dup3(%d, %d, O_CLOEXEC) = %ld %s (%m)\n",
+	       (int) fd_old, (int) fd_new, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/epoll_create.c b/tests/epoll_create.c
new file mode 100644
index 0000000..4be06c4
--- /dev/null
+++ b/tests/epoll_create.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_epoll_create
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	const long int size = (long int) 0xdeadbeefffffffff;
+
+	long rc = syscall(__NR_epoll_create, size);
+	printf("epoll_create(%d) = %ld %s (%m)\n",
+	       (int) size, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_creat")
+
+#endif
diff --git a/tests/epoll_create.test b/tests/epoll_create.test
new file mode 100755
index 0000000..472a9bd
--- /dev/null
+++ b/tests/epoll_create.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check epoll_create syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a17
diff --git a/tests/epoll_create1.c b/tests/epoll_create1.c
index 4d2e107..d348492 100644
--- a/tests/epoll_create1.c
+++ b/tests/epoll_create1.c
@@ -26,25 +26,28 @@
  */
 
 #include "tests.h"
-#include <assert.h>
 #include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
 #include <sys/syscall.h>
 
 #if defined __NR_epoll_create1 && defined O_CLOEXEC
 
+# include <stdio.h>
+# include <unistd.h>
+
 int
 main(void)
 {
-	(void) close(0);
+	long rc = syscall(__NR_epoll_create1, O_CLOEXEC);
+	if (rc == -1) {
+		printf("epoll_create1(EPOLL_CLOEXEC) = -1 %s (%m)\n",
+		       errno2name());
+	} else {
+		printf("epoll_create1(EPOLL_CLOEXEC) = %ld\n", rc);
+	}
 
-	if (syscall(__NR_epoll_create1, O_CLOEXEC))
-		perror_msg_and_skip("epoll_create1 O_CLOEXEC");
-	puts("epoll_create1(EPOLL_CLOEXEC) = 0");
-
-	assert(syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK) == -1);
-	printf("epoll_create1(EPOLL_CLOEXEC|%#x) = -1 EINVAL (%m)\n", O_NONBLOCK);
+	rc = syscall(__NR_epoll_create1, O_CLOEXEC | O_NONBLOCK);
+	printf("epoll_create1(EPOLL_CLOEXEC|%#x) = %ld %s (%m)\n",
+	       O_NONBLOCK, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/epoll_ctl.c b/tests/epoll_ctl.c
new file mode 100644
index 0000000..231e271
--- /dev/null
+++ b/tests/epoll_ctl.c
@@ -0,0 +1,45 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_epoll_ctl
+
+# include <inttypes.h>
+# include <stdio.h>
+# include <sys/epoll.h>
+# include <unistd.h>
+
+static long
+invoke_syscall(unsigned long epfd, unsigned long op, unsigned long fd, void *ev)
+{
+	op |= (unsigned long) 0xffffffff00000000;
+	return syscall(__NR_epoll_ctl, epfd, op, fd, (unsigned long) ev);
+}
+
+int
+main(void)
+{
+	struct epoll_event *const ev = tail_alloc(sizeof(*ev));
+	ev->events = EPOLLIN;
+
+	long rc = invoke_syscall(-1U, EPOLL_CTL_ADD, -2U, ev);
+	printf("epoll_ctl(-1, EPOLL_CTL_ADD, -2, {EPOLLIN,"
+	       " {u32=%u, u64=%" PRIu64 "}}) = %ld %s (%m)\n",
+	       ev->data.u32, ev->data.u64, rc, errno2name());
+
+	rc = invoke_syscall(-3U, EPOLL_CTL_DEL, -4U, ev);
+	printf("epoll_ctl(-3, EPOLL_CTL_DEL, -4, %p) = %ld %s (%m)\n",
+	       ev, rc, errno2name());
+
+	rc = invoke_syscall(-1UL, EPOLL_CTL_MOD, -16UL, 0);
+	printf("epoll_ctl(-1, EPOLL_CTL_MOD, -16, NULL) = %ld %s (%m)\n",
+	       rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_ctl")
+
+#endif
diff --git a/tests/epoll_ctl.test b/tests/epoll_ctl.test
new file mode 100755
index 0000000..1aded54
--- /dev/null
+++ b/tests/epoll_ctl.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check epoll_ctl syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/epoll_pwait.c b/tests/epoll_pwait.c
new file mode 100644
index 0000000..acd4218
--- /dev/null
+++ b/tests/epoll_pwait.c
@@ -0,0 +1,32 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_epoll_pwait
+
+# include <signal.h>
+# include <stdio.h>
+# include <sys/epoll.h>
+# include <unistd.h>
+
+# include "kernel_types.h"
+
+int
+main(void)
+{
+	sigset_t set[2];
+	struct epoll_event *const ev = tail_alloc(sizeof(*ev));
+
+	long rc = syscall(__NR_epoll_pwait, -1, ev, 1, -2,
+			  set, (kernel_ulong_t) sizeof(set));
+	printf("epoll_pwait(-1, %p, 1, -2, %p, %u) = %ld %s (%m)\n",
+	       ev, set, (unsigned) sizeof(set), rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_pwait")
+
+#endif
diff --git a/tests/epoll_pwait.test b/tests/epoll_pwait.test
new file mode 100755
index 0000000..c7aeeac
--- /dev/null
+++ b/tests/epoll_pwait.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of epoll_pwait syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/epoll_wait.c b/tests/epoll_wait.c
new file mode 100644
index 0000000..c2eb563
--- /dev/null
+++ b/tests/epoll_wait.c
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_epoll_wait
+
+# include <stdio.h>
+# include <sys/epoll.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	struct epoll_event *const ev = tail_alloc(sizeof(*ev));
+
+	long rc = syscall(__NR_epoll_wait, -1, ev, 1, -2);
+	printf("epoll_wait(-1, %p, 1, -2) = %ld %s (%m)\n",
+	       ev, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_wait")
+
+#endif
diff --git a/tests/epoll_wait.test b/tests/epoll_wait.test
new file mode 100755
index 0000000..83ae161
--- /dev/null
+++ b/tests/epoll_wait.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check epoll_wait syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a26
diff --git a/tests/errno2name.c b/tests/errno2name.c
new file mode 100644
index 0000000..4a17699
--- /dev/null
+++ b/tests/errno2name.c
@@ -0,0 +1,481 @@
+/*
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <errno.h>
+
+#define CASE(x) case x: return #x
+
+const char *
+errno2name(void)
+{
+	switch (errno) {
+	/* names taken from linux/errnoent.h */
+#ifdef E2BIG
+	CASE(E2BIG);
+#endif
+#ifdef EACCES
+	CASE(EACCES);
+#endif
+#ifdef EADDRINUSE
+	CASE(EADDRINUSE);
+#endif
+#ifdef EADDRNOTAVAIL
+	CASE(EADDRNOTAVAIL);
+#endif
+#ifdef EADV
+	CASE(EADV);
+#endif
+#ifdef EAFNOSUPPORT
+	CASE(EAFNOSUPPORT);
+#endif
+#ifdef EAGAIN
+	CASE(EAGAIN);
+#endif
+#ifdef EALREADY
+	CASE(EALREADY);
+#endif
+#ifdef EBADCOOKIE
+	CASE(EBADCOOKIE);
+#endif
+#ifdef EBADE
+	CASE(EBADE);
+#endif
+#ifdef EBADF
+	CASE(EBADF);
+#endif
+#ifdef EBADFD
+	CASE(EBADFD);
+#endif
+#ifdef EBADHANDLE
+	CASE(EBADHANDLE);
+#endif
+#ifdef EBADMSG
+	CASE(EBADMSG);
+#endif
+#ifdef EBADR
+	CASE(EBADR);
+#endif
+#ifdef EBADRQC
+	CASE(EBADRQC);
+#endif
+#ifdef EBADSLT
+	CASE(EBADSLT);
+#endif
+#ifdef EBADTYPE
+	CASE(EBADTYPE);
+#endif
+#ifdef EBFONT
+	CASE(EBFONT);
+#endif
+#ifdef EBUSY
+	CASE(EBUSY);
+#endif
+#ifdef ECANCELED
+	CASE(ECANCELED);
+#endif
+#ifdef ECHILD
+	CASE(ECHILD);
+#endif
+#ifdef ECHRNG
+	CASE(ECHRNG);
+#endif
+#ifdef ECOMM
+	CASE(ECOMM);
+#endif
+#ifdef ECONNABORTED
+	CASE(ECONNABORTED);
+#endif
+#ifdef ECONNREFUSED
+	CASE(ECONNREFUSED);
+#endif
+#ifdef ECONNRESET
+	CASE(ECONNRESET);
+#endif
+#ifdef EDEADLK
+	CASE(EDEADLK);
+#endif
+#ifdef EDESTADDRREQ
+	CASE(EDESTADDRREQ);
+#endif
+#ifdef EDOM
+	CASE(EDOM);
+#endif
+#ifdef EDOTDOT
+	CASE(EDOTDOT);
+#endif
+#ifdef EDQUOT
+	CASE(EDQUOT);
+#endif
+#ifdef EEXIST
+	CASE(EEXIST);
+#endif
+#ifdef EFAULT
+	CASE(EFAULT);
+#endif
+#ifdef EFBIG
+	CASE(EFBIG);
+#endif
+#ifdef EHOSTDOWN
+	CASE(EHOSTDOWN);
+#endif
+#ifdef EHOSTUNREACH
+	CASE(EHOSTUNREACH);
+#endif
+#ifdef EHWPOISON
+	CASE(EHWPOISON);
+#endif
+#ifdef EIDRM
+	CASE(EIDRM);
+#endif
+#ifdef EILSEQ
+	CASE(EILSEQ);
+#endif
+#ifdef EINPROGRESS
+	CASE(EINPROGRESS);
+#endif
+#ifdef EINTR
+	CASE(EINTR);
+#endif
+#ifdef EINVAL
+	CASE(EINVAL);
+#endif
+#ifdef EIO
+	CASE(EIO);
+#endif
+#ifdef EIOCBQUEUED
+	CASE(EIOCBQUEUED);
+#endif
+#ifdef EISCONN
+	CASE(EISCONN);
+#endif
+#ifdef EISDIR
+	CASE(EISDIR);
+#endif
+#ifdef EISNAM
+	CASE(EISNAM);
+#endif
+#ifdef EJUKEBOX
+	CASE(EJUKEBOX);
+#endif
+#ifdef EKEYEXPIRED
+	CASE(EKEYEXPIRED);
+#endif
+#ifdef EKEYREJECTED
+	CASE(EKEYREJECTED);
+#endif
+#ifdef EKEYREVOKED
+	CASE(EKEYREVOKED);
+#endif
+#ifdef EL2HLT
+	CASE(EL2HLT);
+#endif
+#ifdef EL2NSYNC
+	CASE(EL2NSYNC);
+#endif
+#ifdef EL3HLT
+	CASE(EL3HLT);
+#endif
+#ifdef EL3RST
+	CASE(EL3RST);
+#endif
+#ifdef ELIBACC
+	CASE(ELIBACC);
+#endif
+#ifdef ELIBBAD
+	CASE(ELIBBAD);
+#endif
+#ifdef ELIBEXEC
+	CASE(ELIBEXEC);
+#endif
+#ifdef ELIBMAX
+	CASE(ELIBMAX);
+#endif
+#ifdef ELIBSCN
+	CASE(ELIBSCN);
+#endif
+#ifdef ELNRNG
+	CASE(ELNRNG);
+#endif
+#ifdef ELOOP
+	CASE(ELOOP);
+#endif
+#ifdef EMEDIUMTYPE
+	CASE(EMEDIUMTYPE);
+#endif
+#ifdef EMFILE
+	CASE(EMFILE);
+#endif
+#ifdef EMLINK
+	CASE(EMLINK);
+#endif
+#ifdef EMSGSIZE
+	CASE(EMSGSIZE);
+#endif
+#ifdef EMULTIHOP
+	CASE(EMULTIHOP);
+#endif
+#ifdef ENAMETOOLONG
+	CASE(ENAMETOOLONG);
+#endif
+#ifdef ENAVAIL
+	CASE(ENAVAIL);
+#endif
+#ifdef ENETDOWN
+	CASE(ENETDOWN);
+#endif
+#ifdef ENETRESET
+	CASE(ENETRESET);
+#endif
+#ifdef ENETUNREACH
+	CASE(ENETUNREACH);
+#endif
+#ifdef ENFILE
+	CASE(ENFILE);
+#endif
+#ifdef ENOANO
+	CASE(ENOANO);
+#endif
+#ifdef ENOBUFS
+	CASE(ENOBUFS);
+#endif
+#ifdef ENOCSI
+	CASE(ENOCSI);
+#endif
+#ifdef ENODATA
+	CASE(ENODATA);
+#endif
+#ifdef ENODEV
+	CASE(ENODEV);
+#endif
+#ifdef ENOENT
+	CASE(ENOENT);
+#endif
+#ifdef ENOEXEC
+	CASE(ENOEXEC);
+#endif
+#ifdef ENOIOCTLCMD
+	CASE(ENOIOCTLCMD);
+#endif
+#ifdef ENOKEY
+	CASE(ENOKEY);
+#endif
+#ifdef ENOLCK
+	CASE(ENOLCK);
+#endif
+#ifdef ENOLINK
+	CASE(ENOLINK);
+#endif
+#ifdef ENOMEDIUM
+	CASE(ENOMEDIUM);
+#endif
+#ifdef ENOMEM
+	CASE(ENOMEM);
+#endif
+#ifdef ENOMSG
+	CASE(ENOMSG);
+#endif
+#ifdef ENONET
+	CASE(ENONET);
+#endif
+#ifdef ENOPKG
+	CASE(ENOPKG);
+#endif
+#ifdef ENOPROTOOPT
+	CASE(ENOPROTOOPT);
+#endif
+#ifdef ENOSPC
+	CASE(ENOSPC);
+#endif
+#ifdef ENOSR
+	CASE(ENOSR);
+#endif
+#ifdef ENOSTR
+	CASE(ENOSTR);
+#endif
+#ifdef ENOSYS
+	CASE(ENOSYS);
+#endif
+#ifdef ENOTBLK
+	CASE(ENOTBLK);
+#endif
+#ifdef ENOTCONN
+	CASE(ENOTCONN);
+#endif
+#ifdef ENOTDIR
+	CASE(ENOTDIR);
+#endif
+#ifdef ENOTEMPTY
+	CASE(ENOTEMPTY);
+#endif
+#ifdef ENOTNAM
+	CASE(ENOTNAM);
+#endif
+#ifdef ENOTRECOVERABLE
+	CASE(ENOTRECOVERABLE);
+#endif
+#ifdef ENOTSOCK
+	CASE(ENOTSOCK);
+#endif
+#ifdef ENOTSUPP
+	CASE(ENOTSUPP);
+#endif
+#ifdef ENOTSYNC
+	CASE(ENOTSYNC);
+#endif
+#ifdef ENOTTY
+	CASE(ENOTTY);
+#endif
+#ifdef ENOTUNIQ
+	CASE(ENOTUNIQ);
+#endif
+#ifdef ENXIO
+	CASE(ENXIO);
+#endif
+#ifdef EOPENSTALE
+	CASE(EOPENSTALE);
+#endif
+#ifdef EOPNOTSUPP
+	CASE(EOPNOTSUPP);
+#endif
+#ifdef EOVERFLOW
+	CASE(EOVERFLOW);
+#endif
+#ifdef EOWNERDEAD
+	CASE(EOWNERDEAD);
+#endif
+#ifdef EPERM
+	CASE(EPERM);
+#endif
+#ifdef EPFNOSUPPORT
+	CASE(EPFNOSUPPORT);
+#endif
+#ifdef EPIPE
+	CASE(EPIPE);
+#endif
+#ifdef EPROBE_DEFER
+	CASE(EPROBE_DEFER);
+#endif
+#ifdef EPROTO
+	CASE(EPROTO);
+#endif
+#ifdef EPROTONOSUPPORT
+	CASE(EPROTONOSUPPORT);
+#endif
+#ifdef EPROTOTYPE
+	CASE(EPROTOTYPE);
+#endif
+#ifdef ERANGE
+	CASE(ERANGE);
+#endif
+#ifdef EREMCHG
+	CASE(EREMCHG);
+#endif
+#ifdef EREMOTE
+	CASE(EREMOTE);
+#endif
+#ifdef EREMOTEIO
+	CASE(EREMOTEIO);
+#endif
+#ifdef ERESTART
+	CASE(ERESTART);
+#endif
+#ifdef ERESTARTNOHAND
+	CASE(ERESTARTNOHAND);
+#endif
+#ifdef ERESTARTNOINTR
+	CASE(ERESTARTNOINTR);
+#endif
+#ifdef ERESTARTSYS
+	CASE(ERESTARTSYS);
+#endif
+#ifdef ERESTART_RESTARTBLOCK
+	CASE(ERESTART_RESTARTBLOCK);
+#endif
+#ifdef ERFKILL
+	CASE(ERFKILL);
+#endif
+#ifdef EROFS
+	CASE(EROFS);
+#endif
+#ifdef ESERVERFAULT
+	CASE(ESERVERFAULT);
+#endif
+#ifdef ESHUTDOWN
+	CASE(ESHUTDOWN);
+#endif
+#ifdef ESOCKTNOSUPPORT
+	CASE(ESOCKTNOSUPPORT);
+#endif
+#ifdef ESPIPE
+	CASE(ESPIPE);
+#endif
+#ifdef ESRCH
+	CASE(ESRCH);
+#endif
+#ifdef ESRMNT
+	CASE(ESRMNT);
+#endif
+#ifdef ESTALE
+	CASE(ESTALE);
+#endif
+#ifdef ESTRPIPE
+	CASE(ESTRPIPE);
+#endif
+#ifdef ETIME
+	CASE(ETIME);
+#endif
+#ifdef ETIMEDOUT
+	CASE(ETIMEDOUT);
+#endif
+#ifdef ETOOMANYREFS
+	CASE(ETOOMANYREFS);
+#endif
+#ifdef ETOOSMALL
+	CASE(ETOOSMALL);
+#endif
+#ifdef ETXTBSY
+	CASE(ETXTBSY);
+#endif
+#ifdef EUCLEAN
+	CASE(EUCLEAN);
+#endif
+#ifdef EUNATCH
+	CASE(EUNATCH);
+#endif
+#ifdef EUSERS
+	CASE(EUSERS);
+#endif
+#ifdef EXDEV
+	CASE(EXDEV);
+#endif
+#ifdef EXFULL
+	CASE(EXFULL);
+#endif
+	default: perror_msg_and_fail("unknown errno %d", errno);
+	}
+}
diff --git a/tests/execve.c b/tests/execve.c
index 82e32c6..852eebf 100644
--- a/tests/execve.c
+++ b/tests/execve.c
@@ -28,7 +28,6 @@
  */
 
 #include "tests.h"
-#include <errno.h>
 #include <stdio.h>
 #include <unistd.h>
 
diff --git a/tests/execveat.c b/tests/execveat.c
index d4ead40..972fc17 100644
--- a/tests/execveat.c
+++ b/tests/execveat.c
@@ -28,7 +28,6 @@
  */
 
 #include "tests.h"
-#include <errno.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/syscall.h>
@@ -74,7 +73,7 @@
 #ifdef VERBOSE_EXECVEAT
 	       q_envp[0], q_envp[1], envp[2], envp[3], envp[4],
 #endif
-	       errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       errno2name());
 
 	tail_argv[ARRAY_SIZE(q_argv)] = NULL;
 	tail_envp[ARRAY_SIZE(q_envp)] = NULL;
@@ -91,7 +90,7 @@
 #ifdef VERBOSE_EXECVEAT
 	       q_envp[0], q_envp[1],
 #endif
-	       errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       errno2name());
 
 	syscall(__NR_execveat, -100, FILENAME, tail_argv + 2, tail_envp + 1, 0x1100);
 	printf("execveat(AT_FDCWD, \"%s\", [\"%s\"]"
@@ -105,7 +104,7 @@
 #ifdef VERBOSE_EXECVEAT
 	       q_envp[1],
 #endif
-	       errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       errno2name());
 
 	char **const empty = tail_alloc(sizeof(*empty));
 	char **const efault = empty + 1;
@@ -119,7 +118,7 @@
 	       ", [/* 0 vars */]"
 #endif
 	       ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-	       Q_FILENAME, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       Q_FILENAME, errno2name());
 
 	char str_a[] = "012345678901234567890123456789012";
 	char str_b[] = "_abcdefghijklmnopqrstuvwxyz()[]{}";
@@ -150,7 +149,7 @@
 	printf("], [/* %u vars */", DEFAULT_STRLEN + 1);
 #endif
 	printf("], AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-	       errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       errno2name());
 
 	syscall(__NR_execveat, -100, FILENAME, a + 1, b + 1, 0x1100);
 	printf("execveat(AT_FDCWD, \"%s\", [\"%s\"", Q_FILENAME, a[1]);
@@ -164,17 +163,17 @@
 	printf("], [/* %d vars */", DEFAULT_STRLEN);
 #endif
 	printf("], AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-	       errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       errno2name());
 
 	syscall(__NR_execveat, -100, FILENAME, NULL, efault, 0x1100);
 	printf("execveat(AT_FDCWD, \"%s\", NULL, %p"
 	       ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-	       Q_FILENAME, efault, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       Q_FILENAME, efault, errno2name());
 
 	syscall(__NR_execveat, -100, FILENAME, efault, NULL, 0x1100);
 	printf("execveat(AT_FDCWD, \"%s\", %p, NULL"
 	       ", AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) = -1 %s (%m)\n",
-	       Q_FILENAME, efault, errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	       Q_FILENAME, efault, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/faccessat.c b/tests/faccessat.c
index 39c006a..06a6ae3 100644
--- a/tests/faccessat.c
+++ b/tests/faccessat.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_faccessat
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -13,10 +12,9 @@
 	static const char sample[] = "faccessat.sample";
 	const long int fd = (long int) 0xdeadbeefffffffff;
 
-	int rc = syscall(__NR_faccessat, fd, sample, F_OK);
-	printf("faccessat(%d, \"%s\", F_OK) = %d %s (%m)\n",
-	       (int) fd, sample, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	long rc = syscall(__NR_faccessat, fd, sample, F_OK);
+	printf("faccessat(%d, \"%s\", F_OK) = %ld %s (%m)\n",
+	       (int) fd, sample, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/fchdir.c b/tests/fchdir.c
new file mode 100644
index 0000000..7306d4d
--- /dev/null
+++ b/tests/fchdir.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fchdir
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	const long int fd = (long int) 0xdeadbeefffffffff;
+
+	long rc = syscall(__NR_fchdir, fd);
+	printf("fchdir(%d) = %ld %s (%m)\n",
+	       (int) fd, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_fchdir")
+
+#endif
diff --git a/tests/fchdir.test b/tests/fchdir.test
new file mode 100755
index 0000000..3a4296e
--- /dev/null
+++ b/tests/fchdir.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check fchdir syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a11
diff --git a/tests/fchmod.c b/tests/fchmod.c
index d9ef93e..57fefa1 100644
--- a/tests/fchmod.c
+++ b/tests/fchmod.c
@@ -34,7 +34,6 @@
 #include <sys/stat.h>
 #include <stdio.h>
 #include <unistd.h>
-#include <errno.h>
 
 int
 main(void)
@@ -56,15 +55,8 @@
 
 		if (syscall(__NR_fchmod, fd, 0600) != -1)
 			perror_msg_and_fail("fchmod");
-
-		printf("fchmod(%d, 0600) = -1 EBADF (%m)\n", fd);
-	} else {
-		if (errno == ENOSYS) {
-			printf("fchmod(%d, 0600) = -1 ENOSYS (%m)\n", fd);
-		} else {
-			perror_msg_and_fail("fchmod");
-		}
 	}
+	printf("fchmod(%d, 0600) = -1 %s (%m)\n", fd, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/fchmodat.c b/tests/fchmodat.c
index 6281fcf..2ae613e 100644
--- a/tests/fchmodat.c
+++ b/tests/fchmodat.c
@@ -32,7 +32,6 @@
 
 #ifdef __NR_fchmodat
 
-# include <errno.h>
 # include <fcntl.h>
 # include <stdio.h>
 # include <unistd.h>
@@ -41,7 +40,6 @@
 main(void)
 {
 	static const char sample[] = "fchmodat_sample";
-	const char *err;
 
 	if (open(sample, O_RDONLY | O_CREAT, 0400) == -1)
 		perror_msg_and_fail("open");
@@ -54,16 +52,10 @@
 
 		if (syscall(__NR_fchmodat, -100, sample, 0600) != -1)
 			perror_msg_and_fail("fchmodat");
-
-		err = "ENOENT";
-	} else {
-		if (errno != ENOSYS)
-			perror_msg_and_fail("fchmodat");
-		err = "ENOSYS";
 	}
 
 	printf("fchmodat(AT_FDCWD, \"%s\", 0600) = -1 %s (%m)\n",
-	       sample, err);
+	       sample, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/fchown.c b/tests/fchown.c
new file mode 100644
index 0000000..53a522e
--- /dev/null
+++ b/tests/fchown.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fchown
+
+# define SYSCALL_NR __NR_fchown
+# define SYSCALL_NAME "fchown"
+# define ACCESS_BY_DESCRIPTOR
+
+# if defined __NR_fchown32 && __NR_fchown != __NR_fchown32
+#  define UGID_TYPE_IS_SHORT
+# endif
+
+# include "xchownx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_fchown")
+
+#endif
diff --git a/tests/fchown.test b/tests/fchown.test
new file mode 100755
index 0000000..63a0f2e
--- /dev/null
+++ b/tests/fchown.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check fchown syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a16
diff --git a/tests/fchown32.c b/tests/fchown32.c
new file mode 100644
index 0000000..0927b56
--- /dev/null
+++ b/tests/fchown32.c
@@ -0,0 +1,15 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fchown32
+
+# define SYSCALL_NR __NR_fchown32
+# define SYSCALL_NAME "fchown32"
+# define ACCESS_BY_DESCRIPTOR
+# include "xchownx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_fchown32")
+
+#endif
diff --git a/tests/fchown32.test b/tests/fchown32.test
new file mode 100755
index 0000000..e837f54
--- /dev/null
+++ b/tests/fchown32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check fchown32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a18
diff --git a/tests/fchownat.c b/tests/fchownat.c
index b1d06f6..9a0ecc8 100644
--- a/tests/fchownat.c
+++ b/tests/fchownat.c
@@ -33,7 +33,6 @@
 
 #if defined __NR_fchownat && defined AT_FDCWD && defined AT_SYMLINK_NOFOLLOW
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -47,24 +46,22 @@
 	if (open(sample, O_RDONLY | O_CREAT, 0400) == -1)
 		perror_msg_and_fail("open");
 
-	if (syscall(__NR_fchownat, AT_FDCWD, sample, uid, gid, 0) == 0) {
+	long rc = syscall(__NR_fchownat, AT_FDCWD, sample, uid, gid, 0);
+	if (rc == 0) {
 		printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0) = 0\n",
 		       sample, uid, gid);
 
 		if (unlink(sample))
 			perror_msg_and_fail("unlink");
 
-		if (syscall(__NR_fchownat, AT_FDCWD, sample,
-			    -1, -1L, AT_SYMLINK_NOFOLLOW) != -1)
-			perror_msg_and_fail("fchownat");
+		rc = syscall(__NR_fchownat, AT_FDCWD,
+			     sample, -1, -1L, AT_SYMLINK_NOFOLLOW);
 
 		printf("fchownat(AT_FDCWD, \"%s\", -1, -1, AT_SYMLINK_NOFOLLOW)"
-		       " = -1 ENOENT (%m)\n", sample);
+		       " = %ld %s (%m)\n", sample, rc, errno2name());
 	} else {
-		if (errno != ENOSYS)
-			perror_msg_and_fail("fchownat");
 		printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0)"
-		       " = -1 ENOSYS (%m)\n", sample, uid, gid);
+		       " = %ld %s (%m)\n", sample, uid, gid, rc, errno2name());
 	}
 
 	puts("+++ exited with 0 +++");
diff --git a/tests/fcntl.c b/tests/fcntl.c
index dfad530..1ea83e1 100644
--- a/tests/fcntl.c
+++ b/tests/fcntl.c
@@ -44,7 +44,7 @@
 		.l_start = 0xdefaced1facefeed,
 		.l_len = 0xdefaced2cafef00d
 	};
-	syscall(TEST_SYSCALL_NR, 0, cmd, &fl);
+	invoke_test_syscall(cmd, &fl);
 	printf("%s(0, %s, %p) = %s\n",
 	       TEST_SYSCALL_STR, name, &fl, EINVAL_STR);
 }
diff --git a/tests/fcntl64.c b/tests/fcntl64.c
index 726576e..b83a098 100644
--- a/tests/fcntl64.c
+++ b/tests/fcntl64.c
@@ -44,7 +44,7 @@
 		.l_start = 0xdefaced1facefeed,
 		.l_len = 0xdefaced2cafef00d
 	};
-	syscall(TEST_SYSCALL_NR, 0, cmd, &fl);
+	invoke_test_syscall(cmd, &fl);
 	printf("%s(0, %s, {l_type=F_RDLCK, l_whence=SEEK_SET"
 	       ", l_start=%jd, l_len=%jd}) = %s\n", TEST_SYSCALL_STR, name,
 	       (intmax_t) fl.l_start, (intmax_t) fl.l_len, EINVAL_STR);
@@ -64,7 +64,7 @@
 		.l_type = F_RDLCK,
 		.l_len = FILE_LEN
 	};
-	int rc = syscall(TEST_SYSCALL_NR, 0, F_SETLK64, &fl);
+	long rc = invoke_test_syscall(F_SETLK64, &fl);
 	printf("%s(0, F_SETLK64, {l_type=F_RDLCK, l_whence=SEEK_SET"
 	       ", l_start=0, l_len=%d}) = %s\n",
 	       TEST_SYSCALL_STR, FILE_LEN, rc ? EINVAL_STR : "0");
@@ -72,12 +72,12 @@
 	if (rc)
 		return;
 
-	syscall(TEST_SYSCALL_NR, 0, F_GETLK64, &fl);
+	invoke_test_syscall(F_GETLK64, &fl);
 	printf("%s(0, F_GETLK64, {l_type=F_UNLCK, l_whence=SEEK_SET"
 	       ", l_start=0, l_len=%d, l_pid=0}) = 0\n",
 	       TEST_SYSCALL_STR, FILE_LEN);
 
-	syscall(TEST_SYSCALL_NR, 0, F_SETLK64, &fl);
+	invoke_test_syscall(F_SETLK64, &fl);
 	printf("%s(0, F_SETLK64, {l_type=F_UNLCK, l_whence=SEEK_SET"
 	       ", l_start=0, l_len=%d}) = 0\n",
 	       TEST_SYSCALL_STR, FILE_LEN);
diff --git a/tests/fdatasync.c b/tests/fdatasync.c
index 382f47d..86f1cfa 100644
--- a/tests/fdatasync.c
+++ b/tests/fdatasync.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_fdatasync
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -11,10 +10,9 @@
 main(void)
 {
 	const long int fd = (long int) 0xdeadbeefffffffff;
-	int rc = syscall(__NR_fdatasync, fd);
-	printf("fdatasync(%d) = %d %s (%m)\n",
-	       (int) fd, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_fdatasync, fd);
+	printf("fdatasync(%d) = %ld %s (%m)\n", (int) fd, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/file_handle.c b/tests/file_handle.c
index dba48be..ac2b358 100644
--- a/tests/file_handle.c
+++ b/tests/file_handle.c
@@ -72,20 +72,8 @@
 	       ", f_handle=0x", handle->handle_bytes, handle->handle_type);
 	for (i = 0; i < handle->handle_bytes; ++i)
 		printf("%02x", handle->f_handle[i]);
-	printf("}, O_RDONLY|O_DIRECTORY) = -1 ");
-	assert(open_by_handle_at(-1, handle, O_RDONLY | O_DIRECTORY) == -1);
-	const char *errno_text;
-	switch (errno) {
-		case EPERM:
-			errno_text = "EPERM";
-			break;
-		case EINVAL:
-			errno_text = "EINVAL";
-			break;
-		default:
-			errno_text = "EBADF";
-	}
-	printf("%s (%m)\n", errno_text);
+	int rc = open_by_handle_at(-1, handle, O_RDONLY | O_DIRECTORY);
+	printf("}, O_RDONLY|O_DIRECTORY) = %d %s (%m)\n", rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/file_ioctl.c b/tests/file_ioctl.c
new file mode 100644
index 0000000..0fe17b1
--- /dev/null
+++ b/tests/file_ioctl.c
@@ -0,0 +1,45 @@
+#include "tests.h"
+
+#ifdef HAVE_LINUX_FIEMAP_H
+
+# include <stdio.h>
+# include <sys/ioctl.h>
+# include <linux/fiemap.h>
+# include <linux/fs.h>
+# include "xlat.h"
+# include "xlat/fiemap_flags.h"
+
+static void
+test_fiemap(void)
+{
+	(void) tail_alloc(1);
+	struct fiemap *const args = tail_alloc(sizeof(*args));
+
+	printf("ioctl(-1, FS_IOC_FIEMAP, {fm_start=%" PRI__u64
+	       ", fm_length=%" PRI__u64", fm_flags=",
+	       args->fm_start, args->fm_length);
+	printflags(fiemap_flags, args->fm_flags, "FIEMAP_FLAG_???");
+	printf(", fm_extent_count=%u})", args->fm_extent_count);
+	ioctl(-1, FS_IOC_FIEMAP, args);
+	printf(" = -1 EBADF (%m)\n");
+
+	/* The live version of this test is in btrfs.c */
+}
+
+/* clone and dedupe ioctls are in btrfs.c since they originated there */
+
+int
+main(int argc, char *argv[])
+{
+	test_fiemap();
+
+	puts("+++ exited with 0 +++");
+
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("HAVE_LINUX_FIEMAP_H")
+
+#endif
diff --git a/tests/file_ioctl.test b/tests/file_ioctl.test
new file mode 100755
index 0000000..7b8b8ce
--- /dev/null
+++ b/tests/file_ioctl.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check FS_IOC_FIEMAP ioctl decoding.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/flock.c b/tests/flock.c
index cd25185..d6e2008 100644
--- a/tests/flock.c
+++ b/tests/flock.c
@@ -3,19 +3,18 @@
 
 #ifdef __NR_flock
 
-# include <errno.h>
-# include <sys/file.h>
 # include <stdio.h>
+# include <sys/file.h>
 # include <unistd.h>
 
 int
 main(void)
 {
 	const unsigned long fd = (long int) 0xdeadbeefffffffff;
-	int rc = syscall(__NR_flock, fd, LOCK_SH);
-	printf("flock(%d, LOCK_SH) = %d %s (%m)\n",
-	       (int) fd, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_flock, fd, LOCK_SH);
+	printf("flock(%d, LOCK_SH) = %ld %s (%m)\n",
+	       (int) fd, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/fstatfs.c b/tests/fstatfs.c
new file mode 100644
index 0000000..7ff39dc
--- /dev/null
+++ b/tests/fstatfs.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fstatfs
+
+# define SYSCALL_ARG_FMT		"%d"
+# define SYSCALL_ARG(file, desc)	(desc)
+# define SYSCALL_NR			__NR_fstatfs
+# define SYSCALL_NAME			"fstatfs"
+# include "xstatfs.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_fstatfs")
+
+#endif
diff --git a/tests/fstatfs.test b/tests/fstatfs.test
new file mode 100755
index 0000000..646e66f
--- /dev/null
+++ b/tests/fstatfs.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check fstatfs syscall decoding.
+
+. "${srcdir=.}/statfs.test"
diff --git a/tests/fstatfs64.c b/tests/fstatfs64.c
new file mode 100644
index 0000000..6c59974
--- /dev/null
+++ b/tests/fstatfs64.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fstatfs64
+
+# define SYSCALL_ARG_FMT		"%d"
+# define SYSCALL_ARG(file, desc)	(desc)
+# define SYSCALL_NR			__NR_fstatfs64
+# define SYSCALL_NAME			"fstatfs64"
+# include "xstatfs64.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_fstatfs64")
+
+#endif
diff --git a/tests/fstatfs64.test b/tests/fstatfs64.test
new file mode 100755
index 0000000..179ff1b
--- /dev/null
+++ b/tests/fstatfs64.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check fstatfs64 syscall decoding.
+
+. "${srcdir=.}/statfs.test"
diff --git a/tests/fsync.c b/tests/fsync.c
index 774420e..911c167 100644
--- a/tests/fsync.c
+++ b/tests/fsync.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_fsync
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -11,10 +10,9 @@
 main(void)
 {
 	const long int fd = (long int) 0xdeadbeefffffffff;
-	int rc = syscall(__NR_fsync, fd);
-	printf("fsync(%d) = %d %s (%m)\n",
-	       (int) fd, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_fsync, fd);
+	printf("fsync(%d) = %ld %s (%m)\n", (int) fd, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/ftruncate.c b/tests/ftruncate.c
index 68e3fa8..db8388b 100644
--- a/tests/ftruncate.c
+++ b/tests/ftruncate.c
@@ -30,8 +30,6 @@
 
 #ifdef __NR_ftruncate
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -41,17 +39,15 @@
 main(void)
 {
 	const kernel_ulong_t len = (kernel_ulong_t) 0xdefaced0badc0deULL;
+	long rc;
 
 	if (sizeof(len) > sizeof(long))
-		assert(ftruncate(-1, len) == -1);
+		rc = ftruncate(-1, len);
 	else
-		assert(syscall(__NR_ftruncate, -1L, len) == -1);
+		rc = syscall(__NR_ftruncate, -1L, len);
 
-	if (EBADF != errno)
-		perror_msg_and_skip("ftruncate");
-
-	printf("ftruncate(-1, %llu) = -1 EBADF (%m)\n",
-	       (unsigned long long) len);
+	printf("ftruncate(-1, %llu) = %ld %s (%m)\n",
+	       (unsigned long long) len, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/ftruncate64.c b/tests/ftruncate64.c
index 37d0084..0b13eaf 100644
--- a/tests/ftruncate64.c
+++ b/tests/ftruncate64.c
@@ -30,8 +30,6 @@
 
 #ifdef __NR_ftruncate64
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -40,12 +38,9 @@
 {
 	const off_t len = 0xdefaceddeadbeef;
 
-	assert(ftruncate(-1, len) == -1);
-	if (EBADF != errno)
-		perror_msg_and_skip("ftruncate");
-
-	printf("ftruncate64(-1, %llu) = -1 EBADF (%m)\n",
-	       (unsigned long long) len);
+	int rc = ftruncate(-1, len);
+	printf("ftruncate64(-1, %llu) = %d %s (%m)\n",
+	       (unsigned long long) len, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/futimesat.c b/tests/futimesat.c
new file mode 100644
index 0000000..785c894
--- /dev/null
+++ b/tests/futimesat.c
@@ -0,0 +1,86 @@
+/*
+ * Check decoding of futimesat syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_futimesat
+
+# include <stdio.h>
+# include <sys/time.h>
+# include <unistd.h>
+
+#define CAST_NUM(n)						\
+	(sizeof(n) == sizeof(long) ?				\
+		(unsigned long long) (unsigned long) (n) :	\
+		(unsigned long long) (n))
+
+int
+main(void)
+{
+	struct timeval tv;
+	if (gettimeofday(&tv, NULL))
+		perror_msg_and_fail("gettimeofday");
+
+	static const char sample[] = "futimesat_sample";
+	unsigned long dirfd = (unsigned long) 0xdeadbeef00000000 | -100U;
+
+	long rc = syscall(__NR_futimesat, dirfd, sample, 0);
+	printf("futimesat(AT_FDCWD, \"%s\", NULL) = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	struct timeval *const ts = tail_alloc(sizeof(*ts) * 2);
+	dirfd = (unsigned long) 0xdeadbeefffffffff;
+
+	rc = syscall(__NR_futimesat, dirfd, 0, ts + 1);
+	printf("futimesat(%d, NULL, %p) = %ld %s (%m)\n",
+	       (int) dirfd, ts + 1, rc, errno2name());
+
+	ts[0].tv_sec = tv.tv_sec;
+	ts[0].tv_usec = tv.tv_usec;
+	ts[1].tv_sec = tv.tv_sec - 1;
+	ts[1].tv_usec = tv.tv_usec + 1;
+
+	(void) close(0);
+	rc = syscall(__NR_futimesat, 0, "", ts);
+	printf("futimesat(0, \"\", [{%llu, %llu}, {%llu, %llu}])"
+	       " = %ld %s (%m)\n",
+	       CAST_NUM(ts[0].tv_sec), CAST_NUM(ts[0].tv_usec),
+	       CAST_NUM(ts[1].tv_sec), CAST_NUM(ts[1].tv_usec),
+	       rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_futimesat")
+
+#endif
diff --git a/tests/futimesat.test b/tests/futimesat.test
new file mode 100755
index 0000000..3a67c04
--- /dev/null
+++ b/tests/futimesat.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check futimesat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a28
diff --git a/tests/get_mempolicy.c b/tests/get_mempolicy.c
new file mode 100644
index 0000000..6923a21
--- /dev/null
+++ b/tests/get_mempolicy.c
@@ -0,0 +1,135 @@
+/*
+ * Check decoding of get_mempolicy syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_get_mempolicy
+
+# include <stdio.h>
+# include <unistd.h>
+
+# include "xlat.h"
+# include "xlat/policies.h"
+
+# define MAX_STRLEN 3
+# define NLONGS(n) ((n + 8 * sizeof(long) - 2) \
+		      / (8 * sizeof(long)))
+
+static void
+print_nodes(unsigned long maxnode)
+{
+	unsigned long *const nodemask =
+		tail_alloc(sizeof(*nodemask) * NLONGS(maxnode));
+
+	if (syscall(__NR_get_mempolicy, 0, nodemask, maxnode, 0, 0)) {
+		printf("get_mempolicy(NULL, %p, %lu, NULL, 0) = -1 %s (%m)\n",
+		       nodemask, maxnode, errno2name());
+		return;
+	}
+
+	printf("get_mempolicy(NULL, [");
+
+	unsigned int nlongs = NLONGS(maxnode);
+	unsigned int i;
+	for (i = 0; i < nlongs; ++i) {
+		if (i)
+			fputs(", ", stdout);
+		if (i >= MAX_STRLEN) {
+			fputs("...", stdout);
+			break;
+		}
+		printf("%#0*lx", (int) sizeof(*nodemask) * 2 + 2, nodemask[i]);
+	}
+
+	printf("], %lu, NULL, 0) = 0\n", maxnode);
+}
+
+int
+main(void)
+{
+	long rc;
+
+	if (syscall(__NR_get_mempolicy, 0, 0, 0, 0, 0))
+		perror_msg_and_skip("get_mempolicy");
+	puts("get_mempolicy(NULL, NULL, 0, NULL, 0) = 0");
+
+	int *mode = (void *) 0xdefaced1baddeed2;
+	unsigned long maxnode = (unsigned long) 0xcafef00dbadc0ded;
+	const unsigned long *nodemask = (void *) 0xfacedad3bebefed4;
+	const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef;
+	const unsigned long flags = -1U;
+	rc = syscall(__NR_get_mempolicy, mode, nodemask, maxnode, addr, flags);
+	printf("get_mempolicy(%p, %p, %lu, %#lx, %s|%#lx) = %ld %s (%m)\n",
+	       mode, nodemask, maxnode, addr,
+	       "MPOL_F_NODE|MPOL_F_ADDR",
+	       flags & ~3, rc, errno2name());
+
+	mode = tail_alloc(sizeof(*mode));
+
+	rc = syscall(__NR_get_mempolicy, mode, 0, 0, 0, 0);
+	printf("get_mempolicy([");
+	printxval(policies, (unsigned) *mode, "MPOL_???");
+	printf("], NULL, 0, NULL, 0) = %ld\n", rc);
+
+	*mode = -1;
+	rc = syscall(__NR_get_mempolicy, mode, 0, 0, mode - 1, 2);
+	printf("get_mempolicy([");
+	printxval(policies, (unsigned) *mode, "MPOL_???");
+	printf("], NULL, 0, %p, MPOL_F_ADDR) = %ld\n", mode - 1, rc);
+
+	maxnode = get_page_size() * 8;
+
+	print_nodes(maxnode);
+	print_nodes(maxnode + 1);
+	print_nodes(maxnode + 2);
+
+	maxnode = sizeof(*nodemask) * 8;
+	print_nodes(maxnode - 1);
+	print_nodes(maxnode    );
+	print_nodes(maxnode + 1);
+	print_nodes(maxnode + 2);
+	print_nodes(maxnode * 2 - 1);
+	print_nodes(maxnode * 2    );
+	print_nodes(maxnode * 2 + 1);
+	print_nodes(maxnode * 2 + 2);
+	print_nodes(maxnode * 3 - 1);
+	print_nodes(maxnode * 3    );
+	print_nodes(maxnode * 3 + 1);
+	print_nodes(maxnode * 3 + 2);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_get_mempolicy")
+
+#endif
diff --git a/tests/get_mempolicy.test b/tests/get_mempolicy.test
new file mode 100755
index 0000000..9227097
--- /dev/null
+++ b/tests/get_mempolicy.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check get_mempolicy syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -s3 -a38
diff --git a/tests/getdents.c b/tests/getdents.c
index 16541df..7ea2067 100644
--- a/tests/getdents.c
+++ b/tests/getdents.c
@@ -96,7 +96,6 @@
 main(int ac, const char **av)
 {
 	char *dname;
-	int rc;
 
 	assert(ac == 1);
 	assert(asprintf(&dname, "%s.test.tmp.dir", av[0]) > 0);
@@ -106,9 +105,16 @@
 	assert(!creat(fname, 0600));
 	assert(!close(0));
 	assert(!open(".", O_RDONLY | O_DIRECTORY));
-	while ((rc = syscall(__NR_getdents, 0, buf, sizeof(buf)))) {
+
+	unsigned long count = (unsigned long) 0xfacefeeddeadbeef;
+	long rc = syscall(__NR_getdents, (long) 0xdefacedffffffff, NULL, count);
+	printf("getdents(-1, NULL, %u) = %ld %s (%m)\n",
+	       (unsigned) count, rc, errno2name());
+
+	count = (unsigned long) 0xfacefeed00000000 | sizeof(buf);
+	while ((rc = syscall(__NR_getdents, 0, buf, count))) {
 		kernel_dirent *d;
-		int i;
+		long i;
 
 		if (rc < 0)
 			perror_msg_and_skip("getdents");
@@ -119,9 +125,9 @@
 				printf(", ");
 			print_dirent(d);
 		}
-		printf("], %zu) = %d\n", sizeof(buf), rc);
+		printf("], %u) = %ld\n", (unsigned) count, rc);
 	}
-	printf("getdents(0, [], %zu) = 0\n", sizeof(buf));
+	printf("getdents(0, [], %u) = 0\n", (unsigned) count);
 	puts("+++ exited with 0 +++");
 	assert(!unlink(fname));
 	assert(!chdir(".."));
diff --git a/tests/getdents64.c b/tests/getdents64.c
index 7077d9c..54149d2 100644
--- a/tests/getdents64.c
+++ b/tests/getdents64.c
@@ -101,7 +101,6 @@
 main(int ac, const char **av)
 {
 	char *dname;
-	int rc;
 
 	assert(ac == 1);
 	assert(asprintf(&dname, "%s.test.tmp.dir", av[0]) > 0);
@@ -111,9 +110,16 @@
 	assert(!creat(fname, 0600));
 	assert(!close(0));
 	assert(!open(".", O_RDONLY | O_DIRECTORY));
-	while ((rc = syscall(__NR_getdents64, 0, buf, sizeof(buf)))) {
+
+	unsigned long count = (unsigned long) 0xfacefeeddeadbeef;
+	long rc = syscall(__NR_getdents64, (long) 0xdefacedffffffff, NULL, count);
+	printf("getdents64(-1, NULL, %u) = %ld %s (%m)\n",
+	       (unsigned) count, rc, errno2name());
+
+	count = (unsigned long) 0xfacefeed00000000 | sizeof(buf);
+	while ((rc = syscall(__NR_getdents64, 0, buf, count))) {
 		kernel_dirent64 *d;
-		int i;
+		long i;
 
 		if (rc < 0)
 			perror_msg_and_skip("getdents64");
@@ -124,9 +130,9 @@
 				printf(", ");
 			print_dirent(d);
 		}
-		printf("], %zu) = %d\n", sizeof(buf), rc);
+		printf("], %u) = %ld\n", (unsigned) count, rc);
 	}
-	printf("getdents64(0, [], %zu) = 0\n", sizeof(buf));
+	printf("getdents64(0, [], %u) = 0\n", (unsigned) count);
 	puts("+++ exited with 0 +++");
 	assert(!unlink(fname));
 	assert(!chdir(".."));
diff --git a/tests/getegid.c b/tests/getegid.c
new file mode 100644
index 0000000..31e4b44
--- /dev/null
+++ b/tests/getegid.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getegid
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getegid() = %ld\n", syscall(__NR_getegid));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getegid")
+
+#endif
diff --git a/tests/getegid.test b/tests/getegid.test
new file mode 100755
index 0000000..4354158
--- /dev/null
+++ b/tests/getegid.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check getegid syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/getegid32.c b/tests/getegid32.c
new file mode 100644
index 0000000..7dc358a
--- /dev/null
+++ b/tests/getegid32.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getegid32
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getegid32() = %ld\n", syscall(__NR_getegid32));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getegid32")
+
+#endif
diff --git a/tests/getegid32.test b/tests/getegid32.test
new file mode 100755
index 0000000..a266620
--- /dev/null
+++ b/tests/getegid32.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check getegid32 syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/geteuid.c b/tests/geteuid.c
new file mode 100644
index 0000000..0820656
--- /dev/null
+++ b/tests/geteuid.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_geteuid
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("geteuid() = %ld\n", syscall(__NR_geteuid));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_geteuid")
+
+#endif
diff --git a/tests/geteuid.test b/tests/geteuid.test
new file mode 100755
index 0000000..14ff6a6
--- /dev/null
+++ b/tests/geteuid.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check geteuid syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/geteuid32.c b/tests/geteuid32.c
new file mode 100644
index 0000000..7e731d0
--- /dev/null
+++ b/tests/geteuid32.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_geteuid32
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("geteuid32() = %ld\n", syscall(__NR_geteuid32));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_geteuid32")
+
+#endif
diff --git a/tests/geteuid32.test b/tests/geteuid32.test
new file mode 100755
index 0000000..9dd173d
--- /dev/null
+++ b/tests/geteuid32.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check geteuid32 syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/getgid.c b/tests/getgid.c
new file mode 100644
index 0000000..46969d3
--- /dev/null
+++ b/tests/getgid.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getgid
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getgid() = %ld\n", syscall(__NR_getgid));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getgid")
+
+#endif
diff --git a/tests/getgid.test b/tests/getgid.test
new file mode 100755
index 0000000..f4f0c2e
--- /dev/null
+++ b/tests/getgid.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check getgid syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/getgid32.c b/tests/getgid32.c
new file mode 100644
index 0000000..11580d0
--- /dev/null
+++ b/tests/getgid32.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getgid32
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getgid32() = %ld\n", syscall(__NR_getgid32));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getgid32")
+
+#endif
diff --git a/tests/getgid32.test b/tests/getgid32.test
new file mode 100755
index 0000000..3bc98d1
--- /dev/null
+++ b/tests/getgid32.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check getgid32 syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/getgroups.c b/tests/getgroups.c
new file mode 100644
index 0000000..d70689c
--- /dev/null
+++ b/tests/getgroups.c
@@ -0,0 +1,148 @@
+/*
+ * Check decoding of getgroups/getgroups32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __NR_getgroups32
+
+# define SYSCALL_NR	__NR_getgroups32
+# define SYSCALL_NAME	"getgroups32"
+# define GID_TYPE	unsigned int
+
+#else
+
+# include "tests.h"
+# include <sys/syscall.h>
+
+# ifdef __NR_getgroups
+
+#  define SYSCALL_NR	__NR_getgroups
+#  define SYSCALL_NAME	"getgroups"
+#  if defined __NR_getgroups32 && __NR_getgroups != __NR_getgroups32
+#   define GID_TYPE	unsigned short
+#  else
+#   define GID_TYPE	unsigned int
+#  endif
+
+# endif
+
+#endif
+
+#ifdef GID_TYPE
+
+# include <stdio.h>
+# include <unistd.h>
+
+#define MAX_STRLEN 32
+static long ngroups;
+
+static void
+get_groups(const long size, GID_TYPE *const g)
+{
+	long i = syscall(SYSCALL_NR, size, g);
+	if (i != ngroups)
+		perror_msg_and_fail("%s(%#lx, %p)", SYSCALL_NAME, size, g);
+
+	printf("%s(%u, [", SYSCALL_NAME, (unsigned) size);
+	for (i = 0; i < ngroups; ++i) {
+		if (i)
+			printf(", ");
+		if (i >= MAX_STRLEN) {
+			printf("...");
+			break;
+		}
+		printf("%u", (unsigned int) g[i]);
+	}
+	printf("]) = %ld\n", ngroups);
+}
+
+int
+main(void)
+{
+	long rc;
+
+	/* check how the first argument is decoded */
+	ngroups = syscall(SYSCALL_NR, 0, 0);
+	printf("%s(0, NULL) = %ld\n", SYSCALL_NAME, ngroups);
+	if (ngroups < 0)
+		perror_msg_and_fail(SYSCALL_NAME);
+
+	rc = syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL, 0);
+	printf("%s(0, NULL) = %ld\n", SYSCALL_NAME, rc);
+
+	rc = syscall(SYSCALL_NR, -1U, 0);
+	printf("%s(%u, NULL) = %ld %s (%m)\n",
+	       SYSCALL_NAME, -1U, rc, errno2name());
+
+	rc = syscall(SYSCALL_NR, -1L, 0);
+	printf("%s(%u, NULL) = %ld %s (%m)\n",
+	       SYSCALL_NAME, -1U, rc, errno2name());
+
+	const unsigned int ngroups_max = sysconf(_SC_NGROUPS_MAX);
+
+	rc = syscall(SYSCALL_NR, ngroups_max, 0);
+	if (rc < 0)
+		printf("%s(%u, NULL) = %ld %s (%m)\n",
+		       SYSCALL_NAME, ngroups_max, rc, errno2name());
+	else
+		printf("%s(%u, NULL) = %ld\n",
+		       SYSCALL_NAME, ngroups_max, rc);
+
+	rc = syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL | ngroups_max, 0);
+	if (rc < 0)
+		printf("%s(%u, NULL) = %ld %s (%m)\n",
+		       SYSCALL_NAME, ngroups_max, rc, errno2name());
+	else
+		printf("%s(%u, NULL) = %ld\n",
+		       SYSCALL_NAME, ngroups_max, rc);
+
+	/* check how the second argument is decoded */
+	GID_TYPE *const g1 =
+		tail_alloc(ngroups ? sizeof(*g1) * ngroups : 1);
+	GID_TYPE *const g2 = tail_alloc(sizeof(*g2) * (ngroups + 1));
+	void *efault = g2 + ngroups + 1;
+
+	get_groups(ngroups, g1);
+	get_groups(ngroups + 1, g1);
+	get_groups(ngroups + 1, g2);
+
+	if (ngroups) {
+		rc = syscall(SYSCALL_NR, ngroups, efault);
+		printf("%s(%u, %p) = %ld %s (%m)\n",
+		       SYSCALL_NAME, (unsigned) ngroups, efault,
+		       rc, errno2name());
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getgroups")
+
+#endif
diff --git a/tests/getgroups.test b/tests/getgroups.test
new file mode 100755
index 0000000..2eb3056
--- /dev/null
+++ b/tests/getgroups.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getgroups syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a17
diff --git a/tests/getgroups32.c b/tests/getgroups32.c
new file mode 100644
index 0000000..2576548
--- /dev/null
+++ b/tests/getgroups32.c
@@ -0,0 +1,12 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getgroups32
+
+# include "getgroups.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getgroups32")
+
+#endif
diff --git a/tests/getgroups32.test b/tests/getgroups32.test
new file mode 100755
index 0000000..12a8bcc
--- /dev/null
+++ b/tests/getgroups32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getgroups32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a19
diff --git a/tests/getpgrp.c b/tests/getpgrp.c
new file mode 100644
index 0000000..fd3139b
--- /dev/null
+++ b/tests/getpgrp.c
@@ -0,0 +1,22 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getpgrp
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getpgrp() = %ld\n", syscall(__NR_getpgrp));
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getpgrp")
+
+#endif
diff --git a/tests/getpgrp.test b/tests/getpgrp.test
new file mode 100755
index 0000000..e116bb5
--- /dev/null
+++ b/tests/getpgrp.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getpgrp syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a10
diff --git a/tests/getresgid.c b/tests/getresgid.c
new file mode 100644
index 0000000..5827cdd
--- /dev/null
+++ b/tests/getresgid.c
@@ -0,0 +1,21 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getresgid
+
+# define SYSCALL_NR	__NR_getresgid
+# define SYSCALL_NAME	"getresgid"
+
+# if defined __NR_getresgid32 && __NR_getresgid != __NR_getresgid32
+#  define UGID_TYPE	short
+# else
+#  define UGID_TYPE	int
+# endif
+
+# include "getresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getresgid")
+
+#endif
diff --git a/tests/getresgid.test b/tests/getresgid.test
new file mode 100755
index 0000000..9f5186e
--- /dev/null
+++ b/tests/getresgid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getresgid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a25
diff --git a/tests/getresgid32.c b/tests/getresgid32.c
new file mode 100644
index 0000000..ca337d8
--- /dev/null
+++ b/tests/getresgid32.c
@@ -0,0 +1,15 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getresgid32
+
+# define SYSCALL_NR	__NR_getresgid32
+# define SYSCALL_NAME	"getresgid32"
+# define UGID_TYPE	int
+# include "getresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getresgid32")
+
+#endif
diff --git a/tests/getresgid32.test b/tests/getresgid32.test
new file mode 100755
index 0000000..a979891
--- /dev/null
+++ b/tests/getresgid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getresgid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a27
diff --git a/tests/getresugid.c b/tests/getresugid.c
new file mode 100644
index 0000000..0ee721c
--- /dev/null
+++ b/tests/getresugid.c
@@ -0,0 +1,58 @@
+/*
+ * Check decoding of getresuid/getresgid/getresuid32/getresgid32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+	unsigned UGID_TYPE *const r = tail_alloc(sizeof(*r));
+	unsigned UGID_TYPE *const e = tail_alloc(sizeof(*e));
+	unsigned UGID_TYPE *const s = tail_alloc(sizeof(*s));
+
+	if (syscall(SYSCALL_NR, r, e, s))
+		perror_msg_and_fail(SYSCALL_NAME);
+
+	printf("%s([%u], [%u], [%u]) = 0\n", SYSCALL_NAME,
+	       (unsigned) *r, (unsigned) *e, (unsigned) *s);
+
+	assert(syscall(SYSCALL_NR, NULL, e, s) == -1);
+	printf("%s(NULL, %p, %p) = -1 EFAULT (%m)\n", SYSCALL_NAME, e, s);
+
+	assert(syscall(SYSCALL_NR, r, NULL, s) == -1);
+	printf("%s(%p, NULL, %p) = -1 EFAULT (%m)\n", SYSCALL_NAME, r, s);
+
+	assert(syscall(SYSCALL_NR, r, e, NULL) == -1);
+	printf("%s(%p, %p, NULL) = -1 EFAULT (%m)\n", SYSCALL_NAME, r, e);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/getresuid.c b/tests/getresuid.c
new file mode 100644
index 0000000..bf4ada1
--- /dev/null
+++ b/tests/getresuid.c
@@ -0,0 +1,21 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getresuid
+
+# define SYSCALL_NR	__NR_getresuid
+# define SYSCALL_NAME	"getresuid"
+
+# if defined __NR_getresuid32 && __NR_getresuid != __NR_getresuid32
+#  define UGID_TYPE	short
+# else
+#  define UGID_TYPE	int
+# endif
+
+# include "getresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getresuid")
+
+#endif
diff --git a/tests/getresuid.test b/tests/getresuid.test
new file mode 100755
index 0000000..eee1ac0
--- /dev/null
+++ b/tests/getresuid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getresuid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a25
diff --git a/tests/getresuid32.c b/tests/getresuid32.c
new file mode 100644
index 0000000..3154e27
--- /dev/null
+++ b/tests/getresuid32.c
@@ -0,0 +1,15 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getresuid32
+
+# define SYSCALL_NR	__NR_getresuid32
+# define SYSCALL_NAME	"getresuid32"
+# define UGID_TYPE	int
+# include "getresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getresuid32")
+
+#endif
diff --git a/tests/getresuid32.test b/tests/getresuid32.test
new file mode 100755
index 0000000..fdc76a3
--- /dev/null
+++ b/tests/getresuid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getresuid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a27
diff --git a/tests/getsid.c b/tests/getsid.c
new file mode 100644
index 0000000..b563de9
--- /dev/null
+++ b/tests/getsid.c
@@ -0,0 +1,13 @@
+#include "tests.h"
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+	pid_t pid = getpid();
+	printf("getsid(%d) = %d\n", pid, getsid(pid));
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/getsid.test b/tests/getsid.test
new file mode 100755
index 0000000..3fcf979
--- /dev/null
+++ b/tests/getsid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check getsid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a10
diff --git a/tests/getuid.c b/tests/getuid.c
new file mode 100644
index 0000000..25731c8
--- /dev/null
+++ b/tests/getuid.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getuid
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getuid() = %ld\n", syscall(__NR_getuid));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getuid")
+
+#endif
diff --git a/tests/getuid.test b/tests/getuid.test
new file mode 100755
index 0000000..9aaf74b
--- /dev/null
+++ b/tests/getuid.test
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Check getuid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+check_prog uniq
+run_prog > /dev/null
+run_strace -qq -a9 -e$NAME $args > "$EXP"
+uniq < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+rm -f "$OUT" "$EXP"
diff --git a/tests/getuid32.c b/tests/getuid32.c
new file mode 100644
index 0000000..c6f68ae
--- /dev/null
+++ b/tests/getuid32.c
@@ -0,0 +1,20 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_getuid32
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("getuid32() = %ld\n", syscall(__NR_getuid32));
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getuid32")
+
+#endif
diff --git a/tests/getuid32.test b/tests/getuid32.test
new file mode 100755
index 0000000..ae0c557
--- /dev/null
+++ b/tests/getuid32.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check getuid32 syscall decoding.
+
+. "${srcdir=.}/getuid.test"
diff --git a/tests/inet-cmsg.c b/tests/inet-cmsg.c
index dd6f5c4..7e4e0c9 100644
--- a/tests/inet-cmsg.c
+++ b/tests/inet-cmsg.c
@@ -27,7 +27,6 @@
 
 #include "tests.h"
 #include <assert.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -76,6 +75,7 @@
 	}
 }
 
+#ifdef IP_ORIGDSTADDR
 static void
 print_origdstaddr(const struct cmsghdr *c)
 {
@@ -85,6 +85,7 @@
 	printf("IP_ORIGDSTADDR, {sa_family=AF_INET, sin_port=htons(%u)"
 	       ", sin_addr=inet_addr(\"127.0.0.1\")}", ntohs(sin->sin_port));
 }
+#endif
 
 int
 main(void)
diff --git a/tests/ioctl.c b/tests/ioctl.c
index 68ac8ca..f05ff5c 100644
--- a/tests/ioctl.c
+++ b/tests/ioctl.c
@@ -69,7 +69,7 @@
 	       " = -1 EBADF (%m)\n", &data);
 
 	(void) ioctl(-1, VIDIOC_ENUMINPUT, 0);
-	printf("ioctl(-1, VIDIOC_ENUMINPUT, 0)"
+	printf("ioctl(-1, VIDIOC_ENUMINPUT, NULL)"
 	       " = -1 EBADF (%m)\n");
 
 	(void) ioctl(-1, HIDIOCGVERSION, &data);
diff --git a/tests/ioctl_block.c b/tests/ioctl_block.c
new file mode 100644
index 0000000..3b7d765
--- /dev/null
+++ b/tests/ioctl_block.c
@@ -0,0 +1,216 @@
+/*
+ * This file is part of ioctl_block strace test.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <linux/fs.h>
+#include <linux/blkpg.h>
+#ifdef HAVE_STRUCT_BLK_USER_TRACE_SETUP
+# include <linux/blktrace_api.h>
+#endif
+#include "xlat.h"
+
+static const unsigned int magic = 0xdeadbeef;
+static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0ded;
+
+static void
+init_magic(void *addr, const unsigned int size)
+{
+	unsigned int *p = addr;
+	const unsigned int *end = addr + size - sizeof(int);
+
+	for (; p <= end; ++p)
+		*(unsigned int *) p = magic;
+}
+
+static struct xlat block_argless[] = {
+	XLAT(BLKRRPART),
+	XLAT(BLKFLSBUF),
+#ifdef BLKTRACESTART
+	XLAT(BLKTRACESTART),
+#endif
+#ifdef BLKTRACESTOP
+	XLAT(BLKTRACESTOP),
+#endif
+#ifdef BLKTRACETEARDOWN
+	XLAT(BLKTRACETEARDOWN),
+#endif
+};
+
+#define TEST_NULL_ARG(cmd) \
+	ioctl(-1, cmd, 0); \
+	printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", #cmd)
+
+int
+main(void)
+{
+	TEST_NULL_ARG(BLKBSZGET);
+	TEST_NULL_ARG(BLKBSZSET);
+	TEST_NULL_ARG(BLKFRAGET);
+	TEST_NULL_ARG(BLKGETSIZE);
+	TEST_NULL_ARG(BLKGETSIZE64);
+	TEST_NULL_ARG(BLKPG);
+	TEST_NULL_ARG(BLKRAGET);
+	TEST_NULL_ARG(BLKROGET);
+	TEST_NULL_ARG(BLKROSET);
+	TEST_NULL_ARG(BLKSECTGET);
+	TEST_NULL_ARG(BLKSECTGET);
+	TEST_NULL_ARG(BLKSSZGET);
+#ifdef BLKALIGNOFF
+	TEST_NULL_ARG(BLKALIGNOFF);
+#endif
+#ifdef BLKDAXGET
+	TEST_NULL_ARG(BLKDAXGET);
+#endif
+#ifdef BLKDISCARD
+	TEST_NULL_ARG(BLKDISCARD);
+#endif
+#ifdef BLKDISCARDZEROES
+	TEST_NULL_ARG(BLKDISCARDZEROES);
+#endif
+#ifdef BLKIOMIN
+	TEST_NULL_ARG(BLKIOMIN);
+#endif
+#ifdef BLKIOOPT
+	TEST_NULL_ARG(BLKIOOPT);
+#endif
+#ifdef BLKPBSZGET
+	TEST_NULL_ARG(BLKPBSZGET);
+#endif
+#ifdef BLKROTATIONAL
+	TEST_NULL_ARG(BLKROTATIONAL);
+#endif
+#ifdef BLKSECDISCARD
+	TEST_NULL_ARG(BLKSECDISCARD);
+#endif
+#ifdef BLKZEROOUT
+	TEST_NULL_ARG(BLKZEROOUT);
+#endif
+#if defined BLKTRACESETUP && defined HAVE_STRUCT_BLK_USER_TRACE_SETUP
+	TEST_NULL_ARG(BLKTRACESETUP);
+#endif
+
+	ioctl(-1, BLKRASET, lmagic);
+	printf("ioctl(-1, BLKRASET, %lu) = -1 EBADF (%m)\n", lmagic);
+
+	ioctl(-1, BLKFRASET, lmagic);
+	printf("ioctl(-1, BLKFRASET, %lu) = -1 EBADF (%m)\n", lmagic);
+
+	int *const val_int = tail_alloc(sizeof(*val_int));
+	*val_int = magic;
+
+	ioctl(-1, BLKROSET, val_int);
+	printf("ioctl(-1, BLKROSET, [%d]) = -1 EBADF (%m)\n", *val_int);
+
+	ioctl(-1, BLKBSZSET, val_int);
+	printf("ioctl(-1, BLKBSZSET, [%d]) = -1 EBADF (%m)\n", *val_int);
+
+	uint64_t *pair_int64 = tail_alloc(sizeof(*pair_int64) * 2);
+	pair_int64[0] = 0xdeadbeefbadc0ded;
+	pair_int64[1] = 0xfacefeedcafef00d;
+
+#ifdef BLKDISCARD
+	ioctl(-1, BLKDISCARD, pair_int64);
+	printf("ioctl(-1, BLKDISCARD, [%" PRIu64 ", %" PRIu64 "])"
+	       " = -1 EBADF (%m)\n", pair_int64[0], pair_int64[1]);
+#endif
+
+#ifdef BLKSECDISCARD
+	ioctl(-1, BLKSECDISCARD, pair_int64);
+	printf("ioctl(-1, BLKSECDISCARD, [%" PRIu64 ", %" PRIu64 "])"
+	       " = -1 EBADF (%m)\n", pair_int64[0], pair_int64[1]);
+#endif
+
+#ifdef BLKZEROOUT
+	ioctl(-1, BLKZEROOUT, pair_int64);
+	printf("ioctl(-1, BLKZEROOUT, [%" PRIu64 ", %" PRIu64 "])"
+	       " = -1 EBADF (%m)\n", pair_int64[0], pair_int64[1]);
+#endif
+
+	struct blkpg_ioctl_arg *const blkpg = tail_alloc(sizeof(*blkpg));
+	blkpg->op = 3;
+	blkpg->flags = 0xdeadbeef;
+	blkpg->datalen = 0xbadc0ded;
+	blkpg->data = (void *) (unsigned long) 0xcafef00dfffffeed;
+
+	ioctl(-1, BLKPG, blkpg);
+	printf("ioctl(-1, BLKPG, {%s, flags=%d, datalen=%d"
+	       ", data=%#lx}) = -1 EBADF (%m)\n",
+	       "BLKPG_RESIZE_PARTITION", blkpg->flags, blkpg->datalen,
+	       (unsigned long) blkpg->data);
+
+	struct blkpg_partition *const bp = tail_alloc(sizeof(*bp));
+	bp->start = 0xfac1fed2dad3bef4;
+	bp->length = 0xfac5fed6dad7bef8;
+	bp->pno = magic;
+	memset(bp->devname, 'A', sizeof(bp->devname));
+	memset(bp->volname, 'B', sizeof(bp->volname));
+	blkpg->op = 1;
+	blkpg->data = bp;
+
+	ioctl(-1, BLKPG, blkpg);
+	printf("ioctl(-1, BLKPG, {%s, flags=%d, datalen=%d"
+	       ", data={start=%lld, length=%lld, pno=%d"
+	       ", devname=\"%.*s\", volname=\"%.*s\"}})"
+	       " = -1 EBADF (%m)\n",
+	       "BLKPG_ADD_PARTITION",
+	       blkpg->flags, blkpg->datalen,
+	       bp->start, bp->length, bp->pno,
+	       (int) sizeof(bp->devname) - 1, bp->devname,
+	       (int) sizeof(bp->volname) - 1, bp->volname);
+
+#if defined BLKTRACESETUP && defined HAVE_STRUCT_BLK_USER_TRACE_SETUP
+	struct blk_user_trace_setup *const buts = tail_alloc(sizeof(*buts));
+	init_magic(buts, sizeof(*buts));
+
+	ioctl(-1, BLKTRACESETUP, buts);
+	printf("ioctl(-1, BLKTRACESETUP, {act_mask=%hu, buf_size=%u, buf_nr=%u"
+	       ", start_lba=%" PRI__u64 ", end_lba=%" PRI__u64 ", pid=%u})"
+	       " = -1 EBADF (%m)\n",
+	       buts->act_mask, buts->buf_size, buts->buf_nr,
+	       buts->start_lba, buts->end_lba, buts->pid);
+#endif
+
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(block_argless); ++i) {
+		ioctl(-1, (unsigned long) block_argless[i].val, lmagic);
+		printf("ioctl(-1, %s) = -1 EBADF (%m)\n", block_argless[i].str);
+	}
+
+	ioctl(-1, _IOC(_IOC_READ, 0x12, 0xfe, 0xff), lmagic);
+	printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n",
+	       "_IOC(_IOC_READ, 0x12, 0xfe, 0xff)", lmagic);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/ioctl_block.test b/tests/ioctl_block.test
new file mode 100755
index 0000000..0bf2500
--- /dev/null
+++ b/tests/ioctl_block.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check decoding of BLK* ioctls.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/ioctl_evdev-v.c b/tests/ioctl_evdev-v.c
new file mode 100644
index 0000000..6f1adcf
--- /dev/null
+++ b/tests/ioctl_evdev-v.c
@@ -0,0 +1,3 @@
+/* This file is part of ioctl_evdev-v strace test. */
+#define VERBOSE_IOCTL
+#include "ioctl_evdev.c"
diff --git a/tests/ioctl_evdev-v.test b/tests/ioctl_evdev-v.test
new file mode 100755
index 0000000..8794101
--- /dev/null
+++ b/tests/ioctl_evdev-v.test
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Check verbose decoding EVIOC* ioctls.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+run_strace -a16 -veioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+rm -f "$EXP" "$OUT"
diff --git a/tests/ioctl_evdev.c b/tests/ioctl_evdev.c
new file mode 100644
index 0000000..977c7aa
--- /dev/null
+++ b/tests/ioctl_evdev.c
@@ -0,0 +1,284 @@
+/*
+ * This file is part of ioctl_block strace test.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+
+#ifdef HAVE_LINUX_INPUT_H
+
+# include <errno.h>
+# include <inttypes.h>
+# include <stdio.h>
+# include <string.h>
+# include <sys/ioctl.h>
+# include <linux/input.h>
+
+static const unsigned int magic = 0xdeadbeef;
+static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0ded;
+
+static void
+init_magic(void *addr, const unsigned int size)
+{
+	unsigned int *p = addr;
+	const unsigned int *end = addr + size - sizeof(int);
+
+	for (; p <= end; ++p)
+		*(unsigned int *) p = magic;
+}
+
+# ifdef VERBOSE_IOCTL
+static void
+print_envelope(const struct ff_envelope *const e)
+{
+	printf(", envelope={attack_length=%hu, attack_level=%hu"
+	       ", fade_length=%hu, fade_level=%#hx}",
+	       e->attack_length, e->attack_level,
+	       e->fade_length, e->fade_level);
+}
+# endif /* VERBOSE_IOCTL */
+
+static void
+print_ffe_common(const struct ff_effect *const ffe, const char *const type_str)
+{
+	printf("ioctl(-1, EVIOCSFF, {type=%s, id=%" PRIu16
+	       ", direction=%" PRIu16 ", ",
+	       type_str, ffe->id, ffe->direction);
+# ifdef VERBOSE_IOCTL
+	printf("trigger={button=%hu, interval=%hu}"
+	       ", replay={length=%hu, delay=%hu}",
+	       ffe->trigger.button, ffe->trigger.interval,
+	       ffe->replay.length, ffe->replay.delay);
+# endif /* VERBOSE_IOCTL */
+}
+
+# define TEST_NULL_ARG(cmd) \
+	ioctl(-1, cmd, 0); \
+	printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", #cmd)
+
+int
+main(void)
+{
+	TEST_NULL_ARG(EVIOCGVERSION);
+	TEST_NULL_ARG(EVIOCGEFFECTS);
+	TEST_NULL_ARG(EVIOCGID);
+	TEST_NULL_ARG(EVIOCGKEYCODE);
+	TEST_NULL_ARG(EVIOCSKEYCODE);
+	TEST_NULL_ARG(EVIOCSFF);
+# ifdef EVIOCGKEYCODE_V2
+	TEST_NULL_ARG(EVIOCGKEYCODE_V2);
+# endif
+# ifdef EVIOCSKEYCODE_V2
+	TEST_NULL_ARG(EVIOCSKEYCODE_V2);
+# endif
+# ifdef EVIOCGREP
+	TEST_NULL_ARG(EVIOCGREP);
+# endif
+# ifdef EVIOCSREP
+	TEST_NULL_ARG(EVIOCSREP);
+# endif
+# ifdef EVIOCSCLOCKID
+	TEST_NULL_ARG(EVIOCSCLOCKID);
+# endif
+
+	TEST_NULL_ARG(EVIOCGNAME(0));
+	TEST_NULL_ARG(EVIOCGPHYS(0));
+	TEST_NULL_ARG(EVIOCGUNIQ(0));
+	TEST_NULL_ARG(EVIOCGKEY(0));
+	TEST_NULL_ARG(EVIOCGLED(0));
+# ifdef EVIOCGMTSLOTS
+	TEST_NULL_ARG(EVIOCGMTSLOTS(0));
+# endif
+# ifdef EVIOCGPROP
+	TEST_NULL_ARG(EVIOCGPROP(0));
+# endif
+	TEST_NULL_ARG(EVIOCGSND(0));
+# ifdef EVIOCGSW
+	TEST_NULL_ARG(EVIOCGSW(0));
+# endif
+
+	TEST_NULL_ARG(EVIOCGABS(ABS_X));
+	TEST_NULL_ARG(EVIOCSABS(ABS_X));
+
+	TEST_NULL_ARG(EVIOCGBIT(EV_SYN, 0));
+	TEST_NULL_ARG(EVIOCGBIT(EV_KEY, 1));
+	TEST_NULL_ARG(EVIOCGBIT(EV_REL, 2));
+	TEST_NULL_ARG(EVIOCGBIT(EV_ABS, 3));
+	TEST_NULL_ARG(EVIOCGBIT(EV_MSC, 4));
+# ifdef EV_SW
+	TEST_NULL_ARG(EVIOCGBIT(EV_SW, 5));
+# endif
+	TEST_NULL_ARG(EVIOCGBIT(EV_LED, 6));
+	TEST_NULL_ARG(EVIOCGBIT(EV_SND, 7));
+	TEST_NULL_ARG(EVIOCGBIT(EV_REP, 8));
+	TEST_NULL_ARG(EVIOCGBIT(EV_FF, 9));
+	TEST_NULL_ARG(EVIOCGBIT(EV_PWR, 10));
+	TEST_NULL_ARG(EVIOCGBIT(EV_FF_STATUS, 11));
+
+	ioctl(-1, EVIOCGBIT(EV_MAX, 42), 0);
+	printf("ioctl(-1, EVIOCGBIT(%#x /* EV_??? */, 42), NULL)"
+	       " = -1 EBADF (%m)\n", EV_MAX);
+
+	ioctl(-1, EVIOCRMFF, lmagic);
+	printf("ioctl(-1, EVIOCRMFF, %d) = -1 EBADF (%m)\n", (int) lmagic);
+
+	ioctl(-1, EVIOCGRAB, lmagic);
+	printf("ioctl(-1, EVIOCGRAB, %lu) = -1 EBADF (%m)\n", lmagic);
+
+# ifdef EVIOCREVOKE
+	ioctl(-1, EVIOCREVOKE, lmagic);
+	printf("ioctl(-1, EVIOCREVOKE, %lu) = -1 EBADF (%m)\n", lmagic);
+# endif
+
+	const unsigned int size = get_page_size();
+	void *const page = tail_alloc(size);
+	init_magic(page, size);
+
+	int *const val_int = tail_alloc(sizeof(*val_int));
+	*val_int = magic;
+
+# ifdef EVIOCSCLOCKID
+	ioctl(-1, EVIOCSCLOCKID, val_int);
+	printf("ioctl(-1, EVIOCSCLOCKID, [%u]) = -1 EBADF (%m)\n", *val_int);
+# endif
+
+	int *pair_int = tail_alloc(sizeof(*pair_int) * 2);
+	pair_int[0] = 0xdeadbeef;
+	pair_int[1] = 0xbadc0ded;
+
+# ifdef EVIOSGREP
+	ioctl(-1, EVIOCSREP, pair_int);
+	printf("ioctl(-1, EVIOCSREP, [%u, %u]) = -1 EBADF (%m)\n",
+	       pair_int[0], pair_int[1]);
+# endif
+
+	pair_int[1] = 1;
+	ioctl(-1, EVIOCSKEYCODE, pair_int);
+	printf("ioctl(-1, EVIOCSKEYCODE, [%u, %s]) = -1 EBADF (%m)\n",
+	       pair_int[0], "KEY_ESC");
+
+# ifdef EVIOCSKEYCODE_V2
+	struct input_keymap_entry *const ike = tail_alloc(sizeof(*ike));
+	init_magic(ike, sizeof(*ike));
+	ike->keycode = 2;
+
+	ioctl(-1, EVIOCSKEYCODE_V2, ike);
+	printf("ioctl(-1, EVIOCSKEYCODE_V2, {flags=%" PRIu8
+	       ", len=%" PRIu8 ", ", ike->flags, ike->len);
+#  ifdef VERBOSE_IOCTL
+	printf("index=%" PRIu16 ", keycode=%s, scancode=[",
+	       ike->index, "KEY_1");
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(ike->scancode); ++i) {
+		if (i > 0)
+			printf(", ");
+		printf("%" PRIx8, ike->scancode[i]);
+	}
+	printf("]");
+#  else
+	printf("...");
+#  endif
+	errno = EBADF;
+	printf("}) = -1 EBADF (%m)\n");
+# endif
+
+	struct ff_effect *const ffe = tail_alloc(sizeof(*ffe));
+	init_magic(ffe, sizeof(*ffe));
+
+	ffe->type = FF_CONSTANT;
+	ioctl(-1, EVIOCSFF, ffe);
+	print_ffe_common(ffe, "FF_CONSTANT");
+
+#  ifdef VERBOSE_IOCTL
+	printf(", constant={level=%hd", ffe->u.constant.level);
+	print_envelope(&ffe->u.constant.envelope);
+	printf("}");
+#  else
+	printf("...");
+#  endif
+	errno = EBADF;
+	printf("}) = -1 EBADF (%m)\n");
+
+#  ifdef VERBOSE_IOCTL
+	ffe->type = FF_RAMP;
+	ioctl(-1, EVIOCSFF, ffe);
+	print_ffe_common(ffe, "FF_RAMP");
+	printf(", ramp={start_level=%hd, end_level=%hd",
+	       ffe->u.ramp.start_level, ffe->u.ramp.end_level);
+	print_envelope(&ffe->u.ramp.envelope);
+	errno = EBADF;
+	printf("}}) = -1 EBADF (%m)\n");
+
+	ffe->type = FF_PERIODIC;
+	ioctl(-1, EVIOCSFF, ffe);
+	print_ffe_common(ffe, "FF_PERIODIC");
+	printf(", periodic={waveform=%hu, period=%hu, magnitude=%hd"
+	       ", offset=%hd, phase=%hu",
+	       ffe->u.periodic.waveform, ffe->u.periodic.period,
+	       ffe->u.periodic.magnitude, ffe->u.periodic.offset,
+	       ffe->u.periodic.phase);
+	print_envelope(&ffe->u.periodic.envelope);
+	printf(", custom_len=%u, custom_data=%p}",
+	       ffe->u.periodic.custom_len, ffe->u.periodic.custom_data);
+	errno = EBADF;
+	printf("}) = -1 EBADF (%m)\n");
+
+	ffe->type = FF_RUMBLE;
+	ioctl(-1, EVIOCSFF, ffe);
+	print_ffe_common(ffe, "FF_RUMBLE");
+	printf(", rumble={strong_magnitude=%hu, weak_magnitude=%hu}",
+	       ffe->u.rumble.strong_magnitude, ffe->u.rumble.weak_magnitude);
+	errno = EBADF;
+	printf("}) = -1 EBADF (%m)\n");
+
+	ffe->type = 0xff;
+	ioctl(-1, EVIOCSFF, ffe);
+	print_ffe_common(ffe, "0xff /* FF_??? */");
+	errno = EBADF;
+	printf("}) = -1 EBADF (%m)\n");
+#  endif
+
+	ioctl(-1, _IOC(_IOC_READ, 0x45, 0x01, 0xff), lmagic);
+	printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n",
+	       "_IOC(_IOC_READ, 0x45, 0x01, 0xff)", lmagic);
+
+	ioctl(-1, _IOC(_IOC_WRITE, 0x45, 0x01, 0xff), lmagic);
+	printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n",
+	       "_IOC(_IOC_WRITE, 0x45, 0x01, 0xff)", lmagic);
+
+	ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE, 0x45, 0xfe, 0xff), lmagic);
+	printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n",
+	       "_IOC(_IOC_READ|_IOC_WRITE, 0x45, 0xfe, 0xff)", lmagic);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+#else
+
+SKIP_MAIN_UNDEFINED("HAVE_LINUX_INPUT_H")
+
+#endif
diff --git a/tests/ioctl_evdev.test b/tests/ioctl_evdev.test
new file mode 100755
index 0000000..7ed2e98
--- /dev/null
+++ b/tests/ioctl_evdev.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check decoding of EVIOC* ioctls.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/ioctl_mtd.c b/tests/ioctl_mtd.c
new file mode 100644
index 0000000..b761da8
--- /dev/null
+++ b/tests/ioctl_mtd.c
@@ -0,0 +1,208 @@
+/*
+ * This file is part of ioctl_mtd strace test.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <linux/ioctl.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+# include "mtd-abi.h"
+#else
+# include <mtd/mtd-abi.h>
+#endif
+
+static const unsigned int magic = 0xdeadbeef;
+static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0ded;
+
+static void
+init_magic(void *addr, const unsigned int size)
+{
+	unsigned int *p = addr;
+	const unsigned int *end = addr + size - sizeof(int);
+
+	for (; p <= end; ++p)
+		*(unsigned int *) p = magic;
+}
+
+#define TEST_NULL_ARG(cmd) \
+	do { \
+		ioctl(-1, cmd, 0); \
+		if (_IOC_DIR(cmd) == _IOC_WRITE) \
+			printf("ioctl(-1, MIXER_WRITE(%u) or %s, NULL)" \
+			       " = -1 EBADF (%m)\n", \
+			       (unsigned int) _IOC_NR(cmd), #cmd); \
+		else if (_IOC_DIR(cmd) == _IOC_READ) \
+			printf("ioctl(-1, MIXER_READ(%u) or %s, NULL)" \
+			       " = -1 EBADF (%m)\n", \
+			       (unsigned int) _IOC_NR(cmd), #cmd); \
+		else \
+			printf("ioctl(-1, %s, NULL) = -1 EBADF (%m)\n", #cmd); \
+		} while (0)
+
+#define TEST_erase_info_user(cmd, eiu) \
+	ioctl(-1, cmd, eiu); \
+	printf("ioctl(-1, MIXER_%s(%u) or %s, {start=%#x, length=%#x})" \
+	       " = -1 EBADF (%m)\n", \
+	       (_IOC_DIR(cmd) == _IOC_READ) ? "READ" : "WRITE", \
+	       (unsigned int) _IOC_NR(cmd), #cmd, \
+	       eiu->start, eiu->length)
+
+int
+main(void)
+{
+	TEST_NULL_ARG(ECCGETLAYOUT);
+	TEST_NULL_ARG(ECCGETSTATS);
+	TEST_NULL_ARG(MEMERASE);
+	TEST_NULL_ARG(MEMERASE64);
+	TEST_NULL_ARG(MEMGETBADBLOCK);
+	TEST_NULL_ARG(MEMGETINFO);
+	TEST_NULL_ARG(MEMGETOOBSEL);
+	TEST_NULL_ARG(MEMGETREGIONCOUNT);
+	TEST_NULL_ARG(MEMISLOCKED);
+	TEST_NULL_ARG(MEMLOCK);
+	TEST_NULL_ARG(MEMREADOOB);
+	TEST_NULL_ARG(MEMREADOOB64);
+	TEST_NULL_ARG(MEMSETBADBLOCK);
+	TEST_NULL_ARG(MEMUNLOCK);
+	TEST_NULL_ARG(MEMWRITE);
+	TEST_NULL_ARG(MEMWRITEOOB);
+	TEST_NULL_ARG(MEMWRITEOOB64);
+	TEST_NULL_ARG(OTPGETREGIONCOUNT);
+	TEST_NULL_ARG(OTPGETREGIONINFO);
+	TEST_NULL_ARG(OTPLOCK);
+	TEST_NULL_ARG(OTPSELECT);
+
+	ioctl(-1, MTDFILEMODE, MTD_FILE_MODE_NORMAL);
+	printf("ioctl(-1, MTDFILEMODE, MTD_FILE_MODE_NORMAL) = -1 EBADF (%m)\n");
+
+	int *const opt = tail_alloc(sizeof(*opt));
+	*opt = MTD_OTP_OFF;
+	ioctl(-1, OTPSELECT, opt);
+	printf("ioctl(-1, MIXER_READ(%u) or OTPSELECT, [MTD_OTP_OFF])"
+	       " = -1 EBADF (%m)\n", (unsigned int) _IOC_NR(OTPSELECT));
+
+	uint64_t *const v64 = tail_alloc(sizeof(*v64));
+	init_magic(v64, sizeof(*v64));
+
+	ioctl(-1, MEMGETBADBLOCK, v64);
+	printf("ioctl(-1, MIXER_WRITE(%u) or MEMGETBADBLOCK, [%" PRIu64 "])"
+	       " = -1 EBADF (%m)\n",
+	       (unsigned int) _IOC_NR(MEMGETBADBLOCK), *v64);
+
+	ioctl(-1, MEMSETBADBLOCK, v64);
+	printf("ioctl(-1, MIXER_WRITE(%u) or MEMSETBADBLOCK, [%" PRIu64 "])"
+	       " = -1 EBADF (%m)\n",
+	       (unsigned int) _IOC_NR(MEMSETBADBLOCK), *v64);
+
+	struct region_info_user *const riu = tail_alloc(sizeof(*riu));
+	init_magic(riu, sizeof(*riu));
+	ioctl(-1, MEMGETREGIONINFO, riu);
+	printf("ioctl(-1, %s, {regionindex=%#x}) = -1 EBADF (%m)\n",
+	       "MEMGETREGIONINFO"
+#ifdef __i386__
+	       " or MTRRIOC_GET_PAGE_ENTRY"
+#endif
+	       , riu->regionindex);
+
+	struct erase_info_user *const eiu = tail_alloc(sizeof(*eiu));
+	init_magic(eiu, sizeof(*eiu));
+
+	TEST_erase_info_user(MEMERASE, eiu);
+	TEST_erase_info_user(MEMLOCK, eiu);
+	TEST_erase_info_user(MEMUNLOCK, eiu);
+	TEST_erase_info_user(MEMISLOCKED, eiu);
+
+	struct erase_info_user64 *const eiu64 = tail_alloc(sizeof(*eiu64));
+	init_magic(eiu64, sizeof(*eiu64));
+	ioctl(-1, MEMERASE64, eiu64);
+	printf("ioctl(-1, MIXER_WRITE(%u) or %s, {start=%#llx, length=%#llx})"
+	       " = -1 EBADF (%m)\n",
+	       (unsigned int) _IOC_NR(MEMERASE64), "MEMERASE64",
+	       (unsigned long long) eiu64->start,
+	       (unsigned long long) eiu64->length);
+
+	struct mtd_oob_buf *const oob = tail_alloc(sizeof(*oob));
+	init_magic(oob, sizeof(*oob));
+
+	ioctl(-1, MEMWRITEOOB, oob);
+	printf("ioctl(-1, MEMWRITEOOB, {start=%#x, length=%#x, ptr=%p})"
+	       " = -1 EBADF (%m)\n", oob->start, oob->length, oob->ptr);
+
+	ioctl(-1, MEMREADOOB, oob);
+	printf("ioctl(-1, MEMREADOOB, {start=%#x, length=%#x, ptr=%p})"
+	       " = -1 EBADF (%m)\n", oob->start, oob->length, oob->ptr);
+
+	struct mtd_oob_buf64 *const oob64 = tail_alloc(sizeof(*oob64));
+	init_magic(oob64, sizeof(*oob64));
+
+	ioctl(-1, MEMWRITEOOB64, oob64);
+	printf("ioctl(-1, MEMWRITEOOB64"
+	       ", {start=%#llx, length=%#x, usr_ptr=%#llx}) = -1 EBADF (%m)\n",
+	       (unsigned long long) oob64->start, oob64->length,
+	       (unsigned long long) oob64->usr_ptr);
+
+	ioctl(-1, MEMREADOOB64, oob64);
+	printf("ioctl(-1, MEMREADOOB64"
+	       ", {start=%#llx, length=%#x, usr_ptr=%#llx}) = -1 EBADF (%m)\n",
+	       (unsigned long long) oob64->start, oob64->length,
+	       (unsigned long long) oob64->usr_ptr);
+
+
+	struct otp_info *const oi = tail_alloc(sizeof(*oi));
+	init_magic(oi, sizeof(*oi));
+	ioctl(-1, OTPLOCK, oi);
+	printf("ioctl(-1, MIXER_READ(%u) or OTPLOCK"
+	       ", {start=%#x, length=%#x, locked=%u}) = -1 EBADF (%m)\n",
+	       (unsigned int) _IOC_NR(OTPLOCK),  oi->start, oi->length, oi->locked);
+
+	struct mtd_write_req *const wr = tail_alloc(sizeof(*wr));
+	init_magic(wr, sizeof(*wr));
+	wr->mode = MTD_OPS_PLACE_OOB;
+	ioctl(-1, MEMWRITE, wr);
+	printf("ioctl(-1, MEMWRITE, {start=%#llx, len=%#llx, ooblen=%#llx"
+	       ", usr_data=%#llx, usr_oob=%#llx, mode=MTD_OPS_PLACE_OOB})"
+	       " = -1 EBADF (%m)\n",
+	       (unsigned long long) wr->start,
+	       (unsigned long long) wr->len,
+	       (unsigned long long) wr->ooblen,
+	       (unsigned long long) wr->usr_data,
+	       (unsigned long long) wr->usr_oob);
+
+	ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE, 0x4d, 0xfe, 0xff), lmagic);
+	printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n",
+	       "_IOC(_IOC_READ|_IOC_WRITE, 0x4d, 0xfe, 0xff)", lmagic);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/ioctl_mtd.test b/tests/ioctl_mtd.test
new file mode 100755
index 0000000..0842807
--- /dev/null
+++ b/tests/ioctl_mtd.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check decoding of 'M' type ioctls.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/ioctl_rtc-v.c b/tests/ioctl_rtc-v.c
new file mode 100644
index 0000000..abdace1
--- /dev/null
+++ b/tests/ioctl_rtc-v.c
@@ -0,0 +1,3 @@
+/* This file is part of ioctl_rtc-v strace test. */
+#define VERBOSE_IOCTL
+#include "ioctl_rtc.c"
diff --git a/tests/ioctl_rtc-v.test b/tests/ioctl_rtc-v.test
new file mode 100755
index 0000000..a255322
--- /dev/null
+++ b/tests/ioctl_rtc-v.test
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Check verbose decoding of RTC_* ioctls.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+run_strace -a16 -veioctl $args > "$EXP"
+check_prog grep
+grep -v '^ioctl([012],' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+rm -f "$EXP" "$OUT"
diff --git a/tests/ioctl_rtc.c b/tests/ioctl_rtc.c
new file mode 100644
index 0000000..ee09955
--- /dev/null
+++ b/tests/ioctl_rtc.c
@@ -0,0 +1,218 @@
+/*
+ * This file is part of ioctl_rtc strace test.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <linux/rtc.h>
+#include "xlat.h"
+
+static const unsigned int magic = 0xdeadbeef;
+static const unsigned long lmagic = (unsigned long) 0xdeadbeefbadc0ded;
+
+static void
+init_magic(void *addr, const unsigned int size)
+{
+	unsigned int *p = addr;
+	const unsigned int *end = addr + size - sizeof(int);
+
+	for (; p <= end; ++p)
+		*(unsigned int *) p = magic;
+}
+
+static void
+print_rtc_time(const struct rtc_time *rt)
+{
+	printf("{tm_sec=%d, tm_min=%d, tm_hour=%d"
+	       ", tm_mday=%d, tm_mon=%d, tm_year=%d",
+	       rt->tm_sec, rt->tm_min, rt->tm_hour,
+	       rt->tm_mday, rt->tm_mon, rt->tm_year);
+#ifdef VERBOSE_IOCTL
+	printf(", tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
+	       rt->tm_wday, rt->tm_yday, rt->tm_isdst);
+#else
+	printf(", ...}");
+#endif
+}
+
+static struct xlat rtc_argless[] = {
+	XLAT(RTC_AIE_OFF),
+	XLAT(RTC_PIE_ON),
+	XLAT(RTC_PIE_OFF),
+	XLAT(RTC_UIE_ON),
+	XLAT(RTC_WIE_ON),
+	XLAT(RTC_WIE_OFF),
+#ifdef RTC_VL_CLR
+	XLAT(RTC_VL_CLR),
+#endif
+};
+
+int
+main(void)
+{
+	const unsigned int size = get_page_size();
+
+	void *const page = tail_alloc(size);
+	init_magic(page, size);
+
+	struct rtc_time *rt = tail_alloc(sizeof(*rt));
+	init_magic(rt, sizeof(*rt));
+
+	struct rtc_wkalrm *wk = tail_alloc(sizeof(*wk));
+	init_magic(wk, sizeof(*wk));
+
+	struct rtc_pll_info *pll = tail_alloc(sizeof(*pll));
+	init_magic(pll, sizeof(*pll));
+
+	/* RTC_ALM_READ */
+	ioctl(-1, RTC_ALM_READ, 0);
+	printf("ioctl(-1, RTC_ALM_READ, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_ALM_READ, page);
+	printf("ioctl(-1, RTC_ALM_READ, %p) = -1 EBADF (%m)\n", page);
+
+	/* RTC_RD_TIME */
+	ioctl(-1, RTC_RD_TIME, 0);
+	printf("ioctl(-1, RTC_RD_TIME, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_RD_TIME, page);
+	printf("ioctl(-1, RTC_RD_TIME, %p) = -1 EBADF (%m)\n", page);
+
+	/* RTC_ALM_SET */
+	ioctl(-1, RTC_ALM_SET, 0);
+	printf("ioctl(-1, RTC_ALM_SET, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_ALM_SET, rt);
+	printf("ioctl(-1, RTC_ALM_SET, ");
+	print_rtc_time(rt);
+	errno = EBADF;
+	printf(") = -1 EBADF (%m)\n");
+
+	/* RTC_SET_TIME */
+	ioctl(-1, RTC_SET_TIME, 0);
+	printf("ioctl(-1, RTC_SET_TIME, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_SET_TIME, rt);
+	printf("ioctl(-1, RTC_SET_TIME, ");
+	print_rtc_time(rt);
+	errno = EBADF;
+	printf(") = -1 EBADF (%m)\n");
+
+	/* RTC_IRQP_SET */
+	ioctl(-1, RTC_IRQP_SET, lmagic);
+	printf("ioctl(-1, RTC_IRQP_SET, %lu) = -1 EBADF (%m)\n", lmagic);
+
+	/* RTC_EPOCH_SET */
+	ioctl(-1, RTC_EPOCH_SET, lmagic);
+	printf("ioctl(-1, RTC_EPOCH_SET, %lu) = -1 EBADF (%m)\n", lmagic);
+
+	/* RTC_IRQP_READ */
+	ioctl(-1, RTC_IRQP_READ, 0);
+	printf("ioctl(-1, RTC_IRQP_READ, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_IRQP_READ, page);
+	printf("ioctl(-1, RTC_IRQP_READ, %p) = -1 EBADF (%m)\n", page);
+
+	/* RTC_EPOCH_READ */
+	ioctl(-1, RTC_EPOCH_READ, 0);
+	printf("ioctl(-1, RTC_EPOCH_READ, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_EPOCH_READ, page);
+	printf("ioctl(-1, RTC_EPOCH_READ, %p) = -1 EBADF (%m)\n", page);
+
+	/* RTC_WKALM_RD */
+	ioctl(-1, RTC_WKALM_RD, 0);
+	printf("ioctl(-1, RTC_WKALM_RD, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_WKALM_RD, page);
+	printf("ioctl(-1, RTC_WKALM_RD, %p) = -1 EBADF (%m)\n", page);
+
+	/* RTC_WKALM_SET */
+	ioctl(-1, RTC_WKALM_SET, 0);
+	printf("ioctl(-1, RTC_WKALM_SET, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_WKALM_SET, wk);
+	printf("ioctl(-1, RTC_WKALM_SET, {enabled=%u, pending=%u, time=",
+	       (unsigned) wk->enabled, (unsigned) wk->pending);
+	print_rtc_time(&wk->time);
+	errno = EBADF;
+	printf("}) = -1 EBADF (%m)\n");
+
+	/* RTC_PLL_GET */
+	ioctl(-1, RTC_PLL_GET, 0);
+	printf("ioctl(-1, RTC_PLL_GET, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_PLL_GET, page);
+	printf("ioctl(-1, RTC_PLL_GET, %p) = -1 EBADF (%m)\n", page);
+
+	/* RTC_PLL_SET */
+	ioctl(-1, RTC_PLL_SET, 0);
+	printf("ioctl(-1, RTC_PLL_SET, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_PLL_SET, pll);
+	printf("ioctl(-1, RTC_PLL_SET, {pll_ctrl=%d, pll_value=%d"
+	       ", pll_max=%d, pll_min=%d, pll_posmult=%d, pll_negmult=%d"
+	       ", pll_clock=%ld}) = -1 EBADF (%m)\n",
+	       pll->pll_ctrl, pll->pll_value, pll->pll_max, pll->pll_min,
+	       pll->pll_posmult, pll->pll_negmult, pll->pll_clock);
+
+#ifdef RTC_VL_READ
+	/* RTC_VL_READ */
+	ioctl(-1, RTC_VL_READ, 0);
+	printf("ioctl(-1, RTC_VL_READ, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, RTC_VL_READ, page);
+	printf("ioctl(-1, RTC_VL_READ, %p) = -1 EBADF (%m)\n", page);
+#endif
+
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(rtc_argless); ++i) {
+		ioctl(-1, (unsigned long) rtc_argless[i].val, lmagic);
+		printf("ioctl(-1, %s) = -1 EBADF (%m)\n", rtc_argless[i].str);
+	}
+
+	ioctl(-1, RTC_UIE_OFF, lmagic);
+	printf("ioctl(-1, %s) = -1 EBADF (%m)\n", "PHN_NOT_OH or RTC_UIE_OFF");
+
+	ioctl(-1, RTC_AIE_ON, lmagic);
+#ifdef HPPA
+	printf("ioctl(-1, %s) = -1 EBADF (%m)\n", "PA_PERF_ON or RTC_AIE_ON");
+#else
+	printf("ioctl(-1, %s) = -1 EBADF (%m)\n", "RTC_AIE_ON");
+#endif
+
+	ioctl(-1, _IO(0x70, 0x40), lmagic);
+	printf("ioctl(-1, %s, %#lx) = -1 EBADF (%m)\n", "NVRAM_INIT", lmagic);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/ioctl_rtc.test b/tests/ioctl_rtc.test
new file mode 100755
index 0000000..4545f2a
--- /dev/null
+++ b/tests/ioctl_rtc.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check basic decoding of RTC_* ioctls.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/ioctl_uffdio.c b/tests/ioctl_uffdio.c
new file mode 100644
index 0000000..73a8a99
--- /dev/null
+++ b/tests/ioctl_uffdio.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c)      2016 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_userfaultfd && defined HAVE_LINUX_USERFAULTFD_H
+
+# include <fcntl.h>
+# include <inttypes.h>
+# include <stdint.h>
+# include <stdio.h>
+# include <string.h>
+# include <unistd.h>
+
+# include <sys/ioctl.h>
+# include <sys/mman.h>
+# include <linux/ioctl.h>
+# include <linux/userfaultfd.h>
+
+int
+main(void)
+{
+	int rc;
+	int fd = syscall(__NR_userfaultfd, O_NONBLOCK);
+	size_t pagesize = getpagesize();
+
+	if (fd < 0)
+		perror_msg_and_skip("userfaultfd");
+
+	/* ---- API ---- */
+	struct uffdio_api *api_struct = tail_alloc(sizeof(*api_struct));
+
+	/* With a bad fd */
+	memset(api_struct, 0, sizeof(*api_struct));
+	rc = ioctl(-1, UFFDIO_API, api_struct);
+	printf("ioctl(-1, UFFDIO_API, {api=0, features=0}) = %d %s (%m)\n",
+	       rc, errno2name());
+	/* With a bad pointer */
+	rc = ioctl(fd, UFFDIO_API, NULL);
+	printf("ioctl(%d, UFFDIO_API, NULL) = %d %s (%m)\n",
+		fd, rc, errno2name());
+	/* Normal call */
+	api_struct->api = UFFD_API;
+	api_struct->features = 0;
+	rc = ioctl(fd, UFFDIO_API, api_struct);
+	printf("ioctl(%d, UFFDIO_API, {api=0xaa, features=0, "
+	       "features.out=%#" PRIx64 ", " "ioctls=1<<_UFFDIO_REGISTER|"
+	       "1<<_UFFDIO_UNREGISTER|1<<_UFFDIO_API",
+	       fd, (uint64_t)api_struct->features);
+	api_struct->ioctls &= ~(1ull<<_UFFDIO_REGISTER|
+				1ull<<_UFFDIO_UNREGISTER|
+				1ull<<_UFFDIO_API);
+	if (api_struct->ioctls)
+		printf("|%#" PRIx64, (uint64_t)api_struct->ioctls);
+	printf("}) = %d\n", rc);
+
+	/* For the rest of the tests we need some anonymous memory */
+	void *area1 = mmap(NULL, pagesize, PROT_READ|PROT_WRITE,
+			   MAP_PRIVATE|MAP_ANONYMOUS,
+			   -1, 0);
+	if (area1 == MAP_FAILED)
+		perror_msg_and_fail("mmap area1");
+	void *area2 = mmap(NULL, pagesize, PROT_READ|PROT_WRITE,
+			   MAP_PRIVATE|MAP_ANONYMOUS,
+			   -1, 0);
+	if (area2 == MAP_FAILED)
+		perror_msg_and_fail("mmap area2");
+	madvise(area2, pagesize, MADV_DONTNEED);
+	*(char *)area1 = 42;
+
+	/* ---- REGISTER ---- */
+	struct uffdio_register *register_struct =
+					 tail_alloc(sizeof(*register_struct));
+	memset(register_struct, 0, sizeof(*register_struct));
+
+	rc = ioctl(-1, UFFDIO_REGISTER, register_struct);
+	printf("ioctl(-1, UFFDIO_REGISTER, {range={start=0, len=0}, "
+	       "mode=0}) = %d %s (%m)\n", rc, errno2name());
+
+	rc = ioctl(fd, UFFDIO_REGISTER, NULL);
+	printf("ioctl(%d, UFFDIO_REGISTER, NULL) = %d %s (%m)\n",
+	       fd, rc, errno2name());
+
+	register_struct->range.start = (uint64_t)(uintptr_t)area2;
+	register_struct->range.len = pagesize;
+	register_struct->mode = UFFDIO_REGISTER_MODE_MISSING;
+	rc = ioctl(fd, UFFDIO_REGISTER, register_struct);
+	printf("ioctl(%d, UFFDIO_REGISTER, {range={start=%p, len=%#zx}, "
+	       "mode=UFFDIO_REGISTER_MODE_MISSING, ioctls="
+	       "1<<_UFFDIO_WAKE|1<<_UFFDIO_COPY|1<<_UFFDIO_ZEROPAGE",
+	       fd, area2, pagesize);
+	register_struct->ioctls &= ~(1ull<<_UFFDIO_WAKE|
+				    1ull<<_UFFDIO_COPY|
+				    1ull<<_UFFDIO_ZEROPAGE);
+	if (register_struct->ioctls)
+		printf("|%#" PRIx64, (uint64_t)register_struct->ioctls);
+	printf("}) = %d\n", rc);
+
+	/* With area2 registered we can now do the atomic copies onto it
+	 * but be careful not to access it in any other way otherwise
+	 * userfaultfd will cause us to stall.
+	 */
+	/* ---- COPY ---- */
+	struct uffdio_copy *copy_struct = tail_alloc(sizeof(*copy_struct));
+
+	memset(copy_struct, 0, sizeof(*copy_struct));
+	rc = ioctl(-1, UFFDIO_COPY, copy_struct);
+	printf("ioctl(-1, UFFDIO_COPY, {dst=0, src=0, len=0, mode=0"
+	       "}) = %d %s (%m)\n", rc, errno2name());
+
+	rc = ioctl(fd, UFFDIO_COPY, NULL);
+	printf("ioctl(%d, UFFDIO_COPY, NULL) = %d %s (%m)\n",
+	       fd, rc, errno2name());
+
+	copy_struct->dst = (uint64_t)(uintptr_t)area2;
+	copy_struct->src = (uint64_t)(uintptr_t)area1;
+	copy_struct->len = pagesize;
+	copy_struct->mode = UFFDIO_COPY_MODE_DONTWAKE;
+	rc = ioctl(fd, UFFDIO_COPY, copy_struct);
+	printf("ioctl(%d, UFFDIO_COPY, {dst=%p, src=%p, len=%#zx,"
+	       " mode=UFFDIO_COPY_MODE_DONTWAKE, copy=%#zx}) = %d\n",
+	       fd, area2, area1, pagesize, pagesize, rc);
+
+	/* ---- ZEROPAGE ---- */
+	struct uffdio_zeropage *zero_struct = tail_alloc(sizeof(*zero_struct));
+	madvise(area2, pagesize, MADV_DONTNEED);
+
+	memset(zero_struct, 0, sizeof(*zero_struct));
+	rc = ioctl(-1, UFFDIO_ZEROPAGE, zero_struct);
+	printf("ioctl(-1, UFFDIO_ZEROPAGE, {range={start=0, len=0}, mode=0"
+	       "}) = %d %s (%m)\n", rc, errno2name());
+
+	rc = ioctl(fd, UFFDIO_ZEROPAGE, NULL);
+	printf("ioctl(%d, UFFDIO_ZEROPAGE, NULL) = %d %s (%m)\n",
+	       fd, rc, errno2name());
+
+	zero_struct->range.start = (uint64_t)(uintptr_t)area2;
+	zero_struct->range.len = pagesize;
+	zero_struct->mode = UFFDIO_ZEROPAGE_MODE_DONTWAKE;
+	rc = ioctl(fd, UFFDIO_ZEROPAGE, zero_struct);
+	printf("ioctl(%d, UFFDIO_ZEROPAGE, {range={start=%p, len=%#zx},"
+	       " mode=UFFDIO_ZEROPAGE_MODE_DONTWAKE, zeropage=%#zx}) = %d\n",
+	       fd, area2, pagesize, pagesize, rc);
+
+	/* ---- WAKE ---- */
+	struct uffdio_range *range_struct = tail_alloc(sizeof(*range_struct));
+	memset(range_struct, 0, sizeof(*range_struct));
+
+	rc = ioctl(-1, UFFDIO_WAKE, range_struct);
+	printf("ioctl(-1, UFFDIO_WAKE, {start=0, len=0}) = %d %s (%m)\n",
+	       rc, errno2name());
+
+	rc = ioctl(fd, UFFDIO_WAKE, NULL);
+	printf("ioctl(%d, UFFDIO_WAKE, NULL) = %d %s (%m)\n",
+	       fd, rc, errno2name());
+
+	range_struct->start = (uint64_t)(uintptr_t)area2;
+	range_struct->len = pagesize;
+	rc = ioctl(fd, UFFDIO_WAKE, range_struct);
+	printf("ioctl(%d, UFFDIO_WAKE, {start=%p, len=%#zx}) = %d\n",
+	       fd, area2, pagesize, rc);
+
+	/* ---- UNREGISTER ---- */
+	memset(range_struct, 0, sizeof(*range_struct));
+
+	rc = ioctl(-1, UFFDIO_UNREGISTER, range_struct);
+	printf("ioctl(-1, UFFDIO_UNREGISTER, {start=0, len=0}) = %d %s (%m)\n",
+	       rc, errno2name());
+
+	rc = ioctl(fd, UFFDIO_UNREGISTER, NULL);
+	printf("ioctl(%d, UFFDIO_UNREGISTER, NULL) = %d %s (%m)\n",
+	       fd, rc, errno2name());
+
+	range_struct->start = (uint64_t)(uintptr_t)area2;
+	range_struct->len = pagesize;
+	rc = ioctl(fd, UFFDIO_UNREGISTER, range_struct);
+	printf("ioctl(%d, UFFDIO_UNREGISTER, {start=%p, len=%#zx}) = %d\n",
+	       fd, area2, pagesize, rc);
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_userfaultfd && HAVE_LINUX_USERFAULTFD_H")
+
+#endif
diff --git a/tests/ioctl_uffdio.test b/tests/ioctl_uffdio.test
new file mode 100755
index 0000000..fae9b55
--- /dev/null
+++ b/tests/ioctl_uffdio.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check userfaultfd ioctl decoding.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c
new file mode 100644
index 0000000..850783d
--- /dev/null
+++ b/tests/ioctl_v4l2.c
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <linux/videodev2.h>
+
+static const unsigned int magic = 0xdeadbeef;
+
+static void
+init_magic(void *addr, const unsigned int size)
+{
+	unsigned int *p = addr;
+	const unsigned int *end = addr + size;
+
+	for (; p < end; ++p)
+		*(unsigned int *) p = magic;
+}
+
+int
+main(void )
+{
+	const unsigned int size = get_page_size();
+	void *const page = tail_alloc(size);
+	init_magic(page, size);
+
+	const union u_pixel_format {
+		unsigned int pixelformat;
+		unsigned char cc[sizeof(int)];
+	} u = {
+#if WORDS_BIGENDIAN
+		.cc = {
+			(unsigned char) (magic >> 24),
+			(unsigned char) (magic >> 16),
+			(unsigned char) (magic >> 8),
+			(unsigned char) magic
+		}
+#else
+		.pixelformat = magic
+#endif
+	};
+
+	/* VIDIOC_QUERYCAP */
+	ioctl(-1, VIDIOC_QUERYCAP, 0);
+	printf("ioctl(-1, VIDIOC_QUERYCAP, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_QUERYCAP, page);
+	printf("ioctl(-1, VIDIOC_QUERYCAP, %p) = -1 EBADF (%m)\n", page);
+
+	/* VIDIOC_ENUM_FMT */
+	ioctl(-1, VIDIOC_ENUM_FMT, 0);
+	printf("ioctl(-1, VIDIOC_ENUM_FMT, NULL) = -1 EBADF (%m)\n");
+
+	struct v4l2_fmtdesc *const p_fmtdesc = tail_alloc(sizeof(*p_fmtdesc));
+	p_fmtdesc->index = magic;
+	p_fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	ioctl(-1, VIDIOC_ENUM_FMT, p_fmtdesc);
+	printf("ioctl(-1, VIDIOC_ENUM_FMT, {index=%u"
+	       ", type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_G_FMT */
+	ioctl(-1, VIDIOC_G_FMT, 0);
+	printf("ioctl(-1, VIDIOC_G_FMT, NULL) = -1 EBADF (%m)\n");
+
+	struct v4l2_format *const p_format =
+		tail_alloc(sizeof(*p_format));
+	p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+	ioctl(-1, VIDIOC_G_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_G_FMT"
+	       ", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n");
+
+	/* VIDIOC_S_FMT */
+	ioctl(-1, VIDIOC_S_FMT, 0);
+	printf("ioctl(-1, VIDIOC_S_FMT, NULL) = -1 EBADF (%m)\n");
+
+	p_format->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+	p_format->fmt.pix.width = 0xdad1beaf;
+	p_format->fmt.pix.height = 0xdad2beaf;
+	p_format->fmt.pix.pixelformat = 0xdeadbeef;
+	p_format->fmt.pix.field = V4L2_FIELD_NONE;
+	p_format->fmt.pix.bytesperline = 0xdad3beaf;
+	p_format->fmt.pix.sizeimage = 0xdad4beaf;
+	p_format->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+
+	ioctl(-1, VIDIOC_S_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_S_FMT, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT"
+	       ", fmt.pix={width=%u, height=%u, pixelformat="
+	       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
+	       ", field=V4L2_FIELD_NONE, bytesperline=%u, sizeimage=%u"
+	       ", colorspace=V4L2_COLORSPACE_JPEG}}) = -1 EBADF (%m)\n",
+	       p_format->fmt.pix.width, p_format->fmt.pix.height,
+	       u.cc[0], u.cc[1], u.cc[2], u.cc[3],
+	       p_format->fmt.pix.bytesperline, p_format->fmt.pix.sizeimage);
+
+	/* VIDIOC_TRY_FMT */
+	ioctl(-1, VIDIOC_TRY_FMT, 0);
+	printf("ioctl(-1, VIDIOC_TRY_FMT, NULL) = -1 EBADF (%m)\n");
+
+#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
+	memset(p_format, -1, sizeof(*p_format));
+	p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+	p_format->fmt.pix_mp.width = 0xdad1beaf;
+	p_format->fmt.pix_mp.height = 0xdad2beaf;
+	p_format->fmt.pix_mp.pixelformat = 0xdeadbeef;
+	p_format->fmt.pix_mp.field = V4L2_FIELD_NONE;
+	p_format->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG;
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
+		p_format->fmt.pix_mp.plane_fmt[i].sizeimage = 0xbadc0de0 | i;
+		p_format->fmt.pix_mp.plane_fmt[i].bytesperline = 0xdadbeaf0 | i;
+	}
+	ioctl(-1, VIDIOC_TRY_FMT, p_format);
+	printf("ioctl(-1, VIDIOC_TRY_FMT"
+	       ", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE"
+	       ", fmt.pix_mp={width=%u, height=%u, pixelformat="
+	       "v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
+	       ", field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_JPEG"
+	       ", plane_fmt=[",
+	       p_format->fmt.pix_mp.width, p_format->fmt.pix_mp.height,
+	       u.cc[0], u.cc[1], u.cc[2], u.cc[3]);
+	for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
+		if (i)
+			printf(", ");
+		printf("{sizeimage=%u, bytesperline=%u}",
+		       p_format->fmt.pix_mp.plane_fmt[i].sizeimage,
+		       p_format->fmt.pix_mp.plane_fmt[i].bytesperline);
+	}
+	printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
+	       p_format->fmt.pix_mp.num_planes);
+#else
+	ioctl(-1, VIDIOC_TRY_FMT, page);
+	printf("ioctl(-1, VIDIOC_TRY_FMT, {type=%#x /* V4L2_BUF_TYPE_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+#endif
+
+	/* VIDIOC_REQBUFS */
+	ioctl(-1, VIDIOC_REQBUFS, 0);
+	printf("ioctl(-1, VIDIOC_REQBUFS, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_REQBUFS,
+	      page + size - sizeof(struct v4l2_requestbuffers));
+	printf("ioctl(-1, VIDIOC_REQBUFS, {count=%u, type=%#x"
+	       " /* V4L2_BUF_TYPE_??? */, memory=%#x /* V4L2_MEMORY_??? */})"
+	       " = -1 EBADF (%m)\n", magic, magic, magic);
+
+	/* VIDIOC_QUERYBUF */
+	ioctl(-1, VIDIOC_QUERYBUF, 0);
+	printf("ioctl(-1, VIDIOC_QUERYBUF, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_QUERYBUF, page + size - sizeof(struct v4l2_buffer));
+	printf("ioctl(-1, VIDIOC_QUERYBUF, {type=%#x /* V4L2_BUF_TYPE_??? */"
+	       ", index=%u}) = -1 EBADF (%m)\n", magic, magic);
+
+	/* VIDIOC_QBUF */
+	ioctl(-1, VIDIOC_QBUF, 0);
+	printf("ioctl(-1, VIDIOC_QBUF, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_QBUF, page + size - sizeof(struct v4l2_buffer));
+	printf("ioctl(-1, VIDIOC_QBUF, {type=%#x /* V4L2_BUF_TYPE_??? */"
+	       ", index=%u}) = -1 EBADF (%m)\n", magic, magic);
+
+	/* VIDIOC_DQBUF */
+	ioctl(-1, VIDIOC_DQBUF, 0);
+	printf("ioctl(-1, VIDIOC_DQBUF, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_DQBUF, page + size - sizeof(struct v4l2_buffer));
+	printf("ioctl(-1, VIDIOC_DQBUF, {type=%#x"
+	       " /* V4L2_BUF_TYPE_??? */}) = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_G_FBUF */
+	ioctl(-1, VIDIOC_G_FBUF, 0);
+	printf("ioctl(-1, VIDIOC_G_FBUF, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_FBUF, page);
+	printf("ioctl(-1, VIDIOC_G_FBUF, %p) = -1 EBADF (%m)\n", page);
+
+	/* VIDIOC_S_FBUF */
+	ioctl(-1, VIDIOC_S_FBUF, 0);
+	printf("ioctl(-1, VIDIOC_S_FBUF, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_S_FBUF, page + size - sizeof(struct v4l2_framebuffer));
+	printf("ioctl(-1, VIDIOC_S_FBUF, {capability=%#x"
+	       ", flags=%#x, base=%#lx}) = -1 EBADF (%m)\n",
+	       magic, magic, *(unsigned long *) page);
+
+	/* VIDIOC_STREAMON */
+	ioctl(-1, VIDIOC_STREAMON, 0);
+	printf("ioctl(-1, VIDIOC_STREAMON, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_STREAMON, page + size - sizeof(int));
+	printf("ioctl(-1, VIDIOC_STREAMON, [%#x /* V4L2_BUF_TYPE_??? */])"
+	       " = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_STREAMOFF */
+	ioctl(-1, VIDIOC_STREAMOFF, 0);
+	printf("ioctl(-1, VIDIOC_STREAMOFF, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_STREAMOFF, page + size - sizeof(int));
+	printf("ioctl(-1, VIDIOC_STREAMOFF, [%#x /* V4L2_BUF_TYPE_??? */])"
+	       " = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_G_PARM */
+	ioctl(-1, VIDIOC_G_PARM, 0);
+	printf("ioctl(-1, VIDIOC_G_PARM, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_PARM, page + size - sizeof(struct v4l2_streamparm));
+	printf("ioctl(-1, VIDIOC_G_PARM, {type=%#x /* V4L2_BUF_TYPE_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_S_PARM */
+	ioctl(-1, VIDIOC_S_PARM, 0);
+	printf("ioctl(-1, VIDIOC_S_PARM, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_S_PARM, page);
+	printf("ioctl(-1, VIDIOC_S_PARM, {type=%#x /* V4L2_BUF_TYPE_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+
+	struct v4l2_streamparm *const p_streamparm =
+		tail_alloc(sizeof(*p_streamparm));
+	p_streamparm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	p_streamparm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
+	p_streamparm->parm.capture.capturemode = V4L2_MODE_HIGHQUALITY;
+	p_streamparm->parm.capture.timeperframe.numerator = 0xdeadbeef;
+	p_streamparm->parm.capture.timeperframe.denominator = 0xbadc0ded;
+	ioctl(-1, VIDIOC_S_PARM, p_streamparm);
+	printf("ioctl(-1, VIDIOC_S_PARM, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE"
+	       ", parm.capture={capability=V4L2_CAP_TIMEPERFRAME"
+	       ", capturemode=V4L2_MODE_HIGHQUALITY, timeperframe=%u/%u"
+	       ", extendedmode=%u, readbuffers=%u}}) = -1 EBADF (%m)\n",
+	       p_streamparm->parm.capture.timeperframe.numerator,
+	       p_streamparm->parm.capture.timeperframe.denominator, -1U, -1U);
+
+	p_streamparm->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+	p_streamparm->parm.output.outputmode = 0;
+	ioctl(-1, VIDIOC_S_PARM, p_streamparm);
+	printf("ioctl(-1, VIDIOC_S_PARM, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT"
+	       ", parm.output={capability=V4L2_CAP_TIMEPERFRAME"
+	       ", outputmode=0, timeperframe=%u/%u"
+	       ", extendedmode=%u, writebuffers=%u}}) = -1 EBADF (%m)\n",
+	       p_streamparm->parm.output.timeperframe.numerator,
+	       p_streamparm->parm.output.timeperframe.denominator, -1U, -1U);
+
+	/* VIDIOC_G_STD */
+	ioctl(-1, VIDIOC_G_STD, 0);
+	printf("ioctl(-1, VIDIOC_G_STD, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_STD, page);
+	printf("ioctl(-1, VIDIOC_G_STD, %p) = -1 EBADF (%m)\n", page);
+
+	/* VIDIOC_S_STD */
+	ioctl(-1, VIDIOC_S_STD, 0);
+	printf("ioctl(-1, VIDIOC_S_STD, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_S_STD, page + size - sizeof(long long));
+	printf("ioctl(-1, VIDIOC_S_STD, [%#llx]) = -1 EBADF (%m)\n",
+	       *(unsigned long long *) page);
+
+	/* VIDIOC_ENUMSTD */
+	ioctl(-1, VIDIOC_ENUMSTD, 0);
+	printf("ioctl(-1, VIDIOC_ENUMSTD, NULL) = -1 EBADF (%m)\n");
+
+	struct v4l2_standard *const p_standard =
+		tail_alloc(sizeof(*p_standard));
+	p_standard->index = magic;
+	ioctl(-1, VIDIOC_ENUMSTD, p_standard);
+	printf("ioctl(-1, VIDIOC_ENUMSTD, {index=%u}) = -1 EBADF (%m)\n",
+	       magic);
+
+	/* VIDIOC_ENUMINPUT */
+	ioctl(-1, VIDIOC_ENUMINPUT, 0);
+	printf("ioctl(-1, VIDIOC_ENUMINPUT, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_ENUMINPUT, page);
+	printf("ioctl(-1, VIDIOC_ENUMINPUT, {index=%u}) = -1 EBADF (%m)\n",
+	       magic);
+
+	/* VIDIOC_G_CTRL */
+	ioctl(-1, VIDIOC_G_CTRL, 0);
+	printf("ioctl(-1, VIDIOC_G_CTRL, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_CTRL, page + size - sizeof(struct v4l2_control));
+	printf("ioctl(-1, VIDIOC_G_CTRL, {id=%#x /* V4L2_CID_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_S_CTRL */
+	ioctl(-1, VIDIOC_S_CTRL, 0);
+	printf("ioctl(-1, VIDIOC_S_CTRL, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_S_CTRL, page + size - sizeof(struct v4l2_control));
+	printf("ioctl(-1, VIDIOC_S_CTRL, {id=%#x /* V4L2_CID_??? */"
+	       ", value=%d}) = -1 EBADF (%m)\n", magic, magic);
+
+	/* VIDIOC_QUERYCTRL */
+	ioctl(-1, VIDIOC_QUERYCTRL, 0);
+	printf("ioctl(-1, VIDIOC_QUERYCTRL, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_QUERYCTRL,
+	      page + size - sizeof(struct v4l2_queryctrl));
+# ifdef V4L2_CTRL_FLAG_NEXT_CTRL
+	printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL"
+	       "|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n",
+	       magic & ~V4L2_CTRL_FLAG_NEXT_CTRL);
+# else
+	printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+# endif
+
+	struct v4l2_queryctrl *const p_queryctrl =
+		tail_alloc(sizeof(*p_queryctrl));
+	p_queryctrl->id = V4L2_CID_SATURATION;
+	ioctl(-1, VIDIOC_QUERYCTRL, p_queryctrl);
+	printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CID_SATURATION})"
+	       " = -1 EBADF (%m)\n");
+
+	/* VIDIOC_G_INPUT */
+	ioctl(-1, VIDIOC_G_INPUT, 0);
+	printf("ioctl(-1, VIDIOC_G_INPUT, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_INPUT, page);
+	printf("ioctl(-1, VIDIOC_G_INPUT, %p) = -1 EBADF (%m)\n", page);
+
+	/* VIDIOC_S_INPUT */
+	ioctl(-1, VIDIOC_S_INPUT, 0);
+	printf("ioctl(-1, VIDIOC_S_INPUT, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_S_INPUT, page + size - sizeof(int));
+	printf("ioctl(-1, VIDIOC_S_INPUT, [%u]) = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_CROPCAP */
+	ioctl(-1, VIDIOC_CROPCAP, 0);
+	printf("ioctl(-1, VIDIOC_CROPCAP, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_CROPCAP, page + size - sizeof(struct v4l2_cropcap));
+	printf("ioctl(-1, VIDIOC_CROPCAP, {type=%#x /* V4L2_BUF_TYPE_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_G_CROP */
+	ioctl(-1, VIDIOC_G_CROP, 0);
+	printf("ioctl(-1, VIDIOC_G_CROP, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_CROP, page + size - sizeof(struct v4l2_crop));
+	printf("ioctl(-1, VIDIOC_G_CROP, {type=%#x /* V4L2_BUF_TYPE_??? */})"
+	       " = -1 EBADF (%m)\n", magic);
+
+	/* VIDIOC_S_CROP */
+	ioctl(-1, VIDIOC_S_CROP, 0);
+	printf("ioctl(-1, VIDIOC_S_CROP, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_S_CROP, page + size - sizeof(struct v4l2_crop));
+	printf("ioctl(-1, VIDIOC_S_CROP, {type=%#x /* V4L2_BUF_TYPE_??? */"
+	       ", c={left=%d, top=%d, width=%u, height=%u}}) = -1 EBADF (%m)\n",
+	       magic, magic, magic, magic, magic);
+
+#ifdef VIDIOC_S_EXT_CTRLS
+	/* VIDIOC_S_EXT_CTRLS */
+	ioctl(-1, VIDIOC_S_EXT_CTRLS, 0);
+	printf("ioctl(-1, VIDIOC_S_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
+
+	struct v4l2_ext_controls *const p_ext_controls =
+		tail_alloc(sizeof(*p_ext_controls));
+	p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_USER;
+	p_ext_controls->count = 0;
+	p_ext_controls->controls = (void *) -2UL;
+	ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
+	printf("ioctl(-1, VIDIOC_S_EXT_CTRLS, {ctrl_class=V4L2_CTRL_CLASS_USER"
+	       ", count=%u}) = -1 EBADF (%m)\n", p_ext_controls->count);
+
+	p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_MPEG;
+	p_ext_controls->count = magic;
+	ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
+	printf("ioctl(-1, VIDIOC_S_EXT_CTRLS, {ctrl_class=V4L2_CTRL_CLASS_MPEG"
+	       ", count=%u, controls=%p}) = -1 EBADF (%m)\n",
+	       p_ext_controls->count, p_ext_controls->controls);
+
+# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
+	p_ext_controls->count = 2;
+	p_ext_controls->controls =
+		tail_alloc(sizeof(*p_ext_controls->controls) * p_ext_controls->count);
+	p_ext_controls->controls[0].id = V4L2_CID_BRIGHTNESS;
+	p_ext_controls->controls[0].size = 0;
+	p_ext_controls->controls[0].value64 = 0xfacefeeddeadbeef;
+	p_ext_controls->controls[1].id = V4L2_CID_CONTRAST;
+	p_ext_controls->controls[1].size = 2;
+	p_ext_controls->controls[1].string =
+		tail_alloc(p_ext_controls->controls[1].size);
+
+	ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
+	printf("ioctl(-1, VIDIOC_S_EXT_CTRLS"
+	       ", {ctrl_class=V4L2_CTRL_CLASS_MPEG, count=%u, controls="
+	       "[{id=V4L2_CID_BRIGHTNESS, size=0, value=%d, value64=%lld}"
+	       ", {id=V4L2_CID_CONTRAST, size=2, string=\"\\377\\377\"}"
+	       "] => controls="
+	       "[{id=V4L2_CID_BRIGHTNESS, size=0, value=%d, value64=%lld}"
+	       ", {id=V4L2_CID_CONTRAST, size=2, string=\"\\377\\377\"}"
+	       "], error_idx=%u}) = -1 EBADF (%m)\n",
+	       p_ext_controls->count,
+	       p_ext_controls->controls[0].value,
+	       (long long) p_ext_controls->controls[0].value64,
+	       p_ext_controls->controls[0].value,
+	       (long long) p_ext_controls->controls[0].value64,
+	       p_ext_controls->error_idx);
+
+	++p_ext_controls->count;
+	ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
+	printf("ioctl(-1, VIDIOC_S_EXT_CTRLS"
+	       ", {ctrl_class=V4L2_CTRL_CLASS_MPEG, count=%u, controls="
+	       "[{id=V4L2_CID_BRIGHTNESS, size=0, value=%d, value64=%lld}"
+	       ", {id=V4L2_CID_CONTRAST, size=2, string=\"\\377\\377\"}"
+	       ", %p]}) = -1 EBADF (%m)\n",
+	       p_ext_controls->count,
+	       p_ext_controls->controls[0].value,
+	       (long long) p_ext_controls->controls[0].value64,
+	       p_ext_controls->controls + 2);
+# endif /* HAVE_DECL_V4L2_CTRL_TYPE_STRING */
+
+	/* VIDIOC_TRY_EXT_CTRLS */
+	ioctl(-1, VIDIOC_TRY_EXT_CTRLS, 0);
+	printf("ioctl(-1, VIDIOC_TRY_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
+
+	p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_USER;
+	p_ext_controls->count = magic;
+	p_ext_controls->controls = (void *) -2UL;
+	ioctl(-1, VIDIOC_TRY_EXT_CTRLS, p_ext_controls);
+	printf("ioctl(-1, VIDIOC_TRY_EXT_CTRLS"
+	       ", {ctrl_class=V4L2_CTRL_CLASS_USER, count=%u, controls=%p})"
+	       " = -1 EBADF (%m)\n",
+	       p_ext_controls->count, p_ext_controls->controls);
+
+	/* VIDIOC_G_EXT_CTRLS */
+	ioctl(-1, VIDIOC_G_EXT_CTRLS, 0);
+	printf("ioctl(-1, VIDIOC_G_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_G_EXT_CTRLS, p_ext_controls);
+	printf("ioctl(-1, VIDIOC_G_EXT_CTRLS"
+	       ", {ctrl_class=V4L2_CTRL_CLASS_USER, count=%u, controls=%p"
+	       ", error_idx=%u}) = -1 EBADF (%m)\n",
+	       p_ext_controls->count, p_ext_controls->controls,
+	       p_ext_controls->error_idx);
+#endif /* VIDIOC_S_EXT_CTRLS */
+
+#ifdef VIDIOC_ENUM_FRAMESIZES
+	ioctl(-1, VIDIOC_ENUM_FRAMESIZES, 0);
+	printf("ioctl(-1, VIDIOC_ENUM_FRAMESIZES, NULL) = -1 EBADF (%m)\n");
+
+	struct v4l2_frmsizeenum *const p_frmsizeenum =
+		tail_alloc(sizeof(*p_frmsizeenum));
+	p_frmsizeenum->index = magic;
+	const union u_pixel_format u_frmsizeenum = {
+		.cc = { 'A', '\'', '\\', '\xfa' }
+	};
+#if WORDS_BIGENDIAN
+	p_frmsizeenum->pixel_format =
+		(unsigned) u_frmsizeenum.cc[0] << 24 |
+		(unsigned) u_frmsizeenum.cc[1] << 16 |
+		(unsigned) u_frmsizeenum.cc[2] << 8 |
+		(unsigned) u_frmsizeenum.cc[3];
+#else
+	p_frmsizeenum->pixel_format = u_frmsizeenum.pixelformat;
+#endif
+
+	ioctl(-1, VIDIOC_ENUM_FRAMESIZES, p_frmsizeenum);
+	printf("ioctl(-1, VIDIOC_ENUM_FRAMESIZES, {index=%u"
+	       ", pixel_format=v4l2_fourcc('%c', '\\%c', '\\%c', '\\x%x')})"
+	       " = -1 EBADF (%m)\n", p_frmsizeenum->index,
+	       u_frmsizeenum.cc[0], u_frmsizeenum.cc[1],
+	       u_frmsizeenum.cc[2], u_frmsizeenum.cc[3]);
+#endif /* VIDIOC_ENUM_FRAMESIZES */
+
+#ifdef VIDIOC_ENUM_FRAMEINTERVALS
+	ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, 0);
+	printf("ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, page);
+	printf("ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, {index=%u"
+	       ", pixel_format=v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
+	       ", width=%u, height=%u}) = -1 EBADF (%m)\n",
+	       magic, u.cc[0], u.cc[1], u.cc[2], u.cc[3], magic, magic);
+#endif /* VIDIOC_ENUM_FRAMEINTERVALS */
+
+#ifdef VIDIOC_CREATE_BUFS
+	ioctl(-1, VIDIOC_CREATE_BUFS, 0);
+	printf("ioctl(-1, VIDIOC_CREATE_BUFS, NULL) = -1 EBADF (%m)\n");
+
+	ioctl(-1, VIDIOC_CREATE_BUFS,
+	      page + size - sizeof(struct v4l2_create_buffers));
+	printf("ioctl(-1, VIDIOC_CREATE_BUFS, {count=%u, memory=%#x"
+	       " /* V4L2_MEMORY_??? */, format={type=%#x"
+	       " /* V4L2_BUF_TYPE_??? */}}) = -1 EBADF (%m)\n",
+	       magic, magic, magic);
+#endif /* VIDIOC_CREATE_BUFS */
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/ioctl_v4l2.test b/tests/ioctl_v4l2.test
new file mode 100755
index 0000000..a092a3c
--- /dev/null
+++ b/tests/ioctl_v4l2.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check basic VIDIOC_* ioctl decoding.
+
+. "${srcdir=.}/ioctl.test"
diff --git a/tests/ioperm.c b/tests/ioperm.c
new file mode 100644
index 0000000..f39bdf0
--- /dev/null
+++ b/tests/ioperm.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_ioperm
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	const unsigned long port = (unsigned long) 0xdeafbeefffffffff;
+
+	long rc = syscall(__NR_ioperm, port, 1, 0);
+	printf("ioperm(%#lx, %#lx, %d) = %ld %s (%m)\n",
+	       port, 1UL, 0, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_ioperm")
+
+#endif
diff --git a/tests/ioperm.test b/tests/ioperm.test
new file mode 100755
index 0000000..8c1c1cc
--- /dev/null
+++ b/tests/ioperm.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check ioperm syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a27
diff --git a/tests/iopl.c b/tests/iopl.c
new file mode 100644
index 0000000..b547f3c
--- /dev/null
+++ b/tests/iopl.c
@@ -0,0 +1,23 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_iopl
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	long rc = syscall(__NR_iopl, 4);
+	printf("iopl(4) = %ld %s (%m)\n", rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_iopl")
+
+#endif
diff --git a/tests/iopl.test b/tests/iopl.test
new file mode 100755
index 0000000..d0b5b11
--- /dev/null
+++ b/tests/iopl.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check iopl syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a8
diff --git a/tests/kill.c b/tests/kill.c
new file mode 100644
index 0000000..0755d68
--- /dev/null
+++ b/tests/kill.c
@@ -0,0 +1,79 @@
+/*
+ * Check decoding of kill syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Fei Jie <feij.fnst@cn.fujitsu.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_kill
+
+# include <signal.h>
+# include <stdio.h>
+# include <unistd.h>
+
+static void
+handler(int sig)
+{
+}
+
+int
+main(void)
+{
+	const struct sigaction act = { .sa_handler = handler };
+	if (sigaction(SIGALRM, &act, NULL))
+		perror_msg_and_fail("sigaction");
+
+	sigset_t mask;
+	sigemptyset(&mask);
+	sigaddset(&mask, SIGALRM);
+	if (sigprocmask(SIG_UNBLOCK, &mask, NULL))
+		perror_msg_and_fail("sigprocmask");
+
+	const int pid = getpid();
+	long rc = syscall(__NR_kill, pid, (long) 0xdefaced00000000 | SIGALRM);
+	printf("kill(%d, SIGALRM) = %ld\n", pid, rc);
+
+	const long big_pid = (long) 0xfacefeedbadc0ded;
+	const long big_sig = (long) 0xdeadbeefcafef00d;
+	rc = syscall(__NR_kill, big_pid, big_sig);
+	printf("kill(%d, %d) = %ld %s (%m)\n",
+	       (int) big_pid, (int) big_sig, rc, errno2name());
+
+	rc = syscall(__NR_kill, (long) 0xdefaced00000000 | pid, 0);
+	printf("kill(%d, SIG_0) = %ld\n", pid, rc);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_kill")
+
+#endif
diff --git a/tests/kill.test b/tests/kill.test
new file mode 100755
index 0000000..7a3a51a
--- /dev/null
+++ b/tests/kill.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of kill syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12 -esignal=none
diff --git a/tests/lchown.c b/tests/lchown.c
new file mode 100644
index 0000000..a116901
--- /dev/null
+++ b/tests/lchown.c
@@ -0,0 +1,19 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_lchown
+
+# define SYSCALL_NR __NR_lchown
+# define SYSCALL_NAME "lchown"
+
+# if defined __NR_lchown32 && __NR_lchown != __NR_lchown32
+#  define UGID_TYPE_IS_SHORT
+# endif
+
+# include "xchownx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_lchown")
+
+#endif
diff --git a/tests/lchown.test b/tests/lchown.test
new file mode 100755
index 0000000..ceeaa85
--- /dev/null
+++ b/tests/lchown.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check lchown syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a30
diff --git a/tests/lchown32.c b/tests/lchown32.c
new file mode 100644
index 0000000..ff5ad3e
--- /dev/null
+++ b/tests/lchown32.c
@@ -0,0 +1,14 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_lchown32
+
+# define SYSCALL_NR __NR_lchown32
+# define SYSCALL_NAME "lchown32"
+# include "xchownx.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_lchown32")
+
+#endif
diff --git a/tests/lchown32.test b/tests/lchown32.test
new file mode 100755
index 0000000..6ee1ac9
--- /dev/null
+++ b/tests/lchown32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check lchown32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a32
diff --git a/tests/link.c b/tests/link.c
new file mode 100644
index 0000000..4b84e41
--- /dev/null
+++ b/tests/link.c
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_link
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample_1[] = "link_sample_old";
+	static const char sample_2[] = "link_sample_new";
+
+	long rc = syscall(__NR_link, sample_1, sample_2);
+	printf("link(\"%s\", \"%s\") = %ld %s (%m)\n",
+	       sample_1, sample_2, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_link")
+
+#endif
diff --git a/tests/link.test b/tests/link.test
new file mode 100755
index 0000000..cfa2b0c
--- /dev/null
+++ b/tests/link.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check link syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/linkat.c b/tests/linkat.c
index 1577f0d..06d550e 100644
--- a/tests/linkat.c
+++ b/tests/linkat.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_linkat
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -15,17 +14,17 @@
 	const long fd_old = (long) 0xdeadbeefffffffff;
 	const long fd_new = (long) 0xdeadbeeffffffffe;
 
-	int rc = syscall(__NR_linkat, fd_old, sample_1, fd_new, sample_2, 0);
-	printf("linkat(%d, \"%s\", %d, \"%s\", 0) = %d %s (%m)\n",
-	       (int) fd_old, sample_1, (int) fd_new, sample_2, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	long rc = syscall(__NR_linkat, fd_old, sample_1, fd_new, sample_2, 0);
+	printf("linkat(%d, \"%s\", %d, \"%s\", 0) = %ld %s (%m)\n",
+	       (int) fd_old, sample_1, (int) fd_new, sample_2,
+	       rc, errno2name());
 
 	rc = syscall(__NR_linkat, -100, sample_1, -100, sample_2, -1L);
-	printf("linkat(%s, \"%s\", %s, \"%s\", %s) = %d %s (%m)\n",
+	printf("linkat(%s, \"%s\", %s, \"%s\", %s) = %ld %s (%m)\n",
 	       "AT_FDCWD", sample_1, "AT_FDCWD", sample_2,
 	       "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
 	       "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff",
-	       rc, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/llseek.c b/tests/llseek.c
index 2f69171..e82535a 100644
--- a/tests/llseek.c
+++ b/tests/llseek.c
@@ -30,8 +30,6 @@
 
 #ifdef __NR__llseek
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -43,12 +41,9 @@
 	const long long offset = 0xfacefeeddeadbeefLL;
 	unsigned long long result;
 
-	assert(syscall(__NR__llseek, -1, high, low, &result, SEEK_SET) == -1);
-	if (EBADF != errno)
-		perror_msg_and_skip("_llseek");
-
-	printf("_llseek(-1, %lld, %p, SEEK_SET) = -1 EBADF (%m)\n",
-	       offset, &result);
+	long rc = syscall(__NR__llseek, -1, high, low, &result, SEEK_SET);
+	printf("_llseek(-1, %lld, %p, SEEK_SET) = %ld %s (%m)\n",
+	       offset, &result, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/lseek.c b/tests/lseek.c
index 227c4e3..e5efaa3 100644
--- a/tests/lseek.c
+++ b/tests/lseek.c
@@ -30,8 +30,6 @@
 
 #ifdef __NR_lseek
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 # include "kernel_types.h"
@@ -41,20 +39,19 @@
 {
 	const kernel_ulong_t offset = (kernel_ulong_t) 0xfacefeeddeadbeefULL;
 
-	if (sizeof(offset) > sizeof(long))
-		assert(lseek(-1, offset, SEEK_SET) == -1);
-	else
-		assert(syscall(__NR_lseek, -1L, offset, SEEK_SET) == -1);
-
-	if (EBADF != errno)
-		perror_msg_and_skip("lseek");
-
-	if (sizeof(offset) > sizeof(long))
-		printf("lseek(-1, %lld, SEEK_SET) = -1 EBADF (%m)\n",
-		       (long long) offset);
-	else
-		printf("lseek(-1, %ld, SEEK_SET) = -1 EBADF (%m)\n",
-		       (long) offset);
+	if (sizeof(offset) > sizeof(long)) {
+		/*
+		 * Cannot use syscall because it takes long arguments.
+		 * Let's call lseek with hope it will invoke lseek syscall.
+		 */
+		long long rc = lseek(-1, offset, SEEK_SET);
+		printf("lseek(-1, %lld, SEEK_SET) = %lld %s (%m)\n",
+		       (long long) offset, rc, errno2name());
+	} else {
+		long rc = syscall(__NR_lseek, -1L, offset, SEEK_SET);
+		printf("lseek(-1, %ld, SEEK_SET) = %ld %s (%m)\n",
+		       (long) offset, rc, errno2name());
+	}
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/uid32.c b/tests/mbind.c
similarity index 61%
rename from tests/uid32.c
rename to tests/mbind.c
index 9c30d92..b0f044d 100644
--- a/tests/uid32.c
+++ b/tests/mbind.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Check decoding of mbind syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,41 +30,32 @@
 #include "tests.h"
 #include <sys/syscall.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
+#ifdef __NR_mbind
 
-# include <assert.h>
-# include <stdlib.h>
+# include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	const unsigned long len = (unsigned long) 0xcafef00dbadc0ded;
+	const unsigned long mode = 3;
+	const unsigned long nodemask = (unsigned long) 0xfacefeedfffffff1;
+	const unsigned long maxnode = (unsigned long) 0xdeadbeeffffffff2;
+	const unsigned long flags = -1UL;
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
+	long rc = syscall(__NR_mbind, 0, len, mode, nodemask, maxnode, flags);
+	printf("mbind(NULL, %lu, %s, %#lx, %lu, %s|%#x) = %ld %s (%m)\n",
+	       len, "MPOL_INTERLEAVE", nodemask, maxnode,
+	       "MPOL_MF_STRICT|MPOL_MF_MOVE|MPOL_MF_MOVE_ALL",
+	       (unsigned) flags & ~7, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
+SKIP_MAIN_UNDEFINED("__NR_mbind")
 
 #endif
diff --git a/tests/mbind.test b/tests/mbind.test
new file mode 100755
index 0000000..2a07cac
--- /dev/null
+++ b/tests/mbind.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of mbind syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/membarrier.c b/tests/membarrier.c
index 6aa6c9e..7364d0f 100644
--- a/tests/membarrier.c
+++ b/tests/membarrier.c
@@ -40,7 +40,7 @@
 {
 	assert(syscall(__NR_membarrier, 3, 255) == -1);
 	printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n",
-	       errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	       errno2name());
 	if (errno != ENOSYS) {
 		/* the test needs to be updated? */
 		assert(syscall(__NR_membarrier, 0, 0) == 1);
diff --git a/tests/uid32.c b/tests/migrate_pages.c
similarity index 61%
copy from tests/uid32.c
copy to tests/migrate_pages.c
index 9c30d92..995723c 100644
--- a/tests/uid32.c
+++ b/tests/migrate_pages.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Check decoding of migrate_pages syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,41 +30,25 @@
 #include "tests.h"
 #include <sys/syscall.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
+#ifdef __NR_migrate_pages
 
-# include <assert.h>
-# include <stdlib.h>
+# include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	const long pid = (long) 0xfacefeedffffffff;
+	long rc = syscall(__NR_migrate_pages, pid, 0, 0, 0);
+	printf("migrate_pages(%d, 0, NULL, NULL) = %ld %s (%m)\n",
+	       (int) pid, rc, errno2name());
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
+SKIP_MAIN_UNDEFINED("__NR_migrate_pages")
 
 #endif
diff --git a/tests/migrate_pages.test b/tests/migrate_pages.test
new file mode 100755
index 0000000..fad53b7
--- /dev/null
+++ b/tests/migrate_pages.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check migrate_pages syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a33
diff --git a/tests/mincore.c b/tests/mincore.c
index d9cbbd4..ff2922a 100644
--- a/tests/mincore.c
+++ b/tests/mincore.c
@@ -32,15 +32,14 @@
 #define DEFAULT_STRLEN 32
 
 static void
-test_mincore(const unsigned int pages)
+print_mincore(const unsigned int pages, void *const addr,
+	      const size_t size, unsigned char *const vec)
 {
-	const size_t size = pages * get_page_size();
-	char *addr = tail_alloc(size);
-	unsigned char *vec = tail_alloc(pages);
 	unsigned int i;
 
 	if (mincore(addr, size, vec))
 		perror_msg_and_skip("mincore");
+
 	printf("mincore(%p, %zu, [", addr, size);
 	for (i = 0; i < pages; ++i) {
 		if (i >= DEFAULT_STRLEN) {
@@ -52,10 +51,28 @@
 	puts("]) = 0");
 }
 
+static void
+test_mincore(const unsigned int pages)
+{
+	const size_t page_size = get_page_size();
+	const size_t size = pages * page_size;
+	void *const addr = tail_alloc(size);
+	unsigned char *const vec = tail_alloc(pages);
+
+	mincore(addr, size, NULL);
+	printf("mincore(%p, %zu, NULL) = -1 %s (%m)\n",
+	       addr, size, errno2name());
+
+	print_mincore(pages, addr, size, vec);
+	if (size)
+		print_mincore(pages, addr, size - page_size + 1, vec);
+}
+
 int main(void)
 {
 	test_mincore(1);
 	test_mincore(2);
+	test_mincore(DEFAULT_STRLEN);
 	test_mincore(DEFAULT_STRLEN + 1);
 
 	puts("+++ exited with 0 +++");
diff --git a/tests/mkdir.c b/tests/mkdir.c
new file mode 100644
index 0000000..dbb43c3
--- /dev/null
+++ b/tests/mkdir.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_mkdir
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "mkdir";
+
+	long rc = syscall(__NR_mkdir, sample, 0600);
+	printf("mkdir(\"%s\", 0600) = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mkdir")
+
+#endif
diff --git a/tests/mkdir.test b/tests/mkdir.test
new file mode 100755
index 0000000..98d5a52
--- /dev/null
+++ b/tests/mkdir.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check mkdir syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a21
diff --git a/tests/mkdirat.c b/tests/mkdirat.c
index 03f85c2..cbdf16c 100644
--- a/tests/mkdirat.c
+++ b/tests/mkdirat.c
@@ -3,8 +3,6 @@
 
 #ifdef __NR_mkdirat
 
-# include <errno.h>
-# include <sys/stat.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -13,10 +11,10 @@
 {
 	static const char sample[] = "mkdirat.sample";
 	const long fd = (long) 0xdeadbeefffffffff;
-	int rc = syscall(__NR_mkdirat, fd, sample, 0600);
-	printf("mkdirat(%d, \"%s\", 0600) = %d %s (%m)\n",
-	       (int) fd, sample, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_mkdirat, fd, sample, 0600);
+	printf("mkdirat(%d, \"%s\", 0600) = %ld %s (%m)\n",
+	       (int) fd, sample, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/mknod.c b/tests/mknod.c
index 48367fe..91ce751 100644
--- a/tests/mknod.c
+++ b/tests/mknod.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_mknod
 
-# include <errno.h>
 # include <stdio.h>
 # include <sys/stat.h>
 # include <unistd.h>
@@ -20,17 +19,35 @@
 int
 main(void)
 {
-	int rc = syscall(__NR_mknod, TMP_FILE, S_IFREG|0600, 0);
-	printf("mknod(\"%s\", S_IFREG|0600) = %d %s (%m)\n",
-	       TMP_FILE, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EEXIST");
+	long rc = syscall(__NR_mknod, TMP_FILE, 0, 0xdeadbeef);
+	printf("mknod(\"%s\", 0) = %ld %s (%m)\n",
+	       TMP_FILE, rc, errno2name());
 
-	const unsigned long dev =
+	rc = syscall(__NR_mknod, TMP_FILE, -1L, 0xdeadbeef);
+	printf("mknod(\"%s\", %#o) = %ld %s (%m)\n",
+	       TMP_FILE, -1, rc, errno2name());
+
+	rc = syscall(__NR_mknod, TMP_FILE, S_IFREG|0600, 0);
+	printf("mknod(\"%s\", S_IFREG|0600) = %ld %s (%m)\n",
+	       TMP_FILE, rc, errno2name());
+
+	unsigned long dev =
 		(unsigned long) 0xdeadbeef00000000 | makedev(1, 7);
+
 	rc = syscall(__NR_mknod, TMP_FILE, S_IFCHR | 0400, dev);
-	printf("mknod(\"%s\", S_IFCHR|0400, makedev(1, 7)) = %d %s (%m)\n",
-	       TMP_FILE, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EEXIST");
+	printf("mknod(\"%s\", S_IFCHR|0400, makedev(1, 7)) = %ld %s (%m)\n",
+	       TMP_FILE, rc, errno2name());
+
+	const unsigned long mode =
+		((unsigned long) 0xfacefeedffffffff & ~S_IFMT) | S_IFBLK;
+	dev = (unsigned long) 0xdeadbeefbadc0ded;
+
+	rc = syscall(__NR_mknod, TMP_FILE, mode, dev);
+	printf("mknod(\"%s\", S_IFBLK|S_ISUID|S_ISGID|S_ISVTX|%#o"
+	       ", makedev(%u, %u)) = %ld %s (%m)\n",
+	       TMP_FILE, (unsigned) mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX),
+	       major((unsigned) dev), minor((unsigned) dev),
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/mknod.test b/tests/mknod.test
index 092d770..195f1e3 100755
--- a/tests/mknod.test
+++ b/tests/mknod.test
@@ -3,4 +3,4 @@
 # Check mknod syscall decoding.
 
 . "${srcdir=.}/init.sh"
-run_strace_match_diff -a29
+run_strace_match_diff -a18
diff --git a/tests/mknodat.c b/tests/mknodat.c
new file mode 100644
index 0000000..2cdc47c
--- /dev/null
+++ b/tests/mknodat.c
@@ -0,0 +1,41 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_mknodat
+
+# include <stdio.h>
+# include <sys/stat.h>
+# include <unistd.h>
+
+# ifdef MAJOR_IN_SYSMACROS
+#  include <sys/sysmacros.h>
+# endif
+# ifdef MAJOR_IN_MKDEV
+#  include <sys/mkdev.h>
+# endif
+
+int
+main(void)
+{
+	static const char sample[] = "mknokat_sample";
+	const long int fd = (long int) 0xdeadbeefffffffff;
+	long rc = syscall(__NR_mknodat, fd, sample, S_IFREG|0600, 0);
+	printf("mknodat(%d, \"%s\", S_IFREG|0600) = %ld %s (%m)\n",
+	       (int) fd, sample, rc, errno2name());
+
+	const unsigned long dev =
+		(unsigned long) 0xdeadbeef00000000 | makedev(1, 7);
+
+	rc = syscall(__NR_mknodat, fd, sample, S_IFCHR | 0400, dev);
+	printf("mknodat(%d, \"%s\", S_IFCHR|0400, makedev(1, 7)) = %ld %s (%m)\n",
+	       (int) fd, sample, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mknodat")
+
+#endif
diff --git a/tests/mknodat.test b/tests/mknodat.test
new file mode 100755
index 0000000..edf0498
--- /dev/null
+++ b/tests/mknodat.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check mknodat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/mlock.c b/tests/mlock.c
new file mode 100644
index 0000000..a56dc1f
--- /dev/null
+++ b/tests/mlock.c
@@ -0,0 +1,37 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_mlock && defined __NR_munlock
+
+# include <stdio.h>
+# include <unistd.h>
+
+const int size = 1024;
+
+int
+main(void)
+{
+	const char *addr = tail_alloc(size);
+	if (syscall(__NR_mlock, addr, size) == 0) {
+		printf("mlock(%p, %d) = 0\n", addr, size);
+	} else {
+		printf("mlock(%p, %d) = -1 %s (%m)\n",
+		       addr, size, errno2name());
+	}
+
+	if (syscall(__NR_munlock, addr, size) == 0) {
+		printf("munlock(%p, %d) = 0\n", addr, size);
+	} else {
+		printf("munlock(%p, %d) = -1 %s (%m)\n",
+		       addr, size, errno2name());
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_DEFINED("__NR_mlock && __NR_munlock")
+
+#endif
diff --git a/tests/mlock.test b/tests/mlock.test
new file mode 100755
index 0000000..9a73a30
--- /dev/null
+++ b/tests/mlock.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check mlock and munlock syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -e trace=mlock,munlock -a20
diff --git a/tests/mlock2.c b/tests/mlock2.c
index 4e850fd..af63917 100644
--- a/tests/mlock2.c
+++ b/tests/mlock2.c
@@ -30,17 +30,16 @@
 
 #ifdef __NR_mlock2
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	assert(syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff) == -1);
+	long rc = syscall(__NR_mlock2, 0xdeadbeef, 0xdefaced, 0xffff);
 	printf("mlock2(0xdeadbeef, 233811181, MLOCK_ONFAULT|0xfffe)"
-	       " = -1 %s (%m)\n", errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	       " = %ld %s (%m)\n", rc, errno2name());
+
 	puts("+++ exited with 0 +++");
 	return 0;
 }
diff --git a/tests/mlockall.c b/tests/mlockall.c
new file mode 100644
index 0000000..cafa4d6
--- /dev/null
+++ b/tests/mlockall.c
@@ -0,0 +1,47 @@
+/*
+ * Check decoding of mlockall syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+
+#include <stdio.h>
+#include <sys/mman.h>
+
+int
+main(void)
+{
+	printf("mlockall(0) = %d EINVAL (%m)\n", mlockall(0));
+
+	if (mlockall(MCL_CURRENT) == 0)
+		puts("mlockall(MCL_CURRENT) = 0");
+	else
+		printf("mlockall(MCL_CURRENT) = -1 %s (%m)\n", errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/mlockall.test b/tests/mlockall.test
new file mode 100755
index 0000000..d7a6182
--- /dev/null
+++ b/tests/mlockall.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of mlockall syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12
diff --git a/tests/mount.c b/tests/mount.c
new file mode 100644
index 0000000..cbfe42f8
--- /dev/null
+++ b/tests/mount.c
@@ -0,0 +1,84 @@
+/*
+ * Check decoding of mount syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/mount.h>
+
+#ifndef MS_MGC_VAL
+# define MS_MGC_VAL 0xC0ED0000
+#endif
+
+#ifndef MS_RELATIME
+# define MS_RELATIME (1ul << 21)
+#endif
+
+#define str_ro_nosuid_nodev_noexec "MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC"
+
+int
+main(void)
+{
+	static const char source[] = "mount_source";
+	static const char target[] = "mount_target";
+	static const char fstype[] = "mount_fstype";
+	static const char data[] = "mount_data";
+
+	int rc = mount(source, target, fstype, 15, data);
+	printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
+	       source, target, fstype, str_ro_nosuid_nodev_noexec,
+	       data, rc, errno2name());
+
+	rc = mount(source, target, fstype, MS_RELATIME | 15, data);
+	printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
+	       source, target, fstype,
+	       str_ro_nosuid_nodev_noexec "|MS_RELATIME",
+	       data, rc, errno2name());
+
+	rc = mount(source, target, fstype, MS_MGC_VAL, data);
+	printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
+	       source, target, fstype, "MS_MGC_VAL", data, rc, errno2name());
+
+	rc = mount(source, target, fstype, MS_MGC_VAL | 15, data);
+	printf("mount(\"%s\", \"%s\", \"%s\", %s, \"%s\") = %d %s (%m)\n",
+	       source, target, fstype,
+	       "MS_MGC_VAL|" str_ro_nosuid_nodev_noexec,
+	       data, rc, errno2name());
+
+	rc = mount(source, target, fstype, MS_REMOUNT, data);
+	printf("mount(\"%s\", \"%s\", %p, %s, \"%s\") = %d %s (%m)\n",
+	       source, target, fstype, "MS_REMOUNT", data, rc, errno2name());
+
+	rc = mount(source, target, fstype, MS_BIND, data);
+	printf("mount(\"%s\", \"%s\", %p, %s, %p) = %d %s (%m)\n",
+	       source, target, fstype, "MS_BIND", data, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/mount.test b/tests/mount.test
new file mode 100755
index 0000000..40fdca9
--- /dev/null
+++ b/tests/mount.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of mount syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/move_pages.c b/tests/move_pages.c
new file mode 100644
index 0000000..1059366
--- /dev/null
+++ b/tests/move_pages.c
@@ -0,0 +1,251 @@
+/*
+ * Check decoding of move_pages syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_move_pages
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+# define MAX_STRLEN 3
+
+static void
+print_page_array(const void **const pages,
+		 const unsigned long count,
+		 const unsigned int offset)
+{
+	if (!count) {
+		printf("%s", pages ? "[]" : "NULL");
+		return;
+	}
+	if (count <= offset) {
+		printf("%p", pages);
+		return;
+	}
+	printf("[");
+	unsigned long i;
+	for (i = 0; i < count; ++i) {
+		if (i)
+			printf(", ");
+		if (i + offset < count) {
+			if (i >= MAX_STRLEN) {
+				printf("...");
+				break;
+			}
+		} else {
+			printf("%p", pages + i);
+			break;
+		}
+		const void *const addr = pages[i];
+		if (addr)
+			printf("%p", addr);
+		else
+			printf("NULL");
+	}
+	printf("]");
+}
+
+static void
+print_node_array(const int *const nodes,
+		 const unsigned long count,
+		 const unsigned int offset)
+{
+	if (!count) {
+		printf("%s", nodes ? "[]" : "NULL");
+		return;
+	}
+	if (count <= offset) {
+		printf("%p", nodes);
+		return;
+	}
+	printf("[");
+	unsigned long i;
+	for (i = 0; i < count; ++i) {
+		if (i)
+			printf(", ");
+		if (i + offset < count) {
+			if (i >= MAX_STRLEN) {
+				printf("...");
+				break;
+			}
+		} else {
+			printf("%p", nodes + i);
+			break;
+		}
+		printf("%d", nodes[i]);
+	}
+	printf("]");
+}
+
+static void
+print_status_array(const int *const status, const unsigned long count)
+{
+	if (!count) {
+		printf("%s", status ? "[]" : "NULL");
+		return;
+	}
+	printf("[");
+	unsigned long i;
+	for (i = 0; i < count; ++i) {
+		if (i)
+			printf(", ");
+		if (i >= MAX_STRLEN) {
+			printf("...");
+			break;
+		}
+		if (status[i] >= 0) {
+			printf("%d", status[i]);
+		} else {
+			errno = -status[i];
+			printf("%s", errno2name());
+		}
+	}
+	printf("]");
+}
+
+static void
+print_stat_pages(const unsigned long pid, const unsigned long count,
+		 const void **const pages, int *const status)
+{
+	const unsigned long flags = (unsigned long) 0xfacefeed00000002;
+
+	long rc = syscall(__NR_move_pages,
+			  pid, count, pages, NULL, status, flags);
+	if (rc) {
+		int saved_errno = errno;
+		printf("move_pages(%d, %lu, ", (int) pid, count);
+		print_page_array(pages, count, 0);
+		printf(", NULL, ");
+		if (count)
+			printf("%p", status);
+		else
+			printf("[]");
+		errno = saved_errno;
+		printf(", MPOL_MF_MOVE) = %ld %s (%m)\n",
+		       rc, errno2name());
+	} else {
+		printf("move_pages(%d, %lu, ", (int) pid, count);
+		print_page_array(pages, count, 0);
+		printf(", NULL, ");
+		print_status_array(status, count);
+		printf(", MPOL_MF_MOVE) = 0\n");
+	}
+}
+
+static void
+print_move_pages(const unsigned long pid,
+		 unsigned long count,
+		 const unsigned int offset,
+		 const void **const pages,
+		 int *const nodes,
+		 int *const status)
+{
+	const unsigned long flags = (unsigned long) 0xfacefeed00000004;
+	count += offset;
+
+	long rc = syscall(__NR_move_pages,
+			  pid, count, pages, nodes, status, flags);
+	int saved_errno = errno;
+	printf("move_pages(%d, %lu, ", (int) pid, count);
+	print_page_array(pages, count, offset);
+	printf(", ");
+	print_node_array(nodes, count, offset);
+	printf(", ");
+	if (count)
+		printf("%p", status);
+	else
+		printf("[]");
+	printf(", MPOL_MF_MOVE_ALL) = ");
+	if (rc) {
+		errno = saved_errno;
+		printf("%ld %s (%m)\n", rc, errno2name());
+	} else {
+		puts("0");
+	}
+}
+
+int
+main(void)
+{
+	const unsigned long pid =
+		(unsigned long) 0xfacefeed00000000 | getpid();
+	unsigned long count = 1;
+	const unsigned page_size = get_page_size();
+	const void *const page = tail_alloc(page_size);
+	const void *const efault = page + page_size;
+	const void **pages = tail_alloc(sizeof(*pages));
+	int *nodes = tail_alloc(sizeof(*nodes));
+	int *status = tail_alloc(sizeof(*status));
+
+	print_stat_pages(pid, 0, pages, status);
+	print_move_pages(pid, 0, 0, pages, nodes, status);
+	print_move_pages(pid, 0, 1, pages + 1, nodes + 1, status + 1);
+
+	*pages = page;
+	print_stat_pages(pid, count, pages, status);
+	*nodes = 0xdeadbee1;
+	print_move_pages(pid, count, 0, pages, nodes, status);
+	print_move_pages(pid, count, 1, pages, nodes, status);
+
+	++count;
+	--status;
+	*(--pages) = efault;
+	print_stat_pages(pid, count, pages, status);
+	*(--nodes) = 0xdeadbee2;
+	print_move_pages(pid, count, 0, pages, nodes, status);
+	print_move_pages(pid, count, 1, pages, nodes, status);
+
+	++count;
+	--status;
+	*(--pages) = nodes;
+	print_stat_pages(pid, count, pages, status);
+	*(--nodes) = 0xdeadbee3;
+	print_move_pages(pid, count, 0, pages, nodes, status);
+	print_move_pages(pid, count, 1, pages, nodes, status);
+
+	++count;
+	--status;
+	*(--pages) = status;
+	print_stat_pages(pid, count, pages, status);
+	*(--nodes) = 0xdeadbee4;
+	print_move_pages(pid, count, 0, pages, nodes, status);
+	print_move_pages(pid, count, 1, pages, nodes, status);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_move_pages")
+
+#endif
diff --git a/tests/move_pages.test b/tests/move_pages.test
new file mode 100755
index 0000000..f957717
--- /dev/null
+++ b/tests/move_pages.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of move_pages syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -s3
diff --git a/tests/munlockall.c b/tests/munlockall.c
new file mode 100644
index 0000000..9ac6942
--- /dev/null
+++ b/tests/munlockall.c
@@ -0,0 +1,13 @@
+#include "tests.h"
+
+#include <stdio.h>
+#include <sys/mman.h>
+
+int
+main(void)
+{
+	printf("munlockall() = %d\n", munlockall());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/munlockall.test b/tests/munlockall.test
new file mode 100755
index 0000000..e25d60a
--- /dev/null
+++ b/tests/munlockall.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check munlockall syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a13
diff --git a/tests/net-icmp_filter.c b/tests/net-icmp_filter.c
new file mode 100644
index 0000000..d3f956d
--- /dev/null
+++ b/tests/net-icmp_filter.c
@@ -0,0 +1,84 @@
+/*
+ * Check decoding of ICMP_FILTER.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <stdio.h>
+#include <sys/socket.h>
+#include <linux/icmp.h>
+
+int
+main(void)
+{
+	getsockopt(-1, SOL_RAW, ICMP_FILTER, 0, 0);
+	printf("getsockopt(-1, SOL_RAW, ICMP_FILTER, 0, 0) = -1 %s (%m)\n",
+	       errno2name());
+
+	setsockopt(-1, SOL_RAW, ICMP_FILTER, NULL, 0);
+	printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, NULL, 0) = -1 %s (%m)\n",
+	       errno2name());
+
+	socklen_t *const plen = tail_alloc(sizeof(*plen));
+	void *const efault = plen + 1;
+	struct icmp_filter *const f = tail_alloc(sizeof(*f));
+
+	getsockopt(-1, SOL_RAW, ICMP_FILTER, f, plen);
+	printf("getsockopt(-1, SOL_RAW, ICMP_FILTER, %p, %p) = -1 %s (%m)\n",
+	       f, plen, errno2name());
+
+	setsockopt(-1, SOL_RAW, ICMP_FILTER, efault, sizeof(*f));
+	printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, %p, %u) = -1 %s (%m)\n",
+	       efault, (unsigned) sizeof(*f), errno2name());
+
+	f->data = ~(
+		1<<ICMP_ECHOREPLY |
+		1<<ICMP_DEST_UNREACH |
+		1<<ICMP_SOURCE_QUENCH |
+		1<<ICMP_REDIRECT |
+		1<<ICMP_TIME_EXCEEDED |
+		1<<ICMP_PARAMETERPROB);
+
+	setsockopt(-1, SOL_RAW, ICMP_FILTER, f, -2);
+	printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, %p, -2) = -1 %s (%m)\n",
+	       f, errno2name());
+
+	setsockopt(-1, SOL_RAW, ICMP_FILTER, f, sizeof(*f));
+	printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, %s, %u) = -1 %s (%m)\n",
+	       "~(1<<ICMP_ECHOREPLY|1<<ICMP_DEST_UNREACH|1<<ICMP_SOURCE_QUENCH"
+	       "|1<<ICMP_REDIRECT|1<<ICMP_TIME_EXCEEDED|1<<ICMP_PARAMETERPROB)",
+	       (unsigned) sizeof(*f), errno2name());
+
+	setsockopt(-1, SOL_RAW, ICMP_FILTER, f, sizeof(*f) * 2);
+	printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, %s, %u) = -1 %s (%m)\n",
+	       "~(1<<ICMP_ECHOREPLY|1<<ICMP_DEST_UNREACH|1<<ICMP_SOURCE_QUENCH"
+	       "|1<<ICMP_REDIRECT|1<<ICMP_TIME_EXCEEDED|1<<ICMP_PARAMETERPROB)",
+	       (unsigned) sizeof(*f) * 2, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/net-icmp_filter.test b/tests/net-icmp_filter.test
new file mode 100755
index 0000000..c05a5e6
--- /dev/null
+++ b/tests/net-icmp_filter.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of ICMP_FILTER.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -e trace=getsockopt,setsockopt
diff --git a/tests/net-yy-inet.test b/tests/net-yy-inet.test
index 8b19e56..2ebf91f 100755
--- a/tests/net-yy-inet.test
+++ b/tests/net-yy-inet.test
@@ -36,8 +36,7 @@
 check_prog sed
 run_prog ./netlink_inet_diag
 
-addr="$NAME-local-stream"
-run_prog "./$NAME" $addr > /dev/null
+run_prog "./$NAME" > /dev/null
 
 run_strace -a22 -yy -eclose,network $args > "$EXP"
 # Filter out close() calls made by ld.so and libc.
diff --git a/tests/net-yy-netlink.c b/tests/net-yy-netlink.c
new file mode 100644
index 0000000..e52cfed
--- /dev/null
+++ b/tests/net-yy-netlink.c
@@ -0,0 +1,84 @@
+/*
+ * This file is part of net-yy-netlink strace test.
+ *
+ * Copyright (c) 2013-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <linux/netlink.h>
+#include <linux/sock_diag.h>
+#include <linux/netlink_diag.h>
+
+#if !defined NETLINK_SOCK_DIAG && defined NETLINK_INET_DIAG
+# define NETLINK_SOCK_DIAG NETLINK_INET_DIAG
+#endif
+
+int
+main(void)
+{
+	unsigned magic = 1234;
+	struct sockaddr_nl addr = {
+		.nl_family = AF_NETLINK,
+		.nl_pid = 1234
+	};
+	struct sockaddr *const sa = tail_memdup(&addr, sizeof(addr));
+	socklen_t * const len = tail_alloc(sizeof(socklen_t));
+	*len = sizeof(addr);
+
+	const int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG);
+	if (fd < 0)
+		perror_msg_and_skip("socket");
+	const unsigned long inode = inode_of_sockfd(fd);
+	printf("socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG) = "
+	       "%d<NETLINK:[%lu]>\n", fd, inode);
+
+	if (bind(fd, sa, *len))
+		perror_msg_and_skip("bind");
+	printf("bind(%d<NETLINK:[%lu]>, {sa_family=AF_NETLINK"
+	       ", pid=%u, groups=00000000}, %u) = 0\n",
+	       fd, inode, magic, (unsigned) *len);
+
+	if (getsockname(fd, sa, len))
+		perror_msg_and_fail("getsockname");
+	printf("getsockname(%d<NETLINK:[SOCK_DIAG:%u]>, {sa_family=AF_NETLINK"
+	       ", pid=%u, groups=00000000}, [%u]) = 0\n",
+	       fd, magic, magic, (unsigned) *len);
+
+	if (close(fd))
+		perror_msg_and_fail("close");
+	printf("close(%d<NETLINK:[SOCK_DIAG:%u]>) = 0\n", fd, magic);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/net-yy-netlink.test b/tests/net-yy-netlink.test
new file mode 100755
index 0000000..bff1d86
--- /dev/null
+++ b/tests/net-yy-netlink.test
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Check decoding of protocol:portid pairs associated with socket
+# descriptors
+#
+# Copyright (c) 2014 Masatake YAMATO <yamato@redhat.com>
+# Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+# Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+. "${srcdir=.}/init.sh"
+
+# strace -yy is implemented using /proc/self/fd
+[ -d /proc/self/fd/ ] ||
+	framework_skip_ '/proc/self/fd/ is not available'
+
+check_prog sed
+run_prog ./netlink_netlink_diag
+
+run_prog "./$NAME" > /dev/null
+
+run_strace -a22 -yy -eclose,network $args > "$EXP"
+# Filter out close() calls made by ld.so and libc.
+sed -n '/socket/,$p' < "$LOG" > "$OUT"
+
+match_diff "$OUT" "$EXP"
+rm -f "$EXP" "$OUT"
diff --git a/tests/netlink_inet_diag.c b/tests/netlink_inet_diag.c
index 614a8f1..2332e20 100644
--- a/tests/netlink_inet_diag.c
+++ b/tests/netlink_inet_diag.c
@@ -28,7 +28,6 @@
  */
 
 #include "tests.h"
-#include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
@@ -76,13 +75,17 @@
 static void
 check_responses(const int fd)
 {
-	static long buf[8192 / sizeof(long)];
+	static union {
+		struct nlmsghdr hdr;
+		long buf[8192 / sizeof(long)];
+	} hdr_buf;
+
 	struct sockaddr_nl nladdr = {
 		.nl_family = AF_NETLINK
 	};
 	struct iovec iov = {
-		.iov_base = buf,
-		.iov_len = sizeof(buf)
+		.iov_base = hdr_buf.buf,
+		.iov_len = sizeof(hdr_buf.buf)
 	};
 	struct msghdr msg = {
 		.msg_name = (void *) &nladdr,
@@ -95,7 +98,7 @@
 	if (ret <= 0)
 		perror_msg_and_skip("recvmsg");
 
-	struct nlmsghdr *h = (struct nlmsghdr *) buf;
+	struct nlmsghdr *h = &hdr_buf.hdr;
 	if (!NLMSG_OK(h, ret))
 		error_msg_and_skip("!NLMSG_OK");
 	if (h->nlmsg_type == NLMSG_ERROR) {
diff --git a/tests/netlink_netlink_diag.c b/tests/netlink_netlink_diag.c
new file mode 100644
index 0000000..fc32822
--- /dev/null
+++ b/tests/netlink_netlink_diag.c
@@ -0,0 +1,147 @@
+/*
+ * This file is part of net-yy-netlink strace test.
+ *
+ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Fabien Siron <fabien.siron@epita.fr>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <linux/netlink.h>
+#include <linux/sock_diag.h>
+#include <linux/netlink_diag.h>
+
+#if !defined NETLINK_SOCK_DIAG && defined NETLINK_INET_DIAG
+# define NETLINK_SOCK_DIAG NETLINK_INET_DIAG
+#endif
+
+static void
+send_query(const int fd)
+{
+	struct sockaddr_nl nladdr = {
+		.nl_family = AF_NETLINK
+	};
+	struct {
+		struct nlmsghdr nlh;
+		struct netlink_diag_req ndr;
+	} req = {
+		.nlh = {
+			.nlmsg_len = sizeof(req),
+			.nlmsg_type = SOCK_DIAG_BY_FAMILY,
+			.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST
+		},
+		.ndr = {
+			.sdiag_family = AF_NETLINK,
+			.sdiag_protocol = NDIAG_PROTO_ALL,
+			.ndiag_show = NDIAG_SHOW_MEMINFO
+		}
+	};
+	struct iovec iov = {
+		.iov_base = &req,
+		.iov_len = sizeof(req)
+	};
+	struct msghdr msg = {
+		.msg_name = (void *) &nladdr,
+		.msg_namelen = sizeof(nladdr),
+		.msg_iov = &iov,
+		.msg_iovlen = 1
+	};
+
+	if (sendmsg(fd, &msg, 0) <= 0)
+		perror_msg_and_skip("sendmsg");
+}
+
+static void
+check_responses(const int fd)
+{
+	static union {
+		struct nlmsghdr hdr;
+		long buf[8192 / sizeof(long)];
+	} hdr_buf;
+
+	struct sockaddr_nl nladdr = {
+		.nl_family = AF_NETLINK
+	};
+	struct iovec iov = {
+		.iov_base = hdr_buf.buf,
+		.iov_len = sizeof(hdr_buf.buf)
+	};
+	struct msghdr msg = {
+		.msg_name = (void *) &nladdr,
+		.msg_namelen = sizeof(nladdr),
+		.msg_iov = &iov,
+		.msg_iovlen = 1
+	};
+
+	ssize_t ret = recvmsg(fd, &msg, 0);
+	if (ret <= 0)
+		perror_msg_and_skip("recvmsg");
+
+	struct nlmsghdr *h = &hdr_buf.hdr;
+	if (!NLMSG_OK(h, ret))
+		error_msg_and_skip("!NLMSG_OK");
+	if (h->nlmsg_type == NLMSG_ERROR) {
+		const struct nlmsgerr *err = NLMSG_DATA(h);
+		if (h->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
+			error_msg_and_skip("NLMSG_ERROR");
+		errno = -err->error;
+		perror_msg_and_skip("NLMSG_ERROR");
+	}
+	if (h->nlmsg_type != SOCK_DIAG_BY_FAMILY)
+		error_msg_and_skip("unexpected nlmsg_type %u",
+				   (unsigned) h->nlmsg_type);
+
+	const struct netlink_diag_msg *diag = NLMSG_DATA(h);
+	if (h->nlmsg_len < NLMSG_LENGTH(sizeof(*diag)))
+		error_msg_and_skip("short response");
+}
+
+int main(void)
+{
+	struct sockaddr_nl addr;
+	socklen_t len = sizeof(addr);
+
+	memset(&addr, 0, sizeof(addr));
+	addr.nl_family = AF_NETLINK;
+
+	close(0);
+	close(1);
+
+	if (socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG))
+		perror_msg_and_skip("socket AF_NETLINK");
+	if (bind(0, (struct sockaddr *) &addr, len))
+		perror_msg_and_skip("bind");
+
+	if (socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG) != 1)
+		perror_msg_and_skip("socket AF_NETLINK");
+
+	send_query(1);
+	check_responses(1);
+	return 0;
+}
diff --git a/tests/netlink_unix_diag.c b/tests/netlink_unix_diag.c
index e5ef6fa..b91cbbb 100644
--- a/tests/netlink_unix_diag.c
+++ b/tests/netlink_unix_diag.c
@@ -83,13 +83,17 @@
 static void
 check_responses(const int fd)
 {
-	static long buf[8192 / sizeof(long)];
+	static union {
+		struct nlmsghdr hdr;
+		long buf[8192 / sizeof(long)];
+	} hdr_buf;
+
 	struct sockaddr_nl nladdr = {
 		.nl_family = AF_NETLINK
 	};
 	struct iovec iov = {
-		.iov_base = buf,
-		.iov_len = sizeof(buf)
+		.iov_base = hdr_buf.buf,
+		.iov_len = sizeof(hdr_buf.buf)
 	};
 	struct msghdr msg = {
 		.msg_name = (void *) &nladdr,
@@ -102,7 +106,7 @@
 	if (ret <= 0)
 		perror_msg_and_skip("recvmsg");
 
-	struct nlmsghdr *h = (struct nlmsghdr *) buf;
+	struct nlmsghdr *h = &hdr_buf.hdr;
 	if (!NLMSG_OK(h, ret))
 		error_msg_and_skip("!NLMSG_OK");
 	if (h->nlmsg_type == NLMSG_ERROR) {
diff --git a/tests/nsyscalls.c b/tests/nsyscalls.c
new file mode 100644
index 0000000..25f0719
--- /dev/null
+++ b/tests/nsyscalls.c
@@ -0,0 +1,86 @@
+/*
+ * Check decoding of out-of-range syscalls.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+#include "syscall.h"
+
+#define TD 0
+#define TF 0
+#define TI 0
+#define TN 0
+#define TP 0
+#define TS 0
+#define TM 0
+#define NF 0
+#define MA 0
+#define SI 0
+#define SE 0
+#define SEN(arg) 0,0
+
+static const struct_sysent syscallent[] = {
+#include "syscallent.h"
+};
+
+#include <sys/syscall.h>
+
+#if defined __X32_SYSCALL_BIT && defined __NR_read \
+ && (__X32_SYSCALL_BIT & __NR_read) != 0
+# define SYSCALL_BIT __X32_SYSCALL_BIT
+#else
+# define SYSCALL_BIT 0
+#endif
+
+static const unsigned long nr = ARRAY_SIZE(syscallent) | SYSCALL_BIT;
+
+int
+main(void)
+{
+	static const unsigned long a[] = {
+		(unsigned long) 0xface0fedbadc0ded,
+		(unsigned long) 0xface1fedbadc1ded,
+		(unsigned long) 0xface2fedbadc2ded,
+		(unsigned long) 0xface3fedbadc3ded,
+		(unsigned long) 0xface4fedbadc4ded,
+		(unsigned long) 0xface5fedbadc5ded
+	};
+
+	long rc = syscall(nr, a[0], a[1], a[2], a[3], a[4], a[5]);
+#ifdef LINUX_MIPSO32
+	printf("syscall(%#lx, %#lx, %#lx, %#lx, %#lx, %#lx, %#lx)"
+	       " = %ld ENOSYS (%m)\n", nr,
+	       a[0], a[1], a[2], a[3], a[4], a[5], rc);
+#else
+	printf("syscall_%lu(%#lx, %#lx, %#lx, %#lx, %#lx, %#lx)"
+	       " = %ld (errno %d)\n", nr & (~SYSCALL_BIT),
+	       a[0], a[1], a[2], a[3], a[4], a[5], rc, errno);
+#endif
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/nsyscalls.test b/tests/nsyscalls.test
new file mode 100755
index 0000000..3760831
--- /dev/null
+++ b/tests/nsyscalls.test
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Check decoding of out-of-range syscalls.
+
+. "${srcdir=.}/init.sh"
+
+case "$STRACE_ARCH" in
+	mips) syscall=syscall ;;
+	*) syscall=none ;;
+esac
+
+run_strace_match_diff -e trace=$syscall
diff --git a/tests/old_mmap.c b/tests/old_mmap.c
new file mode 100644
index 0000000..97051db
--- /dev/null
+++ b/tests/old_mmap.c
@@ -0,0 +1,102 @@
+/*
+ * Check decoding of "old mmap" edition of mmap syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+/*
+ * On s390x, this is the mmap syscall used by glibc, so,
+ * from one side, it's already covered by another test, and, from another side,
+ * it would require additional efforts to filter out mmap calls made by glibc.
+ */
+
+#if defined __NR_mmap && \
+(   defined __arm__ \
+ || defined __i386__ \
+ || defined __m68k__ \
+ || (defined __s390__ && !defined __s390x__) \
+)
+
+# include <stdio.h>
+# include <string.h>
+# include <sys/mman.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	long rc = syscall(__NR_mmap, 0);
+	printf("mmap(NULL) = %ld %s (%m)\n", rc, errno2name());
+
+	const unsigned int args1_c[6] = {
+		0xdeadbeef,		/* addr */
+		0xfacefeed,		/* len */
+		PROT_READ|PROT_EXEC,	/* prot */
+		MAP_FILE|MAP_FIXED,	/* flags */
+		-2U,			/* fd */
+		0xbadc0ded		/* offset */
+	};
+	const unsigned int page_size = get_page_size();
+	const unsigned int args2_c[6] = {
+		0,
+		page_size,
+		PROT_READ|PROT_WRITE,
+		MAP_PRIVATE|MAP_ANONYMOUS,
+		-1U,
+		0xfaced000 & -page_size
+	};
+	void *args = tail_memdup(args1_c, sizeof(args1_c));
+
+	rc = syscall(__NR_mmap, args);
+	printf("mmap(%#x, %u, PROT_READ|PROT_EXEC, MAP_FILE|MAP_FIXED"
+	       ", %d, %#x) = %ld %s (%m)\n",
+	       args1_c[0], args1_c[1], args1_c[4], args1_c[5],
+	       rc, errno2name());
+
+	memcpy(args, args2_c, sizeof(args2_c));
+	rc = syscall(__NR_mmap, args);
+	printf("mmap(NULL, %u, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS"
+	       ", %d, %#x) = %#lx\n",
+	       args2_c[1], args2_c[4], args2_c[5], rc);
+
+	void *addr = (void *) rc;
+	if (mprotect(addr, page_size, PROT_NONE))
+		perror_msg_and_fail("mprotect(%p, %u, PROT_NONE)",
+				    addr, page_size);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_mmap && (__arm__ || __i386__ || __m68k__"
+		    " || (__s390__ && !__s390x__))")
+
+#endif
diff --git a/tests/old_mmap.test b/tests/old_mmap.test
new file mode 100755
index 0000000..af776ff
--- /dev/null
+++ b/tests/old_mmap.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of "old mmap" edition of mmap syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a11 -e trace=mmap
diff --git a/tests/open.c b/tests/open.c
index c990cd0..726b1ec 100644
--- a/tests/open.c
+++ b/tests/open.c
@@ -30,7 +30,6 @@
 
 #ifdef __NR_open
 
-# include <errno.h>
 # include <fcntl.h>
 # include <stdio.h>
 # include <unistd.h>
@@ -42,10 +41,8 @@
 	int fd = syscall(__NR_open, sample, O_RDONLY|O_CREAT, 0400);
 
 	if (fd < 0) {
-		if (errno != ENOSYS)
-			perror_msg_and_fail("open");
 		printf("open(\"%s\", O_RDONLY|O_CREAT, 0400)"
-		       " = %d ENOSYS (%m)\n", sample, fd);
+		       " = %d %s (%m)\n", sample, fd, errno2name());
 	} else {
 		printf("open(\"%s\", O_RDONLY|O_CREAT, 0400) = %d\n",
 		       sample, fd);
@@ -54,16 +51,12 @@
 			perror_msg_and_fail("unlink");
 
 		fd = syscall(__NR_open, sample, O_RDONLY);
-		if (fd >= 0 || errno != ENOENT)
-			perror_msg_and_fail("open");
-		printf("open(\"%s\", O_RDONLY) = %d ENOENT (%m)\n",
-		       sample, fd);
+		printf("open(\"%s\", O_RDONLY) = %d %s (%m)\n",
+		       sample, fd, errno2name());
 
 		fd = syscall(__NR_open, sample, O_WRONLY|O_NONBLOCK|0x80000000);
-		if (fd >= 0 || errno != ENOENT)
-			perror_msg_and_fail("open");
 		printf("open(\"%s\", O_WRONLY|O_NONBLOCK|0x80000000)"
-		       " = %d ENOENT (%m)\n", sample, fd);
+		       " = %d %s (%m)\n", sample, fd, errno2name());
 	}
 
 	puts("+++ exited with 0 +++");
diff --git a/tests/openat.c b/tests/openat.c
index f769f6e..a3de1dd 100644
--- a/tests/openat.c
+++ b/tests/openat.c
@@ -33,35 +33,25 @@
 # include <fcntl.h>
 # include <stdio.h>
 # include <unistd.h>
-# include <errno.h>
 
 int
 main(void)
 {
 	static const char sample[] = "openat.sample";
-	int fd;
-
-	fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400);
+	int fd = syscall(__NR_openat, -100, sample, O_RDONLY|O_CREAT, 0400);
 	if (fd == -1) {
-		if (errno == ENOSYS) {
-			printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT"
-		               ", 0400) = -1 ENOSYS (%m)\n", sample);
-		} else {
-			perror_msg_and_fail("openat");
-		}
+		printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400)"
+		       " = -1 %s (%m)\n", sample, errno2name());
 	} else {
-		printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT"
-		       ", 0400) = %d\n", sample, fd);
+		printf("openat(AT_FDCWD, \"%s\", O_RDONLY|O_CREAT, 0400)"
+		       " = %d\n", sample, fd);
 		close(fd);
 		if (unlink(sample) == -1)
 			perror_msg_and_fail("unlink");
+
 		fd = syscall(__NR_openat, -100, sample, O_RDONLY);
-		if (fd == -1 && errno == ENOENT) {
-			printf("openat(AT_FDCWD, \"%s\", O_RDONLY) = %d ENOENT"
-			       " (%m)\n", sample, fd);
-		} else {
-			perror_msg_and_fail("openat");
-		}
+		printf("openat(AT_FDCWD, \"%s\", O_RDONLY) = %d %s (%m)\n",
+		       sample, fd, errno2name());
 	}
 
 	puts("+++ exited with 0 +++");
diff --git a/tests/uid32.c b/tests/overflowuid.c
similarity index 60%
copy from tests/uid32.c
copy to tests/overflowuid.c
index 9c30d92..d9d9e37 100644
--- a/tests/uid32.c
+++ b/tests/overflowuid.c
@@ -26,43 +26,42 @@
  */
 
 #include "tests.h"
-#include <sys/syscall.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
-
-# include <assert.h>
-# include <stdlib.h>
-# include <unistd.h>
-
-int
-main(void)
+static void
+check_overflow_id(const int id, const char *overflowid)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	int fd = open(overflowid, O_RDONLY);
+	if (fd < 0) {
+		if (ENOENT == errno)
+			return;
+		perror_msg_and_fail("open: %s", overflowid);
+	}
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
-	return 0;
+	/* we trust the kernel */
+	char buf[sizeof(int)*3];
+	int n = read(fd, buf, sizeof(buf) - 1);
+	if (n > 0) {
+		buf[n] = '\0';
+		n = atoi(buf);
+		if (id == n)
+			error_msg_and_skip("%d matches %s", id, overflowid);
+	}
+
+	close(fd);
 }
 
-#else
+void
+check_overflowuid(const int uid)
+{
+	check_overflow_id(uid, "/proc/sys/kernel/overflowuid");
+}
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
-
-#endif
+void
+check_overflowgid(const int gid)
+{
+	check_overflow_id(gid, "/proc/sys/kernel/overflowgid");
+}
diff --git a/tests/uid32.c b/tests/pause.c
similarity index 61%
copy from tests/uid32.c
copy to tests/pause.c
index 9c30d92..6dadd15 100644
--- a/tests/uid32.c
+++ b/tests/pause.c
@@ -1,5 +1,8 @@
 /*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Check decoding of pause syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016 Fei Jie <feij.fnst@cn.fujitsu.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,41 +31,44 @@
 #include "tests.h"
 #include <sys/syscall.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
+#ifdef __NR_pause
 
-# include <assert.h>
-# include <stdlib.h>
+# include <signal.h>
+# include <stdio.h>
+# include <sys/time.h>
 # include <unistd.h>
 
+static void
+handler(int sig)
+{
+}
+
 int
 main(void)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	const struct sigaction act = { .sa_handler = handler };
+	if (sigaction(SIGALRM, &act, NULL))
+		perror_msg_and_fail("sigaction");
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
+	sigset_t mask;
+	sigemptyset(&mask);
+	sigaddset(&mask, SIGALRM);
+	if (sigprocmask(SIG_UNBLOCK, &mask, NULL))
+		perror_msg_and_fail("sigprocmask");
+
+	const struct itimerval itv = { .it_value.tv_usec = 123456 };
+	if (setitimer(ITIMER_REAL, &itv, NULL))
+		perror_msg_and_fail("setitimer");
+
+	pause();
+	printf("pause() = ? ERESTARTNOHAND (To be restarted if no handler)\n");
+
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
+SKIP_MAIN_UNDEFINED("__NR_pause")
 
 #endif
diff --git a/tests/pause.test b/tests/pause.test
new file mode 100755
index 0000000..c5fdacd
--- /dev/null
+++ b/tests/pause.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of pause syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a8 -esignal=none
diff --git a/tests/poll.c b/tests/poll.c
index 045aca0..551e9b4 100644
--- a/tests/poll.c
+++ b/tests/poll.c
@@ -91,16 +91,15 @@
 	for (i = 0; i < size; ++i) {
 		if (i)
 			tprintf(", ");
+		if (i >= valid) {
+			tprintf("%p", &pfd[i]);
+			break;
+		}
 		if (i >= abbrev) {
 			tprintf("...");
 			break;
 		}
-		if (i < valid)
-			print_pollfd_entering(&pfd[i]);
-		else {
-			tprintf("%p", &pfd[i]);
-			break;
-		}
+		print_pollfd_entering(&pfd[i]);
 	}
 	tprintf("]");
 }
@@ -185,7 +184,7 @@
 	int rc = syscall(__NR_poll, tail_fds0, 0, timeout);
 	assert(rc == 0);
 
-	tprintf("poll(%p, 0, %d) = %d (Timeout)\n", tail_fds0, timeout, rc);
+	tprintf("poll([], 0, %d) = %d (Timeout)\n", timeout, rc);
 
 	rc = syscall(__NR_poll, tail_fds0, ARRAY_SIZE(pfds0), timeout);
 	assert(rc == 3);
diff --git a/tests/poll.test b/tests/poll.test
index 1834c1f..b74be29 100755
--- a/tests/poll.test
+++ b/tests/poll.test
@@ -5,12 +5,12 @@
 . "${srcdir=.}/init.sh"
 
 run_prog > /dev/null
-run_strace -a18 -vepoll $args > "$OUT"
+run_strace -a16 -vepoll $args > "$OUT"
 match_diff "$LOG" "$OUT"
 
 for abbrev in 0 1 2 3 4 5; do
 	run_prog "./$NAME" $abbrev > /dev/null
-	run_strace -a18 -epoll -s$abbrev $args > "$OUT"
+	run_strace -a16 -epoll -s$abbrev $args > "$OUT"
 	match_diff "$LOG" "$OUT"
 done
 
diff --git a/tests/seccomp.c b/tests/prctl-seccomp-filter-v.c
similarity index 79%
rename from tests/seccomp.c
rename to tests/prctl-seccomp-filter-v.c
index f8d1370..a03f202 100644
--- a/tests/seccomp.c
+++ b/tests/prctl-seccomp-filter-v.c
@@ -1,4 +1,6 @@
 /*
+ * Check verbose decoding of prctl PR_SET_SECCOMP SECCOMP_MODE_FILTER.
+ *
  * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
@@ -51,29 +53,29 @@
  && defined BPF_STMT
 
 #define SOCK_FILTER_ALLOW_SYSCALL(nr) \
-		BPF_JUMP(BPF_JMP | BPF_K | BPF_JEQ, __NR_ ## nr, 0, 1), \
-		BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW)
+		BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \
+		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW)
 
 #define SOCK_FILTER_DENY_SYSCALL(nr, err) \
-		BPF_JUMP(BPF_JMP | BPF_K | BPF_JEQ, __NR_ ## nr, 0, 1), \
-		BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | (SECCOMP_RET_DATA & (err)))
+		BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \
+		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|(SECCOMP_RET_DATA & (err)))
 
 #define SOCK_FILTER_KILL_PROCESS \
-		BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL)
+		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)
 
 #define PRINT_ALLOW_SYSCALL(nr) \
-	printf("BPF_JUMP(BPF_JMP | BPF_K | BPF_JEQ, %#x, 0, 0x1), " \
-	       "BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), ", \
+	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
+	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
 	       __NR_ ## nr)
 
 #define PRINT_DENY_SYSCALL(nr, err) \
-	printf("BPF_JUMP(BPF_JMP | BPF_K | BPF_JEQ, %#x, 0, 0x1), " \
-	       "BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | %#x), ", \
+	printf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
+	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
 	       __NR_ ## nr, err)
 
 static const struct sock_filter filter[] = {
 	/* load syscall number */
-	BPF_STMT(BPF_LD | BPF_W | BPF_ABS, offsetof(struct seccomp_data, nr)),
+	BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)),
 
 	/* allow syscalls */
 	SOCK_FILTER_ALLOW_SYSCALL(close),
@@ -89,7 +91,7 @@
 };
 
 static const struct sock_fprog prog = {
-	.len = sizeof(filter) / sizeof(filter[0]),
+	.len = ARRAY_SIZE(filter),
 	.filter = (struct sock_filter *) filter,
 };
 
@@ -100,9 +102,10 @@
 
 	puts("prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)  = 0");
 
-	printf("prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, [");
+	printf("prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, {len=%u, filter=[",
+	       prog.len);
 
-	printf("BPF_STMT(BPF_LD | BPF_W | BPF_ABS, %#x), ",
+	printf("BPF_STMT(BPF_LD|BPF_W|BPF_ABS, %#x), ",
 	       (unsigned) offsetof(struct seccomp_data, nr));
 
 	PRINT_ALLOW_SYSCALL(close);
@@ -112,9 +115,9 @@
 	PRINT_DENY_SYSCALL(sync, EBUSY),
 	PRINT_DENY_SYSCALL(setsid, EPERM),
 
-	printf("BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL)");
+	printf("BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)");
 
-	puts("]) = 0");
+	puts("]}) = 0");
 	puts("+++ exited with 0 +++");
 
 	fflush(stdout);
diff --git a/tests/prctl-seccomp-filter-v.test b/tests/prctl-seccomp-filter-v.test
new file mode 100755
index 0000000..44e4a78
--- /dev/null
+++ b/tests/prctl-seccomp-filter-v.test
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Check verbose decoding of prctl PR_SET_SECCOMP SECCOMP_MODE_FILTER.
+
+. "${srcdir=.}/init.sh"
+
+check_prog grep
+run_prog > /dev/null
+run_strace -v -eprctl $args > "$EXP"
+grep -v '^prctl(PR_GET_' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+
+rm -f "$EXP" "$OUT"
diff --git a/tests/prctl-seccomp-strict.c b/tests/prctl-seccomp-strict.c
new file mode 100644
index 0000000..57387c9
--- /dev/null
+++ b/tests/prctl-seccomp-strict.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+#ifdef HAVE_PRCTL
+# include <sys/prctl.h>
+#endif
+
+#if defined HAVE_PRCTL && defined PR_SET_SECCOMP && defined __NR_exit
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char text1[] =
+		"prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT) = 0\n";
+	static const char text2[] = "+++ exited with 0 +++\n";
+
+	int rc = prctl(PR_SET_SECCOMP, -1L, 1, 2, 3);
+	printf("prctl(PR_SET_SECCOMP, %#lx /* SECCOMP_MODE_??? */, 0x1, 0x2, 0x3)"
+	       " = %d %s (%m)\n", -1L, rc, errno2name());
+	fflush(stdout);
+
+	rc = prctl(PR_SET_SECCOMP, 1);
+	if (rc) {
+		printf("prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT)"
+		       " = %d %s (%m)\n", rc, errno2name());
+		fflush(stdout);
+		rc = 0;
+	} else {
+		/*
+		 * If kernel implementaton of SECCOMP_MODE_STRICT is buggy,
+		 * the following syscall will result to SIGKILL.
+		 */
+		rc = write(1, text1, LENGTH_OF(text1)) != LENGTH_OF(text1);
+	}
+
+	rc += write(1, text2, LENGTH_OF(text2)) != LENGTH_OF(text2);
+	return !!syscall(__NR_exit, rc);
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("HAVE_PRCTL && PR_SET_SECCOMP && __NR_exit")
+
+#endif
diff --git a/tests/prctl-seccomp-strict.test b/tests/prctl-seccomp-strict.test
new file mode 100755
index 0000000..1f987df
--- /dev/null
+++ b/tests/prctl-seccomp-strict.test
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Check how prctl PR_SET_SECCOMP SECCOMP_MODE_STRICT is decoded.
+
+. "${srcdir=.}/init.sh"
+
+check_prog grep
+set -- "./$NAME"
+"$@" > /dev/null || {
+	case $? in
+		77) skip_ "$* exited with code 77" ;;
+		137) framework_skip_ "$* killed by SIGKILL, fix your kernel" ;;
+		*) fail_ "$args failed" ;;
+	esac
+}
+run_strace -eprctl "$@" > "$EXP"
+grep -v '^prctl(PR_GET_' < "$LOG" > "$OUT"
+match_diff "$OUT" "$EXP"
+rm -f "$EXP" "$OUT"
diff --git a/tests/pread64-pwrite64.c b/tests/pread64-pwrite64.c
index b1d45de..4a0932a 100644
--- a/tests/pread64-pwrite64.c
+++ b/tests/pread64-pwrite64.c
@@ -156,12 +156,11 @@
 		perror_msg_and_fail("pwrite64: expected 0, returned %ld", rc);
 	tprintf("pwrite64(1, \"\", 0, 0) = 0\n");
 
-	rc = pwrite(1, w, w_len + 1, 0);
+	rc = pwrite(1, efault, 1, 0);
 	if (rc != -1)
 		perror_msg_and_fail("pwrite64: expected -1 EFAULT"
 				    ", returned %ld", rc);
-	tprintf("pwrite64(1, %p, %u, 0) = -1 EFAULT (%m)\n",
-		w, w_len + 1);
+	tprintf("pwrite64(1, %p, 1, 0) = -1 EFAULT (%m)\n", efault);
 
 	rc = pwrite(1, nil, 1, -3);
 	if (rc != -1)
diff --git a/tests/preadv-pwritev.c b/tests/preadv-pwritev.c
index f86d071..38a0dd8 100644
--- a/tests/preadv-pwritev.c
+++ b/tests/preadv-pwritev.c
@@ -66,14 +66,12 @@
 	long rc;
 
 	rc = pwritev(1, efault, 42, 0);
-	if (rc != -1)
-		perror_msg_and_fail("pwritev: expected -1, returned %ld", rc);
-	tprintf("pwritev(1, %p, 42, 0) = -1 EFAULT (%m)\n", efault);
+	tprintf("pwritev(1, %p, 42, 0) = %ld %s (%m)\n",
+		efault, rc, errno2name());
 
 	rc = preadv(0, efault, 42, 0);
-	if (rc != -1)
-		perror_msg_and_fail("preadv: expected -1, returned %ld", rc);
-	tprintf("preadv(0, %p, 42, 0) = -1 EFAULT (%m)\n", efault);
+	tprintf("preadv(0, %p, 42, 0) = %ld %s (%m)\n",
+		efault, rc, errno2name());
 
 	static const char r0_c[] = "01234567";
 	const char *r0_d = hexdump_strdup(r0_c);
@@ -100,11 +98,9 @@
 	tprintf("pwritev(1, [], 0, 0) = 0\n");
 
 	rc = pwritev(1, w_iov + ARRAY_SIZE(w_iov_) - 1, 2, 0);
-	if (rc != -1)
-		perror_msg_and_fail("pwritev: expected -1 EFAULT, returned %ld",
-				    rc);
-	tprintf("pwritev(1, [{\"%s\", %u}, %p], 2, 0) = -1 EFAULT (%m)\n",
-		w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_));
+	tprintf("pwritev(1, [{\"%s\", %u}, %p], 2, 0) = %ld %s (%m)\n",
+		w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_),
+		rc, errno2name());
 
 	const unsigned int w_len =
 		LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c);
diff --git a/tests/preadv.c b/tests/preadv.c
index 0fabed2..f3d02e5 100644
--- a/tests/preadv.c
+++ b/tests/preadv.c
@@ -88,7 +88,7 @@
 		perror_msg_and_fail("preadv");
 	printf("preadv(0, NULL, 1, -2) = -1 EINVAL (%m)\n");
 
-	if (preadv(0, NULL, 0, -3) != -1)
+	if (preadv(0, iov, 0, -3) != -1)
 		perror_msg_and_fail("preadv");
 	printf("preadv(0, [], 0, -3) = -1 EINVAL (%m)\n");
 
diff --git a/tests/preadv2-pwritev2.c b/tests/preadv2-pwritev2.c
new file mode 100644
index 0000000..053e76c
--- /dev/null
+++ b/tests/preadv2-pwritev2.c
@@ -0,0 +1,211 @@
+/*
+ * Check decoding of preadv2 and pwritev2 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_preadv2 && defined __NR_pwritev2
+
+# include <errno.h>
+# include <fcntl.h>
+# include <stdio.h>
+# include <sys/uio.h>
+# include <unistd.h>
+
+static int
+pr(const int fd, const struct iovec *const vec,
+   const unsigned long vlen, const unsigned long pos)
+{
+	return syscall(__NR_preadv2, fd, vec, vlen, pos, 0L, 0L);
+}
+
+static int
+pw(const int fd, const struct iovec *const vec,
+   const unsigned long vlen, const unsigned long pos)
+{
+	return syscall(__NR_pwritev2, fd, vec, vlen, pos, 0L, 0L);
+}
+
+static void
+dumpio(void)
+{
+	static char tmp[] = "preadv2-pwritev2-tmpfile";
+	if (open(tmp, O_CREAT|O_RDONLY|O_TRUNC, 0600) != 0)
+		perror_msg_and_fail("creat: %s", tmp);
+	if (open(tmp, O_WRONLY) != 1)
+		perror_msg_and_fail("open: %s", tmp);
+	if (unlink(tmp))
+		perror_msg_and_fail("unlink: %s", tmp);
+
+	static const char w0_c[] = "012";
+	const char *w0_d = hexdump_strdup(w0_c);
+	void *w0 = tail_memdup(w0_c, LENGTH_OF(w0_c));
+
+	static const char w1_c[] = "34567";
+	const char *w1_d = hexdump_strdup(w1_c);
+	void *w1 = tail_memdup(w1_c, LENGTH_OF(w1_c));
+
+	static const char w2_c[] = "89abcde";
+	const char *w2_d = hexdump_strdup(w2_c);
+	void *w2 = tail_memdup(w2_c, LENGTH_OF(w2_c));
+
+	long rc;
+
+	static const char r0_c[] = "01234567";
+	const char *r0_d = hexdump_strdup(r0_c);
+	static const char r1_c[] = "89abcde";
+	const char *r1_d = hexdump_strdup(r1_c);
+
+	const struct iovec w_iov_[] = {
+		{
+			.iov_base = w0,
+			.iov_len = LENGTH_OF(w0_c)
+		}, {
+			.iov_base = w1,
+			.iov_len = LENGTH_OF(w1_c)
+		}, {
+			.iov_base = w2,
+			.iov_len = LENGTH_OF(w2_c)
+		}
+	};
+	const struct iovec *w_iov = tail_memdup(w_iov_, sizeof(w_iov_));
+
+	rc = pw(1, w_iov, 0, 0);
+	if (rc)
+		perror_msg_and_fail("pwritev2: expected 0, returned %ld", rc);
+	tprintf("pwritev2(1, [], 0, 0, 0) = 0\n");
+
+	rc = pw(1, w_iov + ARRAY_SIZE(w_iov_) - 1, 2, 0);
+	tprintf("pwritev2(1, [{\"%s\", %u}, %p], 2, 0, 0) = %ld %s (%m)\n",
+		w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_),
+		rc, errno2name());
+
+	const unsigned int w_len =
+		LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c);
+
+	rc = pw(1, w_iov, ARRAY_SIZE(w_iov_), 0);
+	if (rc != (int) w_len)
+		perror_msg_and_fail("pwritev2: expected %u, returned %ld",
+				    w_len, rc);
+	close(1);
+	tprintf("pwritev2(1, [{\"%s\", %u}, {\"%s\", %u}"
+		", {\"%s\", %u}], %u, 0, 0) = %u\n"
+		" * %u bytes in buffer 0\n"
+		" | 00000 %-49s  %-16s |\n"
+		" * %u bytes in buffer 1\n"
+		" | 00000 %-49s  %-16s |\n"
+		" * %u bytes in buffer 2\n"
+		" | 00000 %-49s  %-16s |\n",
+		w0_c, LENGTH_OF(w0_c), w1_c, LENGTH_OF(w1_c),
+		w2_c, LENGTH_OF(w2_c), ARRAY_SIZE(w_iov_), w_len,
+		LENGTH_OF(w0_c), w0_d, w0_c,
+		LENGTH_OF(w1_c), w1_d, w1_c, LENGTH_OF(w2_c), w2_d, w2_c);
+
+	const unsigned int r_len = (w_len + 1) / 2;
+	void *r0 = tail_alloc(r_len);
+	const struct iovec r0_iov_[] = {
+		{
+			.iov_base = r0,
+			.iov_len = r_len
+		}
+	};
+	const struct iovec *r_iov = tail_memdup(r0_iov_, sizeof(r0_iov_));
+
+	rc = pr(0, r_iov, ARRAY_SIZE(r0_iov_), 0);
+	if (rc != (int) r_len)
+		perror_msg_and_fail("preadv2: expected %u, returned %ld",
+				    r_len, rc);
+	tprintf("preadv2(0, [{\"%s\", %u}], %u, 0, 0) = %u\n"
+		" * %u bytes in buffer 0\n"
+		" | 00000 %-49s  %-16s |\n",
+		r0_c, r_len, ARRAY_SIZE(r0_iov_), r_len, r_len, r0_d, r0_c);
+
+	void *r1 = tail_alloc(r_len);
+	void *r2 = tail_alloc(w_len);
+	const struct iovec r1_iov_[] = {
+		{
+			.iov_base = r1,
+			.iov_len = r_len
+		},
+		{
+			.iov_base = r2,
+			.iov_len = w_len
+		}
+	};
+	r_iov = tail_memdup(r1_iov_, sizeof(r1_iov_));
+
+	rc = pr(0, r_iov, ARRAY_SIZE(r1_iov_), r_len);
+	if (rc != (int) w_len - r_len)
+		perror_msg_and_fail("preadv2: expected %d, returned %ld",
+				    (int) w_len - r_len, rc);
+	tprintf("preadv2(0, [{\"%s\", %u}, {\"\", %u}], %u, %u, 0) = %u\n"
+		" * %u bytes in buffer 0\n"
+		" | 00000 %-49s  %-16s |\n",
+		r1_c, r_len, w_len, ARRAY_SIZE(r1_iov_),
+		r_len, w_len - r_len,
+		w_len - r_len, r1_d, r1_c);
+	close(0);
+}
+
+int
+main(void)
+{
+	const unsigned long vlen = (unsigned long) 0xfac1fed2dad3bef4;
+	const unsigned long long pos = 0xfac5fed6dad7bef8;
+	const unsigned long pos_l = (unsigned long) pos;
+	const unsigned long pos_h = (sizeof(long) == sizeof(long long)) ?
+		(unsigned long) 0xbadc0deddeadbeef : 0xfac5fed6UL;
+	int test_dumpio = 1;
+
+	tprintf("%s", "");
+
+	syscall(__NR_preadv2, -1, NULL, vlen, pos_l, pos_h, 1);
+	if (ENOSYS == errno)
+		test_dumpio = 0;
+	tprintf("preadv2(-1, NULL, %lu, %lld, RWF_HIPRI) = -1 %s (%m)\n",
+	       vlen, pos, errno2name());
+
+	syscall(__NR_pwritev2, -1, NULL, vlen, pos_l, pos_h, 1);
+	if (ENOSYS == errno)
+		test_dumpio = 0;
+	tprintf("pwritev2(-1, NULL, %lu, %lld, RWF_HIPRI) = -1 %s (%m)\n",
+	       vlen, pos, errno2name());
+
+	if (test_dumpio)
+		dumpio();
+
+	tprintf("%s\n", "+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_preadv2 && __NR_pwritev2")
+
+#endif
diff --git a/tests/preadv2-pwritev2.test b/tests/preadv2-pwritev2.test
new file mode 100755
index 0000000..5641ef4
--- /dev/null
+++ b/tests/preadv2-pwritev2.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding and dumping of preadv2 and pwritev2 syscalls.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a22 -eread=0 -ewrite=1 -e trace=preadv2,pwritev2
diff --git a/tests/print_quoted_string.c b/tests/print_quoted_string.c
index 18a9ccf..3ad8602 100644
--- a/tests/print_quoted_string.c
+++ b/tests/print_quoted_string.c
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 /*
  * Based on string_quote() from util.c.
@@ -11,10 +12,17 @@
 void
 print_quoted_string(const char *instr)
 {
-	const unsigned char *str = (const unsigned char*) instr;
-	int c;
+	print_quoted_memory(instr, strlen(instr));
+}
 
-	while ((c = *(str++))) {
+void
+print_quoted_memory(const char *instr, const size_t len)
+{
+	const unsigned char *str = (const unsigned char*) instr;
+	size_t i;
+
+	for (i = 0; i < len; ++i) {
+		const int c = str[i];
 		switch (c) {
 			case '\"':
 				printf("\\\"");
diff --git a/tests/printflags.c b/tests/printflags.c
new file mode 100644
index 0000000..badc85d
--- /dev/null
+++ b/tests/printflags.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
+ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
+ * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
+ * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
+ * Copyright (c) 2005-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include "xlat.h"
+#include <stdio.h>
+
+int
+printflags(const struct xlat *xlat, unsigned long long flags,
+	   const char *const dflt)
+{
+	if (flags == 0 && xlat->val == 0 && xlat->str) {
+		fputs(xlat->str, stdout);
+		return 1;
+	}
+
+	int n;
+	char sep = 0;
+	for (n = 0; xlat->str; xlat++) {
+		if (xlat->val && (flags & xlat->val) == xlat->val) {
+			if (sep)
+				putc(sep, stdout);
+			else
+				sep = '|';
+			fputs(xlat->str, stdout);
+			flags &= ~xlat->val;
+			n++;
+		}
+	}
+
+	if (n) {
+		if (flags) {
+			if (sep)
+				putc(sep, stdout);
+			printf("%#llx", flags);
+			n++;
+		}
+	} else {
+		if (flags) {
+			printf("%#llx", flags);
+			if (dflt)
+				printf(" /* %s */", dflt);
+		} else {
+			if (dflt)
+				putc('0', stdout);
+		}
+	}
+
+	return n;
+}
diff --git a/tests/printxval.c b/tests/printxval.c
new file mode 100644
index 0000000..4fb61c8
--- /dev/null
+++ b/tests/printxval.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
+ * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
+ * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
+ * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
+ * Copyright (c) 2005-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include "xlat.h"
+#include <stdio.h>
+
+int
+printxval(const struct xlat *xlat, unsigned long long val,
+	  const char *const dflt)
+{
+	for (; xlat->str; xlat++) {
+		if (xlat->val == val) {
+			fputs(xlat->str, stdout);
+			return 1;
+		}
+	}
+
+	printf("%#llx", val);
+	if (dflt)
+		printf(" /* %s */", dflt);
+	return 0;
+}
diff --git a/tests/pselect6.c b/tests/pselect6.c
index 358f9c6..49258a9 100644
--- a/tests/pselect6.c
+++ b/tests/pselect6.c
@@ -137,8 +137,9 @@
 
 	tm.ts.tv_nsec = 222222222;
 	assert(pselect(0, NULL, NULL, NULL, &tm.ts, &mask) == -1);
-	puts("pselect6(0, NULL, NULL, NULL, {0, 222222222}, {[HUP CHLD], 8})"
-	     " = ? ERESTARTNOHAND (To be restarted if no handler)");
+	printf("pselect6(0, NULL, NULL, NULL, {0, 222222222}, {[HUP CHLD], %u})"
+	       " = ? ERESTARTNOHAND (To be restarted if no handler)\n",
+	       NSIG / 8);
 	puts("--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---");
 
 	puts("+++ exited with 0 +++");
diff --git a/tests/ptrace.c b/tests/ptrace.c
new file mode 100644
index 0000000..2fbefdd
--- /dev/null
+++ b/tests/ptrace.c
@@ -0,0 +1,477 @@
+/*
+ * Check decoding of ptrace syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_rt_sigprocmask
+
+# include <errno.h>
+# include <signal.h>
+# include <stdio.h>
+# include <string.h>
+# include <sys/wait.h>
+# include <unistd.h>
+# include "ptrace.h"
+# include <linux/audit.h>
+
+static long
+do_ptrace(unsigned long request, unsigned long pid,
+	  unsigned long addr, unsigned long data)
+{
+	return syscall(__NR_ptrace, request, pid, addr, data);
+}
+
+static void
+test_peeksiginfo(unsigned long pid, const unsigned long bad_request)
+{
+	long rc = do_ptrace(PTRACE_PEEKSIGINFO, pid, 0, bad_request);
+	printf("ptrace(PTRACE_PEEKSIGINFO, %u, NULL, %#lx)"
+	       " = %ld %s (%m)\n", (unsigned) pid, bad_request, rc, errno2name());
+
+	struct {
+		unsigned long long off;
+		unsigned int flags, nr;
+	} *const psi = tail_alloc(sizeof(*psi));
+
+	psi->off = 0xdeadbeeffacefeed;
+	psi->flags = 1;
+	psi->nr = 42;
+
+	rc = do_ptrace(PTRACE_PEEKSIGINFO,
+		       pid, (unsigned long) psi, bad_request);
+	printf("ptrace(PTRACE_PEEKSIGINFO, %u, {off=%llu"
+	       ", flags=PTRACE_PEEKSIGINFO_SHARED, nr=%u}, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, psi->off, psi->nr, bad_request, rc, errno2name());
+
+	pid = fork();
+	if (pid < 0)
+		perror_msg_and_fail("fork");
+
+	if (!pid) {
+		sigset_t mask;
+		sigemptyset(&mask);
+		sigaddset(&mask, SIGUSR1);
+		sigaddset(&mask, SIGUSR2);
+		sigaddset(&mask, SIGALRM);
+
+		if (sigprocmask(SIG_BLOCK, &mask, NULL))
+			perror_msg_and_fail("sigprocmask");
+
+		raise(SIGUSR1);
+		raise(SIGUSR2);
+		raise(SIGALRM);
+
+		if (do_ptrace(PTRACE_TRACEME, 0, 0, 0))
+			perror_msg_and_fail("child: PTRACE_TRACEME");
+
+		raise(SIGSTOP);
+		_exit(0);
+	}
+
+	const unsigned int nsigs = 4;
+	const uid_t uid = geteuid();
+	siginfo_t *sigs = tail_alloc(sizeof(*sigs) * nsigs);
+
+	psi->off = 0;
+	psi->flags = 0;
+	psi->nr = nsigs;
+
+	for (;;) {
+		int status, tracee, saved;
+
+		errno = 0;
+		tracee = wait(&status);
+		if (tracee <= 0) {
+			if (errno == EINTR)
+				continue;
+			saved = errno;
+			kill (pid, SIGKILL);
+			errno = saved;
+			perror_msg_and_fail("wait");
+		}
+		if (WIFEXITED(status)) {
+			if (WEXITSTATUS(status) == 0)
+				break;
+			error_msg_and_fail("unexpected exit status %u",
+					   WEXITSTATUS(status));
+		}
+		if (WIFSIGNALED(status))
+			error_msg_and_fail("unexpected signal %u",
+					   WTERMSIG(status));
+		if (!WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP) {
+			kill(pid, SIGKILL);
+			error_msg_and_fail("unexpected wait status %x",
+					   status);
+		}
+
+		rc = do_ptrace(PTRACE_PEEKSIGINFO, pid,
+			       (unsigned long) psi, (unsigned long) sigs);
+		if (rc < 0) {
+			printf("ptrace(PTRACE_PEEKSIGINFO, %u, {off=%llu"
+			       ", flags=0, nr=%u}, %p) = %ld %s (%m)\n",
+			       (unsigned) pid, psi->off, psi->nr, sigs,
+			       rc, errno2name());
+		} else {
+			printf("ptrace(PTRACE_PEEKSIGINFO, %u, {off=%llu"
+			       ", flags=0, nr=%u}"
+			       ", [{si_signo=SIGUSR1, si_code=SI_TKILL"
+			       ", si_pid=%u, si_uid=%u}"
+			       ", {si_signo=SIGUSR2, si_code=SI_TKILL"
+			       ", si_pid=%u, si_uid=%u}"
+			       ", {si_signo=SIGALRM, si_code=SI_TKILL"
+			       ", si_pid=%u, si_uid=%u}"
+			       "]) = %ld\n",
+			       (unsigned) pid, psi->off, psi->nr,
+			       (unsigned) pid, (unsigned) uid,
+			       (unsigned) pid, (unsigned) uid,
+			       (unsigned) pid, (unsigned) uid,
+			       rc);
+		}
+
+		if (do_ptrace(PTRACE_CONT, pid, 0, 0)) {
+			saved = errno;
+			kill (pid, SIGKILL);
+			errno = saved;
+			perror_msg_and_fail("ptrace");
+		}
+		printf("ptrace(PTRACE_CONT, %ld, NULL, SIG_0) = 0\n", pid);
+	}
+}
+
+int
+main(void)
+{
+	const unsigned long bad_request =
+		(unsigned long) 0xdeadbeeffffffeed;
+	const unsigned long bad_data =
+		(unsigned long) 0xdeadcafefffff00d;
+	const unsigned long pid =
+		(unsigned long) 0xdefaced00000000 | (unsigned) getpid();
+
+	unsigned int sigset_size;
+
+	for (sigset_size = 1024 / 8; sigset_size; sigset_size >>= 1) {
+		if (!syscall(__NR_rt_sigprocmask,
+			     SIG_SETMASK, NULL, NULL, sigset_size))
+			break;
+	}
+	if (!sigset_size)
+		perror_msg_and_fail("rt_sigprocmask");
+
+	void *const k_set = tail_alloc(sigset_size);
+	siginfo_t *const sip = tail_alloc(sizeof(*sip));
+
+	long rc = do_ptrace(bad_request, pid, 0, 0);
+	printf("ptrace(%#lx /* PTRACE_??? */, %u, NULL, NULL) = %ld %s (%m)\n",
+	       bad_request, (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_PEEKDATA, pid, bad_request, bad_data);
+# ifdef IA64
+	printf("ptrace(PTRACE_PEEKDATA, %u, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+# else
+	printf("ptrace(PTRACE_PEEKDATA, %u, %#lx, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, bad_data, rc, errno2name());
+#endif
+
+	rc = do_ptrace(PTRACE_PEEKTEXT, pid, bad_request, bad_data);
+# ifdef IA64
+	printf("ptrace(PTRACE_PEEKTEXT, %u, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+# else
+	printf("ptrace(PTRACE_PEEKTEXT, %u, %#lx, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, bad_data, rc, errno2name());
+#endif
+
+	rc = do_ptrace(PTRACE_PEEKUSER, pid, bad_request, bad_data);
+# ifdef IA64
+	printf("ptrace(PTRACE_PEEKUSER, %u, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+# else
+	printf("ptrace(PTRACE_PEEKUSER, %u, %#lx, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, bad_data, rc, errno2name());
+#endif
+
+	rc = do_ptrace(PTRACE_POKEUSER, pid, bad_request, bad_data);
+	printf("ptrace(PTRACE_POKEUSER, %u, %#lx, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, bad_data, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_ATTACH, pid, 0, 0);
+	printf("ptrace(PTRACE_ATTACH, %u) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_INTERRUPT, pid, 0, 0);
+	printf("ptrace(PTRACE_INTERRUPT, %u) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_KILL, pid, 0, 0);
+	printf("ptrace(PTRACE_KILL, %u) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_LISTEN, pid, 0, 0);
+	printf("ptrace(PTRACE_LISTEN, %u) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	sigset_t libc_set;
+	sigemptyset(&libc_set);
+	sigaddset(&libc_set, SIGUSR1);
+	memcpy(k_set, &libc_set, sigset_size);
+
+	rc = do_ptrace(PTRACE_SETSIGMASK,
+		       pid, sigset_size, (unsigned long) k_set);
+	printf("ptrace(PTRACE_SETSIGMASK, %u, %u, [USR1])"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, sigset_size, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_GETSIGMASK,
+		       pid, sigset_size, (unsigned long) k_set);
+	printf("ptrace(PTRACE_GETSIGMASK, %u, %u, %p)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, sigset_size, k_set, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_SECCOMP_GET_FILTER, pid, 42, 0);
+	printf("ptrace(PTRACE_SECCOMP_GET_FILTER, %u, 42, NULL)"
+	       " = %ld %s (%m)\n", (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_GETEVENTMSG, pid, bad_request, bad_data);
+	printf("ptrace(PTRACE_GETEVENTMSG, %u, %#lx, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, bad_data, rc, errno2name());
+
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGIO;
+	sip->si_code = 1;
+	sip->si_errno = ENOENT;
+	sip->si_band = -2;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGIO"
+	       ", si_code=POLL_IN, si_errno=ENOENT, si_band=-2})"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGTRAP;
+	sip->si_code = 1;
+	sip->si_errno = ENOENT;
+	sip->si_pid = 2;
+	sip->si_uid = 3;
+	sip->si_ptr = (void *) bad_request;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGTRAP"
+	       ", si_code=TRAP_BRKPT, si_errno=ENOENT, si_pid=2, si_uid=3"
+	       ", si_value={int=%d, ptr=%p}}) = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_int, sip->si_ptr, rc, errno2name());
+
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGILL;
+	sip->si_code = 1;
+	sip->si_errno = ENOENT;
+	sip->si_addr = (void *) (unsigned long) 0xfacefeeddeadbeef;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGILL"
+	       ", si_code=ILL_ILLOPC, si_errno=ENOENT, si_addr=%p})"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_addr, rc, errno2name());
+
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGFPE;
+	sip->si_code = 1;
+	sip->si_errno = ENOENT;
+	sip->si_addr = (void *) (unsigned long) 0xfacefeeddeadbeef;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGFPE"
+	       ", si_code=FPE_INTDIV, si_errno=ENOENT, si_addr=%p})"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_addr, rc, errno2name());
+
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGBUS;
+	sip->si_code = 1;
+	sip->si_errno = -2;
+	sip->si_addr = (void *) (unsigned long) 0xfacefeeddeadbeef;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGBUS"
+	       ", si_code=BUS_ADRALN, si_errno=%d, si_addr=%p})"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_errno, sip->si_addr,
+	       rc, errno2name());
+
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGPROF;
+	sip->si_code = 0xbadc0ded;
+	sip->si_errno = -2;
+	sip->si_pid = 0;
+	sip->si_uid = 3;
+	sip->si_ptr = 0;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGPROF"
+	       ", si_code=%#x, si_errno=%d, si_pid=0, si_uid=3})"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_code, sip->si_errno,
+	       rc, errno2name());
+
+#ifdef HAVE_SIGINFO_T_SI_SYSCALL
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGSYS;
+	sip->si_code = 1;
+	sip->si_errno = ENOENT;
+	sip->si_call_addr = (void *) (unsigned long) 0xfacefeeddeadbeef;
+	sip->si_syscall = -1U;
+	sip->si_arch = AUDIT_ARCH_X86_64;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGSYS"
+	       ", si_code=SYS_SECCOMP, si_errno=ENOENT, si_call_addr=%p"
+	       ", si_syscall=__NR_syscall_%u, si_arch=AUDIT_ARCH_X86_64})"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_call_addr, sip->si_syscall,
+	       rc, errno2name());
+#endif
+
+#if defined HAVE_SIGINFO_T_SI_TIMERID && defined HAVE_SIGINFO_T_SI_OVERRUN
+	memset(sip, -1, sizeof(*sip));
+	sip->si_signo = SIGHUP;
+	sip->si_code = SI_TIMER;
+	sip->si_errno = ENOENT;
+	sip->si_timerid = 0xdeadbeef;
+	sip->si_overrun = -1;
+	sip->si_ptr = (void *) (unsigned long) 0xfacefeeddeadbeef;
+
+	rc = do_ptrace(PTRACE_SETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_SETSIGINFO, %u, %#lx, {si_signo=SIGHUP"
+	       ", si_code=SI_TIMER, si_errno=ENOENT, si_timerid=%#x"
+	       ", si_overrun=%d, si_value={int=%d, ptr=%p}}) = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, sip->si_timerid, sip->si_overrun,
+	       sip->si_int, sip->si_ptr, rc, errno2name());
+#endif
+
+	rc = do_ptrace(PTRACE_GETSIGINFO,
+		       pid, bad_request, (unsigned long) sip);
+	printf("ptrace(PTRACE_GETSIGINFO, %u, %#lx, %p)"
+	       " = %ld %s (%m)\n", (unsigned) pid, bad_request, sip, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_CONT, pid, 0, SIGUSR1);
+	printf("ptrace(PTRACE_CONT, %u, NULL, SIGUSR1) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_DETACH, pid, 0, SIGUSR2);
+	printf("ptrace(PTRACE_DETACH, %u, NULL, SIGUSR2) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_SYSCALL, pid, 0, SIGUSR1);
+	printf("ptrace(PTRACE_SYSCALL, %u, NULL, SIGUSR1) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+#ifdef PTRACE_SINGLESTEP
+	rc = do_ptrace(PTRACE_SINGLESTEP, pid, 0, SIGUSR2);
+	printf("ptrace(PTRACE_SINGLESTEP, %u, NULL, SIGUSR2) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+#endif
+
+#ifdef PTRACE_SINGLEBLOCK
+	rc = do_ptrace(PTRACE_SINGLEBLOCK, pid, 0, SIGUSR1);
+	printf("ptrace(PTRACE_SINGLEBLOCK, %u, NULL, SIGUSR1) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+#endif
+
+#ifdef PTRACE_SYSEMU
+	rc = do_ptrace(PTRACE_SYSEMU, pid, 0, SIGUSR2);
+	printf("ptrace(PTRACE_SYSEMU, %u, NULL, SIGUSR2) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+#endif
+#ifdef PTRACE_SYSEMU_SINGLESTEP
+	rc = do_ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, SIGUSR1);
+	printf("ptrace(PTRACE_SYSEMU_SINGLESTEP, %u, NULL, SIGUSR1)"
+	       " = %ld %s (%m)\n", (unsigned) pid, rc, errno2name());
+#endif
+
+	rc = do_ptrace(PTRACE_SETOPTIONS,
+		       pid, 0, PTRACE_O_TRACEFORK|PTRACE_O_TRACECLONE);
+	printf("ptrace(PTRACE_SETOPTIONS, %u, NULL"
+	       ", PTRACE_O_TRACEFORK|PTRACE_O_TRACECLONE) = %ld %s (%m)\n",
+	       (unsigned) pid, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_SEIZE,
+		       pid, bad_request, PTRACE_O_TRACESYSGOOD);
+	printf("ptrace(PTRACE_SEIZE, %u, %#lx"
+	       ", PTRACE_O_TRACESYSGOOD) = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_SETREGSET, pid, 1, bad_request);
+	printf("ptrace(PTRACE_SETREGSET, %u, NT_PRSTATUS, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+
+	rc = do_ptrace(PTRACE_GETREGSET, pid, 3, bad_request);
+	printf("ptrace(PTRACE_GETREGSET, %u, NT_PRPSINFO, %#lx)"
+	       " = %ld %s (%m)\n",
+	       (unsigned) pid, bad_request, rc, errno2name());
+
+	test_peeksiginfo(pid, bad_request);
+
+	rc = do_ptrace(PTRACE_TRACEME, 0, 0, 0);
+	if (rc)
+		printf("ptrace(PTRACE_TRACEME) = %ld %s (%m)\n",
+		       rc, errno2name());
+	else
+		printf("ptrace(PTRACE_TRACEME) = 0\n");
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_rt_sigprocmask")
+
+#endif
diff --git a/tests/ptrace.test b/tests/ptrace.test
new file mode 100755
index 0000000..5add9be
--- /dev/null
+++ b/tests/ptrace.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of ptrace syscall.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a23 -e signal=none
diff --git a/tests/pwritev.c b/tests/pwritev.c
index 99b3018..ae05b7a 100644
--- a/tests/pwritev.c
+++ b/tests/pwritev.c
@@ -64,14 +64,14 @@
 	for (i = 0; i < cnt; ++i) {
 		if (i)
 			fputs(", ", stdout);
-		if (i == LIM) {
-			fputs("...", stdout);
-			break;
-		}
 		if (i == size) {
 			printf("%p", &iov[i]);
 			break;
 		}
+		if (i == LIM) {
+			fputs("...", stdout);
+			break;
+		}
 		print_iov(&iov[i]);
 	}
 	putchar(']');
@@ -95,9 +95,9 @@
 		iov[i].iov_base = &buf[i];
 		iov[i].iov_len = LEN - i;
 	}
-	tail_alloc(1);
 
 	const off_t offset = 0xdefaceddeadbeefLL;
+	long rc;
 	int written = 0;
 	for (i = 0; i < LEN; ++i) {
 		written += iov[i].iov_len;
@@ -111,32 +111,30 @@
 
 	for (i = 0; i <= LEN; ++i) {
 		unsigned int n = LEN + 1 - i;
-		if (pwritev(0, iov + i, n, offset + LEN + i) != -1)
-			perror_msg_and_fail("pwritev");
 		fputs("pwritev(0, ", stdout);
 		print_iovec(iov + i, n, LEN - i);
-		printf(", %u, %lld) = -1 EFAULT (%m)\n",
-		       n, (long long) offset + LEN + i);
+		rc = pwritev(0, iov + i, n, offset + LEN + i);
+		printf(", %u, %lld) = %ld %s (%m)\n",
+		       n, (long long) offset + LEN + i, rc, errno2name());
 	}
 
 	iov->iov_base = iov + LEN * 2;
-	if (pwritev(0, iov, 1, -1) != -1)
-		perror_msg_and_fail("pwritev");
-	printf("pwritev(0, [{%p, %d}], 1, -1) = -1 EINVAL (%m)\n",
-	       iov->iov_base, LEN);
+	rc = pwritev(0, iov, 1, -1);
+	printf("pwritev(0, [{%p, %d}], 1, -1) = %ld %s (%m)\n",
+	       iov->iov_base, LEN, rc, errno2name());
 
 	iov += LEN;
-	if (pwritev(0, iov, 42, -2) != -1)
-		perror_msg_and_fail("pwritev");
-	printf("pwritev(0, %p, 42, -2) = -1 EINVAL (%m)\n", iov);
+	rc = pwritev(0, iov, 42, -2);
+	printf("pwritev(0, %p, 42, -2) = %ld %s (%m)\n",
+	       iov, rc, errno2name());
 
-	if (pwritev(0, NULL, 1, -3) != -1)
-		perror_msg_and_fail("pwritev");
-	printf("pwritev(0, NULL, 1, -3) = -1 EINVAL (%m)\n");
+	rc = pwritev(0, NULL, 1, -3);
+	printf("pwritev(0, NULL, 1, -3) = %ld %s (%m)\n",
+	       rc, errno2name());
 
-	if (pwritev(0, NULL, 0, -4) != -1)
-		perror_msg_and_fail("pwritev");
-	printf("pwritev(0, [], 0, -4) = -1 EINVAL (%m)\n");
+	rc = pwritev(0, iov, 0, -4);
+	printf("pwritev(0, [], 0, -4) = %ld %s (%m)\n",
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/read-write.c b/tests/read-write.c
index 4efe147..4d1e730 100644
--- a/tests/read-write.c
+++ b/tests/read-write.c
@@ -152,12 +152,11 @@
 		perror_msg_and_fail("write: expected 0, returned %ld", rc);
 	tprintf("write(1, \"\", 0) = 0\n");
 
-	rc = write(1, w, w_len + 1);
+	rc = write(1, efault, 1);
 	if (rc != -1)
 		perror_msg_and_fail("write: expected -1 EFAULT"
 				    ", returned %ld", rc);
-	tprintf("write(1, %p, %u) = -1 EFAULT (%m)\n",
-		w, w_len + 1);
+	tprintf("write(1, %p, 1) = -1 EFAULT (%m)\n", efault);
 
 	rc = write(1, w, w_len);
 	if (rc != (int) w_len)
diff --git a/tests/readv.c b/tests/readv.c
index b0603c2..93eef67 100644
--- a/tests/readv.c
+++ b/tests/readv.c
@@ -58,12 +58,15 @@
 	static const char w2_c[] = "89abcde";
 	const char *w2_d = hexdump_strdup(w2_c);
 	void *w2 = tail_memdup(w2_c, LENGTH_OF(w2_c));
+	long rc;
 
-	assert(writev(1, efault, 42) == -1);
-	tprintf("writev(1, %p, 42) = -1 EFAULT (%m)\n", efault);
+	rc = writev(1, efault, 42);
+	tprintf("writev(1, %p, 42) = %ld %s (%m)\n",
+		efault, rc, errno2name());
 
-	assert(readv(0, efault, 42) == -1);
-	tprintf("readv(0, %p, 42) = -1 EFAULT (%m)\n", efault);
+	rc = readv(0, efault, 42);
+	tprintf("readv(0, %p, 42) = %ld %s (%m)\n",
+		efault, rc, errno2name());
 
 	static const char r0_c[] = "01234567";
 	const char *r0_d = hexdump_strdup(r0_c);
@@ -84,12 +87,13 @@
 	};
 	const struct iovec *w_iov = tail_memdup(w_iov_, sizeof(w_iov_));
 
-	assert(writev(1, w_iov, 0) == 0);
-	tprintf("writev(1, [], 0) = 0\n");
+	tprintf("writev(1, [], 0) = %ld\n",
+		(long) writev(1, w_iov, 0));
 
-	assert(writev(1, w_iov + ARRAY_SIZE(w_iov_) - 1, 2) == -1);
-	tprintf("writev(1, [{\"%s\", %u}, %p], 2) = -1 EFAULT (%m)\n",
-		w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_));
+	rc = writev(1, w_iov + ARRAY_SIZE(w_iov_) - 1, 2);
+	tprintf("writev(1, [{\"%s\", %u}, %p], 2) = %ld %s (%m)\n",
+		w2_c, LENGTH_OF(w2_c), w_iov + ARRAY_SIZE(w_iov_),
+		rc, errno2name());
 
 	const unsigned int w_len =
 		LENGTH_OF(w0_c) + LENGTH_OF(w1_c) + LENGTH_OF(w2_c);
diff --git a/tests/reboot.c b/tests/reboot.c
new file mode 100644
index 0000000..eedc2a6
--- /dev/null
+++ b/tests/reboot.c
@@ -0,0 +1,37 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_reboot
+
+# include <stdio.h>
+# include <linux/reboot.h>
+# include <unistd.h>
+
+# define INVALID_MAGIC 319887762
+# define INVALID_CMD 0x01234568
+
+int
+main(void)
+{
+	static const char buf[] = "reboot";
+	long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, \
+	          INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf);
+	printf("reboot(LINUX_REBOOT_MAGIC1, %#x /* LINUX_REBOOT_MAGIC_??? */,"
+	       " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %ld %s (%m)\n",
+	       INVALID_MAGIC, buf, rc, errno2name());
+
+	rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, \
+	     LINUX_REBOOT_MAGIC2, INVALID_CMD);
+	printf("reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,"
+	       " %#x /* LINUX_REBOOT_CMD_??? */) = %ld %s (%m)\n",
+	       INVALID_CMD, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_reboot")
+
+#endif
diff --git a/tests/reboot.test b/tests/reboot.test
new file mode 100755
index 0000000..a97dd21
--- /dev/null
+++ b/tests/reboot.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check reboot syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/uid32.c b/tests/remap_file_pages.c
similarity index 61%
copy from tests/uid32.c
copy to tests/remap_file_pages.c
index 9c30d92..8aa099e 100644
--- a/tests/uid32.c
+++ b/tests/remap_file_pages.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Check decoding of remap_file_pages syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,41 +30,32 @@
 #include "tests.h"
 #include <sys/syscall.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
+#ifdef __NR_remap_file_pages
 
-# include <assert.h>
-# include <stdlib.h>
+# include <stdio.h>
+# include <sys/mman.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef;
+	const unsigned long size = (unsigned long) 0xdefaced1bad2f00d;
+	const unsigned long prot = PROT_READ|PROT_WRITE|PROT_EXEC;
+	const unsigned long pgoff = (unsigned long) 0xcaf3babebad4deed;
+	const unsigned long flags = MAP_PRIVATE|MAP_ANONYMOUS;
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
+	long rc = syscall(__NR_remap_file_pages, addr, size, prot, pgoff, flags);
+	printf("remap_file_pages(%#lx, %lu, %s, %lu, %s) = %ld %s (%m)\n",
+	       addr, size, "PROT_READ|PROT_WRITE|PROT_EXEC", pgoff,
+	       "MAP_PRIVATE|MAP_ANONYMOUS", rc, errno2name());
+
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
+SKIP_MAIN_UNDEFINED("__NR_remap_file_pages")
 
 #endif
diff --git a/tests/remap_file_pages.test b/tests/remap_file_pages.test
new file mode 100755
index 0000000..9d51a9a
--- /dev/null
+++ b/tests/remap_file_pages.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check remap_file_pages syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/rename.c b/tests/rename.c
index 2fb88d6..a2a9209 100644
--- a/tests/rename.c
+++ b/tests/rename.c
@@ -1,5 +1,4 @@
 #include "tests.h"
-#include <errno.h>
 #include <sys/syscall.h>
 
 #ifdef __NR_rename
@@ -13,10 +12,9 @@
 int
 main(void)
 {
-	int rc = syscall(__NR_rename, OLD_FILE, NEW_FILE);
-	printf("rename(\"%s\", \"%s\") = %d %s (%m)\n",
-	       OLD_FILE, NEW_FILE, rc,
-	       errno == ENOSYS ? "ENOSYS" : "ENOENT");
+	long rc = syscall(__NR_rename, OLD_FILE, NEW_FILE);
+	printf("rename(\"%s\", \"%s\") = %ld %s (%m)\n",
+	       OLD_FILE, NEW_FILE, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/renameat.c b/tests/renameat.c
index f17e9b0..da38f23 100644
--- a/tests/renameat.c
+++ b/tests/renameat.c
@@ -1,5 +1,4 @@
 #include "tests.h"
-#include <errno.h>
 #include <sys/syscall.h>
 
 #ifdef __NR_renameat
@@ -15,10 +14,11 @@
 {
 	const long int fd_old = (long int) 0xdeadbeefffffffff;
 	const long int fd_new = (long int) 0xdeadbeeffffffffe;
-	int rc = syscall(__NR_renameat, fd_old, OLD_FILE, fd_new, NEW_FILE);
-	printf("renameat(%d, \"%s\", %d, \"%s\") = %d %s (%m)\n",
-	       (int) fd_old, OLD_FILE, (int) fd_new, NEW_FILE, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	long rc = syscall(__NR_renameat, fd_old, OLD_FILE, fd_new, NEW_FILE);
+	printf("renameat(%d, \"%s\", %d, \"%s\") = %ld %s (%m)\n",
+	       (int) fd_old, OLD_FILE, (int) fd_new, NEW_FILE,
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/uid32.c b/tests/renameat2.c
similarity index 61%
copy from tests/uid32.c
copy to tests/renameat2.c
index 9c30d92..28a1b5b 100644
--- a/tests/uid32.c
+++ b/tests/renameat2.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Check decoding of renameat2 syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,41 +30,33 @@
 #include "tests.h"
 #include <sys/syscall.h>
 
-#if defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32)
+#ifdef __NR_renameat2
 
-# include <assert.h>
-# include <stdlib.h>
+# include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	int r, e, s;
-	int size;
-	int *list = 0;
+	static const char oldpath[] = "renameat2_oldpath";
+	static const char newpath[] = "renameat2_newpath";
+	const unsigned long olddirfd =
+		(unsigned long) 0xfacefeedffffffff;
+	const unsigned long newdirfd =
+		(unsigned long) 0xfacefeed00000000 | -100U;
 
-	r = syscall(__NR_getuid32);
-	assert(syscall(__NR_setuid32, r) == 0);
-	assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
-	assert(syscall(__NR_setreuid32, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
-	assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups32, size, list) == size);
+	long rc = syscall(__NR_renameat2,
+			  olddirfd, oldpath, newdirfd, newpath, 1);
+	printf("renameat2(%d, \"%s\", AT_FDCWD, \"%s\", RENAME_NOREPLACE)"
+	       " = %ld %s (%m)\n",
+	       (int) olddirfd, oldpath, newpath, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
+SKIP_MAIN_UNDEFINED("__NR_renameat2")
 
 #endif
diff --git a/tests/renameat2.test b/tests/renameat2.test
new file mode 100755
index 0000000..4c176bb
--- /dev/null
+++ b/tests/renameat2.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check renameat2 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/rmdir.c b/tests/rmdir.c
new file mode 100644
index 0000000..e5a7f1d
--- /dev/null
+++ b/tests/rmdir.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_rmdir
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "rmdir_sample";
+	long rc = syscall(__NR_rmdir, sample);
+	printf("rmdir(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_rmdir")
+
+#endif
diff --git a/tests/rmdir.test b/tests/rmdir.test
new file mode 100755
index 0000000..81ee66b
--- /dev/null
+++ b/tests/rmdir.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check rmdir syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a22
diff --git a/tests/rt_sigpending.c b/tests/rt_sigpending.c
index 16dfa7e..a6381cd 100644
--- a/tests/rt_sigpending.c
+++ b/tests/rt_sigpending.c
@@ -48,8 +48,11 @@
 iterate(const char *const text, unsigned int size, void *set)
 {
 	for (;;) {
-		if (k_sigpending(set, size))
-			perror_msg_and_fail("rt_sigpending");
+		if (k_sigpending(set, size)) {
+			tprintf("rt_sigpending(%p, %u) = -1 EFAULT (%m)\n",
+				set, size);
+			break;
+		}
 		if (size) {
 #if WORDS_BIGENDIAN
 			if (size < sizeof(long))
diff --git a/tests/rt_sigsuspend.c b/tests/rt_sigsuspend.c
index 07a50e0..b96a8c9 100644
--- a/tests/rt_sigsuspend.c
+++ b/tests/rt_sigsuspend.c
@@ -48,11 +48,13 @@
 
 static void
 iterate(const char *const text, const int sig,
-	const void *set, unsigned int size)
+	const void *const set, unsigned int size)
 {
-	for (;;) {
+	const void *mask;
+
+	for (mask = set;; size >>= 1, mask += size) {
 		raise(sig);
-		assert(k_sigsuspend(set, size) == -1);
+		assert(k_sigsuspend(mask, size) == -1);
 		if (EINTR == errno) {
 			tprintf("rt_sigsuspend(%s, %u) = ? ERESTARTNOHAND"
 				" (To be restarted if no handler)\n",
@@ -61,16 +63,14 @@
 			if (size < sizeof(long))
 				tprintf("rt_sigsuspend(%p, %u)"
 					" = -1 EINVAL (%m)\n",
-					set, size);
+					mask, size);
 			else
 				tprintf("rt_sigsuspend(%s, %u)"
 					" = -1 EINVAL (%m)\n",
-					text, size);
+					set == mask ? text : "~[]", size);
 		}
 		if (!size)
 			break;
-		size >>= 1;
-		set += size;
 	}
 }
 
diff --git a/tests/rt_tgsigqueueinfo.c b/tests/rt_tgsigqueueinfo.c
index ff33f40..0926fb1 100644
--- a/tests/rt_tgsigqueueinfo.c
+++ b/tests/rt_tgsigqueueinfo.c
@@ -32,7 +32,6 @@
 
 #ifdef __NR_rt_tgsigqueueinfo
 
-# include <assert.h>
 # include <errno.h>
 # include <signal.h>
 # include <stdio.h>
diff --git a/tests/sched_rr_get_interval.c b/tests/sched_rr_get_interval.c
new file mode 100644
index 0000000..dd069e2
--- /dev/null
+++ b/tests/sched_rr_get_interval.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_sched_rr_get_interval
+
+# include <stdio.h>
+# include <sched.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	struct timespec *const tp = tail_alloc(sizeof(struct timespec));
+	long rc = syscall(__NR_sched_rr_get_interval, -1, tp);
+	printf("sched_rr_get_interval(-1, %p) = %ld %s (%m)\n",
+	       tp, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sched_rr_get_interval")
+
+#endif
diff --git a/tests/sched_rr_get_interval.test b/tests/sched_rr_get_interval.test
new file mode 100755
index 0000000..828ba5d
--- /dev/null
+++ b/tests/sched_rr_get_interval.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check sched_rr_get_interval syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a31
diff --git a/tests/sched_xetparam.c b/tests/sched_xetparam.c
index d968a2c..cb30818 100644
--- a/tests/sched_xetparam.c
+++ b/tests/sched_xetparam.c
@@ -3,7 +3,6 @@
 
 #if defined __NR_sched_getparam && defined __NR_sched_setparam
 
-# include <errno.h>
 # include <sched.h>
 # include <stdio.h>
 # include <unistd.h>
@@ -11,16 +10,17 @@
 int
 main(void)
 {
-	struct sched_param *const param = tail_alloc(sizeof(struct sched_param));
-	int rc = syscall(__NR_sched_getparam, 0, param);
-	printf("sched_getparam(0, [%d]) = %d\n",
+	struct sched_param *const param =
+		tail_alloc(sizeof(struct sched_param));
+
+	long rc = syscall(__NR_sched_getparam, 0, param);
+	printf("sched_getparam(0, [%d]) = %ld\n",
 	       param->sched_priority, rc);
 
 	param->sched_priority = -1;
 	rc = syscall(__NR_sched_setparam, 0, param);
-	printf("sched_setparam(0, [%d]) = %d %s (%m)\n",
-	       param->sched_priority, rc,
-	       errno == EPERM ? "EPERM" : "EINVAL");
+	printf("sched_setparam(0, [%d]) = %ld %s (%m)\n",
+	       param->sched_priority, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/sched_xetscheduler.c b/tests/sched_xetscheduler.c
index dbf3c1f..f86adfa 100644
--- a/tests/sched_xetscheduler.c
+++ b/tests/sched_xetscheduler.c
@@ -3,7 +3,6 @@
 
 #if defined __NR_sched_getscheduler && defined __NR_sched_setscheduler
 
-# include <errno.h>
 # include <sched.h>
 # include <stdio.h>
 # include <unistd.h>
@@ -12,7 +11,7 @@
 main(void)
 {
 	struct sched_param *const param = tail_alloc(sizeof(struct sched_param));
-	int rc = syscall(__NR_sched_getscheduler, 0);
+	long rc = syscall(__NR_sched_getscheduler, 0);
 	const char *scheduler;
 	switch (rc) {
 		case SCHED_FIFO:
@@ -44,14 +43,13 @@
 		default:
 			scheduler = "SCHED_OTHER";
 	}
-	printf("sched_getscheduler(0) = %d (%s)\n",
+	printf("sched_getscheduler(0) = %ld (%s)\n",
 	       rc, scheduler);
 
 	param->sched_priority = -1;
 	rc = syscall(__NR_sched_setscheduler, 0, SCHED_FIFO, param);
-	printf("sched_setscheduler(0, SCHED_FIFO, [%d]) = %d %s (%m)\n",
-	       param->sched_priority, rc,
-	       errno == EPERM ? "EPERM" : "EINVAL");
+	printf("sched_setscheduler(0, SCHED_FIFO, [%d]) = %ld %s (%m)\n",
+	       param->sched_priority, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/sched_yield.c b/tests/sched_yield.c
new file mode 100644
index 0000000..ed25722
--- /dev/null
+++ b/tests/sched_yield.c
@@ -0,0 +1,22 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_sched_yield
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("sched_yield() = %ld\n", syscall(__NR_sched_yield));
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sched_yield")
+
+#endif
diff --git a/tests/sched_yield.test b/tests/sched_yield.test
new file mode 100755
index 0000000..f0c2c30
--- /dev/null
+++ b/tests/sched_yield.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check sched_yield syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14
diff --git a/tests/scm_rights.c b/tests/scm_rights.c
index 00af4d5..42caed7 100644
--- a/tests/scm_rights.c
+++ b/tests/scm_rights.c
@@ -27,7 +27,6 @@
 
 #include "tests.h"
 #include <assert.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tests/seccomp-filter-v.c b/tests/seccomp-filter-v.c
new file mode 100644
index 0000000..ef69c0d
--- /dev/null
+++ b/tests/seccomp-filter-v.c
@@ -0,0 +1,213 @@
+/*
+ * Check verbose decoding of seccomp SECCOMP_SET_MODE_FILTER.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#ifdef HAVE_PRCTL
+# include <sys/prctl.h>
+#endif
+#ifdef HAVE_LINUX_SECCOMP_H
+# include <linux/seccomp.h>
+#endif
+#ifdef HAVE_LINUX_FILTER_H
+# include <linux/filter.h>
+#endif
+
+#if defined __NR_seccomp \
+ && defined PR_SET_NO_NEW_PRIVS \
+ && defined SECCOMP_SET_MODE_FILTER \
+ && defined SECCOMP_RET_ERRNO \
+ && defined BPF_JUMP \
+ && defined BPF_STMT
+
+#define SOCK_FILTER_ALLOW_SYSCALL(nr) \
+		BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \
+		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW)
+
+#define SOCK_FILTER_DENY_SYSCALL(nr, err) \
+		BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, __NR_ ## nr, 0, 1), \
+		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|(SECCOMP_RET_DATA & (err)))
+
+#define SOCK_FILTER_KILL_PROCESS \
+		BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)
+
+#define PRINT_ALLOW_SYSCALL(nr) \
+	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
+	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), ", \
+	       __NR_ ## nr)
+
+#define PRINT_DENY_SYSCALL(nr, err) \
+	tprintf("BPF_JUMP(BPF_JMP|BPF_K|BPF_JEQ, %#x, 0, 0x1), " \
+	       "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|%#x), ", \
+	       __NR_ ## nr, err)
+
+static const struct sock_filter filter_c[] = {
+	/* load syscall number */
+	BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)),
+
+	/* allow syscalls */
+	SOCK_FILTER_ALLOW_SYSCALL(close),
+	SOCK_FILTER_ALLOW_SYSCALL(exit),
+	SOCK_FILTER_ALLOW_SYSCALL(exit_group),
+
+	/* deny syscalls */
+	SOCK_FILTER_DENY_SYSCALL(sync, EBUSY),
+	SOCK_FILTER_DENY_SYSCALL(setsid, EPERM),
+
+	/* kill process */
+	SOCK_FILTER_KILL_PROCESS
+};
+
+#ifndef BPF_MAXINSNS
+# define BPF_MAXINSNS 4096
+#endif
+
+int
+main(void)
+{
+	tprintf("%s", "");
+
+	static const char kill_stmt_txt[] =
+		"BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL)";
+	struct sock_filter *const filter =
+		tail_memdup(filter_c, sizeof(filter_c));
+	struct sock_filter *const big_filter =
+		tail_alloc(sizeof(*big_filter) * (BPF_MAXINSNS + 1));
+	struct sock_fprog *const prog = tail_alloc(sizeof(*prog));
+
+	int fds[2];
+	if (pipe(fds))
+		perror_msg_and_fail("pipe");
+	if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
+		perror_msg_and_skip("PR_SET_NO_NEW_PRIVS");
+
+	prog->filter = filter +  ARRAY_SIZE(filter_c);
+	prog->len = 1;
+	syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, 0, prog);
+	tprintf("seccomp(SECCOMP_SET_MODE_FILTER, 0, {len=1, filter=%p})"
+		" = -1 EFAULT (%m)\n", prog->filter);
+
+	prog->filter = filter +  ARRAY_SIZE(filter_c) - 1;
+	prog->len = 3;
+	syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, 0, prog);
+	tprintf("seccomp(SECCOMP_SET_MODE_FILTER, 0, {len=%u"
+		", filter=[%s, %p]}) = -1 EFAULT (%m)\n",
+		prog->len, kill_stmt_txt, filter +  ARRAY_SIZE(filter_c));
+
+	prog->len = 0;
+	syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, 0, prog);
+	tprintf("seccomp(SECCOMP_SET_MODE_FILTER, 0, {len=0, filter=[]})"
+		" = -1 EINVAL (%m)\n");
+
+	unsigned int i;
+	for (i = 0; i <= BPF_MAXINSNS; ++i) {
+		const struct sock_filter stmt =
+			BPF_STMT(BPF_CLASS(i), i << 16);
+		big_filter[i] = stmt;
+	}
+
+	prog->filter = big_filter;
+	prog->len = BPF_MAXINSNS + 1;
+	tprintf("seccomp(SECCOMP_SET_MODE_FILTER, %s, {len=%u, filter=[",
+		"SECCOMP_FILTER_FLAG_TSYNC|0xfffffffe", prog->len);
+	for (i = 0; i < BPF_MAXINSNS; ++i) {
+		if (i)
+			tprintf(", ");
+		switch(BPF_CLASS(i)) {
+		case BPF_LD:
+			tprintf("BPF_STMT(BPF_LD|BPF_W|BPF_IMM, %#x)", i << 16);
+			break;
+		case BPF_LDX:
+			tprintf("BPF_STMT(BPF_LDX|BPF_W|BPF_IMM, %#x)", i << 16);
+			break;
+		case BPF_ST:
+			tprintf("BPF_STMT(BPF_ST, %#x)", i << 16);
+			break;
+		case BPF_STX:
+			tprintf("BPF_STMT(BPF_STX, %#x)", i << 16);
+			break;
+		case BPF_ALU:
+			tprintf("BPF_STMT(BPF_ALU|BPF_K|BPF_ADD, %#x)", i << 16);
+			break;
+		case BPF_JMP:
+			tprintf("BPF_STMT(BPF_JMP|BPF_K|BPF_JA, %#x)", i << 16);
+			break;
+		case BPF_RET:
+			tprintf("BPF_STMT(BPF_RET|BPF_K, %#x"
+				" /* SECCOMP_RET_??? */)", i << 16);
+			break;
+		case BPF_MISC:
+			tprintf("BPF_STMT(BPF_MISC|BPF_TAX, %#x)", i << 16);
+			break;
+		}
+	}
+	tprintf(", ...]})");
+	syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -1, prog);
+	tprintf(" = -1 EINVAL (%m)\n");
+
+	prog->filter = filter;
+	prog->len = ARRAY_SIZE(filter_c);
+
+	tprintf("seccomp(SECCOMP_SET_MODE_FILTER, 0, {len=%u, filter=[",
+		prog->len);
+
+	tprintf("BPF_STMT(BPF_LD|BPF_W|BPF_ABS, %#x), ",
+	       (unsigned) offsetof(struct seccomp_data, nr));
+
+	PRINT_ALLOW_SYSCALL(close);
+	PRINT_ALLOW_SYSCALL(exit);
+	PRINT_ALLOW_SYSCALL(exit_group);
+
+	PRINT_DENY_SYSCALL(sync, EBUSY),
+	PRINT_DENY_SYSCALL(setsid, EPERM),
+
+	tprintf("%s]}) = 0\n+++ exited with 0 +++\n", kill_stmt_txt);
+
+	if (syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, 0, prog))
+		perror_msg_and_skip("SECCOMP_SET_MODE_FILTER");
+
+	if (close(0) || close(1))
+		_exit(77);
+
+	_exit(0);
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_seccomp && PR_SET_NO_NEW_PRIVS"
+		    " && SECCOMP_SET_MODE_FILTER && SECCOMP_RET_ERRNO"
+		    " && BPF_JUMP && BPF_STMT")
+
+#endif
diff --git a/tests/seccomp-filter-v.test b/tests/seccomp-filter-v.test
new file mode 100755
index 0000000..f873eb6
--- /dev/null
+++ b/tests/seccomp-filter-v.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check verbose decoding of seccomp SECCOMP_SET_MODE_FILTER.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -v -e trace=seccomp
diff --git a/tests/seccomp-filter.c b/tests/seccomp-filter.c
new file mode 100644
index 0000000..0326f6e
--- /dev/null
+++ b/tests/seccomp-filter.c
@@ -0,0 +1,75 @@
+/*
+ * Check decoding of seccomp SECCOMP_SET_MODE_FILTER.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+
+#include <stdio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#ifdef HAVE_LINUX_SECCOMP_H
+# include <linux/seccomp.h>
+#endif
+#ifdef HAVE_LINUX_FILTER_H
+# include <linux/filter.h>
+#endif
+
+#if defined __NR_seccomp && defined SECCOMP_SET_MODE_FILTER
+
+# define N 7
+
+int
+main(void)
+{
+	struct sock_filter *const filter = tail_alloc(sizeof(*filter) * N);
+	const void *const efault = tail_alloc(1);
+	struct sock_fprog *const prog = tail_alloc(sizeof(*prog));
+	long rc;
+
+	prog->filter = filter;
+	prog->len = N;
+	rc = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -1, prog);
+	printf("seccomp(SECCOMP_SET_MODE_FILTER, %s, {len=%u, filter=%p})"
+	       " = %ld %s (%m)\n", "SECCOMP_FILTER_FLAG_TSYNC|0xfffffffe",
+	       prog->len, prog->filter, rc, errno2name());
+
+	rc = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER, -2L, efault);
+	printf("seccomp(SECCOMP_SET_MODE_FILTER, %s, %p) = %ld %s (%m)\n",
+	       "0xfffffffe /* SECCOMP_FILTER_FLAG_??? */",
+	       efault, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_seccomp && SECCOMP_SET_MODE_FILTER")
+
+#endif
diff --git a/tests/seccomp-filter.test b/tests/seccomp-filter.test
new file mode 100755
index 0000000..65c6d49
--- /dev/null
+++ b/tests/seccomp-filter.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check decoding of seccomp SECCOMP_SET_MODE_FILTER.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -e trace=seccomp
diff --git a/tests/seccomp-strict.c b/tests/seccomp-strict.c
new file mode 100644
index 0000000..c145567
--- /dev/null
+++ b/tests/seccomp-strict.c
@@ -0,0 +1,74 @@
+/*
+ * Check how seccomp SECCOMP_SET_MODE_STRICT is decoded.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_seccomp && defined __NR_exit
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char text1[] =
+		"seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL) = 0\n";
+	static const char text2[] = "+++ exited with 0 +++\n";
+	const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef;
+	long rc;
+
+	rc = syscall(__NR_seccomp, -1L, -1L, addr);
+	printf("seccomp(%#x /* SECCOMP_SET_MODE_??? */, %u, %#lx)"
+	       " = %ld %s (%m)\n", -1, -1, addr, rc, errno2name());
+	fflush(stdout);
+
+	rc = syscall(__NR_seccomp, 0, 0, 0);
+	if (rc) {
+		printf("seccomp(SECCOMP_SET_MODE_STRICT, 0, NULL)"
+		       " = %ld %s (%m)\n", rc, errno2name());
+		fflush(stdout);
+		rc = 0;
+	} else {
+		/*
+		 * If kernel implementaton of SECCOMP_MODE_STRICT is buggy,
+		 * the following syscall will result to SIGKILL.
+		 */
+		rc = write(1, text1, LENGTH_OF(text1)) != LENGTH_OF(text1);
+	}
+
+	rc += write(1, text2, LENGTH_OF(text2)) != LENGTH_OF(text2);
+	return !!syscall(__NR_exit, rc);
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_seccomp && __NR_exit")
+
+#endif
diff --git a/tests/seccomp-strict.test b/tests/seccomp-strict.test
new file mode 100755
index 0000000..b354c6a
--- /dev/null
+++ b/tests/seccomp-strict.test
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Check how seccomp SECCOMP_SET_MODE_STRICT is decoded.
+
+. "${srcdir=.}/init.sh"
+
+set -- "./$NAME"
+"$@" > /dev/null || {
+	case $? in
+		77) skip_ "$* exited with code 77" ;;
+		137) framework_skip_ "$* killed by SIGKILL, fix your kernel" ;;
+		*) fail_ "$args failed" ;;
+	esac
+}
+run_strace -eseccomp "$@" > "$EXP"
+match_diff "$LOG" "$EXP"
+rm -f "$EXP"
diff --git a/tests/seccomp.test b/tests/seccomp.test
deleted file mode 100755
index 1c9579a..0000000
--- a/tests/seccomp.test
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# Check how SECCOMP_MODE_FILTER is decoded.
-
-. "${srcdir=.}/init.sh"
-run_strace_match_diff -v -e trace=prctl
diff --git a/tests/semop.c b/tests/semop.c
new file mode 100644
index 0000000..214ce32
--- /dev/null
+++ b/tests/semop.c
@@ -0,0 +1,54 @@
+#include "tests.h"
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+union semun
+{
+	int val;
+	struct semid_ds *buf;
+	unsigned short *array;
+	struct seminfo *__buf;
+};
+
+static int id = -1;
+
+static void
+cleanup(void)
+{
+	semctl(id, 0, IPC_RMID, 0);
+	id = -1;
+}
+
+int
+main(void)
+{
+	id = semget(IPC_PRIVATE, 1, 0600);
+	if (id < 0)
+		perror_msg_and_skip("semget");
+	atexit(cleanup);
+
+	union semun sem_union = { .val = 0 };
+	if (semctl(id, 0, SETVAL, sem_union) == -1)
+		perror_msg_and_skip("semctl");
+
+	struct sembuf *const sem_b = tail_alloc(sizeof(*sem_b));
+	sem_b->sem_num = 0;
+	sem_b->sem_op = 1;
+	sem_b->sem_flg = SEM_UNDO;
+
+	if (semop(id, sem_b, 1))
+		perror_msg_and_skip("semop, 1");
+	printf("semop(%d, [{0, 1, SEM_UNDO}], 1) = 0\n", id);
+
+	sem_b->sem_op = -1;
+	if (semop(id, sem_b, 1))
+		perror_msg_and_skip("semop, -1");
+	printf("semop(%d, [{0, -1, SEM_UNDO}], 1) = 0\n", id);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/semop.test b/tests/semop.test
new file mode 100755
index 0000000..7e8f32c
--- /dev/null
+++ b/tests/semop.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check semop syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a32
diff --git a/tests/set_mempolicy.c b/tests/set_mempolicy.c
new file mode 100644
index 0000000..e59e89f
--- /dev/null
+++ b/tests/set_mempolicy.c
@@ -0,0 +1,152 @@
+/*
+ * Check decoding of set_mempolicy syscall.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_set_mempolicy
+
+# include <errno.h>
+# include <stdio.h>
+# include <string.h>
+# include <unistd.h>
+
+# include "xlat.h"
+# include "xlat/policies.h"
+
+# define MAX_STRLEN 3
+# define NLONGS(n) ((n + 8 * sizeof(long) - 2) \
+		      / (8 * sizeof(long)))
+
+static void
+print_nodes(const unsigned long maxnode, unsigned int offset)
+{
+	unsigned int nlongs = NLONGS(maxnode);
+	if (nlongs <= offset)
+		nlongs = 0;
+	else
+		nlongs -= offset;
+	const unsigned int size = nlongs * sizeof(long);
+	unsigned long *const nodemask =
+		tail_alloc(size ? size : (offset ? 1 : 0));
+	memset(nodemask, 0, size);
+
+	long rc = syscall(__NR_set_mempolicy, 0, nodemask, maxnode);
+	int saved_errno = errno;
+
+	fputs("set_mempolicy(MPOL_DEFAULT, ", stdout);
+
+	if (nlongs) {
+		putc('[', stdout);
+		unsigned int i;
+		for (i = 0; i < nlongs + offset; ++i) {
+			if (i)
+				fputs(", ", stdout);
+			if (i < nlongs) {
+				if (i >= MAX_STRLEN) {
+					fputs("...", stdout);
+					break;
+				}
+				printf("%#0*lx", (int) sizeof(long) * 2 + 2,
+				       nodemask[i]);
+			} else {
+				printf("%p", nodemask + i);
+				break;
+			}
+		}
+		putc(']', stdout);
+	} else {
+		if (maxnode)
+			printf("%p", nodemask);
+		else
+			printf("[]");
+	}
+
+	printf(", %lu) = ", maxnode);
+	if (rc) {
+		errno = saved_errno;
+		printf("%ld %s (%m)\n", rc, errno2name());
+	} else {
+		puts("0");
+	}
+}
+
+static void
+test_offset(const unsigned int offset)
+{
+	unsigned long maxnode = get_page_size() * 8;
+
+	print_nodes(maxnode, offset);
+	print_nodes(maxnode + 1, offset);
+	print_nodes(maxnode + 2, offset);
+
+	maxnode = sizeof(long) * 8;
+	print_nodes(0, offset);
+	print_nodes(1, offset);
+	print_nodes(2, offset);
+	print_nodes(maxnode - 1, offset);
+	print_nodes(maxnode    , offset);
+	print_nodes(maxnode + 1, offset);
+	print_nodes(maxnode + 2, offset);
+	print_nodes(maxnode * 2 - 1, offset);
+	print_nodes(maxnode * 2    , offset);
+	print_nodes(maxnode * 2 + 1, offset);
+	print_nodes(maxnode * 2 + 2, offset);
+	print_nodes(maxnode * 3 - 1, offset);
+	print_nodes(maxnode * 3    , offset);
+	print_nodes(maxnode * 3 + 1, offset);
+	print_nodes(maxnode * 3 + 2, offset);
+	print_nodes(maxnode * 4 + 2, offset);
+}
+
+int
+main(void)
+{
+	if (syscall(__NR_set_mempolicy, 0, 0, 0))
+		perror_msg_and_skip("set_mempolicy");
+	puts("set_mempolicy(MPOL_DEFAULT, NULL, 0) = 0");
+
+	const unsigned long *nodemask = (void *) 0xfacefeedfffffffe;
+	const unsigned long maxnode = (unsigned long) 0xcafef00dbadc0ded;
+	long rc = syscall(__NR_set_mempolicy, 1, nodemask, maxnode);
+	printf("set_mempolicy(MPOL_PREFERRED, %p, %lu) = %ld %s (%m)\n",
+	       nodemask, maxnode, rc, errno2name());
+
+	test_offset(0);
+	test_offset(1);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_set_mempolicy")
+
+#endif
diff --git a/tests/set_mempolicy.test b/tests/set_mempolicy.test
new file mode 100755
index 0000000..0ed6666
--- /dev/null
+++ b/tests/set_mempolicy.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check set_mempolicy syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -s3 -a35
diff --git a/tests/setdomainname.c b/tests/setdomainname.c
new file mode 100644
index 0000000..1d83ffd
--- /dev/null
+++ b/tests/setdomainname.c
@@ -0,0 +1,24 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setdomainname
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	long rc = syscall(__NR_setdomainname, 0, 63);
+	printf("setdomainname(NULL, 63) = %ld %s (%m)\n",
+	       rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setdomainname")
+
+#endif
diff --git a/tests/setdomainname.test b/tests/setdomainname.test
new file mode 100755
index 0000000..2159e7c
--- /dev/null
+++ b/tests/setdomainname.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setdomainname syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a24
diff --git a/tests/setfsgid.c b/tests/setfsgid.c
new file mode 100644
index 0000000..9f3a279
--- /dev/null
+++ b/tests/setfsgid.c
@@ -0,0 +1,23 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setfsgid
+
+# define SYSCALL_NR	__NR_setfsgid
+# define SYSCALL_NAME	"setfsgid"
+
+# if defined __NR_setfsgid32 && __NR_setfsgid != __NR_setfsgid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_getegid)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	getegid()
+# endif
+
+# include "setfsugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setfsgid")
+
+#endif
diff --git a/tests/setfsgid.test b/tests/setfsgid.test
new file mode 100755
index 0000000..0ae2b0a
--- /dev/null
+++ b/tests/setfsgid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setfsgid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12
diff --git a/tests/setfsgid32.c b/tests/setfsgid32.c
new file mode 100644
index 0000000..149b767
--- /dev/null
+++ b/tests/setfsgid32.c
@@ -0,0 +1,16 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setfsgid32
+
+# define SYSCALL_NR	__NR_setfsgid32
+# define SYSCALL_NAME	"setfsgid32"
+# define UGID_TYPE	int
+# define GETUGID	getegid()
+# include "setfsugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setfsgid32")
+
+#endif
diff --git a/tests/setfsgid32.test b/tests/setfsgid32.test
new file mode 100755
index 0000000..9b7a2bf
--- /dev/null
+++ b/tests/setfsgid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setfsgid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14
diff --git a/tests/setfsugid.c b/tests/setfsugid.c
new file mode 100644
index 0000000..5b8f4fd
--- /dev/null
+++ b/tests/setfsugid.c
@@ -0,0 +1,65 @@
+/*
+ * Check decoding of setfsuid/setfsgid/setfsuid32/setfsgid32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+	unsigned int ugid = GETUGID;
+
+	const long tests[] = {
+		ugid,
+		0xffff0000U | ugid,
+		(unsigned long) 0xffffffff00000000ULL | ugid,
+		0xffffU,
+		-1U,
+		-1L,
+		0xc0deffffU,
+		0xfacefeedU,
+		(long) 0xfacefeeddeadbeefULL
+	};
+
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+		const unsigned int num = (unsigned UGID_TYPE) tests[i];
+		unsigned int rc;
+
+		rc = syscall(SYSCALL_NR, tests[i]);
+		printf("%s(%u) = %u\n", SYSCALL_NAME, num, rc);
+
+		rc = syscall(SYSCALL_NR, ugid);
+		printf("%s(%u) = %u\n", SYSCALL_NAME, ugid, rc);
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/setfsuid.c b/tests/setfsuid.c
new file mode 100644
index 0000000..7c77f50
--- /dev/null
+++ b/tests/setfsuid.c
@@ -0,0 +1,23 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setfsuid
+
+# define SYSCALL_NR	__NR_setfsuid
+# define SYSCALL_NAME	"setfsuid"
+
+# if defined __NR_setfsuid32 && __NR_setfsuid != __NR_setfsuid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_geteuid)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	geteuid()
+# endif
+
+# include "setfsugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setfsuid")
+
+#endif
diff --git a/tests/setfsuid.test b/tests/setfsuid.test
new file mode 100755
index 0000000..18a1021
--- /dev/null
+++ b/tests/setfsuid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setfsuid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12
diff --git a/tests/setfsuid32.c b/tests/setfsuid32.c
new file mode 100644
index 0000000..cb72d7c
--- /dev/null
+++ b/tests/setfsuid32.c
@@ -0,0 +1,16 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setfsuid32
+
+# define SYSCALL_NR	__NR_setfsuid32
+# define SYSCALL_NAME	"setfsuid32"
+# define UGID_TYPE	int
+# define GETUGID	geteuid()
+# include "setfsugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setfsuid32")
+
+#endif
diff --git a/tests/setfsuid32.test b/tests/setfsuid32.test
new file mode 100755
index 0000000..2dce3cc
--- /dev/null
+++ b/tests/setfsuid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setfsuid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14
diff --git a/tests/setgid.c b/tests/setgid.c
new file mode 100644
index 0000000..aa3f898
--- /dev/null
+++ b/tests/setgid.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setgid
+
+# define SYSCALL_NR	__NR_setgid
+# define SYSCALL_NAME	"setgid"
+
+# if defined __NR_setgid32 && __NR_setgid != __NR_setgid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_getegid)
+#  define CHECK_OVERFLOWUGID(arg)	check_overflowgid(arg)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	getegid()
+#  define CHECK_OVERFLOWUGID(arg)
+# endif
+
+# include "setugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setgid")
+
+#endif
diff --git a/tests/setgid.test b/tests/setgid.test
new file mode 100755
index 0000000..a3a9004
--- /dev/null
+++ b/tests/setgid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setgid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a10
diff --git a/tests/setgid32.c b/tests/setgid32.c
new file mode 100644
index 0000000..c9f1221
--- /dev/null
+++ b/tests/setgid32.c
@@ -0,0 +1,17 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setgid32
+
+# define SYSCALL_NR	__NR_setgid32
+# define SYSCALL_NAME	"setgid32"
+# define UGID_TYPE	int
+# define GETUGID	getegid()
+# define CHECK_OVERFLOWUGID(arg)
+# include "setugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setgid32")
+
+#endif
diff --git a/tests/setgid32.test b/tests/setgid32.test
new file mode 100755
index 0000000..11a87e1
--- /dev/null
+++ b/tests/setgid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setgid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12
diff --git a/tests/setgroups.c b/tests/setgroups.c
new file mode 100644
index 0000000..8355301
--- /dev/null
+++ b/tests/setgroups.c
@@ -0,0 +1,171 @@
+/*
+ * Check decoding of setgroups/setgroups32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __NR_setgroups32
+
+# define SYSCALL_NR	__NR_setgroups32
+# define SYSCALL_NAME	"setgroups32"
+# define GID_TYPE	unsigned int
+
+#else
+
+# include "tests.h"
+# include <sys/syscall.h>
+
+# ifdef __NR_setgroups
+
+#  define SYSCALL_NR	__NR_setgroups
+#  define SYSCALL_NAME	"setgroups"
+#  if defined __NR_setgroups32 && __NR_setgroups != __NR_setgroups32
+#   define GID_TYPE	unsigned short
+#  else
+#   define GID_TYPE	unsigned int
+#  endif
+
+# endif
+
+#endif
+
+#ifdef GID_TYPE
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	/* check how the first argument is decoded */
+	if (syscall(SYSCALL_NR, 0, 0))
+		printf("%s(0, NULL) = -1 %s (%m)\n", SYSCALL_NAME, errno2name());
+	else
+		printf("%s(0, NULL) = 0\n", SYSCALL_NAME);
+
+	if (syscall(SYSCALL_NR, (long) 0xffffffff00000000ULL, 0))
+		printf("%s(0, NULL) = -1 %s (%m)\n",
+		       SYSCALL_NAME, errno2name());
+	else
+		printf("%s(0, NULL) = 0\n", SYSCALL_NAME);
+
+	syscall(SYSCALL_NR, 1, 0);
+	printf("%s(1, NULL) = -1 %s (%m)\n", SYSCALL_NAME, errno2name());
+
+	syscall(SYSCALL_NR, (long) 0xffffffff00000001ULL, 0);
+	printf("%s(1, NULL) = -1 %s (%m)\n", SYSCALL_NAME, errno2name());
+
+	syscall(SYSCALL_NR, -1U, 0);
+	printf("%s(%u, NULL) = -1 %s (%m)\n", SYSCALL_NAME, -1U, errno2name());
+
+	syscall(SYSCALL_NR, -1L, 0);
+	printf("%s(%u, NULL) = -1 %s (%m)\n", SYSCALL_NAME, -1U, errno2name());
+
+	/* check how the second argument is decoded */
+	const GID_TYPE *const g1 = tail_alloc(sizeof(*g1));
+	GID_TYPE *const g2 = tail_alloc(sizeof(*g2) * 2);
+	GID_TYPE *const g3 = tail_alloc(sizeof(*g3) * 3);
+
+	if (syscall(SYSCALL_NR, 0, g1 + 1))
+		printf("%s(0, []) = -1 %s (%m)\n",
+		       SYSCALL_NAME, errno2name());
+	else
+		printf("%s(0, []) = 0\n", SYSCALL_NAME);
+
+	if (syscall(SYSCALL_NR, 1, g1))
+		printf("%s(1, [%u]) = -1 %s (%m)\n",
+		       SYSCALL_NAME, (unsigned) *g1, errno2name());
+	else
+		printf("%s(1, [%u]) = 0\n",
+		       SYSCALL_NAME, (unsigned) *g1);
+
+	syscall(SYSCALL_NR, 1, g1 + 1);
+	printf("%s(1, %p) = -1 %s (%m)\n",
+	       SYSCALL_NAME, g1 + 1, errno2name());
+
+	syscall(SYSCALL_NR, 1, -1L);
+	printf("%s(1, %#lx) = -1 %s (%m)\n", SYSCALL_NAME, -1L, errno2name());
+
+	syscall(SYSCALL_NR, 2, g1);
+	printf("%s(2, [%u, %p]) = -1 %s (%m)\n",
+	       SYSCALL_NAME, (unsigned) *g1, g1 + 1, errno2name());
+
+	g2[0] = -2;
+	g2[1] = -3;
+	if (syscall(SYSCALL_NR, 2, g2))
+		printf("%s(2, [%u, %u]) = -1 %s (%m)\n", SYSCALL_NAME,
+		       (unsigned) g2[0], (unsigned) g2[1], errno2name());
+	else
+		printf("%s(2, [%u, %u]) = 0\n", SYSCALL_NAME,
+		       (unsigned) g2[0], (unsigned) g2[1]);
+
+	syscall(SYSCALL_NR, 3, g2);
+	printf("%s(3, [%u, %u, %p]) = -1 %s (%m)\n", SYSCALL_NAME,
+	       (unsigned) g2[0], (unsigned) g2[1], g2 + 2, errno2name());
+
+	g3[0] = 0;
+	g3[1] = 1;
+	if (syscall(SYSCALL_NR, 3, g3))
+		printf("%s(3, [%u, %u, ...]) = -1 %s (%m)\n", SYSCALL_NAME,
+		       (unsigned) g3[0], (unsigned) g3[1], errno2name());
+	else
+		printf("%s(3, [%u, %u]) = 0\n", SYSCALL_NAME,
+		       (unsigned) g3[0], (unsigned) g3[1]);
+
+	syscall(SYSCALL_NR, 4, g3);
+	printf("%s(4, [%u, %u, ...]) = -1 %s (%m)\n", SYSCALL_NAME,
+	       (unsigned) g3[0], (unsigned) g3[1], errno2name());
+
+	long rc = sysconf(_SC_NGROUPS_MAX);
+	const unsigned ngroups_max = rc;
+
+	if ((unsigned long) rc == ngroups_max && (int) ngroups_max > 0) {
+		syscall(SYSCALL_NR, ngroups_max, g3);
+		printf("%s(%u, [%u, %u, ...]) = -1 %s (%m)\n", SYSCALL_NAME,
+		       ngroups_max, (unsigned) g3[0], (unsigned) g3[1],
+		       errno2name());
+
+		const unsigned long size =
+			(unsigned long) 0xffffffff00000000ULL | ngroups_max;
+		syscall(SYSCALL_NR, size, g3);
+		printf("%s(%u, [%u, %u, ...]) = -1 %s (%m)\n", SYSCALL_NAME,
+		       ngroups_max, (unsigned) g3[0], (unsigned) g3[1],
+		       errno2name());
+
+		syscall(SYSCALL_NR, ngroups_max + 1, g3);
+		printf("%s(%u, %p) = -1 %s (%m)\n", SYSCALL_NAME,
+		       ngroups_max + 1, g3, errno2name());
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setgroups")
+
+#endif
diff --git a/tests/setgroups.test b/tests/setgroups.test
new file mode 100755
index 0000000..0dcc8f7
--- /dev/null
+++ b/tests/setgroups.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setgroups syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -s2 -a17
diff --git a/tests/setgroups32.c b/tests/setgroups32.c
new file mode 100644
index 0000000..bd0a1fd
--- /dev/null
+++ b/tests/setgroups32.c
@@ -0,0 +1,12 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setgroups32
+
+# include "setgroups.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setgroups32")
+
+#endif
diff --git a/tests/setgroups32.test b/tests/setgroups32.test
new file mode 100755
index 0000000..ee4750d
--- /dev/null
+++ b/tests/setgroups32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setgroups32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -s2 -a19
diff --git a/tests/sethostname.c b/tests/sethostname.c
index 8d98cb6..65d0a78 100644
--- a/tests/sethostname.c
+++ b/tests/sethostname.c
@@ -3,28 +3,15 @@
 
 #ifdef __NR_sethostname
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	const char *hostname = NULL;
-	int rc = syscall(__NR_sethostname, hostname, 63);
-	const char *errno_text;
-	switch (errno) {
-		case ENOSYS:
-			errno_text = "ENOSYS";
-			break;
-		case EPERM:
-			errno_text = "EPERM";
-			break;
-		default:
-			errno_text = "EFAULT";
-	}
-	printf("sethostname(NULL, %d) = %d %s (%m)\n",
-	       63, rc, errno_text);
+	long rc = syscall(__NR_sethostname, 0, 63);
+	printf("sethostname(NULL, 63) = %ld %s (%m)\n",
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/setregid.c b/tests/setregid.c
new file mode 100644
index 0000000..6efa388
--- /dev/null
+++ b/tests/setregid.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setregid
+
+# define SYSCALL_NR	__NR_setregid
+# define SYSCALL_NAME	"setregid"
+
+# if defined __NR_setregid32 && __NR_setregid != __NR_setregid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_getegid)
+#  define CHECK_OVERFLOWUGID(arg)	check_overflowgid(arg)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	getegid()
+#  define CHECK_OVERFLOWUGID(arg)
+# endif
+
+# include "setreugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setregid")
+
+#endif
diff --git a/tests/setregid.test b/tests/setregid.test
new file mode 100755
index 0000000..101c7bd
--- /dev/null
+++ b/tests/setregid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setregid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a15
diff --git a/tests/setregid32.c b/tests/setregid32.c
new file mode 100644
index 0000000..0d0ebed
--- /dev/null
+++ b/tests/setregid32.c
@@ -0,0 +1,17 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setregid32
+
+# define SYSCALL_NR	__NR_setregid32
+# define SYSCALL_NAME	"setregid32"
+# define UGID_TYPE	int
+# define GETUGID	getegid()
+# define CHECK_OVERFLOWUGID(arg)
+# include "setreugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setregid32")
+
+#endif
diff --git a/tests/setregid32.test b/tests/setregid32.test
new file mode 100755
index 0000000..e57e66c
--- /dev/null
+++ b/tests/setregid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setregid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a17
diff --git a/tests/setresgid.c b/tests/setresgid.c
new file mode 100644
index 0000000..6754c2f
--- /dev/null
+++ b/tests/setresgid.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setresgid
+
+# define SYSCALL_NR	__NR_setresgid
+# define SYSCALL_NAME	"setresgid"
+
+# if defined __NR_setresgid32 && __NR_setresgid != __NR_setresgid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_getegid)
+#  define CHECK_OVERFLOWUGID(arg)	check_overflowgid(arg)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	getegid()
+#  define CHECK_OVERFLOWUGID(arg)
+# endif
+
+# include "setresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setresgid")
+
+#endif
diff --git a/tests/setresgid.test b/tests/setresgid.test
new file mode 100755
index 0000000..5a69574
--- /dev/null
+++ b/tests/setresgid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setresgid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a19
diff --git a/tests/setresgid32.c b/tests/setresgid32.c
new file mode 100644
index 0000000..29a8042
--- /dev/null
+++ b/tests/setresgid32.c
@@ -0,0 +1,17 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setresgid32
+
+# define SYSCALL_NR	__NR_setresgid32
+# define SYSCALL_NAME	"setresgid32"
+# define UGID_TYPE	int
+# define GETUGID	getegid()
+# define CHECK_OVERFLOWUGID(arg)
+# include "setresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setresgid32")
+
+#endif
diff --git a/tests/setresgid32.test b/tests/setresgid32.test
new file mode 100755
index 0000000..528b2c9
--- /dev/null
+++ b/tests/setresgid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setresgid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a21
diff --git a/tests/setresugid.c b/tests/setresugid.c
new file mode 100644
index 0000000..711bd31
--- /dev/null
+++ b/tests/setresugid.c
@@ -0,0 +1,113 @@
+/*
+ * Check decoding of setresuid/setresgid/setresuid32/setresgid32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int
+ugid2int(const unsigned UGID_TYPE ugid)
+{
+	if ((unsigned UGID_TYPE) -1U == ugid)
+		return -1;
+	else
+		return ugid;
+}
+
+static void
+print_int(const unsigned int num)
+{
+	if (num == -1U)
+		printf("-1");
+	else
+		printf("%u", num);
+}
+
+static int
+num_matches_id(const unsigned int num, const unsigned int ugid)
+{
+	return num == ugid || num == -1U;
+}
+
+#define TRIPLE(val)	\
+	{ val, ugid, ugid }, { ugid, val, ugid }, { ugid, ugid, val }
+
+int
+main(void)
+{
+	unsigned int ugid = GETUGID;
+	CHECK_OVERFLOWUGID(ugid);
+
+	const struct {
+		const long r, e, s;
+	} tests[] = {
+		{ ugid, ugid, ugid },
+		TRIPLE((unsigned long) 0xffffffff00000000ULL | ugid),
+		TRIPLE(-1U),
+		TRIPLE(-1L),
+		TRIPLE(0xffff0000U | ugid),
+		TRIPLE(0xffff),
+		TRIPLE(0xc0deffffU)
+	};
+
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+		const unsigned int rn = ugid2int(tests[i].r);
+		const unsigned int en = ugid2int(tests[i].e);
+		const unsigned int sn = ugid2int(tests[i].s);
+
+		if (!num_matches_id(rn, ugid) ||
+		    !num_matches_id(en, ugid) ||
+		    !num_matches_id(sn, ugid))
+			continue;
+
+		if (syscall(SYSCALL_NR, tests[i].r, tests[i].e, tests[i].s)) {
+			if (!i && ENOSYS == errno) {
+				printf("%s(%u, %u, %u) = -1 ENOSYS (%m)\n",
+				       SYSCALL_NAME, ugid, ugid, ugid);
+				break;
+			}
+			perror_msg_and_fail("%s(%#lx, %#lx, %#lx)",
+					    SYSCALL_NAME,
+					    tests[i].r, tests[i].e, tests[i].s);
+		}
+
+		printf("%s(", SYSCALL_NAME);
+		print_int(rn);
+		printf(", ");
+		print_int(en);
+		printf(", ");
+		print_int(sn);
+		printf(") = 0\n");
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/setresuid.c b/tests/setresuid.c
new file mode 100644
index 0000000..b924f91
--- /dev/null
+++ b/tests/setresuid.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setresuid
+
+# define SYSCALL_NR	__NR_setresuid
+# define SYSCALL_NAME	"setresuid"
+
+# if defined __NR_setresuid32 && __NR_setresuid != __NR_setresuid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_geteuid)
+#  define CHECK_OVERFLOWUGID(arg)	check_overflowuid(arg)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	geteuid()
+#  define CHECK_OVERFLOWUGID(arg)
+# endif
+
+# include "setresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setresuid")
+
+#endif
diff --git a/tests/setresuid.test b/tests/setresuid.test
new file mode 100755
index 0000000..f1219e0
--- /dev/null
+++ b/tests/setresuid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setresuid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a19
diff --git a/tests/setresuid32.c b/tests/setresuid32.c
new file mode 100644
index 0000000..d4187dd
--- /dev/null
+++ b/tests/setresuid32.c
@@ -0,0 +1,17 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setresuid32
+
+# define SYSCALL_NR	__NR_setresuid32
+# define SYSCALL_NAME	"setresuid32"
+# define UGID_TYPE	int
+# define GETUGID	geteuid()
+# define CHECK_OVERFLOWUGID(arg)
+# include "setresugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setresuid32")
+
+#endif
diff --git a/tests/setresuid32.test b/tests/setresuid32.test
new file mode 100755
index 0000000..942a3a6
--- /dev/null
+++ b/tests/setresuid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setresuid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a21
diff --git a/tests/setreugid.c b/tests/setreugid.c
new file mode 100644
index 0000000..38c80d5
--- /dev/null
+++ b/tests/setreugid.c
@@ -0,0 +1,106 @@
+/*
+ * Check decoding of setreuid/setregid/setreuid32/setregid32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int
+ugid2int(const unsigned UGID_TYPE ugid)
+{
+	if ((unsigned UGID_TYPE) -1U == ugid)
+		return -1;
+	else
+		return ugid;
+}
+
+static void
+print_int(const unsigned int num)
+{
+	if (num == -1U)
+		printf("-1");
+	else
+		printf("%u", num);
+}
+
+static int
+num_matches_id(const unsigned int num, const unsigned int ugid)
+{
+	return num == ugid || num == -1U;
+}
+
+#define PAIR(val)	{ val, ugid }, { ugid, val }
+
+int
+main(void)
+{
+	unsigned int ugid = GETUGID;
+	CHECK_OVERFLOWUGID(ugid);
+
+	const struct {
+		const long r, e;
+	} tests[] = {
+		{ ugid, ugid },
+		PAIR((unsigned long) 0xffffffff00000000ULL | ugid),
+		PAIR(-1U),
+		PAIR(-1L),
+		PAIR(0xffff0000U | ugid),
+		PAIR(0xffff),
+		PAIR(0xc0deffffU)
+	};
+
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+		const unsigned int rn = ugid2int(tests[i].r);
+		const unsigned int en = ugid2int(tests[i].e);
+
+		if (!num_matches_id(rn, ugid) || !num_matches_id(en, ugid))
+			continue;
+
+		if (syscall(SYSCALL_NR, tests[i].r, tests[i].e)) {
+			if (!i && ENOSYS == errno) {
+				printf("%s(%u, %u) = -1 ENOSYS (%m)\n",
+				       SYSCALL_NAME, ugid, ugid);
+				break;
+			}
+			perror_msg_and_fail("%s(%#lx, %#lx)", SYSCALL_NAME,
+					    tests[i].r, tests[i].e);
+		}
+
+		printf("%s(", SYSCALL_NAME);
+		print_int(rn);
+		printf(", ");
+		print_int(en);
+		printf(") = 0\n");
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/setreuid.c b/tests/setreuid.c
new file mode 100644
index 0000000..dc13038
--- /dev/null
+++ b/tests/setreuid.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setreuid
+
+# define SYSCALL_NR	__NR_setreuid
+# define SYSCALL_NAME	"setreuid"
+
+# if defined __NR_setreuid32 && __NR_setreuid != __NR_setreuid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_geteuid)
+#  define CHECK_OVERFLOWUGID(arg)	check_overflowuid(arg)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	geteuid()
+#  define CHECK_OVERFLOWUGID(arg)
+# endif
+
+# include "setreugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setreuid")
+
+#endif
diff --git a/tests/setreuid.test b/tests/setreuid.test
new file mode 100755
index 0000000..b6db3c1
--- /dev/null
+++ b/tests/setreuid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setreuid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a15
diff --git a/tests/setreuid32.c b/tests/setreuid32.c
new file mode 100644
index 0000000..43b7b91
--- /dev/null
+++ b/tests/setreuid32.c
@@ -0,0 +1,17 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setreuid32
+
+# define SYSCALL_NR	__NR_setreuid32
+# define SYSCALL_NAME	"setreuid32"
+# define UGID_TYPE	int
+# define GETUGID	geteuid()
+# define CHECK_OVERFLOWUGID(arg)
+# include "setreugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setreuid32")
+
+#endif
diff --git a/tests/setreuid32.test b/tests/setreuid32.test
new file mode 100755
index 0000000..23323d4
--- /dev/null
+++ b/tests/setreuid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setreuid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a17
diff --git a/tests/setugid.c b/tests/setugid.c
new file mode 100644
index 0000000..dd6b921
--- /dev/null
+++ b/tests/setugid.c
@@ -0,0 +1,97 @@
+/*
+ * Check decoding of setuid/setgid/setuid32/setgid32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int
+ugid2int(const unsigned UGID_TYPE ugid)
+{
+	if ((unsigned UGID_TYPE) -1U == ugid)
+		return -1;
+	else
+		return ugid;
+}
+
+int
+main(void)
+{
+	unsigned int ugid = GETUGID;
+	CHECK_OVERFLOWUGID(ugid);
+
+	const long tests[] = {
+		ugid,
+		0xffff0000U | ugid,
+		(unsigned long) 0xffffffff00000000ULL | ugid,
+		0xffffU,
+		-1U,
+		-1L
+	};
+
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+		const unsigned int num = ugid2int(tests[i]);
+		long expected;
+
+		if (num == ugid)
+			expected = 0;
+		else if (num == -1U)
+			expected = -1;
+		else
+			continue;
+
+		const long rc = syscall(SYSCALL_NR, tests[i]);
+		int saved_errno = errno;
+		if (rc != expected) {
+			if (!i && ENOSYS == errno) {
+				printf("%s(%u) = -1 ENOSYS (%m)\n",
+				       SYSCALL_NAME, ugid);
+				break;
+			}
+			perror_msg_and_fail("%s(%#lx) != %ld",
+					    SYSCALL_NAME, tests[i], expected);
+		}
+
+		printf("%s(", SYSCALL_NAME);
+		if (num == -1U)
+			printf("-1");
+		else
+			printf("%u", num);
+		errno = saved_errno;
+		if (expected)
+			printf(") = -1 %s (%m)\n", errno2name());
+		else
+			printf(") = 0\n");
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/setuid.c b/tests/setuid.c
new file mode 100644
index 0000000..c9e97e0
--- /dev/null
+++ b/tests/setuid.c
@@ -0,0 +1,25 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setuid
+
+# define SYSCALL_NR	__NR_setuid
+# define SYSCALL_NAME	"setuid"
+
+# if defined __NR_setuid32 && __NR_setuid != __NR_setuid32
+#  define UGID_TYPE	short
+#  define GETUGID	syscall(__NR_geteuid)
+#  define CHECK_OVERFLOWUGID(arg)	check_overflowuid(arg)
+# else
+#  define UGID_TYPE	int
+#  define GETUGID	geteuid()
+#  define CHECK_OVERFLOWUGID(arg)
+# endif
+
+# include "setugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setuid")
+
+#endif
diff --git a/tests/setuid.test b/tests/setuid.test
new file mode 100755
index 0000000..9279233
--- /dev/null
+++ b/tests/setuid.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setuid syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a10
diff --git a/tests/setuid32.c b/tests/setuid32.c
new file mode 100644
index 0000000..9247cb2
--- /dev/null
+++ b/tests/setuid32.c
@@ -0,0 +1,17 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_setuid32
+
+# define SYSCALL_NR	__NR_setuid32
+# define SYSCALL_NAME	"setuid32"
+# define UGID_TYPE	int
+# define GETUGID	geteuid()
+# define CHECK_OVERFLOWUGID(arg)
+# include "setugid.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_setuid32")
+
+#endif
diff --git a/tests/setuid32.test b/tests/setuid32.test
new file mode 100755
index 0000000..7998392
--- /dev/null
+++ b/tests/setuid32.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check setuid32 syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a12
diff --git a/tests/shmxt.c b/tests/shmxt.c
new file mode 100644
index 0000000..8e087f3
--- /dev/null
+++ b/tests/shmxt.c
@@ -0,0 +1,53 @@
+#include "tests.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/shm.h>
+
+static int id = -1;
+
+static void
+cleanup(void)
+{
+	shmctl(id, IPC_RMID, NULL);
+	id = -1;
+}
+
+#ifdef __alpha__
+# define SHMAT "osf_shmat"
+#else
+# define SHMAT "shmat"
+#endif
+
+int
+main(void)
+{
+	id = shmget(IPC_PRIVATE, 1, 0600);
+	if (id < 0)
+		perror_msg_and_skip("shmget");
+	atexit(cleanup);
+
+	shmat(id, NULL, SHM_REMAP);
+	printf("%s(%d, NULL, SHM_REMAP) = -1 %s (%m)\n",
+	       SHMAT, id, errno2name());
+
+	void *shmaddr = shmat(id, NULL, SHM_RDONLY);
+	if (shmaddr == (void *)(-1))
+		perror_msg_and_skip("shmat SHM_RDONLY");
+	printf("%s(%d, NULL, SHM_RDONLY) = %p\n", SHMAT, id, shmaddr);
+
+	if (shmdt(shmaddr))
+		perror_msg_and_skip("shmdt");
+	printf("shmdt(%p) = 0\n", shmaddr);
+
+	++shmaddr;
+	void *shmaddr2 = shmat(id, shmaddr, SHM_RND);
+	if (shmaddr2 == (void *)(-1))
+		printf("%s(%d, %p, SHM_RND) = -1 %s (%m)\n",
+		       SHMAT, id, shmaddr, errno2name());
+	else
+		printf("%s(%d, %p, SHM_RND) = %p\n",
+		       SHMAT, id, shmaddr, shmaddr2);
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/shmxt.test b/tests/shmxt.test
new file mode 100755
index 0000000..3757cfa
--- /dev/null
+++ b/tests/shmxt.test
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Check shmat and shmdt syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+
+case "$STRACE_ARCH" in
+	alpha) shmat=osf_shmat ;;
+	*) shmat=shmat ;;
+esac
+
+run_strace_match_diff -e trace=$shmat,shmdt -a11
diff --git a/tests/sleep.c b/tests/sleep.c
index 725d0f2..f4bce3c 100644
--- a/tests/sleep.c
+++ b/tests/sleep.c
@@ -28,7 +28,6 @@
  */
 
 #include "tests.h"
-#include <errno.h>
 #include <stdlib.h>
 #include <time.h>
 
diff --git a/tests/splice.c b/tests/splice.c
index ac24b2a..433cf7f 100644
--- a/tests/splice.c
+++ b/tests/splice.c
@@ -32,8 +32,6 @@
 
 #if defined __NR_splice
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -49,12 +47,13 @@
 	const size_t len = (size_t) 0xdeadbef3facefed3ULL;
 	const unsigned int flags = 15;
 
-	assert(syscall(__NR_splice, fd_in, off_in, fd_out, off_out,
-		       len, flags) == -1);
-	printf("splice(%d, [%lld], %d, [%lld], %zu, %s) = -1 %s (%m)\n",
+	long rc = syscall(__NR_splice,
+			  fd_in, off_in, fd_out, off_out, len, flags);
+	printf("splice(%d, [%lld], %d, [%lld], %zu, %s) = %ld %s (%m)\n",
 	       (int) fd_in, *off_in, (int) fd_out, *off_out, len,
 	       "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT",
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	       rc, errno2name());
+
 	puts("+++ exited with 0 +++");
 	return 0;
 }
diff --git a/tests/statfs.c b/tests/statfs.c
index 9b6ba55..5a87afc 100644
--- a/tests/statfs.c
+++ b/tests/statfs.c
@@ -26,13 +26,18 @@
  */
 
 #include "tests.h"
-#include <sys/statfs.h>
+#include <sys/syscall.h>
 
-int
-main(void)
-{
-	struct statfs stb;
-	if (statfs("/proc/self/status", &stb))
-		perror_msg_and_fail("statfs");
-	return 0;
-}
+#ifdef __NR_statfs
+
+# define SYSCALL_ARG_FMT		"\"%s\""
+# define SYSCALL_ARG(file, desc)	(file)
+# define SYSCALL_NR			__NR_statfs
+# define SYSCALL_NAME			"statfs"
+# include "xstatfs.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_statfs")
+
+#endif
diff --git a/tests/statfs.expected b/tests/statfs.expected
index 93e2b51..0fa4510 100644
--- a/tests/statfs.expected
+++ b/tests/statfs.expected
@@ -1 +1 @@
-statfs(64)?\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type="PROC_SUPER_MAGIC", f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?\}\) += 0
+statfs(64)?\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type=PROC_SUPER_MAGIC, f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=ST_VALID(\|ST_[A-Z]+)*)?\}\) += 0
diff --git a/tests/statfs.test b/tests/statfs.test
index 214d521..6075576 100755
--- a/tests/statfs.test
+++ b/tests/statfs.test
@@ -1,15 +1,11 @@
 #!/bin/sh
 
-# Check how statfs/statfs64 syscalls are traced.
+# Check statfs syscall decoding.
 
 . "${srcdir=.}/init.sh"
 
 # this test probes /proc/self/status
 [ -f /proc/self/status ] ||
-        framework_skip_ '/proc/self/status is not available'
+	framework_skip_ '/proc/self/status is not available'
 
-run_prog
-run_strace -efile $args
-match_grep
-
-exit 0
+run_strace_match_diff -a17
diff --git a/tests/statfs64.c b/tests/statfs64.c
new file mode 100644
index 0000000..b85dce2
--- /dev/null
+++ b/tests/statfs64.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_statfs64
+
+# define SYSCALL_ARG_FMT		"\"%s\""
+# define SYSCALL_ARG(file, desc)	(file)
+# define SYSCALL_NR			__NR_statfs64
+# define SYSCALL_NAME			"statfs64"
+# include "xstatfs64.c"
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_statfs64")
+
+#endif
diff --git a/tests/statfs64.test b/tests/statfs64.test
new file mode 100755
index 0000000..9c0aa27
--- /dev/null
+++ b/tests/statfs64.test
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Check statfs64 syscall decoding.
+
+. "${srcdir=.}/statfs.test"
diff --git a/tests/strace-S.test b/tests/strace-S.test
new file mode 100755
index 0000000..0ffec30
--- /dev/null
+++ b/tests/strace-S.test
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check -S option.
+
+. "${srcdir=.}/init.sh"
+
+run_prog_skip_if_failed date > /dev/null
+
+test_c()
+{
+	local sortby sortopts sedexpr
+	sortby="$1"; shift
+	sortopts="$1"; shift
+	sedexpr="$1"; shift
+
+	run_strace -c -S "$sortby" date > /dev/null
+	sed -ne "$sedexpr" < "$LOG" > "$OUT"
+
+	[ -s "$OUT" ] ||
+		fail_ "$STRACE $args output mismatch"
+	LC_ALL=C sort -c $sortopts "$OUT" ||
+		fail_ "$STRACE $args output not sorted properly"
+}
+
+c='[[:space:]]\+\([^[:space:]]\+\)'
+test_c calls '-n -r' '/^[[:space:]]\+[0-9]/ s/^'"$c$c$c$c"'[[:space:]].*/\4/p'
+test_c name '' '/^[[:space:]]\+[0-9]/ s/^'"$c$c$c$c"'\([[:space:]]\+[0-9]\+\)\?'"$c"'$/\6/p'
+
+rm -f "$OUT"
diff --git a/tests/strace-T.expected b/tests/strace-T.expected
index f4b779b..809b7ea 100644
--- a/tests/strace-T.expected
+++ b/tests/strace-T.expected
@@ -1 +1 @@
-nanosleep\(\{1, 0\}, NULL\) = 0 <(1\.0|0\.9)[[:digit:]]{5}>
+nanosleep\(\{1, 0\}, NULL\) = 0 <(1\.[01]|0\.9)[[:digit:]]{5}>
diff --git a/tests/strace-V.test b/tests/strace-V.test
new file mode 100755
index 0000000..91093ac
--- /dev/null
+++ b/tests/strace-V.test
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Check -V option.
+
+. "${srcdir=.}/init.sh"
+
+run_strace -V > "$LOG"
+
+getval()
+{
+	sed -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"\([^"]*\)".*/\1/p' ../config.h
+}
+
+printf "%s -- version %s\n" "$(getval PACKAGE_NAME)" "$(getval VERSION)" > "$EXP"
+
+match_diff "$EXP" "$LOG"
+rm -f "$EXP"
diff --git a/tests/strace-ff.expected b/tests/strace-ff.expected
new file mode 100644
index 0000000..627a1b4
--- /dev/null
+++ b/tests/strace-ff.expected
@@ -0,0 +1,2 @@
+exit_group(0) = ?
++++ exited with 0 +++
diff --git a/tests/strace-ff.test b/tests/strace-ff.test
new file mode 100755
index 0000000..2ce06f1
--- /dev/null
+++ b/tests/strace-ff.test
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check -ff option.
+
+. "${srcdir=.}/init.sh"
+
+run_prog_skip_if_failed \
+	kill -0 $$
+
+./set_ptracer_any ./sleep 1 > "$OUT" &
+tracee_pid=$!
+
+while ! [ -s "$OUT" ]; do
+	kill -0 $tracee_pid 2> /dev/null ||
+		fail_ 'set_ptracer_any sleep failed'
+done
+
+rm -f "$LOG".*
+run_strace -a14 -eexit_group -ff -p $tracee_pid
+
+# check that output matches
+match_diff "$LOG.$tracee_pid"
+
+# check that no other output files have been created
+set -- "$LOG".*
+[ "$LOG.$tracee_pid" = "$*" ] ||
+	fail_ "too many output files: $*"
+
+rm -f "$OUT" "$LOG.$tracee_pid"
diff --git a/tests/strace-r.expected b/tests/strace-r.expected
index 2b206c8..8009c35 100644
--- a/tests/strace-r.expected
+++ b/tests/strace-r.expected
@@ -1,2 +1,2 @@
 [ ]{5}0\.0{6} execve\("\./sleep", \["\./sleep", "1"\], \[/\* [[:digit:]]+ vars \*/\]\) = 0
-[ ]{5}(1\.0|0\.9)[[:digit:]]{5} \+\+\+ exited with 0 \+\+\+
+[ ]{5}(1\.[01]|0\.9)[[:digit:]]{5} \+\+\+ exited with 0 \+\+\+
diff --git a/tests/struct_flock.c b/tests/struct_flock.c
index f942909..aae71a0 100644
--- a/tests/struct_flock.c
+++ b/tests/struct_flock.c
@@ -25,7 +25,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -43,6 +42,14 @@
 # define TYPEOF_FLOCK_OFF_T off_t
 #endif
 
+static long
+invoke_test_syscall(const unsigned int cmd, void *const p)
+{
+	const unsigned long op = (unsigned long) 0xffffffff00000000 | cmd;
+
+	return syscall(TEST_SYSCALL_NR, 0, op, (unsigned long) p);
+}
+
 static void
 test_flock_einval(const int cmd, const char *name)
 {
@@ -51,7 +58,7 @@
 		.l_start = (TYPEOF_FLOCK_OFF_T) 0xdefaced1facefeed,
 		.l_len = (TYPEOF_FLOCK_OFF_T) 0xdefaced2cafef00d
 	};
-	syscall(TEST_SYSCALL_NR, 0, cmd, &fl);
+	invoke_test_syscall(cmd, &fl);
 	printf("%s(0, %s, {l_type=F_RDLCK, l_whence=SEEK_SET"
 	       ", l_start=%jd, l_len=%jd}) = %s\n", TEST_SYSCALL_STR, name,
 	       (intmax_t) fl.l_start, (intmax_t) fl.l_len, EINVAL_STR);
@@ -67,19 +74,19 @@
 		.l_type = F_RDLCK,
 		.l_len = FILE_LEN
 	};
-	int rc = syscall(TEST_SYSCALL_NR, 0, F_SETLK, &fl);
+	long rc = invoke_test_syscall(F_SETLK, &fl);
 	printf("%s(0, F_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET"
 	       ", l_start=0, l_len=%d}) = %s\n",
 	       TEST_SYSCALL_STR, FILE_LEN, rc ? EINVAL_STR : "0");
 	if (rc)
 		return;
 
-	syscall(TEST_SYSCALL_NR, 0, F_GETLK, &fl);
+	invoke_test_syscall(F_GETLK, &fl);
 	printf("%s(0, F_GETLK, {l_type=F_UNLCK, l_whence=SEEK_SET"
 	       ", l_start=0, l_len=%d, l_pid=0}) = 0\n",
 	       TEST_SYSCALL_STR, FILE_LEN);
 
-	syscall(TEST_SYSCALL_NR, 0, F_SETLK, &fl);
+	invoke_test_syscall(F_SETLK, &fl);
 	printf("%s(0, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET"
 	       ", l_start=0, l_len=%d}) = 0\n",
 	       TEST_SYSCALL_STR, FILE_LEN);
diff --git a/tests/swap.c b/tests/swap.c
index e8f0196..065af4d 100644
--- a/tests/swap.c
+++ b/tests/swap.c
@@ -3,53 +3,42 @@
 
 #if defined __NR_swapon && defined __NR_swapoff
 
-# include <errno.h>
 # include <stdio.h>
 # include <sys/swap.h>
 # include <unistd.h>
 
-static const char *
-error_msg(int error_num)
-{
-	switch (error_num) {
-		case ENOSYS: return "ENOSYS";
-		case EPERM: return "EPERM";
-		case EINVAL: return "EINVAL";
-		default: return "ENOENT";
-	}
-}
-
 int
 main(void)
 {
 	static const char sample[] = "swap.sample";
+	long rc;
 
-	int rc = syscall(__NR_swapon, sample, 0);
-	printf("swapon(\"%s\", 0) = %d %s (%m)\n",
-	       sample, rc, error_msg(errno));
+	rc = syscall(__NR_swapon, sample, 0);
+	printf("swapon(\"%s\", %s) = %ld %s (%m)\n",
+	       sample, "0", rc, errno2name());
 
 	rc = syscall(__NR_swapon, sample, 42);
-	printf("swapon(\"%s\", %s) = %d %s (%m)\n",
-	       sample, "42", rc, error_msg(errno));
+	printf("swapon(\"%s\", %s) = %ld %s (%m)\n",
+	       sample, "42", rc, errno2name());
 
 	rc = syscall(__NR_swapon, sample, SWAP_FLAG_PREFER);
-	printf("swapon(\"%s\", %s) = %d %s (%m)\n",
-	       sample, "SWAP_FLAG_PREFER", rc, error_msg(errno));
+	printf("swapon(\"%s\", %s) = %ld %s (%m)\n",
+	       sample, "SWAP_FLAG_PREFER", rc, errno2name());
 
 	rc = syscall(__NR_swapon, sample, SWAP_FLAG_PREFER | 42);
-	printf("swapon(\"%s\", %s) = %d %s (%m)\n",
-	       sample, "SWAP_FLAG_PREFER|42", rc, error_msg(errno));
+	printf("swapon(\"%s\", %s) = %ld %s (%m)\n",
+	       sample, "SWAP_FLAG_PREFER|42", rc, errno2name());
 
 	rc = syscall(__NR_swapon, sample, -1L);
-	printf("swapon(\"%s\", %s) = %d %s (%m)\n",
+	printf("swapon(\"%s\", %s) = %ld %s (%m)\n",
 	       sample,
 	       "SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|SWAP_FLAG_DISCARD_ONCE"
 	       "|SWAP_FLAG_DISCARD_PAGES|0xfff80000|32767",
-	       rc, error_msg(errno));
+	       rc, errno2name());
 
 	rc = syscall(__NR_swapoff, sample);
-	printf("swapoff(\"%s\") = %d %s (%m)\n",
-	       sample, rc, error_msg(errno));
+	printf("swapoff(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/symlink.c b/tests/symlink.c
new file mode 100644
index 0000000..44c5655
--- /dev/null
+++ b/tests/symlink.c
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_symlink
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample_1[] = "symlink_new";
+	static const char sample_2[] = "symlink";
+
+	long rc = syscall(__NR_symlink, sample_1, sample_2);
+	printf("symlink(\"%s\", \"%s\") = %ld %s (%m)\n",
+	       sample_1, sample_2, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_symlink")
+
+#endif
diff --git a/tests/symlink.test b/tests/symlink.test
new file mode 100755
index 0000000..79b93ba
--- /dev/null
+++ b/tests/symlink.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check symlink syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a34
diff --git a/tests/symlinkat.c b/tests/symlinkat.c
new file mode 100644
index 0000000..3dfdd80
--- /dev/null
+++ b/tests/symlinkat.c
@@ -0,0 +1,28 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_symlinkat
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	const long int fd = (long int) 0xdeadbeefffffffff;
+	static const char oldpath[] = "symlink_old";
+	static const char newpath[] = "symlink_new";
+
+	long rc = syscall(__NR_symlinkat, oldpath, fd, newpath);
+	printf("symlinkat(\"%s\", %d, \"%s\") = %ld %s (%m)\n",
+	       oldpath, (int) fd, newpath, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_symlinkat")
+
+#endif
diff --git a/tests/symlinkat.test b/tests/symlinkat.test
new file mode 100755
index 0000000..d8501ff
--- /dev/null
+++ b/tests/symlinkat.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check symlinkat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff
diff --git a/tests/sync.c b/tests/sync.c
new file mode 100644
index 0000000..132a6f2
--- /dev/null
+++ b/tests/sync.c
@@ -0,0 +1,22 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_sync
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	printf("sync() = %ld\n", syscall(__NR_sync));
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_sync")
+
+#endif
diff --git a/tests/sync.test b/tests/sync.test
new file mode 100755
index 0000000..f6bf6c8
--- /dev/null
+++ b/tests/sync.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check sync syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a7
diff --git a/tests/sync_file_range.c b/tests/sync_file_range.c
index 2c3848c..9426e3c 100644
--- a/tests/sync_file_range.c
+++ b/tests/sync_file_range.c
@@ -33,8 +33,6 @@
 
 #if defined HAVE_SYNC_FILE_RANGE && defined __NR_sync_file_range
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 
 int
@@ -45,14 +43,14 @@
 	const off64_t nbytes = 0xfacefeedcafef00d;
 	const unsigned int flags = -1;
 
-	assert(sync_file_range(fd, offset, nbytes, flags) == -1);
+	int rc = sync_file_range(fd, offset, nbytes, flags);
 	printf("%s(%d, %lld, %lld, SYNC_FILE_RANGE_WAIT_BEFORE"
 	       "|SYNC_FILE_RANGE_WRITE|SYNC_FILE_RANGE_WAIT_AFTER"
-	       "|0xfffffff8) = -1 %s (%m)\n",
+	       "|0xfffffff8) = %d %s (%m)\n",
 	       "sync_file_range", fd,
 	       (long long) offset,
 	       (long long) nbytes,
-	       errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/sync_file_range2.c b/tests/sync_file_range2.c
index aa38c27..d19cf25 100644
--- a/tests/sync_file_range2.c
+++ b/tests/sync_file_range2.c
@@ -33,8 +33,6 @@
 
 #if defined HAVE_SYNC_FILE_RANGE && defined  __NR_sync_file_range2
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 
 int
@@ -45,14 +43,14 @@
 	const off64_t nbytes = 0xfacefeedcafef00d;
 	const unsigned int flags = -1;
 
-	assert(sync_file_range(fd, offset, nbytes, flags) == -1);
+	int rc = sync_file_range(fd, offset, nbytes, flags);
 	printf("%s(%d, SYNC_FILE_RANGE_WAIT_BEFORE"
 	       "|SYNC_FILE_RANGE_WRITE|SYNC_FILE_RANGE_WAIT_AFTER"
-	       "|0xfffffff8, %lld, %lld) = -1 %s (%m)\n",
+	       "|0xfffffff8, %lld, %lld) = %d %s (%m)\n",
 	       "sync_file_range2", fd,
 	       (long long) offset,
 	       (long long) nbytes,
-	       errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/syslog.c b/tests/syslog.c
index 1475db5..8c68298 100644
--- a/tests/syslog.c
+++ b/tests/syslog.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_syslog
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -12,21 +11,10 @@
 int
 main(void)
 {
-	const char *errno_text;
-	const void *bufp = &errno_text;
-	int rc = syscall(__NR_syslog, SYSLOG_ACTION_READ, bufp, -1);
-	switch (errno) {
-		case ENOSYS:
-			errno_text = "ENOSYS";
-			break;
-		case EPERM:
-			errno_text = "EPERM";
-			break;
-		default:
-			errno_text = "EINVAL";
-	}
-	printf("syslog(SYSLOG_ACTION_READ, %p, -1) = %d %s (%m)\n",
-	       bufp, rc, errno_text);
+	const long addr = (long) 0xfacefeeddeadbeef;
+	int rc = syscall(__NR_syslog, SYSLOG_ACTION_READ, addr, -1);
+	printf("syslog(SYSLOG_ACTION_READ, %#lx, -1) = %d %s (%m)\n",
+	       addr, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/tail_alloc.c b/tests/tail_alloc.c
index 82e1aac..08081d4 100644
--- a/tests/tail_alloc.c
+++ b/tests/tail_alloc.c
@@ -34,17 +34,20 @@
 {
 	const size_t page_size = get_page_size();
 	const size_t len = (size + page_size - 1) & -page_size;
-	const size_t alloc_size = len + 2 * page_size;
+	const size_t alloc_size = len + 6 * page_size;
 
 	void *p = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE,
 		       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 	if (MAP_FAILED == p)
 		perror_msg_and_fail("mmap(%zu)", alloc_size);
 
-	void *start_work = p + page_size;
+	void *start_work = p + 3 * page_size;
 	void *tail_guard = start_work + len;
 
-	if (munmap(p, page_size) || munmap(tail_guard, page_size))
+	if (munmap(p, page_size) ||
+	    munmap(p + 2 * page_size, page_size) ||
+	    munmap(tail_guard, page_size) ||
+	    munmap(tail_guard + 2 * page_size, page_size))
 		perror_msg_and_fail("munmap");
 
 	memset(start_work, 0xff, len);
diff --git a/tests/tee.c b/tests/tee.c
index abdf383..f36f92a 100644
--- a/tests/tee.c
+++ b/tests/tee.c
@@ -32,8 +32,6 @@
 
 #if defined __NR_tee
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -45,12 +43,12 @@
 	const size_t len = (size_t) 0xdeadbef3facefed3ULL;
 	const unsigned int flags = 15;
 
-	assert(syscall(__NR_tee, fd_in, fd_out,
-		       len, flags) == -1);
-	printf("tee(%d, %d, %zu, %s) = -1 %s (%m)\n",
+	long rc = syscall(__NR_tee, fd_in, fd_out, len, flags);
+	printf("tee(%d, %d, %zu, %s) = %ld %s (%m)\n",
 	       (int) fd_in, (int) fd_out, len,
 	       "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT",
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	       rc, errno2name());
+
 	puts("+++ exited with 0 +++");
 	return 0;
 }
diff --git a/tests/tests.h b/tests/tests.h
index 115379e..0205ea0 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -78,8 +78,28 @@
 /* Return inode number of socket descriptor. */
 unsigned long inode_of_sockfd(int);
 
-/* Print string in quoted form. */
-void print_quoted_string(const char *str);
+/* Print string in a quoted form. */
+void print_quoted_string(const char *);
+
+/* Print memory in a quoted form. */
+void print_quoted_memory(const char *, size_t);
+
+/* Check whether given uid matches kernel overflowuid. */
+void check_overflowuid(const int);
+
+/* Check whether given gid matches kernel overflowgid. */
+void check_overflowgid(const int);
+
+/* Translate errno to its name. */
+const char *errno2name(void);
+
+struct xlat;
+
+/* Print flags in symbolic form according to xlat table. */
+int printflags(const struct xlat *, const unsigned long long, const char *);
+
+/* Print constant in symbolic form according to xlat table. */
+int printxval(const struct xlat *, const unsigned long long, const char *);
 
 # define ARRAY_SIZE(arg) ((unsigned int) (sizeof(arg) / sizeof((arg)[0])))
 # define LENGTH_OF(arg) ((unsigned int) sizeof(arg) - 1)
@@ -87,4 +107,24 @@
 # define SKIP_MAIN_UNDEFINED(arg) \
 	int main(void) { error_msg_and_skip("undefined: %s", arg); }
 
+/*
+ * The kernel used to define 64-bit types on 64-bit systems on a per-arch
+ * basis.  Some architectures would use unsigned long and others would use
+ * unsigned long long.  These types were exported as part of the
+ * kernel-userspace ABI and now must be maintained forever.  This matches
+ * what the kernel exports for each architecture so we don't need to cast
+ * every printing of __u64 or __s64 to stdint types.
+ */
+# if SIZEOF_LONG == 4
+#  define PRI__64 "ll"
+# elif defined ALPHA || defined IA64 || defined MIPS || defined POWERPC
+#  define PRI__64 "l"
+# else
+#  define PRI__64 "ll"
+# endif
+
+# define PRI__d64 PRI__64"d"
+# define PRI__u64 PRI__64"u"
+# define PRI__x64 PRI__64"x"
+
 #endif
diff --git a/tests/timer_create.c b/tests/timer_create.c
index 8f7d5cd..ff924d3 100644
--- a/tests/timer_create.c
+++ b/tests/timer_create.c
@@ -42,7 +42,8 @@
 main(void)
 {
 	syscall(__NR_timer_create, CLOCK_REALTIME, NULL, NULL);
-	printf("timer_create(CLOCK_REALTIME, NULL, NULL) = -1 EFAULT (%m)\n");
+	printf("timer_create(CLOCK_REALTIME, NULL, NULL) = -1 %s (%m)\n",
+	       errno2name());
 
 	int tid[4] = {};
 	struct_sigevent sev = {
@@ -54,10 +55,11 @@
 	syscall(__NR_timer_create, CLOCK_REALTIME, &sev, NULL);
 	printf("timer_create(CLOCK_REALTIME, {sigev_value={int=%d, ptr=%#lx}"
 	       ", sigev_signo=%u, sigev_notify=%#x /* SIGEV_??? */}"
-	       ", NULL) = -1 EINVAL (%m)\n",
+	       ", NULL) = -1 %s (%m)\n",
 	       sev.sigev_value.sival_int,
 	       sev.sigev_value.sival_ptr,
-	       sev.sigev_signo, sev.sigev_notify);
+	       sev.sigev_signo, sev.sigev_notify,
+	       errno2name());
 
 	sev.sigev_notify = SIGEV_NONE;
 	if (syscall(__NR_timer_create, CLOCK_REALTIME, &sev, &tid[0]))
diff --git a/tests/truncate.c b/tests/truncate.c
index b47a97e..c3ad2ba 100644
--- a/tests/truncate.c
+++ b/tests/truncate.c
@@ -30,8 +30,6 @@
 
 #ifdef __NR_truncate
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 # include "kernel_types.h"
@@ -42,17 +40,15 @@
 	static const char fname[] = "truncate\nfilename";
 	static const char qname[] = "truncate\\nfilename";
 	const kernel_ulong_t len = (kernel_ulong_t) 0xdefaced0badc0deULL;
+	long rc;
 
 	if (sizeof(len) > sizeof(long))
-		assert(truncate(fname, len) == -1);
+		rc = truncate(fname, len);
 	else
-		assert(syscall(__NR_truncate, fname, len) == -1);
+		rc = syscall(__NR_truncate, fname, len);
 
-	if (ENOENT != errno)
-		perror_msg_and_skip("truncate");
-
-	printf("truncate(\"%s\", %llu) = -1 ENOENT (%m)\n",
-	       qname, (unsigned long long) len);
+	printf("truncate(\"%s\", %llu) = %ld %s (%m)\n",
+	       qname, (unsigned long long) len, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/truncate64.c b/tests/truncate64.c
index 0e193d5..c973c45 100644
--- a/tests/truncate64.c
+++ b/tests/truncate64.c
@@ -30,8 +30,6 @@
 
 #ifdef __NR_truncate64
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -42,11 +40,9 @@
 	static const char qname[] = "truncate64\\nfilename";
 	const off_t len = 0xdefaceddeadbeef;
 
-	assert(truncate(fname, len) == -1);
-	if (ENOENT != errno)
-		perror_msg_and_skip("truncate");
-	printf("truncate64(\"%s\", %llu) = -1 ENOENT (%m)\n",
-	       qname, (unsigned long long) len);
+	int rc = truncate(fname, len);
+	printf("truncate64(\"%s\", %llu) = %d %s (%m)\n",
+	       qname, (unsigned long long) len, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/uid.awk b/tests/uid.awk
deleted file mode 100644
index a5fdf1a..0000000
--- a/tests/uid.awk
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/gawk
-#
-# Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. The name of the author may not be used to endorse or promote products
-#    derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-BEGIN {
-  r_uint = "(0|[1-9][0-9]*)"
-  r_getuid = "getuid" suffix "\\(\\)[[:space:]]+= " r_uint
-  r_getxuid = "getxuid" suffix "\\(\\)[[:space:]]+= " r_uint " \\(euid " r_uint "\\)"
-  regexp = "^(" r_getuid "|" r_getxuid ")$"
-  expected = "getuid"
-  fail = 0
-}
-
-regexp == "" {
-  fail = 1
-  next
-}
-
-{
-  if (match($0, regexp, a)) {
-    if (expected == "getuid") {
-      if ("" != a[2])
-        uid = a[2]
-      else
-        uid = a[3]
-      expected = "setuid"
-      regexp = "^setuid" suffix "\\(" uid "\\)[[:space:]]+= 0$"
-    } else if (expected == "setuid") {
-      expected = "getresuid"
-      regexp = "^getresuid" suffix "\\(\\[" uid "\\], \\[" uid "\\], \\[" uid "\\]\\)[[:space:]]+= 0$"
-    } else if (expected == "getresuid") {
-      expected = "setreuid"
-      regexp = "^setreuid" suffix "\\(-1, -1\\)[[:space:]]+= 0$"
-    } else if (expected == "setreuid") {
-      expected = "setresuid"
-      regexp = "^setresuid" suffix "\\(" uid ", -1, -1\\)[[:space:]]+= 0$"
-    } else if (expected == "setresuid") {
-      expected = "fchown"
-      regexp = "^fchown" suffix "\\(1, -1, -1\\)[[:space:]]+= 0$"
-    } else if (expected == "fchown") {
-      expected = "1st getgroups"
-      regexp = "^getgroups" suffix "\\(0, NULL\\)[[:space:]]+= " r_uint "$"
-    } else if (expected == "1st getgroups") {
-      ngroups = a[1]
-      if (ngroups == "0")
-        list=""
-      else if (ngroups == "1")
-        list=r_uint
-      else
-        list=r_uint "(, " r_uint "){" (ngroups - 1) "}"
-      expected = "2nd getgroups"
-      regexp = "^getgroups" suffix "\\(" ngroups ", \\[" list "\\]\\)[[:space:]]+= " ngroups "$"
-    } else if (expected == "2nd getgroups") {
-      expected = "the last line"
-      regexp = "^\\+\\+\\+ exited with 0 \\+\\+\\+$"
-    } else if (expected == "the last line") {
-      expected = "nothing"
-      regexp = ""
-    }
-  }
-}
-
-END {
-  if (fail) {
-    print "Unexpected output after exit"
-    exit 1
-  }
-  if (regexp == "")
-    exit 0
-  print "error: " expected " doesn't match"
-  exit 1
-}
diff --git a/tests/uid.c b/tests/uid.c
deleted file mode 100644
index 5da0471..0000000
--- a/tests/uid.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "tests.h"
-#include <sys/syscall.h>
-
-#if (defined __NR_getuid || defined __NR_getxuid) \
- && defined(__NR_setuid) \
- && defined(__NR_getresuid) \
- && defined(__NR_setreuid) \
- && defined(__NR_setresuid) \
- && defined(__NR_fchown) \
- && defined(__NR_getgroups)
-
-# include <assert.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <fcntl.h>
-
-int
-main(void)
-{
-	int uid;
-	int size;
-	int *list = 0;
-
-# ifndef __NR_getuid
-#  define __NR_getuid __NR_getxuid
-# endif
-	uid = syscall(__NR_getuid);
-
-	(void) close(0);
-	if (open("/proc/sys/kernel/overflowuid", O_RDONLY) == 0) {
-		/* we trust the kernel */
-		char buf[sizeof(int)*3];
-		int n = read(0, buf, sizeof(buf) - 1);
-		if (n) {
-			buf[n] = '\0';
-			n = atoi(buf);
-			if (uid == n)
-				error_msg_and_skip("getuid() == overflowuid");
-		}
-		(void) close(0);
-	}
-
-	assert(syscall(__NR_setuid, uid) == 0);
-	{
-		/*
-		 * uids returned by getresuid should be ignored
-		 * to avoid 16bit vs 32bit issues.
-		 */
-		int r, e, s;
-		assert(syscall(__NR_getresuid, &r, &e, &s) == 0);
-	}
-	assert(syscall(__NR_setreuid, -1, -1L) == 0);
-	assert(syscall(__NR_setresuid, uid, -1, -1L) == 0);
-	assert(syscall(__NR_fchown, 1, -1, -1L) == 0);
-	assert((size = syscall(__NR_getgroups, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups, size, list) == size);
-	return 0;
-}
-
-#else
-
-SKIP_MAIN_UNDEFINED("(__NR_getuid || __NR_getxuid)"
-		    " && __NR_setuid && __NR_getresuid && __NR_setreuid"
-		    " && __NR_setresuid && __NR_fchown && __NR_getgroups")
-
-#endif
diff --git a/tests/uid.test b/tests/uid.test
deleted file mode 100755
index 9c5a97f..0000000
--- a/tests/uid.test
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# Check uid decoding.
-
-. "${srcdir=.}/init.sh"
-
-s="${uid_syscall_suffix-}"
-w="${uid_t_size-}"
-
-run_prog ./uid$s$w
-
-case "$STRACE_ARCH" in
-	alpha) getuid=getxuid ;;
-	*) getuid=getuid ;;
-esac
-
-syscalls="$getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s"
-run_strace -e trace="$syscalls" $args
-
-AWK=gawk
-match_awk "$LOG" "$srcdir"/uid.awk "$STRACE $args output mismatch" -v suffix="$s"
-
-exit 0
diff --git a/tests/uid16.c b/tests/uid16.c
deleted file mode 100644
index 04bf8a3..0000000
--- a/tests/uid16.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "tests.h"
-#include <sys/syscall.h>
-
-#if defined(__NR_getuid) \
- && defined(__NR_setuid) \
- && defined(__NR_getresuid) \
- && defined(__NR_setreuid) \
- && defined(__NR_setresuid) \
- && defined(__NR_fchown) \
- && defined(__NR_getgroups) \
- \
- && defined(__NR_getuid32) \
- && defined(__NR_setuid32) \
- && defined(__NR_getresuid32) \
- && defined(__NR_setreuid32) \
- && defined(__NR_setresuid32) \
- && defined(__NR_fchown32) \
- && defined(__NR_getgroups32) \
- \
- && __NR_getuid != __NR_getuid32 \
- && __NR_setuid != __NR_setuid32 \
- && __NR_getresuid != __NR_getresuid32 \
- && __NR_setreuid != __NR_setreuid32 \
- && __NR_setresuid != __NR_setresuid32 \
- && __NR_fchown != __NR_fchown32 \
- && __NR_getgroups != __NR_getgroups32 \
- /**/
-
-# include <assert.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <fcntl.h>
-
-int
-main(void)
-{
-	int uid;
-	int size;
-	int *list = 0;
-
-	uid = syscall(__NR_getuid);
-
-	(void) close(0);
-	if (open("/proc/sys/kernel/overflowuid", O_RDONLY) == 0) {
-		/* we trust the kernel */
-		char buf[sizeof(int)*3];
-		int n = read(0, buf, sizeof(buf) - 1);
-		if (n) {
-			buf[n] = '\0';
-			n = atoi(buf);
-			if (uid == n)
-				error_msg_and_skip("getuid() == overflowuid");
-		}
-		close(0);
-	}
-
-	assert(syscall(__NR_setuid, uid) == 0);
-	{
-		/*
-		 * uids returned by getresuid should be ignored
-		 * to avoid 16bit vs 32bit issues.
-		 */
-		int r, e, s;
-		assert(syscall(__NR_getresuid, &r, &e, &s) == 0);
-	}
-	assert(syscall(__NR_setreuid, -1, 0xffff) == 0);
-	assert(syscall(__NR_setresuid, uid, -1, 0xffff) == 0);
-	assert(syscall(__NR_fchown, 1, -1, 0xffff) == 0);
-	assert((size = syscall(__NR_getgroups, 0, list)) >= 0);
-	assert(list = calloc(size + 1, sizeof(*list)));
-	assert(syscall(__NR_getgroups, size, list) == size);
-	return 0;
-}
-
-#else
-
-SKIP_MAIN_UNDEFINED("__NR_getuid && __NR_setuid && __NR_getresuid"
-		    " && __NR_setreuid && __NR_setresuid"
-		    " && __NR_fchown && __NR_getgroups"
-		    " && __NR_getuid32 && __NR_setuid32 && __NR_getresuid32"
-		    " && __NR_setreuid32 && __NR_setresuid32"
-		    " && __NR_fchown32 && __NR_getgroups32")
-
-#endif
diff --git a/tests/uid16.test b/tests/uid16.test
deleted file mode 100755
index b9da79d..0000000
--- a/tests/uid16.test
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Check uid16_t decoding.
-
-uid_t_size=16
-
-. "${srcdir=.}/uid.test"
diff --git a/tests/uid32.test b/tests/uid32.test
deleted file mode 100755
index 82ba9b7..0000000
--- a/tests/uid32.test
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-# Check uid32 decoding.
-
-uid_syscall_suffix=32
-
-. "${srcdir=.}/uid.test"
diff --git a/tests/umount.c b/tests/umount.c
index 9ad8828..cc382fe 100644
--- a/tests/umount.c
+++ b/tests/umount.c
@@ -26,12 +26,11 @@
  */
 
 #include "tests.h"
-#include <errno.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
 #include <sys/syscall.h>
+#include <unistd.h>
 
 #ifdef __NR_oldumount
 # define TEST_SYSCALL_STR "oldumount"
@@ -48,24 +47,16 @@
 main(void)
 {
 	static const char sample[] = "umount.sample";
-	const char *errno_text;
 	if (mkdir(sample, 0700))
 		perror_msg_and_fail("mkdir: %s", sample);
-	(void) syscall(__NR_oldumount, sample);
-	switch (errno) {
-		case ENOSYS:
-			errno_text = "ENOSYS";
-			break;
-		case EPERM:
-			errno_text = "EPERM";
-			break;
-		default:
-			errno_text = "EINVAL";
-	}
-	printf("%s(\"%s\") = -1 %s (%m)\n",
-	       TEST_SYSCALL_STR, sample, errno_text);
+
+	long rc = syscall(__NR_oldumount, sample);
+	printf("%s(\"%s\") = %ld %s (%m)\n",
+	       TEST_SYSCALL_STR, sample, rc, errno2name());
+
 	if (rmdir(sample))
 		perror_msg_and_fail("rmdir: %s", sample);
+
 	puts("+++ exited with 0 +++");
 	return 0;
 }
diff --git a/tests/umovestr3.c b/tests/umovestr3.c
new file mode 100644
index 0000000..cf2fa7d
--- /dev/null
+++ b/tests/umovestr3.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/param.h>
+
+int
+main(void)
+{
+	const unsigned int size = PATH_MAX - 1;
+	const char *p = tail_alloc(size);
+	const char *const efault = p + size;
+
+	for (; p <= efault; ++p) {
+		int rc = chdir(p);
+		printf("chdir(%p) = %d %s (%m)\n", p, rc, errno2name());
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/umovestr3.test b/tests/umovestr3.test
new file mode 100755
index 0000000..d5be283
--- /dev/null
+++ b/tests/umovestr3.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# yet another umovestr short read test
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14 -e trace=chdir
diff --git a/tests/unlink.c b/tests/unlink.c
new file mode 100644
index 0000000..f5a1a1a
--- /dev/null
+++ b/tests/unlink.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_unlink
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	static const char sample[] = "unlink_sample";
+
+	long rc = syscall(__NR_unlink, sample);
+	printf("unlink(\"%s\") = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_unlink")
+
+#endif
diff --git a/tests/unlink.test b/tests/unlink.test
new file mode 100755
index 0000000..09bf79a
--- /dev/null
+++ b/tests/unlink.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check unlink syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a24
diff --git a/tests/unlinkat.c b/tests/unlinkat.c
index 2a268a2..29eeb19 100644
--- a/tests/unlinkat.c
+++ b/tests/unlinkat.c
@@ -3,7 +3,6 @@
 
 #ifdef __NR_unlinkat
 
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -13,17 +12,16 @@
 	static const char sample[] = "unlinkat_sample";
 	const long fd = (long) 0xdeadbeefffffffff;
 
-	int rc = syscall(__NR_unlinkat, fd, sample, 0);
-	printf("unlinkat(%d, \"%s\", 0) = %d %s (%m)\n",
-	       (int) fd, sample, rc,
-	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+	long rc = syscall(__NR_unlinkat, fd, sample, 0);
+	printf("unlinkat(%d, \"%s\", 0) = %ld %s (%m)\n",
+	       (int) fd, sample, rc, errno2name());
 
 	rc = syscall(__NR_unlinkat, -100, sample, -1L);
-	printf("unlinkat(%s, \"%s\", %s) = %d %s (%m)\n",
+	printf("unlinkat(%s, \"%s\", %s) = %ld %s (%m)\n",
 	       "AT_FDCWD", sample,
 	       "AT_SYMLINK_NOFOLLOW|AT_REMOVEDIR|AT_SYMLINK_FOLLOW"
 	       "|AT_NO_AUTOMOUNT|AT_EMPTY_PATH|0xffffe0ff",
-	       rc, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	       rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/userfaultfd.c b/tests/userfaultfd.c
index 5dc294b..5747a2a 100644
--- a/tests/userfaultfd.c
+++ b/tests/userfaultfd.c
@@ -31,17 +31,15 @@
 
 #if defined __NR_userfaultfd && defined O_CLOEXEC
 
-# include <assert.h>
-# include <errno.h>
 # include <stdio.h>
 # include <unistd.h>
 
 int
 main(void)
 {
-	assert(syscall(__NR_userfaultfd, 1 | O_NONBLOCK | O_CLOEXEC) == -1);
-	printf("userfaultfd(O_NONBLOCK|O_CLOEXEC|0x1) = -1 %s (%m)\n",
-	       errno == ENOSYS ? "ENOSYS" : "EINVAL");
+	long rc = syscall(__NR_userfaultfd, 1 | O_NONBLOCK | O_CLOEXEC);
+	printf("userfaultfd(O_NONBLOCK|O_CLOEXEC|0x1) = %ld %s (%m)\n",
+	       rc, errno2name());
 	puts("+++ exited with 0 +++");
 	return 0;
 }
diff --git a/tests/utimes.c b/tests/utimes.c
new file mode 100644
index 0000000..e9fe931
--- /dev/null
+++ b/tests/utimes.c
@@ -0,0 +1,83 @@
+/*
+ * Check decoding of utimes syscall.
+ *
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_utimes
+
+# include <stdio.h>
+# include <sys/time.h>
+# include <unistd.h>
+
+#define CAST_NUM(n)						\
+	(sizeof(n) == sizeof(long) ?				\
+		(unsigned long long) (unsigned long) (n) :	\
+		(unsigned long long) (n))
+
+int
+main(void)
+{
+	struct timeval tv;
+	if (gettimeofday(&tv, NULL))
+		perror_msg_and_fail("gettimeofday");
+
+	static const char sample[] = "utimes_sample";
+
+	long rc = syscall(__NR_utimes, sample, 0);
+	printf("utimes(\"%s\", NULL) = %ld %s (%m)\n",
+	       sample, rc, errno2name());
+
+	struct timeval *const ts = tail_alloc(sizeof(*ts) * 2);
+
+	rc = syscall(__NR_utimes, 0, ts + 1);
+	printf("utimes(NULL, %p) = %ld %s (%m)\n",
+	       ts + 1, rc, errno2name());
+
+	ts[0].tv_sec = tv.tv_sec;
+	ts[0].tv_usec = tv.tv_usec;
+	ts[1].tv_sec = tv.tv_sec - 1;
+	ts[1].tv_usec = tv.tv_usec + 1;
+
+	rc = syscall(__NR_utimes, "", ts);
+	printf("utimes(\"\", [{%llu, %llu}, {%llu, %llu}])"
+	       " = %ld %s (%m)\n",
+	       CAST_NUM(ts[0].tv_sec), CAST_NUM(ts[0].tv_usec),
+	       CAST_NUM(ts[1].tv_sec), CAST_NUM(ts[1].tv_usec),
+	       rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_utimes")
+
+#endif
diff --git a/tests/utimes.test b/tests/utimes.test
new file mode 100755
index 0000000..99143a0
--- /dev/null
+++ b/tests/utimes.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check utimes syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a21
diff --git a/tests/vhangup.c b/tests/vhangup.c
new file mode 100644
index 0000000..ba90319
--- /dev/null
+++ b/tests/vhangup.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_vhangup
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	if (setsid() == -1)
+		perror_msg_and_skip("setsid");
+
+	long rc = syscall(__NR_vhangup);
+	printf("vhangup() = %ld %s (%m)\n", rc, errno2name());
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_vhangup")
+
+#endif
diff --git a/tests/vhangup.test b/tests/vhangup.test
new file mode 100755
index 0000000..8fe1cac
--- /dev/null
+++ b/tests/vhangup.test
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Check vhangup syscall decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_strace_match_diff -a10
diff --git a/tests/xattr.c b/tests/xattr.c
index 7ae13c0..e72436c 100644
--- a/tests/xattr.c
+++ b/tests/xattr.c
@@ -29,17 +29,115 @@
 
 #ifdef HAVE_SYS_XATTR_H
 
+# include <assert.h>
+# include <stdio.h>
 # include <sys/xattr.h>
 
+# ifndef XATTR_SIZE_MAX
+#  define XATTR_SIZE_MAX 65536
+# endif
+
 int
 main(void)
 {
-#define NAME "strace.test"
-#define VALUE "foo\0bar"
-	if (!removexattr(".", NAME))
-		error_msg_and_skip("removexattr: error expected");
-	if (!setxattr(".", NAME, VALUE, sizeof(VALUE), XATTR_CREATE))
-		error_msg_and_skip("setxattr: error expected");
+	static const char name[] = "strace.test";
+	static const char c_value[] = "foo\0bar";
+	static const char q_value[] = "foo\\0bar";
+
+	const char *const z_value = tail_memdup(c_value, sizeof(c_value));
+	char *const efault = tail_alloc(1) + 1;
+	const char *const value = tail_memdup(c_value, sizeof(c_value) - 1);
+	char *const big = tail_alloc(XATTR_SIZE_MAX + 1);
+
+	assert(fsetxattr(-1, 0, 0, 0, XATTR_CREATE) == -1);
+	printf("fsetxattr(-1, NULL, NULL, 0, XATTR_CREATE) = -1 %s (%m)\n",
+	       errno2name());
+
+	assert(fsetxattr(-1, 0, z_value, 0, XATTR_CREATE) == -1);
+	printf("fsetxattr(-1, NULL, \"\", 0, XATTR_CREATE) = -1 %s (%m)\n",
+	       errno2name());
+
+	assert(fsetxattr(-1, name, big, XATTR_SIZE_MAX + 1, XATTR_CREATE) == -1);
+	printf("fsetxattr(-1, \"%s\", %p, %u, XATTR_CREATE)"
+	       " = -1 %s (%m)\n",
+	       name, big, XATTR_SIZE_MAX + 1, errno2name());
+
+	assert(fsetxattr(-1, name, value, sizeof(c_value), XATTR_CREATE) == -1);
+	printf("fsetxattr(-1, \"%s\", %p, %u, XATTR_CREATE)"
+	       " = -1 %s (%m)\n",
+	       name, value, (unsigned) sizeof(c_value), errno2name());
+
+	assert(fsetxattr(-1, name, z_value, sizeof(c_value), XATTR_REPLACE) == -1);
+	printf("fsetxattr(-1, \"%s\", \"%s\", %u, XATTR_REPLACE)"
+	       " = -1 %s (%m)\n",
+	       name, q_value, (unsigned) sizeof(c_value), errno2name());
+
+	assert(fsetxattr(-1, name, value, sizeof(c_value) - 1, XATTR_CREATE|XATTR_REPLACE) == -1);
+	printf("fsetxattr(-1, \"%s\", \"%s\", %u, XATTR_CREATE|XATTR_REPLACE)"
+	       " = -1 %s (%m)\n",
+	       name, q_value, (unsigned) sizeof(c_value) - 1, errno2name());
+
+	assert(setxattr(".", name, z_value, sizeof(c_value), XATTR_CREATE) == -1);
+	printf("setxattr(\".\", \"%s\", \"%s\", %u, XATTR_CREATE)"
+	       " = -1 %s (%m)\n",
+	       name, q_value, (unsigned) sizeof(c_value), errno2name());
+
+	assert(lsetxattr(".", name, value, sizeof(c_value) - 1, XATTR_CREATE) == -1);
+	printf("lsetxattr(\".\", \"%s\", \"%s\", %u, XATTR_CREATE)"
+	       " = -1 %s (%m)\n",
+	       name, q_value, (unsigned) sizeof(c_value) - 1, errno2name());
+
+	assert(fgetxattr(-1, name, efault, 4) == -1);
+	printf("fgetxattr(-1, \"%s\", %p, 4) = -1 %s (%m)\n",
+	       name, efault, errno2name());
+
+	assert(getxattr(".", name, big, XATTR_SIZE_MAX + 1) == -1);
+	printf("getxattr(\".\", \"%s\", %p, %u) = -1 %s (%m)\n",
+	       name, big, XATTR_SIZE_MAX + 1, errno2name());
+
+	assert(lgetxattr(".", name, big + 1, XATTR_SIZE_MAX) == -1);
+	printf("lgetxattr(\".\", \"%s\", %p, %u) = -1 %s (%m)\n",
+	       name, big + 1, XATTR_SIZE_MAX, errno2name());
+
+	assert(flistxattr(-1, efault, 4) == -1);
+	printf("flistxattr(-1, %p, 4) = -1 %s (%m)\n",
+	       efault, errno2name());
+
+	assert(llistxattr("", efault + 1, 4) == -1);
+	printf("llistxattr(\"\", %p, 4) = -1 %s (%m)\n",
+	       efault + 1, errno2name());
+
+	ssize_t rc = listxattr(".", big, 0);
+	if (rc < 0)
+		printf("listxattr(\".\", %p, 0) = -1 %s (%m)\n",
+		       big, errno2name());
+	else
+		printf("listxattr(\".\", %p, 0) = %ld\n",
+		       big, (long) rc);
+
+	rc = listxattr(".", big, XATTR_SIZE_MAX + 1);
+	if (rc < 0)
+		printf("listxattr(\".\", %p, %u) = -1 %s (%m)\n",
+		       big, XATTR_SIZE_MAX + 1, errno2name());
+	else {
+		printf("listxattr(\".\", \"");
+		print_quoted_memory(big, rc);
+		printf("\", %u) = %ld\n", XATTR_SIZE_MAX + 1, (long) rc);
+	}
+
+	assert(fremovexattr(-1, name) == -1);
+	printf("fremovexattr(-1, \"%s\") = -1 %s (%m)\n",
+	       name, errno2name());
+
+	assert(removexattr(".", name) == -1);
+	printf("removexattr(\".\", \"%s\") = -1 %s (%m)\n",
+	       name, errno2name());
+
+	assert(lremovexattr(".", name) == -1);
+	printf("lremovexattr(\".\", \"%s\") = -1 %s (%m)\n",
+	       name, errno2name());
+
+	puts("+++ exited with 0 +++");
 	return 0;
 }
 
diff --git a/tests/xattr.expected b/tests/xattr.expected
deleted file mode 100644
index 0179a17..0000000
--- a/tests/xattr.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-removexattr\("\.", "strace\.test"\) += -1 .*
-setxattr\("\.", "strace\.test", "foo\\0bar", 8, XATTR_CREATE\) += -1 .*
diff --git a/tests/xattr.test b/tests/xattr.test
index 613352b..8c7a87b 100755
--- a/tests/xattr.test
+++ b/tests/xattr.test
@@ -4,8 +4,9 @@
 
 . "${srcdir=.}/init.sh"
 
-run_prog
-run_strace -e removexattr,setxattr $args
-match_grep
+syscalls=
+for n in getxattr setxattr listxattr removexattr; do
+	syscalls="$syscalls,${n},f${n},l${n}"
+done
 
-exit 0
+run_strace_match_diff -a22 -e trace=$syscalls
diff --git a/tests/xchownx.c b/tests/xchownx.c
new file mode 100644
index 0000000..b065675
--- /dev/null
+++ b/tests/xchownx.c
@@ -0,0 +1,171 @@
+/*
+ * Check decoding of chown/chown32/lchown/lchown32/fchown/fchown32 syscalls.
+ *
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#ifdef UGID_TYPE_IS_SHORT
+# define UGID_TYPE	short
+# define GETEUID	syscall(__NR_geteuid)
+# define GETEGID	syscall(__NR_getegid)
+# define CHECK_OVERFLOWUID(arg)	check_overflowuid(arg)
+# define CHECK_OVERFLOWGID(arg)	check_overflowgid(arg)
+#else
+# define UGID_TYPE	int
+# define GETEUID	geteuid()
+# define GETEGID	getegid()
+# define CHECK_OVERFLOWUID(arg)
+# define CHECK_OVERFLOWGID(arg)
+#endif
+
+#define UNLINK_SAMPLE \
+	if (unlink(sample)) perror_msg_and_fail("unlink")
+#define CLOSE_SAMPLE \
+	if (close(fd)) perror_msg_and_fail("close")
+
+#ifdef ACCESS_BY_DESCRIPTOR
+# define SYSCALL_ARG1 fd
+# define FMT_ARG1 "%d"
+# define EOK_CMD CLOSE_SAMPLE
+# define CLEANUP_CMD UNLINK_SAMPLE
+#else
+# define SYSCALL_ARG1 sample
+# define FMT_ARG1 "\"%s\""
+# define EOK_CMD UNLINK_SAMPLE
+# define CLEANUP_CMD CLOSE_SAMPLE
+#endif
+
+static int
+ugid2int(const unsigned UGID_TYPE id)
+{
+	if ((unsigned UGID_TYPE) -1U == id)
+		return -1;
+	else
+		return id;
+}
+
+static void
+print_int(const unsigned int num)
+{
+	if (num == -1U)
+		printf(", -1");
+	else
+		printf(", %u", num);
+}
+
+static int
+num_matches_id(const unsigned int num, const unsigned int id)
+{
+	return num == id || num == -1U;
+}
+
+#define PAIR(val)	{ val, gid }, { uid, val }
+
+int
+main(void)
+{
+	static const char sample[] = SYSCALL_NAME "_sample";
+
+	unsigned int uid = GETEUID;
+	CHECK_OVERFLOWUID(uid);
+	unsigned int gid = GETEGID;
+	CHECK_OVERFLOWUID(gid);
+
+	const struct {
+		const long uid, gid;
+	} tests[] = {
+		{ uid, gid },
+		{ (unsigned long) 0xffffffff00000000ULL | uid, gid },
+		{ uid, (unsigned long) 0xffffffff00000000ULL | gid },
+		PAIR(-1U),
+		PAIR(-1L),
+		{ 0xffff0000U | uid, gid },
+		{ uid, 0xffff0000U | gid },
+		PAIR(0xffff),
+		PAIR(0xc0deffffU),
+		PAIR(0xfacefeedU),
+		PAIR((long) 0xfacefeeddeadbeefULL)
+	};
+
+	int fd = open(sample, O_RDONLY | O_CREAT, 0400);
+	if (fd < 0)
+		perror_msg_and_fail("open");
+
+	CLEANUP_CMD;
+
+	unsigned int i;
+	long expected = 0;
+
+	for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+		const unsigned int unum = ugid2int(tests[i].uid);
+		const unsigned int gnum = ugid2int(tests[i].gid);
+
+		if (num_matches_id(unum, uid) &&
+		    num_matches_id(gnum, gid)) {
+			if (expected)
+				continue;
+		} else {
+			if (!expected) {
+				expected = -1;
+				EOK_CMD;
+			}
+		}
+
+		const long rc = syscall(SYSCALL_NR, SYSCALL_ARG1,
+					tests[i].uid, tests[i].gid);
+		int saved_errno = errno;
+		if (rc != expected) {
+			if (!i && ENOSYS == errno) {
+				printf("%s(" FMT_ARG1 ", %u, %u)"
+				       " = -1 ENOSYS (%m)\n",
+				       SYSCALL_NAME, SYSCALL_ARG1, uid, gid);
+				break;
+			}
+			perror_msg_and_fail("%s(" FMT_ARG1
+					    ", %#lx, %#lx) != %ld",
+					    SYSCALL_NAME, SYSCALL_ARG1,
+					    tests[i].uid, tests[i].gid,
+					    expected);
+		}
+
+		printf("%s(" FMT_ARG1, SYSCALL_NAME, SYSCALL_ARG1);
+		print_int(unum);
+		print_int(gnum);
+		errno = saved_errno;
+		if (expected)
+			printf(") = %ld %s (%m)\n", expected, errno2name());
+		else
+			printf(") = 0\n");
+	}
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/xetpgid.c b/tests/xetpgid.c
index f6bf640..6ce79c1 100644
--- a/tests/xetpgid.c
+++ b/tests/xetpgid.c
@@ -32,7 +32,6 @@
 
 #if defined __NR_getpgid && defined __NR_setpgid
 
-# include <assert.h>
 # include <stdio.h>
 # include <unistd.h>
 
@@ -40,14 +39,14 @@
 main(void)
 {
 	const int pid = getpid();
-	int rc = syscall(__NR_getpgid,
-			 (unsigned long) 0xffffffff00000000 | pid);
-	printf("getpgid(%d) = %d\n", pid, rc);
+	long rc = syscall(__NR_getpgid,
+			  (unsigned long) 0xffffffff00000000 | pid);
+	printf("getpgid(%d) = %ld\n", pid, rc);
 
 	rc = syscall(__NR_setpgid,
 		     (unsigned long) 0xffffffff00000000,
 		     (unsigned long) 0xffffffff00000000 | pid);
-	printf("setpgid(0, %d) = %d\n", pid, rc);
+	printf("setpgid(0, %d) = %ld\n", pid, rc);
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/xetpriority.c b/tests/xetpriority.c
index aefe5e9..a32b031 100644
--- a/tests/xetpriority.c
+++ b/tests/xetpriority.c
@@ -3,9 +3,7 @@
 
 #if defined __NR_getpriority && defined __NR_setpriority
 
-# include <errno.h>
 # include <stdio.h>
-# include <sys/time.h>
 # include <sys/resource.h>
 # include <unistd.h>
 
@@ -13,19 +11,18 @@
 main(void)
 {
 	const int pid = getpid();
-	int rc = syscall(__NR_getpriority, PRIO_PROCESS,
-	         (unsigned long) 0xffffffff00000000 | pid);
-	printf("getpriority(PRIO_PROCESS, %d) = %d\n",
-	       pid, rc);
+	long rc = syscall(__NR_getpriority, PRIO_PROCESS,
+			  (unsigned long) 0xffffffff00000000 | pid);
+	printf("getpriority(PRIO_PROCESS, %d) = %ld\n", pid, rc);
 
-	if ((syscall(__NR_setpriority, PRIO_PROCESS,
-	    (unsigned long) 0xffffffff00000000 | pid,
-	    (unsigned long) 0xffffffff00000000)) == 0) {
+	rc = syscall(__NR_setpriority, PRIO_PROCESS,
+		     (unsigned long) 0xffffffff00000000 | pid,
+		     (unsigned long) 0xffffffff00000000);
+	if (rc)
+		printf("setpriority(PRIO_PROCESS, %d, 0) = %ld %s (%m)\n",
+		       pid, rc, errno2name());
+	else
 		printf("setpriority(PRIO_PROCESS, %d, 0) = 0\n", pid);
-	} else {
-		printf("setpriority(PRIO_PROCESS, %d, 0) = -1 %s (%m)\n",
-		       pid, errno == EPERM ? "EPERM" : "EACCES");
-	}
 
 	puts("+++ exited with 0 +++");
 	return 0;
diff --git a/tests/xstatfs.c b/tests/xstatfs.c
new file mode 100644
index 0000000..26c43de
--- /dev/null
+++ b/tests/xstatfs.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define SYSCALL_INVOKE(file, desc, ptr, size) \
+	syscall(SYSCALL_NR, SYSCALL_ARG(file, desc), ptr)
+#define PRINT_SYSCALL_HEADER(file, desc, size) \
+	printf("%s(" SYSCALL_ARG_FMT ", ", SYSCALL_NAME, SYSCALL_ARG(file, desc))
+
+#define STRUCT_STATFS	struct statfs
+#ifdef HAVE_STRUCT_STATFS_F_FRSIZE
+# define PRINT_F_FRSIZE
+#endif
+#ifdef HAVE_STRUCT_STATFS_F_FLAGS
+# define PRINT_F_FLAGS
+#endif
+#if defined HAVE_STRUCT_STATFS_F_FSID_VAL
+# define PRINT_F_FSID	f_fsid.val
+#elif defined HAVE_STRUCT_STATFS_F_FSID___VAL
+# define PRINT_F_FSID	f_fsid.__val
+#endif
+
+#include "xstatfsx.c"
diff --git a/tests/xstatfs64.c b/tests/xstatfs64.c
new file mode 100644
index 0000000..8f50de2
--- /dev/null
+++ b/tests/xstatfs64.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define SYSCALL_INVOKE(file, desc, ptr, size) \
+	syscall(SYSCALL_NR, SYSCALL_ARG(file, desc), size, ptr)
+#define PRINT_SYSCALL_HEADER(file, desc, size) \
+	printf("%s(" SYSCALL_ARG_FMT ", %u, ", SYSCALL_NAME, \
+	       SYSCALL_ARG(file, desc), (unsigned) size)
+
+#define STRUCT_STATFS	struct statfs64
+#ifdef HAVE_STRUCT_STATFS64_F_FRSIZE
+# define PRINT_F_FRSIZE
+#endif
+#ifdef HAVE_STRUCT_STATFS64_F_FLAGS
+# define PRINT_F_FLAGS
+#endif
+#if defined HAVE_STRUCT_STATFS64_F_FSID_VAL
+# define PRINT_F_FSID	f_fsid.val
+#elif defined HAVE_STRUCT_STATFS64_F_FSID___VAL
+# define PRINT_F_FSID	f_fsid.__val
+#endif
+#define CHECK_ODD_SIZE
+
+#include "xstatfsx.c"
diff --git a/tests/xstatfsx.c b/tests/xstatfsx.c
new file mode 100644
index 0000000..3561866
--- /dev/null
+++ b/tests/xstatfsx.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <linux/types.h>
+#include <asm/statfs.h>
+
+#include "xlat.h"
+#include "xlat/fsmagic.h"
+#include "xlat/statfs_flags.h"
+
+#define PRINT_NUM(arg)							\
+	if (sizeof(b->arg) == sizeof(int))				\
+		printf(", %s=%u", #arg, (unsigned int) b->arg);		\
+	else if (sizeof(b->arg) == sizeof(long))				\
+		printf(", %s=%lu", #arg, (unsigned long) b->arg);	\
+	else								\
+		printf(", %s=%llu", #arg, (unsigned long long) b->arg)
+
+static void
+print_statfs_type(const char *const prefix, const unsigned int magic)
+{
+	fputs(prefix, stdout);
+	unsigned int i;
+	for (i = 0; i < ARRAY_SIZE(fsmagic); ++i)
+		if (magic == fsmagic[i].val) {
+			fputs(fsmagic[i].str, stdout);
+			return;
+		}
+	printf("%#x", magic);
+}
+
+static void
+print_statfs(const char *const sample, const char *magic_str)
+{
+	int fd = open(sample, O_RDONLY);
+	if (fd < 0)
+		perror_msg_and_fail("open: %s", sample);
+
+	STRUCT_STATFS *const b = tail_alloc(sizeof(*b));
+	long rc = SYSCALL_INVOKE(sample, fd, b, sizeof(*b));
+	if (rc)
+		perror_msg_and_skip(SYSCALL_NAME);
+
+	PRINT_SYSCALL_HEADER(sample, fd, sizeof(*b));
+	if (magic_str)
+		printf("{f_type=%s", magic_str);
+	else
+		print_statfs_type("{f_type=", b->f_type);
+	PRINT_NUM(f_bsize);
+	PRINT_NUM(f_blocks);
+	PRINT_NUM(f_bfree);
+	PRINT_NUM(f_bavail);
+	PRINT_NUM(f_files);
+	PRINT_NUM(f_ffree);
+#ifdef PRINT_F_FSID
+	printf(", f_fsid={%u, %u}",
+	       (unsigned) b->PRINT_F_FSID[0], (unsigned) b->PRINT_F_FSID[1]);
+#endif
+	PRINT_NUM(f_namelen);
+#ifdef PRINT_F_FRSIZE
+	PRINT_NUM(f_frsize);
+#endif
+#ifdef PRINT_F_FLAGS
+	if (b->f_flags & ST_VALID) {
+		printf(", f_flags=");
+		printflags(statfs_flags, b->f_flags, "ST_???");
+	}
+#endif
+	printf("}) = 0\n");
+}
+
+int
+main(void)
+{
+	print_statfs("/proc/self/status", "PROC_SUPER_MAGIC");
+
+	print_statfs(".", NULL);
+
+	long rc = SYSCALL_INVOKE("", -1, 0, sizeof(STRUCT_STATFS));
+	PRINT_SYSCALL_HEADER("", -1, sizeof(STRUCT_STATFS));
+	printf("NULL) = %ld %s (%m)\n", rc, errno2name());
+
+#ifdef CHECK_ODD_SIZE
+	const unsigned long addr = (unsigned long) 0xfacefeeddeadbeef;
+	rc = SYSCALL_INVOKE("", -1, addr, sizeof(STRUCT_STATFS) + 1);
+	PRINT_SYSCALL_HEADER("", -1, sizeof(STRUCT_STATFS) + 1);
+	printf("%#lx) = %ld %s (%m)\n", addr, rc, errno2name());
+#endif
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
diff --git a/tests/xstatx.c b/tests/xstatx.c
index 8694f95..2883f16 100644
--- a/tests/xstatx.c
+++ b/tests/xstatx.c
@@ -40,7 +40,6 @@
 #  error PRINT_SYSCALL_FOOTER must be defined
 # endif
 
-# include <errno.h>
 # include <stdio.h>
 # include <stddef.h>
 # include <time.h>
diff --git a/time.c b/time.c
index c98862d..963d0ea 100644
--- a/time.c
+++ b/time.c
@@ -171,7 +171,7 @@
 {
 	if (print_timex(tcp, addr))
 		return 0;
-	tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
+	tcp->auxstr = xlookup(adjtimex_state, (unsigned long) tcp->u_rval);
 	if (tcp->auxstr)
 		return RVAL_STR;
 	return 0;
@@ -303,18 +303,6 @@
 
 #include "xlat/timerfdflags.h"
 
-SYS_FUNC(timerfd)
-{
-	tprintf("%ld, ", tcp->u_arg[0]);
-	printclockname(tcp->u_arg[0]);
-	tprints(", ");
-	printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
-	tprints(", ");
-	print_itimerspec(tcp, tcp->u_arg[3]);
-
-	return RVAL_DECODED | RVAL_FD;
-}
-
 SYS_FUNC(timerfd_create)
 {
 	printclockname(tcp->u_arg[0]);
diff --git a/times.c b/times.c
index d3f6daf..04df462 100644
--- a/times.c
+++ b/times.c
@@ -46,11 +46,11 @@
 
 	if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
 		tprintf("{tms_utime=%llu, tms_stime=%llu, ",
-			(unsigned long long) tbuf.tms_utime,
-			(unsigned long long) tbuf.tms_stime);
+			widen_to_ull(tbuf.tms_utime),
+			widen_to_ull(tbuf.tms_stime));
 		tprintf("tms_cutime=%llu, tms_cstime=%llu}",
-			(unsigned long long) tbuf.tms_cutime,
-			(unsigned long long) tbuf.tms_cstime);
+			widen_to_ull(tbuf.tms_cutime),
+			widen_to_ull(tbuf.tms_cstime));
 	}
 
 	return syserror(tcp) ? RVAL_DECIMAL :
diff --git a/ubi.c b/ubi.c
new file mode 100644
index 0000000..dfac0be
--- /dev/null
+++ b/ubi.c
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2012 Mike Frysinger <vapier@gentoo.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+#include <linux/ioctl.h>
+
+/* The UBI api changes, so we have to keep a local copy */
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
+# include "ubi-user.h"
+#else
+# include <mtd/ubi-user.h>
+#endif
+
+#include "xlat/ubi_volume_types.h"
+#include "xlat/ubi_volume_props.h"
+
+int
+ubi_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+{
+	if (!verbose(tcp))
+		return RVAL_DECODED;
+
+	switch (code) {
+	case UBI_IOCMKVOL:
+		if (entering(tcp)) {
+			struct ubi_mkvol_req mkvol;
+
+			tprints(", ");
+			if (umove_or_printaddr(tcp, arg, &mkvol))
+				break;
+
+			tprintf("{vol_id=%" PRIi32 ", alignment=%" PRIi32
+				", bytes=%" PRIi64 ", vol_type=", mkvol.vol_id,
+				mkvol.alignment, (int64_t)mkvol.bytes);
+			printxval(ubi_volume_types,
+				    (uint8_t) mkvol.vol_type, "UBI_???_VOLUME");
+			tprintf(", name_len=%" PRIi16 ", name=", mkvol.name_len);
+			if (print_quoted_string(mkvol.name,
+					CLAMP(mkvol.name_len, 0, UBI_MAX_VOLUME_NAME),
+					QUOTE_0_TERMINATED) > 0) {
+				tprints("...");
+			}
+			tprints("}");
+			return 1;
+		}
+		if (!syserror(tcp)) {
+			tprints(" => ");
+			printnum_int(tcp, arg, "%d");
+		}
+		break;
+
+	case UBI_IOCRSVOL: {
+		struct ubi_rsvol_req rsvol;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &rsvol))
+			break;
+
+		tprintf("{vol_id=%" PRIi32 ", bytes=%" PRIi64 "}",
+			rsvol.vol_id, (int64_t)rsvol.bytes);
+		break;
+	}
+
+	case UBI_IOCRNVOL: {
+		struct ubi_rnvol_req rnvol;
+		int c;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &rnvol))
+			break;
+
+		tprintf("{count=%" PRIi32 ", ents=[", rnvol.count);
+		for (c = 0; c < CLAMP(rnvol.count, 0, UBI_MAX_RNVOL); ++c) {
+			if (c)
+				tprints(", ");
+			tprintf("{vol_id=%" PRIi32 ", name_len=%" PRIi16
+				", name=", rnvol.ents[c].vol_id,
+				rnvol.ents[c].name_len);
+			if (print_quoted_string(rnvol.ents[c].name,
+					CLAMP(rnvol.ents[c].name_len, 0, UBI_MAX_VOLUME_NAME),
+					QUOTE_0_TERMINATED) > 0) {
+				tprints("...");
+			}
+			tprints("}");
+		}
+		tprints("]}");
+		break;
+	}
+
+	case UBI_IOCEBCH: {
+		struct ubi_leb_change_req leb;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &leb))
+			break;
+
+		tprintf("{lnum=%d, bytes=%d}", leb.lnum, leb.bytes);
+		break;
+	}
+
+	case UBI_IOCATT:
+		if (entering(tcp)) {
+			struct ubi_attach_req attach;
+
+			tprints(", ");
+			if (umove_or_printaddr(tcp, arg, &attach))
+				break;
+
+			tprintf("{ubi_num=%" PRIi32 ", mtd_num=%" PRIi32
+				", vid_hdr_offset=%" PRIi32
+				", max_beb_per1024=%" PRIi16 "}",
+				attach.ubi_num, attach.mtd_num,
+				attach.vid_hdr_offset, attach.max_beb_per1024);
+			return 1;
+		}
+		if (!syserror(tcp)) {
+			tprints(" => ");
+			printnum_int(tcp, arg, "%d");
+		}
+		break;
+
+	case UBI_IOCEBMAP: {
+		struct ubi_map_req map;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &map))
+			break;
+
+		tprintf("{lnum=%" PRIi32 ", dtype=%" PRIi8 "}",
+			map.lnum, map.dtype);
+		break;
+	}
+
+	case UBI_IOCSETVOLPROP: {
+		struct ubi_set_vol_prop_req prop;
+
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &prop))
+			break;
+
+		tprints("{property=");
+		printxval(ubi_volume_props, prop.property, "UBI_VOL_PROP_???");
+		tprintf(", value=%#" PRIx64 "}", (uint64_t)prop.value);
+		break;
+	}
+
+
+	case UBI_IOCVOLUP:
+		tprints(", ");
+		printnum_int64(tcp, arg, "%" PRIi64);
+		break;
+
+	case UBI_IOCDET:
+	case UBI_IOCEBER:
+	case UBI_IOCEBISMAP:
+	case UBI_IOCEBUNMAP:
+	case UBI_IOCRMVOL:
+		tprints(", ");
+		printnum_int(tcp, arg, "%d");
+		break;
+
+#ifdef UBI_IOCVOLCRBLK
+	case UBI_IOCVOLCRBLK:
+#endif
+#ifdef UBI_IOCVOLRMBLK
+	case UBI_IOCVOLRMBLK:
+#endif
+		/* no arguments */
+		break;
+
+	default:
+		return RVAL_DECODED;
+	}
+
+	return RVAL_DECODED | 1;
+}
diff --git a/uid.c b/uid.c
index c872392..67e8e58 100644
--- a/uid.c
+++ b/uid.c
@@ -3,7 +3,7 @@
  * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
  * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
- * Copyright (c) 2003-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2003-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -75,8 +75,7 @@
 
 SYS_FUNC(setfsuid)
 {
-	if (entering(tcp))
-		tprintf("%u", (uid_t) tcp->u_arg[0]);
+	tprintf("%u", (uid_t) tcp->u_arg[0]);
 
 	return RVAL_UDECIMAL | RVAL_DECODED;
 }
@@ -148,117 +147,52 @@
 void
 printuid(const char *text, const unsigned int uid)
 {
-	if ((unsigned int) -1 == uid || (uid_t) -1 == uid)
+	if ((uid_t) -1U == (uid_t) uid)
 		tprintf("%s-1", text);
 	else
-		tprintf("%s%u", text, uid);
+		tprintf("%s%u", text, (uid_t) uid);
+}
+
+static bool
+print_gid(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	tprintf("%u", (unsigned int) (* (uid_t *) elem_buf));
+
+	return true;
+}
+
+static void
+print_groups(struct tcb *tcp, const unsigned int len, const unsigned long addr)
+{
+	static unsigned long ngroups_max;
+	if (!ngroups_max)
+		ngroups_max = sysconf(_SC_NGROUPS_MAX);
+
+	if (len > ngroups_max) {
+		printaddr(addr);
+		return;
+	}
+
+	uid_t gid;
+	print_array(tcp, addr, len, &gid, sizeof(gid),
+		    umoven_or_printaddr, print_gid, 0);
 }
 
 SYS_FUNC(setgroups)
 {
-	unsigned long cur, abbrev_end;
-	uid_t gid;
-	int failed = 0;
-	const unsigned long len = tcp->u_arg[0];
-	const unsigned long start = tcp->u_arg[1];
-	const unsigned long size = len * sizeof(gid);
-	const unsigned long end = start + size;
+	const unsigned int len = tcp->u_arg[0];
 
-	tprintf("%lu, ", len);
-	if (len == 0) {
-		tprints("[]");
-		return RVAL_DECODED;
-	}
-	if (!start || !verbose(tcp) ||
-	    size / sizeof(gid) != len || end < start) {
-		printaddr(start);
-		return RVAL_DECODED;
-	}
-	if (abbrev(tcp)) {
-		abbrev_end = start + max_strlen * sizeof(gid);
-		if (abbrev_end < start)
-			abbrev_end = end;
-	} else {
-		abbrev_end = end;
-	}
-	tprints("[");
-	for (cur = start; cur < end; cur += sizeof(gid)) {
-		if (cur > start)
-			tprints(", ");
-		if (cur >= abbrev_end) {
-			tprints("...");
-			break;
-		}
-		if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
-			tprints("?");
-			failed = 1;
-			break;
-		}
-		tprintf("%u", (unsigned int) gid);
-	}
-	tprints("]");
-	if (failed) {
-		tprints(" ");
-		printaddr(start);
-	}
-
+	tprintf("%u, ", len);
+	print_groups(tcp, len, tcp->u_arg[1]);
 	return RVAL_DECODED;
 }
 
 SYS_FUNC(getgroups)
 {
-	if (entering(tcp)) {
-		tprintf("%lu, ", tcp->u_arg[0]);
-	} else {
-		unsigned long cur, abbrev_end;
-		uid_t gid;
-		int failed = 0;
-		const unsigned long len = tcp->u_rval;
-		const unsigned long size = len * sizeof(gid);
-		const unsigned long start = tcp->u_arg[1];
-		const unsigned long end = start + size;
-
-		if (!start) {
-			printaddr(start);
-			return 0;
-		}
-		if (len == 0) {
-			tprints("[]");
-			return 0;
-		}
-		if (!verbose(tcp) || syserror(tcp) ||
-		    size / sizeof(gid) != len || end < start) {
-			printaddr(start);
-			return 0;
-		}
-		if (abbrev(tcp)) {
-			abbrev_end = start + max_strlen * sizeof(gid);
-			if (abbrev_end < start)
-				abbrev_end = end;
-		} else {
-			abbrev_end = end;
-		}
-		tprints("[");
-		for (cur = start; cur < end; cur += sizeof(gid)) {
-			if (cur > start)
-				tprints(", ");
-			if (cur >= abbrev_end) {
-				tprints("...");
-				break;
-			}
-			if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
-				tprints("?");
-				failed = 1;
-				break;
-			}
-			tprintf("%u", (unsigned int) gid);
-		}
-		tprints("]");
-		if (failed) {
-			tprints(" ");
-			printaddr(start);
-		}
-	}
+	if (entering(tcp))
+		tprintf("%u, ", (unsigned int) tcp->u_arg[0]);
+	else
+		print_groups(tcp, tcp->u_rval, tcp->u_arg[1]);
 	return 0;
 }
 
diff --git a/userfaultfd.c b/userfaultfd.c
index 15f825a..2721105 100644
--- a/userfaultfd.c
+++ b/userfaultfd.c
@@ -36,3 +36,123 @@
 
 	return RVAL_DECODED | RVAL_FD;
 }
+
+#ifdef HAVE_LINUX_USERFAULTFD_H
+# include <linux/ioctl.h>
+# include <linux/userfaultfd.h>
+
+# include "xlat/uffd_api_flags.h"
+# include "xlat/uffd_copy_flags.h"
+# include "xlat/uffd_register_ioctl_flags.h"
+# include "xlat/uffd_register_mode_flags.h"
+# include "xlat/uffd_zeropage_flags.h"
+
+static void
+tprintf_uffdio_range(const struct uffdio_range *range)
+{
+	tprintf("{start=%#" PRI__x64 ", len=%#" PRI__x64 "}",
+		range->start, range->len);
+}
+
+int
+uffdio_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
+{
+	switch (code) {
+	case UFFDIO_API: {
+		struct uffdio_api ua;
+		if (entering(tcp)) {
+			tprints(", ");
+			if (umove_or_printaddr(tcp, arg, &ua))
+				return RVAL_DECODED | 1;
+			/* Features is intended to contain some flags, but
+			 * there aren't any defined yet.
+			 */
+			tprintf("{api=%#" PRI__x64
+				", features=%#" PRI__x64,
+				ua.api, ua.features);
+		} else {
+			if (!syserror(tcp) && !umove(tcp, arg, &ua)) {
+				tprintf(", features.out=%#" PRI__x64
+					", ioctls=", ua.features);
+				printflags64(uffd_api_flags, ua.ioctls,
+					     "_UFFDIO_???");
+			}
+			tprintf("}");
+		}
+		return 1;
+	}
+
+	case UFFDIO_COPY: {
+		struct uffdio_copy uc;
+		if (entering(tcp)) {
+			tprints(", ");
+			if (umove_or_printaddr(tcp, arg, &uc))
+				return RVAL_DECODED | 1;
+			tprintf("{dst=%#" PRI__x64 ", src=%#" PRI__x64
+				", len=%#" PRI__x64 ", mode=",
+				uc.dst, uc.src, uc.len);
+			printflags64(uffd_copy_flags, uc.mode,
+				     "UFFDIO_COPY_???");
+		} else {
+			if (!syserror(tcp) && !umove(tcp, arg, &uc))
+				tprintf(", copy=%#" PRI__x64, uc.copy);
+			tprints("}");
+		}
+		return 1;
+	}
+
+	case UFFDIO_REGISTER: {
+		struct uffdio_register ur;
+		if (entering(tcp)) {
+			tprints(", ");
+			if (umove_or_printaddr(tcp, arg, &ur))
+				return RVAL_DECODED | 1;
+			tprintf("{range=");
+			tprintf_uffdio_range(&ur.range);
+			tprintf(", mode=");
+			printflags64(uffd_register_mode_flags, ur.mode,
+				     "UFFDIO_REGISTER_MODE_???");
+		} else {
+			if (!syserror(tcp) && !umove(tcp, arg, &ur)) {
+				tprintf(", ioctls=");
+				printflags64(uffd_register_ioctl_flags,
+					     ur.ioctls, "UFFDIO_???");
+			}
+			tprints("}");
+		}
+		return 1;
+	}
+
+	case UFFDIO_UNREGISTER:
+	case UFFDIO_WAKE: {
+		struct uffdio_range ura;
+		tprints(", ");
+		if (!umove_or_printaddr(tcp, arg, &ura))
+			tprintf_uffdio_range(&ura);
+		return RVAL_DECODED | 1;
+	}
+
+	case UFFDIO_ZEROPAGE: {
+		struct uffdio_zeropage uz;
+		if (entering(tcp)) {
+			tprints(", ");
+			if (umove_or_printaddr(tcp, arg, &uz))
+				return RVAL_DECODED | 1;
+			tprintf("{range=");
+			tprintf_uffdio_range(&uz.range);
+			tprintf(", mode=");
+			printflags64(uffd_zeropage_flags, uz.mode,
+				     "UFFDIO_ZEROPAGE_???");
+		} else {
+			if (!syserror(tcp) && !umove(tcp, arg, &uz))
+				tprintf(", zeropage=%#" PRI__x64, uz.zeropage);
+			tprints("}");
+		}
+		return 1;
+	}
+
+	default:
+		return RVAL_DECODED;
+	}
+}
+#endif /* HAVE_LINUX_USERFAULTFD_H */
diff --git a/util.c b/util.c
index 1e5aecc..9c8c978 100644
--- a/util.c
+++ b/util.c
@@ -121,7 +121,7 @@
 }
 
 const char *
-xlookup(const struct xlat *xlat, const unsigned int val)
+xlookup(const struct xlat *xlat, const uint64_t val)
 {
 	for (; xlat->str != NULL; xlat++)
 		if (xlat->val == val)
@@ -132,16 +132,16 @@
 static int
 xlat_bsearch_compare(const void *a, const void *b)
 {
-	const unsigned int val1 = (const unsigned long) a;
-	const unsigned int val2 = ((const struct xlat *) b)->val;
+	const uint64_t val1 = *(const uint64_t *) a;
+	const uint64_t val2 = ((const struct xlat *) b)->val;
 	return (val1 > val2) ? 1 : (val1 < val2) ? -1 : 0;
 }
 
 const char *
-xlat_search(const struct xlat *xlat, const size_t nmemb, const unsigned int val)
+xlat_search(const struct xlat *xlat, const size_t nmemb, const uint64_t val)
 {
 	const struct xlat *e =
-		bsearch((const void*) (const unsigned long) val,
+		bsearch((const void*) &val,
 			xlat, nmemb, sizeof(*xlat), xlat_bsearch_compare);
 
 	return e ? e->str : NULL;
@@ -208,7 +208,7 @@
  * Print entry in struct xlat table, if there.
  */
 void
-printxvals(const unsigned int val, const char *dflt, const struct xlat *xlat, ...)
+printxvals(const uint64_t val, const char *dflt, const struct xlat *xlat, ...)
 {
 	va_list args;
 
@@ -223,7 +223,7 @@
 		}
 	}
 	/* No hits -- print raw # instead. */
-	tprintf("%#x /* %s */", val, dflt);
+	tprintf("%#" PRIx64 " /* %s */", val, dflt);
 
 	va_end(args);
 }
@@ -303,7 +303,7 @@
  * return # of flags printed.
  */
 void
-addflags(const struct xlat *xlat, int flags)
+addflags(const struct xlat *xlat, uint64_t flags)
 {
 	for (; xlat->str; xlat++) {
 		if (xlat->val && (flags & xlat->val) == xlat->val) {
@@ -312,7 +312,7 @@
 		}
 	}
 	if (flags) {
-		tprintf("|%#x", flags);
+		tprintf("|%#" PRIx64, flags);
 	}
 }
 
@@ -322,7 +322,7 @@
  * Return static string.
  */
 const char *
-sprintflags(const char *prefix, const struct xlat *xlat, int flags)
+sprintflags(const char *prefix, const struct xlat *xlat, uint64_t flags)
 {
 	static char outstr[1024];
 	char *outptr;
@@ -349,14 +349,14 @@
 	if (flags) {
 		if (found)
 			*outptr++ = '|';
-		outptr += sprintf(outptr, "%#x", flags);
+		outptr += sprintf(outptr, "%#" PRIx64, flags);
 	}
 
 	return outstr;
 }
 
 int
-printflags(const struct xlat *xlat, int flags, const char *dflt)
+printflags64(const struct xlat *xlat, uint64_t flags, const char *dflt)
 {
 	int n;
 	const char *sep;
@@ -378,12 +378,12 @@
 
 	if (n) {
 		if (flags) {
-			tprintf("%s%#x", sep, flags);
+			tprintf("%s%#" PRIx64, sep, flags);
 			n++;
 		}
 	} else {
 		if (flags) {
-			tprintf("%#x", flags);
+			tprintf("%#" PRIx64, flags);
 			if (dflt)
 				tprintf(" /* %s */", dflt);
 		} else {
@@ -1143,37 +1143,6 @@
 	return 0;
 }
 
-int
-umove_ulong_or_printaddr(struct tcb *tcp, const long addr, unsigned long *ptr)
-{
-	if (current_wordsize < sizeof(*ptr)) {
-		uint32_t val32;
-		int r = umove_or_printaddr(tcp, addr, &val32);
-		if (!r)
-			*ptr = (unsigned long) val32;
-		return r;
-	}
-	return umove_or_printaddr(tcp, addr, ptr);
-}
-
-int
-umove_ulong_array_or_printaddr(struct tcb *tcp, const long addr,
-			       unsigned long *ptr, size_t n)
-{
-	if (current_wordsize < sizeof(*ptr)) {
-		uint32_t ptr32[n];
-		int r = umove_or_printaddr(tcp, addr, &ptr32);
-		if (!r) {
-			size_t i;
-
-			for (i = 0; i < n; ++i)
-				ptr[i] = (unsigned long) ptr32[i];
-		}
-		return r;
-	}
-	return umoven_or_printaddr(tcp, addr, n * sizeof(*ptr), ptr);
-}
-
 /*
  * Like `umove' but make the additional effort of looking
  * for a terminating zero byte.
@@ -1335,3 +1304,103 @@
 	}
 	return 0;
 }
+
+/*
+ * Iteratively fetch and print up to nmemb elements of elem_size size
+ * from the array that starts at tracee's address start_addr.
+ *
+ * Array elements are being fetched to the address specified by elem_buf.
+ *
+ * The fetcher callback function specified by umoven_func should follow
+ * the same semantics as umoven_or_printaddr function.
+ *
+ * The printer callback function specified by print_func is expected
+ * to print something; if it returns false, no more iterations will be made.
+ *
+ * The pointer specified by opaque_data is passed to each invocation
+ * of print_func callback function.
+ *
+ * This function prints:
+ * - "NULL", if start_addr is NULL;
+ * - "[]", if nmemb is 0;
+ * - start_addr, if nmemb * elem_size overflows or wraps around;
+ * - nothing, if the first element cannot be fetched
+ *   (if umoven_func returns non-zero), but it is assumed that
+ *   umoven_func has printed the address it failed to fetch data from;
+ * - elements of the array, delimited by ", ", with the array itself
+ *   enclosed with [] brackets.
+ *
+ * If abbrev(tcp) is true, then
+ * - the maximum number of elements printed equals to max_strlen;
+ * - "..." is printed instead of max_strlen+1 element
+ *   and no more iterations will be made.
+ *
+ * This function returns true only if
+ * - umoven_func has been called at least once AND
+ * - umoven_func has not returned false.
+ */
+bool
+print_array(struct tcb *tcp,
+	    const unsigned long start_addr,
+	    const size_t nmemb,
+	    void *const elem_buf,
+	    const size_t elem_size,
+	    int (*const umoven_func)(struct tcb *,
+				     long,
+				     unsigned int,
+				     void *),
+	    bool (*const print_func)(struct tcb *,
+				     void *elem_buf,
+				     size_t elem_size,
+				     void *opaque_data),
+	    void *const opaque_data)
+{
+	if (!start_addr) {
+		tprints("NULL");
+		return false;
+	}
+
+	if (!nmemb) {
+		tprints("[]");
+		return false;
+	}
+
+	const size_t size = nmemb * elem_size;
+	const unsigned long end_addr = start_addr + size;
+
+	if (end_addr <= start_addr || size / elem_size != nmemb) {
+		printaddr(start_addr);
+		return false;
+	}
+
+	const unsigned long abbrev_end =
+		(abbrev(tcp) && max_strlen < nmemb) ?
+			start_addr + elem_size * max_strlen : end_addr;
+	unsigned long cur;
+
+	for (cur = start_addr; cur < end_addr; cur += elem_size) {
+		if (cur != start_addr)
+			tprints(", ");
+
+		if (umoven_func(tcp, cur, elem_size, elem_buf))
+			break;
+
+		if (cur == start_addr)
+			tprints("[");
+
+		if (cur >= abbrev_end) {
+			tprints("...");
+			cur = end_addr;
+			break;
+		}
+
+		if (!print_func(tcp, elem_buf, elem_size, opaque_data)) {
+			cur = end_addr;
+			break;
+		}
+	}
+	if (cur != start_addr)
+		tprints("]");
+
+	return cur >= end_addr;
+}
diff --git a/v4l2.c b/v4l2.c
index 5b2426b..c0cda21 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -29,10 +29,31 @@
 
 #include "defs.h"
 
+#include DEF_MPERS_TYPE(struct_v4l2_buffer)
+#include DEF_MPERS_TYPE(struct_v4l2_create_buffers)
+#include DEF_MPERS_TYPE(struct_v4l2_ext_control)
+#include DEF_MPERS_TYPE(struct_v4l2_ext_controls)
+#include DEF_MPERS_TYPE(struct_v4l2_format)
+#include DEF_MPERS_TYPE(struct_v4l2_framebuffer)
+#include DEF_MPERS_TYPE(struct_v4l2_input)
+#include DEF_MPERS_TYPE(struct_v4l2_standard)
+
 #include <stdint.h>
-#include <sys/ioctl.h>
+#include <linux/ioctl.h>
 #include <linux/types.h>
 #include <linux/videodev2.h>
+
+typedef struct v4l2_buffer struct_v4l2_buffer;
+typedef struct v4l2_create_buffers struct_v4l2_create_buffers;
+typedef struct v4l2_ext_control struct_v4l2_ext_control;
+typedef struct v4l2_ext_controls struct_v4l2_ext_controls;
+typedef struct v4l2_format struct_v4l2_format;
+typedef struct v4l2_framebuffer struct_v4l2_framebuffer;
+typedef struct v4l2_input struct_v4l2_input;
+typedef struct v4l2_standard struct_v4l2_standard;
+
+#include MPERS_DEFS
+
 /* some historical constants */
 #ifndef V4L2_CID_HCENTER
 #define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
@@ -44,58 +65,53 @@
 #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
 #endif
 
-#include "xlat/v4l2_device_capabilities_flags.h"
-#include "xlat/v4l2_buf_types.h"
-#include "xlat/v4l2_buf_flags.h"
-#include "xlat/v4l2_framesize_types.h"
-#include "xlat/v4l2_frameinterval_types.h"
-#include "xlat/v4l2_fields.h"
-#include "xlat/v4l2_colorspaces.h"
-#include "xlat/v4l2_format_description_flags.h"
-#include "xlat/v4l2_memories.h"
-#include "xlat/v4l2_control_ids.h"
-#include "xlat/v4l2_control_types.h"
-#include "xlat/v4l2_control_flags.h"
-#include "xlat/v4l2_control_classes.h"
-#include "xlat/v4l2_streaming_capabilities.h"
-#include "xlat/v4l2_capture_modes.h"
-#include "xlat/v4l2_input_types.h"
-
 #define FMT_FRACT "%u/%u"
 #define ARGS_FRACT(x) ((x).numerator), ((x).denominator)
 
-#define FMT_RECT "{left=%i, top=%i, width=%i, height=%i}"
+#define FMT_RECT "{left=%d, top=%d, width=%u, height=%u}"
 #define ARGS_RECT(x) (x).left, (x).top, (x).width, (x).height
 
-static void print_pixelformat(uint32_t fourcc)
+static void
+print_pixelformat(uint32_t fourcc)
 {
-	union {
+	const union {
 		uint32_t pixelformat;
 		unsigned char cc[sizeof(uint32_t)];
 	} u = {
-		.pixelformat =
 #if WORDS_BIGENDIAN
-			htole32(fourcc)
+		.cc = {
+			(unsigned char) (fourcc >> 24),
+			(unsigned char) (fourcc >> 16),
+			(unsigned char) (fourcc >> 8),
+			(unsigned char) fourcc
+		}
 #else
-			fourcc
+		.pixelformat = fourcc
 #endif
 	};
 	unsigned int i;
 
 	tprints("v4l2_fourcc(");
 	for (i = 0; i < sizeof(u.cc); ++i) {
-		unsigned int c = u.cc[i];
+		unsigned char c = u.cc[i];
 
 		if (i)
 			tprints(", ");
-		if (c == ' ' ||
-		    (c >= '0' && c <= '9') ||
-		    (c >= 'A' && c <= 'Z') ||
-		    (c >= 'a' && c <= 'z')) {
+		if (c == '\'' || c == '\\') {
 			char sym[] = {
 				'\'',
-				u.cc[i],
-				'\''
+				'\\',
+				c,
+				'\'',
+				'\0'
+			};
+			tprints(sym);
+		} else if (c >= ' ' && c <= 0x7e) {
+			char sym[] = {
+				'\'',
+				c,
+				'\'',
+				'\0'
 			};
 			tprints(sym);
 		} else {
@@ -114,588 +130,825 @@
 	tprints(")");
 }
 
-static void print_v4l2_format_fmt(const struct v4l2_format *f)
+#include "xlat/v4l2_device_capabilities_flags.h"
+
+static int
+print_v4l2_capability(struct tcb *tcp, const long arg)
 {
-	tprints("fmt.");
+	struct v4l2_capability caps;
+
+	if (entering(tcp))
+		return 0;
+	tprints(", ");
+	if (umove_or_printaddr(tcp, arg, &caps))
+		return 1;
+	tprints("{driver=");
+	print_quoted_string((const char *) caps.driver,
+			    sizeof(caps.driver), QUOTE_0_TERMINATED);
+	tprints(", card=");
+	print_quoted_string((const char *) caps.card,
+			    sizeof(caps.card), QUOTE_0_TERMINATED);
+	tprints(", bus_info=");
+	print_quoted_string((const char *) caps.bus_info,
+			    sizeof(caps.bus_info), QUOTE_0_TERMINATED);
+	tprintf(", version=%u.%u.%u, capabilities=",
+		(caps.version >> 16) & 0xFF,
+		(caps.version >> 8) & 0xFF,
+		caps.version & 0xFF);
+	printflags(v4l2_device_capabilities_flags, caps.capabilities,
+		   "V4L2_CAP_???");
+#ifdef V4L2_CAP_DEVICE_CAPS
+	tprints(", device_caps=");
+	printflags(v4l2_device_capabilities_flags, caps.device_caps,
+		   "V4L2_CAP_???");
+#endif
+	tprints("}");
+	return 1;
+}
+
+#include "xlat/v4l2_buf_types.h"
+#include "xlat/v4l2_format_description_flags.h"
+
+static int
+print_v4l2_fmtdesc(struct tcb *tcp, const long arg)
+{
+	struct v4l2_fmtdesc f;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &f))
+			return RVAL_DECODED | 1;
+		tprintf("{index=%u, type=", f.index);
+		printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
+		return 0;
+	}
+
+	if (!syserror(tcp) && !umove(tcp, arg, &f)) {
+		tprints(", flags=");
+		printflags(v4l2_format_description_flags, f.flags,
+			   "V4L2_FMT_FLAG_???");
+		tprints(", description=");
+		print_quoted_string((const char *) f.description,
+				    sizeof(f.description),
+				    QUOTE_0_TERMINATED);
+		tprints(", pixelformat=");
+		print_pixelformat(f.pixelformat);
+	}
+	tprints("}");
+	return 1;
+}
+
+#include "xlat/v4l2_fields.h"
+#include "xlat/v4l2_colorspaces.h"
+
+static void
+print_v4l2_format_fmt(const char *prefix, const struct_v4l2_format *f)
+{
 	switch (f->type) {
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-	case V4L2_BUF_TYPE_VIDEO_OUTPUT: {
-		const struct v4l2_pix_format *pix = &f->fmt.pix;
-
-		tprintf("pix={width=%u, height=%u, pixelformat=",
-			pix->width, pix->height);
-		print_pixelformat(pix->pixelformat);
+	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+		tprints(prefix);
+		tprintf("fmt.pix={width=%u, height=%u, pixelformat=",
+			f->fmt.pix.width, f->fmt.pix.height);
+		print_pixelformat(f->fmt.pix.pixelformat);
 		tprints(", field=");
-		printxval(v4l2_fields, pix->field, "V4L2_FIELD_???");
+		printxval(v4l2_fields, f->fmt.pix.field, "V4L2_FIELD_???");
 		tprintf(", bytesperline=%u, sizeimage=%u, colorspace=",
-			pix->bytesperline, pix->sizeimage);
-		printxval(v4l2_colorspaces, pix->colorspace,
+			f->fmt.pix.bytesperline, f->fmt.pix.sizeimage);
+		printxval(v4l2_colorspaces, f->fmt.pix.colorspace,
 			  "V4L2_COLORSPACE_???");
 		tprints("}");
 		break;
-	}
 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
 	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {
-		const struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
 		unsigned int i, max;
 
-		tprintf("pix_mp={width=%u, height=%u, pixelformat=",
-			pix_mp->width, pix_mp->height);
-		print_pixelformat(pix_mp->pixelformat);
+		tprints(prefix);
+		tprintf("fmt.pix_mp={width=%u, height=%u, pixelformat=",
+			f->fmt.pix_mp.width, f->fmt.pix_mp.height);
+		print_pixelformat(f->fmt.pix_mp.pixelformat);
 		tprints(", field=");
-		printxval(v4l2_fields, pix_mp->field, "V4L2_FIELD_???");
+		printxval(v4l2_fields, f->fmt.pix_mp.field, "V4L2_FIELD_???");
 		tprints(", colorspace=");
-		printxval(v4l2_colorspaces, pix_mp->colorspace,
+		printxval(v4l2_colorspaces, f->fmt.pix_mp.colorspace,
 			  "V4L2_COLORSPACE_???");
-		tprints("plane_fmt=[");
-		max = pix_mp->num_planes;
+		tprints(", plane_fmt=[");
+		max = f->fmt.pix_mp.num_planes;
 		if (max > VIDEO_MAX_PLANES)
 			max = VIDEO_MAX_PLANES;
 		for (i = 0; i < max; i++) {
 			if (i > 0)
 				tprints(", ");
 			tprintf("{sizeimage=%u, bytesperline=%u}",
-				pix_mp->plane_fmt[i].sizeimage,
-				pix_mp->plane_fmt[i].bytesperline);
+				f->fmt.pix_mp.plane_fmt[i].sizeimage,
+				f->fmt.pix_mp.plane_fmt[i].bytesperline);
 		}
-		tprintf("], num_planes=%u}", (unsigned) pix_mp->num_planes);
+		tprintf("], num_planes=%u}", (unsigned) f->fmt.pix_mp.num_planes);
 		break;
 	}
 #endif
 
 	/* TODO: Complete this switch statement */
+#if 0
 	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
 #if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
 	case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
 #endif
-		tprints("win={???}");
+		tprints(prefix);
+		tprints("fmt.win={???}");
 		break;
 
 	case V4L2_BUF_TYPE_VBI_CAPTURE:
 	case V4L2_BUF_TYPE_VBI_OUTPUT:
-		tprints("vbi={???}");
+		tprints(prefix);
+		tprints("fmt.vbi={???}");
 		break;
 
 	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
 	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
-		tprints("sliced={???}");
+		tprints(prefix);
+		tprints("fmt.sliced={???}");
 		break;
 
-	default:
-		tprints("???");
+#if HAVE_DECL_V4L2_BUF_TYPE_SDR_CAPTURE
+	case V4L2_BUF_TYPE_SDR_CAPTURE:
+	case V4L2_BUF_TYPE_SDR_OUTPUT:
+		tprints(prefix);
+		tprints("fmt.sdr={???}");
 		break;
+#endif
+#endif
 	}
 }
 
-int
-v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+static int
+print_v4l2_format(struct tcb *tcp, const long arg, const bool is_get)
 {
-	if (!verbose(tcp))
+	struct_v4l2_format f;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &f))
+			return RVAL_DECODED | 1;
+		tprints("{type=");
+		printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
+		if (is_get)
+			return 0;
+		print_v4l2_format_fmt(", ", &f);
+	} else {
+		if (!syserror(tcp) && !umove(tcp, arg, &f)) {
+			const char *delim = is_get ? ", " : " => ";
+			print_v4l2_format_fmt(delim, &f);
+		}
+		tprints("}");
+	}
+	return 1;
+}
+
+#include "xlat/v4l2_memories.h"
+
+static int
+print_v4l2_requestbuffers(struct tcb *tcp, const long arg)
+{
+	struct v4l2_requestbuffers reqbufs;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &reqbufs))
+			return RVAL_DECODED | 1;
+		tprintf("{count=%u, type=", reqbufs.count);
+		printxval(v4l2_buf_types, reqbufs.type, "V4L2_BUF_TYPE_???");
+		tprints(", memory=");
+		printxval(v4l2_memories, reqbufs.memory, "V4L2_MEMORY_???");
+		tprints("}");
 		return 0;
+	} else {
+		static char outstr[sizeof("{count=}") + sizeof(int) * 3];
 
-	switch (code) {
-	case VIDIOC_QUERYCAP: /* decode on exit */ {
-		struct v4l2_capability caps;
-
-		if (entering(tcp) || syserror(tcp) || umove(tcp, arg, &caps) < 0)
-			return 0;
-		tprints(", {driver=");
-		print_quoted_string((const char *) caps.driver,
-				    sizeof(caps.driver), QUOTE_0_TERMINATED);
-		tprints(", card=");
-		print_quoted_string((const char *) caps.card,
-				    sizeof(caps.card), QUOTE_0_TERMINATED);
-		tprints(", bus_info=");
-		print_quoted_string((const char *) caps.bus_info,
-				    sizeof(caps.bus_info), QUOTE_0_TERMINATED);
-		tprintf(", version=%u.%u.%u, capabilities=",
-			(caps.version >> 16) & 0xFF,
-			(caps.version >> 8) & 0xFF,
-			caps.version & 0xFF);
-		printflags(v4l2_device_capabilities_flags, caps.capabilities,
-			   "V4L2_CAP_???");
-#ifdef V4L2_CAP_DEVICE_CAPS
-		tprints(", device_caps=");
-		printflags(v4l2_device_capabilities_flags, caps.device_caps,
-			   "V4L2_CAP_???");
-#endif
-		tprints("}");
-		return 1;
-	}
-
-#ifdef VIDIOC_ENUM_FRAMESIZES
-	case VIDIOC_ENUM_FRAMESIZES: /* decode on exit */ {
-		struct v4l2_frmsizeenum s;
-
-		if (entering(tcp) || umove(tcp, arg, &s) < 0)
-			return 0;
-		tprintf(", {index=%u, pixel_format=", s.index);
-		print_pixelformat(s.pixel_format);
-
-		if (!syserror(tcp)) {
-			tprints(", type=");
-			printxval(v4l2_framesize_types, s.type, "V4L2_FRMSIZE_TYPE_???");
-			switch (s.type) {
-			case V4L2_FRMSIZE_TYPE_DISCRETE:
-				tprintf(", discrete={width=%u, height=%u}",
-					s.discrete.width, s.discrete.height);
-				break;
-			case V4L2_FRMSIZE_TYPE_STEPWISE:
-				tprintf(", stepwise={min_width=%u, max_width=%u, "
-					"step_width=%u, min_height=%u, max_height=%u, "
-					"step_height=%u}",
-					s.stepwise.min_width, s.stepwise.max_width,
-					s.stepwise.step_width, s.stepwise.min_height,
-					s.stepwise.max_height, s.stepwise.step_height);
-				break;
-			}
-		}
-		tprints("}");
-		return 1;
-	}
-#endif /* VIDIOC_ENUM_FRAMESIZES */
-
-	case VIDIOC_G_FMT:
-	case VIDIOC_S_FMT:
-	case VIDIOC_TRY_FMT: {
-		struct v4l2_format f;
-
-		if (umove(tcp, arg, &f) < 0)
-			return 0;
-		if (entering(tcp)) {
-			tprints(", {type=");
-			printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
-		}
-		if ((entering(tcp) && code != VIDIOC_G_FMT)
-		    || (exiting(tcp) && !syserror(tcp))) {
-			tprints(exiting(tcp) && code != VIDIOC_G_FMT ? " => " : ", ");
-			print_v4l2_format_fmt(&f);
-		}
-		if (exiting(tcp))
-			tprints("}");
-		return 1;
-	}
-
-	case VIDIOC_ENUM_FMT: {
-		struct v4l2_fmtdesc f;
-
-		if (entering(tcp) || umove(tcp, arg, &f) < 0)
-			return 0;
-
-		tprintf(", {index=%u", f.index);
-		if (!syserror(tcp)) {
-			tprints(", type=");
-			printxval(v4l2_buf_types, f.type, "V4L2_BUF_TYPE_???");
-			tprints(", flags=");
-			printflags(v4l2_format_description_flags, f.flags,
-				   "V4L2_FMT_FLAG_???");
-			tprints(", description=");
-			print_quoted_string((const char *) f.description,
-					    sizeof(f.description),
-					    QUOTE_0_TERMINATED);
-			tprints(", pixelformat=");
-			print_pixelformat(f.pixelformat);
-		}
-		tprints("}");
-		return 1;
-	}
-
-	case VIDIOC_G_PARM:
-	case VIDIOC_S_PARM: {
-		struct v4l2_streamparm s;
-
-		if (entering(tcp) && code == VIDIOC_G_PARM)
+		if (syserror(tcp) || umove(tcp, arg, &reqbufs) < 0)
 			return 1;
-		if (exiting(tcp) && syserror(tcp))
-			return code == VIDIOC_S_PARM;
-		if (umove(tcp, arg, &s) < 0)
-			return 0;
-		if (entering(tcp)) {
-			tprints(", {type=");
-			printxval(v4l2_buf_types, s.type, "V4L2_BUF_TYPE_???");
-		}
-
-		tprints(exiting(tcp) && code == VIDIOC_S_PARM ? " => {" : ", {");
-		if (s.type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-			struct v4l2_captureparm *cap = &s.parm.capture;
-
-			tprints("capability=");
-			printflags(v4l2_streaming_capabilities,
-				   cap->capability, "V4L2_CAP_???");
-
-			tprints(", capturemode=");
-			printflags(v4l2_capture_modes,
-				   cap->capturemode, "V4L2_MODE_???");
-
-			tprintf(", timeperframe=" FMT_FRACT,
-				ARGS_FRACT(cap->timeperframe));
-
-			tprintf(", extendedmode=%u, readbuffers=%u",
-				cap->extendedmode,
-				cap->readbuffers);
-		} else
-			tprints("...");
-		tprints("}");
-		if (exiting(tcp))
-			tprints("}");
-		return 1;
+		sprintf(outstr, "{count=%u}", reqbufs.count);
+		tcp->auxstr = outstr;
+		return 1 + RVAL_STR;
 	}
+}
 
-	case VIDIOC_QUERYCTRL: {
-		struct v4l2_queryctrl c;
+#include "xlat/v4l2_buf_flags.h"
 
-		if (umove(tcp, arg, &c) < 0)
-			return 0;
-		/* 'id' field must be printed :
-		* on enter
-		* on exit if !syserror(tcp) && V4L2_CTRL_FLAG_NEXT_CTRL was set
-		*/
-		if (entering(tcp)
-		    || (exiting(tcp) && tcp->auxstr && !syserror(tcp))) {
-			tprints(exiting(tcp) ? " => " : ", {id=");
-#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
-			tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
-			if (tcp->auxstr) {
-				tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
-				c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
+static int
+print_v4l2_buffer(struct tcb *tcp, const unsigned int code, const long arg)
+{
+	struct_v4l2_buffer b;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &b))
+			return RVAL_DECODED | 1;
+		tprints("{type=");
+		printxval(v4l2_buf_types, b.type, "V4L2_BUF_TYPE_???");
+		if (code != VIDIOC_DQBUF)
+			tprintf(", index=%u", b.index);
+	} else {
+		if (!syserror(tcp) && umove(tcp, arg, &b) == 0) {
+			if (code == VIDIOC_DQBUF)
+				tprintf(", index=%u", b.index);
+			tprints(", memory=");
+			printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
+
+			if (b.memory == V4L2_MEMORY_MMAP) {
+				tprintf(", m.offset=%#x", b.m.offset);
+			} else if (b.memory == V4L2_MEMORY_USERPTR) {
+				tprintf(", m.userptr=%#lx",
+					(unsigned long) b.m.userptr);
 			}
-#endif
-			printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
-		}
-		if (exiting(tcp)) {
-			if (!syserror(tcp)) {
-				tprints(", type=");
-				printxval(v4l2_control_types, c.type,
-					  "V4L2_CTRL_TYPE_???");
-				tprints(", name=");
-				print_quoted_string((const char *) c.name,
-						    sizeof(c.name),
-						    QUOTE_0_TERMINATED);
-				tprintf(", minimum=%i, maximum=%i, step=%i, "
-					"default_value=%i, flags=",
-					c.minimum, c.maximum,
-					c.step, c.default_value);
-				printflags(v4l2_control_flags, c.flags,
-					   "V4L2_CTRL_FLAG_???");
-			}
-			tprints("}");
-		}
-		return 1;
-	}
 
-	case VIDIOC_G_CTRL:
-	case VIDIOC_S_CTRL: {
-		struct v4l2_control c;
-
-		if (entering(tcp) || umove(tcp, arg, &c) < 0)
-			return 0;
-		tprints(", {id=");
-		printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
-		if (!syserror(tcp) || code != VIDIOC_G_CTRL)
-			tprintf(", value=%i", c.value);
+			tprintf(", length=%u, bytesused=%u, flags=",
+				b.length, b.bytesused);
+			printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
+			if (code == VIDIOC_DQBUF)
+				tprintf(", timestamp = {%ju.%06ju}",
+					(uintmax_t)b.timestamp.tv_sec,
+					(uintmax_t)b.timestamp.tv_usec);
+			tprints(", ...");
+		}
 		tprints("}");
-		return 1;
+	}
+	return 1;
+}
+
+static int
+print_v4l2_framebuffer(struct tcb *tcp, const long arg)
+{
+	struct_v4l2_framebuffer b;
+
+	tprints(", ");
+	if (!umove_or_printaddr(tcp, arg, &b)) {
+		tprintf("{capability=%#x, flags=%#x, base=%#lx}",
+			b.capability, b.flags, (unsigned long) b.base);
 	}
 
-#ifdef VIDIOC_S_EXT_CTRLS
-	case VIDIOC_S_EXT_CTRLS:
-	case VIDIOC_TRY_EXT_CTRLS:
-	case VIDIOC_G_EXT_CTRLS: {
-		struct v4l2_ext_controls c;
-		unsigned int n;
-		bool must_print_values;
+	return RVAL_DECODED | 1;
+}
 
-		if (entering(tcp) && code == VIDIOC_G_EXT_CTRLS)
-			return 0;
-		if (exiting(tcp) && syserror(tcp) && code != VIDIOC_G_EXT_CTRLS)
-			return 0;
-		must_print_values = ((entering(tcp) && code != VIDIOC_G_EXT_CTRLS)
-				     || (exiting(tcp) && !syserror(tcp)));
-		if (umove(tcp, arg, &c) < 0)
-			return 0;
-		tprints(code != VIDIOC_G_EXT_CTRLS && exiting(tcp) ? " => " : ", ");
-		tprints("{ctrl_class=");
-		printxval(v4l2_control_classes, c.ctrl_class,
-			  "V4L2_CTRL_CLASS_???");
-		tprintf(", count=%u", c.count);
-		if (exiting(tcp) && syserror(tcp))
-			tprintf(", error_idx=%u", c.error_idx);
-		tprints(", controls=[");
-		for (n = 0; n < c.count; ++n) {
-			struct v4l2_ext_control ctrl;
+static int
+print_v4l2_buf_type(struct tcb *tcp, const long arg)
+{
+	int type;
 
-			if (n > 0)
+	tprints(", ");
+	if (!umove_or_printaddr(tcp, arg, &type)) {
+		tprints("[");
+		printxval(v4l2_buf_types, type, "V4L2_BUF_TYPE_???");
+		tprints("]");
+	}
+	return RVAL_DECODED | 1;
+}
+
+#include "xlat/v4l2_streaming_capabilities.h"
+#include "xlat/v4l2_capture_modes.h"
+
+static int
+print_v4l2_streamparm(struct tcb *tcp, const long arg, const bool is_get)
+{
+	struct v4l2_streamparm s;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &s))
+			return RVAL_DECODED | 1;
+		tprints("{type=");
+		printxval(v4l2_buf_types, s.type, "V4L2_BUF_TYPE_???");
+		switch (s.type) {
+			case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+			case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+				if (is_get)
+					return 0;
 				tprints(", ");
-			if (umove(tcp, (long) (c.controls + n), &ctrl) < 0)
 				break;
-			if (abbrev(tcp) && n == 2) {
-				tprints("...");
-				break;
-			}
-			tprints("{id=");
-			printxval(v4l2_control_ids, ctrl.id, "V4L2_CID_???");
-# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
-			tprintf(", size=%u", ctrl.size);
-			if (ctrl.size > 0) {
-				if (must_print_values) {
-					tprints(", string=");
-					printstr(tcp, (long) ctrl.string, ctrl.size);
-				}
-			} else
-# endif
-			{
-				if (must_print_values) {
-					tprintf(", value=%i, value64=%lld", ctrl.value,
-						(long long) ctrl.value64);
-				}
-			}
-			tprints("}");
+			default:
+				tprints("}");
+				return RVAL_DECODED | 1;
 		}
-		tprints("]}");
-		return 1;
-	}
-#endif /* VIDIOC_S_EXT_CTRLS */
-
-	case VIDIOC_ENUMSTD: {
-		struct v4l2_standard s;
-
-		if (umove(tcp, arg, &s) < 0)
-			return 0;
-		if (entering(tcp))
-			tprintf(", {index=%i", s.index);
-		else {
-			if (!syserror(tcp)) {
-				tprints(", name=");
-				print_quoted_string((const char *) s.name,
-						    sizeof(s.name),
-						    QUOTE_0_TERMINATED);
-				tprintf(", frameperiod=" FMT_FRACT, ARGS_FRACT(s.frameperiod));
-				tprintf(", framelines=%i", s.framelines);
-			}
+	} else {
+		if (syserror(tcp) || umove(tcp, arg, &s) < 0) {
 			tprints("}");
+			return 1;
 		}
-		return 1;
+		tprints(is_get ? ", " : " => ");
 	}
 
-	case VIDIOC_G_STD:
-	case VIDIOC_S_STD: {
-		v4l2_std_id s;
+	if (s.type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+		tprints("parm.capture={capability=");
+		printflags(v4l2_streaming_capabilities,
+			   s.parm.capture.capability, "V4L2_CAP_???");
 
-		if (code == VIDIOC_G_STD && exiting(tcp) && syserror(tcp))
-			return 0;
-		if (umove(tcp, arg, &s) < 0)
-			return 0;
-		if ((code == VIDIOC_S_STD) == entering(tcp))
-			tprintf(", std=%#llx", (unsigned long long) s);
-		return 1;
+		tprints(", capturemode=");
+		printflags(v4l2_capture_modes,
+			   s.parm.capture.capturemode, "V4L2_MODE_???");
+
+		tprintf(", timeperframe=" FMT_FRACT,
+			ARGS_FRACT(s.parm.capture.timeperframe));
+
+		tprintf(", extendedmode=%u, readbuffers=%u}",
+			s.parm.capture.extendedmode,
+			s.parm.capture.readbuffers);
+	} else {
+		tprints("parm.output={capability=");
+		printflags(v4l2_streaming_capabilities,
+			   s.parm.output.capability, "V4L2_CAP_???");
+
+		tprintf(", outputmode=%u", s.parm.output.outputmode);
+
+		tprintf(", timeperframe=" FMT_FRACT,
+			ARGS_FRACT(s.parm.output.timeperframe));
+
+		tprintf(", extendedmode=%u, writebuffers=%u}",
+			s.parm.output.extendedmode,
+			s.parm.output.writebuffers);
 	}
+	if (exiting(tcp))
+		tprints("}");
+	return 1;
+}
 
-	case VIDIOC_ENUMINPUT: {
-		struct v4l2_input i;
+static int
+print_v4l2_standard(struct tcb *tcp, const long arg)
+{
+	struct_v4l2_standard s;
 
-		if (entering(tcp) || umove(tcp, arg, &i) < 0)
-			return 0;
-		tprintf(", {index=%i", i.index);
-		if (!syserror(tcp)) {
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &s))
+			return RVAL_DECODED | 1;
+		tprintf("{index=%u", s.index);
+	} else {
+		if (!syserror(tcp) && !umove(tcp, arg, &s)) {
+			tprints(", name=");
+			print_quoted_string((const char *) s.name,
+					    sizeof(s.name),
+					    QUOTE_0_TERMINATED);
+			tprintf(", frameperiod=" FMT_FRACT,
+				ARGS_FRACT(s.frameperiod));
+			tprintf(", framelines=%d", s.framelines);
+		}
+		tprints("}");
+	}
+	return 1;
+}
+
+#include "xlat/v4l2_input_types.h"
+
+static int
+print_v4l2_input(struct tcb *tcp, const long arg)
+{
+	struct_v4l2_input i;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &i))
+			return RVAL_DECODED | 1;
+		tprintf("{index=%u", i.index);
+	} else {
+		if (!syserror(tcp) && !umove(tcp, arg, &i)) {
 			tprints(", name=");
 			print_quoted_string((const char *) i.name,
-					    sizeof(i.name), QUOTE_0_TERMINATED);
+					    sizeof(i.name),
+					    QUOTE_0_TERMINATED);
 			tprints(", type=");
 			printxval(v4l2_input_types, i.type,
 				  "V4L2_INPUT_TYPE_???");
 		}
 		tprints("}");
-		return 1;
+	}
+	return 1;
+}
+
+#include "xlat/v4l2_control_ids.h"
+
+static int
+print_v4l2_control(struct tcb *tcp, const long arg, const bool is_get)
+{
+	struct v4l2_control c;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &c))
+			return RVAL_DECODED | 1;
+		tprints("{id=");
+		printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
+		if (!is_get)
+			tprintf(", value=%d", c.value);
+		return 0;
 	}
 
-	case VIDIOC_G_INPUT:
-	case VIDIOC_S_INPUT: {
-		int index;
+	if (!syserror(tcp) && !umove(tcp, arg, &c)) {
+		tprints(is_get ? ", " : " => ");
+		tprintf("value=%d", c.value);
+	}
 
-		if (entering(tcp) || syserror(tcp) || umove(tcp, arg, &index) < 0)
+	tprints("}");
+	return 1;
+}
+
+#include "xlat/v4l2_control_types.h"
+#include "xlat/v4l2_control_flags.h"
+
+static int
+print_v4l2_queryctrl(struct tcb *tcp, const long arg)
+{
+	struct v4l2_queryctrl c;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &c))
+			return RVAL_DECODED | 1;
+		tprints("{id=");
+	} else {
+		if (syserror(tcp) || umove(tcp, arg, &c) < 0) {
+			tprints("}");
+			return 1;
+		}
+		if (tcp->auxstr)
+			tprints(" => ");
+	}
+
+	if (entering(tcp) || tcp->auxstr) {
+#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
+		tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
+		if (tcp->auxstr) {
+			tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
+			c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
+		}
+#endif
+		printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
+	}
+
+	if (exiting(tcp)) {
+		tprints(", type=");
+		printxval(v4l2_control_types, c.type, "V4L2_CTRL_TYPE_???");
+		tprints(", name=");
+		print_quoted_string((const char *) c.name,
+				    sizeof(c.name),
+				    QUOTE_0_TERMINATED);
+		tprintf(", minimum=%d, maximum=%d, step=%d"
+			", default_value=%d, flags=",
+			c.minimum, c.maximum, c.step, c.default_value);
+		printflags(v4l2_control_flags, c.flags, "V4L2_CTRL_FLAG_???");
+		tprints("}");
+	}
+	return 1;
+}
+
+static int
+print_v4l2_cropcap(struct tcb *tcp, const long arg)
+{
+	struct v4l2_cropcap c;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &c))
+			return RVAL_DECODED | 1;
+		tprints("{type=");
+		printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
+		return 0;
+	}
+	if (!syserror(tcp) && !umove(tcp, arg, &c)) {
+		tprintf(", bounds=" FMT_RECT
+			", defrect=" FMT_RECT
+			", pixelaspect=" FMT_FRACT,
+			ARGS_RECT(c.bounds),
+			ARGS_RECT(c.defrect),
+			ARGS_FRACT(c.pixelaspect));
+	}
+	tprints("}");
+	return 1;
+}
+
+static int
+print_v4l2_crop(struct tcb *tcp, const long arg, const bool is_get)
+{
+	struct v4l2_crop c;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &c))
+			return RVAL_DECODED | 1;
+		tprints("{type=");
+		printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
+		if (is_get)
 			return 0;
-
-		tprintf(", index=%i", index);
-		return 1;
+		tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
+	} else {
+		if (!syserror(tcp) && !umove(tcp, arg, &c))
+			tprintf(", c=" FMT_RECT, ARGS_RECT(c.c));
 	}
 
+	tprints("}");
+	return RVAL_DECODED | 1;
+}
+
+#ifdef VIDIOC_S_EXT_CTRLS
+static bool
+print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+	const struct_v4l2_ext_control *p = elem_buf;
+
+	tprints("{id=");
+	printxval(v4l2_control_ids, p->id, "V4L2_CID_???");
+# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
+	tprintf(", size=%u", p->size);
+	if (p->size > 0) {
+		tprints(", string=");
+		printstr(tcp, (long) p->string, p->size);
+	} else
+# endif
+	tprintf(", value=%d, value64=%lld", p->value,
+		(long long) p->value64);
+	tprints("}");
+
+	return true;
+}
+
+#include "xlat/v4l2_control_classes.h"
+
+static int
+umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const long addr,
+				    const unsigned int len, void *our_addr)
+{
+	if (!addr) {
+		tprints("NULL");
+		return -1;
+	}
+	if (umoven(tcp, addr, len, our_addr) < 0) {
+		tprintf("%#lx", addr);
+		return -1;
+	}
+	return 0;
+}
+
+static int
+print_v4l2_ext_controls(struct tcb *tcp, const long arg, const bool is_get)
+{
+	struct_v4l2_ext_controls c;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &c))
+			return RVAL_DECODED | 1;
+		tprints("{ctrl_class=");
+		printxval(v4l2_control_classes, c.ctrl_class,
+			  "V4L2_CTRL_CLASS_???");
+		tprintf(", count=%u", c.count);
+		if (!c.count) {
+			tprints("}");
+			return RVAL_DECODED | 1;
+		}
+		if (is_get)
+			return 0;
+		tprints(", ");
+	} else {
+		if (umove(tcp, arg, &c) < 0) {
+			tprints("}");
+			return 1;
+		}
+		tprints(is_get ? ", " : " => ");
+	}
+
+	tprints("controls=");
+	struct_v4l2_ext_control ctrl;
+	bool fail = !print_array(tcp, (unsigned long) c.controls, c.count,
+				 &ctrl, sizeof(ctrl),
+				 umoven_or_printaddr_ignore_syserror,
+				 print_v4l2_ext_control, 0);
+
+	if (exiting(tcp) && syserror(tcp))
+		tprintf(", error_idx=%u", c.error_idx);
+
+	if (exiting(tcp) || fail) {
+		tprints("}");
+		return RVAL_DECODED | 1;
+	}
+	return 1;
+}
+#endif /* VIDIOC_S_EXT_CTRLS */
+
+#ifdef VIDIOC_ENUM_FRAMESIZES
+# include "xlat/v4l2_framesize_types.h"
+
+static int
+print_v4l2_frmsizeenum(struct tcb *tcp, const long arg)
+{
+	struct v4l2_frmsizeenum s;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &s))
+			return RVAL_DECODED | 1;
+		tprintf("{index=%u, pixel_format=", s.index);
+		print_pixelformat(s.pixel_format);
+		return 0;
+	}
+
+	if (!syserror(tcp) && !umove(tcp, arg, &s)) {
+		tprints(", type=");
+		printxval(v4l2_framesize_types, s.type, "V4L2_FRMSIZE_TYPE_???");
+		switch (s.type) {
+		case V4L2_FRMSIZE_TYPE_DISCRETE:
+			tprintf(", discrete={width=%u, height=%u}",
+				s.discrete.width, s.discrete.height);
+			break;
+		case V4L2_FRMSIZE_TYPE_STEPWISE:
+			tprintf(", stepwise={min_width=%u, max_width=%u, "
+				"step_width=%u, min_height=%u, max_height=%u, "
+				"step_height=%u}",
+				s.stepwise.min_width, s.stepwise.max_width,
+				s.stepwise.step_width, s.stepwise.min_height,
+				s.stepwise.max_height, s.stepwise.step_height);
+			break;
+		}
+	}
+	tprints("}");
+	return 1;
+}
+#endif /* VIDIOC_ENUM_FRAMESIZES */
+
 #ifdef VIDIOC_ENUM_FRAMEINTERVALS
-	case VIDIOC_ENUM_FRAMEINTERVALS: {
-		struct v4l2_frmivalenum f;
+# include "xlat/v4l2_frameinterval_types.h"
 
-		if (entering(tcp) || umove(tcp, arg, &f) < 0)
-			return 0;
-		tprintf(", {index=%i, pixel_format=", f.index);
+static int
+print_v4l2_frmivalenum(struct tcb *tcp, const long arg)
+{
+	struct v4l2_frmivalenum f;
+
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &f))
+			return RVAL_DECODED | 1;
+		tprintf("{index=%u, pixel_format=", f.index);
 		print_pixelformat(f.pixel_format);
 		tprintf(", width=%u, height=%u", f.width, f.height);
-		if (!syserror(tcp)) {
-			tprints(", type=");
-			printxval(v4l2_frameinterval_types, f.type,
-				  "V4L2_FRMIVAL_TYPE_???");
-			switch (f.type) {
-			case V4L2_FRMIVAL_TYPE_DISCRETE:
-				tprintf(", discrete=" FMT_FRACT,
-					ARGS_FRACT(f.discrete));
-				break;
-			case V4L2_FRMIVAL_TYPE_STEPWISE:
-			case V4L2_FRMSIZE_TYPE_CONTINUOUS:
-				tprintf(", stepwise={min=" FMT_FRACT ", max="
-					FMT_FRACT ", step=" FMT_FRACT "}",
-					ARGS_FRACT(f.stepwise.min),
-					ARGS_FRACT(f.stepwise.max),
-					ARGS_FRACT(f.stepwise.step));
-				break;
-			}
-		}
-		tprints("}");
-		return 1;
+		return 0;
 	}
+	if (!syserror(tcp) && !umove(tcp, arg, &f)) {
+		tprints(", type=");
+		printxval(v4l2_frameinterval_types, f.type,
+			  "V4L2_FRMIVAL_TYPE_???");
+		switch (f.type) {
+		case V4L2_FRMIVAL_TYPE_DISCRETE:
+			tprintf(", discrete=" FMT_FRACT,
+				ARGS_FRACT(f.discrete));
+			break;
+		case V4L2_FRMIVAL_TYPE_STEPWISE:
+		case V4L2_FRMSIZE_TYPE_CONTINUOUS:
+			tprintf(", stepwise={min=" FMT_FRACT ", max="
+				FMT_FRACT ", step=" FMT_FRACT "}",
+				ARGS_FRACT(f.stepwise.min),
+				ARGS_FRACT(f.stepwise.max),
+				ARGS_FRACT(f.stepwise.step));
+			break;
+		}
+	}
+	tprints("}");
+	return 1;
+}
 #endif /* VIDIOC_ENUM_FRAMEINTERVALS */
 
-	case VIDIOC_CROPCAP: {
-		struct v4l2_cropcap c;
-
-		if (entering(tcp) || umove(tcp, arg, &c) < 0)
-			return 0;
-		tprints(", {type=");
-		printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
-		if (!syserror(tcp))
-			tprintf(", bounds=" FMT_RECT ", defrect=" FMT_RECT ", "
-				"pixelaspect=" FMT_FRACT, ARGS_RECT(c.bounds),
-				ARGS_RECT(c.defrect), ARGS_FRACT(c.pixelaspect));
-		tprints("}");
-		return 1;
-	}
-
-	case VIDIOC_S_CROP: {
-		struct v4l2_crop c;
-
-		if (exiting(tcp) || umove(tcp, arg, &c) < 0)
-			return 0;
-		tprints(", {type=");
-		printxval(v4l2_buf_types, c.type, "V4L2_BUF_TYPE_???");
-		tprintf(", c=" FMT_RECT "}", ARGS_RECT(c.c));
-		return 1;
-	}
-
-	case VIDIOC_G_FBUF:
-	case VIDIOC_S_FBUF: {
-		struct v4l2_framebuffer b;
-
-		if (syserror(tcp) && code == VIDIOC_G_FBUF)
-			return 0;
-		if (entering(tcp) || umove(tcp, arg, &b) < 0)
-			return 0;
-		tprintf(", {capability=%x, flags=%x, base=%p}",
-			b.capability, b.flags, b.base);
-		return 1;
-	}
-
 #ifdef VIDIOC_CREATE_BUFS
-	case VIDIOC_CREATE_BUFS: {
-		struct v4l2_create_buffers b;
+static int
+print_v4l2_create_buffers(struct tcb *tcp, const long arg)
+{
+	struct_v4l2_create_buffers b;
 
-		if (exiting(tcp) && syserror(tcp))
-			return 1;
-		if (umove(tcp, arg, &b) < 0)
-			return 0;
-		if (entering(tcp)) {
-			tprintf(", {count=%u, memory=", b.count);
-			printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
-			tprints(", format={type=");
-			printxval(v4l2_buf_types, b.format.type, "V4L2_BUF_TYPE_???");
-			tprints(", ");
-			print_v4l2_format_fmt(&b.format);
-			tprints("}}");
-			return 1;
-		} else {
-			static const char fmt[] = "{index=%u, count=%u}";
-			static char outstr[sizeof(fmt) + sizeof(int) * 6];
+	if (entering(tcp)) {
+		tprints(", ");
+		if (umove_or_printaddr(tcp, arg, &b))
+			return RVAL_DECODED | 1;
+		tprintf("{count=%u, memory=", b.count);
+		printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
+		tprints(", format={type=");
+		printxval(v4l2_buf_types, b.format.type,
+			  "V4L2_BUF_TYPE_???");
+		print_v4l2_format_fmt(", ",
+				      (struct_v4l2_format *) &b.format);
+		tprints("}}");
+		return 0;
+	} else {
+		static const char fmt[] = "{index=%u, count=%u}";
+		static char outstr[sizeof(fmt) + sizeof(int) * 6];
 
-			sprintf(outstr, fmt, b.index, b.count);
-			tcp->auxstr = outstr;
-			return 1 + RVAL_STR;
-		}
+		if (syserror(tcp) || umove(tcp, arg, &b) < 0)
+			return 1;
+		sprintf(outstr, fmt, b.index, b.count);
+		tcp->auxstr = outstr;
+		return 1 + RVAL_STR;
 	}
+}
 #endif /* VIDIOC_CREATE_BUFS */
 
-	case VIDIOC_REQBUFS: {
-		struct v4l2_requestbuffers reqbufs;
+MPERS_PRINTER_DECL(int, v4l2_ioctl,
+		   struct tcb *tcp, const unsigned int code, const long arg)
+{
+	if (!verbose(tcp))
+		return RVAL_DECODED;
 
-		if (umove(tcp, arg, &reqbufs) < 0)
+	switch (code) {
+	case VIDIOC_QUERYCAP: /* R */
+		return print_v4l2_capability(tcp, arg);
+
+	case VIDIOC_ENUM_FMT: /* RW */
+		return print_v4l2_fmtdesc(tcp, arg);
+
+	case VIDIOC_G_FMT: /* RW */
+	case VIDIOC_S_FMT: /* RW */
+	case VIDIOC_TRY_FMT: /* RW */
+		return print_v4l2_format(tcp, arg, code == VIDIOC_G_FMT);
+
+	case VIDIOC_REQBUFS: /* RW */
+		return print_v4l2_requestbuffers(tcp, arg);
+
+	case VIDIOC_QUERYBUF: /* RW */
+	case VIDIOC_QBUF: /* RW */
+	case VIDIOC_DQBUF: /* RW */
+		return print_v4l2_buffer(tcp, code, arg);
+
+	case VIDIOC_G_FBUF: /* R */
+		if (entering(tcp))
 			return 0;
-		if (entering(tcp)) {
-			tprintf(", {count=%u, type=", reqbufs.count);
-			printxval(v4l2_buf_types, reqbufs.type, "V4L2_BUF_TYPE_???");
-			tprints(", memory=");
-			printxval(v4l2_memories, reqbufs.memory, "V4L2_MEMORY_???");
-			tprints("}");
-			return 1;
-		} else if (syserror(tcp))
-			return 1;
-		else {
-			static char outstr[sizeof("{count=}") + sizeof(int) * 3];
+		/* fall through */
+	case VIDIOC_S_FBUF: /* W */
+		return print_v4l2_framebuffer(tcp, arg);
 
-			sprintf(outstr, "{count=%u}", reqbufs.count);
-			tcp->auxstr = outstr;
-			return 1 + RVAL_STR;
-		}
-	}
+	case VIDIOC_STREAMON: /* W */
+	case VIDIOC_STREAMOFF: /* W */
+		return print_v4l2_buf_type(tcp, arg);
 
-	case VIDIOC_QUERYBUF:
-	case VIDIOC_QBUF:
-	case VIDIOC_DQBUF: {
-		struct v4l2_buffer b;
+	case VIDIOC_G_PARM: /* RW */
+	case VIDIOC_S_PARM: /* RW */
+		return print_v4l2_streamparm(tcp, arg, code == VIDIOC_G_PARM);
 
-		if (umove(tcp, arg, &b) < 0)
+	case VIDIOC_G_STD: /* R */
+		if (entering(tcp))
 			return 0;
-		if (entering(tcp)) {
-			tprints(", {type=");
-			printxval(v4l2_buf_types, b.type, "V4L2_BUF_TYPE_???");
-			if (code != VIDIOC_DQBUF)
-				tprintf(", index=%u", b.index);
-		} else {
-			if (!syserror(tcp)) {
-				if (code == VIDIOC_DQBUF)
-					tprintf(", index=%u", b.index);
-				tprints(", memory=");
-				printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
+		/* fall through */
+	case VIDIOC_S_STD: /* W */
+		tprints(", ");
+		printnum_int64(tcp, arg, "%#" PRIx64);
+		return RVAL_DECODED | 1;
 
-				if (b.memory == V4L2_MEMORY_MMAP) {
-					tprintf(", m.offset=%#x", b.m.offset);
-				} else if (b.memory == V4L2_MEMORY_USERPTR) {
-					tprintf(", m.userptr=%#lx", b.m.userptr);
-				}
+	case VIDIOC_ENUMSTD: /* RW */
+		return print_v4l2_standard(tcp, arg);
 
-				tprintf(", length=%u, bytesused=%u, flags=",
-					b.length, b.bytesused);
-				printflags(v4l2_buf_flags, b.flags, "V4L2_BUF_FLAG_???");
-				if (code == VIDIOC_DQBUF)
-					tprintf(", timestamp = {%ju.%06ju}",
-						(uintmax_t)b.timestamp.tv_sec,
-						(uintmax_t)b.timestamp.tv_usec);
-				tprints(", ...");
-			}
-			tprints("}");
-		}
-		return 1;
-	}
+	case VIDIOC_ENUMINPUT: /* RW */
+		return print_v4l2_input(tcp, arg);
 
-	case VIDIOC_STREAMON:
-	case VIDIOC_STREAMOFF: {
-		int type;
+	case VIDIOC_G_CTRL: /* RW */
+	case VIDIOC_S_CTRL: /* RW */
+		return print_v4l2_control(tcp, arg, code == VIDIOC_G_CTRL);
 
-		if (umove(tcp, arg, &type) < 0)
+	case VIDIOC_QUERYCTRL: /* RW */
+		return print_v4l2_queryctrl(tcp, arg);
+
+	case VIDIOC_G_INPUT: /* R */
+		if (entering(tcp))
 			return 0;
-		if (entering(tcp)) {
-			tprints(", ");
-			printxval(v4l2_buf_types, type, "V4L2_BUF_TYPE_???");
-		}
-		return 1;
-	}
+		/* fall through */
+	case VIDIOC_S_INPUT: /* RW */
+		tprints(", ");
+		printnum_int(tcp, arg, "%u");
+		return RVAL_DECODED | 1;
 
-	default: /* decode on exit */
-		return 0;
+	case VIDIOC_CROPCAP: /* RW */
+		return print_v4l2_cropcap(tcp, arg);
+
+	case VIDIOC_G_CROP: /* RW */
+	case VIDIOC_S_CROP: /* W */
+		return print_v4l2_crop(tcp, arg, code == VIDIOC_G_CROP);
+
+#ifdef VIDIOC_S_EXT_CTRLS
+	case VIDIOC_S_EXT_CTRLS: /* RW */
+	case VIDIOC_TRY_EXT_CTRLS: /* RW */
+	case VIDIOC_G_EXT_CTRLS: /* RW */
+		return print_v4l2_ext_controls(tcp, arg,
+					       code == VIDIOC_G_EXT_CTRLS);
+#endif /* VIDIOC_S_EXT_CTRLS */
+
+#ifdef VIDIOC_ENUM_FRAMESIZES
+	case VIDIOC_ENUM_FRAMESIZES: /* RW */
+		return print_v4l2_frmsizeenum(tcp, arg);
+#endif /* VIDIOC_ENUM_FRAMESIZES */
+
+#ifdef VIDIOC_ENUM_FRAMEINTERVALS
+	case VIDIOC_ENUM_FRAMEINTERVALS: /* RW */
+		return print_v4l2_frmivalenum(tcp, arg);
+#endif /* VIDIOC_ENUM_FRAMEINTERVALS */
+
+#ifdef VIDIOC_CREATE_BUFS
+	case VIDIOC_CREATE_BUFS: /* RW */
+		return print_v4l2_create_buffers(tcp, arg);
+#endif /* VIDIOC_CREATE_BUFS */
+
+	default:
+		return RVAL_DECODED;
 	}
 }
diff --git a/xattr.c b/xattr.c
index c47ebd6..30a8467 100644
--- a/xattr.c
+++ b/xattr.c
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2002-2005 Roland McGrath <roland@redhat.com>
  * Copyright (c) 2004 Ulrich Drepper <drepper@redhat.com>
- * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2005-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,54 +35,30 @@
 
 #include "xlat/xattrflags.h"
 
+#ifndef XATTR_SIZE_MAX
+# define XATTR_SIZE_MAX 65536
+#endif
+
 static void
 print_xattr_val(struct tcb *tcp,
 		unsigned long addr,
 		unsigned long insize,
 		unsigned long size)
 {
-	char *buf = NULL;
-	unsigned int len;
+	static char buf[XATTR_SIZE_MAX];
 
 	tprints(", ");
 
-	if (insize == 0)
-		goto done;
-
-	len = size;
-	if (size != (unsigned long) len)
-		goto done;
-
-	if (!len) {
-		tprintf("\"\", %ld", insize);
-		return;
-	}
-
-	if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)))
-		goto done;
-
-	buf = malloc(len);
-	if (!buf)
-		goto done;
-
-	if (umoven(tcp, addr, len, buf) < 0) {
-		free(buf);
-		buf = NULL;
-		goto done;
-	}
-
-	/* Don't print terminating NUL if there is one. */
-	if (buf[len - 1] == '\0')
-		--len;
-
-done:
-	if (buf) {
-		print_quoted_string(buf, len, 0);
-		free(buf);
-	} else {
+	if (!addr || size > sizeof(buf))
 		printaddr(addr);
+	else if (!size || !umoven_or_printaddr(tcp, addr, size, buf)) {
+		/* Don't print terminating NUL if there is one. */
+		if (size && buf[size - 1] == '\0')
+			--size;
+
+		print_quoted_string(buf, size, 0);
 	}
-	tprintf(", %ld", insize);
+	tprintf(", %lu", insize);
 }
 
 SYS_FUNC(setxattr)
@@ -134,13 +110,10 @@
 static void
 print_xattr_list(struct tcb *tcp, unsigned long addr, unsigned long size)
 {
-	if (syserror(tcp)) {
+	if (!size || syserror(tcp)) {
 		printaddr(addr);
 	} else {
-		unsigned long len =
-			(size < (unsigned long) tcp->u_rval) ?
-				size : (unsigned long) tcp->u_rval;
-		printstr(tcp, addr, len);
+		printstr(tcp, addr, tcp->u_rval);
 	}
 	tprintf(", %lu", size);
 }
diff --git a/xlat.h b/xlat.h
new file mode 100644
index 0000000..2f7643c
--- /dev/null
+++ b/xlat.h
@@ -0,0 +1,16 @@
+#ifndef STRACE_XLAT_H
+
+# include <stdint.h>
+
+struct xlat {
+	uint64_t val;
+	const char *str;
+};
+
+# define XLAT(val)			{ (unsigned)(val), #val }
+# define XLAT_PAIR(val, str)		{ (unsigned)(val), str  }
+# define XLAT_TYPE(type, val)		{     (type)(val), #val }
+# define XLAT_TYPE_PAIR(type, val, str)	{     (type)(val), str  }
+# define XLAT_END			{		0, 0    }
+
+#endif
diff --git a/xlat/Makemodule.am b/xlat/Makemodule.am
index 4cd5d5a..2daca18 100644
--- a/xlat/Makemodule.am
+++ b/xlat/Makemodule.am
@@ -1,5 +1,5 @@
-XLAT_INPUT_FILES = xlat/access_flags.in xlat/aclipc.in xlat/addrfams.in xlat/adjtimex_modes.in xlat/adjtimex_state.in xlat/adjtimex_status.in xlat/advise.in xlat/af_packet_types.in xlat/archvals.in xlat/at_flags.in xlat/atomic_ops.in xlat/audit_arch.in xlat/baud_options.in xlat/blkpg_ops.in xlat/bootflags1.in xlat/bootflags2.in xlat/bootflags3.in xlat/bpf_class.in xlat/bpf_commands.in xlat/bpf_map_types.in xlat/bpf_map_update_elem_flags.in xlat/bpf_miscop.in xlat/bpf_mode.in xlat/bpf_op_alu.in xlat/bpf_op_jmp.in xlat/bpf_prog_types.in xlat/bpf_rval.in xlat/bpf_size.in xlat/bpf_src.in xlat/bsg_protocol.in xlat/bsg_subprotocol.in xlat/bt_protocols.in xlat/cacheflush_scope.in xlat/cap.in xlat/cap_mask0.in xlat/cap_mask1.in xlat/cap_version.in xlat/clockflags.in xlat/clocknames.in xlat/clone_flags.in xlat/cpuclocknames.in xlat/delete_module_flags.in xlat/dirent_types.in xlat/efd_flags.in xlat/epollctls.in xlat/epollevents.in xlat/epollflags.in xlat/evdev_abs.in xlat/evdev_autorepeat.in xlat/evdev_ev.in xlat/evdev_ff_status.in xlat/evdev_ff_types.in xlat/evdev_keycode.in xlat/evdev_leds.in xlat/evdev_misc.in xlat/evdev_mtslots.in xlat/evdev_prop.in xlat/evdev_relative_axes.in xlat/evdev_snd.in xlat/evdev_switch.in xlat/evdev_sync.in xlat/falloc_flags.in xlat/fan_classes.in xlat/fan_event_flags.in xlat/fan_init_flags.in xlat/fan_mark_flags.in xlat/fcntl64cmds.in xlat/fcntlcmds.in xlat/fdflags.in xlat/flockcmds.in xlat/f_owner_types.in xlat/f_seals.in xlat/fsmagic.in xlat/futexops.in xlat/futexwakecmps.in xlat/futexwakeops.in xlat/getrandom_flags.in xlat/getsockipoptions.in xlat/getsockipv6options.in xlat/icmpfilterflags.in xlat/if_dqblk_valid.in xlat/if_dqinfo_flags.in xlat/if_dqinfo_valid.in xlat/iffflags.in xlat/inet_protocols.in xlat/inotify_flags.in xlat/inotify_init_flags.in xlat/ioctl_dirs.in xlat/ioprio_class.in xlat/ioprio_who.in xlat/ipc_msg_flags.in xlat/ip_cmsg_types.in xlat/itimer_which.in xlat/kcmp_types.in xlat/kexec_arch_values.in xlat/kexec_file_load_flags.in xlat/kexec_load_flags.in xlat/keyctl_commands.in xlat/key_perms.in xlat/key_reqkeys.in xlat/key_spec.in xlat/lockfcmds.in xlat/loop_crypt_type_options.in xlat/loop_flags_options.in xlat/madvise_cmds.in xlat/mbindflags.in xlat/mctl_sync.in xlat/membarrier_cmds.in xlat/memfd_create_flags.in xlat/mempolicyflags.in xlat/mlockall_flags.in xlat/mlock_flags.in xlat/mmap_flags.in xlat/mmap_prot.in xlat/modem_flags.in xlat/modetypes.in xlat/module_init_flags.in xlat/mount_flags.in xlat/move_pages_flags.in xlat/mremap_flags.in xlat/msgctl_flags.in xlat/msg_flags.in xlat/mtd_file_mode_options.in xlat/mtd_flags_options.in xlat/mtd_mode_options.in xlat/mtd_nandecc_options.in xlat/mtd_otp_options.in xlat/mtd_type_options.in xlat/netlink_protocols.in xlat/notifyflags.in xlat/nt_descriptor_types.in xlat/open_access_modes.in xlat/open_mode_flags.in xlat/openmodessol.in xlat/packet_mreq_type.in xlat/perf_event_open_flags.in xlat/personality_flags.in xlat/personality_types.in xlat/policies.in xlat/pollflags.in xlat/pr_cap_ambient.in xlat/prctl_options.in xlat/priorities.in xlat/pr_mce_kill.in xlat/pr_mce_kill_policy.in xlat/pr_set_mm.in xlat/pr_tsc.in xlat/pr_unalign_flags.in xlat/ptp_flags_options.in xlat/ptrace_cmds.in xlat/ptrace_events.in xlat/ptrace_setoptions_flags.in xlat/quotacmds.in xlat/quota_formats.in xlat/quotatypes.in xlat/rename_flags.in xlat/resource_flags.in xlat/resources.in xlat/sched_flags.in xlat/schedulers.in xlat/scmvals.in xlat/secbits.in xlat/seccomp_filter_flags.in xlat/seccomp_mode.in xlat/seccomp_ops.in xlat/seccomp_ret_action.in xlat/semctl_flags.in xlat/semop_flags.in xlat/setsockipoptions.in xlat/setsockipv6options.in xlat/sfd_flags.in xlat/sg_io_dxfer_direction.in xlat/shmctl_flags.in xlat/shm_flags.in xlat/shm_resource_flags.in xlat/shutdown_modes.in xlat/sigact_flags.in xlat/sigaltstack_flags.in xlat/sigbus_codes.in xlat/sigchld_codes.in xlat/sigemt_codes.in xlat/sigev_value.in xlat/sigfpe_codes.in xlat/sigill_codes.in xlat/siginfo_codes.in xlat/sigpoll_codes.in xlat/sigprocmaskcmds.in xlat/sigprof_codes.in xlat/sigsegv_codes.in xlat/sigsys_codes.in xlat/sigtrap_codes.in xlat/socketlayers.in xlat/sockipoptions.in xlat/sockipv6options.in xlat/sockipxoptions.in xlat/sockoptions.in xlat/sockpacketoptions.in xlat/sockrawoptions.in xlat/socksctpoptions.in xlat/socktcpoptions.in xlat/sock_type_flags.in xlat/socktypes.in xlat/splice_flags.in xlat/sram_alloc_flags.in xlat/swap_flags.in xlat/sync_file_range_flags.in xlat/sysctl_kern.in xlat/sysctl_net_core.in xlat/sysctl_net.in xlat/sysctl_net_ipv4_conf.in xlat/sysctl_net_ipv4.in xlat/sysctl_net_ipv4_route.in xlat/sysctl_net_ipv6.in xlat/sysctl_net_ipv6_route.in xlat/sysctl_net_unix.in xlat/sysctl_root.in xlat/sysctl_vm.in xlat/syslog_action_type.in xlat/sysmips_operations.in xlat/tcflsh_options.in xlat/tcxonc_options.in xlat/timerfdflags.in xlat/ubi_volume_props.in xlat/ubi_volume_types.in xlat/uffd_flags.in xlat/umount_flags.in xlat/usagewho.in xlat/v4l2_buf_flags.in xlat/v4l2_buf_types.in xlat/v4l2_capture_modes.in xlat/v4l2_colorspaces.in xlat/v4l2_control_classes.in xlat/v4l2_control_flags.in xlat/v4l2_control_ids.in xlat/v4l2_control_types.in xlat/v4l2_device_capabilities_flags.in xlat/v4l2_fields.in xlat/v4l2_format_description_flags.in xlat/v4l2_frameinterval_types.in xlat/v4l2_framesize_types.in xlat/v4l2_input_types.in xlat/v4l2_memories.in xlat/v4l2_streaming_capabilities.in xlat/wait4_options.in xlat/waitid_types.in xlat/whence_codes.in xlat/xattrflags.in xlat/xfs_dqblk_flags.in xlat/xfs_quota_flags.in 
-XLAT_HEADER_FILES = xlat/access_flags.h xlat/aclipc.h xlat/addrfams.h xlat/adjtimex_modes.h xlat/adjtimex_state.h xlat/adjtimex_status.h xlat/advise.h xlat/af_packet_types.h xlat/archvals.h xlat/at_flags.h xlat/atomic_ops.h xlat/audit_arch.h xlat/baud_options.h xlat/blkpg_ops.h xlat/bootflags1.h xlat/bootflags2.h xlat/bootflags3.h xlat/bpf_class.h xlat/bpf_commands.h xlat/bpf_map_types.h xlat/bpf_map_update_elem_flags.h xlat/bpf_miscop.h xlat/bpf_mode.h xlat/bpf_op_alu.h xlat/bpf_op_jmp.h xlat/bpf_prog_types.h xlat/bpf_rval.h xlat/bpf_size.h xlat/bpf_src.h xlat/bsg_protocol.h xlat/bsg_subprotocol.h xlat/bt_protocols.h xlat/cacheflush_scope.h xlat/cap.h xlat/cap_mask0.h xlat/cap_mask1.h xlat/cap_version.h xlat/clockflags.h xlat/clocknames.h xlat/clone_flags.h xlat/cpuclocknames.h xlat/delete_module_flags.h xlat/dirent_types.h xlat/efd_flags.h xlat/epollctls.h xlat/epollevents.h xlat/epollflags.h xlat/evdev_abs.h xlat/evdev_autorepeat.h xlat/evdev_ev.h xlat/evdev_ff_status.h xlat/evdev_ff_types.h xlat/evdev_keycode.h xlat/evdev_leds.h xlat/evdev_misc.h xlat/evdev_mtslots.h xlat/evdev_prop.h xlat/evdev_relative_axes.h xlat/evdev_snd.h xlat/evdev_switch.h xlat/evdev_sync.h xlat/falloc_flags.h xlat/fan_classes.h xlat/fan_event_flags.h xlat/fan_init_flags.h xlat/fan_mark_flags.h xlat/fcntl64cmds.h xlat/fcntlcmds.h xlat/fdflags.h xlat/flockcmds.h xlat/f_owner_types.h xlat/f_seals.h xlat/fsmagic.h xlat/futexops.h xlat/futexwakecmps.h xlat/futexwakeops.h xlat/getrandom_flags.h xlat/getsockipoptions.h xlat/getsockipv6options.h xlat/icmpfilterflags.h xlat/if_dqblk_valid.h xlat/if_dqinfo_flags.h xlat/if_dqinfo_valid.h xlat/iffflags.h xlat/inet_protocols.h xlat/inotify_flags.h xlat/inotify_init_flags.h xlat/ioctl_dirs.h xlat/ioprio_class.h xlat/ioprio_who.h xlat/ipc_msg_flags.h xlat/ip_cmsg_types.h xlat/itimer_which.h xlat/kcmp_types.h xlat/kexec_arch_values.h xlat/kexec_file_load_flags.h xlat/kexec_load_flags.h xlat/keyctl_commands.h xlat/key_perms.h xlat/key_reqkeys.h xlat/key_spec.h xlat/lockfcmds.h xlat/loop_crypt_type_options.h xlat/loop_flags_options.h xlat/madvise_cmds.h xlat/mbindflags.h xlat/mctl_sync.h xlat/membarrier_cmds.h xlat/memfd_create_flags.h xlat/mempolicyflags.h xlat/mlockall_flags.h xlat/mlock_flags.h xlat/mmap_flags.h xlat/mmap_prot.h xlat/modem_flags.h xlat/modetypes.h xlat/module_init_flags.h xlat/mount_flags.h xlat/move_pages_flags.h xlat/mremap_flags.h xlat/msgctl_flags.h xlat/msg_flags.h xlat/mtd_file_mode_options.h xlat/mtd_flags_options.h xlat/mtd_mode_options.h xlat/mtd_nandecc_options.h xlat/mtd_otp_options.h xlat/mtd_type_options.h xlat/netlink_protocols.h xlat/notifyflags.h xlat/nt_descriptor_types.h xlat/open_access_modes.h xlat/open_mode_flags.h xlat/openmodessol.h xlat/packet_mreq_type.h xlat/perf_event_open_flags.h xlat/personality_flags.h xlat/personality_types.h xlat/policies.h xlat/pollflags.h xlat/pr_cap_ambient.h xlat/prctl_options.h xlat/priorities.h xlat/pr_mce_kill.h xlat/pr_mce_kill_policy.h xlat/pr_set_mm.h xlat/pr_tsc.h xlat/pr_unalign_flags.h xlat/ptp_flags_options.h xlat/ptrace_cmds.h xlat/ptrace_events.h xlat/ptrace_setoptions_flags.h xlat/quotacmds.h xlat/quota_formats.h xlat/quotatypes.h xlat/rename_flags.h xlat/resource_flags.h xlat/resources.h xlat/sched_flags.h xlat/schedulers.h xlat/scmvals.h xlat/secbits.h xlat/seccomp_filter_flags.h xlat/seccomp_mode.h xlat/seccomp_ops.h xlat/seccomp_ret_action.h xlat/semctl_flags.h xlat/semop_flags.h xlat/setsockipoptions.h xlat/setsockipv6options.h xlat/sfd_flags.h xlat/sg_io_dxfer_direction.h xlat/shmctl_flags.h xlat/shm_flags.h xlat/shm_resource_flags.h xlat/shutdown_modes.h xlat/sigact_flags.h xlat/sigaltstack_flags.h xlat/sigbus_codes.h xlat/sigchld_codes.h xlat/sigemt_codes.h xlat/sigev_value.h xlat/sigfpe_codes.h xlat/sigill_codes.h xlat/siginfo_codes.h xlat/sigpoll_codes.h xlat/sigprocmaskcmds.h xlat/sigprof_codes.h xlat/sigsegv_codes.h xlat/sigsys_codes.h xlat/sigtrap_codes.h xlat/socketlayers.h xlat/sockipoptions.h xlat/sockipv6options.h xlat/sockipxoptions.h xlat/sockoptions.h xlat/sockpacketoptions.h xlat/sockrawoptions.h xlat/socksctpoptions.h xlat/socktcpoptions.h xlat/sock_type_flags.h xlat/socktypes.h xlat/splice_flags.h xlat/sram_alloc_flags.h xlat/swap_flags.h xlat/sync_file_range_flags.h xlat/sysctl_kern.h xlat/sysctl_net_core.h xlat/sysctl_net.h xlat/sysctl_net_ipv4_conf.h xlat/sysctl_net_ipv4.h xlat/sysctl_net_ipv4_route.h xlat/sysctl_net_ipv6.h xlat/sysctl_net_ipv6_route.h xlat/sysctl_net_unix.h xlat/sysctl_root.h xlat/sysctl_vm.h xlat/syslog_action_type.h xlat/sysmips_operations.h xlat/tcflsh_options.h xlat/tcxonc_options.h xlat/timerfdflags.h xlat/ubi_volume_props.h xlat/ubi_volume_types.h xlat/uffd_flags.h xlat/umount_flags.h xlat/usagewho.h xlat/v4l2_buf_flags.h xlat/v4l2_buf_types.h xlat/v4l2_capture_modes.h xlat/v4l2_colorspaces.h xlat/v4l2_control_classes.h xlat/v4l2_control_flags.h xlat/v4l2_control_ids.h xlat/v4l2_control_types.h xlat/v4l2_device_capabilities_flags.h xlat/v4l2_fields.h xlat/v4l2_format_description_flags.h xlat/v4l2_frameinterval_types.h xlat/v4l2_framesize_types.h xlat/v4l2_input_types.h xlat/v4l2_memories.h xlat/v4l2_streaming_capabilities.h xlat/wait4_options.h xlat/waitid_types.h xlat/whence_codes.h xlat/xattrflags.h xlat/xfs_dqblk_flags.h xlat/xfs_quota_flags.h 
+XLAT_INPUT_FILES = xlat/access_flags.in xlat/aclipc.in xlat/addrfams.in xlat/adjtimex_modes.in xlat/adjtimex_state.in xlat/adjtimex_status.in xlat/advise.in xlat/af_packet_types.in xlat/archvals.in xlat/at_flags.in xlat/atomic_ops.in xlat/audit_arch.in xlat/baud_options.in xlat/blkpg_ops.in xlat/bootflags1.in xlat/bootflags2.in xlat/bootflags3.in xlat/bpf_class.in xlat/bpf_commands.in xlat/bpf_map_types.in xlat/bpf_map_update_elem_flags.in xlat/bpf_miscop.in xlat/bpf_mode.in xlat/bpf_op_alu.in xlat/bpf_op_jmp.in xlat/bpf_prog_types.in xlat/bpf_rval.in xlat/bpf_size.in xlat/bpf_src.in xlat/bsg_protocol.in xlat/bsg_subprotocol.in xlat/bt_protocols.in xlat/btrfs_balance_args.in xlat/btrfs_balance_ctl_cmds.in xlat/btrfs_balance_flags.in xlat/btrfs_balance_state.in xlat/btrfs_compress_types.in xlat/btrfs_defrag_flags.in xlat/btrfs_dev_replace_cmds.in xlat/btrfs_dev_replace_results.in xlat/btrfs_dev_replace_state.in xlat/btrfs_dev_stats_flags.in xlat/btrfs_dev_stats_values.in xlat/btrfs_features_compat.in xlat/btrfs_features_compat_ro.in xlat/btrfs_features_incompat.in xlat/btrfs_key_types.in xlat/btrfs_qgroup_ctl_cmds.in xlat/btrfs_qgroup_inherit_flags.in xlat/btrfs_qgroup_limit_flags.in xlat/btrfs_qgroup_status_flags.in xlat/btrfs_scrub_flags.in xlat/btrfs_send_flags.in xlat/btrfs_snap_flags_v2.in xlat/btrfs_space_info_flags.in xlat/btrfs_tree_objectids.in xlat/cacheflush_scope.in xlat/cap.in xlat/cap_mask0.in xlat/cap_mask1.in xlat/cap_version.in xlat/clockflags.in xlat/clocknames.in xlat/clone_flags.in xlat/cpuclocknames.in xlat/delete_module_flags.in xlat/dirent_types.in xlat/efd_flags.in xlat/epollctls.in xlat/epollevents.in xlat/epollflags.in xlat/evdev_abs.in xlat/evdev_autorepeat.in xlat/evdev_ev.in xlat/evdev_ff_status.in xlat/evdev_ff_types.in xlat/evdev_keycode.in xlat/evdev_leds.in xlat/evdev_misc.in xlat/evdev_mtslots.in xlat/evdev_prop.in xlat/evdev_relative_axes.in xlat/evdev_snd.in xlat/evdev_switch.in xlat/evdev_sync.in xlat/falloc_flags.in xlat/fan_classes.in xlat/fan_event_flags.in xlat/fan_init_flags.in xlat/fan_mark_flags.in xlat/fcntl64cmds.in xlat/fcntlcmds.in xlat/fdflags.in xlat/fiemap_extent_flags.in xlat/fiemap_flags.in xlat/flockcmds.in xlat/f_owner_types.in xlat/f_seals.in xlat/fsmagic.in xlat/futexops.in xlat/futexwakecmps.in xlat/futexwakeops.in xlat/getrandom_flags.in xlat/getsockipoptions.in xlat/getsockipv6options.in xlat/icmpfilterflags.in xlat/if_dqblk_valid.in xlat/if_dqinfo_flags.in xlat/if_dqinfo_valid.in xlat/iffflags.in xlat/inet_protocols.in xlat/inotify_flags.in xlat/inotify_init_flags.in xlat/ioctl_dirs.in xlat/ioprio_class.in xlat/ioprio_who.in xlat/ipc_msg_flags.in xlat/ip_cmsg_types.in xlat/itimer_which.in xlat/kcmp_types.in xlat/kexec_arch_values.in xlat/kexec_file_load_flags.in xlat/kexec_load_flags.in xlat/keyctl_commands.in xlat/key_perms.in xlat/key_reqkeys.in xlat/key_spec.in xlat/lockfcmds.in xlat/loop_crypt_type_options.in xlat/loop_flags_options.in xlat/madvise_cmds.in xlat/mbindflags.in xlat/mctl_sync.in xlat/membarrier_cmds.in xlat/memfd_create_flags.in xlat/mempolicyflags.in xlat/mlockall_flags.in xlat/mlock_flags.in xlat/mmap_flags.in xlat/mmap_prot.in xlat/modem_flags.in xlat/modetypes.in xlat/module_init_flags.in xlat/mount_flags.in xlat/move_pages_flags.in xlat/mremap_flags.in xlat/msgctl_flags.in xlat/msg_flags.in xlat/mtd_file_mode_options.in xlat/mtd_flags_options.in xlat/mtd_mode_options.in xlat/mtd_nandecc_options.in xlat/mtd_otp_options.in xlat/mtd_type_options.in xlat/netlink_protocols.in xlat/notifyflags.in xlat/nt_descriptor_types.in xlat/open_access_modes.in xlat/open_mode_flags.in xlat/openmodessol.in xlat/packet_mreq_type.in xlat/perf_event_open_flags.in xlat/personality_flags.in xlat/personality_types.in xlat/policies.in xlat/pollflags.in xlat/pr_cap_ambient.in xlat/prctl_options.in xlat/priorities.in xlat/pr_mce_kill.in xlat/pr_mce_kill_policy.in xlat/pr_set_mm.in xlat/pr_tsc.in xlat/pr_unalign_flags.in xlat/ptp_flags_options.in xlat/ptrace_cmds.in xlat/ptrace_events.in xlat/ptrace_peeksiginfo_flags.in xlat/ptrace_setoptions_flags.in xlat/quotacmds.in xlat/quota_formats.in xlat/quotatypes.in xlat/rename_flags.in xlat/resource_flags.in xlat/resources.in xlat/rwf_flags.in xlat/sched_flags.in xlat/schedulers.in xlat/scmvals.in xlat/secbits.in xlat/seccomp_filter_flags.in xlat/seccomp_mode.in xlat/seccomp_ops.in xlat/seccomp_ret_action.in xlat/semctl_flags.in xlat/semop_flags.in xlat/setsockipoptions.in xlat/setsockipv6options.in xlat/sfd_flags.in xlat/sg_io_dxfer_direction.in xlat/shmctl_flags.in xlat/shm_flags.in xlat/shm_resource_flags.in xlat/shutdown_modes.in xlat/sigact_flags.in xlat/sigaltstack_flags.in xlat/sigbus_codes.in xlat/sigchld_codes.in xlat/sigemt_codes.in xlat/sigev_value.in xlat/sigfpe_codes.in xlat/sigill_codes.in xlat/siginfo_codes.in xlat/sigpoll_codes.in xlat/sigprocmaskcmds.in xlat/sigprof_codes.in xlat/sigsegv_codes.in xlat/sigsys_codes.in xlat/sigtrap_codes.in xlat/socketlayers.in xlat/sockipoptions.in xlat/sockipv6options.in xlat/sockipxoptions.in xlat/sockoptions.in xlat/sockpacketoptions.in xlat/sockrawoptions.in xlat/socksctpoptions.in xlat/socktcpoptions.in xlat/sock_type_flags.in xlat/socktypes.in xlat/splice_flags.in xlat/sram_alloc_flags.in xlat/statfs_flags.in xlat/swap_flags.in xlat/sync_file_range_flags.in xlat/sysctl_kern.in xlat/sysctl_net_core.in xlat/sysctl_net.in xlat/sysctl_net_ipv4_conf.in xlat/sysctl_net_ipv4.in xlat/sysctl_net_ipv4_route.in xlat/sysctl_net_ipv6.in xlat/sysctl_net_ipv6_route.in xlat/sysctl_net_unix.in xlat/sysctl_root.in xlat/sysctl_vm.in xlat/syslog_action_type.in xlat/sysmips_operations.in xlat/tcflsh_options.in xlat/tcxonc_options.in xlat/timerfdflags.in xlat/ubi_volume_props.in xlat/ubi_volume_types.in xlat/uffd_api_flags.in xlat/uffd_copy_flags.in xlat/uffd_flags.in xlat/uffd_register_ioctl_flags.in xlat/uffd_register_mode_flags.in xlat/uffd_zeropage_flags.in xlat/umount_flags.in xlat/usagewho.in xlat/v4l2_buf_flags.in xlat/v4l2_buf_types.in xlat/v4l2_capture_modes.in xlat/v4l2_colorspaces.in xlat/v4l2_control_classes.in xlat/v4l2_control_flags.in xlat/v4l2_control_ids.in xlat/v4l2_control_types.in xlat/v4l2_device_capabilities_flags.in xlat/v4l2_fields.in xlat/v4l2_format_description_flags.in xlat/v4l2_frameinterval_types.in xlat/v4l2_framesize_types.in xlat/v4l2_input_types.in xlat/v4l2_memories.in xlat/v4l2_streaming_capabilities.in xlat/wait4_options.in xlat/waitid_types.in xlat/whence_codes.in xlat/xattrflags.in xlat/xfs_dqblk_flags.in xlat/xfs_quota_flags.in 
+XLAT_HEADER_FILES = xlat/access_flags.h xlat/aclipc.h xlat/addrfams.h xlat/adjtimex_modes.h xlat/adjtimex_state.h xlat/adjtimex_status.h xlat/advise.h xlat/af_packet_types.h xlat/archvals.h xlat/at_flags.h xlat/atomic_ops.h xlat/audit_arch.h xlat/baud_options.h xlat/blkpg_ops.h xlat/bootflags1.h xlat/bootflags2.h xlat/bootflags3.h xlat/bpf_class.h xlat/bpf_commands.h xlat/bpf_map_types.h xlat/bpf_map_update_elem_flags.h xlat/bpf_miscop.h xlat/bpf_mode.h xlat/bpf_op_alu.h xlat/bpf_op_jmp.h xlat/bpf_prog_types.h xlat/bpf_rval.h xlat/bpf_size.h xlat/bpf_src.h xlat/bsg_protocol.h xlat/bsg_subprotocol.h xlat/bt_protocols.h xlat/btrfs_balance_args.h xlat/btrfs_balance_ctl_cmds.h xlat/btrfs_balance_flags.h xlat/btrfs_balance_state.h xlat/btrfs_compress_types.h xlat/btrfs_defrag_flags.h xlat/btrfs_dev_replace_cmds.h xlat/btrfs_dev_replace_results.h xlat/btrfs_dev_replace_state.h xlat/btrfs_dev_stats_flags.h xlat/btrfs_dev_stats_values.h xlat/btrfs_features_compat.h xlat/btrfs_features_compat_ro.h xlat/btrfs_features_incompat.h xlat/btrfs_key_types.h xlat/btrfs_qgroup_ctl_cmds.h xlat/btrfs_qgroup_inherit_flags.h xlat/btrfs_qgroup_limit_flags.h xlat/btrfs_qgroup_status_flags.h xlat/btrfs_scrub_flags.h xlat/btrfs_send_flags.h xlat/btrfs_snap_flags_v2.h xlat/btrfs_space_info_flags.h xlat/btrfs_tree_objectids.h xlat/cacheflush_scope.h xlat/cap.h xlat/cap_mask0.h xlat/cap_mask1.h xlat/cap_version.h xlat/clockflags.h xlat/clocknames.h xlat/clone_flags.h xlat/cpuclocknames.h xlat/delete_module_flags.h xlat/dirent_types.h xlat/efd_flags.h xlat/epollctls.h xlat/epollevents.h xlat/epollflags.h xlat/evdev_abs.h xlat/evdev_autorepeat.h xlat/evdev_ev.h xlat/evdev_ff_status.h xlat/evdev_ff_types.h xlat/evdev_keycode.h xlat/evdev_leds.h xlat/evdev_misc.h xlat/evdev_mtslots.h xlat/evdev_prop.h xlat/evdev_relative_axes.h xlat/evdev_snd.h xlat/evdev_switch.h xlat/evdev_sync.h xlat/falloc_flags.h xlat/fan_classes.h xlat/fan_event_flags.h xlat/fan_init_flags.h xlat/fan_mark_flags.h xlat/fcntl64cmds.h xlat/fcntlcmds.h xlat/fdflags.h xlat/fiemap_extent_flags.h xlat/fiemap_flags.h xlat/flockcmds.h xlat/f_owner_types.h xlat/f_seals.h xlat/fsmagic.h xlat/futexops.h xlat/futexwakecmps.h xlat/futexwakeops.h xlat/getrandom_flags.h xlat/getsockipoptions.h xlat/getsockipv6options.h xlat/icmpfilterflags.h xlat/if_dqblk_valid.h xlat/if_dqinfo_flags.h xlat/if_dqinfo_valid.h xlat/iffflags.h xlat/inet_protocols.h xlat/inotify_flags.h xlat/inotify_init_flags.h xlat/ioctl_dirs.h xlat/ioprio_class.h xlat/ioprio_who.h xlat/ipc_msg_flags.h xlat/ip_cmsg_types.h xlat/itimer_which.h xlat/kcmp_types.h xlat/kexec_arch_values.h xlat/kexec_file_load_flags.h xlat/kexec_load_flags.h xlat/keyctl_commands.h xlat/key_perms.h xlat/key_reqkeys.h xlat/key_spec.h xlat/lockfcmds.h xlat/loop_crypt_type_options.h xlat/loop_flags_options.h xlat/madvise_cmds.h xlat/mbindflags.h xlat/mctl_sync.h xlat/membarrier_cmds.h xlat/memfd_create_flags.h xlat/mempolicyflags.h xlat/mlockall_flags.h xlat/mlock_flags.h xlat/mmap_flags.h xlat/mmap_prot.h xlat/modem_flags.h xlat/modetypes.h xlat/module_init_flags.h xlat/mount_flags.h xlat/move_pages_flags.h xlat/mremap_flags.h xlat/msgctl_flags.h xlat/msg_flags.h xlat/mtd_file_mode_options.h xlat/mtd_flags_options.h xlat/mtd_mode_options.h xlat/mtd_nandecc_options.h xlat/mtd_otp_options.h xlat/mtd_type_options.h xlat/netlink_protocols.h xlat/notifyflags.h xlat/nt_descriptor_types.h xlat/open_access_modes.h xlat/open_mode_flags.h xlat/openmodessol.h xlat/packet_mreq_type.h xlat/perf_event_open_flags.h xlat/personality_flags.h xlat/personality_types.h xlat/policies.h xlat/pollflags.h xlat/pr_cap_ambient.h xlat/prctl_options.h xlat/priorities.h xlat/pr_mce_kill.h xlat/pr_mce_kill_policy.h xlat/pr_set_mm.h xlat/pr_tsc.h xlat/pr_unalign_flags.h xlat/ptp_flags_options.h xlat/ptrace_cmds.h xlat/ptrace_events.h xlat/ptrace_peeksiginfo_flags.h xlat/ptrace_setoptions_flags.h xlat/quotacmds.h xlat/quota_formats.h xlat/quotatypes.h xlat/rename_flags.h xlat/resource_flags.h xlat/resources.h xlat/rwf_flags.h xlat/sched_flags.h xlat/schedulers.h xlat/scmvals.h xlat/secbits.h xlat/seccomp_filter_flags.h xlat/seccomp_mode.h xlat/seccomp_ops.h xlat/seccomp_ret_action.h xlat/semctl_flags.h xlat/semop_flags.h xlat/setsockipoptions.h xlat/setsockipv6options.h xlat/sfd_flags.h xlat/sg_io_dxfer_direction.h xlat/shmctl_flags.h xlat/shm_flags.h xlat/shm_resource_flags.h xlat/shutdown_modes.h xlat/sigact_flags.h xlat/sigaltstack_flags.h xlat/sigbus_codes.h xlat/sigchld_codes.h xlat/sigemt_codes.h xlat/sigev_value.h xlat/sigfpe_codes.h xlat/sigill_codes.h xlat/siginfo_codes.h xlat/sigpoll_codes.h xlat/sigprocmaskcmds.h xlat/sigprof_codes.h xlat/sigsegv_codes.h xlat/sigsys_codes.h xlat/sigtrap_codes.h xlat/socketlayers.h xlat/sockipoptions.h xlat/sockipv6options.h xlat/sockipxoptions.h xlat/sockoptions.h xlat/sockpacketoptions.h xlat/sockrawoptions.h xlat/socksctpoptions.h xlat/socktcpoptions.h xlat/sock_type_flags.h xlat/socktypes.h xlat/splice_flags.h xlat/sram_alloc_flags.h xlat/statfs_flags.h xlat/swap_flags.h xlat/sync_file_range_flags.h xlat/sysctl_kern.h xlat/sysctl_net_core.h xlat/sysctl_net.h xlat/sysctl_net_ipv4_conf.h xlat/sysctl_net_ipv4.h xlat/sysctl_net_ipv4_route.h xlat/sysctl_net_ipv6.h xlat/sysctl_net_ipv6_route.h xlat/sysctl_net_unix.h xlat/sysctl_root.h xlat/sysctl_vm.h xlat/syslog_action_type.h xlat/sysmips_operations.h xlat/tcflsh_options.h xlat/tcxonc_options.h xlat/timerfdflags.h xlat/ubi_volume_props.h xlat/ubi_volume_types.h xlat/uffd_api_flags.h xlat/uffd_copy_flags.h xlat/uffd_flags.h xlat/uffd_register_ioctl_flags.h xlat/uffd_register_mode_flags.h xlat/uffd_zeropage_flags.h xlat/umount_flags.h xlat/usagewho.h xlat/v4l2_buf_flags.h xlat/v4l2_buf_types.h xlat/v4l2_capture_modes.h xlat/v4l2_colorspaces.h xlat/v4l2_control_classes.h xlat/v4l2_control_flags.h xlat/v4l2_control_ids.h xlat/v4l2_control_types.h xlat/v4l2_device_capabilities_flags.h xlat/v4l2_fields.h xlat/v4l2_format_description_flags.h xlat/v4l2_frameinterval_types.h xlat/v4l2_framesize_types.h xlat/v4l2_input_types.h xlat/v4l2_memories.h xlat/v4l2_streaming_capabilities.h xlat/wait4_options.h xlat/waitid_types.h xlat/whence_codes.h xlat/xattrflags.h xlat/xfs_dqblk_flags.h xlat/xfs_quota_flags.h 
 $(top_srcdir)/xlat/access_flags.h: $(top_srcdir)/xlat/access_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/aclipc.h: $(top_srcdir)/xlat/aclipc.in $(top_srcdir)/xlat/gen.sh
@@ -64,6 +64,54 @@
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/bt_protocols.h: $(top_srcdir)/xlat/bt_protocols.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_balance_args.h: $(top_srcdir)/xlat/btrfs_balance_args.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_balance_ctl_cmds.h: $(top_srcdir)/xlat/btrfs_balance_ctl_cmds.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_balance_flags.h: $(top_srcdir)/xlat/btrfs_balance_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_balance_state.h: $(top_srcdir)/xlat/btrfs_balance_state.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_compress_types.h: $(top_srcdir)/xlat/btrfs_compress_types.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_defrag_flags.h: $(top_srcdir)/xlat/btrfs_defrag_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_dev_replace_cmds.h: $(top_srcdir)/xlat/btrfs_dev_replace_cmds.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_dev_replace_results.h: $(top_srcdir)/xlat/btrfs_dev_replace_results.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_dev_replace_state.h: $(top_srcdir)/xlat/btrfs_dev_replace_state.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_dev_stats_flags.h: $(top_srcdir)/xlat/btrfs_dev_stats_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_dev_stats_values.h: $(top_srcdir)/xlat/btrfs_dev_stats_values.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_features_compat.h: $(top_srcdir)/xlat/btrfs_features_compat.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_features_compat_ro.h: $(top_srcdir)/xlat/btrfs_features_compat_ro.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_features_incompat.h: $(top_srcdir)/xlat/btrfs_features_incompat.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_key_types.h: $(top_srcdir)/xlat/btrfs_key_types.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_qgroup_ctl_cmds.h: $(top_srcdir)/xlat/btrfs_qgroup_ctl_cmds.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_qgroup_inherit_flags.h: $(top_srcdir)/xlat/btrfs_qgroup_inherit_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_qgroup_limit_flags.h: $(top_srcdir)/xlat/btrfs_qgroup_limit_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_qgroup_status_flags.h: $(top_srcdir)/xlat/btrfs_qgroup_status_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_scrub_flags.h: $(top_srcdir)/xlat/btrfs_scrub_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_send_flags.h: $(top_srcdir)/xlat/btrfs_send_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_snap_flags_v2.h: $(top_srcdir)/xlat/btrfs_snap_flags_v2.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_space_info_flags.h: $(top_srcdir)/xlat/btrfs_space_info_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/btrfs_tree_objectids.h: $(top_srcdir)/xlat/btrfs_tree_objectids.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/cacheflush_scope.h: $(top_srcdir)/xlat/cacheflush_scope.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/cap.h: $(top_srcdir)/xlat/cap.in $(top_srcdir)/xlat/gen.sh
@@ -138,6 +186,10 @@
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/fdflags.h: $(top_srcdir)/xlat/fdflags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/fiemap_extent_flags.h: $(top_srcdir)/xlat/fiemap_extent_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/fiemap_flags.h: $(top_srcdir)/xlat/fiemap_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/flockcmds.h: $(top_srcdir)/xlat/flockcmds.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/f_owner_types.h: $(top_srcdir)/xlat/f_owner_types.in $(top_srcdir)/xlat/gen.sh
@@ -302,6 +354,8 @@
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/ptrace_events.h: $(top_srcdir)/xlat/ptrace_events.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/ptrace_peeksiginfo_flags.h: $(top_srcdir)/xlat/ptrace_peeksiginfo_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/ptrace_setoptions_flags.h: $(top_srcdir)/xlat/ptrace_setoptions_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/quotacmds.h: $(top_srcdir)/xlat/quotacmds.in $(top_srcdir)/xlat/gen.sh
@@ -316,6 +370,8 @@
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/resources.h: $(top_srcdir)/xlat/resources.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/rwf_flags.h: $(top_srcdir)/xlat/rwf_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/sched_flags.h: $(top_srcdir)/xlat/sched_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/schedulers.h: $(top_srcdir)/xlat/schedulers.in $(top_srcdir)/xlat/gen.sh
@@ -408,6 +464,8 @@
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/sram_alloc_flags.h: $(top_srcdir)/xlat/sram_alloc_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/statfs_flags.h: $(top_srcdir)/xlat/statfs_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/swap_flags.h: $(top_srcdir)/xlat/swap_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/sync_file_range_flags.h: $(top_srcdir)/xlat/sync_file_range_flags.in $(top_srcdir)/xlat/gen.sh
@@ -448,8 +506,18 @@
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/ubi_volume_types.h: $(top_srcdir)/xlat/ubi_volume_types.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/uffd_api_flags.h: $(top_srcdir)/xlat/uffd_api_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/uffd_copy_flags.h: $(top_srcdir)/xlat/uffd_copy_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/uffd_flags.h: $(top_srcdir)/xlat/uffd_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/uffd_register_ioctl_flags.h: $(top_srcdir)/xlat/uffd_register_ioctl_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/uffd_register_mode_flags.h: $(top_srcdir)/xlat/uffd_register_mode_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
+$(top_srcdir)/xlat/uffd_zeropage_flags.h: $(top_srcdir)/xlat/uffd_zeropage_flags.in $(top_srcdir)/xlat/gen.sh
+	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/umount_flags.h: $(top_srcdir)/xlat/umount_flags.in $(top_srcdir)/xlat/gen.sh
 	$(AM_V_GEN)$(top_srcdir)/xlat/gen.sh $< $@
 $(top_srcdir)/xlat/usagewho.h: $(top_srcdir)/xlat/usagewho.in $(top_srcdir)/xlat/gen.sh
diff --git a/xlat/addrfams.h b/xlat/addrfams.h
index 410cc69..7bfcc88 100644
--- a/xlat/addrfams.h
+++ b/xlat/addrfams.h
@@ -1,4 +1,7 @@
 /* Generated by ./xlat/gen.sh from ./xlat/addrfams.in; do not edit. */
+#if !(defined(AF_KCM) || (defined(HAVE_DECL_AF_KCM) && HAVE_DECL_AF_KCM))
+# define AF_KCM 41
+#endif
 
 #ifndef IN_MPERS
 
@@ -132,6 +135,7 @@
 #if defined(AF_VSOCK) || (defined(HAVE_DECL_AF_VSOCK) && HAVE_DECL_AF_VSOCK)
   XLAT(AF_VSOCK),
 #endif
+ XLAT(AF_KCM),
  XLAT_END
 };
 
diff --git a/xlat/addrfams.in b/xlat/addrfams.in
index 7b1a861..f8c49d7 100644
--- a/xlat/addrfams.in
+++ b/xlat/addrfams.in
@@ -41,3 +41,4 @@
 AF_ALG
 AF_NFC
 AF_VSOCK
+AF_KCM		41
diff --git a/xlat/blkpg_ops.h b/xlat/blkpg_ops.h
index 0697fc0..bc36705 100644
--- a/xlat/blkpg_ops.h
+++ b/xlat/blkpg_ops.h
@@ -11,11 +11,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat blkpg_ops in mpers mode
+extern const struct xlat blkpg_ops[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat blkpg_ops[] = {
  XLAT(BLKPG_ADD_PARTITION),
  XLAT(BLKPG_DEL_PARTITION),
diff --git a/xlat/btrfs_balance_args.h b/xlat/btrfs_balance_args.h
new file mode 100644
index 0000000..d1f1091
--- /dev/null
+++ b/xlat/btrfs_balance_args.h
@@ -0,0 +1,60 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_balance_args.in; do not edit. */
+#if !(defined(BTRFS_BALANCE_ARGS_PROFILES) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_PROFILES) && HAVE_DECL_BTRFS_BALANCE_ARGS_PROFILES))
+# define BTRFS_BALANCE_ARGS_PROFILES (1ULL << 0)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_USAGE) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_USAGE) && HAVE_DECL_BTRFS_BALANCE_ARGS_USAGE))
+# define BTRFS_BALANCE_ARGS_USAGE (1ULL << 1)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_DEVID) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_DEVID) && HAVE_DECL_BTRFS_BALANCE_ARGS_DEVID))
+# define BTRFS_BALANCE_ARGS_DEVID (1ULL << 2)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_DRANGE) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_DRANGE) && HAVE_DECL_BTRFS_BALANCE_ARGS_DRANGE))
+# define BTRFS_BALANCE_ARGS_DRANGE (1ULL << 3)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_VRANGE) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_VRANGE) && HAVE_DECL_BTRFS_BALANCE_ARGS_VRANGE))
+# define BTRFS_BALANCE_ARGS_VRANGE (1ULL << 4)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_LIMIT) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_LIMIT) && HAVE_DECL_BTRFS_BALANCE_ARGS_LIMIT))
+# define BTRFS_BALANCE_ARGS_LIMIT (1ULL << 5)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_LIMIT_RANGE) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_LIMIT_RANGE) && HAVE_DECL_BTRFS_BALANCE_ARGS_LIMIT_RANGE))
+# define BTRFS_BALANCE_ARGS_LIMIT_RANGE (1ULL << 6)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_STRIPES_RANGE) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_STRIPES_RANGE) && HAVE_DECL_BTRFS_BALANCE_ARGS_STRIPES_RANGE))
+# define BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_CONVERT) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_CONVERT) && HAVE_DECL_BTRFS_BALANCE_ARGS_CONVERT))
+# define BTRFS_BALANCE_ARGS_CONVERT (1ULL << 8)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_SOFT) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_SOFT) && HAVE_DECL_BTRFS_BALANCE_ARGS_SOFT))
+# define BTRFS_BALANCE_ARGS_SOFT (1ULL << 9)
+#endif
+#if !(defined(BTRFS_BALANCE_ARGS_USAGE_RANGE) || (defined(HAVE_DECL_BTRFS_BALANCE_ARGS_USAGE_RANGE) && HAVE_DECL_BTRFS_BALANCE_ARGS_USAGE_RANGE))
+# define BTRFS_BALANCE_ARGS_USAGE_RANGE (1ULL << 10)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_balance_args[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_balance_args[] = {
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_PROFILES),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_USAGE),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_DEVID),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_DRANGE),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_VRANGE),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_LIMIT),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_LIMIT_RANGE),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_STRIPES_RANGE),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_CONVERT),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_SOFT),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ARGS_USAGE_RANGE),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_balance_args.in b/xlat/btrfs_balance_args.in
new file mode 100644
index 0000000..ffeaacc
--- /dev/null
+++ b/xlat/btrfs_balance_args.in
@@ -0,0 +1,12 @@
+#val_type uint64_t
+BTRFS_BALANCE_ARGS_PROFILES	(1ULL << 0)
+BTRFS_BALANCE_ARGS_USAGE	(1ULL << 1)
+BTRFS_BALANCE_ARGS_DEVID	(1ULL << 2)
+BTRFS_BALANCE_ARGS_DRANGE	(1ULL << 3)
+BTRFS_BALANCE_ARGS_VRANGE	(1ULL << 4)
+BTRFS_BALANCE_ARGS_LIMIT        (1ULL << 5)
+BTRFS_BALANCE_ARGS_LIMIT_RANGE  (1ULL << 6)
+BTRFS_BALANCE_ARGS_STRIPES_RANGE (1ULL << 7)
+BTRFS_BALANCE_ARGS_CONVERT	(1ULL << 8)
+BTRFS_BALANCE_ARGS_SOFT		(1ULL << 9)
+BTRFS_BALANCE_ARGS_USAGE_RANGE	(1ULL << 10)
diff --git a/xlat/btrfs_balance_ctl_cmds.h b/xlat/btrfs_balance_ctl_cmds.h
new file mode 100644
index 0000000..9bdc820
--- /dev/null
+++ b/xlat/btrfs_balance_ctl_cmds.h
@@ -0,0 +1,24 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_balance_ctl_cmds.in; do not edit. */
+#if !(defined(BTRFS_BALANCE_CTL_PAUSE) || (defined(HAVE_DECL_BTRFS_BALANCE_CTL_PAUSE) && HAVE_DECL_BTRFS_BALANCE_CTL_PAUSE))
+# define BTRFS_BALANCE_CTL_PAUSE 1
+#endif
+#if !(defined(BTRFS_BALANCE_CTL_CANCEL) || (defined(HAVE_DECL_BTRFS_BALANCE_CTL_CANCEL) && HAVE_DECL_BTRFS_BALANCE_CTL_CANCEL))
+# define BTRFS_BALANCE_CTL_CANCEL 2
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_balance_ctl_cmds[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_balance_ctl_cmds[] = {
+ XLAT(BTRFS_BALANCE_CTL_PAUSE),
+ XLAT(BTRFS_BALANCE_CTL_CANCEL),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_balance_ctl_cmds.in b/xlat/btrfs_balance_ctl_cmds.in
new file mode 100644
index 0000000..5cdd0bc
--- /dev/null
+++ b/xlat/btrfs_balance_ctl_cmds.in
@@ -0,0 +1,2 @@
+BTRFS_BALANCE_CTL_PAUSE         1
+BTRFS_BALANCE_CTL_CANCEL        2
diff --git a/xlat/btrfs_balance_flags.h b/xlat/btrfs_balance_flags.h
new file mode 100644
index 0000000..c071b6e
--- /dev/null
+++ b/xlat/btrfs_balance_flags.h
@@ -0,0 +1,36 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_balance_flags.in; do not edit. */
+#if !(defined(BTRFS_BALANCE_DATA) || (defined(HAVE_DECL_BTRFS_BALANCE_DATA) && HAVE_DECL_BTRFS_BALANCE_DATA))
+# define BTRFS_BALANCE_DATA (1ULL << 0)
+#endif
+#if !(defined(BTRFS_BALANCE_SYSTEM) || (defined(HAVE_DECL_BTRFS_BALANCE_SYSTEM) && HAVE_DECL_BTRFS_BALANCE_SYSTEM))
+# define BTRFS_BALANCE_SYSTEM (1ULL << 1)
+#endif
+#if !(defined(BTRFS_BALANCE_METADATA) || (defined(HAVE_DECL_BTRFS_BALANCE_METADATA) && HAVE_DECL_BTRFS_BALANCE_METADATA))
+# define BTRFS_BALANCE_METADATA (1ULL << 2)
+#endif
+#if !(defined(BTRFS_BALANCE_FORCE) || (defined(HAVE_DECL_BTRFS_BALANCE_FORCE) && HAVE_DECL_BTRFS_BALANCE_FORCE))
+# define BTRFS_BALANCE_FORCE (1ULL << 3)
+#endif
+#if !(defined(BTRFS_BALANCE_RESUME) || (defined(HAVE_DECL_BTRFS_BALANCE_RESUME) && HAVE_DECL_BTRFS_BALANCE_RESUME))
+# define BTRFS_BALANCE_RESUME (1ULL << 4)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_balance_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_balance_flags[] = {
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_DATA),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_SYSTEM),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_METADATA),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_FORCE),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_RESUME),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_balance_flags.in b/xlat/btrfs_balance_flags.in
new file mode 100644
index 0000000..00ae0d1
--- /dev/null
+++ b/xlat/btrfs_balance_flags.in
@@ -0,0 +1,6 @@
+#val_type uint64_t
+BTRFS_BALANCE_DATA              (1ULL << 0)
+BTRFS_BALANCE_SYSTEM            (1ULL << 1)
+BTRFS_BALANCE_METADATA          (1ULL << 2)
+BTRFS_BALANCE_FORCE		(1ULL << 3)
+BTRFS_BALANCE_RESUME		(1ULL << 4)
diff --git a/xlat/btrfs_balance_state.h b/xlat/btrfs_balance_state.h
new file mode 100644
index 0000000..64c8511
--- /dev/null
+++ b/xlat/btrfs_balance_state.h
@@ -0,0 +1,28 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_balance_state.in; do not edit. */
+#if !(defined(BTRFS_BALANCE_STATE_RUNNING) || (defined(HAVE_DECL_BTRFS_BALANCE_STATE_RUNNING) && HAVE_DECL_BTRFS_BALANCE_STATE_RUNNING))
+# define BTRFS_BALANCE_STATE_RUNNING (1ULL << 0)
+#endif
+#if !(defined(BTRFS_BALANCE_STATE_PAUSE_REQ) || (defined(HAVE_DECL_BTRFS_BALANCE_STATE_PAUSE_REQ) && HAVE_DECL_BTRFS_BALANCE_STATE_PAUSE_REQ))
+# define BTRFS_BALANCE_STATE_PAUSE_REQ (1ULL << 1)
+#endif
+#if !(defined(BTRFS_BALANCE_STATE_CANCEL_REQ) || (defined(HAVE_DECL_BTRFS_BALANCE_STATE_CANCEL_REQ) && HAVE_DECL_BTRFS_BALANCE_STATE_CANCEL_REQ))
+# define BTRFS_BALANCE_STATE_CANCEL_REQ (1ULL << 2)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_balance_state[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_balance_state[] = {
+ XLAT(BTRFS_BALANCE_STATE_RUNNING),
+ XLAT(BTRFS_BALANCE_STATE_PAUSE_REQ),
+ XLAT(BTRFS_BALANCE_STATE_CANCEL_REQ),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_balance_state.in b/xlat/btrfs_balance_state.in
new file mode 100644
index 0000000..5dbfca5
--- /dev/null
+++ b/xlat/btrfs_balance_state.in
@@ -0,0 +1,3 @@
+BTRFS_BALANCE_STATE_RUNNING     (1ULL << 0)
+BTRFS_BALANCE_STATE_PAUSE_REQ   (1ULL << 1)
+BTRFS_BALANCE_STATE_CANCEL_REQ  (1ULL << 2)
diff --git a/xlat/btrfs_compress_types.h b/xlat/btrfs_compress_types.h
new file mode 100644
index 0000000..dd89c63
--- /dev/null
+++ b/xlat/btrfs_compress_types.h
@@ -0,0 +1,28 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_compress_types.in; do not edit. */
+#if !(defined(BTRFS_COMPRESS_NONE) || (defined(HAVE_DECL_BTRFS_COMPRESS_NONE) && HAVE_DECL_BTRFS_COMPRESS_NONE))
+# define BTRFS_COMPRESS_NONE 0
+#endif
+#if !(defined(BTRFS_COMPRESS_ZLIB) || (defined(HAVE_DECL_BTRFS_COMPRESS_ZLIB) && HAVE_DECL_BTRFS_COMPRESS_ZLIB))
+# define BTRFS_COMPRESS_ZLIB 1
+#endif
+#if !(defined(BTRFS_COMPRESS_LZO) || (defined(HAVE_DECL_BTRFS_COMPRESS_LZO) && HAVE_DECL_BTRFS_COMPRESS_LZO))
+# define BTRFS_COMPRESS_LZO 2
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_compress_types[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_compress_types[] = {
+ XLAT(BTRFS_COMPRESS_NONE),
+ XLAT(BTRFS_COMPRESS_ZLIB),
+ XLAT(BTRFS_COMPRESS_LZO),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_compress_types.in b/xlat/btrfs_compress_types.in
new file mode 100644
index 0000000..c47d59f
--- /dev/null
+++ b/xlat/btrfs_compress_types.in
@@ -0,0 +1,3 @@
+BTRFS_COMPRESS_NONE 0
+BTRFS_COMPRESS_ZLIB 1
+BTRFS_COMPRESS_LZO 2
diff --git a/xlat/btrfs_defrag_flags.h b/xlat/btrfs_defrag_flags.h
new file mode 100644
index 0000000..2990b21
--- /dev/null
+++ b/xlat/btrfs_defrag_flags.h
@@ -0,0 +1,22 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_defrag_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_defrag_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_defrag_flags[] = {
+#if defined(BTRFS_DEFRAG_RANGE_COMPRESS) || (defined(HAVE_DECL_BTRFS_DEFRAG_RANGE_COMPRESS) && HAVE_DECL_BTRFS_DEFRAG_RANGE_COMPRESS)
+  XLAT_TYPE(uint64_t, BTRFS_DEFRAG_RANGE_COMPRESS),
+#endif
+#if defined(BTRFS_DEFRAG_RANGE_START_IO) || (defined(HAVE_DECL_BTRFS_DEFRAG_RANGE_START_IO) && HAVE_DECL_BTRFS_DEFRAG_RANGE_START_IO)
+  XLAT_TYPE(uint64_t, BTRFS_DEFRAG_RANGE_START_IO),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_defrag_flags.in b/xlat/btrfs_defrag_flags.in
new file mode 100644
index 0000000..ae026c8
--- /dev/null
+++ b/xlat/btrfs_defrag_flags.in
@@ -0,0 +1,3 @@
+#val_type uint64_t
+BTRFS_DEFRAG_RANGE_COMPRESS
+BTRFS_DEFRAG_RANGE_START_IO
diff --git a/xlat/btrfs_dev_replace_cmds.h b/xlat/btrfs_dev_replace_cmds.h
new file mode 100644
index 0000000..83bd044
--- /dev/null
+++ b/xlat/btrfs_dev_replace_cmds.h
@@ -0,0 +1,25 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_dev_replace_cmds.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_dev_replace_cmds[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_dev_replace_cmds[] = {
+#if defined(BTRFS_IOCTL_DEV_REPLACE_CMD_START) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_CMD_START) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_CMD_START)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_CMD_START),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_dev_replace_cmds.in b/xlat/btrfs_dev_replace_cmds.in
new file mode 100644
index 0000000..18600f0
--- /dev/null
+++ b/xlat/btrfs_dev_replace_cmds.in
@@ -0,0 +1,4 @@
+#val_type uint64_t
+BTRFS_IOCTL_DEV_REPLACE_CMD_START
+BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS
+BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL
diff --git a/xlat/btrfs_dev_replace_results.h b/xlat/btrfs_dev_replace_results.h
new file mode 100644
index 0000000..62fe4f8
--- /dev/null
+++ b/xlat/btrfs_dev_replace_results.h
@@ -0,0 +1,28 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_dev_replace_results.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_dev_replace_results[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_dev_replace_results[] = {
+#if defined(BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_dev_replace_results.in b/xlat/btrfs_dev_replace_results.in
new file mode 100644
index 0000000..bf89282
--- /dev/null
+++ b/xlat/btrfs_dev_replace_results.in
@@ -0,0 +1,5 @@
+#val_type uint64_t
+BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR
+BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED
+BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED
+BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS
diff --git a/xlat/btrfs_dev_replace_state.h b/xlat/btrfs_dev_replace_state.h
new file mode 100644
index 0000000..7095c1a
--- /dev/null
+++ b/xlat/btrfs_dev_replace_state.h
@@ -0,0 +1,31 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_dev_replace_state.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_dev_replace_state[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_dev_replace_state[] = {
+#if defined(BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED),
+#endif
+#if defined(BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED) || (defined(HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED) && HAVE_DECL_BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED)
+  XLAT_TYPE(uint64_t, BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_dev_replace_state.in b/xlat/btrfs_dev_replace_state.in
new file mode 100644
index 0000000..bbc0ba1
--- /dev/null
+++ b/xlat/btrfs_dev_replace_state.in
@@ -0,0 +1,6 @@
+#val_type uint64_t
+BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED
+BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED
+BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED
+BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED
+BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED
diff --git a/xlat/btrfs_dev_stats_flags.h b/xlat/btrfs_dev_stats_flags.h
new file mode 100644
index 0000000..7bfbb09
--- /dev/null
+++ b/xlat/btrfs_dev_stats_flags.h
@@ -0,0 +1,19 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_dev_stats_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_dev_stats_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_dev_stats_flags[] = {
+#if defined(BTRFS_DEV_STATS_RESET) || (defined(HAVE_DECL_BTRFS_DEV_STATS_RESET) && HAVE_DECL_BTRFS_DEV_STATS_RESET)
+  XLAT_TYPE(uint64_t, BTRFS_DEV_STATS_RESET),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_dev_stats_flags.in b/xlat/btrfs_dev_stats_flags.in
new file mode 100644
index 0000000..9ff56c3
--- /dev/null
+++ b/xlat/btrfs_dev_stats_flags.in
@@ -0,0 +1,2 @@
+#val_type uint64_t
+BTRFS_DEV_STATS_RESET
diff --git a/xlat/btrfs_dev_stats_values.h b/xlat/btrfs_dev_stats_values.h
new file mode 100644
index 0000000..eaaeff0
--- /dev/null
+++ b/xlat/btrfs_dev_stats_values.h
@@ -0,0 +1,21 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_dev_stats_values.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_dev_stats_values[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_dev_stats_values[] = {
+ XLAT_TYPE(uint64_t, BTRFS_DEV_STAT_WRITE_ERRS),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_STAT_READ_ERRS),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_STAT_FLUSH_ERRS),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_STAT_CORRUPTION_ERRS),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_STAT_GENERATION_ERRS),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_dev_stats_values.in b/xlat/btrfs_dev_stats_values.in
new file mode 100644
index 0000000..02a37be
--- /dev/null
+++ b/xlat/btrfs_dev_stats_values.in
@@ -0,0 +1,7 @@
+#val_type uint64_t
+#unconditional
+BTRFS_DEV_STAT_WRITE_ERRS
+BTRFS_DEV_STAT_READ_ERRS
+BTRFS_DEV_STAT_FLUSH_ERRS
+BTRFS_DEV_STAT_CORRUPTION_ERRS
+BTRFS_DEV_STAT_GENERATION_ERRS
diff --git a/xlat/btrfs_features_compat.h b/xlat/btrfs_features_compat.h
new file mode 100644
index 0000000..d1e61d8
--- /dev/null
+++ b/xlat/btrfs_features_compat.h
@@ -0,0 +1,16 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_features_compat.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_features_compat[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_features_compat[] = {
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_features_compat.in b/xlat/btrfs_features_compat.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/xlat/btrfs_features_compat.in
diff --git a/xlat/btrfs_features_compat_ro.h b/xlat/btrfs_features_compat_ro.h
new file mode 100644
index 0000000..adb9a4d
--- /dev/null
+++ b/xlat/btrfs_features_compat_ro.h
@@ -0,0 +1,20 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_features_compat_ro.in; do not edit. */
+#if !(defined(BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE) || (defined(HAVE_DECL_BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE) && HAVE_DECL_BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE))
+# define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_features_compat_ro[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_features_compat_ro[] = {
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_features_compat_ro.in b/xlat/btrfs_features_compat_ro.in
new file mode 100644
index 0000000..3fd1b6d
--- /dev/null
+++ b/xlat/btrfs_features_compat_ro.in
@@ -0,0 +1,2 @@
+#val_type uint64_t
+BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
diff --git a/xlat/btrfs_features_incompat.h b/xlat/btrfs_features_incompat.h
new file mode 100644
index 0000000..b012f41
--- /dev/null
+++ b/xlat/btrfs_features_incompat.h
@@ -0,0 +1,56 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_features_incompat.in; do not edit. */
+#if !(defined(BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF))
+# define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL))
+# define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS))
+# define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO))
+# define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2))
+# define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2 (1ULL << 4)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_BIG_METADATA) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_BIG_METADATA) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_BIG_METADATA))
+# define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF))
+# define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_RAID56) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_RAID56) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_RAID56))
+# define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA))
+# define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8)
+#endif
+#if !(defined(BTRFS_FEATURE_INCOMPAT_NO_HOLES) || (defined(HAVE_DECL_BTRFS_FEATURE_INCOMPAT_NO_HOLES) && HAVE_DECL_BTRFS_FEATURE_INCOMPAT_NO_HOLES))
+# define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_features_incompat[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_features_incompat[] = {
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_BIG_METADATA),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_RAID56),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA),
+ XLAT_TYPE(uint64_t, BTRFS_FEATURE_INCOMPAT_NO_HOLES),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_features_incompat.in b/xlat/btrfs_features_incompat.in
new file mode 100644
index 0000000..45baacf
--- /dev/null
+++ b/xlat/btrfs_features_incompat.in
@@ -0,0 +1,11 @@
+#val_type uint64_t
+BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF    (1ULL << 0)
+BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL   (1ULL << 1)
+BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS     (1ULL << 2)
+BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO     (1ULL << 3)
+BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2   (1ULL << 4)
+BTRFS_FEATURE_INCOMPAT_BIG_METADATA     (1ULL << 5)
+BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF    (1ULL << 6)
+BTRFS_FEATURE_INCOMPAT_RAID56           (1ULL << 7)
+BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA  (1ULL << 8)
+BTRFS_FEATURE_INCOMPAT_NO_HOLES         (1ULL << 9)
diff --git a/xlat/btrfs_key_types.h b/xlat/btrfs_key_types.h
new file mode 100644
index 0000000..1a72165
--- /dev/null
+++ b/xlat/btrfs_key_types.h
@@ -0,0 +1,180 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_key_types.in; do not edit. */
+#if !(defined(BTRFS_INODE_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_INODE_ITEM_KEY) && HAVE_DECL_BTRFS_INODE_ITEM_KEY))
+# define BTRFS_INODE_ITEM_KEY 1
+#endif
+#if !(defined(BTRFS_INODE_REF_KEY) || (defined(HAVE_DECL_BTRFS_INODE_REF_KEY) && HAVE_DECL_BTRFS_INODE_REF_KEY))
+# define BTRFS_INODE_REF_KEY 12
+#endif
+#if !(defined(BTRFS_INODE_EXTREF_KEY) || (defined(HAVE_DECL_BTRFS_INODE_EXTREF_KEY) && HAVE_DECL_BTRFS_INODE_EXTREF_KEY))
+# define BTRFS_INODE_EXTREF_KEY 13
+#endif
+#if !(defined(BTRFS_XATTR_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_XATTR_ITEM_KEY) && HAVE_DECL_BTRFS_XATTR_ITEM_KEY))
+# define BTRFS_XATTR_ITEM_KEY 24
+#endif
+#if !(defined(BTRFS_ORPHAN_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_ORPHAN_ITEM_KEY) && HAVE_DECL_BTRFS_ORPHAN_ITEM_KEY))
+# define BTRFS_ORPHAN_ITEM_KEY 48
+#endif
+#if !(defined(BTRFS_DIR_LOG_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_DIR_LOG_ITEM_KEY) && HAVE_DECL_BTRFS_DIR_LOG_ITEM_KEY))
+# define BTRFS_DIR_LOG_ITEM_KEY 60
+#endif
+#if !(defined(BTRFS_DIR_LOG_INDEX_KEY) || (defined(HAVE_DECL_BTRFS_DIR_LOG_INDEX_KEY) && HAVE_DECL_BTRFS_DIR_LOG_INDEX_KEY))
+# define BTRFS_DIR_LOG_INDEX_KEY 72
+#endif
+#if !(defined(BTRFS_DIR_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_DIR_ITEM_KEY) && HAVE_DECL_BTRFS_DIR_ITEM_KEY))
+# define BTRFS_DIR_ITEM_KEY 84
+#endif
+#if !(defined(BTRFS_DIR_INDEX_KEY) || (defined(HAVE_DECL_BTRFS_DIR_INDEX_KEY) && HAVE_DECL_BTRFS_DIR_INDEX_KEY))
+# define BTRFS_DIR_INDEX_KEY 96
+#endif
+#if !(defined(BTRFS_EXTENT_DATA_KEY) || (defined(HAVE_DECL_BTRFS_EXTENT_DATA_KEY) && HAVE_DECL_BTRFS_EXTENT_DATA_KEY))
+# define BTRFS_EXTENT_DATA_KEY 108
+#endif
+#if !(defined(BTRFS_EXTENT_CSUM_KEY) || (defined(HAVE_DECL_BTRFS_EXTENT_CSUM_KEY) && HAVE_DECL_BTRFS_EXTENT_CSUM_KEY))
+# define BTRFS_EXTENT_CSUM_KEY 128
+#endif
+#if !(defined(BTRFS_ROOT_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_ROOT_ITEM_KEY) && HAVE_DECL_BTRFS_ROOT_ITEM_KEY))
+# define BTRFS_ROOT_ITEM_KEY 132
+#endif
+#if !(defined(BTRFS_ROOT_BACKREF_KEY) || (defined(HAVE_DECL_BTRFS_ROOT_BACKREF_KEY) && HAVE_DECL_BTRFS_ROOT_BACKREF_KEY))
+# define BTRFS_ROOT_BACKREF_KEY 144
+#endif
+#if !(defined(BTRFS_ROOT_REF_KEY) || (defined(HAVE_DECL_BTRFS_ROOT_REF_KEY) && HAVE_DECL_BTRFS_ROOT_REF_KEY))
+# define BTRFS_ROOT_REF_KEY 156
+#endif
+#if !(defined(BTRFS_EXTENT_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_EXTENT_ITEM_KEY) && HAVE_DECL_BTRFS_EXTENT_ITEM_KEY))
+# define BTRFS_EXTENT_ITEM_KEY 168
+#endif
+#if !(defined(BTRFS_METADATA_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_METADATA_ITEM_KEY) && HAVE_DECL_BTRFS_METADATA_ITEM_KEY))
+# define BTRFS_METADATA_ITEM_KEY 169
+#endif
+#if !(defined(BTRFS_TREE_BLOCK_REF_KEY) || (defined(HAVE_DECL_BTRFS_TREE_BLOCK_REF_KEY) && HAVE_DECL_BTRFS_TREE_BLOCK_REF_KEY))
+# define BTRFS_TREE_BLOCK_REF_KEY 176
+#endif
+#if !(defined(BTRFS_EXTENT_DATA_REF_KEY) || (defined(HAVE_DECL_BTRFS_EXTENT_DATA_REF_KEY) && HAVE_DECL_BTRFS_EXTENT_DATA_REF_KEY))
+# define BTRFS_EXTENT_DATA_REF_KEY 178
+#endif
+#if !(defined(BTRFS_EXTENT_REF_V0_KEY) || (defined(HAVE_DECL_BTRFS_EXTENT_REF_V0_KEY) && HAVE_DECL_BTRFS_EXTENT_REF_V0_KEY))
+# define BTRFS_EXTENT_REF_V0_KEY 180
+#endif
+#if !(defined(BTRFS_SHARED_BLOCK_REF_KEY) || (defined(HAVE_DECL_BTRFS_SHARED_BLOCK_REF_KEY) && HAVE_DECL_BTRFS_SHARED_BLOCK_REF_KEY))
+# define BTRFS_SHARED_BLOCK_REF_KEY 182
+#endif
+#if !(defined(BTRFS_SHARED_DATA_REF_KEY) || (defined(HAVE_DECL_BTRFS_SHARED_DATA_REF_KEY) && HAVE_DECL_BTRFS_SHARED_DATA_REF_KEY))
+# define BTRFS_SHARED_DATA_REF_KEY 184
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_ITEM_KEY) && HAVE_DECL_BTRFS_BLOCK_GROUP_ITEM_KEY))
+# define BTRFS_BLOCK_GROUP_ITEM_KEY 192
+#endif
+#if !(defined(BTRFS_FREE_SPACE_INFO_KEY) || (defined(HAVE_DECL_BTRFS_FREE_SPACE_INFO_KEY) && HAVE_DECL_BTRFS_FREE_SPACE_INFO_KEY))
+# define BTRFS_FREE_SPACE_INFO_KEY 198
+#endif
+#if !(defined(BTRFS_FREE_SPACE_EXTENT_KEY) || (defined(HAVE_DECL_BTRFS_FREE_SPACE_EXTENT_KEY) && HAVE_DECL_BTRFS_FREE_SPACE_EXTENT_KEY))
+# define BTRFS_FREE_SPACE_EXTENT_KEY 199
+#endif
+#if !(defined(BTRFS_FREE_SPACE_BITMAP_KEY) || (defined(HAVE_DECL_BTRFS_FREE_SPACE_BITMAP_KEY) && HAVE_DECL_BTRFS_FREE_SPACE_BITMAP_KEY))
+# define BTRFS_FREE_SPACE_BITMAP_KEY 200
+#endif
+#if !(defined(BTRFS_DEV_EXTENT_KEY) || (defined(HAVE_DECL_BTRFS_DEV_EXTENT_KEY) && HAVE_DECL_BTRFS_DEV_EXTENT_KEY))
+# define BTRFS_DEV_EXTENT_KEY 204
+#endif
+#if !(defined(BTRFS_DEV_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_DEV_ITEM_KEY) && HAVE_DECL_BTRFS_DEV_ITEM_KEY))
+# define BTRFS_DEV_ITEM_KEY 216
+#endif
+#if !(defined(BTRFS_CHUNK_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_CHUNK_ITEM_KEY) && HAVE_DECL_BTRFS_CHUNK_ITEM_KEY))
+# define BTRFS_CHUNK_ITEM_KEY 228
+#endif
+#if !(defined(BTRFS_QGROUP_STATUS_KEY) || (defined(HAVE_DECL_BTRFS_QGROUP_STATUS_KEY) && HAVE_DECL_BTRFS_QGROUP_STATUS_KEY))
+# define BTRFS_QGROUP_STATUS_KEY 240
+#endif
+#if !(defined(BTRFS_QGROUP_INFO_KEY) || (defined(HAVE_DECL_BTRFS_QGROUP_INFO_KEY) && HAVE_DECL_BTRFS_QGROUP_INFO_KEY))
+# define BTRFS_QGROUP_INFO_KEY 242
+#endif
+#if !(defined(BTRFS_QGROUP_LIMIT_KEY) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_KEY) && HAVE_DECL_BTRFS_QGROUP_LIMIT_KEY))
+# define BTRFS_QGROUP_LIMIT_KEY 244
+#endif
+#if !(defined(BTRFS_QGROUP_RELATION_KEY) || (defined(HAVE_DECL_BTRFS_QGROUP_RELATION_KEY) && HAVE_DECL_BTRFS_QGROUP_RELATION_KEY))
+# define BTRFS_QGROUP_RELATION_KEY 246
+#endif
+#if !(defined(BTRFS_BALANCE_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_BALANCE_ITEM_KEY) && HAVE_DECL_BTRFS_BALANCE_ITEM_KEY))
+# define BTRFS_BALANCE_ITEM_KEY 248
+#endif
+#if !(defined(BTRFS_TEMPORARY_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_TEMPORARY_ITEM_KEY) && HAVE_DECL_BTRFS_TEMPORARY_ITEM_KEY))
+# define BTRFS_TEMPORARY_ITEM_KEY 248
+#endif
+#if !(defined(BTRFS_DEV_STATS_KEY) || (defined(HAVE_DECL_BTRFS_DEV_STATS_KEY) && HAVE_DECL_BTRFS_DEV_STATS_KEY))
+# define BTRFS_DEV_STATS_KEY 249
+#endif
+#if !(defined(BTRFS_PERSISTENT_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_PERSISTENT_ITEM_KEY) && HAVE_DECL_BTRFS_PERSISTENT_ITEM_KEY))
+# define BTRFS_PERSISTENT_ITEM_KEY 249
+#endif
+#if !(defined(BTRFS_DEV_REPLACE_KEY) || (defined(HAVE_DECL_BTRFS_DEV_REPLACE_KEY) && HAVE_DECL_BTRFS_DEV_REPLACE_KEY))
+# define BTRFS_DEV_REPLACE_KEY 250
+#endif
+#if !(defined(BTRFS_UUID_KEY_SUBVOL) || (defined(HAVE_DECL_BTRFS_UUID_KEY_SUBVOL) && HAVE_DECL_BTRFS_UUID_KEY_SUBVOL))
+# define BTRFS_UUID_KEY_SUBVOL 251
+#endif
+#if !(defined(BTRFS_UUID_KEY_RECEIVED_SUBVOL) || (defined(HAVE_DECL_BTRFS_UUID_KEY_RECEIVED_SUBVOL) && HAVE_DECL_BTRFS_UUID_KEY_RECEIVED_SUBVOL))
+# define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252
+#endif
+#if !(defined(BTRFS_STRING_ITEM_KEY) || (defined(HAVE_DECL_BTRFS_STRING_ITEM_KEY) && HAVE_DECL_BTRFS_STRING_ITEM_KEY))
+# define BTRFS_STRING_ITEM_KEY 253
+#endif
+#if !(defined(UINT32_MAX) || (defined(HAVE_DECL_UINT32_MAX) && HAVE_DECL_UINT32_MAX))
+# define UINT32_MAX -1U
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_key_types[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_key_types[] = {
+ XLAT_TYPE(uint64_t, BTRFS_INODE_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_INODE_REF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_INODE_EXTREF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_XATTR_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_ORPHAN_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DIR_LOG_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DIR_LOG_INDEX_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DIR_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DIR_INDEX_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_EXTENT_DATA_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_EXTENT_CSUM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_ROOT_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_ROOT_BACKREF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_ROOT_REF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_EXTENT_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_METADATA_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_TREE_BLOCK_REF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_EXTENT_DATA_REF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_EXTENT_REF_V0_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_SHARED_BLOCK_REF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_SHARED_DATA_REF_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_FREE_SPACE_INFO_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_FREE_SPACE_EXTENT_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_FREE_SPACE_BITMAP_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_EXTENT_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_CHUNK_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_STATUS_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_INFO_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_RELATION_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_BALANCE_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_TEMPORARY_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_STATS_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_PERSISTENT_ITEM_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_REPLACE_KEY),
+ XLAT_TYPE(uint64_t, BTRFS_UUID_KEY_SUBVOL),
+ XLAT_TYPE(uint64_t, BTRFS_UUID_KEY_RECEIVED_SUBVOL),
+ XLAT_TYPE(uint64_t, BTRFS_STRING_ITEM_KEY),
+ XLAT_TYPE(uint64_t, UINT32_MAX),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_key_types.in b/xlat/btrfs_key_types.in
new file mode 100644
index 0000000..5721e60
--- /dev/null
+++ b/xlat/btrfs_key_types.in
@@ -0,0 +1,42 @@
+#val_type uint64_t
+BTRFS_INODE_ITEM_KEY            1
+BTRFS_INODE_REF_KEY             12
+BTRFS_INODE_EXTREF_KEY          13
+BTRFS_XATTR_ITEM_KEY            24
+BTRFS_ORPHAN_ITEM_KEY           48
+BTRFS_DIR_LOG_ITEM_KEY  60
+BTRFS_DIR_LOG_INDEX_KEY 72
+BTRFS_DIR_ITEM_KEY      84
+BTRFS_DIR_INDEX_KEY     96
+BTRFS_EXTENT_DATA_KEY   108
+BTRFS_EXTENT_CSUM_KEY   128
+BTRFS_ROOT_ITEM_KEY     132
+BTRFS_ROOT_BACKREF_KEY  144
+BTRFS_ROOT_REF_KEY      156
+BTRFS_EXTENT_ITEM_KEY   168
+BTRFS_METADATA_ITEM_KEY 169
+BTRFS_TREE_BLOCK_REF_KEY        176
+BTRFS_EXTENT_DATA_REF_KEY       178
+BTRFS_EXTENT_REF_V0_KEY         180
+BTRFS_SHARED_BLOCK_REF_KEY      182
+BTRFS_SHARED_DATA_REF_KEY       184
+BTRFS_BLOCK_GROUP_ITEM_KEY 192
+BTRFS_FREE_SPACE_INFO_KEY 198
+BTRFS_FREE_SPACE_EXTENT_KEY 199
+BTRFS_FREE_SPACE_BITMAP_KEY 200
+BTRFS_DEV_EXTENT_KEY    204
+BTRFS_DEV_ITEM_KEY      216
+BTRFS_CHUNK_ITEM_KEY    228
+BTRFS_QGROUP_STATUS_KEY         240
+BTRFS_QGROUP_INFO_KEY           242
+BTRFS_QGROUP_LIMIT_KEY          244
+BTRFS_QGROUP_RELATION_KEY       246
+BTRFS_BALANCE_ITEM_KEY  248
+BTRFS_TEMPORARY_ITEM_KEY        248
+BTRFS_DEV_STATS_KEY             249
+BTRFS_PERSISTENT_ITEM_KEY       249
+BTRFS_DEV_REPLACE_KEY   250
+BTRFS_UUID_KEY_SUBVOL   251
+BTRFS_UUID_KEY_RECEIVED_SUBVOL  252
+BTRFS_STRING_ITEM_KEY   253
+UINT32_MAX -1U
diff --git a/xlat/btrfs_qgroup_ctl_cmds.h b/xlat/btrfs_qgroup_ctl_cmds.h
new file mode 100644
index 0000000..25bdce2
--- /dev/null
+++ b/xlat/btrfs_qgroup_ctl_cmds.h
@@ -0,0 +1,25 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_qgroup_ctl_cmds.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_qgroup_ctl_cmds[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_qgroup_ctl_cmds[] = {
+#if defined(BTRFS_QUOTA_CTL_ENABLE) || (defined(HAVE_DECL_BTRFS_QUOTA_CTL_ENABLE) && HAVE_DECL_BTRFS_QUOTA_CTL_ENABLE)
+  XLAT_TYPE(uint64_t, BTRFS_QUOTA_CTL_ENABLE),
+#endif
+#if defined(BTRFS_QUOTA_CTL_DISABLE) || (defined(HAVE_DECL_BTRFS_QUOTA_CTL_DISABLE) && HAVE_DECL_BTRFS_QUOTA_CTL_DISABLE)
+  XLAT_TYPE(uint64_t, BTRFS_QUOTA_CTL_DISABLE),
+#endif
+#if defined(BTRFS_QUOTA_CTL_RESCAN__NOTUSED) || (defined(HAVE_DECL_BTRFS_QUOTA_CTL_RESCAN__NOTUSED) && HAVE_DECL_BTRFS_QUOTA_CTL_RESCAN__NOTUSED)
+  XLAT_TYPE(uint64_t, BTRFS_QUOTA_CTL_RESCAN__NOTUSED),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_qgroup_ctl_cmds.in b/xlat/btrfs_qgroup_ctl_cmds.in
new file mode 100644
index 0000000..05e2003
--- /dev/null
+++ b/xlat/btrfs_qgroup_ctl_cmds.in
@@ -0,0 +1,4 @@
+#val_type uint64_t
+BTRFS_QUOTA_CTL_ENABLE
+BTRFS_QUOTA_CTL_DISABLE
+BTRFS_QUOTA_CTL_RESCAN__NOTUSED
diff --git a/xlat/btrfs_qgroup_inherit_flags.h b/xlat/btrfs_qgroup_inherit_flags.h
new file mode 100644
index 0000000..ead56ea
--- /dev/null
+++ b/xlat/btrfs_qgroup_inherit_flags.h
@@ -0,0 +1,19 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_qgroup_inherit_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_qgroup_inherit_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_qgroup_inherit_flags[] = {
+#if defined(BTRFS_QGROUP_INHERIT_SET_LIMITS) || (defined(HAVE_DECL_BTRFS_QGROUP_INHERIT_SET_LIMITS) && HAVE_DECL_BTRFS_QGROUP_INHERIT_SET_LIMITS)
+  XLAT_TYPE(uint64_t, BTRFS_QGROUP_INHERIT_SET_LIMITS),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_qgroup_inherit_flags.in b/xlat/btrfs_qgroup_inherit_flags.in
new file mode 100644
index 0000000..0e133b9
--- /dev/null
+++ b/xlat/btrfs_qgroup_inherit_flags.in
@@ -0,0 +1,2 @@
+#val_type uint64_t
+BTRFS_QGROUP_INHERIT_SET_LIMITS
diff --git a/xlat/btrfs_qgroup_limit_flags.h b/xlat/btrfs_qgroup_limit_flags.h
new file mode 100644
index 0000000..114c876
--- /dev/null
+++ b/xlat/btrfs_qgroup_limit_flags.h
@@ -0,0 +1,40 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_qgroup_limit_flags.in; do not edit. */
+#if !(defined(BTRFS_QGROUP_LIMIT_MAX_RFER) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_MAX_RFER) && HAVE_DECL_BTRFS_QGROUP_LIMIT_MAX_RFER))
+# define BTRFS_QGROUP_LIMIT_MAX_RFER (1ULL << 0)
+#endif
+#if !(defined(BTRFS_QGROUP_LIMIT_MAX_EXCL) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_MAX_EXCL) && HAVE_DECL_BTRFS_QGROUP_LIMIT_MAX_EXCL))
+# define BTRFS_QGROUP_LIMIT_MAX_EXCL (1ULL << 1)
+#endif
+#if !(defined(BTRFS_QGROUP_LIMIT_RSV_RFER) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_RSV_RFER) && HAVE_DECL_BTRFS_QGROUP_LIMIT_RSV_RFER))
+# define BTRFS_QGROUP_LIMIT_RSV_RFER (1ULL << 2)
+#endif
+#if !(defined(BTRFS_QGROUP_LIMIT_RSV_EXCL) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_RSV_EXCL) && HAVE_DECL_BTRFS_QGROUP_LIMIT_RSV_EXCL))
+# define BTRFS_QGROUP_LIMIT_RSV_EXCL (1ULL << 3)
+#endif
+#if !(defined(BTRFS_QGROUP_LIMIT_RFER_CMPR) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_RFER_CMPR) && HAVE_DECL_BTRFS_QGROUP_LIMIT_RFER_CMPR))
+# define BTRFS_QGROUP_LIMIT_RFER_CMPR (1ULL << 4)
+#endif
+#if !(defined(BTRFS_QGROUP_LIMIT_EXCL_CMPR) || (defined(HAVE_DECL_BTRFS_QGROUP_LIMIT_EXCL_CMPR) && HAVE_DECL_BTRFS_QGROUP_LIMIT_EXCL_CMPR))
+# define BTRFS_QGROUP_LIMIT_EXCL_CMPR (1ULL << 5)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_qgroup_limit_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_qgroup_limit_flags[] = {
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_MAX_RFER),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_MAX_EXCL),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_RSV_RFER),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_RSV_EXCL),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_RFER_CMPR),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_LIMIT_EXCL_CMPR),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_qgroup_limit_flags.in b/xlat/btrfs_qgroup_limit_flags.in
new file mode 100644
index 0000000..bac7abe
--- /dev/null
+++ b/xlat/btrfs_qgroup_limit_flags.in
@@ -0,0 +1,7 @@
+#val_type uint64_t
+BTRFS_QGROUP_LIMIT_MAX_RFER     (1ULL << 0)
+BTRFS_QGROUP_LIMIT_MAX_EXCL     (1ULL << 1)
+BTRFS_QGROUP_LIMIT_RSV_RFER     (1ULL << 2)
+BTRFS_QGROUP_LIMIT_RSV_EXCL     (1ULL << 3)
+BTRFS_QGROUP_LIMIT_RFER_CMPR    (1ULL << 4)
+BTRFS_QGROUP_LIMIT_EXCL_CMPR    (1ULL << 5)
diff --git a/xlat/btrfs_qgroup_status_flags.h b/xlat/btrfs_qgroup_status_flags.h
new file mode 100644
index 0000000..d02a86b
--- /dev/null
+++ b/xlat/btrfs_qgroup_status_flags.h
@@ -0,0 +1,24 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_qgroup_status_flags.in; do not edit. */
+#if !(defined(BTRFS_QGROUP_STATUS_FLAG_ON) || (defined(HAVE_DECL_BTRFS_QGROUP_STATUS_FLAG_ON) && HAVE_DECL_BTRFS_QGROUP_STATUS_FLAG_ON))
+# define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
+#endif
+#if !(defined(BTRFS_QGROUP_STATUS_FLAG_RESCAN) || (defined(HAVE_DECL_BTRFS_QGROUP_STATUS_FLAG_RESCAN) && HAVE_DECL_BTRFS_QGROUP_STATUS_FLAG_RESCAN))
+# define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_qgroup_status_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_qgroup_status_flags[] = {
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_STATUS_FLAG_ON),
+ XLAT_TYPE(uint64_t, BTRFS_QGROUP_STATUS_FLAG_RESCAN),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_qgroup_status_flags.in b/xlat/btrfs_qgroup_status_flags.in
new file mode 100644
index 0000000..86f60ac
--- /dev/null
+++ b/xlat/btrfs_qgroup_status_flags.in
@@ -0,0 +1,3 @@
+#val_type uint64_t
+BTRFS_QGROUP_STATUS_FLAG_ON             (1ULL << 0)
+BTRFS_QGROUP_STATUS_FLAG_RESCAN         (1ULL << 1)
diff --git a/xlat/btrfs_scrub_flags.h b/xlat/btrfs_scrub_flags.h
new file mode 100644
index 0000000..5823e34
--- /dev/null
+++ b/xlat/btrfs_scrub_flags.h
@@ -0,0 +1,20 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_scrub_flags.in; do not edit. */
+#if !(defined(BTRFS_SCRUB_READONLY) || (defined(HAVE_DECL_BTRFS_SCRUB_READONLY) && HAVE_DECL_BTRFS_SCRUB_READONLY))
+# define BTRFS_SCRUB_READONLY 1
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_scrub_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_scrub_flags[] = {
+ XLAT_TYPE(uint64_t, BTRFS_SCRUB_READONLY),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_scrub_flags.in b/xlat/btrfs_scrub_flags.in
new file mode 100644
index 0000000..914de3d
--- /dev/null
+++ b/xlat/btrfs_scrub_flags.in
@@ -0,0 +1,2 @@
+#val_type uint64_t
+BTRFS_SCRUB_READONLY    1
diff --git a/xlat/btrfs_send_flags.h b/xlat/btrfs_send_flags.h
new file mode 100644
index 0000000..be2b02a
--- /dev/null
+++ b/xlat/btrfs_send_flags.h
@@ -0,0 +1,28 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_send_flags.in; do not edit. */
+#if !(defined(BTRFS_SEND_FLAG_NO_FILE_DATA) || (defined(HAVE_DECL_BTRFS_SEND_FLAG_NO_FILE_DATA) && HAVE_DECL_BTRFS_SEND_FLAG_NO_FILE_DATA))
+# define BTRFS_SEND_FLAG_NO_FILE_DATA 0x1
+#endif
+#if !(defined(BTRFS_SEND_FLAG_OMIT_STREAM_HEADER) || (defined(HAVE_DECL_BTRFS_SEND_FLAG_OMIT_STREAM_HEADER) && HAVE_DECL_BTRFS_SEND_FLAG_OMIT_STREAM_HEADER))
+# define BTRFS_SEND_FLAG_OMIT_STREAM_HEADER 0x2
+#endif
+#if !(defined(BTRFS_SEND_FLAG_OMIT_END_CMD) || (defined(HAVE_DECL_BTRFS_SEND_FLAG_OMIT_END_CMD) && HAVE_DECL_BTRFS_SEND_FLAG_OMIT_END_CMD))
+# define BTRFS_SEND_FLAG_OMIT_END_CMD 0x4
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_send_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_send_flags[] = {
+ XLAT(BTRFS_SEND_FLAG_NO_FILE_DATA),
+ XLAT(BTRFS_SEND_FLAG_OMIT_STREAM_HEADER),
+ XLAT(BTRFS_SEND_FLAG_OMIT_END_CMD),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_send_flags.in b/xlat/btrfs_send_flags.in
new file mode 100644
index 0000000..652ef39
--- /dev/null
+++ b/xlat/btrfs_send_flags.in
@@ -0,0 +1,3 @@
+BTRFS_SEND_FLAG_NO_FILE_DATA            0x1
+BTRFS_SEND_FLAG_OMIT_STREAM_HEADER      0x2
+BTRFS_SEND_FLAG_OMIT_END_CMD            0x4
diff --git a/xlat/btrfs_snap_flags_v2.h b/xlat/btrfs_snap_flags_v2.h
new file mode 100644
index 0000000..4208852
--- /dev/null
+++ b/xlat/btrfs_snap_flags_v2.h
@@ -0,0 +1,25 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_snap_flags_v2.in; do not edit. */
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_snap_flags_v2[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_snap_flags_v2[] = {
+#if defined(BTRFS_SUBVOL_CREATE_ASYNC) || (defined(HAVE_DECL_BTRFS_SUBVOL_CREATE_ASYNC) && HAVE_DECL_BTRFS_SUBVOL_CREATE_ASYNC)
+  XLAT_TYPE(uint64_t, BTRFS_SUBVOL_CREATE_ASYNC),
+#endif
+#if defined(BTRFS_SUBVOL_RDONLY) || (defined(HAVE_DECL_BTRFS_SUBVOL_RDONLY) && HAVE_DECL_BTRFS_SUBVOL_RDONLY)
+  XLAT_TYPE(uint64_t, BTRFS_SUBVOL_RDONLY),
+#endif
+#if defined(BTRFS_SUBVOL_QGROUP_INHERIT) || (defined(HAVE_DECL_BTRFS_SUBVOL_QGROUP_INHERIT) && HAVE_DECL_BTRFS_SUBVOL_QGROUP_INHERIT)
+  XLAT_TYPE(uint64_t, BTRFS_SUBVOL_QGROUP_INHERIT),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_snap_flags_v2.in b/xlat/btrfs_snap_flags_v2.in
new file mode 100644
index 0000000..43ea574
--- /dev/null
+++ b/xlat/btrfs_snap_flags_v2.in
@@ -0,0 +1,4 @@
+#val_type uint64_t
+BTRFS_SUBVOL_CREATE_ASYNC
+BTRFS_SUBVOL_RDONLY
+BTRFS_SUBVOL_QGROUP_INHERIT
diff --git a/xlat/btrfs_space_info_flags.h b/xlat/btrfs_space_info_flags.h
new file mode 100644
index 0000000..7dcf06c
--- /dev/null
+++ b/xlat/btrfs_space_info_flags.h
@@ -0,0 +1,60 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_space_info_flags.in; do not edit. */
+#if !(defined(BTRFS_BLOCK_GROUP_DATA) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_DATA) && HAVE_DECL_BTRFS_BLOCK_GROUP_DATA))
+# define BTRFS_BLOCK_GROUP_DATA (1ULL << 0)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_SYSTEM) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_SYSTEM) && HAVE_DECL_BTRFS_BLOCK_GROUP_SYSTEM))
+# define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_METADATA) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_METADATA) && HAVE_DECL_BTRFS_BLOCK_GROUP_METADATA))
+# define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_RAID0) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_RAID0) && HAVE_DECL_BTRFS_BLOCK_GROUP_RAID0))
+# define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_RAID1) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_RAID1) && HAVE_DECL_BTRFS_BLOCK_GROUP_RAID1))
+# define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_DUP) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_DUP) && HAVE_DECL_BTRFS_BLOCK_GROUP_DUP))
+# define BTRFS_BLOCK_GROUP_DUP (1ULL << 5)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_RAID10) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_RAID10) && HAVE_DECL_BTRFS_BLOCK_GROUP_RAID10))
+# define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_RAID5) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_RAID5) && HAVE_DECL_BTRFS_BLOCK_GROUP_RAID5))
+# define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7)
+#endif
+#if !(defined(BTRFS_BLOCK_GROUP_RAID6) || (defined(HAVE_DECL_BTRFS_BLOCK_GROUP_RAID6) && HAVE_DECL_BTRFS_BLOCK_GROUP_RAID6))
+# define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
+#endif
+#if !(defined(BTRFS_AVAIL_ALLOC_BIT_SINGLE) || (defined(HAVE_DECL_BTRFS_AVAIL_ALLOC_BIT_SINGLE) && HAVE_DECL_BTRFS_AVAIL_ALLOC_BIT_SINGLE))
+# define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
+#endif
+#if !(defined(BTRFS_SPACE_INFO_GLOBAL_RSV) || (defined(HAVE_DECL_BTRFS_SPACE_INFO_GLOBAL_RSV) && HAVE_DECL_BTRFS_SPACE_INFO_GLOBAL_RSV))
+# define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_space_info_flags[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_space_info_flags[] = {
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_DATA),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_SYSTEM),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_METADATA),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_RAID0),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_RAID1),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_DUP),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_RAID10),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_RAID5),
+ XLAT_TYPE(uint64_t, BTRFS_BLOCK_GROUP_RAID6),
+ XLAT_TYPE(uint64_t, BTRFS_AVAIL_ALLOC_BIT_SINGLE),
+ XLAT_TYPE(uint64_t, BTRFS_SPACE_INFO_GLOBAL_RSV),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_space_info_flags.in b/xlat/btrfs_space_info_flags.in
new file mode 100644
index 0000000..be6d195
--- /dev/null
+++ b/xlat/btrfs_space_info_flags.in
@@ -0,0 +1,12 @@
+#val_type uint64_t
+BTRFS_BLOCK_GROUP_DATA          (1ULL << 0)
+BTRFS_BLOCK_GROUP_SYSTEM        (1ULL << 1)
+BTRFS_BLOCK_GROUP_METADATA      (1ULL << 2)
+BTRFS_BLOCK_GROUP_RAID0         (1ULL << 3)
+BTRFS_BLOCK_GROUP_RAID1         (1ULL << 4)
+BTRFS_BLOCK_GROUP_DUP           (1ULL << 5)
+BTRFS_BLOCK_GROUP_RAID10        (1ULL << 6)
+BTRFS_BLOCK_GROUP_RAID5         (1ULL << 7)
+BTRFS_BLOCK_GROUP_RAID6         (1ULL << 8)
+BTRFS_AVAIL_ALLOC_BIT_SINGLE    (1ULL << 48)
+BTRFS_SPACE_INFO_GLOBAL_RSV     (1ULL << 49)
diff --git a/xlat/btrfs_tree_objectids.h b/xlat/btrfs_tree_objectids.h
new file mode 100644
index 0000000..f96ee7f
--- /dev/null
+++ b/xlat/btrfs_tree_objectids.h
@@ -0,0 +1,68 @@
+/* Generated by ./xlat/gen.sh from ./xlat/btrfs_tree_objectids.in; do not edit. */
+#if !(defined(BTRFS_ROOT_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_ROOT_TREE_OBJECTID) && HAVE_DECL_BTRFS_ROOT_TREE_OBJECTID))
+# define BTRFS_ROOT_TREE_OBJECTID 1ULL
+#endif
+#if !(defined(BTRFS_EXTENT_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_EXTENT_TREE_OBJECTID) && HAVE_DECL_BTRFS_EXTENT_TREE_OBJECTID))
+# define BTRFS_EXTENT_TREE_OBJECTID 2ULL
+#endif
+#if !(defined(BTRFS_CHUNK_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_CHUNK_TREE_OBJECTID) && HAVE_DECL_BTRFS_CHUNK_TREE_OBJECTID))
+# define BTRFS_CHUNK_TREE_OBJECTID 3ULL
+#endif
+#if !(defined(BTRFS_DEV_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_DEV_TREE_OBJECTID) && HAVE_DECL_BTRFS_DEV_TREE_OBJECTID))
+# define BTRFS_DEV_TREE_OBJECTID 4ULL
+#endif
+#if !(defined(BTRFS_FS_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_FS_TREE_OBJECTID) && HAVE_DECL_BTRFS_FS_TREE_OBJECTID))
+# define BTRFS_FS_TREE_OBJECTID 5ULL
+#endif
+#if !(defined(BTRFS_ROOT_TREE_DIR_OBJECTID) || (defined(HAVE_DECL_BTRFS_ROOT_TREE_DIR_OBJECTID) && HAVE_DECL_BTRFS_ROOT_TREE_DIR_OBJECTID))
+# define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
+#endif
+#if !(defined(BTRFS_CSUM_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_CSUM_TREE_OBJECTID) && HAVE_DECL_BTRFS_CSUM_TREE_OBJECTID))
+# define BTRFS_CSUM_TREE_OBJECTID 7ULL
+#endif
+#if !(defined(BTRFS_QUOTA_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_QUOTA_TREE_OBJECTID) && HAVE_DECL_BTRFS_QUOTA_TREE_OBJECTID))
+# define BTRFS_QUOTA_TREE_OBJECTID 8ULL
+#endif
+#if !(defined(BTRFS_UUID_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_UUID_TREE_OBJECTID) && HAVE_DECL_BTRFS_UUID_TREE_OBJECTID))
+# define BTRFS_UUID_TREE_OBJECTID 9ULL
+#endif
+#if !(defined(BTRFS_FREE_SPACE_TREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_FREE_SPACE_TREE_OBJECTID) && HAVE_DECL_BTRFS_FREE_SPACE_TREE_OBJECTID))
+# define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL
+#endif
+#if !(defined(BTRFS_FIRST_FREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_FIRST_FREE_OBJECTID) && HAVE_DECL_BTRFS_FIRST_FREE_OBJECTID))
+# define BTRFS_FIRST_FREE_OBJECTID 256ULL
+#endif
+#if !(defined(BTRFS_LAST_FREE_OBJECTID) || (defined(HAVE_DECL_BTRFS_LAST_FREE_OBJECTID) && HAVE_DECL_BTRFS_LAST_FREE_OBJECTID))
+# define BTRFS_LAST_FREE_OBJECTID -256ULL
+#endif
+#if !(defined(UINT64_MAX) || (defined(HAVE_DECL_UINT64_MAX) && HAVE_DECL_UINT64_MAX))
+# define UINT64_MAX -1ULL
+#endif
+
+#ifdef IN_MPERS
+
+extern const struct xlat btrfs_tree_objectids[];
+
+#else
+
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
+static
+# endif
+const struct xlat btrfs_tree_objectids[] = {
+ XLAT_TYPE(uint64_t, BTRFS_ROOT_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_EXTENT_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_CHUNK_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_DEV_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_FS_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_ROOT_TREE_DIR_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_CSUM_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_QUOTA_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_UUID_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_FREE_SPACE_TREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_FIRST_FREE_OBJECTID),
+ XLAT_TYPE(uint64_t, BTRFS_LAST_FREE_OBJECTID),
+ XLAT_TYPE(uint64_t, UINT64_MAX),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/btrfs_tree_objectids.in b/xlat/btrfs_tree_objectids.in
new file mode 100644
index 0000000..0b6e598
--- /dev/null
+++ b/xlat/btrfs_tree_objectids.in
@@ -0,0 +1,14 @@
+#val_type uint64_t
+BTRFS_ROOT_TREE_OBJECTID 1ULL
+BTRFS_EXTENT_TREE_OBJECTID 2ULL
+BTRFS_CHUNK_TREE_OBJECTID 3ULL
+BTRFS_DEV_TREE_OBJECTID 4ULL
+BTRFS_FS_TREE_OBJECTID 5ULL
+BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
+BTRFS_CSUM_TREE_OBJECTID 7ULL
+BTRFS_QUOTA_TREE_OBJECTID 8ULL
+BTRFS_UUID_TREE_OBJECTID 9ULL
+BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL
+BTRFS_FIRST_FREE_OBJECTID 256ULL
+BTRFS_LAST_FREE_OBJECTID -256ULL
+UINT64_MAX -1ULL
diff --git a/xlat/cap_mask0.h b/xlat/cap_mask0.h
index eb9ed47..4402dc2 100644
--- a/xlat/cap_mask0.h
+++ b/xlat/cap_mask0.h
@@ -8,38 +8,38 @@
 
 static
 const struct xlat cap_mask0[] = {
- { 1<<CAP_CHOWN, "CAP_CHOWN" },
- { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE" },
- { 1<<CAP_DAC_READ_SEARCH, "CAP_DAC_READ_SEARCH" },
- { 1<<CAP_FOWNER, "CAP_FOWNER" },
- { 1<<CAP_FSETID, "CAP_FSETID" },
- { 1<<CAP_KILL, "CAP_KILL" },
- { 1<<CAP_SETGID, "CAP_SETGID" },
- { 1<<CAP_SETUID, "CAP_SETUID" },
- { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
- { 1<<CAP_LINUX_IMMUTABLE, "CAP_LINUX_IMMUTABLE" },
- { 1<<CAP_NET_BIND_SERVICE, "CAP_NET_BIND_SERVICE" },
- { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST" },
- { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
- { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
- { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
- { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
- { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE" },
- { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
- { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT" },
- { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE" },
- { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
- { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
- { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
- { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
- { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE" },
- { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
- { 1<<CAP_SYS_TTY_CONFIG, "CAP_SYS_TTY_CONFIG" },
- { 1<<CAP_MKNOD, "CAP_MKNOD" },
- { 1<<CAP_LEASE, "CAP_LEASE" },
- { 1<<CAP_AUDIT_WRITE, "CAP_AUDIT_WRITE" },
- { 1<<CAP_AUDIT_CONTROL, "CAP_AUDIT_CONTROL" },
- { 1<<CAP_SETFCAP, "CAP_SETFCAP" },
+ XLAT_PAIR(1ULL<<CAP_CHOWN, "1<<CAP_CHOWN"),
+ XLAT_PAIR(1ULL<<CAP_DAC_OVERRIDE, "1<<CAP_DAC_OVERRIDE"),
+ XLAT_PAIR(1ULL<<CAP_DAC_READ_SEARCH, "1<<CAP_DAC_READ_SEARCH"),
+ XLAT_PAIR(1ULL<<CAP_FOWNER, "1<<CAP_FOWNER"),
+ XLAT_PAIR(1ULL<<CAP_FSETID, "1<<CAP_FSETID"),
+ XLAT_PAIR(1ULL<<CAP_KILL, "1<<CAP_KILL"),
+ XLAT_PAIR(1ULL<<CAP_SETGID, "1<<CAP_SETGID"),
+ XLAT_PAIR(1ULL<<CAP_SETUID, "1<<CAP_SETUID"),
+ XLAT_PAIR(1ULL<<CAP_SETPCAP, "1<<CAP_SETPCAP"),
+ XLAT_PAIR(1ULL<<CAP_LINUX_IMMUTABLE, "1<<CAP_LINUX_IMMUTABLE"),
+ XLAT_PAIR(1ULL<<CAP_NET_BIND_SERVICE, "1<<CAP_NET_BIND_SERVICE"),
+ XLAT_PAIR(1ULL<<CAP_NET_BROADCAST, "1<<CAP_NET_BROADCAST"),
+ XLAT_PAIR(1ULL<<CAP_NET_ADMIN, "1<<CAP_NET_ADMIN"),
+ XLAT_PAIR(1ULL<<CAP_NET_RAW, "1<<CAP_NET_RAW"),
+ XLAT_PAIR(1ULL<<CAP_IPC_LOCK, "1<<CAP_IPC_LOCK"),
+ XLAT_PAIR(1ULL<<CAP_IPC_OWNER, "1<<CAP_IPC_OWNER"),
+ XLAT_PAIR(1ULL<<CAP_SYS_MODULE, "1<<CAP_SYS_MODULE"),
+ XLAT_PAIR(1ULL<<CAP_SYS_RAWIO, "1<<CAP_SYS_RAWIO"),
+ XLAT_PAIR(1ULL<<CAP_SYS_CHROOT, "1<<CAP_SYS_CHROOT"),
+ XLAT_PAIR(1ULL<<CAP_SYS_PTRACE, "1<<CAP_SYS_PTRACE"),
+ XLAT_PAIR(1ULL<<CAP_SYS_PACCT, "1<<CAP_SYS_PACCT"),
+ XLAT_PAIR(1ULL<<CAP_SYS_ADMIN, "1<<CAP_SYS_ADMIN"),
+ XLAT_PAIR(1ULL<<CAP_SYS_BOOT, "1<<CAP_SYS_BOOT"),
+ XLAT_PAIR(1ULL<<CAP_SYS_NICE, "1<<CAP_SYS_NICE"),
+ XLAT_PAIR(1ULL<<CAP_SYS_RESOURCE, "1<<CAP_SYS_RESOURCE"),
+ XLAT_PAIR(1ULL<<CAP_SYS_TIME, "1<<CAP_SYS_TIME"),
+ XLAT_PAIR(1ULL<<CAP_SYS_TTY_CONFIG, "1<<CAP_SYS_TTY_CONFIG"),
+ XLAT_PAIR(1ULL<<CAP_MKNOD, "1<<CAP_MKNOD"),
+ XLAT_PAIR(1ULL<<CAP_LEASE, "1<<CAP_LEASE"),
+ XLAT_PAIR(1ULL<<CAP_AUDIT_WRITE, "1<<CAP_AUDIT_WRITE"),
+ XLAT_PAIR(1ULL<<CAP_AUDIT_CONTROL, "1<<CAP_AUDIT_CONTROL"),
+ XLAT_PAIR(1ULL<<CAP_SETFCAP, "1<<CAP_SETFCAP"),
  XLAT_END
 };
 
diff --git a/xlat/cap_mask1.h b/xlat/cap_mask1.h
index d35f9ad..074f5c6 100644
--- a/xlat/cap_mask1.h
+++ b/xlat/cap_mask1.h
@@ -8,12 +8,12 @@
 
 static
 const struct xlat cap_mask1[] = {
- { 1<<CAP_MAC_OVERRIDE, "CAP_MAC_OVERRIDE" },
- { 1<<CAP_MAC_ADMIN, "CAP_MAC_ADMIN" },
- { 1<<CAP_SYSLOG, "CAP_SYSLOG" },
- { 1<<CAP_WAKE_ALARM, "CAP_WAKE_ALARM" },
- { 1<<CAP_BLOCK_SUSPEND, "CAP_BLOCK_SUSPEND" },
- { 1<<CAP_AUDIT_READ, "CAP_AUDIT_READ" },
+ XLAT_PAIR(1ULL<<CAP_MAC_OVERRIDE, "1<<CAP_MAC_OVERRIDE"),
+ XLAT_PAIR(1ULL<<CAP_MAC_ADMIN, "1<<CAP_MAC_ADMIN"),
+ XLAT_PAIR(1ULL<<CAP_SYSLOG, "1<<CAP_SYSLOG"),
+ XLAT_PAIR(1ULL<<CAP_WAKE_ALARM, "1<<CAP_WAKE_ALARM"),
+ XLAT_PAIR(1ULL<<CAP_BLOCK_SUSPEND, "1<<CAP_BLOCK_SUSPEND"),
+ XLAT_PAIR(1ULL<<CAP_AUDIT_READ, "1<<CAP_AUDIT_READ"),
  XLAT_END
 };
 
diff --git a/xlat/evdev_abs.h b/xlat/evdev_abs.h
index 50cfa6e..3edd1f3 100644
--- a/xlat/evdev_abs.h
+++ b/xlat/evdev_abs.h
@@ -1,12 +1,7 @@
 /* Generated by ./xlat/gen.sh from ./xlat/evdev_abs.in; do not edit. */
 
-#ifdef IN_MPERS
+#ifndef IN_MPERS
 
-# error static const struct xlat evdev_abs in mpers mode
-
-#else
-
-static
 const struct xlat evdev_abs[] = {
 #if defined(ABS_X) || (defined(HAVE_DECL_ABS_X) && HAVE_DECL_ABS_X)
   XLAT(ABS_X),
diff --git a/xlat/evdev_autorepeat.h b/xlat/evdev_autorepeat.h
index d06a02b..67f1ce6 100644
--- a/xlat/evdev_autorepeat.h
+++ b/xlat/evdev_autorepeat.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_autorepeat in mpers mode
+extern const struct xlat evdev_autorepeat[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_autorepeat[] = {
 #if defined(REP_DELAY) || (defined(HAVE_DECL_REP_DELAY) && HAVE_DECL_REP_DELAY)
   XLAT(REP_DELAY),
diff --git a/xlat/evdev_ff_status.h b/xlat/evdev_ff_status.h
index 107bb1a..2313d1a 100644
--- a/xlat/evdev_ff_status.h
+++ b/xlat/evdev_ff_status.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_ff_status in mpers mode
+extern const struct xlat evdev_ff_status[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_ff_status[] = {
 #if defined(FF_STATUS_STOPPED) || (defined(HAVE_DECL_FF_STATUS_STOPPED) && HAVE_DECL_FF_STATUS_STOPPED)
   XLAT(FF_STATUS_STOPPED),
diff --git a/xlat/evdev_ff_types.h b/xlat/evdev_ff_types.h
index 35dddc9..2608bb1 100644
--- a/xlat/evdev_ff_types.h
+++ b/xlat/evdev_ff_types.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_ff_types in mpers mode
+extern const struct xlat evdev_ff_types[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_ff_types[] = {
 #if defined(FF_RUMBLE) || (defined(HAVE_DECL_FF_RUMBLE) && HAVE_DECL_FF_RUMBLE)
   XLAT(FF_RUMBLE),
diff --git a/xlat/evdev_keycode.h b/xlat/evdev_keycode.h
index a391b57..4354bf9 100644
--- a/xlat/evdev_keycode.h
+++ b/xlat/evdev_keycode.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_keycode in mpers mode
+extern const struct xlat evdev_keycode[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_keycode[] = {
 #if defined(KEY_RESERVED) || (defined(HAVE_DECL_KEY_RESERVED) && HAVE_DECL_KEY_RESERVED)
   XLAT(KEY_RESERVED),
diff --git a/xlat/evdev_leds.h b/xlat/evdev_leds.h
index ca0de38..8f2b24c 100644
--- a/xlat/evdev_leds.h
+++ b/xlat/evdev_leds.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_leds in mpers mode
+extern const struct xlat evdev_leds[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_leds[] = {
 #if defined(LED_NUML) || (defined(HAVE_DECL_LED_NUML) && HAVE_DECL_LED_NUML)
   XLAT(LED_NUML),
diff --git a/xlat/evdev_misc.h b/xlat/evdev_misc.h
index 96f8afa..8a363d3 100644
--- a/xlat/evdev_misc.h
+++ b/xlat/evdev_misc.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_misc in mpers mode
+extern const struct xlat evdev_misc[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_misc[] = {
 #if defined(MSC_SERIAL) || (defined(HAVE_DECL_MSC_SERIAL) && HAVE_DECL_MSC_SERIAL)
   XLAT(MSC_SERIAL),
diff --git a/xlat/evdev_mtslots.h b/xlat/evdev_mtslots.h
index 3633514..4379f37 100644
--- a/xlat/evdev_mtslots.h
+++ b/xlat/evdev_mtslots.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_mtslots in mpers mode
+extern const struct xlat evdev_mtslots[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_mtslots[] = {
 #if defined(ABS_MT_SLOT) || (defined(HAVE_DECL_ABS_MT_SLOT) && HAVE_DECL_ABS_MT_SLOT)
   XLAT(ABS_MT_SLOT),
diff --git a/xlat/evdev_prop.h b/xlat/evdev_prop.h
index c998c82..9f4f336 100644
--- a/xlat/evdev_prop.h
+++ b/xlat/evdev_prop.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_prop in mpers mode
+extern const struct xlat evdev_prop[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_prop[] = {
 #if defined(INPUT_PROP_POINTER) || (defined(HAVE_DECL_INPUT_PROP_POINTER) && HAVE_DECL_INPUT_PROP_POINTER)
   XLAT(INPUT_PROP_POINTER),
diff --git a/xlat/evdev_relative_axes.h b/xlat/evdev_relative_axes.h
index cf9efb4..b3b9b9a 100644
--- a/xlat/evdev_relative_axes.h
+++ b/xlat/evdev_relative_axes.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_relative_axes in mpers mode
+extern const struct xlat evdev_relative_axes[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_relative_axes[] = {
 #if defined(REL_X) || (defined(HAVE_DECL_REL_X) && HAVE_DECL_REL_X)
   XLAT(REL_X),
diff --git a/xlat/evdev_snd.h b/xlat/evdev_snd.h
index 95e4cd9..e03885f 100644
--- a/xlat/evdev_snd.h
+++ b/xlat/evdev_snd.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_snd in mpers mode
+extern const struct xlat evdev_snd[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_snd[] = {
 #if defined(SND_CLICK) || (defined(HAVE_DECL_SND_CLICK) && HAVE_DECL_SND_CLICK)
   XLAT(SND_CLICK),
diff --git a/xlat/evdev_switch.h b/xlat/evdev_switch.h
index afa4b3b..fb8c2cf 100644
--- a/xlat/evdev_switch.h
+++ b/xlat/evdev_switch.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_switch in mpers mode
+extern const struct xlat evdev_switch[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_switch[] = {
 #if defined(SW_LID) || (defined(HAVE_DECL_SW_LID) && HAVE_DECL_SW_LID)
   XLAT(SW_LID),
diff --git a/xlat/evdev_sync.h b/xlat/evdev_sync.h
index 85372a3..2e53d78 100644
--- a/xlat/evdev_sync.h
+++ b/xlat/evdev_sync.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat evdev_sync in mpers mode
+extern const struct xlat evdev_sync[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat evdev_sync[] = {
 #if defined(SYN_REPORT) || (defined(HAVE_DECL_SYN_REPORT) && HAVE_DECL_SYN_REPORT)
   XLAT(SYN_REPORT),
diff --git a/xlat/fiemap_extent_flags.h b/xlat/fiemap_extent_flags.h
new file mode 100644
index 0000000..629328c
--- /dev/null
+++ b/xlat/fiemap_extent_flags.h
@@ -0,0 +1,58 @@
+/* Generated by ./xlat/gen.sh from ./xlat/fiemap_extent_flags.in; do not edit. */
+#if !(defined(FIEMAP_EXTENT_LAST) || (defined(HAVE_DECL_FIEMAP_EXTENT_LAST) && HAVE_DECL_FIEMAP_EXTENT_LAST))
+# define FIEMAP_EXTENT_LAST 0x00000001
+#endif
+#if !(defined(FIEMAP_EXTENT_UNKNOWN) || (defined(HAVE_DECL_FIEMAP_EXTENT_UNKNOWN) && HAVE_DECL_FIEMAP_EXTENT_UNKNOWN))
+# define FIEMAP_EXTENT_UNKNOWN 0x00000002
+#endif
+#if !(defined(FIEMAP_EXTENT_DELALLOC) || (defined(HAVE_DECL_FIEMAP_EXTENT_DELALLOC) && HAVE_DECL_FIEMAP_EXTENT_DELALLOC))
+# define FIEMAP_EXTENT_DELALLOC 0x00000004
+#endif
+#if !(defined(FIEMAP_EXTENT_ENCODED) || (defined(HAVE_DECL_FIEMAP_EXTENT_ENCODED) && HAVE_DECL_FIEMAP_EXTENT_ENCODED))
+# define FIEMAP_EXTENT_ENCODED 0x00000008
+#endif
+#if !(defined(FIEMAP_EXTENT_DATA_ENCRYPTED) || (defined(HAVE_DECL_FIEMAP_EXTENT_DATA_ENCRYPTED) && HAVE_DECL_FIEMAP_EXTENT_DATA_ENCRYPTED))
+# define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080
+#endif
+#if !(defined(FIEMAP_EXTENT_NOT_ALIGNED) || (defined(HAVE_DECL_FIEMAP_EXTENT_NOT_ALIGNED) && HAVE_DECL_FIEMAP_EXTENT_NOT_ALIGNED))
+# define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100
+#endif
+#if !(defined(FIEMAP_EXTENT_DATA_INLINE) || (defined(HAVE_DECL_FIEMAP_EXTENT_DATA_INLINE) && HAVE_DECL_FIEMAP_EXTENT_DATA_INLINE))
+# define FIEMAP_EXTENT_DATA_INLINE 0x00000200
+#endif
+#if !(defined(FIEMAP_EXTENT_DATA_TAIL) || (defined(HAVE_DECL_FIEMAP_EXTENT_DATA_TAIL) && HAVE_DECL_FIEMAP_EXTENT_DATA_TAIL))
+# define FIEMAP_EXTENT_DATA_TAIL 0x00000400
+#endif
+#if !(defined(FIEMAP_EXTENT_UNWRITTEN) || (defined(HAVE_DECL_FIEMAP_EXTENT_UNWRITTEN) && HAVE_DECL_FIEMAP_EXTENT_UNWRITTEN))
+# define FIEMAP_EXTENT_UNWRITTEN 0x00000800
+#endif
+#if !(defined(FIEMAP_EXTENT_MERGED) || (defined(HAVE_DECL_FIEMAP_EXTENT_MERGED) && HAVE_DECL_FIEMAP_EXTENT_MERGED))
+# define FIEMAP_EXTENT_MERGED 0x00001000
+#endif
+#if !(defined(FIEMAP_EXTENT_SHARED) || (defined(HAVE_DECL_FIEMAP_EXTENT_SHARED) && HAVE_DECL_FIEMAP_EXTENT_SHARED))
+# define FIEMAP_EXTENT_SHARED 0x00002000
+#endif
+
+#ifdef IN_MPERS
+
+# error static const struct xlat fiemap_extent_flags in mpers mode
+
+#else
+
+static
+const struct xlat fiemap_extent_flags[] = {
+ XLAT(FIEMAP_EXTENT_LAST),
+ XLAT(FIEMAP_EXTENT_UNKNOWN),
+ XLAT(FIEMAP_EXTENT_DELALLOC),
+ XLAT(FIEMAP_EXTENT_ENCODED),
+ XLAT(FIEMAP_EXTENT_DATA_ENCRYPTED),
+ XLAT(FIEMAP_EXTENT_NOT_ALIGNED),
+ XLAT(FIEMAP_EXTENT_DATA_INLINE),
+ XLAT(FIEMAP_EXTENT_DATA_TAIL),
+ XLAT(FIEMAP_EXTENT_UNWRITTEN),
+ XLAT(FIEMAP_EXTENT_MERGED),
+ XLAT(FIEMAP_EXTENT_SHARED),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/fiemap_extent_flags.in b/xlat/fiemap_extent_flags.in
new file mode 100644
index 0000000..4d8911a
--- /dev/null
+++ b/xlat/fiemap_extent_flags.in
@@ -0,0 +1,11 @@
+FIEMAP_EXTENT_LAST		0x00000001
+FIEMAP_EXTENT_UNKNOWN		0x00000002
+FIEMAP_EXTENT_DELALLOC		0x00000004
+FIEMAP_EXTENT_ENCODED		0x00000008
+FIEMAP_EXTENT_DATA_ENCRYPTED	0x00000080
+FIEMAP_EXTENT_NOT_ALIGNED	0x00000100
+FIEMAP_EXTENT_DATA_INLINE	0x00000200
+FIEMAP_EXTENT_DATA_TAIL		0x00000400
+FIEMAP_EXTENT_UNWRITTEN		0x00000800
+FIEMAP_EXTENT_MERGED		0x00001000
+FIEMAP_EXTENT_SHARED		0x00002000
diff --git a/xlat/fiemap_flags.h b/xlat/fiemap_flags.h
new file mode 100644
index 0000000..4f463ef
--- /dev/null
+++ b/xlat/fiemap_flags.h
@@ -0,0 +1,26 @@
+/* Generated by ./xlat/gen.sh from ./xlat/fiemap_flags.in; do not edit. */
+#if !(defined(FIEMAP_FLAG_SYNC) || (defined(HAVE_DECL_FIEMAP_FLAG_SYNC) && HAVE_DECL_FIEMAP_FLAG_SYNC))
+# define FIEMAP_FLAG_SYNC 1
+#endif
+#if !(defined(FIEMAP_FLAG_XATTR) || (defined(HAVE_DECL_FIEMAP_FLAG_XATTR) && HAVE_DECL_FIEMAP_FLAG_XATTR))
+# define FIEMAP_FLAG_XATTR 2
+#endif
+#if !(defined(FIEMAP_FLAG_CACHE) || (defined(HAVE_DECL_FIEMAP_FLAG_CACHE) && HAVE_DECL_FIEMAP_FLAG_CACHE))
+# define FIEMAP_FLAG_CACHE 4
+#endif
+
+#ifdef IN_MPERS
+
+# error static const struct xlat fiemap_flags in mpers mode
+
+#else
+
+static
+const struct xlat fiemap_flags[] = {
+ XLAT(FIEMAP_FLAG_SYNC),
+ XLAT(FIEMAP_FLAG_XATTR),
+ XLAT(FIEMAP_FLAG_CACHE),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/fiemap_flags.in b/xlat/fiemap_flags.in
new file mode 100644
index 0000000..aff7295
--- /dev/null
+++ b/xlat/fiemap_flags.in
@@ -0,0 +1,3 @@
+FIEMAP_FLAG_SYNC	1
+FIEMAP_FLAG_XATTR	2
+FIEMAP_FLAG_CACHE	4
diff --git a/xlat/gen.sh b/xlat/gen.sh
index 6fbade9..bc6982e 100755
--- a/xlat/gen.sh
+++ b/xlat/gen.sh
@@ -59,6 +59,31 @@
 	fi
 }
 
+print_xlat()
+{
+	local val
+	val="$1"; shift
+
+	if [ -z "${val_type-}" ]; then
+		echo " XLAT(${val}),"
+	else
+		echo " XLAT_TYPE(${val_type}, ${val}),"
+	fi
+}
+
+print_xlat_pair()
+{
+	local val str
+	val="$1"; shift
+	str="$1"; shift
+
+	if [ -z "${val_type-}" ]; then
+		echo " XLAT_PAIR(${val}, \"${str}\"),"
+	else
+		echo " XLAT_TYPE_PAIR(${val_type}, ${val}, \"${str}\"),"
+	fi
+}
+
 cond_xlat()
 {
 	local line val m def xlat
@@ -70,10 +95,10 @@
 	       sed -n 's/^[^[:space:]]\+[[:space:]]\+\([^[:space:]].*\)$/\1/p')"
 
 	if [ "${m}" = "${m#1<<}" ]; then
-		xlat=" XLAT(${val}),"
+		xlat="$(print_xlat "${val}")"
 	else
+		xlat="$(print_xlat_pair "1ULL<<${val#1<<}" "${val}")"
 		m="${m#1<<}"
-		xlat=" { ${val}, \"${m}\" },"
 	fi
 
 	if [ -z "${def}" ]; then
@@ -116,6 +141,9 @@
 		'#unterminated')
 			unterminated=1
 			;;
+		'#val_type '*)
+			# to be processed during 2nd pass
+			;;
 		'#'*)
 			echo "${line}"
 			;;
@@ -157,7 +185,7 @@
 	fi
 	echo "const struct xlat ${name}[] = {"
 
-	unconditional=
+	unconditional= val_type=
 	# 2nd pass: output everything.
 	while read line; do
 		LC_COLLATE=C
@@ -168,22 +196,25 @@
 		'#unterminated')
 			# processed during 1st pass
 			;;
+		'#val_type '*)
+			val_type="${line#\#val_type }"
+			;;
 		[A-Z_]*)	# symbolic constants
 			if [ -n "${unconditional}" ]; then
-				echo " XLAT(${line}),"
+				print_xlat "${line}"
 			else
 				cond_xlat "${line}"
 			fi
 			;;
 		'1<<'[A-Z_]*)	# symbolic constants with shift
 			if [ -n "${unconditional}" ]; then
-				echo " { ${line}, \"${line#1<<}\" },"
+				print_xlat_pair "1ULL<<${line#1<<}" "${line}"
 			else
 				cond_xlat "${line}"
 			fi
 			;;
 		[0-9]*)	# numeric constants
-			echo " XLAT(${line}),"
+			print_xlat "${line}"
 			;;
 		*)	# verbatim lines
 			echo "${line}"
diff --git a/xlat/icmpfilterflags.h b/xlat/icmpfilterflags.h
index 013eb4d..1672a19 100644
--- a/xlat/icmpfilterflags.h
+++ b/xlat/icmpfilterflags.h
@@ -9,43 +9,43 @@
 static
 const struct xlat icmpfilterflags[] = {
 #if defined(ICMP_ECHOREPLY) || (defined(HAVE_DECL_ICMP_ECHOREPLY) && HAVE_DECL_ICMP_ECHOREPLY)
-  { 1<<ICMP_ECHOREPLY, "ICMP_ECHOREPLY" },
+  XLAT_PAIR(1ULL<<ICMP_ECHOREPLY, "1<<ICMP_ECHOREPLY"),
 #endif
 #if defined(ICMP_DEST_UNREACH) || (defined(HAVE_DECL_ICMP_DEST_UNREACH) && HAVE_DECL_ICMP_DEST_UNREACH)
-  { 1<<ICMP_DEST_UNREACH, "ICMP_DEST_UNREACH" },
+  XLAT_PAIR(1ULL<<ICMP_DEST_UNREACH, "1<<ICMP_DEST_UNREACH"),
 #endif
 #if defined(ICMP_SOURCE_QUENCH) || (defined(HAVE_DECL_ICMP_SOURCE_QUENCH) && HAVE_DECL_ICMP_SOURCE_QUENCH)
-  { 1<<ICMP_SOURCE_QUENCH, "ICMP_SOURCE_QUENCH" },
+  XLAT_PAIR(1ULL<<ICMP_SOURCE_QUENCH, "1<<ICMP_SOURCE_QUENCH"),
 #endif
 #if defined(ICMP_REDIRECT) || (defined(HAVE_DECL_ICMP_REDIRECT) && HAVE_DECL_ICMP_REDIRECT)
-  { 1<<ICMP_REDIRECT, "ICMP_REDIRECT" },
+  XLAT_PAIR(1ULL<<ICMP_REDIRECT, "1<<ICMP_REDIRECT"),
 #endif
 #if defined(ICMP_ECHO) || (defined(HAVE_DECL_ICMP_ECHO) && HAVE_DECL_ICMP_ECHO)
-  { 1<<ICMP_ECHO, "ICMP_ECHO" },
+  XLAT_PAIR(1ULL<<ICMP_ECHO, "1<<ICMP_ECHO"),
 #endif
 #if defined(ICMP_TIME_EXCEEDED) || (defined(HAVE_DECL_ICMP_TIME_EXCEEDED) && HAVE_DECL_ICMP_TIME_EXCEEDED)
-  { 1<<ICMP_TIME_EXCEEDED, "ICMP_TIME_EXCEEDED" },
+  XLAT_PAIR(1ULL<<ICMP_TIME_EXCEEDED, "1<<ICMP_TIME_EXCEEDED"),
 #endif
 #if defined(ICMP_PARAMETERPROB) || (defined(HAVE_DECL_ICMP_PARAMETERPROB) && HAVE_DECL_ICMP_PARAMETERPROB)
-  { 1<<ICMP_PARAMETERPROB, "ICMP_PARAMETERPROB" },
+  XLAT_PAIR(1ULL<<ICMP_PARAMETERPROB, "1<<ICMP_PARAMETERPROB"),
 #endif
 #if defined(ICMP_TIMESTAMP) || (defined(HAVE_DECL_ICMP_TIMESTAMP) && HAVE_DECL_ICMP_TIMESTAMP)
-  { 1<<ICMP_TIMESTAMP, "ICMP_TIMESTAMP" },
+  XLAT_PAIR(1ULL<<ICMP_TIMESTAMP, "1<<ICMP_TIMESTAMP"),
 #endif
 #if defined(ICMP_TIMESTAMPREPLY) || (defined(HAVE_DECL_ICMP_TIMESTAMPREPLY) && HAVE_DECL_ICMP_TIMESTAMPREPLY)
-  { 1<<ICMP_TIMESTAMPREPLY, "ICMP_TIMESTAMPREPLY" },
+  XLAT_PAIR(1ULL<<ICMP_TIMESTAMPREPLY, "1<<ICMP_TIMESTAMPREPLY"),
 #endif
 #if defined(ICMP_INFO_REQUEST) || (defined(HAVE_DECL_ICMP_INFO_REQUEST) && HAVE_DECL_ICMP_INFO_REQUEST)
-  { 1<<ICMP_INFO_REQUEST, "ICMP_INFO_REQUEST" },
+  XLAT_PAIR(1ULL<<ICMP_INFO_REQUEST, "1<<ICMP_INFO_REQUEST"),
 #endif
 #if defined(ICMP_INFO_REPLY) || (defined(HAVE_DECL_ICMP_INFO_REPLY) && HAVE_DECL_ICMP_INFO_REPLY)
-  { 1<<ICMP_INFO_REPLY, "ICMP_INFO_REPLY" },
+  XLAT_PAIR(1ULL<<ICMP_INFO_REPLY, "1<<ICMP_INFO_REPLY"),
 #endif
 #if defined(ICMP_ADDRESS) || (defined(HAVE_DECL_ICMP_ADDRESS) && HAVE_DECL_ICMP_ADDRESS)
-  { 1<<ICMP_ADDRESS, "ICMP_ADDRESS" },
+  XLAT_PAIR(1ULL<<ICMP_ADDRESS, "1<<ICMP_ADDRESS"),
 #endif
 #if defined(ICMP_ADDRESSREPLY) || (defined(HAVE_DECL_ICMP_ADDRESSREPLY) && HAVE_DECL_ICMP_ADDRESSREPLY)
-  { 1<<ICMP_ADDRESSREPLY, "ICMP_ADDRESSREPLY" },
+  XLAT_PAIR(1ULL<<ICMP_ADDRESSREPLY, "1<<ICMP_ADDRESSREPLY"),
 #endif
  XLAT_END
 };
diff --git a/xlat/mbindflags.h b/xlat/mbindflags.h
index aee1b42..eb30ba1 100644
--- a/xlat/mbindflags.h
+++ b/xlat/mbindflags.h
@@ -1,4 +1,13 @@
 /* Generated by ./xlat/gen.sh from ./xlat/mbindflags.in; do not edit. */
+#if !(defined(MPOL_MF_STRICT) || (defined(HAVE_DECL_MPOL_MF_STRICT) && HAVE_DECL_MPOL_MF_STRICT))
+# define MPOL_MF_STRICT 1
+#endif
+#if !(defined(MPOL_MF_MOVE) || (defined(HAVE_DECL_MPOL_MF_MOVE) && HAVE_DECL_MPOL_MF_MOVE))
+# define MPOL_MF_MOVE 2
+#endif
+#if !(defined(MPOL_MF_MOVE_ALL) || (defined(HAVE_DECL_MPOL_MF_MOVE_ALL) && HAVE_DECL_MPOL_MF_MOVE_ALL))
+# define MPOL_MF_MOVE_ALL 4
+#endif
 
 #ifdef IN_MPERS
 
@@ -8,15 +17,9 @@
 
 static
 const struct xlat mbindflags[] = {
-#if defined(MPOL_MF_STRICT) || (defined(HAVE_DECL_MPOL_MF_STRICT) && HAVE_DECL_MPOL_MF_STRICT)
-  XLAT(MPOL_MF_STRICT),
-#endif
-#if defined(MPOL_MF_MOVE) || (defined(HAVE_DECL_MPOL_MF_MOVE) && HAVE_DECL_MPOL_MF_MOVE)
-  XLAT(MPOL_MF_MOVE),
-#endif
-#if defined(MPOL_MF_MOVE_ALL) || (defined(HAVE_DECL_MPOL_MF_MOVE_ALL) && HAVE_DECL_MPOL_MF_MOVE_ALL)
-  XLAT(MPOL_MF_MOVE_ALL),
-#endif
+ XLAT(MPOL_MF_STRICT),
+ XLAT(MPOL_MF_MOVE),
+ XLAT(MPOL_MF_MOVE_ALL),
  XLAT_END
 };
 
diff --git a/xlat/mbindflags.in b/xlat/mbindflags.in
index 105504e..04f3ae6 100644
--- a/xlat/mbindflags.in
+++ b/xlat/mbindflags.in
@@ -1,3 +1,3 @@
-MPOL_MF_STRICT
-MPOL_MF_MOVE
-MPOL_MF_MOVE_ALL
+MPOL_MF_STRICT		1
+MPOL_MF_MOVE		2
+MPOL_MF_MOVE_ALL	4
diff --git a/xlat/mempolicyflags.h b/xlat/mempolicyflags.h
index e349b17..38db13c 100644
--- a/xlat/mempolicyflags.h
+++ b/xlat/mempolicyflags.h
@@ -1,4 +1,10 @@
 /* Generated by ./xlat/gen.sh from ./xlat/mempolicyflags.in; do not edit. */
+#if !(defined(MPOL_F_NODE) || (defined(HAVE_DECL_MPOL_F_NODE) && HAVE_DECL_MPOL_F_NODE))
+# define MPOL_F_NODE 1
+#endif
+#if !(defined(MPOL_F_ADDR) || (defined(HAVE_DECL_MPOL_F_ADDR) && HAVE_DECL_MPOL_F_ADDR))
+# define MPOL_F_ADDR 2
+#endif
 
 #ifdef IN_MPERS
 
@@ -8,12 +14,8 @@
 
 static
 const struct xlat mempolicyflags[] = {
-#if defined(MPOL_F_NODE) || (defined(HAVE_DECL_MPOL_F_NODE) && HAVE_DECL_MPOL_F_NODE)
-  XLAT(MPOL_F_NODE),
-#endif
-#if defined(MPOL_F_ADDR) || (defined(HAVE_DECL_MPOL_F_ADDR) && HAVE_DECL_MPOL_F_ADDR)
-  XLAT(MPOL_F_ADDR),
-#endif
+ XLAT(MPOL_F_NODE),
+ XLAT(MPOL_F_ADDR),
  XLAT_END
 };
 
diff --git a/xlat/mempolicyflags.in b/xlat/mempolicyflags.in
index 89c414b..bdcc6f3 100644
--- a/xlat/mempolicyflags.in
+++ b/xlat/mempolicyflags.in
@@ -1,2 +1,2 @@
-MPOL_F_NODE
-MPOL_F_ADDR
+MPOL_F_NODE	1
+MPOL_F_ADDR	2
diff --git a/xlat/msg_flags.h b/xlat/msg_flags.h
index bec25d1..aedfaeb 100644
--- a/xlat/msg_flags.h
+++ b/xlat/msg_flags.h
@@ -1,4 +1,7 @@
 /* Generated by ./xlat/gen.sh from ./xlat/msg_flags.in; do not edit. */
+#if !(defined(MSG_BATCH) || (defined(HAVE_DECL_MSG_BATCH) && HAVE_DECL_MSG_BATCH))
+# define MSG_BATCH 0x40000
+#endif
 
 #ifdef IN_MPERS
 
@@ -59,6 +62,7 @@
 #if defined(MSG_WAITFORONE) || (defined(HAVE_DECL_MSG_WAITFORONE) && HAVE_DECL_MSG_WAITFORONE)
   XLAT(MSG_WAITFORONE),
 #endif
+ XLAT(MSG_BATCH),
 #if defined(MSG_EOF) || (defined(HAVE_DECL_MSG_EOF) && HAVE_DECL_MSG_EOF)
   XLAT(MSG_EOF),
 #endif
diff --git a/xlat/msg_flags.in b/xlat/msg_flags.in
index 9369040..cf6b83c 100644
--- a/xlat/msg_flags.in
+++ b/xlat/msg_flags.in
@@ -15,6 +15,7 @@
 MSG_NOSIGNAL
 MSG_MORE
 MSG_WAITFORONE
+MSG_BATCH	0x40000
 MSG_EOF
 MSG_FASTOPEN
 MSG_CMSG_CLOEXEC
diff --git a/xlat/mtd_file_mode_options.h b/xlat/mtd_file_mode_options.h
index dfb877a..943919f 100644
--- a/xlat/mtd_file_mode_options.h
+++ b/xlat/mtd_file_mode_options.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat mtd_file_mode_options in mpers mode
+extern const struct xlat mtd_file_mode_options[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat mtd_file_mode_options[] = {
  XLAT(MTD_FILE_MODE_NORMAL),
  XLAT(MTD_FILE_MODE_OTP_FACTORY),
diff --git a/xlat/mtd_flags_options.h b/xlat/mtd_flags_options.h
index 6d87b4c..8712561 100644
--- a/xlat/mtd_flags_options.h
+++ b/xlat/mtd_flags_options.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat mtd_flags_options in mpers mode
+extern const struct xlat mtd_flags_options[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat mtd_flags_options[] = {
 #if defined(MTD_WRITEABLE) || (defined(HAVE_DECL_MTD_WRITEABLE) && HAVE_DECL_MTD_WRITEABLE)
   XLAT(MTD_WRITEABLE),
diff --git a/xlat/mtd_mode_options.h b/xlat/mtd_mode_options.h
index 2a8ddf3..b7e8b4a 100644
--- a/xlat/mtd_mode_options.h
+++ b/xlat/mtd_mode_options.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat mtd_mode_options in mpers mode
+extern const struct xlat mtd_mode_options[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat mtd_mode_options[] = {
  XLAT(MTD_OPS_PLACE_OOB),
  XLAT(MTD_OPS_AUTO_OOB),
diff --git a/xlat/mtd_nandecc_options.h b/xlat/mtd_nandecc_options.h
index 1cceb82..21b0166 100644
--- a/xlat/mtd_nandecc_options.h
+++ b/xlat/mtd_nandecc_options.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat mtd_nandecc_options in mpers mode
+extern const struct xlat mtd_nandecc_options[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat mtd_nandecc_options[] = {
 #if defined(MTD_NANDECC_OFF) || (defined(HAVE_DECL_MTD_NANDECC_OFF) && HAVE_DECL_MTD_NANDECC_OFF)
   XLAT(MTD_NANDECC_OFF),
diff --git a/xlat/mtd_otp_options.h b/xlat/mtd_otp_options.h
index 3d0caee..2ee7f49 100644
--- a/xlat/mtd_otp_options.h
+++ b/xlat/mtd_otp_options.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat mtd_otp_options in mpers mode
+extern const struct xlat mtd_otp_options[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat mtd_otp_options[] = {
 #if defined(MTD_OTP_OFF) || (defined(HAVE_DECL_MTD_OTP_OFF) && HAVE_DECL_MTD_OTP_OFF)
   XLAT(MTD_OTP_OFF),
diff --git a/xlat/mtd_type_options.h b/xlat/mtd_type_options.h
index 138b768..46829e8 100644
--- a/xlat/mtd_type_options.h
+++ b/xlat/mtd_type_options.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat mtd_type_options in mpers mode
+extern const struct xlat mtd_type_options[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat mtd_type_options[] = {
 #if defined(MTD_ABSENT) || (defined(HAVE_DECL_MTD_ABSENT) && HAVE_DECL_MTD_ABSENT)
   XLAT(MTD_ABSENT),
diff --git a/xlat/policies.h b/xlat/policies.h
index 1b2a13a..8b44db6 100644
--- a/xlat/policies.h
+++ b/xlat/policies.h
@@ -1,4 +1,16 @@
 /* Generated by ./xlat/gen.sh from ./xlat/policies.in; do not edit. */
+#if !(defined(MPOL_DEFAULT) || (defined(HAVE_DECL_MPOL_DEFAULT) && HAVE_DECL_MPOL_DEFAULT))
+# define MPOL_DEFAULT 0
+#endif
+#if !(defined(MPOL_PREFERRED) || (defined(HAVE_DECL_MPOL_PREFERRED) && HAVE_DECL_MPOL_PREFERRED))
+# define MPOL_PREFERRED 1
+#endif
+#if !(defined(MPOL_BIND) || (defined(HAVE_DECL_MPOL_BIND) && HAVE_DECL_MPOL_BIND))
+# define MPOL_BIND 2
+#endif
+#if !(defined(MPOL_INTERLEAVE) || (defined(HAVE_DECL_MPOL_INTERLEAVE) && HAVE_DECL_MPOL_INTERLEAVE))
+# define MPOL_INTERLEAVE 3
+#endif
 
 #ifdef IN_MPERS
 
@@ -8,18 +20,10 @@
 
 static
 const struct xlat policies[] = {
-#if defined(MPOL_DEFAULT) || (defined(HAVE_DECL_MPOL_DEFAULT) && HAVE_DECL_MPOL_DEFAULT)
-  XLAT(MPOL_DEFAULT),
-#endif
-#if defined(MPOL_PREFERRED) || (defined(HAVE_DECL_MPOL_PREFERRED) && HAVE_DECL_MPOL_PREFERRED)
-  XLAT(MPOL_PREFERRED),
-#endif
-#if defined(MPOL_BIND) || (defined(HAVE_DECL_MPOL_BIND) && HAVE_DECL_MPOL_BIND)
-  XLAT(MPOL_BIND),
-#endif
-#if defined(MPOL_INTERLEAVE) || (defined(HAVE_DECL_MPOL_INTERLEAVE) && HAVE_DECL_MPOL_INTERLEAVE)
-  XLAT(MPOL_INTERLEAVE),
-#endif
+ XLAT(MPOL_DEFAULT),
+ XLAT(MPOL_PREFERRED),
+ XLAT(MPOL_BIND),
+ XLAT(MPOL_INTERLEAVE),
  XLAT_END
 };
 
diff --git a/xlat/policies.in b/xlat/policies.in
index 22599fd..fab5396 100644
--- a/xlat/policies.in
+++ b/xlat/policies.in
@@ -1,4 +1,4 @@
-MPOL_DEFAULT
-MPOL_PREFERRED
-MPOL_BIND
-MPOL_INTERLEAVE
+MPOL_DEFAULT	0
+MPOL_PREFERRED	1
+MPOL_BIND	2
+MPOL_INTERLEAVE	3
diff --git a/xlat/ptrace_peeksiginfo_flags.h b/xlat/ptrace_peeksiginfo_flags.h
new file mode 100644
index 0000000..c6152b7
--- /dev/null
+++ b/xlat/ptrace_peeksiginfo_flags.h
@@ -0,0 +1,18 @@
+/* Generated by ./xlat/gen.sh from ./xlat/ptrace_peeksiginfo_flags.in; do not edit. */
+#if !(defined(PTRACE_PEEKSIGINFO_SHARED) || (defined(HAVE_DECL_PTRACE_PEEKSIGINFO_SHARED) && HAVE_DECL_PTRACE_PEEKSIGINFO_SHARED))
+# define PTRACE_PEEKSIGINFO_SHARED 1
+#endif
+
+#ifdef IN_MPERS
+
+# error static const struct xlat ptrace_peeksiginfo_flags in mpers mode
+
+#else
+
+static
+const struct xlat ptrace_peeksiginfo_flags[] = {
+ XLAT(PTRACE_PEEKSIGINFO_SHARED),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/ptrace_peeksiginfo_flags.in b/xlat/ptrace_peeksiginfo_flags.in
new file mode 100644
index 0000000..28a4c22
--- /dev/null
+++ b/xlat/ptrace_peeksiginfo_flags.in
@@ -0,0 +1 @@
+PTRACE_PEEKSIGINFO_SHARED 1
diff --git a/xlat/rename_flags.h b/xlat/rename_flags.h
index 71be045..2fc0a76 100644
--- a/xlat/rename_flags.h
+++ b/xlat/rename_flags.h
@@ -1,4 +1,13 @@
 /* Generated by ./xlat/gen.sh from ./xlat/rename_flags.in; do not edit. */
+#if !(defined(RENAME_NOREPLACE) || (defined(HAVE_DECL_RENAME_NOREPLACE) && HAVE_DECL_RENAME_NOREPLACE))
+# define RENAME_NOREPLACE 1
+#endif
+#if !(defined(RENAME_EXCHANGE) || (defined(HAVE_DECL_RENAME_EXCHANGE) && HAVE_DECL_RENAME_EXCHANGE))
+# define RENAME_EXCHANGE 2
+#endif
+#if !(defined(RENAME_WHITEOUT) || (defined(HAVE_DECL_RENAME_WHITEOUT) && HAVE_DECL_RENAME_WHITEOUT))
+# define RENAME_WHITEOUT 4
+#endif
 
 #ifdef IN_MPERS
 
@@ -8,15 +17,9 @@
 
 static
 const struct xlat rename_flags[] = {
-#if defined(RENAME_NOREPLACE) || (defined(HAVE_DECL_RENAME_NOREPLACE) && HAVE_DECL_RENAME_NOREPLACE)
-  XLAT(RENAME_NOREPLACE),
-#endif
-#if defined(RENAME_EXCHANGE) || (defined(HAVE_DECL_RENAME_EXCHANGE) && HAVE_DECL_RENAME_EXCHANGE)
-  XLAT(RENAME_EXCHANGE),
-#endif
-#if defined(RENAME_WHITEOUT) || (defined(HAVE_DECL_RENAME_WHITEOUT) && HAVE_DECL_RENAME_WHITEOUT)
-  XLAT(RENAME_WHITEOUT),
-#endif
+ XLAT(RENAME_NOREPLACE),
+ XLAT(RENAME_EXCHANGE),
+ XLAT(RENAME_WHITEOUT),
  XLAT_END
 };
 
diff --git a/xlat/rename_flags.in b/xlat/rename_flags.in
index 2df71bc..8d96b9b 100644
--- a/xlat/rename_flags.in
+++ b/xlat/rename_flags.in
@@ -1,3 +1,3 @@
-RENAME_NOREPLACE
-RENAME_EXCHANGE
-RENAME_WHITEOUT
+RENAME_NOREPLACE	1
+RENAME_EXCHANGE		2
+RENAME_WHITEOUT		4
diff --git a/xlat/rwf_flags.h b/xlat/rwf_flags.h
new file mode 100644
index 0000000..8fe8917
--- /dev/null
+++ b/xlat/rwf_flags.h
@@ -0,0 +1,18 @@
+/* Generated by ./xlat/gen.sh from ./xlat/rwf_flags.in; do not edit. */
+#if !(defined(RWF_HIPRI) || (defined(HAVE_DECL_RWF_HIPRI) && HAVE_DECL_RWF_HIPRI))
+# define RWF_HIPRI 1
+#endif
+
+#ifdef IN_MPERS
+
+# error static const struct xlat rwf_flags in mpers mode
+
+#else
+
+static
+const struct xlat rwf_flags[] = {
+ XLAT(RWF_HIPRI),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/rwf_flags.in b/xlat/rwf_flags.in
new file mode 100644
index 0000000..2f97916
--- /dev/null
+++ b/xlat/rwf_flags.in
@@ -0,0 +1 @@
+RWF_HIPRI 1
diff --git a/xlat/socketlayers.h b/xlat/socketlayers.h
index c3af327..5fe7614 100644
--- a/xlat/socketlayers.h
+++ b/xlat/socketlayers.h
@@ -101,6 +101,9 @@
 #if !(defined(SOL_NFC) || (defined(HAVE_DECL_SOL_NFC) && HAVE_DECL_SOL_NFC))
 # define SOL_NFC 280
 #endif
+#if !(defined(SOL_KCM) || (defined(HAVE_DECL_SOL_KCM) && HAVE_DECL_SOL_KCM))
+# define SOL_KCM 281
+#endif
 
 #ifdef IN_MPERS
 
@@ -144,6 +147,7 @@
  XLAT(SOL_CAIF),
  XLAT(SOL_ALG),
  XLAT(SOL_NFC),
+ XLAT(SOL_KCM),
  XLAT_END
 };
 
diff --git a/xlat/socketlayers.in b/xlat/socketlayers.in
index 85845b7..7b0b86e 100644
--- a/xlat/socketlayers.in
+++ b/xlat/socketlayers.in
@@ -32,3 +32,4 @@
 SOL_CAIF	278
 SOL_ALG		279
 SOL_NFC		280
+SOL_KCM		281
diff --git a/xlat/statfs_flags.h b/xlat/statfs_flags.h
new file mode 100644
index 0000000..149f57f
--- /dev/null
+++ b/xlat/statfs_flags.h
@@ -0,0 +1,54 @@
+/* Generated by ./xlat/gen.sh from ./xlat/statfs_flags.in; do not edit. */
+#if !(defined(ST_VALID) || (defined(HAVE_DECL_ST_VALID) && HAVE_DECL_ST_VALID))
+# define ST_VALID 0x0020
+#endif
+#if !(defined(ST_RDONLY) || (defined(HAVE_DECL_ST_RDONLY) && HAVE_DECL_ST_RDONLY))
+# define ST_RDONLY 0x0001
+#endif
+#if !(defined(ST_NOSUID) || (defined(HAVE_DECL_ST_NOSUID) && HAVE_DECL_ST_NOSUID))
+# define ST_NOSUID 0x0002
+#endif
+#if !(defined(ST_NODEV) || (defined(HAVE_DECL_ST_NODEV) && HAVE_DECL_ST_NODEV))
+# define ST_NODEV 0x0004
+#endif
+#if !(defined(ST_NOEXEC) || (defined(HAVE_DECL_ST_NOEXEC) && HAVE_DECL_ST_NOEXEC))
+# define ST_NOEXEC 0x0008
+#endif
+#if !(defined(ST_SYNCHRONOUS) || (defined(HAVE_DECL_ST_SYNCHRONOUS) && HAVE_DECL_ST_SYNCHRONOUS))
+# define ST_SYNCHRONOUS 0x0010
+#endif
+#if !(defined(ST_MANDLOCK) || (defined(HAVE_DECL_ST_MANDLOCK) && HAVE_DECL_ST_MANDLOCK))
+# define ST_MANDLOCK 0x0040
+#endif
+#if !(defined(ST_NOATIME) || (defined(HAVE_DECL_ST_NOATIME) && HAVE_DECL_ST_NOATIME))
+# define ST_NOATIME 0x0400
+#endif
+#if !(defined(ST_NODIRATIME) || (defined(HAVE_DECL_ST_NODIRATIME) && HAVE_DECL_ST_NODIRATIME))
+# define ST_NODIRATIME 0x0800
+#endif
+#if !(defined(ST_RELATIME) || (defined(HAVE_DECL_ST_RELATIME) && HAVE_DECL_ST_RELATIME))
+# define ST_RELATIME 0x1000
+#endif
+
+#ifdef IN_MPERS
+
+# error static const struct xlat statfs_flags in mpers mode
+
+#else
+
+static
+const struct xlat statfs_flags[] = {
+ XLAT(ST_VALID),
+ XLAT(ST_RDONLY),
+ XLAT(ST_NOSUID),
+ XLAT(ST_NODEV),
+ XLAT(ST_NOEXEC),
+ XLAT(ST_SYNCHRONOUS),
+ XLAT(ST_MANDLOCK),
+ XLAT(ST_NOATIME),
+ XLAT(ST_NODIRATIME),
+ XLAT(ST_RELATIME),
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/statfs_flags.in b/xlat/statfs_flags.in
new file mode 100644
index 0000000..f791a60
--- /dev/null
+++ b/xlat/statfs_flags.in
@@ -0,0 +1,10 @@
+ST_VALID	0x0020
+ST_RDONLY	0x0001
+ST_NOSUID	0x0002
+ST_NODEV	0x0004
+ST_NOEXEC	0x0008
+ST_SYNCHRONOUS	0x0010
+ST_MANDLOCK	0x0040
+ST_NOATIME	0x0400
+ST_NODIRATIME	0x0800
+ST_RELATIME	0x1000
diff --git a/xlat/uffd_api_flags.h b/xlat/uffd_api_flags.h
new file mode 100644
index 0000000..4963ec4
--- /dev/null
+++ b/xlat/uffd_api_flags.h
@@ -0,0 +1,23 @@
+/* Generated by ./xlat/gen.sh from ./xlat/uffd_api_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+# error static const struct xlat uffd_api_flags in mpers mode
+
+#else
+
+static
+const struct xlat uffd_api_flags[] = {
+#if defined(_UFFDIO_REGISTER) || (defined(HAVE_DECL__UFFDIO_REGISTER) && HAVE_DECL__UFFDIO_REGISTER)
+  XLAT_TYPE_PAIR(uint64_t, 1ULL<<_UFFDIO_REGISTER, "1<<_UFFDIO_REGISTER"),
+#endif
+#if defined(_UFFDIO_UNREGISTER) || (defined(HAVE_DECL__UFFDIO_UNREGISTER) && HAVE_DECL__UFFDIO_UNREGISTER)
+  XLAT_TYPE_PAIR(uint64_t, 1ULL<<_UFFDIO_UNREGISTER, "1<<_UFFDIO_UNREGISTER"),
+#endif
+#if defined(_UFFDIO_API) || (defined(HAVE_DECL__UFFDIO_API) && HAVE_DECL__UFFDIO_API)
+  XLAT_TYPE_PAIR(uint64_t, 1ULL<<_UFFDIO_API, "1<<_UFFDIO_API"),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/uffd_api_flags.in b/xlat/uffd_api_flags.in
new file mode 100644
index 0000000..fd21087
--- /dev/null
+++ b/xlat/uffd_api_flags.in
@@ -0,0 +1,4 @@
+#val_type uint64_t
+1<<_UFFDIO_REGISTER
+1<<_UFFDIO_UNREGISTER
+1<<_UFFDIO_API
diff --git a/xlat/uffd_copy_flags.h b/xlat/uffd_copy_flags.h
new file mode 100644
index 0000000..669c1bb
--- /dev/null
+++ b/xlat/uffd_copy_flags.h
@@ -0,0 +1,17 @@
+/* Generated by ./xlat/gen.sh from ./xlat/uffd_copy_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+# error static const struct xlat uffd_copy_flags in mpers mode
+
+#else
+
+static
+const struct xlat uffd_copy_flags[] = {
+#if defined(UFFDIO_COPY_MODE_DONTWAKE) || (defined(HAVE_DECL_UFFDIO_COPY_MODE_DONTWAKE) && HAVE_DECL_UFFDIO_COPY_MODE_DONTWAKE)
+  XLAT_TYPE(uint64_t, UFFDIO_COPY_MODE_DONTWAKE),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/uffd_copy_flags.in b/xlat/uffd_copy_flags.in
new file mode 100644
index 0000000..02d6b19
--- /dev/null
+++ b/xlat/uffd_copy_flags.in
@@ -0,0 +1,2 @@
+#val_type uint64_t
+UFFDIO_COPY_MODE_DONTWAKE
diff --git a/xlat/uffd_register_ioctl_flags.h b/xlat/uffd_register_ioctl_flags.h
new file mode 100644
index 0000000..0c90f3c
--- /dev/null
+++ b/xlat/uffd_register_ioctl_flags.h
@@ -0,0 +1,23 @@
+/* Generated by ./xlat/gen.sh from ./xlat/uffd_register_ioctl_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+# error static const struct xlat uffd_register_ioctl_flags in mpers mode
+
+#else
+
+static
+const struct xlat uffd_register_ioctl_flags[] = {
+#if defined(_UFFDIO_WAKE) || (defined(HAVE_DECL__UFFDIO_WAKE) && HAVE_DECL__UFFDIO_WAKE)
+  XLAT_TYPE_PAIR(uint64_t, 1ULL<<_UFFDIO_WAKE, "1<<_UFFDIO_WAKE"),
+#endif
+#if defined(_UFFDIO_COPY) || (defined(HAVE_DECL__UFFDIO_COPY) && HAVE_DECL__UFFDIO_COPY)
+  XLAT_TYPE_PAIR(uint64_t, 1ULL<<_UFFDIO_COPY, "1<<_UFFDIO_COPY"),
+#endif
+#if defined(_UFFDIO_ZEROPAGE) || (defined(HAVE_DECL__UFFDIO_ZEROPAGE) && HAVE_DECL__UFFDIO_ZEROPAGE)
+  XLAT_TYPE_PAIR(uint64_t, 1ULL<<_UFFDIO_ZEROPAGE, "1<<_UFFDIO_ZEROPAGE"),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/uffd_register_ioctl_flags.in b/xlat/uffd_register_ioctl_flags.in
new file mode 100644
index 0000000..f4e3b94
--- /dev/null
+++ b/xlat/uffd_register_ioctl_flags.in
@@ -0,0 +1,4 @@
+#val_type uint64_t
+1<<_UFFDIO_WAKE
+1<<_UFFDIO_COPY
+1<<_UFFDIO_ZEROPAGE
diff --git a/xlat/uffd_register_mode_flags.h b/xlat/uffd_register_mode_flags.h
new file mode 100644
index 0000000..bfcae87
--- /dev/null
+++ b/xlat/uffd_register_mode_flags.h
@@ -0,0 +1,20 @@
+/* Generated by ./xlat/gen.sh from ./xlat/uffd_register_mode_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+# error static const struct xlat uffd_register_mode_flags in mpers mode
+
+#else
+
+static
+const struct xlat uffd_register_mode_flags[] = {
+#if defined(UFFDIO_REGISTER_MODE_MISSING) || (defined(HAVE_DECL_UFFDIO_REGISTER_MODE_MISSING) && HAVE_DECL_UFFDIO_REGISTER_MODE_MISSING)
+  XLAT_TYPE(uint64_t, UFFDIO_REGISTER_MODE_MISSING),
+#endif
+#if defined(UFFDIO_REGISTER_MODE_WP) || (defined(HAVE_DECL_UFFDIO_REGISTER_MODE_WP) && HAVE_DECL_UFFDIO_REGISTER_MODE_WP)
+  XLAT_TYPE(uint64_t, UFFDIO_REGISTER_MODE_WP),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/uffd_register_mode_flags.in b/xlat/uffd_register_mode_flags.in
new file mode 100644
index 0000000..996b1f3
--- /dev/null
+++ b/xlat/uffd_register_mode_flags.in
@@ -0,0 +1,3 @@
+#val_type uint64_t
+UFFDIO_REGISTER_MODE_MISSING
+UFFDIO_REGISTER_MODE_WP
diff --git a/xlat/uffd_zeropage_flags.h b/xlat/uffd_zeropage_flags.h
new file mode 100644
index 0000000..8367ff6
--- /dev/null
+++ b/xlat/uffd_zeropage_flags.h
@@ -0,0 +1,17 @@
+/* Generated by ./xlat/gen.sh from ./xlat/uffd_zeropage_flags.in; do not edit. */
+
+#ifdef IN_MPERS
+
+# error static const struct xlat uffd_zeropage_flags in mpers mode
+
+#else
+
+static
+const struct xlat uffd_zeropage_flags[] = {
+#if defined(UFFDIO_ZEROPAGE_MODE_DONTWAKE) || (defined(HAVE_DECL_UFFDIO_ZEROPAGE_MODE_DONTWAKE) && HAVE_DECL_UFFDIO_ZEROPAGE_MODE_DONTWAKE)
+  XLAT_TYPE(uint64_t, UFFDIO_ZEROPAGE_MODE_DONTWAKE),
+#endif
+ XLAT_END
+};
+
+#endif /* !IN_MPERS */
diff --git a/xlat/uffd_zeropage_flags.in b/xlat/uffd_zeropage_flags.in
new file mode 100644
index 0000000..6d48a04
--- /dev/null
+++ b/xlat/uffd_zeropage_flags.in
@@ -0,0 +1,2 @@
+#val_type uint64_t
+UFFDIO_ZEROPAGE_MODE_DONTWAKE
diff --git a/xlat/v4l2_buf_flags.h b/xlat/v4l2_buf_flags.h
index 45906d3..63f0b47 100644
--- a/xlat/v4l2_buf_flags.h
+++ b/xlat/v4l2_buf_flags.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_buf_flags in mpers mode
+extern const struct xlat v4l2_buf_flags[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_buf_flags[] = {
 #if defined(V4L2_BUF_FLAG_MAPPED) || (defined(HAVE_DECL_V4L2_BUF_FLAG_MAPPED) && HAVE_DECL_V4L2_BUF_FLAG_MAPPED)
   XLAT(V4L2_BUF_FLAG_MAPPED),
diff --git a/xlat/v4l2_buf_types.h b/xlat/v4l2_buf_types.h
index 487b02c..c5966a9 100644
--- a/xlat/v4l2_buf_types.h
+++ b/xlat/v4l2_buf_types.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_buf_types in mpers mode
+extern const struct xlat v4l2_buf_types[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_buf_types[] = {
 #if defined(V4L2_BUF_TYPE_VIDEO_CAPTURE) || (defined(HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE) && HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE)
   XLAT(V4L2_BUF_TYPE_VIDEO_CAPTURE),
diff --git a/xlat/v4l2_capture_modes.h b/xlat/v4l2_capture_modes.h
index 24f677d..ea21949 100644
--- a/xlat/v4l2_capture_modes.h
+++ b/xlat/v4l2_capture_modes.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_capture_modes in mpers mode
+extern const struct xlat v4l2_capture_modes[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_capture_modes[] = {
 #if defined(V4L2_MODE_HIGHQUALITY) || (defined(HAVE_DECL_V4L2_MODE_HIGHQUALITY) && HAVE_DECL_V4L2_MODE_HIGHQUALITY)
   XLAT(V4L2_MODE_HIGHQUALITY),
diff --git a/xlat/v4l2_colorspaces.h b/xlat/v4l2_colorspaces.h
index 524c697..857baf9 100644
--- a/xlat/v4l2_colorspaces.h
+++ b/xlat/v4l2_colorspaces.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_colorspaces in mpers mode
+extern const struct xlat v4l2_colorspaces[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_colorspaces[] = {
 #if defined(V4L2_COLORSPACE_SMPTE170M) || (defined(HAVE_DECL_V4L2_COLORSPACE_SMPTE170M) && HAVE_DECL_V4L2_COLORSPACE_SMPTE170M)
   XLAT(V4L2_COLORSPACE_SMPTE170M),
diff --git a/xlat/v4l2_control_classes.h b/xlat/v4l2_control_classes.h
index 8a7d21a..9ceb9c4 100644
--- a/xlat/v4l2_control_classes.h
+++ b/xlat/v4l2_control_classes.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_control_classes in mpers mode
+extern const struct xlat v4l2_control_classes[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_control_classes[] = {
 #if defined(V4L2_CTRL_CLASS_USER) || (defined(HAVE_DECL_V4L2_CTRL_CLASS_USER) && HAVE_DECL_V4L2_CTRL_CLASS_USER)
   XLAT(V4L2_CTRL_CLASS_USER),
diff --git a/xlat/v4l2_control_flags.h b/xlat/v4l2_control_flags.h
index 674b05d..a4c8a53 100644
--- a/xlat/v4l2_control_flags.h
+++ b/xlat/v4l2_control_flags.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_control_flags in mpers mode
+extern const struct xlat v4l2_control_flags[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_control_flags[] = {
 #if defined(V4L2_CTRL_FLAG_DISABLED) || (defined(HAVE_DECL_V4L2_CTRL_FLAG_DISABLED) && HAVE_DECL_V4L2_CTRL_FLAG_DISABLED)
   XLAT(V4L2_CTRL_FLAG_DISABLED),
diff --git a/xlat/v4l2_control_ids.h b/xlat/v4l2_control_ids.h
index b70241d..2f740db 100644
--- a/xlat/v4l2_control_ids.h
+++ b/xlat/v4l2_control_ids.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_control_ids in mpers mode
+extern const struct xlat v4l2_control_ids[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_control_ids[] = {
  XLAT(0),
 #if defined(V4L2_CID_BRIGHTNESS) || (defined(HAVE_DECL_V4L2_CID_BRIGHTNESS) && HAVE_DECL_V4L2_CID_BRIGHTNESS)
diff --git a/xlat/v4l2_control_types.h b/xlat/v4l2_control_types.h
index d046ba3..37ac812 100644
--- a/xlat/v4l2_control_types.h
+++ b/xlat/v4l2_control_types.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_control_types in mpers mode
+extern const struct xlat v4l2_control_types[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_control_types[] = {
 #if defined(V4L2_CTRL_TYPE_INTEGER) || (defined(HAVE_DECL_V4L2_CTRL_TYPE_INTEGER) && HAVE_DECL_V4L2_CTRL_TYPE_INTEGER)
   XLAT(V4L2_CTRL_TYPE_INTEGER),
diff --git a/xlat/v4l2_device_capabilities_flags.h b/xlat/v4l2_device_capabilities_flags.h
index 727e09e..248350e 100644
--- a/xlat/v4l2_device_capabilities_flags.h
+++ b/xlat/v4l2_device_capabilities_flags.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_device_capabilities_flags in mpers mode
+extern const struct xlat v4l2_device_capabilities_flags[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_device_capabilities_flags[] = {
 #if defined(V4L2_CAP_VIDEO_CAPTURE) || (defined(HAVE_DECL_V4L2_CAP_VIDEO_CAPTURE) && HAVE_DECL_V4L2_CAP_VIDEO_CAPTURE)
   XLAT(V4L2_CAP_VIDEO_CAPTURE),
diff --git a/xlat/v4l2_fields.h b/xlat/v4l2_fields.h
index a7cad92..a6c78db 100644
--- a/xlat/v4l2_fields.h
+++ b/xlat/v4l2_fields.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_fields in mpers mode
+extern const struct xlat v4l2_fields[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_fields[] = {
 #if defined(V4L2_FIELD_ANY) || (defined(HAVE_DECL_V4L2_FIELD_ANY) && HAVE_DECL_V4L2_FIELD_ANY)
   XLAT(V4L2_FIELD_ANY),
diff --git a/xlat/v4l2_format_description_flags.h b/xlat/v4l2_format_description_flags.h
index ee2300c..d82236d 100644
--- a/xlat/v4l2_format_description_flags.h
+++ b/xlat/v4l2_format_description_flags.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_format_description_flags in mpers mode
+extern const struct xlat v4l2_format_description_flags[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_format_description_flags[] = {
 #if defined(V4L2_FMT_FLAG_COMPRESSED) || (defined(HAVE_DECL_V4L2_FMT_FLAG_COMPRESSED) && HAVE_DECL_V4L2_FMT_FLAG_COMPRESSED)
   XLAT(V4L2_FMT_FLAG_COMPRESSED),
diff --git a/xlat/v4l2_frameinterval_types.h b/xlat/v4l2_frameinterval_types.h
index 071d9a9..728c3c7 100644
--- a/xlat/v4l2_frameinterval_types.h
+++ b/xlat/v4l2_frameinterval_types.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_frameinterval_types in mpers mode
+extern const struct xlat v4l2_frameinterval_types[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_frameinterval_types[] = {
 #if defined(V4L2_FRMIVAL_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE)
   XLAT(V4L2_FRMIVAL_TYPE_DISCRETE),
diff --git a/xlat/v4l2_framesize_types.h b/xlat/v4l2_framesize_types.h
index cd72ce1..28a77c2 100644
--- a/xlat/v4l2_framesize_types.h
+++ b/xlat/v4l2_framesize_types.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_framesize_types in mpers mode
+extern const struct xlat v4l2_framesize_types[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_framesize_types[] = {
 #if defined(V4L2_FRMSIZE_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE)
   XLAT(V4L2_FRMSIZE_TYPE_DISCRETE),
diff --git a/xlat/v4l2_input_types.h b/xlat/v4l2_input_types.h
index e090a88..8707ce7 100644
--- a/xlat/v4l2_input_types.h
+++ b/xlat/v4l2_input_types.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_input_types in mpers mode
+extern const struct xlat v4l2_input_types[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_input_types[] = {
 #if defined(V4L2_INPUT_TYPE_TUNER) || (defined(HAVE_DECL_V4L2_INPUT_TYPE_TUNER) && HAVE_DECL_V4L2_INPUT_TYPE_TUNER)
   XLAT(V4L2_INPUT_TYPE_TUNER),
diff --git a/xlat/v4l2_memories.h b/xlat/v4l2_memories.h
index e34deef..eda2ff9 100644
--- a/xlat/v4l2_memories.h
+++ b/xlat/v4l2_memories.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_memories in mpers mode
+extern const struct xlat v4l2_memories[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_memories[] = {
 #if defined(V4L2_MEMORY_MMAP) || (defined(HAVE_DECL_V4L2_MEMORY_MMAP) && HAVE_DECL_V4L2_MEMORY_MMAP)
   XLAT(V4L2_MEMORY_MMAP),
diff --git a/xlat/v4l2_streaming_capabilities.h b/xlat/v4l2_streaming_capabilities.h
index 1985639..839146a 100644
--- a/xlat/v4l2_streaming_capabilities.h
+++ b/xlat/v4l2_streaming_capabilities.h
@@ -2,11 +2,13 @@
 
 #ifdef IN_MPERS
 
-# error static const struct xlat v4l2_streaming_capabilities in mpers mode
+extern const struct xlat v4l2_streaming_capabilities[];
 
 #else
 
+# if !(defined HAVE_M32_MPERS || defined HAVE_MX32_MPERS)
 static
+# endif
 const struct xlat v4l2_streaming_capabilities[] = {
 #if defined(V4L2_CAP_TIMEPERFRAME) || (defined(HAVE_DECL_V4L2_CAP_TIMEPERFRAME) && HAVE_DECL_V4L2_CAP_TIMEPERFRAME)
   XLAT(V4L2_CAP_TIMEPERFRAME),