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 <jeffm@suse.com>.
diff --git a/defs.h b/defs.h
index d7613f1..33de96f 100644
--- a/defs.h
+++ b/defs.h
@@ -557,7 +557,7 @@
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_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 e89400a..671f475 100644
--- a/util.c
+++ b/util.c
@@ -322,7 +322,7 @@
* 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 @@
if (flags) {
if (found)
*outptr++ = '|';
- outptr += sprintf(outptr, "%#x", flags);
+ outptr += sprintf(outptr, "%#" PRIx64, flags);
}
return outstr;