]> granicus.if.org Git - strace/commitdiff
Introduce sprintflags64 function
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 28 Apr 2016 18:49:36 +0000 (18:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 28 Apr 2016 19:04:38 +0000 (19:04 +0000)
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>.

defs.h
util.c

diff --git a/defs.h b/defs.h
index d7613f1e5dcb7bd855b2e9c0eb7f9f0586d42f96..33de96f440d0c4e32bd4d6b5487c7efe73338648 100644 (file)
--- 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 e89400a79882653e5fc8f8acc1a7389e3a0efa72..671f475c5e1d1cfa925869c58cb5341d93e9457e 100644 (file)
--- 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;