Add writev function

This commit adds compatibility with POSIX writev according to the Open
Group specification:
http://pubs.opengroup.org/onlinepubs/009695399/functions/writev.html

Implementation maps to sendmsg in the same manner that write() maps to
send()
This commit is contained in:
Joel Cunningham
2015-09-22 08:36:27 -05:00
parent db76671d4d
commit cc4d09423a
2 changed files with 18 additions and 0 deletions

View File

@@ -1271,6 +1271,21 @@ lwip_write(int s, const void *data, size_t size)
return lwip_send(s, data, size, 0);
}
int
lwip_writev(int s, const struct iovec *iov, int iovcnt)
{
struct msghdr msg;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = (struct iovec *)iov;
msg.msg_iovlen = iovcnt;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;
return lwip_sendmsg(s, &msg, 0);
}
/**
* Go through the readset and writeset lists and see which socket of the sockets
* set in the sets has events. On return, readset, writeset and exceptset have