]> granicus.if.org Git - strace/commitdiff
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
authorRoland McGrath <roland@redhat.com>
Wed, 1 Jun 2005 19:02:36 +0000 (19:02 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 1 Jun 2005 19:02:36 +0000 (19:02 +0000)
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.

16 files changed:
bjm.c
defs.h
desc.c
file.c
ipc.c
mem.c
net.c
proc.c
process.c
signal.c
sock.c
stream.c
system.c
term.c
time.c
util.c

diff --git a/bjm.c b/bjm.c
index 3a6be0673f8d34f5fbd8666371d1ba1a1bada778..68a218556fbe2dd692eb1cb82e619f53d93af6da 100644 (file)
--- a/bjm.c
+++ b/bjm.c
@@ -118,7 +118,7 @@ struct tcb *tcp;
                        size_t                  ret;
                        umove(tcp, tcp->u_arg[2], &mi);
                        tprintf("{address=%#lx, size=%lu, flags=", mi.addr, mi.size);
-                       printflags(modflags, mi.flags);
+                       printflags(modflags, mi.flags, "MOD_???");
                        tprintf(", usecount=%lu}", mi.usecount);
                        umove(tcp, tcp->u_arg[4], &ret);
                        tprintf(", %Zu", ret);
diff --git a/defs.h b/defs.h
index 03cad786ccd2da3ea28f03a74a6a2598e3d246e9..574a7d2f380d761c72798be23b3cfc05d3220e74 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -425,10 +425,10 @@ extern void qualify P((char *));
 extern void newoutf P((struct tcb *));
 extern int get_scno P((struct tcb *));
 extern int trace_syscall P((struct tcb *));
-extern void printxval P((const struct xlat *, int, char *));
+extern void printxval P((const struct xlat *, int, const char *));
 extern int printargs P((struct tcb *));
 extern int addflags P((const struct xlat *, int));
-extern int printflags P((const struct xlat *, int));
+extern int printflags P((const struct xlat *, int, const char *));
 extern int umoven P((struct tcb *, long, int, char *));
 extern int umovestr P((struct tcb *, long, int, char *));
 extern int upeek P((int, long, long *));
diff --git a/desc.c b/desc.c
index 6e864b2734f10c87a0158a5ad4ca99f0f1a8b30a..2432b58f6446c5f17085ac4d6ee0b50c3de0f369 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -278,16 +278,14 @@ struct tcb *tcp;
                switch (tcp->u_arg[1]) {
                case F_SETFD:
                        tprintf(", ");
-                       if (printflags(fdflags, tcp->u_arg[2]) == 0)
-                               tprintf("0");
+                       printflags(fdflags, tcp->u_arg[2], "FD_???");
                        break;
                case F_SETOWN: case F_DUPFD:
                        tprintf(", %ld", tcp->u_arg[2]);
                        break;
                case F_SETFL:
                        tprintf(", ");
-                       if (printflags(openmodes, tcp->u_arg[2] + 1) == 0)
-                               tprintf("0");
+                       printflags(openmodes, tcp->u_arg[2] + 1, "O_???");
                        break;
                case F_SETLK: case F_SETLKW:
 #ifdef F_FREESP
@@ -357,8 +355,7 @@ struct tcb *tcp;
 {
        if (entering(tcp)) {
                tprintf("%ld, ", tcp->u_arg[0]);
-               if (!printflags(flockcmds, tcp->u_arg[1]))
-                       tprintf("LOCK_???");
+               printflags(flockcmds, tcp->u_arg[1], "LOCK_???");
        }
        return 0;
 }
@@ -639,8 +636,7 @@ print_epoll_event(ev)
 struct epoll_event *ev;
 {
        tprintf("{");
-       if (printflags(epollevents, ev->events) == 0)
-               tprintf("0");
+       printflags(epollevents, ev->events, "EPOLL???");
        /* We cannot know what format the program uses, so print u32 and u64
           which will cover every value.  */
        tprintf(", {u32=%" PRIu32 ", u64=%" PRIu64 "}}",
diff --git a/file.c b/file.c
index 8a3432f3403a921922e291801d660c3682b72e6a..821d4a82b07a32075352d08d605f44caf70d9bbb 100644 (file)
--- a/file.c
+++ b/file.c
@@ -315,7 +315,7 @@ struct tcb *tcp;
                printpath(tcp, tcp->u_arg[0]);
                tprintf(", ");
                /* flags */
-               printflags(openmodes, tcp->u_arg[1] + 1);
+               printflags(openmodes, tcp->u_arg[1] + 1, "O_???");
                if (tcp->u_arg[1] & O_CREAT) {
                        /* mode */
                        tprintf(", %#lo", tcp->u_arg[2]);
@@ -351,7 +351,7 @@ struct tcb *tcp;
                printpath(tcp, tcp->u_arg[0]);
                tprintf(", ");
                /* flags */
-               printflags(openmodessol, tcp->u_arg[1] + 1);
+               printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
                if (tcp->u_arg[1] & 0x100) {
                        /* mode */
                        tprintf(", %#lo", tcp->u_arg[2]);
@@ -394,7 +394,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                printpath(tcp, tcp->u_arg[0]);
                tprintf(", ");
-               printflags(access_flags, tcp->u_arg[1]);
+               printflags(access_flags, tcp->u_arg[1], "?_OK");
        }
        return 0;
 }
@@ -783,10 +783,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                printpath(tcp, tcp->u_arg[0]);
                tprintf(", ");
-               if (tcp->u_arg[1])
-                       printflags(fileflags, tcp->u_arg[1]);
-               else
-                       tprintf("0");
+               printflags(fileflags, tcp->u_arg[1], "UF_???");
        }
        return 0;
 }
@@ -797,10 +794,7 @@ struct tcb *tcp;
 {
        if (entering(tcp)) {
                tprintf("%ld, ", tcp->u_arg[0]);
-               if (tcp->u_arg[1])
-                       printflags(fileflags, tcp->u_arg[1]);
-               else
-                       tprintf("0");
+               printflags(fileflags, tcp->u_arg[1], "UF_???");
        }
        return 0;
 }
@@ -853,10 +847,7 @@ struct stat *statbuf;
            tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
 #if HAVE_STRUCT_STAT_ST_FLAGS
                tprintf(", st_flags=");
-               if (statbuf->st_flags) {
-                       printflags(fileflags, statbuf->st_flags);
-               } else
-                       tprintf("0");
+               printflags(fileflags, statbuf->st_flags, "UF_???");
 #endif
 #if HAVE_STRUCT_STAT_ST_ACLCNT
                tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
@@ -999,10 +990,7 @@ long addr;
                tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
 #if HAVE_STRUCT_STAT_ST_FLAGS
                tprintf(", st_flags=");
-               if (statbuf.st_flags) {
-                       printflags(fileflags, statbuf.st_flags);
-               } else
-                       tprintf("0");
+               printflags(fileflags, statbuf.st_flags, "UF_???");
 #endif
 #if HAVE_STRUCT_STAT_ST_ACLCNT
                tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
@@ -2403,7 +2391,7 @@ struct tcb *tcp;
        printstr(tcp, tcp->u_arg[1], -1);
        print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
        tprintf(", ");
-       printflags(xattrflags, tcp->u_arg[4]);
+       printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
     }
     return 0;
 }
