Merge remote-tracking branch 'strace/master' into HEAD
diff --git a/Makefile.am b/Makefile.am
index 8193c9e..549aebc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -555,11 +555,18 @@
 srpm: dist-xz
 	rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
 
-BUILT_SOURCES = .version
+BUILT_SOURCES = .version sys_func.h
 
 $(srcdir)/.version:
 	$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
 
+strace_SOURCES_c = $(filter %.c,$(strace_SOURCES))
+
+sys_func.h: $(patsubst %,$(srcdir)/%,$(strace_SOURCES_c))
+	for f in $^; do \
+		sed -n 's/^SYS_FUNC(.*/extern &;/p' $$f; \
+	done | sort -u > $@
+
 dist-hook:
 	$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
 
@@ -586,7 +593,7 @@
 ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
 ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
 BUILT_SOURCES += $(ioctlent_h)
-CLEANFILES = $(ioctlent_h)
+CLEANFILES = sys_func.h $(ioctlent_h)
 
 ioctlent%.h: ioctlsort%
 	./$< > $@
diff --git a/access.c b/access.c
index f28f69d..dd0d749 100644
--- a/access.c
+++ b/access.c
@@ -15,14 +15,12 @@
 	return 0;
 }
 
-int
-sys_access(struct tcb *tcp)
+SYS_FUNC(access)
 {
 	return decode_access(tcp, 0);
 }
 
-int
-sys_faccessat(struct tcb *tcp)
+SYS_FUNC(faccessat)
 {
 	if (entering(tcp))
 		print_dirfd(tcp, tcp->u_arg[0]);
diff --git a/affinity.c b/affinity.c
index 97d8b3e..286e15c 100644
--- a/affinity.c
+++ b/affinity.c
@@ -32,8 +32,7 @@
 	}
 }
 
-int
-sys_sched_setaffinity(struct tcb *tcp)
+SYS_FUNC(sched_setaffinity)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -42,8 +41,7 @@
 	return 0;
 }
 
-int
-sys_sched_getaffinity(struct tcb *tcp)
+SYS_FUNC(sched_getaffinity)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
diff --git a/aio.c b/aio.c
index 18e5301..7d8fb65 100644
--- a/aio.c
+++ b/aio.c
@@ -38,8 +38,7 @@
 # define IOCB_RESFD (1 << 0)
 #endif
 
-int
-sys_io_setup(struct tcb *tcp)
+SYS_FUNC(io_setup)
 {
 	if (entering(tcp))
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -57,8 +56,7 @@
 	return 0;
 }
 
