]> granicus.if.org Git - strace/commitdiff
Replace x86-64 paccept with accept4
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Aug 2009 10:34:05 +0000 (12:34 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 1 Sep 2009 19:53:29 +0000 (19:53 +0000)
This patch changes the paccept syscall to accept4 for x86-64, since
the former was dropped in Linux kernel commit v2.6.27-rc7-14-g2d4c826.
At the same time, it adds support for pretty printing its arguments.

* linux/x86_64/syscallent.h: Replace paccept with accept4,
hook in sys_accept4.
* net.c (sys_accept): Leave a small stub calling the new...
(do_accept): ... function, which also adds a flags_arg argument.
(sys_accept4): New.

linux/syscall.h
linux/x86_64/syscallent.h
net.c

index 60df9345c62ee3b203e1aacfe7e3dceee12d8c82..b373ec888d797754782549ccbd598abd0e7ebe5b 100644 (file)
@@ -109,7 +109,7 @@ int sys_signalfd4(), sys_eventfd2(), sys_epoll_create1(), sys_dup3(), sys_pipe2(
 
 /* sys_socketcall subcalls */
 
-int sys_socket(), sys_bind(), sys_connect(), sys_listen();
+int sys_socket(), sys_bind(), sys_connect(), sys_listen(), sys_accept4();
 int sys_accept(), sys_getsockname(), sys_getpeername(), sys_socketpair();
 int sys_send(), sys_recv(), sys_sendto(), sys_recvfrom();
 int sys_shutdown(), sys_setsockopt(), sys_getsockopt();
index fd18715ed299fbba3eac9f20f4730447ca5d1f43..a941dcb130fa4d7864d112d341679a4bea822d61 100644 (file)
        { 6,    TF,     sys_fallocate,          "fallocate"     }, /* 285 */
        { 4,    TD,     sys_timerfd_settime,    "timerfd_settime"}, /* 286 */
        { 2,    TD,     sys_timerfd_gettime,    "timerfd_gettime"}, /* 287 */
-       { 6,    TN,     printargs,              "paccept"       }, /* 288 */
+       { 4,    TN,     sys_accept4,            "accept4"       }, /* 288 */
        { 4,    TD|TS,  sys_signalfd4,          "signalfd4"     }, /* 289 */
        { 2,    TD,     sys_eventfd2,           "eventfd2"      }, /* 290 */
        { 1,    0,      sys_epoll_create1,      "epoll_create1" }, /* 291 */
diff --git a/net.c b/net.c
index 9759268194799ef3b240ff9dbaaf76c3b15fe58a..9d2b9f9e583db21def43fa7c8ed17c875d3a430f 100644 (file)
--- a/net.c
+++ b/net.c
@@ -1303,13 +1303,14 @@ struct tcb *tcp;
        return 0;
 }
 
-int
-sys_accept(tcp)
-struct tcb *tcp;
+static int
+do_accept(struct tcb *tcp, int flags_arg)
 {
        if (entering(tcp)) {
                tprintf("%ld, ", tcp->u_arg[0]);
-       } else if (!tcp->u_arg[2])
+               return 0;
+       }
+       if (!tcp->u_arg[2])
                tprintf("%#lx, NULL", tcp->u_arg[1]);
        else {
                int len;
@@ -1322,9 +1323,28 @@ struct tcb *tcp;
                tprintf(", ");
                printnum_int(tcp, tcp->u_arg[2], "%u");
        }
+       if (flags_arg >= 0) {
+               tprintf(", ");
+               printflags(sock_type_flags, tcp->u_arg[flags_arg],
+                          "SOCK_???");
+       }
        return 0;
 }
 
+int
+sys_accept(struct tcb *tcp)
+{
+       return do_accept(tcp, -1);
+}
+
+#ifdef LINUX
+int
+sys_accept4(struct tcb *tcp)
+{
+       return do_accept(tcp, 3);
+}
+#endif
+
 int
 sys_send(tcp)
 struct tcb *tcp;