@@ -2417,7 +2405,7 @@ struct tcb *tcp;
        printstr(tcp, tcp->u_arg[1], -1);
        print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
        tprintf(", ");
-       printflags(xattrflags, tcp->u_arg[4]);
+       printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
     }
     return 0;
 }
diff --git a/ipc.c b/ipc.c
index 60fece0d82b7bad826625ecc0edc42eec33e0a15..ede16b9bb71e406d9ec7f579f928320f26935cfd 100644 (file)
--- a/ipc.c
+++ b/ipc.c
@@ -162,7 +162,7 @@ struct tcb *tcp;
                else
                        tprintf("IPC_PRIVATE");
                tprintf(", ");
-               if (printflags(resource_flags, tcp->u_arg[1] & ~0777) != 0)
+               if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
                        tprintf("|");
                tprintf("%#lo", tcp->u_arg[1] & 0777);
        }
@@ -206,8 +206,7 @@ struct tcb *tcp;
                        tcp->u_arg[1]);
                tprintf("}, %lu", tcp->u_arg[1]);
                tprintf(", ");
-               if (printflags(msg_flags, tcp->u_arg[2]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[2], "MSG_???");
 #else /* !LINUX */
                umove(tcp, tcp->u_arg[1], &mtype);
                tprintf(", {%lu, ", mtype);
@@ -215,8 +214,7 @@ struct tcb *tcp;
                        tcp->u_arg[2]);
                tprintf("}, %lu", tcp->u_arg[2]);
                tprintf(", ");
-               if (printflags(msg_flags, tcp->u_arg[3]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[3], "MSG_???");
 #endif /* !LINUX */
        }
        return 0;
@@ -245,8 +243,7 @@ struct tcb *tcp;
                tprintf("}, %lu", tcp->u_arg[1]);
                tprintf(", %ld", tmp.msgtyp);
                tprintf(", ");
-               if (printflags(msg_flags, tcp->u_arg[2]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[2], "MSG_???");
 #else /* !LINUX */
                umove(tcp, tcp->u_arg[1], &mtype);
                tprintf(", {%lu, ", mtype);
@@ -255,8 +252,7 @@ struct tcb *tcp;
                tprintf("}, %lu", tcp->u_arg[2]);
                tprintf(", %ld", tcp->u_arg[3]);
                tprintf(", ");
-               if (printflags(msg_flags, tcp->u_arg[4]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[4], "MSG_???");
 #endif /* !LINUX */
        }
        return 0;
@@ -302,7 +298,7 @@ struct tcb *tcp;
                        tprintf("IPC_PRIVATE");
                tprintf(", %lu", tcp->u_arg[1]);
                tprintf(", ");
-               if (printflags(resource_flags, tcp->u_arg[2] & ~0777) != 0)
+               if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
                        tprintf("|");
                tprintf("%#lo", tcp->u_arg[2] & 0777);
        }
@@ -331,7 +327,7 @@ struct tcb *tcp;
                        tprintf("IPC_PRIVATE");
                tprintf(", %lu", tcp->u_arg[1]);
                tprintf(", ");
-               if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777) != 0)
+               if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
                        tprintf("|");
                tprintf("%#lo", tcp->u_arg[2] & 0777);
        }
@@ -365,13 +361,11 @@ struct tcb *tcp;
 #ifdef LINUX
                tprintf(", %#lx", tcp->u_arg[3]);
                tprintf(", ");
-               if (printflags(shm_flags, tcp->u_arg[1]) == 0)
-                       tprintf("0");
+               printflags(shm_flags, tcp->u_arg[1], "SHM_???");
 #else /* !LINUX */
                tprintf(", %#lx", tcp->u_arg[1]);
                tprintf(", ");
