]> granicus.if.org Git - strace/commitdiff
mq.c: introduce do_mq_timedsend and do_mq_timedreceive
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)
These are going to be used to implement parsers of mq_timedsend_time64
and mq_timedreceive_time64 syscalls.

* mq.c (do_mq_timedsend, do_mq_timedreceive): New functions.
(SYS_FUNC(mq_timedsend)): Turn into a thin wrapper around
do_mq_timedsend.
(SYS_FUNC(mq_timedreceive)): Turn into a thin wrapper around
do_mq_timedreceive.

mq.c

diff --git a/mq.c b/mq.c
index 0090b0936155f2c2dbcdee0ee6edb166b9a55f0a..cc8b42563a2b5357c36a83510892deabb832e77a 100644 (file)
--- a/mq.c
+++ b/mq.c
@@ -26,18 +26,25 @@ SYS_FUNC(mq_open)
        return RVAL_DECODED | RVAL_FD;
 }
 
-SYS_FUNC(mq_timedsend)
+static int
+do_mq_timedsend(struct tcb *const tcp, const print_obj_by_addr_fn print_ts)
 {
        printfd(tcp, tcp->u_arg[0]);
        tprints(", ");
        printstrn(tcp, tcp->u_arg[1], tcp->u_arg[2]);
        tprintf(", %" PRI_klu ", %u, ", tcp->u_arg[2],
                (unsigned int) tcp->u_arg[3]);
-       print_timespec(tcp, tcp->u_arg[4]);
+       print_ts(tcp, tcp->u_arg[4]);
        return RVAL_DECODED;
 }
 
-SYS_FUNC(mq_timedreceive)
+SYS_FUNC(mq_timedsend)
+{
+       return do_mq_timedsend(tcp, print_timespec);
+}
+
+static int
+do_mq_timedreceive(struct tcb *const tcp, const print_obj_by_addr_fn print_ts)
 {
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
@@ -56,12 +63,17 @@ SYS_FUNC(mq_timedreceive)
                 * whether the syscall has failed or not.
                 */
                temporarily_clear_syserror(tcp);
-               print_timespec(tcp, tcp->u_arg[4]);
+               print_ts(tcp, tcp->u_arg[4]);
                restore_cleared_syserror(tcp);
        }
        return 0;
 }
 
+SYS_FUNC(mq_timedreceive)
+{
+       return do_mq_timedreceive(tcp, print_timespec);
+}
+
 SYS_FUNC(mq_notify)
 {
        printfd(tcp, tcp->u_arg[0]);