From: Dmitry V. Levin Date: Thu, 28 Apr 2016 18:49:36 +0000 (+0000) Subject: Introduce sprintflags64 function X-Git-Tag: v4.12~246 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01c910ccc32ebc2c92fff68867f11e74102bf8e2;p=strace Introduce sprintflags64 function This is necessary for the upcoming change of xlat.val type. * defs.h (sprintflags): Rename to sprintflags64, change type of integer argument to uint64_t. (sprintflags): New static inline function. * util.c (sprintflags): Rename to sprintflags64, 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 d7613f1e..33de96f4 100644 --- a/defs.h +++ b/defs.h @@ -557,7 +557,7 @@ extern int printargs_d(struct tcb *); extern void addflags(const struct xlat *, uint64_t); extern int printflags(const struct xlat *, int, const char *); -extern const char *sprintflags(const char *, const struct xlat *, int); +extern const char *sprintflags64(const char *, const struct xlat *, uint64_t); extern const char *sprintmode(int); extern const char *sprinttime(time_t); extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long); @@ -666,6 +666,12 @@ extern void unwind_print_stacktrace(struct tcb* tcp); extern void unwind_capture_stacktrace(struct tcb* tcp); #endif +static inline const char * +sprintflags(const char *prefix, const struct xlat *x, unsigned int flags) +{ + return sprintflags64(prefix, x, flags); +} + static inline void printxval64(const struct xlat *x, const uint64_t val, const char *dflt) { diff --git a/util.c b/util.c index e89400a7..671f475c 100644 --- a/util.c +++ b/util.c @@ -322,7 +322,7 @@ addflags(const struct xlat *xlat, uint64_t flags) * Return static string. */ const char * -sprintflags(const char *prefix, const struct xlat *xlat, int flags) +sprintflags64(const char *prefix, const struct xlat *xlat, uint64_t flags) { static char outstr[1024]; char *outptr; @@ -349,7 +349,7 @@ sprintflags(const char *prefix, const struct xlat *xlat, int flags) if (flags) { if (found) *outptr++ = '|'; - outptr += sprintf(outptr, "%#x", flags); + outptr += sprintf(outptr, "%#" PRIx64, flags); } return outstr;