-               if (printflags(shm_flags, tcp->u_arg[2]) == 0)
-                       tprintf("0");
+               printflags(shm_flags, tcp->u_arg[2], "SHM_???");
 #endif /* !LINUX */
                if (syserror(tcp))
                        return 0;
@@ -407,7 +401,7 @@ struct tcb *tcp;
                printpath(tcp, tcp->u_arg[0]);
                tprintf(", ");
                /* flags */
-               printflags(openmodes, tcp->u_arg[1] + 1);
+               printflags(openmodes, tcp->u_arg[1] + 1, "O_???");
                if (tcp->u_arg[1] & O_CREAT) {
 # ifndef HAVE_MQUEUE_H
                        tprintf(", %lx", tcp->u_arg[2]);
@@ -477,7 +471,7 @@ long addr;
                        return;
                }
                tprintf("{mq_flags=");
-               printflags(openmodes, attr.mq_flags + 1);
+               printflags(openmodes, attr.mq_flags + 1, "O_???");
                tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
                        attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
 # endif
diff --git a/mem.c b/mem.c
index fbc26daf7985aa367d7156f3692e9471c51dc245..08a5f926e06c8cee8e63e8cc5e843e88c129bab6 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -199,14 +199,14 @@ long *u_arg;
                /* len */
                tprintf("%lu, ", u_arg[1]);
                /* prot */
-               printflags(mmap_prot, u_arg[2]);
+               printflags(mmap_prot, u_arg[2], "PROT_???");
                tprintf(", ");
                /* flags */
 #ifdef MAP_TYPE
                printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
                addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
 #else
-               printflags(mmap_flags, u_arg[3]);
+               printflags(mmap_flags, u_arg[3], "MAP_???");
 #endif
                /* fd (is always int, not long) */
                tprintf(", %d, ", (int)u_arg[4]);
@@ -300,14 +300,14 @@ struct tcb *tcp;
                /* len */
                tprintf("%lu, ", u_arg[1]);
                /* prot */
-               printflags(mmap_prot, u_arg[2]);
+               printflags(mmap_prot, u_arg[2], "PROT_???");
                tprintf(", ");
                /* flags */
 #ifdef MAP_TYPE
                printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
                addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
 #else
-               printflags(mmap_flags, u_arg[3]);
+               printflags(mmap_flags, u_arg[3], "MAP_???");
 #endif
                /* fd */
                tprintf(", %ld, ", u_arg[4]);
@@ -337,8 +337,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                tprintf("%#lx, %lu, ",
                        tcp->u_arg[0], tcp->u_arg[1]);
-               if (!printflags(mmap_prot, tcp->u_arg[2]))
-                       tprintf("PROT_???");
+               printflags(mmap_prot, tcp->u_arg[2], "PROT_???");
        }
        return 0;
 }
@@ -357,7 +356,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                tprintf("%#lx, %lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1],
                        tcp->u_arg[2]);
-               printflags(mremap_flags, tcp->u_arg[3]);
+               printflags(mremap_flags, tcp->u_arg[3], "MREMAP_???");
        }
        return RVAL_HEX;
 }
@@ -388,7 +387,7 @@ struct tcb *tcp;
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
-               printflags(madvise_flags, tcp->u_arg[2]);
+               printflags(madvise_flags, tcp->u_arg[2], "MADV_???");
        }
        return 0;
 }
@@ -409,7 +408,7 @@ sys_mlockall(tcp)
 struct tcb *tcp;
 {
        if (entering(tcp)) {
-               printflags(mlockall_flags, tcp->u_arg[0]);
+               printflags(mlockall_flags, tcp->u_arg[0], "MCL_???");
        }
        return 0;
 }
@@ -438,8 +437,7 @@ struct tcb *tcp;
                /* len */
                tprintf(", %lu, ", tcp->u_arg[1]);
                /* flags */
-               if (!printflags(mctl_sync, tcp->u_arg[2]))
-                       tprintf("MS_???");
+               printflags(mctl_sync, tcp->u_arg[2], "MS_???");
        }
        return 0;
 }
@@ -476,19 +474,16 @@ struct tcb *tcp;
                tprintf(", %lu, ", tcp->u_arg[1]);
                /* function */
                function = tcp->u_arg[2];
-               if (!printflags(mctl_funcs, function))
-                       tprintf("MC_???");
+               printflags(mctl_funcs, function, "MC_???");
                /* arg */
                arg = tcp->u_arg[3];
                tprintf(", ");
                switch (function) {
                case MC_SYNC:
-                       if (!printflags(mctl_sync, arg))
-                               tprintf("MS_???");
+                       printflags(mctl_sync, arg, "MS_???");
                        break;
                case MC_LOCKAS:
-                       if (!printflags(mctl_lockas, arg))
-                               tprintf("MCL_???");
+                       printflags(mctl_lockas, arg, "MCL_???");
                        break;
                default:
                        tprintf("%#x", arg);
@@ -646,13 +641,13 @@ struct tcb *tcp;
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
-               printflags(mmap_prot, tcp->u_arg[2]);
+               printflags(mmap_prot, tcp->u_arg[2], "PROT_???");
                tprintf(", %lu, ", tcp->u_arg[3]);
 #ifdef MAP_TYPE
                printxval(mmap_flags, tcp->u_arg[4] & MAP_TYPE, "MAP_???");
                addflags(mmap_flags, tcp->u_arg[4] & ~MAP_TYPE);
 #else
-               printflags(mmap_flags, tcp->u_arg[4]);
+               printflags(mmap_flags, tcp->u_arg[4], "MAP_???");
 #endif
        }
        return 0;
