[CRIU] [PATCH 17/18] skqueue: Use sendmsg() to send data
Pavel Emelyanov
xemul at virtuozzo.com
Mon Jul 10 12:41:47 MSK 2017
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/sk-queue.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/criu/sk-queue.c b/criu/sk-queue.c
index 057c0bf..77e203e 100644
--- a/criu/sk-queue.c
+++ b/criu/sk-queue.c
@@ -201,6 +201,13 @@ static int send_one_pkt(int fd, struct sk_packet *pkt)
{
int ret;
SkPacketEntry *entry = pkt->entry;
+ struct msghdr mh = {};
+ struct iovec iov;
+
+ mh.msg_iov = &iov;
+ mh.msg_iovlen = 1;
+ iov.iov_base = pkt->data;
+ iov.iov_len = entry->length;
/*
* Don't try to use sendfile here, because it use sendpage() and
@@ -210,7 +217,7 @@ static int send_one_pkt(int fd, struct sk_packet *pkt)
* boundaries messages should be saved.
*/
- ret = write(fd, pkt->data, entry->length);
+ ret = sendmsg(fd, &mh, 0);
xfree(pkt->data);
if (ret < 0) {
pr_perror("Failed to send packet");
--
2.1.4
More information about the CRIU
mailing list