+struct print_iovec_config {
+ enum iov_decode decode_iov;
+ unsigned long data_size;
+};
+
+static bool
+print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
+{
+ const unsigned long *iov;
+ unsigned long iov_buf[2], len;
+ struct print_iovec_config *c = data;
+
+ if (elem_size < sizeof(iov_buf)) {
+ iov_buf[0] = ((unsigned int *) elem_buf)[0];
+ iov_buf[1] = ((unsigned int *) elem_buf)[1];
+ iov = iov_buf;
+ } else {
+ iov = elem_buf;
+ }
+
+ tprints("{iov_base=");
+
+ len = iov[1];
+
+ switch (c->decode_iov) {
+ case IOV_DECODE_STR:
+ if (len > c->data_size)
+ len = c->data_size;
+ c->data_size -= len;
+ printstr(tcp, iov[0], len);
+ break;
+ case IOV_DECODE_NETLINK:
+ if (len > c->data_size)
+ len = c->data_size;
+ c->data_size -= len;
+ decode_netlink(tcp, iov[0], iov[1]);
+ break;
+ default:
+ printaddr(iov[0]);
+ break;
+ }
+
+ tprintf(", iov_len=%lu}", iov[1]);
+
+ return true;
+}
+