Sockets: declare msghdr->msg_iovlen as msg_iovlen_t

* Lwip declares msghdr->msg_iovlen as int, but when
  using external socket headers, some systems declare
  msg_iovlen as size_t or others.
* This patch creates a new type msg_iovlen_t and
  expects users to typedef it to the type they need
  for their system.
This commit is contained in:
Joan Lledó 2019-08-10 11:15:37 +02:00 committed by Simon Goldschmidt
parent c4f33be3f3
commit f92d6702bc
3 changed files with 7 additions and 5 deletions

View File

@ -1129,7 +1129,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
u8_t apiflags;
err_t err;
u16_t buflen, copylen, copied;
int i;
msg_iovlen_t i;
LWIP_UNUSED_ARG(dbg_s);
LWIP_ERROR("lwip_recvfrom_udp_raw: invalid arguments", (msg->msg_iov != NULL) || (msg->msg_iovlen <= 0), return ERR_ARG;);
@ -1319,7 +1319,7 @@ ssize_t
lwip_recvmsg(int s, struct msghdr *message, int flags)
{
struct lwip_sock *sock;
int i;
msg_iovlen_t i;
ssize_t buflen;
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvmsg(%d, message=%p, flags=0x%x)\n", s, (void *)message, flags));
@ -1506,7 +1506,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
#if LWIP_UDP || LWIP_RAW
{
struct netbuf chain_buf;
int i;
msg_iovlen_t i;
ssize_t size = 0;
LWIP_UNUSED_ARG(flags);

View File

@ -131,11 +131,13 @@ struct iovec {
};
#endif
typedef int msg_iovlen_t;
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
int msg_iovlen;
msg_iovlen_t msg_iovlen;
void *msg_control;
socklen_t msg_controllen;
int msg_flags;

View File

@ -250,7 +250,7 @@ static void test_sockets_init_loopback_addr(int domain, struct sockaddr_storage
static void test_sockets_msgapi_update_iovs(struct msghdr *msg, size_t bytes)
{
int i;
msg_iovlen_t i;
/* note: this modifies the underyling iov_base and iov_len for a partial
read for an individual vector. This updates the msg->msg_iov pointer