Compile vppinfra on macOS

Add missing calls to clib_mem_init to vppinfra test codes.

Change-Id: I53ffc6fc287d1a378065bb86c18b6e995ecdb775
Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index 87a9333..29b2a94 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -309,12 +309,16 @@
 default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen,
 			int fds[], int num_fds)
 {
+#ifdef __linux__
   char ctl[CMSG_SPACE (sizeof (int) * num_fds) +
 	   CMSG_SPACE (sizeof (struct ucred))];
+  struct ucred *cr = 0;
+#else
+  char ctl[CMSG_SPACE (sizeof (int) * num_fds)];
+#endif
   struct msghdr mh = { 0 };
   struct iovec iov[1];
   ssize_t size;
-  struct ucred *cr = 0;
   struct cmsghdr *cmsg;
 
   iov[0].iov_base = msg;
@@ -340,6 +344,7 @@
     {
       if (cmsg->cmsg_level == SOL_SOCKET)
 	{
+#ifdef __linux__
 	  if (cmsg->cmsg_type == SCM_CREDENTIALS)
 	    {
 	      cr = (struct ucred *) CMSG_DATA (cmsg);
@@ -347,7 +352,9 @@
 	      s->gid = cr->gid;
 	      s->pid = cr->pid;
 	    }
-	  else if (cmsg->cmsg_type == SCM_RIGHTS)
+	  else
+#endif
+	  if (cmsg->cmsg_type == SCM_RIGHTS)
 	    {
 	      clib_memcpy (fds, CMSG_DATA (cmsg), num_fds * sizeof (int));
 	    }
@@ -436,6 +443,7 @@
 	  clib_unix_warning ("setsockopt SO_REUSEADDR fails");
       }
 
+#if __linux__
       if (addr.sa.sa_family == PF_LOCAL && s->flags & CLIB_SOCKET_F_PASSCRED)
 	{
 	  int x = 1;
@@ -447,6 +455,7 @@
 	      goto done;
 	    }
 	}
+#endif
 
       if (need_bind && bind (s->fd, &addr.sa, addr_len) < 0)
 	{