#include <linux/sock_diag.h>
#include "static_assert.h"
+#include "xlat/netlink_sk_meminfo_indices.h"
+
static bool
fetch_nlattr(struct tcb *const tcp, struct nlattr *const nlattr,
const kernel_ulong_t addr, const unsigned int len,
return false;
unsigned int count = 0;
- print_array(tcp, addr, nmemb, &mem, sizeof(mem),
- tfetch_mem, print_uint32_array_member, &count);
+ print_array_ex(tcp, addr, nmemb, &mem, sizeof(mem),
+ tfetch_mem, print_uint32_array_member, &count,
+ PAF_PRINT_INDICES | PAF_INDEX_XLAT_VALUE_INDEXED
+ | XLAT_STYLE_FMT_U,
+ ARRSZ_PAIR(netlink_sk_meminfo_indices),
+ "SK_MEMINFO_???");
return true;
}
#include <linux/inet_diag.h>
#include <linux/sock_diag.h>
+static const char * const sk_meminfo_strs[] = {
+ "SK_MEMINFO_RMEM_ALLOC",
+ "SK_MEMINFO_RCVBUF",
+ "SK_MEMINFO_WMEM_ALLOC",
+ "SK_MEMINFO_SNDBUF",
+ "SK_MEMINFO_FWD_ALLOC",
+ "SK_MEMINFO_WMEM_QUEUED",
+ "SK_MEMINFO_OPTMEM",
+ "SK_MEMINFO_BACKLOG",
+ "SK_MEMINFO_DROPS",
+};
+
static const char address[] = "10.11.12.13";
static void
static void
print_uint(const unsigned int *p, size_t i)
{
- printf("%u", *p);
+ if (i >= ARRAY_SIZE(sk_meminfo_strs))
+ printf("[%zu /* SK_MEMINFO_??? */", i);
+ else
+ printf("[%s", sk_meminfo_strs[i]);
+
+ printf("] = %u", *p);
}
int