]> granicus.if.org Git - strace/commitdiff
print_fields.h: add PRINT_FIELD_U64 for printing u64 with UINT64_MAX handling
authorEugene Syromyatnikov <evgsyr@gmail.com>
Tue, 13 Mar 2018 22:46:14 +0000 (23:46 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 12 Apr 2018 23:00:28 +0000 (23:00 +0000)
* print_fields.h (PRINT_FIELD_U64): New macro.

print_fields.h

index 0b810d5c3dbf5778a684c62dfbac4bd91a9e9baf..99c0cc134611a4921b7d54e793fb8c398bba54b0 100644 (file)
 
 #define PRINT_FIELD_UID PRINT_FIELD_ID
 
+#define PRINT_FIELD_U64(prefix_, where_, field_)                                       \
+       do {                                                                            \
+               STRACE_PRINTF("%s%s=", (prefix_), #field_);                             \
+               if (zero_extend_signed_to_ull((where_).field_) == UINT64_MAX)           \
+                       print_xlat_ex(UINT64_MAX, "UINT64_MAX", XLAT_STYLE_FMT_U);      \
+               else                                                                    \
+                       STRACE_PRINTF("%llu",                                           \
+                                     zero_extend_signed_to_ull((where_).field_));      \
+       } while (0)
+
 #define PRINT_FIELD_STRING(prefix_, where_, field_, len_, style_)      \
        do {                                                            \
                STRACE_PRINTF("%s%s=", (prefix_), #field_);             \