@@ -729,8 +724,7 @@ struct tcb *tcp;
                printxval(policies, tcp->u_arg[2], "MPOL_???");
                get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[4], 0);
                tprintf(", ");
-               if (printflags(mbindflags, tcp->u_arg[5]) == 0)
-                       tprintf("0");
+               printflags(mbindflags, tcp->u_arg[5], "MPOL_???");
        }
        return 0;
 }
@@ -760,8 +754,7 @@ struct tcb *tcp;
                        printxval(policies, pol, "MPOL_???");
                get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], syserror(tcp));
                tprintf(", %#lx, ", tcp->u_arg[3]);
-               if (printflags(mempolicyflags, tcp->u_arg[4]) == 0)
-                       tprintf("0");
+               printflags(mempolicyflags, tcp->u_arg[4], "MPOL_???");
        }
        return 0;
 }
diff --git a/net.c b/net.c
index 593ccf3e23c336b393c57c39c89049f71f166fc0..103278d545a2c2b3e70e8169a5d2f33f7f6f6ad8 100644 (file)
--- a/net.c
+++ b/net.c
@@ -1146,8 +1146,7 @@ long addr;
                printcmsghdr(tcp, (unsigned long) msg.msg_control,
                             msg.msg_controllen);
        tprintf(", msg_flags=");
-       if (printflags(msg_flags, msg.msg_flags)==0)
-               tprintf("0");
+       printflags(msg_flags, msg.msg_flags, "MSG_???");
 #else /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
        tprintf("msg_accrights=%#lx, msg_accrightslen=%u",
                (unsigned long) msg.msg_accrights, msg.msg_accrightslen);
@@ -1274,8 +1273,7 @@ struct tcb *tcp;
                printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
                tprintf(", %lu, ", tcp->u_arg[2]);
                /* flags */
-               if (printflags(msg_flags, tcp->u_arg[3]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[3], "MSG_???");
        }
        return 0;
 }
@@ -1289,8 +1287,7 @@ struct tcb *tcp;
                printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
                tprintf(", %lu, ", tcp->u_arg[2]);
                /* flags */
-               if (printflags(msg_flags, tcp->u_arg[3]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[3], "MSG_???");
                /* to address */
                tprintf(", ");
                printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
@@ -1311,8 +1308,7 @@ struct tcb *tcp;
                printmsghdr(tcp, tcp->u_arg[1]);
                /* flags */
                tprintf(", ");
-               if (printflags(msg_flags, tcp->u_arg[2]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[2], "MSG_???");
        }
        return 0;
 }
@@ -1332,8 +1328,7 @@ struct tcb *tcp;
                        printstr(tcp, tcp->u_arg[1], tcp->u_rval);
 
                tprintf(", %lu, ", tcp->u_arg[2]);
-               if (printflags(msg_flags, tcp->u_arg[3]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[3], "MSG_???");
        }
        return 0;
 }
@@ -1358,8 +1353,7 @@ struct tcb *tcp;
                /* len */
                tprintf(", %lu, ", tcp->u_arg[2]);
                /* flags */
-               if (printflags(msg_flags, tcp->u_arg[3]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[3], "MSG_???");
                /* from address, len */
                if (!tcp->u_arg[4] || !tcp->u_arg[5]) {
                        if (tcp->u_arg[4] == 0)
@@ -1399,8 +1393,7 @@ struct tcb *tcp;
                        printmsghdr(tcp, tcp->u_arg[1]);
                /* flags */
                tprintf(", ");
-               if (printflags(msg_flags, tcp->u_arg[2]) == 0)
-                       tprintf("0");
+               printflags(msg_flags, tcp->u_arg[2], "MSG_???");
        }
        return 0;
 }
@@ -1623,8 +1616,7 @@ long addr;
        }
 
        tprintf("~(");
-       if (printflags(icmpfilterflags, ~filter.data) == 0)
-               tprintf("0");
+       printflags(icmpfilterflags, ~filter.data, "ICMP_???");
        tprintf(")");
 }
 #endif /* ICMP_FILTER */
