]> granicus.if.org Git - strace/commitdiff
Introduce printflags64 function
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 28 Apr 2016 18:55:18 +0000 (18:55 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 28 Apr 2016 19:05:13 +0000 (19:05 +0000)
This is necessary for the upcoming change of xlat.val type.

* defs.h (printflags): Rename to printflags64, change type of integer
argument to uint64_t.
(printflags): New static inline function.
* util.c (printflags): Rename to printflags64, change type of integer
argument to uint64_t.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.

defs.h
util.c

diff --git a/defs.h b/defs.h
index 33de96f440d0c4e32bd4d6b5487c7efe73338648..eec0228bb50020ec1a229ba8e676e3d8c2d9aa03 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -556,7 +556,7 @@ extern int printargs_u(struct tcb *);
 extern int printargs_d(struct tcb *);
 
 extern void addflags(const struct xlat *, uint64_t);
-extern int printflags(const struct xlat *, int, const char *);
+extern int printflags64(const struct xlat *, uint64_t, const char *);
 extern const char *sprintflags64(const char *, const struct xlat *, uint64_t);
 extern const char *sprintmode(int);
 extern const char *sprinttime(time_t);
@@ -672,6 +672,12 @@ sprintflags(const char *prefix, const struct xlat *x, unsigned int flags)
        return sprintflags64(prefix, x, flags);
 }
 
+static inline int
+printflags(const struct xlat *x, unsigned int flags, const char *dflt)
+{
+       return printflags64(x, flags, dflt);
+}
+
 static inline void
 printxval64(const struct xlat *x, const uint64_t val, const char *dflt)
 {
diff --git a/util.c b/util.c
index 671f475c5e1d1cfa925869c58cb5341d93e9457e..a9bce9986c0fe81ca3a8c51cbf3b975e4d4ff8f6 100644 (file)
--- a/util.c
+++ b/util.c
@@ -356,7 +356,7 @@ sprintflags64(const char *prefix, const struct xlat *xlat, uint64_t flags)
 }
 
 int
-printflags(const struct xlat *xlat, int flags, const char *dflt)
+printflags64(const struct xlat *xlat, uint64_t flags, const char *dflt)
 {
        int n;
        const char *sep;
@@ -378,12 +378,12 @@ printflags(const struct xlat *xlat, int flags, const char *dflt)
 
        if (n) {
                if (flags) {
-                       tprintf("%s%#x", sep, flags);
+                       tprintf("%s%#" PRIx64, sep, flags);
                        n++;
                }
        } else {
                if (flags) {
-                       tprintf("%#x", flags);
+                       tprintf("%#" PRIx64, flags);
                        if (dflt)
                                tprintf(" /* %s */", dflt);
                } else {