예제 #1
0
int fix_message_send(struct fix_message *self, int sockfd, int flags)
{
	struct iovec iov[2];
	int ret = 0;

	fix_message_unparse(self);

	buffer_to_iovec(self->head_buf, &iov[0]);
	buffer_to_iovec(self->body_buf, &iov[1]);

	if (xwritev(sockfd, iov, ARRAY_SIZE(iov)) < 0) {
		ret = -1;
		goto error_out;
	}

error_out:
	self->head_buf = self->body_buf = NULL;

	return ret;
}
예제 #2
0
ssize_t writev_in_full(int fd, const struct iovec *iov, int iovcnt)
{
	ssize_t total = 0;
	size_t count = get_iov_size(iov, iovcnt);

	while (count > 0) {
		ssize_t nr;

		nr = xwritev(fd, iov, iovcnt);
		if (nr < 0)
			return -1;
		if (nr == 0) {
			errno = ENOSPC;
			return -1;
		}

		shift_iovec(&iov, &iovcnt, nr, &total, &count, NULL);
	}

	return total;
}
예제 #3
0
static ssize_t xwritev0(int fd, const struct msghdr *msg, int flags)
{
	return xwritev(fd, msg->msg_iov, msg->msg_iovlen);
}