]> granicus.if.org Git - strace/blobdiff - ipc_sem.c
nlattr: add unsigned int decoders that print in hex form
[strace] / ipc_sem.c
index db79746988b0a77f089114498e7aa158f690f6fc..8201a22b5fe7b1c601ba817e9f46e112a475ce6c 100644 (file)
--- a/ipc_sem.c
+++ b/ipc_sem.c
@@ -5,6 +5,7 @@
  * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
  * Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
  * Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2017 The strace developers.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,12 +58,13 @@ print_sembuf(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 #endif
 
 static void
-tprint_sembuf_array(struct tcb *tcp, const long addr, const unsigned int count)
+tprint_sembuf_array(struct tcb *const tcp, const kernel_ulong_t addr,
+                   const unsigned int count)
 {
 #if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
        struct sembuf sb;
        print_array(tcp, addr, count, &sb, sizeof(sb),
-                   umoven_or_printaddr, print_sembuf, 0);
+                   tfetch_mem, print_sembuf, 0);
 #else
        printaddr(addr);
 #endif
@@ -101,11 +103,7 @@ SYS_FUNC(semtimedop)
 
 SYS_FUNC(semget)
 {
-       const int key = (int) tcp->u_arg[0];
-       if (key)
-               tprintf("%#x", key);
-       else
-               tprints("IPC_PRIVATE");
+       printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
        tprintf(", %d, ", (int) tcp->u_arg[1]);
        if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
                tprints("|");
@@ -125,7 +123,7 @@ SYS_FUNC(semctl)
           ) {
                printnum_ptr(tcp, tcp->u_arg[3]);
        } else {
-               tprintf("%#lx", tcp->u_arg[3]);
+               printaddr(tcp->u_arg[3]);
        }
        return RVAL_DECODED;
 }