From: Dmitry V. Levin Date: Thu, 28 Apr 2016 18:55:18 +0000 (+0000) Subject: Introduce printflags64 function X-Git-Tag: v4.12~245 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00beed61a43e042a37bcfbda71ed21d1e4918716;p=strace Introduce printflags64 function 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 . --- diff --git a/defs.h b/defs.h index 33de96f4..eec0228b 100644 --- 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 671f475c..a9bce998 100644 --- 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 {