diff --git a/proc.c b/proc.c
index 57521440ca47e5bbe39906d430dafc2560981d54..6916799a132392fcf50f64e51934bdcfd81a0cb6 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -110,8 +110,7 @@ int code, arg;
                        tprintf(", {...}");
                else {
                        tprintf(", {pr_flags=");
-                       if (!printflags(proc_status_flags, status.pr_flags))
-                               tprintf("0");
+                       printflags(proc_status_flags, status.pr_flags, "PR_???");
                        if (status.pr_why) {
                                tprintf(", pr_why=");
                                printxval(proc_status_why, status.pr_why,
@@ -142,8 +141,7 @@ int code, arg;
                        tprintf(", {...}");
                else {
                        tprintf(", {pr_flags=");
-                       if (!printflags(proc_run_flags, run.pr_flags))
-                               tprintf("0");
+                       printflags(proc_run_flags, run.pr_flags, "PR???");
                        tprintf(", ...}");
                }
                return 1;
@@ -154,8 +152,7 @@ int code, arg;
                        tprintf(", [?]");
                else {
                        tprintf(", [");
-                       if (!printflags(proc_status_flags, val))
-                               tprintf("0");
+                       printflags(proc_status_flags, val, "PR_???");
                        tprintf("]");
                }
                return 1;
@@ -227,29 +224,22 @@ int code, arg;
                        tprintf(", {...}");
                else {
                        tprintf(", {state=%d, flags=", status.state);
-                       if (!printflags(proc_status_flags, status.flags))
-                               tprintf("0");
+                       printflags(proc_status_flags, status.flags, "PF_???");
                        tprintf(", events=");
-                       printflags(proc_status_why, status.events);
+                       printflags(proc_status_why, status.events, "S_???");
                        tprintf(", why=");
                        printxval(proc_status_why, status.why, "S_???");
                        tprintf(", val=%lu}", status.val);
                }
                return 1;
        case PIOCBIS:
-               if (arg) {
-                       tprintf(", ");
-                       printflags(proc_status_why, arg);
-               } else
-                       tprintf(", 0");
+               tprintf(", ");
+               printflags(proc_status_why, arg, "S_???");
                return 1;
                return 1;
        case PIOCSFL:
-               if (arg) {
-                       tprintf(", ");
-                       printflags(proc_status_flags, arg);
-               } else
-                       tprintf(", 0");
+               tprintf(", ");
+               printflags(proc_status_flags, arg, "PF_???");
                return 1;
        case PIOCGFL:
                if (syserror(tcp))
@@ -258,10 +248,7 @@ int code, arg;
                        tprintf(", {...}");
                else {
                        tprintf(", [");
-                       if (val)
-                               printflags(proc_status_flags, val);
-                       else
-                               tprintf("0");
+                       printflags(proc_status_flags, val, "PF_???");
                        tprintf("]");
                }
                return 1;
index 56d15699a28acdd387b58affc2b558d47ec65a5c..badcba6fc679c7dea593d7f39d40521a601b3796 100644 (file)
--- a/process.c
+++ b/process.c
@@ -579,8 +579,7 @@ struct tcb *tcp;
                                tcp->u_arg[ARG_STACKSIZE]);
 # endif
                tprintf("flags=");
-               if (printflags(clone_flags, flags &~ CSIGNAL) == 0)
-                       tprintf("0");
+               printflags(clone_flags, flags &~ CSIGNAL, NULL);
                if ((flags & CSIGNAL) != 0)
                        tprintf("|%s", signame(flags & CSIGNAL));
                if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
@@ -1820,8 +1819,7 @@ int bitness;
                        exited = printstatus(status);
                /* options */
                tprintf(", ");
-               if (!printflags(wait4_options, tcp->u_arg[2]))
-                       tprintf("0");
+               printflags(wait4_options, tcp->u_arg[2], "W???");
                if (n == 4) {
                        tprintf(", ");
                        /* usage */
@@ -2045,8 +2043,7 @@ struct tcb *tcp;
                        printsiginfo(&si, verbose (tcp));
                /* options */
                tprintf(", ");
-               if (!printflags(wait4_options, tcp->u_arg[3]))
-                       tprintf("0");
+               printflags(wait4_options, tcp->u_arg[3], "W???");
                if (tcp->u_nargs > 4) {
                        /* usage */
                        tprintf(", ");
index f7c9f668c4cbea21c5bb2bbfd1cc974d1f7edcff..2df70a0f3f78c0a675ade7c8b8fca7f5980d412f 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -962,8 +962,7 @@ struct tcb *tcp;
                        tprintf("{%#lx, ", (unsigned long) sv.sv_handler);
                        printsigmask(&sv.sv_mask, 0);
                        tprintf(", ");
-                       if (!printflags(sigvec_flags, sv.sv_flags))
-                               tprintf("0");
+                       printflags(sigvec_flags, sv.sv_flags, "SV_???");
                        tprintf("}");
                }
        }
@@ -1128,8 +1127,7 @@ struct tcb *tcp;
                        printsigmask(&sigset, 0);
 #endif
                        tprintf(", ");
-                       if (!printflags(sigact_flags, sa.sa_flags))
-                               tprintf("0");
+                       printflags(sigact_flags, sa.sa_flags, "SA_???");
 #ifdef SA_RESTORER
                        if (sa.sa_flags & SA_RESTORER)
                                tprintf(", %p", sa.sa_restorer);
@@ -1541,8 +1539,7 @@ ucontext_t *ucp;
        tprintf("{");
        if (!abbrev(tcp)) {
                tprintf("uc_flags=");
-               if (!printflags(ucontext_flags, ucp->uc_flags))
-                       tprintf("0");
+               printflags(ucontext_flags, ucp->uc_flags, "UC_???");
                tprintf(", uc_link=%#lx, ", (unsigned long) ucp->uc_link);
        }
        tprintf("uc_sigmask=");
@@ -1551,8 +1548,7 @@ ucontext_t *ucp;
                tprintf(", uc_stack={ss_sp=%#lx, ss_size=%d, ss_flags=",
                        (unsigned long) ucp->uc_stack.ss_sp,
                        ucp->uc_stack.ss_size);
-               if (!printflags(sigaltstack_flags, ucp->uc_stack.ss_flags))
-                       tprintf("0");
+               printflags(sigaltstack_flags, ucp->uc_stack.ss_flags, "SS_???");
                tprintf("}");
        }
        tprintf(", ...}");
@@ -1613,8 +1609,7 @@ unsigned long addr;
        if (umove(tcp, addr, &ss) < 0)
                return -1;
        tprintf("{ss_sp=%#lx, ss_flags=", (unsigned long) ss.ss_sp);
-       if (!printflags(sigaltstack_flags, ss.ss_flags))
-               tprintf("0");
+       printflags(sigaltstack_flags, ss.ss_flags, "SS_???");
        tprintf(", ss_size=%lu}", (unsigned long) ss.ss_size);
        return 0;
 }
