Commit e52341f5 authored by Pavel Emelyanov's avatar Pavel Emelyanov

skqueue: Use sendmsg() to send data

Reviewed-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent ff91d4f7
...@@ -201,6 +201,13 @@ static int send_one_pkt(int fd, struct sk_packet *pkt) ...@@ -201,6 +201,13 @@ static int send_one_pkt(int fd, struct sk_packet *pkt)
{ {
int ret; int ret;
SkPacketEntry *entry = pkt->entry; 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 * 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) ...@@ -210,7 +217,7 @@ static int send_one_pkt(int fd, struct sk_packet *pkt)
* boundaries messages should be saved. * boundaries messages should be saved.
*/ */
ret = write(fd, pkt->data, entry->length); ret = sendmsg(fd, &mh, 0);
xfree(pkt->data); xfree(pkt->data);
if (ret < 0) { if (ret < 0) {
pr_perror("Failed to send packet"); pr_perror("Failed to send packet");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment