]> granicus.if.org Git - strace/commitdiff
ipc_sem.c: introduce do_semtimedop
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 semtimedop_time64
syscall.

* ipc_sem.c (do_semtimedop): New function.
(SYS_FUNC(semtimedop)): Turn into a thin wrapper around do_semtimedop.

ipc_sem.c

index c77a367a105fb8e443d3f7250eab7576ded4a695..5d706a58504db8b44eddf9025aa2758f6326e8a1 100644 (file)
--- a/ipc_sem.c
+++ b/ipc_sem.c
@@ -62,25 +62,31 @@ SYS_FUNC(semop)
        return RVAL_DECODED;
 }
 
-SYS_FUNC(semtimedop)
+static int
+do_semtimedop(struct tcb *const tcp, const print_obj_by_addr_fn print_ts)
 {
        tprintf("%d, ", (int) tcp->u_arg[0]);
        if (indirect_ipccall(tcp)) {
                tprint_sembuf_array(tcp, tcp->u_arg[3], tcp->u_arg[1]);
                tprints(", ");
 #if defined(S390) || defined(S390X)
-               print_timespec(tcp, tcp->u_arg[2]);
+               print_ts(tcp, tcp->u_arg[2]);
 #else
-               print_timespec(tcp, tcp->u_arg[4]);
+               print_ts(tcp, tcp->u_arg[4]);
 #endif
        } else {
                tprint_sembuf_array(tcp, tcp->u_arg[1], tcp->u_arg[2]);
                tprints(", ");
-               print_timespec(tcp, tcp->u_arg[3]);
+               print_ts(tcp, tcp->u_arg[3]);
        }
        return RVAL_DECODED;
 }
 
+SYS_FUNC(semtimedop)
+{
+       return do_semtimedop(tcp, print_timespec);
+}
+
 SYS_FUNC(semget)
 {
        printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);