2008-10-23  Dmitry V. Levin  <ldv@altlinux.org>

	Implement parsers for new linux syscalls.
	* desc.c (do_dup2, [LINUX] sys_dup3): New functions.
	(sys_dup2): Use do_dup2.
	[LINUX] (sys_epoll_create1): New function.
	[LINUX] (do_eventfd, sys_eventfd2): New functions.
	[LINUX] (sys_eventfd): Use do_eventfd.
	* net.c (do_pipe, [LINUX] sys_pipe2): New functions.
	(sys_pipe): Use do_pipe.
	* signal.c [LINUX] (do_signalfd, sys_signalfd4): New functions.
	[LINUX] (sys_signalfd): Use do_signalfd.
	* linux/syscall.h: Declare new sys_* functions.
	* linux/syscallent.h: Hook up signalfd4, eventfd2, epoll_create1,
	dup3, pipe2, inotify_init1.
	* linux/x86_64/syscallent.h: Hook up paccept, signalfd4, eventfd2,
	epoll_create1, dup3, pipe2, inotify_init1.
diff --git a/net.c b/net.c
index 98278c1..b294230 100644
--- a/net.c
+++ b/net.c
@@ -1497,32 +1497,51 @@
 	return sys_accept(tcp);
 }
 
-int
-sys_pipe(tcp)
-struct tcb *tcp;
+extern const struct xlat open_mode_flags[];
+
+static int
+do_pipe(struct tcb *tcp, int flags_arg)
 {
-
-#if defined(LINUX) && !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64)
-	int fds[2];
-
 	if (exiting(tcp)) {
 		if (syserror(tcp)) {
 			tprintf("%#lx", tcp->u_arg[0]);
-			return 0;
-		}
-		if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
-			tprintf("[...]");
-		else
-			tprintf("[%u, %u]", fds[0], fds[1]);
-	}
+		} else {
+#if defined(LINUX) && !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64)
+			int fds[2];
+
+			if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
+				tprintf("[...]");
+			else
+				tprintf("[%u, %u]", fds[0], fds[1]);
 #elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(FREEBSD) || defined(IA64)
-	if (exiting(tcp))
-		tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
+			tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
+#else
+			tprintf("%#lx", tcp->u_arg[0]);
 #endif
+		}
+		if (flags_arg >= 0) {
+			tprintf(", ");
+			printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
+		}
+	}
 	return 0;
 }
 
 int
+sys_pipe(struct tcb *tcp)
+{
+	return do_pipe(tcp, -1);
+}
+
+#ifdef LINUX
+int
+sys_pipe2(struct tcb *tcp)
+{
+	return do_pipe(tcp, 1);
+}
+#endif
+
+int
 sys_socketpair(struct tcb *tcp)
 {
 #ifdef LINUX