@@ -1857,8 +1852,7 @@ sys_rt_sigaction(tcp)
                                        memcpy(&sigset, &sa.sa_mask, sizeof(sigset));
                                printsigmask(&sigset, 1);
                                tprintf(", ");
-                               if (!printflags(sigact_flags, sa.sa_flags))
-                                       tprintf("0");
+                               printflags(sigact_flags, sa.sa_flags, "SA_???");
 #ifdef SA_RESTORER
                                if (sa.sa_flags & SA_RESTORER)
                                        tprintf(", %p", sa.sa_restorer);
diff --git a/sock.c b/sock.c
index 787bf9291da8704ad0662b70ad60d691bd6f2843..462df22b116407a3fc9c8541fbff5a231086f48c 100644 (file)
--- a/sock.c
+++ b/sock.c
@@ -193,7 +193,7 @@ long code, arg;
                                break;
                        case SIOCGIFFLAGS:
                                tprintf("ifr_flags=");
-                               printflags(iffflags, ifr.ifr_flags);
+                               printflags(iffflags, ifr.ifr_flags, "IFF_???");
                                break;
                        case SIOCGIFMETRIC:
                                tprintf("ifr_metric=%d", ifr.ifr_metric);
index 68be3a46468de4b7cac4cb9513dc089fb50b4227..998fd8ab4108c8ef5efae9b167ee15f99e8a0d52 100644 (file)
--- a/stream.c
+++ b/stream.c
@@ -124,8 +124,7 @@ struct tcb *tcp;
                for (i = 1; i < 3; i++)
                        printstrbufarg(tcp, tcp->u_arg[i], 0);
                /* flags */
-               if (!printflags(msgflags, tcp->u_arg[3]))
-                       tprintf("0");
+               printflags(msgflags, tcp->u_arg[3], "RS_???");
        }
        return 0;
 }
@@ -155,8 +154,7 @@ struct tcb *tcp;
                        tprintf("[?]");
                else {
                        tprintf("[");
-                       if (!printflags(msgflags, flags))
-                               tprintf("0");
+                       printflags(msgflags, flags, "RS_???");
                        tprintf("]");
                }
                /* decode return value */
@@ -209,8 +207,7 @@ struct tcb *tcp;
                /* band */
                tprintf("%ld, ", tcp->u_arg[3]);
                /* flags */
-               if (!printflags(pmsgflags, tcp->u_arg[4]))
-                       tprintf("0");
+               printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
        }
        return 0;
 }
@@ -245,8 +242,7 @@ struct tcb *tcp;
                        tprintf("[?]");
                else {
                        tprintf("[");
-                       if (!printflags(pmsgflags, flags))
-                               tprintf("0");
+                       printflags(pmsgflags, flags, "MSG_???");
                        tprintf("]");
                }
                /* decode return value */
@@ -334,13 +330,12 @@ struct tcb *tcp;
                                        continue;
                                }
                                tprintf("{fd=%d, events=", pollp[i].fd);
-                               if (!printflags(pollflags, pollp[i].events))
-                                       tprintf("0");
+                               printflags(pollflags, pollp[i].events,
+                                          "POLL???");
                                if (!syserror(tcp) && pollp[i].revents) {
                                        tprintf(", revents=");
-                                       if (!printflags(pollflags,
-                                                       pollp[i].revents))
-                                               tprintf("0");
+                                       printflags(pollflags, pollp[i].revents,
+                                                  "POLL???");
                                }
                                tprintf("}");
                        }
@@ -774,7 +769,8 @@ int len;
                GET (T_OPTMGMT_REQ, optmgmt_req);
                COMMA ();
                tprintf ("MGMT=");
-               printflags (transport_user_flags, m.optmgmt_req.MGMT_flags);
+               printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
+                           "T_???");
                STRUCT (optmgmt_req, OPT, print_optmgmt);
                break;
 #endif
@@ -834,7 +830,7 @@ int len;
                tprintf (", CURRENT=");
                printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
                tprintf (", PROVIDER=");
-               printflags (provider_flags, m.info_ack.PROVIDER_flag);
+               printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
                break;
 #endif
 #ifdef T_BIND_ACK
@@ -885,7 +881,8 @@ int len;
                GET (T_OPTMGMT_ACK, optmgmt_ack);
                COMMA ();
                tprintf ("MGMT=");
-               printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags);
+               printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
+                           "T_???");
                STRUCT (optmgmt_ack, OPT, print_optmgmt);
                break;
 #endif
@@ -1127,8 +1124,7 @@ int code, arg;
                        tprintf(", {...}");
                else {
                        tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
-                       if (!printflags(stream_flush_options, bi.bi_flag))
-                               tprintf("0");
+                       printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
                        tprintf("}");
                }
                return 1;
@@ -1136,8 +1132,7 @@ int code, arg;
        case I_SETSIG:
                /* argument is a set of flags */
                tprintf(", ");
-               if (!printflags(stream_setsig_flags, arg))
-                       tprintf("0");
+               printflags(stream_setsig_flags, arg, "S_???");
                return 1;
        case I_GETSIG:
                /* argument is a pointer to a set of flags */
@@ -1146,8 +1141,8 @@ int code, arg;
                tprintf(", [");
                if (umove(tcp, arg, &val) < 0)
                        tprintf("?");
