]> granicus.if.org Git - strace/commitdiff
futex.c: introduce do_futex
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 4 May 2019 23:15:52 +0000 (23:15 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 4 May 2019 23:15:52 +0000 (23:15 +0000)
This is going to be used to implement a parser of futex_time64 syscall.

* futex.c (do_futex): New function.
(SYS_FUNC(futex)): Turn into a thin wrapper around do_futex.

futex.c

diff --git a/futex.c b/futex.c
index 38acb4e559f355eea777108b01c403f57ab34cee..41e4857dca24075b0ab590cd628a13912955132c 100644 (file)
--- a/futex.c
+++ b/futex.c
@@ -26,7 +26,8 @@
 #include "xlat/futexwakeops.h"
 #include "xlat/futexwakecmps.h"
 
-SYS_FUNC(futex)
+static int
+do_futex(struct tcb *const tcp, const print_obj_by_addr_fn print_ts)
 {
        const kernel_ulong_t uaddr = tcp->u_arg[0];
        const int op = tcp->u_arg[1];
@@ -45,16 +46,16 @@ SYS_FUNC(futex)
        case FUTEX_WAIT:
                tprintf(", %u", val);
                tprints(", ");
-               print_timespec(tcp, timeout);
+               print_ts(tcp, timeout);
                break;
        case FUTEX_LOCK_PI:
                tprints(", ");
-               print_timespec(tcp, timeout);
+               print_ts(tcp, timeout);
                break;
        case FUTEX_WAIT_BITSET:
                tprintf(", %u", val);
                tprints(", ");
-               print_timespec(tcp, timeout);
+               print_ts(tcp, timeout);
                tprints(", ");
                printxval(futexbitset, val3, NULL);
                break;
@@ -98,7 +99,7 @@ SYS_FUNC(futex)
        case FUTEX_WAIT_REQUEUE_PI:
                tprintf(", %u", val);
                tprints(", ");
-               print_timespec(tcp, timeout);
+               print_ts(tcp, timeout);
                tprints(", ");
                printaddr(uaddr2);
                break;
@@ -121,3 +122,8 @@ SYS_FUNC(futex)
 
        return RVAL_DECODED;
 }
+
+SYS_FUNC(futex)
+{
+       return do_futex(tcp, print_timespec);
+}