MEDIUM: log: replace sendto() with sendmsg() in __send_log()

This patch replaces sendto() with sendmsg() in __send_log() and makes use
of an iovec to send the log message.
diff --git a/include/types/log.h b/include/types/log.h
index d0fb966..f6f6e99 100644
--- a/include/types/log.h
+++ b/include/types/log.h
@@ -30,6 +30,7 @@
 
 #define NB_LOG_FACILITIES       24
 #define NB_LOG_LEVELS           8
+#define NB_MSG_IOVEC_ELEMENTS   1
 #define SYSLOG_PORT             514
 #define UNIQUEID_LEN            128
 
diff --git a/src/log.c b/src/log.c
index ef7005a..8a7e5f4 100644
--- a/src/log.c
+++ b/src/log.c
@@ -807,6 +807,11 @@
  */
 void __send_log(struct proxy *p, int level, char *message, size_t size)
 {
+	static struct iovec iovec[NB_MSG_IOVEC_ELEMENTS] = { };
+	static struct msghdr msghdr = {
+		.msg_iov = iovec,
+		.msg_iovlen = NB_MSG_IOVEC_ELEMENTS
+	};
 	static int logfdunix = -1;	/* syslog to AF_UNIX socket */
 	static int logfdinet = -1;	/* syslog to AF_INET socket */
 	static char *dataptr = NULL;
@@ -889,14 +894,18 @@
 		backup = log_ptr[max - 1];
 		log_ptr[max - 1] = '\n';
 
-		sent = sendto(*plogfd, log_ptr, max,
-			      MSG_DONTWAIT | MSG_NOSIGNAL,
-			      (struct sockaddr *)&logsrv->addr, get_addr_len(&logsrv->addr));
+		iovec[0].iov_base = log_ptr;
+		iovec[0].iov_len = max;
+
+		msghdr.msg_name = (struct sockaddr *)&logsrv->addr;
+		msghdr.msg_namelen = get_addr_len(&logsrv->addr);
+
+		sent = sendmsg(*plogfd, &msghdr, MSG_DONTWAIT | MSG_NOSIGNAL);
 
 		log_ptr[max - 1] = backup;
 
 		if (sent < 0) {
-			Alert("sendto logger #%d failed: %s (errno=%d)\n",
+			Alert("sendmsg logger #%d failed: %s (errno=%d)\n",
 				nblogger, strerror(errno), errno);
 		}
 	}
diff --git a/tests/test-log.cfg b/tests/test-log.cfg
index a8d971c..ce91603 100644
--- a/tests/test-log.cfg
+++ b/tests/test-log.cfg
@@ -1,7 +1,7 @@
 # This is a test configuration.
 # Its purpose is simply to emit logs on the loopback in order to verify
 # that the time is correct. To be used with tcpdump on lo, or with
-# "strace -s100 -esendto".
+# "strace -s100 -esendmsg".
 
 global
 	log 127.0.0.1:514 local0