Esempio n. 1
0
File: net.c Progetto: yunchih/strace
static void
decode_sockbuf(struct tcb *tcp, int fd, long addr, long addrlen)
{

	switch (verbose(tcp) ? getfdproto(tcp, fd) : SOCK_PROTO_UNKNOWN) {
	case SOCK_PROTO_NETLINK:
		decode_netlink(tcp, addr, addrlen);
		break;
	default:
		printstr(tcp, addr, addrlen);
	}
}
Esempio n. 2
0
static bool
print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
	const kernel_ulong_t *iov;
	kernel_ulong_t 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;
			if (c->data_size != (kernel_ulong_t) -1)
				c->data_size -= len;
			printstrn(tcp, iov[0], len);
			break;
		case IOV_DECODE_NETLINK:
			if (len > c->data_size)
				len = c->data_size;
			if (c->data_size != (kernel_ulong_t) -1)
				c->data_size -= len;
			/* assume that the descriptor is 1st syscall argument */
			decode_netlink(tcp, tcp->u_arg[0], iov[0], len);
			break;
		default:
			printaddr(iov[0]);
			break;
	}

	tprintf(", iov_len=%" PRI_klu "}", iov[1]);

	return true;
}