-               else if (!printflags(stream_setsig_flags, val))
-                       tprintf("0");
+               else
+                       printflags(stream_setsig_flags, val, "S_???");
                tprintf("]");
                return 1;
        case I_PEEK:
@@ -1163,8 +1158,7 @@ int code, arg;
                tprintf(", databuf=");
                printstrbuf(tcp, &sp.databuf, 1);
                tprintf(", flags=");
-               if (!printflags(msgflags, sp.flags))
-                       tprintf("0");
+               printflags(msgflags, sp.flags, "RS_???");
                tprintf("}");
                return 1;
        case I_SRDOPT:
@@ -1216,16 +1210,14 @@ int code, arg;
                tprintf(", databuf=");
                printstrbuf(tcp, &sfi.databuf, 1);
                tprintf(", flags=");
-               if (!printflags(msgflags, sfi.flags))
-                       tprintf("0");
+               printflags(msgflags, sfi.flags, "RS_???");
                tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
                return 1;
 #ifdef I_SWROPT
        case I_SWROPT:
                /* argument is a set of flags */
                tprintf(", ");
-               if (!printflags(stream_write_flags, arg))
-                       tprintf("0");
+               printflags(stream_write_flags, arg, "SND???");
                return 1;
 #endif /* I_SWROPT */
 #ifdef I_GWROPT
@@ -1236,8 +1228,8 @@ int code, arg;
                tprintf(", [");
                if (umove(tcp, arg, &val) < 0)
                        tprintf("?");
-               else if (!printflags(stream_write_flags, arg))
-                       tprintf("0");
+               else
+                       printflags(stream_write_flags, arg, "SND???");
                tprintf("]");
                return 1;
 #endif /* I_GWROPT */
index 623571cf4f7cf44cd4d398825de1651b6dd48dc8..7bbcdcd0229b1454757c701d3febcc8aa7efbb43 100644 (file)
--- a/system.c
+++ b/system.c
@@ -112,7 +112,7 @@ struct tcb *tcp;
                else
                        tprintf("%#lx", tcp->u_arg[2]);
                tprintf(", ");
-               printflags(mount_flags, tcp->u_arg[3]);
+               printflags(mount_flags, tcp->u_arg[3], "MS_???");
                tprintf(", %#lx", tcp->u_arg[4]);
        }
        return 0;
