2006-10-13  Ulrich Drepper  <drepper@redhat.com>
	    Bernhard Kaindl <bk@suse.de>
	    Dmitry V. Levin  <ldv@altlinux.org>
	    Michael Holzheu <holzheu@de.ibm.com>

	Add hooks for new syscalls.  Add decoders for *at, inotify*,
	pselect6, ppoll and unshare syscalls.

	* defs.h: Declare print_sigset.
	* desc.c (sys_pselect6): New function.
	* file.c (decode_open, decode_access, decode_mkdir,
	decode_readlink, decode_chmod, decode_utimes, decode_mknod):
	New functions.
	(sys_open, sys_access, sys_mkdir, sys_readlink, sys_chmod,
	sys_utimes, sys_mknod): Use them.
	[LINUX] (fstatatflags, unlinkatflags, inotify_modes): New
	variables.
	[LINUX] (print_dirfd, sys_openat, sys_faccessat,
	sys_newfstatat, sys_mkdirat, sys_linkat, sys_unlinkat,
	sys_symlinkat, sys_readlinkat, sys_renameat, sys_fchownat,
	sys_fchmodat, sys_futimesat, sys_mknodat, sys_inotify_add_watch,
	sys_inotify_rm_watch): New functions.
	* process.c [LINUX] (sys_unshare): New function.
	* signal.c (print_sigset): New function.
	(sys_sigprocmask): Use it.
	* stream.c (decode_poll): New function.
	(sys_poll): Use it.
	[LINUX] (sys_ppoll): New function.
	* linux/syscall.h: Delcare new syscall handlers.
	* linux/syscallent.h: Hook up new syscalls.
	* linux/alpha/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	Fixes RH#178633.
diff --git a/signal.c b/signal.c
index 520562e..fde89f2 100644
--- a/signal.c
+++ b/signal.c
@@ -395,6 +395,19 @@
 	tprintf(signame(nr));
 }
 
+void
+print_sigset(struct tcb *tcp, long addr, int rt)
+{
+	sigset_t ss;
+
+	if (!addr)
+		tprintf("NULL");
+	else if (copy_sigset(tcp, addr, &ss) < 0)
+		tprintf("%#lx", addr);
+	else
+		printsigmask(&ss, rt);
+}
+
 #ifdef LINUX
 
 #ifndef ILL_ILLOPC
@@ -1652,8 +1665,6 @@
 		return RVAL_HEX | RVAL_STR;
 	}
 #else /* !ALPHA */
-	sigset_t sigset;
-
 	if (entering(tcp)) {
 #ifdef SVR4
 		if (tcp->u_arg[0] == 0)
@@ -1662,24 +1673,16 @@
 #endif /* SVR4 */
 		printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
 		tprintf(", ");
-		if (!tcp->u_arg[1])
-			tprintf("NULL, ");
-		else if (copy_sigset(tcp, tcp->u_arg[1], &sigset) < 0)
-			tprintf("%#lx, ", tcp->u_arg[1]);
-		else {
-			printsigmask(&sigset, 0);
-			tprintf(", ");
-		}
+		print_sigset(tcp, tcp->u_arg[1], 0);
+		tprintf(", ");
 	}
 	else {
 		if (!tcp->u_arg[2])
 			tprintf("NULL");
 		else if (syserror(tcp))
 			tprintf("%#lx", tcp->u_arg[2]);
-		else if (copy_sigset(tcp, tcp->u_arg[2], &sigset) < 0)
-			tprintf("[?]");
 		else
-			printsigmask(&sigset, 0);
+			print_sigset(tcp, tcp->u_arg[2], 0);
 	}
 #endif /* !ALPHA */
 	return 0;