-int
-sys_io_destroy(struct tcb *tcp)
+SYS_FUNC(io_destroy)
 {
 	if (entering(tcp))
 		tprintf("%lu", tcp->u_arg[0]);
@@ -112,8 +110,7 @@
 
 #endif /* HAVE_LIBAIO_H */
 
-int
-sys_io_submit(struct tcb *tcp)
+SYS_FUNC(io_submit)
 {
 	if (entering(tcp)) {
 #ifdef HAVE_LIBAIO_H
@@ -197,8 +194,7 @@
 	return 0;
 }
 
-int
-sys_io_cancel(struct tcb *tcp)
+SYS_FUNC(io_cancel)
 {
 	if (entering(tcp)) {
 #ifdef HAVE_LIBAIO_H
@@ -232,8 +228,7 @@
 	return 0;
 }
 
-int
-sys_io_getevents(struct tcb *tcp)
+SYS_FUNC(io_getevents)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, %ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1],
diff --git a/bjm.c b/bjm.c
index c8d72a3..435d6bb 100644
--- a/bjm.c
+++ b/bjm.c
@@ -72,8 +72,7 @@
 #include "xlat/modflags.h"
 #include "xlat/delete_module_flags.h"
 
-int
-sys_query_module(struct tcb *tcp)
+SYS_FUNC(query_module)
 {
 	if (entering(tcp)) {
 		printstr(tcp, tcp->u_arg[0], -1);
@@ -163,8 +162,7 @@
 	return 0;
 }
 
-int
-sys_create_module(struct tcb *tcp)
+SYS_FUNC(create_module)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -173,8 +171,7 @@
 	return RVAL_HEX;
 }
 
-int
-sys_delete_module(struct tcb *tcp)
+SYS_FUNC(delete_module)
 {
 	if (entering(tcp)) {
 		printstr(tcp, tcp->u_arg[0], -1);
@@ -184,8 +181,7 @@
 	return 0;
 }
 
-int
-sys_init_module(struct tcb *tcp)
+SYS_FUNC(init_module)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -199,8 +195,7 @@
 
 #include "xlat/module_init_flags.h"
 
-int
-sys_finit_module(struct tcb *tcp)
+SYS_FUNC(finit_module)
 {
 	if (exiting(tcp))
 		return 0;
diff --git a/cacheflush.c b/cacheflush.c
index bfbf583..727d49b 100644
--- a/cacheflush.c
+++ b/cacheflush.c
@@ -20,8 +20,7 @@
 	XLAT_END
 };
 
-int
-sys_cacheflush(struct tcb *tcp)
+SYS_FUNC(cacheflush)
 {
 	if (entering(tcp)) {
 		/* addr */
@@ -46,8 +45,7 @@
 	XLAT_END
 };
 
-int
-sys_cacheflush(struct tcb *tcp)
+SYS_FUNC(cacheflush)
 {
 	if (entering(tcp)) {
 		/* start addr */
@@ -78,8 +76,7 @@
 	XLAT_END
 };
 
-int
-sys_cacheflush(struct tcb *tcp)
+SYS_FUNC(cacheflush)
 {
 	if (entering(tcp)) {
 		/* addr */
diff --git a/capability.c b/capability.c
index 26d9c66..d18d726 100644
--- a/capability.c
+++ b/capability.c
@@ -117,8 +117,7 @@
 	tprints("}");
 }
 
-int
-sys_capget(struct tcb *tcp)
+SYS_FUNC(capget)
 {
 	cap_user_header_t h;
 
@@ -133,8 +132,7 @@
 	return 0;
 }
 
-int
-sys_capset(struct tcb *tcp)
+SYS_FUNC(capset)
 {
 	if (entering(tcp)) {
 		cap_user_header_t h = get_cap_header(tcp, tcp->u_arg[0]);
diff --git a/chdir.c b/chdir.c
index 29f0afc..a91d366 100644
--- a/chdir.c
+++ b/chdir.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_chdir(struct tcb *tcp)
+SYS_FUNC(chdir)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
diff --git a/chmod.c b/chmod.c
index 89453a9..21ce115 100644
--- a/chmod.c
+++ b/chmod.c
@@ -10,22 +10,19 @@
 	return 0;
 }
 
-int
-sys_chmod(struct tcb *tcp)
+SYS_FUNC(chmod)
 {
 	return decode_chmod(tcp, 0);
 }
 
-int
-sys_fchmodat(struct tcb *tcp)
+SYS_FUNC(fchmodat)
 {
 	if (entering(tcp))
 		print_dirfd(tcp, tcp->u_arg[0]);
 	return decode_chmod(tcp, 1);
 }
 
-int
-sys_fchmod(struct tcb *tcp)
+SYS_FUNC(fchmod)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
diff --git a/clone.c b/clone.c
index a0a7096..6c2d196 100644
--- a/clone.c
+++ b/clone.c
@@ -68,8 +68,7 @@
 extern void print_user_desc(struct tcb *, long);
 #endif /* I386 || X86_64 || X32 */
 
-int
-sys_clone(struct tcb *tcp)
+SYS_FUNC(clone)
 {
 	if (exiting(tcp)) {
 		const char *sep = "|";
@@ -123,8 +122,7 @@
 	return 0;
 }
 
-int
-sys_setns(struct tcb *tcp)
+SYS_FUNC(setns)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -134,16 +132,14 @@
 	return 0;
 }
 
-int
-sys_unshare(struct tcb *tcp)
+SYS_FUNC(unshare)
 {
 	if (entering(tcp))
 		printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
 	return 0;
 }
 
-int
-sys_fork(struct tcb *tcp)
+SYS_FUNC(fork)
 {
 	if (exiting(tcp))
 		return RVAL_UDECIMAL;
diff --git a/defs.h b/defs.h
index 34f1603..77c819c 100644
--- a/defs.h
+++ b/defs.h
@@ -673,3 +673,9 @@
 /* Only ensures that sysent[scno] isn't out of range */
 #define SCNO_IN_RANGE(scno) \
 	((unsigned long)(scno) < nsyscalls)
+
+#ifndef SYS_FUNC_NAME
+# define SYS_FUNC_NAME(syscall_name) sys_ ## syscall_name
+#endif
+
+#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(syscall_name)(struct tcb *tcp)
diff --git a/desc.c b/desc.c
index 485c802..1b9dd1a 100644
--- a/desc.c
+++ b/desc.c
@@ -145,8 +145,7 @@
 		tprints("}");
 }
 
-int
-sys_fcntl(struct tcb *tcp)
+SYS_FUNC(fcntl)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -244,8 +243,7 @@
 
 #ifdef LOCK_SH
 
-int
-sys_flock(struct tcb *tcp)
+SYS_FUNC(flock)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -256,8 +254,7 @@
 }
 #endif /* LOCK_SH */
 
-int
-sys_close(struct tcb *tcp)
+SYS_FUNC(close)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -265,8 +262,7 @@
 	return 0;
 }
 
-int
-sys_dup(struct tcb *tcp)
+SYS_FUNC(dup)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -289,21 +285,18 @@
 	return RVAL_FD;
 }
 
-int
-sys_dup2(struct tcb *tcp)
+SYS_FUNC(dup2)
 {
 	return do_dup2(tcp, -1);
 }
 
-int
-sys_dup3(struct tcb *tcp)
+SYS_FUNC(dup3)
 {
 	return do_dup2(tcp, 2);
 }
 
 #if defined(ALPHA)
-int
-sys_getdtablesize(struct tcb *tcp)
+SYS_FUNC(getdtablesize)
 {
 	return 0;
 }
@@ -440,8 +433,7 @@
 	return 0;
 }
 
-int
-sys_oldselect(struct tcb *tcp)
+SYS_FUNC(oldselect)
 {
 	long args[5];
 
@@ -453,8 +445,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_select(struct tcb *tcp)
+SYS_FUNC(osf_select)
 {
 	long *args = tcp->u_arg;
 	return decode_select(tcp, args, BITNESS_32);
@@ -466,14 +457,12 @@
 #include "xlat/epollflags.h"
 
 /* Not aliased to printargs_ld: we want it to have a distinct address */
-int
-sys_epoll_create(struct tcb *tcp)
+SYS_FUNC(epoll_create)
 {
 	return printargs_ld(tcp);
 }
 
-int
-sys_epoll_create1(struct tcb *tcp)
+SYS_FUNC(epoll_create1)
 {
 	if (entering(tcp))
 		printflags(epollflags, tcp->u_arg[0], "EPOLL_???");
@@ -493,8 +482,7 @@
 }
 #endif
 
-int
-sys_epoll_ctl(struct tcb *tcp)
+SYS_FUNC(epoll_ctl)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -563,15 +551,13 @@
 	}
 }
 
-int
-sys_epoll_wait(struct tcb *tcp)
+SYS_FUNC(epoll_wait)
 {
 	epoll_wait_common(tcp);
 	return 0;
 }
 
-int
-sys_epoll_pwait(struct tcb *tcp)
+SYS_FUNC(epoll_pwait)
 {
 	epoll_wait_common(tcp);
 	if (exiting(tcp)) {
@@ -583,14 +569,12 @@
 	return 0;
 }
 
-int
-sys_select(struct tcb *tcp)
+SYS_FUNC(select)
 {
 	return decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
 }
 
-int
-sys_pselect6(struct tcb *tcp)
+SYS_FUNC(pselect6)
 {
 	int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
 	if (entering(tcp)) {
@@ -636,20 +620,17 @@
 	return 0;
 }
 
-int
-sys_eventfd(struct tcb *tcp)
+SYS_FUNC(eventfd)
 {
 	return do_eventfd(tcp, -1);
 }
 
-int
-sys_eventfd2(struct tcb *tcp)
+SYS_FUNC(eventfd2)
 {
 	return do_eventfd(tcp, 1);
 }
 
-int
-sys_perf_event_open(struct tcb *tcp)
+SYS_FUNC(perf_event_open)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %d, %d, %d, ",
diff --git a/dirent.c b/dirent.c
index d30e0d2..32f04b9 100644
--- a/dirent.c
+++ b/dirent.c
@@ -38,8 +38,7 @@
 	tprints("}");
 }
 
-int
-sys_readdir(struct tcb *tcp)
+SYS_FUNC(readdir)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -58,8 +57,7 @@
 
 #include "xlat/direnttypes.h"
 
-int
-sys_getdents(struct tcb *tcp)
+SYS_FUNC(getdents)
 {
 	unsigned int i, len, dents = 0;
 	char *buf;
@@ -139,8 +137,7 @@
 	return 0;
 }
 
-int
-sys_getdents64(struct tcb *tcp)
+SYS_FUNC(getdents64)
 {
 	/* the minimum size of a valid dirent64 structure */
 	const unsigned int d_name_offset = offsetof(struct dirent64, d_name);
diff --git a/execve.c b/execve.c
index 31e80a6..4f2639d 100644
--- a/execve.c
+++ b/execve.c
@@ -42,8 +42,7 @@
 	tprintf(fmt, count, count == 1 ? "" : "s");
 }
 
-int
-sys_execve(struct tcb *tcp)
+SYS_FUNC(execve)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -68,8 +67,7 @@
 }
 
 #if defined(SPARC) || defined(SPARC64)
-int
-sys_execv(struct tcb *tcp)
+SYS_FUNC(execv)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
diff --git a/exit.c b/exit.c
index 0e0c2ea..d23e528 100644
--- a/exit.c
+++ b/exit.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_exit(struct tcb *tcp)
+SYS_FUNC(exit)
 {
 	if (exiting(tcp)) {
 		fprintf(stderr, "_exit returned!\n");
diff --git a/fadvise.c b/fadvise.c
index 850a425..088f857 100644
--- a/fadvise.c
+++ b/fadvise.c
@@ -4,8 +4,7 @@
 
 #include "xlat/advise.h"
 
-int
-sys_fadvise64(struct tcb *tcp)
+SYS_FUNC(fadvise64)
 {
 	if (entering(tcp)) {
 		int argn;
@@ -17,8 +16,7 @@
 	return 0;
 }
 
-int
-sys_fadvise64_64(struct tcb *tcp)
+SYS_FUNC(fadvise64_64)
 {
 	if (entering(tcp)) {
 		int argn;
diff --git a/fallocate.c b/fallocate.c
index 990106d..c096c98 100644
--- a/fallocate.c
+++ b/fallocate.c
@@ -6,8 +6,7 @@
 
 #include "xlat/falloc_flags.h"
 
-int
-sys_fallocate(struct tcb *tcp)
+SYS_FUNC(fallocate)
 {
 	if (entering(tcp)) {
 		int argn;
diff --git a/fanotify.c b/fanotify.c
index 63816b8..8ceca0e 100644
--- a/fanotify.c
+++ b/fanotify.c
@@ -10,8 +10,7 @@
 # define FAN_NOFD -1
 #endif
 
-int
-sys_fanotify_init(struct tcb *tcp)
+SYS_FUNC(fanotify_init)
 {
 	unsigned flags;
 
@@ -34,8 +33,7 @@
 #include "xlat/fan_mark_flags.h"
 #include "xlat/fan_event_flags.h"
 
-int
-sys_fanotify_mark(struct tcb *tcp)
+SYS_FUNC(fanotify_mark)
 {
 	unsigned long long mask = 0;
 	int argn;
diff --git a/fchownat.c b/fchownat.c
index 95de6e4..743b574 100644
--- a/fchownat.c
+++ b/fchownat.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_fchownat(struct tcb *tcp)
+SYS_FUNC(fchownat)
 {
 	if (entering(tcp)) {
 		print_dirfd(tcp, tcp->u_arg[0]);
diff --git a/file.c b/file.c
index 9dc7595..8e1952f 100644
--- a/file.c
+++ b/file.c
@@ -275,8 +275,7 @@
 	do_printstat(tcp, &statbuf);
 }
 
-int
-sys_stat(struct tcb *tcp)
+SYS_FUNC(stat)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -287,8 +286,7 @@
 	return 0;
 }
 
-int
-sys_fstat(struct tcb *tcp)
+SYS_FUNC(fstat)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -385,8 +383,7 @@
 	do_printstat64(tcp, &statbuf);
 }
 
-int
-sys_stat64(struct tcb *tcp)
+SYS_FUNC(stat64)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -397,8 +394,7 @@
 	return 0;
 }
 
-int
-sys_fstat64(struct tcb *tcp)
+SYS_FUNC(fstat64)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -411,22 +407,19 @@
 
 #else
 
-int
-sys_stat64(struct tcb *tcp)
+SYS_FUNC(stat64)
 {
 	return sys_stat(tcp);
 }
 
-int
-sys_fstat64(struct tcb *tcp)
+SYS_FUNC(fstat64)
 {
 	return sys_fstat(tcp);
 }
 
 #endif /* HAVE_STRUCT_STAT64 */
 
-int
-sys_newfstatat(struct tcb *tcp)
+SYS_FUNC(newfstatat)
 {
 	if (entering(tcp)) {
 		print_dirfd(tcp, tcp->u_arg[0]);
@@ -499,8 +492,7 @@
 	do_printstat(tcp, &newstatbuf);
 }
 
-int
-sys_oldstat(struct tcb *tcp)
+SYS_FUNC(oldstat)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -511,8 +503,7 @@
 	return 0;
 }
 
-int
-sys_oldfstat(struct tcb *tcp)
+SYS_FUNC(oldfstat)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -527,8 +518,7 @@
 
 #if defined(SPARC) || defined(SPARC64)
 
-int
-sys_xstat(struct tcb *tcp)
+SYS_FUNC(xstat)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -540,8 +530,7 @@
 	return 0;
 }
 
-int
-sys_fxstat(struct tcb *tcp)
+SYS_FUNC(fxstat)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
diff --git a/futex.c b/futex.c
index a1781c0..f59587c 100644
--- a/futex.c
+++ b/futex.c
@@ -98,8 +98,7 @@
 #include "xlat/futexwakeops.h"
 #include "xlat/futexwakecmps.h"
 
-int
-sys_futex(struct tcb *tcp)
+SYS_FUNC(futex)
 {
 	if (entering(tcp)) {
 		long int cmd = tcp->u_arg[1] & 127;
diff --git a/get_robust_list.c b/get_robust_list.c
index 1b667ca..d9e0f1a 100644
--- a/get_robust_list.c
+++ b/get_robust_list.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_get_robust_list(struct tcb *tcp)
+SYS_FUNC(get_robust_list)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
diff --git a/getcpu.c b/getcpu.c
index 522786f..47af795 100644
--- a/getcpu.c
+++ b/getcpu.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_getcpu(struct tcb *tcp)
+SYS_FUNC(getcpu)
 {
 	if (exiting(tcp)) {
 		unsigned u;
diff --git a/getcwd.c b/getcwd.c
index 1b97448..66af834 100644
--- a/getcwd.c
+++ b/getcwd.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_getcwd(struct tcb *tcp)
+SYS_FUNC(getcwd)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp))
diff --git a/getrandom.c b/getrandom.c
index 068b2e6..b67916d 100644
--- a/getrandom.c
+++ b/getrandom.c
@@ -1,8 +1,7 @@
 #include "defs.h"
 #include "xlat/getrandom_flags.h"
 
-int
-sys_getrandom(struct tcb *tcp)
+SYS_FUNC(getrandom)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp))
diff --git a/hostname.c b/hostname.c
index d2e0471..c497dc5 100644
--- a/hostname.c
+++ b/hostname.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_sethostname(struct tcb *tcp)
+SYS_FUNC(sethostname)
 {
 	if (entering(tcp)) {
 		printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
@@ -11,8 +10,7 @@
 }
 
 #if defined(ALPHA)
-int
-sys_gethostname(struct tcb *tcp)
+SYS_FUNC(gethostname)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp))
diff --git a/inotify.c b/inotify.c
index 81c8c5d..34902b8 100644
--- a/inotify.c
+++ b/inotify.c
@@ -4,8 +4,7 @@
 #include "xlat/inotify_flags.h"
 #include "xlat/inotify_init_flags.h"
 
-int
-sys_inotify_add_watch(struct tcb *tcp)
+SYS_FUNC(inotify_add_watch)
 {
 	if (entering(tcp)) {
 		/* file descriptor */
@@ -20,8 +19,7 @@
 	return 0;
 }
 
-int
-sys_inotify_rm_watch(struct tcb *tcp)
+SYS_FUNC(inotify_rm_watch)
 {
 	if (entering(tcp)) {
 		/* file descriptor */
@@ -32,8 +30,7 @@
 	return 0;
 }
 
-int
-sys_inotify_init1(struct tcb *tcp)
+SYS_FUNC(inotify_init1)
 {
 	if (entering(tcp))
 		printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
diff --git a/io.c b/io.c
index 0618509..30ed578 100644
--- a/io.c
+++ b/io.c
@@ -32,8 +32,7 @@
 #include <fcntl.h>
 #include <sys/uio.h>
 
-int
-sys_read(struct tcb *tcp)
+SYS_FUNC(read)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -48,8 +47,7 @@
 	return 0;
 }
 
-int
-sys_write(struct tcb *tcp)
+SYS_FUNC(write)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -142,8 +140,7 @@
 	tprint_iov_upto(tcp, len, addr, decode_iov, (unsigned long) -1L);
 }
 
-int
-sys_readv(struct tcb *tcp)
+SYS_FUNC(readv)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -160,8 +157,7 @@
 	return 0;
 }
 
-int
-sys_writev(struct tcb *tcp)
+SYS_FUNC(writev)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -183,8 +179,7 @@
 #define PREAD_OFFSET_ARG 3
 #endif
 
-int
-sys_pread(struct tcb *tcp)
+SYS_FUNC(pread)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -200,8 +195,7 @@
 	return 0;
 }
 
-int
-sys_pwrite(struct tcb *tcp)
+SYS_FUNC(pwrite)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -239,8 +233,7 @@
 #endif
 }
 
-int
-sys_preadv(struct tcb *tcp)
+SYS_FUNC(preadv)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -257,8 +250,7 @@
 	return 0;
 }
 
-int
-sys_pwritev(struct tcb *tcp)
+SYS_FUNC(pwritev)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -296,8 +288,7 @@
 		tprintf("[%lu]", offset);
 }
 
-int
-sys_sendfile(struct tcb *tcp)
+SYS_FUNC(sendfile)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -323,8 +314,7 @@
 		tprintf("[%llu]", (unsigned long long int) offset);
 }
 
-int
-sys_sendfile64(struct tcb *tcp)
+SYS_FUNC(sendfile64)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -339,8 +329,7 @@
 
 #include "xlat/splice_flags.h"
 
-int
-sys_tee(struct tcb *tcp)
+SYS_FUNC(tee)
 {
 	if (entering(tcp)) {
 		/* int fd_in */
@@ -357,8 +346,7 @@
 	return 0;
 }
 
-int
-sys_splice(struct tcb *tcp)
+SYS_FUNC(splice)
 {
 	if (entering(tcp)) {
 		/* int fd_in */
@@ -381,8 +369,7 @@
 	return 0;
 }
 
-int
-sys_vmsplice(struct tcb *tcp)
+SYS_FUNC(vmsplice)
 {
 	if (entering(tcp)) {
 		/* int fd */
@@ -397,8 +384,7 @@
 	return 0;
 }
 
-int
-sys_ioctl(struct tcb *tcp)
+SYS_FUNC(ioctl)
 {
 	const struct_ioctlent *iop;
 
diff --git a/ioprio.c b/ioprio.c
index 6826e56..20866dc 100644
--- a/ioprio.c
+++ b/ioprio.c
@@ -42,8 +42,7 @@
 	return outstr;
 }
 
-int
-sys_ioprio_get(struct tcb *tcp)
+SYS_FUNC(ioprio_get)
 {
 	if (entering(tcp)) {
 		/* int which */
@@ -60,8 +59,7 @@
 	}
 }
 
-int
-sys_ioprio_set(struct tcb *tcp)
+SYS_FUNC(ioprio_set)
 {
 	if (entering(tcp)) {
 		/* int which */
diff --git a/ipc.c b/ipc.c
index a94f572..f2c064b 100644
--- a/ipc.c
+++ b/ipc.c
@@ -72,7 +72,7 @@
 #include "xlat/ipc_msg_flags.h"
 #include "xlat/semop_flags.h"
 
-int sys_msgget(struct tcb *tcp)
+SYS_FUNC(msgget)
 {
 	if (entering(tcp)) {
 		if (tcp->u_arg[0])
@@ -100,7 +100,7 @@
 	return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
 }
 
-int sys_msgctl(struct tcb *tcp)
+SYS_FUNC(msgctl)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, ", tcp->u_arg[0]);
@@ -127,7 +127,7 @@
 	printflags(ipc_msg_flags, flags, "MSG_???");
 }
 
-int sys_msgsnd(struct tcb *tcp)
+SYS_FUNC(msgsnd)
 {
 	if (entering(tcp)) {
 		tprintf("%d, ", (int) tcp->u_arg[0]);
@@ -157,7 +157,7 @@
 	tprintf(", %lu, %ld, ", count, msgtyp);
 }
 
-int sys_msgrcv(struct tcb *tcp)
+SYS_FUNC(msgrcv)
 {
 	if (entering(tcp)) {
 		tprintf("%d, ", (int) tcp->u_arg[0]);
@@ -227,7 +227,7 @@
 	tprintf("}, %lu", count);
 }
 
-int sys_semop(struct tcb *tcp)
+SYS_FUNC(semop)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, ", tcp->u_arg[0]);
@@ -240,7 +240,7 @@
 	return 0;
 }
 
-int sys_semtimedop(struct tcb *tcp)
+SYS_FUNC(semtimedop)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, ", tcp->u_arg[0]);
@@ -261,7 +261,7 @@
 	return 0;
 }
 
-int sys_semget(struct tcb *tcp)
+SYS_FUNC(semget)
 {
 	if (entering(tcp)) {
 		if (tcp->u_arg[0])
@@ -276,7 +276,7 @@
 	return 0;
 }
 
-int sys_semctl(struct tcb *tcp)
+SYS_FUNC(semctl)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -295,7 +295,7 @@
 	return 0;
 }
 
-int sys_shmget(struct tcb *tcp)
+SYS_FUNC(shmget)
 {
 	if (entering(tcp)) {
 		if (tcp->u_arg[0])
@@ -310,7 +310,7 @@
 	return 0;
 }
 
-int sys_shmctl(struct tcb *tcp)
+SYS_FUNC(shmctl)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, ", tcp->u_arg[0]);
@@ -324,7 +324,7 @@
 	return 0;
 }
 
-int sys_shmat(struct tcb *tcp)
+SYS_FUNC(shmat)
 {
 	if (exiting(tcp)) {
 		tprintf("%lu", tcp->u_arg[0]);
@@ -348,7 +348,7 @@
 	return 0;
 }
 
-int sys_shmdt(struct tcb *tcp)
+SYS_FUNC(shmdt)
 {
 	if (entering(tcp)) {
 		if (indirect_ipccall(tcp)) {
@@ -360,8 +360,7 @@
 	return 0;
 }
 
-int
-sys_mq_open(struct tcb *tcp)
+SYS_FUNC(mq_open)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -387,8 +386,7 @@
 	return 0;
 }
 
-int
-sys_mq_timedsend(struct tcb *tcp)
+SYS_FUNC(mq_timedsend)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -399,8 +397,7 @@
 	return 0;
 }
 
-int
-sys_mq_timedreceive(struct tcb *tcp)
+SYS_FUNC(mq_timedreceive)
 {
 	if (entering(tcp))
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -412,8 +409,7 @@
 	return 0;
 }
 
-int
-sys_mq_notify(struct tcb *tcp)
+SYS_FUNC(mq_notify)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -445,8 +441,7 @@
 	}
 }
 
-int
-sys_mq_getsetattr(struct tcb *tcp)
+SYS_FUNC(mq_getsetattr)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -457,8 +452,7 @@
 	return 0;
 }
 
-int
-sys_ipc(struct tcb *tcp)
+SYS_FUNC(ipc)
 {
 	return printargs(tcp);
 }
diff --git a/kexec.c b/kexec.c
index 6bec51c..781280a 100644
--- a/kexec.c
+++ b/kexec.c
@@ -72,8 +72,7 @@
 		tprintf(" %#lx", addr);
 }
 
-int
-sys_kexec_load(struct tcb *tcp)
+SYS_FUNC(kexec_load)
 {
 	unsigned long n;
 
diff --git a/keyctl.c b/keyctl.c
index e77557e..0447745 100644
--- a/keyctl.c
+++ b/keyctl.c
@@ -15,8 +15,7 @@
 		tprintf("%d", id);
 }
 
-int
-sys_add_key(struct tcb *tcp)
+SYS_FUNC(add_key)
 {
 	if (entering(tcp)) {
 		/* type */
@@ -35,8 +34,7 @@
 	return 0;
 }
 
-int
-sys_request_key(struct tcb *tcp)
+SYS_FUNC(request_key)
 {
 	if (entering(tcp)) {
 		/* type */
@@ -263,8 +261,7 @@
 
 #include "xlat/keyctl_commands.h"
 
-int
-sys_keyctl(struct tcb *tcp)
+SYS_FUNC(keyctl)
 {
 	int cmd = tcp->u_arg[0];
 
diff --git a/ldt.c b/ldt.c
index 0376d2b..dbe49d9 100644
--- a/ldt.c
+++ b/ldt.c
@@ -39,8 +39,7 @@
 		desc.useable);
 }
 
-int
-sys_modify_ldt(struct tcb *tcp)
+SYS_FUNC(modify_ldt)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -55,8 +54,7 @@
 	return 0;
 }
 
-int
-sys_set_thread_area(struct tcb *tcp)
+SYS_FUNC(set_thread_area)
 {
 	if (entering(tcp)) {
 		print_user_desc(tcp, tcp->u_arg[0]);
@@ -76,8 +74,7 @@
 	return 0;
 }
 
-int
-sys_get_thread_area(struct tcb *tcp)
+SYS_FUNC(get_thread_area)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp))
@@ -91,8 +88,7 @@
 #endif /* I386 || X86_64 || X32 */
 
 #if defined(M68K) || defined(MIPS)
-int
-sys_set_thread_area(struct tcb *tcp)
+SYS_FUNC(set_thread_area)
 {
 	if (entering(tcp))
 		tprintf("%#lx", tcp->u_arg[0]);
@@ -102,8 +98,7 @@
 #endif
 
 #if defined(M68K)
-int
-sys_get_thread_area(struct tcb *tcp)
+SYS_FUNC(get_thread_area)
 {
 	return RVAL_HEX;
 }
diff --git a/link.c b/link.c
index 2f5298f..74ff514 100644
--- a/link.c
+++ b/link.c
@@ -20,8 +20,7 @@
 
 #include "xlat/at_flags.h"
 
-int
-sys_link(struct tcb *tcp)
+SYS_FUNC(link)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -31,8 +30,7 @@
 	return 0;
 }
 
-int
-sys_linkat(struct tcb *tcp)
+SYS_FUNC(linkat)
 {
 	if (entering(tcp)) {
 		print_dirfd(tcp, tcp->u_arg[0]);
@@ -46,8 +44,7 @@
 	return 0;
 }
 
-int
-sys_unlinkat(struct tcb *tcp)
+SYS_FUNC(unlinkat)
 {
 	if (entering(tcp)) {
 		print_dirfd(tcp, tcp->u_arg[0]);
@@ -58,8 +55,7 @@
 	return 0;
 }
 
-int
-sys_symlinkat(struct tcb *tcp)
+SYS_FUNC(symlinkat)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
diff --git a/linux/alpha/syscallent.h b/linux/alpha/syscallent.h
index 5b17165..7a25b44 100644
--- a/linux/alpha/syscallent.h
+++ b/linux/alpha/syscallent.h
@@ -185,8 +185,8 @@
 [157] = { 5,	0,		printargs,			"osf_sigwaitprim"	}, /*not implemented */
 [158] = { 5,	0,		printargs,			"osf_nfssvc"		}, /*not implemented */
 [159] = { 4,	0,		printargs,			"osf_getdirentries"	},
-[160] = { 3,	0,		osf_statfs,		"osf_statfs"			},
-[161] = { 3,	0,		osf_fstatfs,		"osf_fstatfs"			},
+[160] = { 3,	0,		sys_osf_statfs,			"osf_statfs"		},
+[161] = { 3,	0,		sys_osf_fstatfs,		"osf_fstatfs"		},
 [162] = { },
 [163] = { 5,	0,		printargs,			"osf_asynch_daemon"	}, /*not implemented */
 [164] = { 5,	0,		printargs,			"osf_getfh"		}, /*not implemented */
diff --git a/linux/syscall.h b/linux/syscall.h
index dbf2d20..bd70601 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -27,341 +27,17 @@
  */
 
 #include "dummy.h"
-
-/* common syscalls */
-
-int sys_accept();
-int sys_accept4();
-int sys_access();
-int sys_add_key();
-int sys_adjtimex();
-int sys_arch_prctl();
-int sys_bind();
-int sys_brk();
-int sys_capget();
-int sys_capset();
-int sys_chdir();
-int sys_chmod();
-int sys_chown();
-int sys_clock_adjtime();
-int sys_clock_gettime();
-int sys_clock_nanosleep();
-int sys_clock_settime();
-int sys_clone();
-int sys_close();
-int sys_connect();
-int sys_creat();
-int sys_create_module();
-int sys_delete_module();
-int sys_dup();
-int sys_dup2();
-int sys_dup3();
-int sys_epoll_create();
-int sys_epoll_create1();
-int sys_epoll_ctl();
-int sys_epoll_pwait();
-int sys_epoll_wait();
-int sys_eventfd();
-int sys_eventfd2();
-int sys_execve();
-int sys_exit();
-int sys_faccessat();
-int sys_fadvise64();
-int sys_fadvise64_64();
-int sys_fallocate();
-int sys_fanotify_init();
-int sys_fanotify_mark();
-int sys_fchmod();
-int sys_fchmodat();
-int sys_fchown();
-int sys_fchownat();
-int sys_fcntl();
-int sys_fgetxattr();
-int sys_finit_module();
-int sys_flistxattr();
-int sys_flock();
-int sys_fork();
-int sys_fremovexattr();
-int sys_fsetxattr();
-int sys_fstat();
-int sys_fstat64();
-int sys_fstatfs();
-int sys_fstatfs64();
-int sys_ftruncate();
-int sys_ftruncate64();
-int sys_futex();
-int sys_futimesat();
-int sys_get_mempolicy();
-int sys_get_robust_list();
-int sys_get_thread_area();
-int sys_getcpu();
-int sys_getcwd();
-int sys_getdents();
-int sys_getdents64();
-int sys_getdtablesize();
-int sys_getgroups();
-int sys_gethostname();
-int sys_getitimer();
-int sys_getpmsg(); /* TODO: non-Linux, remove? */
-int sys_getpriority();
-int sys_getrandom();
-int sys_getresuid();
-int sys_getrlimit();
-int sys_getrusage();
-int sys_getsockname();
-int sys_getsockopt();
-int sys_gettimeofday();
-int sys_getuid();
-int sys_getxattr();
-int sys_init_module();
-int sys_inotify_add_watch();
-int sys_inotify_init1();
-int sys_inotify_rm_watch();
-int sys_io_cancel();
-int sys_io_destroy();
-int sys_io_getevents();
-int sys_io_setup();
-int sys_io_submit();
-int sys_ioctl();
-int sys_ioprio_get();
-int sys_ioprio_set();
-int sys_ipc();
-int sys_keyctl();
-int sys_kexec_load();
-int sys_kill();
-int sys_link();
-int sys_linkat();
-int sys_listen();
-int sys_listxattr();
-int sys_llseek();
-int sys_lseek();
-int sys_madvise();
-int sys_mbind();
-int sys_migrate_pages();
-int sys_mincore();
-int sys_mknod();
-int sys_mknodat();
-int sys_mlockall();
-int sys_mmap();
-int sys_mmap_pgoff();
-int sys_mmap_4koff();
-int sys_modify_ldt();
-int sys_mount();
-int sys_move_pages();
-int sys_mprotect();
-int sys_mq_getsetattr();
-int sys_mq_notify();
-int sys_mq_open();
-int sys_mq_timedreceive();
-int sys_mq_timedsend();
-int sys_mremap();
-int sys_msgctl();
-int sys_msgget();
-int sys_msgrcv();
-int sys_msgsnd();
-int sys_msync();
-int sys_munmap();
-int sys_nanosleep();
-int sys_newfstatat();
-int sys_old_mmap();
-int sys_old_mmap_pgoff();
-int sys_oldfstat();
-int sys_oldselect();
-int sys_oldstat();
-int sys_open();
-int sys_openat();
-int sys_perf_event_open();
-int sys_personality();
-int sys_pipe();
-int sys_pipe2();
-int sys_poll();
-int sys_poll();
-int sys_ppoll();
-int sys_prctl();
-int sys_pread();
-int sys_preadv();
-int sys_prlimit64();
-int sys_process_vm_readv();
-int sys_process_vm_writev();
-int sys_pselect6();
-int sys_ptrace();
-int sys_putpmsg(); /* TODO: non-Linux, remove? */
-int sys_pwrite();
-int sys_pwritev();
-int sys_query_module();
-int sys_quotactl();
-int sys_read();
-int sys_readahead();
-int sys_readdir();
-int sys_readlink();
-int sys_readlinkat();
-int sys_readv();
-int sys_reboot();
-int sys_recv();
-int sys_recvfrom();
-int sys_recvmmsg();
-int sys_recvmsg();
-int sys_remap_file_pages();
-int sys_removexattr();
-int sys_renameat();
-int sys_renameat2();
-int sys_request_key();
-int sys_restart_syscall();
-int sys_rt_sigaction();
-int sys_rt_sigpending();
-int sys_rt_sigprocmask();
-int sys_rt_sigqueueinfo();
-int sys_rt_sigsuspend();
-int sys_rt_sigtimedwait();
-int sys_rt_tgsigqueueinfo();
-int sys_sched_get_priority_min();
-int sys_sched_getaffinity();
-int sys_sched_getparam();
-int sys_sched_getscheduler();
-int sys_sched_rr_get_interval();
-int sys_sched_setaffinity();
-int sys_sched_setparam();
-int sys_sched_setscheduler();
-int sys_seccomp();
-int sys_select();
-int sys_semctl();
-int sys_semget();
-int sys_semop();
-int sys_semtimedop();
-int sys_send();
-int sys_sendfile();
-int sys_sendfile64();
-int sys_sendmmsg();
-int sys_sendmsg();
-int sys_sendto();
-int sys_set_mempolicy();
-int sys_set_thread_area();
-int sys_setfsuid();
-int sys_setgroups();
-int sys_sethostname();
-int sys_setitimer();
-int sys_setns();
-int sys_setpriority();
-int sys_setresuid();
-int sys_setreuid();
-int sys_setrlimit();
-int sys_setsockopt();
-int sys_settimeofday();
-int sys_setuid();
-int sys_setxattr();
-int sys_shmat();
-int sys_shmctl();
-int sys_shmdt();
-int sys_shmget();
-int sys_shutdown();
-int sys_sigaction();
-int sys_sigaltstack();
-int sys_siggetmask();
-int sys_signal();
-int sys_signalfd();
-int sys_signalfd4();
-int sys_sigpending();
-int sys_sigprocmask();
-int sys_sigreturn();
-int sys_sigsetmask();
-int sys_sigsuspend();
-int sys_socket();
-int sys_socketcall();
-int sys_socketpair();
-int sys_splice();
-int sys_stat();
-int sys_stat64();
-int sys_statfs();
-int sys_statfs64();
-int sys_swapon();
-int sys_symlinkat();
-int sys_sync_file_range();
-int sys_sync_file_range2();
-int sys_sysctl();
-int sys_sysinfo();
-int sys_syslog();
-int sys_tee();
-int sys_tgkill();
-int sys_time();
-int sys_timer_create();
-int sys_timer_gettime();
-int sys_timer_settime();
-int sys_timerfd();
-int sys_timerfd_create();
-int sys_timerfd_gettime();
-int sys_timerfd_settime();
-int sys_times();
-int sys_truncate();
-int sys_truncate64();
-int sys_umask();
-int sys_umount2();
-int sys_uname();
-int sys_unlinkat();
-int sys_unshare();
-int sys_utime();
-int sys_utimensat();
-int sys_utimes();
-int sys_vmsplice();
-int sys_wait4();
-int sys_waitid();
-int sys_waitpid();
-int sys_write();
-int sys_writev();
-
-/* architecture-specific calls */
-#ifdef ALPHA
-int osf_statfs();
-int osf_fstatfs();
-int sys_osf_getitimer();
-int sys_osf_getrusage();
-int sys_osf_gettimeofday();
-int sys_osf_select();
-int sys_osf_setitimer();
-int sys_osf_settimeofday();
-int sys_osf_utimes();
-int sys_osf_wait4();
-#endif
-
-#if defined(ALPHA) || defined(IA64) || defined(SPARC) || defined(SPARC64)
-int sys_getpagesize();
-#endif
-
-#ifdef MIPS
-int sys_sysmips();
-#endif
-
-#if defined M68K || defined SH
-int sys_cacheflush();
-#endif
-
-#if defined OR1K
-int sys_or1k_atomic();
-#endif
-
-#ifdef POWERPC
-int sys_subpage_prot();
-#endif
-
-#ifdef BFIN
-int sys_cacheflush();
-int sys_sram_alloc();
-#endif
-
-#if defined SPARC || defined SPARC64
-int sys_execv();
-int sys_getmsg();
-int sys_putmsg();
-#endif
+#include "sys_func.h"
 
 #if NEED_UID16_PARSERS
-int sys_chown16();
-int sys_fchown16();
-int sys_getgroups16();
-int sys_getresuid16();
-int sys_getuid16();
-int sys_setfsuid16();
-int sys_setgroups16();
-int sys_setresuid16();
-int sys_setreuid16();
-int sys_setuid16();
+extern SYS_FUNC(chown16);
+extern SYS_FUNC(fchown16);
+extern SYS_FUNC(getgroups16);
+extern SYS_FUNC(getresuid16);
+extern SYS_FUNC(getuid16);
+extern SYS_FUNC(setfsuid16);
+extern SYS_FUNC(setgroups16);
+extern SYS_FUNC(setresuid16);
+extern SYS_FUNC(setreuid16);
+extern SYS_FUNC(setuid16);
 #endif
diff --git a/lseek.c b/lseek.c
index 7a0a501..74441ed 100644
--- a/lseek.c
+++ b/lseek.c
@@ -10,8 +10,7 @@
  * Use test/x32_lseek.c to test lseek decoding.
  */
 #if defined(LINUX_MIPSN32) || defined(X32)
-int
-sys_lseek(struct tcb *tcp)
+SYS_FUNC(lseek)
 {
 	long long offset;
 	int whence;
@@ -29,8 +28,7 @@
 	return RVAL_LUDECIMAL;
 }
 #else
-int
-sys_lseek(struct tcb *tcp)
+SYS_FUNC(lseek)
 {
 	long offset;
 	int whence;
@@ -62,8 +60,7 @@
  * for hi and lo. We would need to use tcp->ext_arg[N] on x32...
  * ...however, x32 (and x86_64) does not _have_ llseek syscall as such.
  */
-int
-sys_llseek(struct tcb *tcp)
+SYS_FUNC(llseek)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
diff --git a/mem.c b/mem.c
index 4082658..322b7eb 100644
--- a/mem.c
+++ b/mem.c
@@ -44,8 +44,7 @@
 	return pagesize;
 }
 
-int
-sys_brk(struct tcb *tcp)
+SYS_FUNC(brk)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx", tcp->u_arg[0]);
@@ -95,8 +94,7 @@
  */
 
 /* Params are pointed to by u_arg[0], offset is in bytes */
-int
-sys_old_mmap(struct tcb *tcp)
+SYS_FUNC(old_mmap)
 {
 	long u_arg[6];
 #if defined(IA64)
@@ -127,8 +125,7 @@
 
 #if defined(S390)
 /* Params are pointed to by u_arg[0], offset is in pages */
-int
-sys_old_mmap_pgoff(struct tcb *tcp)
+SYS_FUNC(old_mmap_pgoff)
 {
 	long u_arg[5];
 	int i;
@@ -145,8 +142,7 @@
 #endif
 
 /* Params are passed directly, offset is in bytes */
-int
-sys_mmap(struct tcb *tcp)
+SYS_FUNC(mmap)
 {
 	unsigned long long offset = (unsigned long) tcp->u_arg[5];
 #if defined(LINUX_MIPSN32) || defined(X32)
@@ -162,8 +158,7 @@
 }
 
 /* Params are passed directly, offset is in pages */
-int
-sys_mmap_pgoff(struct tcb *tcp)
+SYS_FUNC(mmap_pgoff)
 {
 	/* Try test/mmap_offset_decode.c */
 	unsigned long long offset;
@@ -173,8 +168,7 @@
 }
 
 /* Params are passed directly, offset is in 4k units */
-int
-sys_mmap_4koff(struct tcb *tcp)
+SYS_FUNC(mmap_4koff)
 {
 	unsigned long long offset;
 	offset = (unsigned long) tcp->u_arg[5];
@@ -182,8 +176,7 @@
 	return print_mmap(tcp, tcp->u_arg, offset);
 }
 
-int
-sys_munmap(struct tcb *tcp)
+SYS_FUNC(munmap)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu",
@@ -192,8 +185,7 @@
 	return 0;
 }
 
-int
-sys_mprotect(struct tcb *tcp)
+SYS_FUNC(mprotect)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, ",
@@ -205,8 +197,7 @@
 
 #include "xlat/mremap_flags.h"
 
-int
-sys_mremap(struct tcb *tcp)
+SYS_FUNC(mremap)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1],
@@ -223,8 +214,7 @@
 
 #include "xlat/madvise_cmds.h"
 
-int
-sys_madvise(struct tcb *tcp)
+SYS_FUNC(madvise)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -235,8 +225,7 @@
 
 #include "xlat/mlockall_flags.h"
 
-int
-sys_mlockall(struct tcb *tcp)
+SYS_FUNC(mlockall)
 {
 	if (entering(tcp)) {
 		printflags(mlockall_flags, tcp->u_arg[0], "MCL_???");
@@ -246,8 +235,7 @@
 
 #include "xlat/mctl_sync.h"
 
-int
-sys_msync(struct tcb *tcp)
+SYS_FUNC(msync)
 {
 	if (entering(tcp)) {
 		/* addr */
@@ -260,8 +248,7 @@
 	return 0;
 }
 
-int
-sys_mincore(struct tcb *tcp)
+SYS_FUNC(mincore)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -291,8 +278,7 @@
 }
 
 #if defined(ALPHA) || defined(IA64) || defined(SPARC) || defined(SPARC64)
-int
-sys_getpagesize(struct tcb *tcp)
+SYS_FUNC(getpagesize)
 {
 	if (exiting(tcp))
 		return RVAL_HEX;
@@ -300,8 +286,7 @@
 }
 #endif
 
-int
-sys_remap_file_pages(struct tcb *tcp)
+SYS_FUNC(remap_file_pages)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -377,8 +362,7 @@
 	tprintf(", %lu", maxnodes);
 }
 
-int
-sys_mbind(struct tcb *tcp)
+SYS_FUNC(mbind)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -390,8 +374,7 @@
 	return 0;
 }
 
-int
-sys_set_mempolicy(struct tcb *tcp)
+SYS_FUNC(set_mempolicy)
 {
 	if (entering(tcp)) {
 		printxval(policies, tcp->u_arg[0], "MPOL_???");
@@ -400,8 +383,7 @@
 	return 0;
 }
 
-int
-sys_get_mempolicy(struct tcb *tcp)
+SYS_FUNC(get_mempolicy)
 {
 	if (exiting(tcp)) {
 		int pol;
@@ -418,8 +400,7 @@
 	return 0;
 }
 
-int
-sys_migrate_pages(struct tcb *tcp)
+SYS_FUNC(migrate_pages)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
@@ -430,8 +411,7 @@
 	return 0;
 }
 
-int
-sys_move_pages(struct tcb *tcp)
+SYS_FUNC(move_pages)
 {
 	if (entering(tcp)) {
 		unsigned long npages = tcp->u_arg[1];
@@ -502,8 +482,7 @@
 }
 
 #if defined(POWERPC)
-int
-sys_subpage_prot(struct tcb *tcp)
+SYS_FUNC(subpage_prot)
 {
 	if (entering(tcp)) {
 		unsigned long cur, end, abbrev_end, entries;
diff --git a/mknod.c b/mknod.c
index 1463232..dbca736 100644
--- a/mknod.c
+++ b/mknod.c
@@ -40,14 +40,12 @@
 	return 0;
 }
 
-int
-sys_mknod(struct tcb *tcp)
+SYS_FUNC(mknod)
 {
 	return decode_mknod(tcp, 0);
 }
 
-int
-sys_mknodat(struct tcb *tcp)
+SYS_FUNC(mknodat)
 {
 	if (entering(tcp))
 		print_dirfd(tcp, tcp->u_arg[0]);
@@ -55,8 +53,7 @@
 }
 
 #if defined(SPARC) || defined(SPARC64)
-int
-sys_xmknod(struct tcb *tcp)
+SYS_FUNC(xmknod)
 {
 	int mode = tcp->u_arg[2];
 
diff --git a/mount.c b/mount.c
index f6c8f75..7b30b37 100644
--- a/mount.c
+++ b/mount.c
@@ -32,8 +32,7 @@
 
 #include "xlat/mount_flags.h"
 
-int
-sys_mount(struct tcb *tcp)
+SYS_FUNC(mount)
 {
 	if (entering(tcp)) {
 		int ignore_type = 0, ignore_data = 0;
diff --git a/net.c b/net.c
index 58c54c8..2ed950d 100644
--- a/net.c
+++ b/net.c
@@ -729,8 +729,7 @@
 	printflags(sock_type_flags, flags, "SOCK_???");
 }
 
-int
-sys_socket(struct tcb *tcp)
+SYS_FUNC(socket)
 {
 	if (entering(tcp)) {
 		printxval(domains, tcp->u_arg[0], "PF_???");
@@ -770,8 +769,7 @@
 	return 0;
 }
 
-int
-sys_bind(struct tcb *tcp)
+SYS_FUNC(bind)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -782,14 +780,12 @@
 	return 0;
 }
 
-int
-sys_connect(struct tcb *tcp)
+SYS_FUNC(connect)
 {
 	return sys_bind(tcp);
 }
 
-int
-sys_listen(struct tcb *tcp)
+SYS_FUNC(listen)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -828,22 +824,19 @@
 	return 0;
 }
 
-int
-sys_accept(struct tcb *tcp)
+SYS_FUNC(accept)
 {
 	do_sockname(tcp, -1);
 	return RVAL_FD;
 }
 
-int
-sys_accept4(struct tcb *tcp)
+SYS_FUNC(accept4)
 {
 	do_sockname(tcp, 3);
 	return RVAL_FD;
 }
 
-int
-sys_send(struct tcb *tcp)
+SYS_FUNC(send)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -856,8 +849,7 @@
 	return 0;
 }
 
-int
-sys_sendto(struct tcb *tcp)
+SYS_FUNC(sendto)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -877,8 +869,7 @@
 
 #ifdef HAVE_SENDMSG
 
-int
-sys_sendmsg(struct tcb *tcp)
+SYS_FUNC(sendmsg)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -891,8 +882,7 @@
 	return 0;
 }
 
-int
-sys_sendmmsg(struct tcb *tcp)
+SYS_FUNC(sendmmsg)
 {
 	if (entering(tcp)) {
 		/* sockfd */
@@ -912,8 +902,7 @@
 
 #endif /* HAVE_SENDMSG */
 
-int
-sys_recv(struct tcb *tcp)
+SYS_FUNC(recv)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -930,8 +919,7 @@
 	return 0;
 }
 
-int
-sys_recvfrom(struct tcb *tcp)
+SYS_FUNC(recvfrom)
 {
 	int fromlen;
 
@@ -977,8 +965,7 @@
 
 #ifdef HAVE_SENDMSG
 
-int
-sys_recvmsg(struct tcb *tcp)
+SYS_FUNC(recvmsg)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -995,8 +982,7 @@
 	return 0;
 }
 
-int
-sys_recvmmsg(struct tcb *tcp)
+SYS_FUNC(recvmmsg)
 {
 	/* +5 chars are for "left " prefix */
 	static char str[5 + TIMESPEC_TEXT_BUFSIZE];
@@ -1044,8 +1030,7 @@
 
 #include "xlat/shutdown_modes.h"
 
-int
-sys_shutdown(struct tcb *tcp)
+SYS_FUNC(shutdown)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -1055,8 +1040,7 @@
 	return 0;
 }
 
-int
-sys_getsockname(struct tcb *tcp)
+SYS_FUNC(getsockname)
 {
 	return do_sockname(tcp, -1);
 }
@@ -1090,20 +1074,17 @@
 	return 0;
 }
 
-int
-sys_pipe(struct tcb *tcp)
+SYS_FUNC(pipe)
 {
 	return do_pipe(tcp, -1);
 }
 
-int
-sys_pipe2(struct tcb *tcp)
+SYS_FUNC(pipe2)
 {
 	return do_pipe(tcp, 1);
 }
 
-int
-sys_socketpair(struct tcb *tcp)
+SYS_FUNC(socketpair)
 {
 	int fds[2];
 
@@ -1306,8 +1287,7 @@
 	tprintf(", [%d]", len);
 }
 
-int
-sys_getsockopt(struct tcb *tcp)
+SYS_FUNC(getsockopt)
 {
 	if (entering(tcp)) {
 		print_sockopt_fd_level_name(tcp, tcp->u_arg[0],
@@ -1493,8 +1473,7 @@
 	tprintf(", %d", len);
 }
 
-int
-sys_setsockopt(struct tcb *tcp)
+SYS_FUNC(setsockopt)
 {
 	if (entering(tcp)) {
 		print_sockopt_fd_level_name(tcp, tcp->u_arg[0],
diff --git a/open.c b/open.c
index 5d82981..4a70d89 100644
--- a/open.c
+++ b/open.c
@@ -97,22 +97,19 @@
 	return RVAL_FD;
 }
 
-int
-sys_open(struct tcb *tcp)
+SYS_FUNC(open)
 {
 	return decode_open(tcp, 0);
 }
 
-int
-sys_openat(struct tcb *tcp)
+SYS_FUNC(openat)
 {
 	if (entering(tcp))
 		print_dirfd(tcp, tcp->u_arg[0]);
 	return decode_open(tcp, 1);
 }
 
-int
-sys_creat(struct tcb *tcp)
+SYS_FUNC(creat)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
diff --git a/or1k_atomic.c b/or1k_atomic.c
index 1b60272..05509a7 100644
--- a/or1k_atomic.c
+++ b/or1k_atomic.c
@@ -14,7 +14,7 @@
 
 #include "xlat/atomic_ops.h"
 
-int sys_or1k_atomic(struct tcb *tcp)
+SYS_FUNC(or1k_atomic)
 {
 	if (entering(tcp)) {
 		printxval(atomic_ops, tcp->u_arg[0], "???");
diff --git a/personality.c b/personality.c
index a90d7dd..98b8bba 100644
--- a/personality.c
+++ b/personality.c
@@ -4,8 +4,7 @@
 
 #include "xlat/personality_options.h"
 
-int
-sys_personality(struct tcb *tcp)
+SYS_FUNC(personality)
 {
 	if (entering(tcp))
 		printxval(personality_options, tcp->u_arg[0], "PER_???");
diff --git a/prctl.c b/prctl.c
index 0ec0fc8..4a6bd25 100644
--- a/prctl.c
+++ b/prctl.c
@@ -281,8 +281,7 @@
 	return 0;
 }
 
-int
-sys_prctl(struct tcb *tcp)
+SYS_FUNC(prctl)
 {
 	return entering(tcp) ? prctl_enter(tcp) : prctl_exit(tcp);
 }
@@ -291,8 +290,7 @@
 # include <asm/prctl.h>
 # include "xlat/archvals.h"
 
-int
-sys_arch_prctl(struct tcb *tcp)
+SYS_FUNC(arch_prctl)
 {
 	if (entering(tcp))
 		printxval(archvals, tcp->u_arg[0], "ARCH_???");
diff --git a/process.c b/process.c
index 690ca8e..73092a2 100644
--- a/process.c
+++ b/process.c
@@ -55,8 +55,7 @@
 	XLAT_END
 };
 
-int
-sys_ptrace(struct tcb *tcp)
+SYS_FUNC(ptrace)
 {
 	const struct xlat *x;
 	unsigned long addr;
diff --git a/process_vm.c b/process_vm.c
index 02058a5..310223e 100644
--- a/process_vm.c
+++ b/process_vm.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_process_vm_readv(struct tcb *tcp)
+SYS_FUNC(process_vm_readv)
 {
 	if (entering(tcp)) {
 		/* arg 1: pid */
@@ -28,8 +27,7 @@
 	return 0;
 }
 
-int
-sys_process_vm_writev(struct tcb *tcp)
+SYS_FUNC(process_vm_writev)
 {
 	if (entering(tcp)) {
 		/* arg 1: pid */
diff --git a/quota.c b/quota.c
index f9a1bc5..fd0ae02 100644
--- a/quota.c
+++ b/quota.c
@@ -524,8 +524,7 @@
 	}
 }
 
-int
-sys_quotactl(struct tcb *tcp)
+SYS_FUNC(quotactl)
 {
 	/*
 	 * The Linux kernel only looks at the low 32 bits of command and id
diff --git a/readahead.c b/readahead.c
index 8f47988..a34b60d 100644
--- a/readahead.c
+++ b/readahead.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_readahead(struct tcb *tcp)
+SYS_FUNC(readahead)
 {
 	if (entering(tcp)) {
 		int argn;
diff --git a/readlink.c b/readlink.c
index efa8e9f..fcb4153 100644
--- a/readlink.c
+++ b/readlink.c
@@ -23,14 +23,12 @@
 	return 0;
 }
 
-int
-sys_readlink(struct tcb *tcp)
+SYS_FUNC(readlink)
 {
 	return decode_readlink(tcp, 0);
 }
 
-int
-sys_readlinkat(struct tcb *tcp)
+SYS_FUNC(readlinkat)
 {
 	if (entering(tcp))
 		print_dirfd(tcp, tcp->u_arg[0]);
diff --git a/reboot.c b/reboot.c
index 5c4752d..2d11851 100644
--- a/reboot.c
+++ b/reboot.c
@@ -4,8 +4,7 @@
 #include "xlat/bootflags2.h"
 #include "xlat/bootflags3.h"
 
-int
-sys_reboot(struct tcb *tcp)
+SYS_FUNC(reboot)
 {
 	if (exiting(tcp))
 		return 0;
diff --git a/renameat.c b/renameat.c
index 1c02551..ac8d202 100644
--- a/renameat.c
+++ b/renameat.c
@@ -10,8 +10,7 @@
 	printpath(tcp, tcp->u_arg[3]);
 }
 
-int
-sys_renameat(struct tcb *tcp)
+SYS_FUNC(renameat)
 {
 	if (entering(tcp)) {
 		decode_renameat(tcp);
@@ -22,8 +21,7 @@
 #include <linux/fs.h>
 #include "xlat/rename_flags.h"
 
-int
-sys_renameat2(struct tcb *tcp)
+SYS_FUNC(renameat2)
 {
 	if (entering(tcp)) {
 		decode_renameat(tcp);
diff --git a/resource.c b/resource.c
index 57ce17e..687f8d8 100644
--- a/resource.c
+++ b/resource.c
@@ -142,8 +142,7 @@
 
 #endif
 
-int
-sys_getrlimit(struct tcb *tcp)
+SYS_FUNC(getrlimit)
 {
 	if (entering(tcp)) {
 		printxval(resources, tcp->u_arg[0], "RLIMIT_???");
@@ -155,8 +154,7 @@
 	return 0;
 }
 
-int
-sys_setrlimit(struct tcb *tcp)
+SYS_FUNC(setrlimit)
 {
 	if (entering(tcp)) {
 		printxval(resources, tcp->u_arg[0], "RLIMIT_???");
@@ -166,8 +164,7 @@
 	return 0;
 }
 
-int
-sys_prlimit64(struct tcb *tcp)
+SYS_FUNC(prlimit64)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", tcp->u_arg[0]);
@@ -276,8 +273,7 @@
 	}
 }
 
-int
-sys_getrusage(struct tcb *tcp)
+SYS_FUNC(getrusage)
 {
 	if (entering(tcp)) {
 		printxval(usagewho, tcp->u_arg[0], "RUSAGE_???");
@@ -289,8 +285,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_getrusage(struct tcb *tcp)
+SYS_FUNC(osf_getrusage)
 {
 	if (entering(tcp)) {
 		printxval(usagewho, tcp->u_arg[0], "RUSAGE_???");
@@ -304,8 +299,7 @@
 
 #include "xlat/priorities.h"
 
-int
-sys_getpriority(struct tcb *tcp)
+SYS_FUNC(getpriority)
 {
 	if (entering(tcp)) {
 		printxval(priorities, tcp->u_arg[0], "PRIO_???");
@@ -314,8 +308,7 @@
 	return 0;
 }
 
-int
-sys_setpriority(struct tcb *tcp)
+SYS_FUNC(setpriority)
 {
 	if (entering(tcp)) {
 		printxval(priorities, tcp->u_arg[0], "PRIO_???");
@@ -324,8 +317,7 @@
 	return 0;
 }
 
-int
-sys_times(struct tcb *tcp)
+SYS_FUNC(times)
 {
 	struct tms tbuf;
 
diff --git a/sched.c b/sched.c
index d3192fa..8bb7c25 100644
--- a/sched.c
+++ b/sched.c
@@ -4,8 +4,7 @@
 
 #include "xlat/schedulers.h"
 
-int
-sys_sched_getscheduler(struct tcb *tcp)
+SYS_FUNC(sched_getscheduler)
 {
 	if (entering(tcp)) {
 		tprintf("%d", (int) tcp->u_arg[0]);
@@ -17,8 +16,7 @@
 	return 0;
 }
 
-int
-sys_sched_setscheduler(struct tcb *tcp)
+SYS_FUNC(sched_setscheduler)
 {
 	if (entering(tcp)) {
 		struct sched_param p;
@@ -32,8 +30,7 @@
 	return 0;
 }
 
-int
-sys_sched_getparam(struct tcb *tcp)
+SYS_FUNC(sched_getparam)
 {
 	if (entering(tcp)) {
 		tprintf("%d, ", (int) tcp->u_arg[0]);
@@ -47,8 +44,7 @@
 	return 0;
 }
 
-int
-sys_sched_setparam(struct tcb *tcp)
+SYS_FUNC(sched_setparam)
 {
 	if (entering(tcp)) {
 		struct sched_param p;
@@ -60,8 +56,7 @@
 	return 0;
 }
 
-int
-sys_sched_get_priority_min(struct tcb *tcp)
+SYS_FUNC(sched_get_priority_min)
 {
 	if (entering(tcp)) {
 		printxval(schedulers, tcp->u_arg[0], "SCHED_???");
@@ -69,8 +64,7 @@
 	return 0;
 }
 
-int
-sys_sched_rr_get_interval(struct tcb *tcp)
+SYS_FUNC(sched_rr_get_interval)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
diff --git a/seccomp.c b/seccomp.c
index 9939c11..09c6bba 100644
--- a/seccomp.c
+++ b/seccomp.c
@@ -230,8 +230,7 @@
 		tprints("NULL");
 }
 
-int
-sys_seccomp(struct tcb *tcp)
+SYS_FUNC(seccomp)
 {
 	if (entering(tcp)) {
 		unsigned int op = tcp->u_arg[0];
diff --git a/sigaltstack.c b/sigaltstack.c
index feba59b..b3b834f 100644
--- a/sigaltstack.c
+++ b/sigaltstack.c
@@ -40,8 +40,7 @@
 	}
 }
 
-int
-sys_sigaltstack(struct tcb *tcp)
+SYS_FUNC(sigaltstack)
 {
 	if (entering(tcp)) {
 		print_stack_t(tcp, tcp->u_arg[0]);
diff --git a/signal.c b/signal.c
index 0b52ddb..c9e7518 100644
--- a/signal.c
+++ b/signal.c
@@ -249,8 +249,7 @@
 	tprints(sprintsigmask_n("", mask, len));
 }
 
-int
-sys_sigsetmask(struct tcb *tcp)
+SYS_FUNC(sigsetmask)
 {
 	if (entering(tcp)) {
 		tprintsigmask_val("", tcp->u_arg[0]);
@@ -359,8 +358,7 @@
 	tprints("}");
 }
 
-int
-sys_sigaction(struct tcb *tcp)
+SYS_FUNC(sigaction)
 {
 	if (entering(tcp)) {
 		printsignal(tcp->u_arg[0]);
@@ -372,8 +370,7 @@
 	return 0;
 }
 
-int
-sys_signal(struct tcb *tcp)
+SYS_FUNC(signal)
 {
 	if (entering(tcp)) {
 		printsignal(tcp->u_arg[0]);
@@ -411,8 +408,7 @@
 
 #endif /* HAVE_SIGACTION */
 
-int
-sys_siggetmask(struct tcb *tcp)
+SYS_FUNC(siggetmask)
 {
 	if (exiting(tcp)) {
 		tcp->auxstr = sprintsigmask_val("mask ", tcp->u_rval);
@@ -420,8 +416,7 @@
 	return RVAL_HEX | RVAL_STR;
 }
 
-int
-sys_sigsuspend(struct tcb *tcp)
+SYS_FUNC(sigsuspend)
 {
 	if (entering(tcp)) {
 		tprintsigmask_val("", tcp->u_arg[2]);
@@ -432,8 +427,7 @@
 #ifdef HAVE_SIGACTION
 
 /* "Old" sigprocmask, which operates with word-sized signal masks */
-int
-sys_sigprocmask(struct tcb *tcp)
+SYS_FUNC(sigprocmask)
 {
 # ifdef ALPHA
 	if (entering(tcp)) {
@@ -474,8 +468,7 @@
 
 #endif /* HAVE_SIGACTION */
 
-int
-sys_kill(struct tcb *tcp)
+SYS_FUNC(kill)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, %s",
@@ -486,8 +479,7 @@
 	return 0;
 }
 
-int
-sys_tgkill(struct tcb *tcp)
+SYS_FUNC(tgkill)
 {
 	if (entering(tcp)) {
 		tprintf("%ld, %ld, %s",
@@ -499,8 +491,7 @@
 	return 0;
 }
 
-int
-sys_sigpending(struct tcb *tcp)
+SYS_FUNC(sigpending)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp))
@@ -511,8 +502,7 @@
 	return 0;
 }
 
-int
-sys_rt_sigprocmask(struct tcb *tcp)
+SYS_FUNC(rt_sigprocmask)
 {
 	/* Note: arg[3] is the length of the sigset. Kernel requires NSIG / 8 */
 	if (entering(tcp)) {
@@ -637,8 +627,7 @@
 	tprints("}");
 }
 
-int
-sys_rt_sigaction(struct tcb *tcp)
+SYS_FUNC(rt_sigaction)
 {
 	if (entering(tcp)) {
 		printsignal(tcp->u_arg[0]);
@@ -658,8 +647,7 @@
 	return 0;
 }
 
-int
-sys_rt_sigpending(struct tcb *tcp)
+SYS_FUNC(rt_sigpending)
 {
 	if (exiting(tcp)) {
 		/*
@@ -677,8 +665,7 @@
 	return 0;
 }
 
-int
-sys_rt_sigsuspend(struct tcb *tcp)
+SYS_FUNC(rt_sigsuspend)
 {
 	if (entering(tcp)) {
 		/* NB: kernel requires arg[1] == NSIG / 8 */
@@ -696,8 +683,7 @@
 	printsiginfo_at(tcp, uinfo);
 }
 
-int
-sys_rt_sigqueueinfo(struct tcb *tcp)
+SYS_FUNC(rt_sigqueueinfo)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, ", tcp->u_arg[0]);
@@ -706,8 +692,7 @@
 	return 0;
 }
 
-int
-sys_rt_tgsigqueueinfo(struct tcb *tcp)
+SYS_FUNC(rt_tgsigqueueinfo)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -716,7 +701,7 @@
 	return 0;
 }
 
-int sys_rt_sigtimedwait(struct tcb *tcp)
+SYS_FUNC(rt_sigtimedwait)
 {
 	/* NB: kernel requires arg[3] == NSIG / 8 */
 	if (entering(tcp)) {
@@ -742,8 +727,7 @@
 	return 0;
 };
 
-int
-sys_restart_syscall(struct tcb *tcp)
+SYS_FUNC(restart_syscall)
 {
 	if (entering(tcp)) {
 		tprintf("<... resuming interrupted %s ...>",
@@ -772,14 +756,12 @@
 	return 0;
 }
 
-int
-sys_signalfd(struct tcb *tcp)
+SYS_FUNC(signalfd)
 {
 	return do_signalfd(tcp, -1);
 }
 
-int
-sys_signalfd4(struct tcb *tcp)
+SYS_FUNC(signalfd4)
 {
 	return do_signalfd(tcp, 3);
 }
diff --git a/sigreturn.c b/sigreturn.c
index b3fc038..3909d1d 100644
--- a/sigreturn.c
+++ b/sigreturn.c
@@ -13,8 +13,7 @@
 # error NSIG < 32
 #endif
 
-int
-sys_sigreturn(struct tcb *tcp)
+SYS_FUNC(sigreturn)
 {
 	if (entering(tcp)) {
 #include "arch_sigreturn.c"
diff --git a/sock.c b/sock.c
index dc8febc..48bf74b 100644
--- a/sock.c
+++ b/sock.c
@@ -291,8 +291,7 @@
 	}
 }
 
-int
-sys_socketcall(struct tcb *tcp)
+SYS_FUNC(socketcall)
 {
 	return printargs(tcp);
 }
diff --git a/sram_alloc.c b/sram_alloc.c
index b524c7b..a27941a 100644
--- a/sram_alloc.c
+++ b/sram_alloc.c
@@ -6,8 +6,7 @@
 
 #include "xlat/sram_alloc_flags.h"
 
-int
-sys_sram_alloc(struct tcb *tcp)
+SYS_FUNC(sram_alloc)
 {
 	if (entering(tcp)) {
 		/* size */
diff --git a/statfs.c b/statfs.c
index 6373195..3845c2a 100644
--- a/statfs.c
+++ b/statfs.c
@@ -52,8 +52,7 @@
 	tprints("}");
 }
 
-int
-sys_statfs(struct tcb *tcp)
+SYS_FUNC(statfs)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -64,8 +63,7 @@
 	return 0;
 }
 
-int
-sys_fstatfs(struct tcb *tcp)
+SYS_FUNC(fstatfs)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -181,16 +179,14 @@
 	return 0;
 }
 
-int
-sys_statfs64(struct tcb *tcp)
+SYS_FUNC(statfs64)
 {
 	if (entering(tcp))
 		printpath(tcp, tcp->u_arg[0]);
 	return do_statfs64_fstatfs64(tcp);
 }
 
-int
-sys_fstatfs64(struct tcb *tcp)
+SYS_FUNC(fstatfs64)
 {
 	if (entering(tcp))
 		printfd(tcp, tcp->u_arg[0]);
@@ -199,8 +195,7 @@
 #endif /* HAVE_STRUCT_STATFS64 */
 
 #ifdef ALPHA
-int
-osf_statfs(struct tcb *tcp)
+SYS_FUNC(osf_statfs)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -212,8 +207,7 @@
 	return 0;
 }
 
-int
-osf_fstatfs(struct tcb *tcp)
+SYS_FUNC(osf_fstatfs)
 {
 	if (entering(tcp)) {
 		tprintf("%lu, ", tcp->u_arg[0]);
diff --git a/stream.c b/stream.c
index 3ebbfb7..4d8549b 100644
--- a/stream.c
+++ b/stream.c
@@ -86,8 +86,7 @@
 	tprints(", ");
 }
 
-int
-sys_putmsg(struct tcb *tcp)
+SYS_FUNC(putmsg)
 {
 	int i;
 
@@ -103,8 +102,7 @@
 	return 0;
 }
 
-int
-sys_getmsg(struct tcb *tcp)
+SYS_FUNC(getmsg)
 {
 	int i, flags;
 
@@ -152,8 +150,7 @@
 # if defined SYS_putpmsg || defined SYS_getpmsg
 #include "xlat/pmsgflags.h"
 #  ifdef SYS_putpmsg
-int
-sys_putpmsg(struct tcb *tcp)
+SYS_FUNC(putpmsg)
 {
 	int i;
 
@@ -172,8 +169,7 @@
 }
 #  endif
 #  ifdef SYS_getpmsg
-int
-sys_getpmsg(struct tcb *tcp)
+SYS_FUNC(getpmsg)
 {
 	int i, flags;
 
@@ -363,8 +359,7 @@
 	}
 }
 
-int
-sys_poll(struct tcb *tcp)
+SYS_FUNC(poll)
 {
 	int rc = decode_poll(tcp, 0);
 	if (entering(tcp)) {
@@ -378,8 +373,7 @@
 	return rc;
 }
 
-int
-sys_ppoll(struct tcb *tcp)
+SYS_FUNC(ppoll)
 {
 	int rc = decode_poll(tcp, tcp->u_arg[2]);
 	if (entering(tcp)) {
@@ -393,8 +387,7 @@
 }
 
 #else /* !HAVE_SYS_POLL_H */
-int
-sys_poll(struct tcb *tcp)
+SYS_FUNC(poll)
 {
 	return 0;
 }
diff --git a/swapon.c b/swapon.c
index 8200a9b..4006d96 100644
--- a/swapon.c
+++ b/swapon.c
@@ -17,8 +17,7 @@
 
 #include "xlat/swap_flags.h"
 
-int
-sys_swapon(struct tcb *tcp)
+SYS_FUNC(swapon)
 {
 	if (entering(tcp)) {
 		int flags = tcp->u_arg[1];
diff --git a/sync_file_range.c b/sync_file_range.c
index 4b1977b..5264f15 100644
--- a/sync_file_range.c
+++ b/sync_file_range.c
@@ -4,8 +4,7 @@
 
 #include "xlat/sync_file_range_flags.h"
 
-int
-sys_sync_file_range(struct tcb *tcp)
+SYS_FUNC(sync_file_range)
 {
 	if (entering(tcp)) {
 		int argn;
@@ -18,8 +17,7 @@
 	return 0;
 }
 
-int
-sys_sync_file_range2(struct tcb *tcp)
+SYS_FUNC(sync_file_range2)
 {
 	if (entering(tcp)) {
 		int argn;
diff --git a/syscall.c b/syscall.c
index d54d8b6..1e19eb5 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1264,7 +1264,7 @@
 			.nargs = MAX_ARGS,
 			.sys_flags = 0,
 			.sys_func = printargs,
-			.sys_name = "unknown", /* not used */
+			.sys_name = "system call",
 		};
 		tcp->s_ent = &unknown;
 		tcp->qual_flg = UNDEFINED_SCNO | QUAL_RAW | DEFAULT_QUAL_FLAGS;
diff --git a/sysctl.c b/sysctl.c
index a550eda..03d7b1c 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -14,8 +14,7 @@
 #include "xlat/sysctl_net_ipv6.h"
 #include "xlat/sysctl_net_ipv6_route.h"
 
-int
-sys_sysctl(struct tcb *tcp)
+SYS_FUNC(sysctl)
 {
 	struct __sysctl_args info;
 	int *name;
diff --git a/sysinfo.c b/sysinfo.c
index 21a6246..6f22165 100644
--- a/sysinfo.c
+++ b/sysinfo.c
@@ -1,8 +1,7 @@
 #include "defs.h"
 #include <sys/sysinfo.h>
 
-int
-sys_sysinfo(struct tcb *tcp)
+SYS_FUNC(sysinfo)
 {
 	struct sysinfo si;
 
diff --git a/syslog.c b/syslog.c
index 6e4b1ba..6071ed6 100644
--- a/syslog.c
+++ b/syslog.c
@@ -16,8 +16,7 @@
 
 #include "xlat/syslog_action_type.h"
 
-int
-sys_syslog(struct tcb *tcp)
+SYS_FUNC(syslog)
 {
 	int type = tcp->u_arg[0];
 
diff --git a/sysmips.c b/sysmips.c
index 6728b8a..d7d5455 100644
--- a/sysmips.c
+++ b/sysmips.c
@@ -15,7 +15,7 @@
 
 #include "xlat/sysmips_operations.h"
 
-int sys_sysmips(struct tcb *tcp)
+SYS_FUNC(sysmips)
 {
 	if (entering(tcp)) {
 		printxval(sysmips_operations, tcp->u_arg[0], "???");
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e5dae02..7ace705 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,7 @@
 # Automake input for strace tests.
 
+OS = linux
+ARCH = @arch@
 AM_CFLAGS = $(WARN_CFLAGS)
 AM_CPPFLAGS = -I$(top_builddir)/$(OS)/$(ARCH) \
 	      -I$(top_srcdir)/$(OS)/$(ARCH) \
@@ -91,11 +93,13 @@
 	detach-sleeping.test \
 	detach-stopped.test \
 	detach-running.test \
+	restart_syscall.test \
 	strace-k.test
 
 net-fd.log: net.log
 
-TEST_LOG_COMPILER = $(srcdir)/run.sh
+TEST_LOG_COMPILER = env
+AM_TEST_LOG_FLAGS = STRACE_ARCH=$(ARCH) $(srcdir)/run.sh
 
 EXTRA_DIST = init.sh run.sh match.awk \
 	     caps.awk \
@@ -112,6 +116,8 @@
 	     net-yy-accept.awk \
 	     net-yy-connect.awk \
 	     pipe.expected \
+	     restart_syscall.expected \
+	     restart_syscall_unknown.expected \
 	     select.awk \
 	     sigaction.awk \
 	     statfs.expected \
diff --git a/tests/fanotify_mark.expected b/tests/fanotify_mark.expected
old mode 100755
new mode 100644
diff --git a/tests/ioctl.expected b/tests/ioctl.expected
old mode 100755
new mode 100644
diff --git a/tests/net-fd.expected b/tests/net-fd.expected
old mode 100755
new mode 100644
diff --git a/tests/net.expected b/tests/net.expected
old mode 100755
new mode 100644
diff --git a/tests/restart_syscall.expected b/tests/restart_syscall.expected
new file mode 100644
index 0000000..af9267d
--- /dev/null
+++ b/tests/restart_syscall.expected
@@ -0,0 +1,2 @@
+restart_syscall(<... resuming interrupted nanosleep ...>) = 0
++++ exited with 0 +++
diff --git a/tests/restart_syscall.test b/tests/restart_syscall.test
new file mode 100755
index 0000000..5ae3a1d
--- /dev/null
+++ b/tests/restart_syscall.test
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Check how "resuming interrupted nanosleep" works.
+
+. "${srcdir=.}/init.sh"
+
+check_prog sleep
+check_prog grep
+run_strace -enanosleep sleep 1
+grep nanosleep < "$LOG" > /dev/null ||
+	framework_skip_ 'sleep does not use nanosleep'
+
+./set_ptracer_any sleep 2 &
+sleep 1
+run_strace -q -erestart_syscall -p $!
+
+case "$STRACE_ARCH" in
+	alpha|mips|or1k|s390|s390x)
+		# These architectures use the same register
+		# both for syscall number and syscall return code.
+		match_diff "$LOG" "$srcdir/restart_syscall_unknown.expected"
+		;;
+	*) match_diff
+		;;
+esac
diff --git a/tests/restart_syscall_unknown.expected b/tests/restart_syscall_unknown.expected
new file mode 100644
index 0000000..5f16895
--- /dev/null
+++ b/tests/restart_syscall_unknown.expected
@@ -0,0 +1,2 @@
+restart_syscall(<... resuming interrupted system call ...>) = 0
++++ exited with 0 +++
diff --git a/tests/statfs.expected b/tests/statfs.expected
old mode 100755
new mode 100644
diff --git a/tests/sun_path.expected b/tests/sun_path.expected
old mode 100755
new mode 100644
diff --git a/tests/uio.expected b/tests/uio.expected
old mode 100755
new mode 100644
diff --git a/time.c b/time.c
index 6db3563..b30fd0f 100644
--- a/time.c
+++ b/time.c
@@ -158,8 +158,7 @@
 	}
 }
 
-int
-sys_time(struct tcb *tcp)
+SYS_FUNC(time)
 {
 	if (exiting(tcp)) {
 		printnum_long(tcp, tcp->u_arg[0], "%ld");
@@ -167,8 +166,7 @@
 	return 0;
 }
 
-int
-sys_gettimeofday(struct tcb *tcp)
+SYS_FUNC(gettimeofday)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp)) {
@@ -183,8 +181,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_gettimeofday(struct tcb *tcp)
+SYS_FUNC(osf_gettimeofday)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp)) {
@@ -199,8 +196,7 @@
 }
 #endif
 
-int
-sys_settimeofday(struct tcb *tcp)
+SYS_FUNC(settimeofday)
 {
 	if (entering(tcp)) {
 		printtv(tcp, tcp->u_arg[0]);
@@ -211,8 +207,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_settimeofday(struct tcb *tcp)
+SYS_FUNC(osf_settimeofday)
 {
 	if (entering(tcp)) {
 		printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
@@ -223,8 +218,7 @@
 }
 #endif
 
-int
-sys_adjtime(struct tcb *tcp)
+SYS_FUNC(adjtime)
 {
 	if (entering(tcp)) {
 		printtv(tcp, tcp->u_arg[0]);
@@ -238,8 +232,7 @@
 	return 0;
 }
 
-int
-sys_nanosleep(struct tcb *tcp)
+SYS_FUNC(nanosleep)
 {
 	if (entering(tcp)) {
 		print_timespec(tcp, tcp->u_arg[0]);
@@ -314,8 +307,7 @@
 #define printitv(tcp, addr)	\
 	printitv_bitness((tcp), (addr), BITNESS_CURRENT)
 
-int
-sys_getitimer(struct tcb *tcp)
+SYS_FUNC(getitimer)
 {
 	if (entering(tcp)) {
 		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
@@ -330,8 +322,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_getitimer(struct tcb *tcp)
+SYS_FUNC(osf_getitimer)
 {
 	if (entering(tcp)) {
 		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
@@ -346,8 +337,7 @@
 }
 #endif
 
-int
-sys_setitimer(struct tcb *tcp)
+SYS_FUNC(setitimer)
 {
 	if (entering(tcp)) {
 		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
@@ -364,8 +354,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_setitimer(struct tcb *tcp)
+SYS_FUNC(osf_setitimer)
 {
 	if (entering(tcp)) {
 		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
@@ -496,8 +485,7 @@
 	return 0;
 }
 
-int
-sys_adjtimex(struct tcb *tcp)
+SYS_FUNC(adjtimex)
 {
 	if (exiting(tcp))
 		return do_adjtimex(tcp, tcp->u_arg[0]);
@@ -530,8 +518,7 @@
 		printxval(clocknames, clockid, "CLOCK_???");
 }
 
-int
-sys_clock_settime(struct tcb *tcp)
+SYS_FUNC(clock_settime)
 {
 	if (entering(tcp)) {
 		printclockname(tcp->u_arg[0]);
@@ -541,8 +528,7 @@
 	return 0;
 }
 
-int
-sys_clock_gettime(struct tcb *tcp)
+SYS_FUNC(clock_gettime)
 {
 	if (entering(tcp)) {
 		printclockname(tcp->u_arg[0]);
@@ -556,8 +542,7 @@
 	return 0;
 }
 
-int
-sys_clock_nanosleep(struct tcb *tcp)
+SYS_FUNC(clock_nanosleep)
 {
 	if (entering(tcp)) {
 		printclockname(tcp->u_arg[0]);
@@ -575,8 +560,7 @@
 	return 0;
 }
 
-int
-sys_clock_adjtime(struct tcb *tcp)
+SYS_FUNC(clock_adjtime)
 {
 	if (exiting(tcp))
 		return do_adjtimex(tcp, tcp->u_arg[1]);
@@ -672,8 +656,7 @@
 	}
 }
 
-int
-sys_timer_create(struct tcb *tcp)
+SYS_FUNC(timer_create)
 {
 	if (entering(tcp)) {
 		printclockname(tcp->u_arg[0]);
@@ -691,8 +674,7 @@
 	return 0;
 }
 
-int
-sys_timer_settime(struct tcb *tcp)
+SYS_FUNC(timer_settime)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, ", tcp->u_arg[0]);
@@ -709,8 +691,7 @@
 	return 0;
 }
 
-int
-sys_timer_gettime(struct tcb *tcp)
+SYS_FUNC(timer_gettime)
 {
 	if (entering(tcp)) {
 		tprintf("%#lx, ", tcp->u_arg[0]);
@@ -811,8 +792,7 @@
 
 #include "xlat/timerfdflags.h"
 
-int
-sys_timerfd(struct tcb *tcp)
+SYS_FUNC(timerfd)
 {
 	if (entering(tcp)) {
 		/* It does not matter that the kernel uses itimerspec.  */
@@ -826,8 +806,7 @@
 	return 0;
 }
 
-int
-sys_timerfd_create(struct tcb *tcp)
+SYS_FUNC(timerfd_create)
 {
 	if (entering(tcp)) {
 		printclockname(tcp->u_arg[0]);
@@ -837,8 +816,7 @@
 	return 0;
 }
 
-int
-sys_timerfd_settime(struct tcb *tcp)
+SYS_FUNC(timerfd_settime)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -852,8 +830,7 @@
 	return 0;
 }
 
-int
-sys_timerfd_gettime(struct tcb *tcp)
+SYS_FUNC(timerfd_gettime)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
diff --git a/truncate.c b/truncate.c
index fd1a0db..e7e9968 100644
--- a/truncate.c
+++ b/truncate.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_truncate(struct tcb *tcp)
+SYS_FUNC(truncate)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -10,8 +9,7 @@
 	return 0;
 }
 
-int
-sys_truncate64(struct tcb *tcp)
+SYS_FUNC(truncate64)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -20,8 +18,7 @@
 	return 0;
 }
 
-int
-sys_ftruncate(struct tcb *tcp)
+SYS_FUNC(ftruncate)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -30,8 +27,7 @@
 	return 0;
 }
 
-int
-sys_ftruncate64(struct tcb *tcp)
+SYS_FUNC(ftruncate64)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
diff --git a/uid.c b/uid.c
index 96b3d38..02cd699 100644
--- a/uid.c
+++ b/uid.c
@@ -37,16 +37,14 @@
 # define uid_t_(size)	uid_t__(size)
 # define uid_t__(size)	uint ## size ## _t
 
-int
-sys_getuid(struct tcb *tcp)
+SYS_FUNC(getuid)
 {
 	if (exiting(tcp))
 		tcp->u_rval = (uid_t) tcp->u_rval;
 	return RVAL_UDECIMAL;
 }
 
-int
-sys_setfsuid(struct tcb *tcp)
+SYS_FUNC(setfsuid)
 {
 	if (entering(tcp))
 		tprintf("%u", (uid_t) tcp->u_arg[0]);
@@ -55,8 +53,7 @@
 	return RVAL_UDECIMAL;
 }
 
-int
-sys_setuid(struct tcb *tcp)
+SYS_FUNC(setuid)
 {
 	if (entering(tcp)) {
 		tprintf("%u", (uid_t) tcp->u_arg[0]);
@@ -75,8 +72,7 @@
 		tprintf("%s[%u]", prefix, uid);
 }
 
-int
-sys_getresuid(struct tcb *tcp)
+SYS_FUNC(getresuid)
 {
 	if (exiting(tcp)) {
 		if (syserror(tcp)) {
@@ -91,8 +87,7 @@
 	return 0;
 }
 
-int
-sys_setreuid(struct tcb *tcp)
+SYS_FUNC(setreuid)
 {
 	if (entering(tcp)) {
 		printuid("", tcp->u_arg[0]);
@@ -101,8 +96,7 @@
 	return 0;
 }
 
-int
-sys_setresuid(struct tcb *tcp)
+SYS_FUNC(setresuid)
 {
 	if (entering(tcp)) {
 		printuid("", tcp->u_arg[0]);
@@ -112,8 +106,7 @@
 	return 0;
 }
 
-int
-sys_chown(struct tcb *tcp)
+SYS_FUNC(chown)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -123,8 +116,7 @@
 	return 0;
 }
 
-int
-sys_fchown(struct tcb *tcp)
+SYS_FUNC(fchown)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -143,8 +135,7 @@
 		tprintf("%s%u", text, uid);
 }
 
-int
-sys_setgroups(struct tcb *tcp)
+SYS_FUNC(setgroups)
 {
 	if (entering(tcp)) {
 		unsigned long len, size, start, cur, end, abbrev_end;
@@ -197,8 +188,7 @@
 	return 0;
 }
 
-int
-sys_getgroups(struct tcb *tcp)
+SYS_FUNC(getgroups)
 {
 	unsigned long len;
 
diff --git a/umask.c b/umask.c
index cc00cc6..9b50385 100644
--- a/umask.c
+++ b/umask.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_umask(struct tcb *tcp)
+SYS_FUNC(umask)
 {
 	if (entering(tcp)) {
 		tprintf("%#lo", tcp->u_arg[0]);
diff --git a/umount.c b/umount.c
index ca5037f..b015f83 100644
--- a/umount.c
+++ b/umount.c
@@ -6,8 +6,7 @@
 
 #include "xlat/umount_flags.h"
 
-int
-sys_umount2(struct tcb *tcp)
+SYS_FUNC(umount2)
 {
 	if (entering(tcp)) {
 		printstr(tcp, tcp->u_arg[0], -1);
diff --git a/uname.c b/uname.c
index 74f8efb..0f699d8 100644
--- a/uname.c
+++ b/uname.c
@@ -2,8 +2,7 @@
 
 #include <sys/utsname.h>
 
-int
-sys_uname(struct tcb *tcp)
+SYS_FUNC(uname)
 {
 	struct utsname uname;
 
diff --git a/utime.c b/utime.c
index ba25356..af286a4 100644
--- a/utime.c
+++ b/utime.c
@@ -1,7 +1,6 @@
 #include "defs.h"
 
-int
-sys_utime(struct tcb *tcp)
+SYS_FUNC(utime)
 {
 	union {
 		long utl[2];
diff --git a/utimes.c b/utimes.c
index 40f9566..41fc529 100644
--- a/utimes.c
+++ b/utimes.c
@@ -22,22 +22,19 @@
 	return 0;
 }
 
-int
-sys_utimes(struct tcb *tcp)
+SYS_FUNC(utimes)
 {
 	return decode_utimes(tcp, 0, 0);
 }
 
-int
-sys_futimesat(struct tcb *tcp)
+SYS_FUNC(futimesat)
 {
 	if (entering(tcp))
 		print_dirfd(tcp, tcp->u_arg[0]);
 	return decode_utimes(tcp, 1, 0);
 }
 
-int
-sys_utimensat(struct tcb *tcp)
+SYS_FUNC(utimensat)
 {
 	if (entering(tcp)) {
 		print_dirfd(tcp, tcp->u_arg[0]);
@@ -49,8 +46,7 @@
 }
 
 #ifdef ALPHA
-int
-sys_osf_utimes(struct tcb *tcp)
+SYS_FUNC(osf_utimes)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
diff --git a/wait.c b/wait.c
index 08e3397..d2eb36d 100644
--- a/wait.c
+++ b/wait.c
@@ -139,21 +139,18 @@
 	return 0;
 }
 
-int
-sys_waitpid(struct tcb *tcp)
+SYS_FUNC(waitpid)
 {
 	return printwaitn(tcp, 3, 0);
 }
 
-int
-sys_wait4(struct tcb *tcp)
+SYS_FUNC(wait4)
 {
 	return printwaitn(tcp, 4, 0);
 }
 
 #ifdef ALPHA
-int
-sys_osf_wait4(struct tcb *tcp)
+SYS_FUNC(osf_wait4)
 {
 	return printwaitn(tcp, 4, 1);
 }
@@ -161,8 +158,7 @@
 
 #include "xlat/waitid_types.h"
 
-int
-sys_waitid(struct tcb *tcp)
+SYS_FUNC(waitid)
 {
 	if (entering(tcp)) {
 		printxval(waitid_types, tcp->u_arg[0], "P_???");
diff --git a/xattr.c b/xattr.c
index 60419e9..3b05d38 100644
--- a/xattr.c
+++ b/xattr.c
@@ -54,8 +54,7 @@
 	tprintf(", 0x%lx, %ld", arg, insize);
 }
 
-int
-sys_setxattr(struct tcb *tcp)
+SYS_FUNC(setxattr)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -68,8 +67,7 @@
 	return 0;
 }
 
-int
-sys_fsetxattr(struct tcb *tcp)
+SYS_FUNC(fsetxattr)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -82,8 +80,7 @@
 	return 0;
 }
 
-int
-sys_getxattr(struct tcb *tcp)
+SYS_FUNC(getxattr)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -96,8 +93,7 @@
 	return 0;
 }
 
-int
-sys_fgetxattr(struct tcb *tcp)
+SYS_FUNC(fgetxattr)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -128,8 +124,7 @@
 	tprintf(", %lu", size);
 }
 
-int
-sys_listxattr(struct tcb *tcp)
+SYS_FUNC(listxattr)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -140,8 +135,7 @@
 	return 0;
 }
 
-int
-sys_flistxattr(struct tcb *tcp)
+SYS_FUNC(flistxattr)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);
@@ -152,8 +146,7 @@
 	return 0;
 }
 
-int
-sys_removexattr(struct tcb *tcp)
+SYS_FUNC(removexattr)
 {
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -163,8 +156,7 @@
 	return 0;
 }
 
-int
-sys_fremovexattr(struct tcb *tcp)
+SYS_FUNC(fremovexattr)
 {
 	if (entering(tcp)) {
 		printfd(tcp, tcp->u_arg[0]);