@@ -197,14 +197,11 @@ sys_reboot(tcp)
 struct tcb *tcp;
 {
        if (entering(tcp)) {
-               if (!printflags(bootflags1, tcp->u_arg[0]))
-                       tprintf("LINUX_REBOOT_MAGIC???");
+               printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
                tprintf(", ");
-               if (!printflags(bootflags2, tcp->u_arg[1]))
-                       tprintf("LINUX_REBOOT_MAGIC???");
+               printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
                tprintf(", ");
-               if (!printflags(bootflags3, tcp->u_arg[2]))
-                       tprintf("LINUX_REBOOT_CMD_???");
+               printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
                if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
                        tprintf(", ");
                        printstr(tcp, tcp->u_arg[3], -1);
@@ -251,7 +248,7 @@ struct tcb *tcp;
                printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
                tprintf(", ");
                /* flags */
-               printflags(cacheflush_flags, tcp->u_arg[2]);
+               printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
                /* len */
                tprintf(", %lu", tcp->u_arg[3]);
        }
@@ -302,8 +299,7 @@ sys_reboot(tcp)
 struct tcb *tcp;
 {
        if (entering(tcp)) {
-               if (!printflags(bootflags, tcp->u_arg[0]))
-                       tprintf("RB_???");
+               printflags(bootflags, tcp->u_arg[0], "RB_???");
                if (tcp->u_arg[0] & RB_STRING) {
                        printstr(tcp, tcp->u_arg[1], -1);
                }
@@ -401,8 +397,7 @@ struct tcb *tcp;
                }
                printstr(tcp, tcp->u_arg[1], -1);
                tprintf(", ");
-               if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
-                       tprintf("0");
+               printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???");
                tprintf(", ");
 
                if (strcmp(type, "4.2") == 0) {
@@ -422,8 +417,7 @@ struct tcb *tcp;
                        tprintf("[");
                        printsock(tcp, (int) a.addr);
                        tprintf(", ");
-                       if (!printflags(nfsflags, a.flags))
-                               tprintf("NFSMNT_???");
+                       printflags(nfsflags, a.flags, "NFSMNT_???");
                        tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
                                a.wsize, a.rsize, a.timeo, a.retrans);
                        if (a.flags & NFSMNT_HOSTNAME && a.hostname)
@@ -1216,7 +1210,7 @@ struct tcb *tcp;
                tprintf(", ");
                printpath(tcp, tcp->u_arg[1]);
                tprintf(", ");
-               printflags(mount_flags, tcp->u_arg[2]);
+               printflags(mount_flags, tcp->u_arg[2], "MS_???");
                if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
                        tprintf(", ");
                        tprintf("%ld", tcp->u_arg[3]);
@@ -1233,8 +1227,7 @@ struct tcb *tcp;
                                        tprintf("addr=");
                                        printsock(tcp, (int) args.addr);
                                        tprintf(", flags=");
-                                       if (!printflags(nfs_flags, args.flags))
-                                               tprintf("NFSMNT_???");
+                                       printflags(nfs_flags, args.flags, "NFSMNT_???");
                                        tprintf(", hostname=");
                                        printstr(tcp, (int) args.hostname, -1);
                                        tprintf(", ...}");
@@ -1329,7 +1322,7 @@ struct tcb *tcp;
                tprintf(", ");
                printpath(tcp, tcp->u_arg[1]);
                tprintf(", ");
-               printflags(mount_flags, tcp->u_arg[2]);
+               printflags(mount_flags, tcp->u_arg[2], "MS_???");
                /* The doc sez that the file system type is given as a
                   fsindex, and we should use sysfs to work out the name.
                   This appears to be untrue for UW.  Maybe it's untrue
@@ -1353,8 +1346,7 @@ struct tcb *tcp;
                                        tprintf("%#lx", tcp->u_arg[4]);
                                else {
                                        tprintf("{ flags=");
-                                       if (!printflags(vxfs_flags, args.mflags))
-                                               tprintf("0x%08x", args.mflags);
+                                       printflags(vxfs_flags, args.mflags, "VX_MS_???");
                                        if (args.mflags & VX_MS_SNAPSHOT) {
                                                tprintf (", snapof=");
                                                printstr (tcp,
@@ -1387,8 +1379,7 @@ struct tcb *tcp;
                                                printsock(tcp, (int) addr.buf, addr.len);
                                        }
                                        tprintf(", flags=");
-                                       if (!printflags(nfs_flags, args.flags))
-                                               tprintf("NFSMNT_???");
+                                       printflags(nfs_flags, args.flags, "NFSMNT_???");
                                        tprintf(", hostname=");
                                        printstr(tcp, (int) args.hostname, -1);
                                        tprintf(", ...}");
@@ -1497,11 +1488,11 @@ struct tcb *tcp;
                        tprintf("???");
                else {
                        tprintf("{");
-                       printflags(capabilities, arg1->effective);
+                       printflags(capabilities, arg1->effective, "CAP_???");
                        tprintf(", ");
-                       printflags(capabilities, arg1->permitted);
+                       printflags(capabilities, arg1->permitted, "CAP_???");
                        tprintf(", ");
-                       printflags(capabilities, arg1->inheritable);
+                       printflags(capabilities, arg1->inheritable, "CAP_???");
                        tprintf("}");
                }
        }
@@ -1549,11 +1540,11 @@ struct tcb *tcp;
                        tprintf("???");
                else {
                        tprintf("{");
-                       printflags(capabilities, arg1->effective);
+                       printflags(capabilities, arg1->effective, "CAP_???");
                        tprintf(", ");
-                       printflags(capabilities, arg1->permitted);
+                       printflags(capabilities, arg1->permitted, "CAP_???");
                        tprintf(", ");
-                       printflags(capabilities, arg1->inheritable);
+                       printflags(capabilities, arg1->inheritable, "CAP_???");
                        tprintf("}");
                }
        }
diff --git a/term.c b/term.c
index e4bf2f8be31409519b885d7c9be0f927437dd4a0..15897bd848f7f1488c777214a8d0e651e401f013 100644 (file)
--- a/term.c
+++ b/term.c
@@ -340,8 +340,7 @@ long code, arg;
                if (umove(tcp, arg, &arg) < 0)
                        return 0;
                tprintf(", [");
-               if (!printflags(modem_flags, arg))
-                       tprintf("0");
+               printflags(modem_flags, arg, "TIOCM_???");
                tprintf("]");
                return 1;
 #endif /* TIOCMGET */
diff --git a/time.c b/time.c
index 5176f53645e7a26be7d484bae6c3f48e19bb5cf1..b27a71ef3f593ecafbb0dfbcd2beb37c5e29a178 100644 (file)
--- a/time.c
+++ b/time.c
@@ -411,8 +411,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
                tprintf(", ");
-               if (printflags(clockflags, tcp->u_arg[1]) == 0)
-                       tprintf("0");
+               printflags(clockflags, tcp->u_arg[1], "TIMER_???");
                tprintf(", ");
                printtv(tcp, tcp->u_arg[2]);
                tprintf(", ");
@@ -493,8 +492,7 @@ struct tcb *tcp;
 {
        if (entering(tcp)) {
                tprintf("%#lx, ", tcp->u_arg[0]);
-               if (printflags(clockflags, tcp->u_arg[1]) == 0)
-                       tprintf("0");
+               printflags(clockflags, tcp->u_arg[1], "TIMER_???");
                tprintf(", ");
                printitv(tcp, tcp->u_arg[2]);
                tprintf(", ");
diff --git a/util.c b/util.c
index f54f6fce2bc9b38544b0dc0ba1b44f974cab41da..d92c0ea83821749f0f4af177121a26a7e36d2dc3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -247,7 +247,7 @@ void
 printxval(xlat, val, dflt)
 const struct xlat *xlat;
 int val;
-char *dflt;
+const char *dflt;
 {
        char *str = xlookup(xlat, val);
 
@@ -284,9 +284,10 @@ int flags;
 }
 
 int
-printflags(xlat, flags)
+printflags(xlat, flags, dflt)
 const struct xlat *xlat;
 int flags;
+const char *dflt;
 {
        int n;
        char *sep;
@@ -305,10 +306,23 @@ int flags;
                        n++;
                }
        }
-       if (flags) {
-               tprintf("%s%#x", sep, flags);
-               n++;
+
+       if (n) {
+               if (flags) {
+                       tprintf("%s%#x", sep, flags);
+                       n++;
+               }
+       } else {
+               if (flags) {
+                       tprintf("%#x", flags);
+                       if (dflt)
+                               tprintf(" /* %s */", dflt);
+               } else {
+                       if (dflt)
+                               tprintf("0");
+               }
        }
+
        return n;
 }