diff options
author | Damjan Marion <damarion@cisco.com> | 2018-09-03 12:30:36 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-09-03 16:51:40 +0000 |
commit | 4dffd1c9988020619caff9b8d3b350e7f79e0398 (patch) | |
tree | 58d6b48f3925e815b68dfe04d3946c80ad1c24a1 /src/vppinfra/socket.c | |
parent | ea5b5be4eeb0f4cd80cb466bd6e31cad33c57960 (diff) |
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>
Diffstat (limited to 'src/vppinfra/socket.c')
-rw-r--r-- | src/vppinfra/socket.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c index 87a9333f904..29b2a945cb9 100644 --- a/src/vppinfra/socket.c +++ b/src/vppinfra/socket.c @@ -309,12 +309,16 @@ static clib_error_t * 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 @@ default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen, { if (cmsg->cmsg_level == SOL_SOCKET) { +#ifdef __linux__ if (cmsg->cmsg_type == SCM_CREDENTIALS) { cr = (struct ucred *) CMSG_DATA (cmsg); @@ -347,7 +352,9 @@ default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen, 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_socket_init (clib_socket_t * s) 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 @@ clib_socket_init (clib_socket_t * s) goto done; } } +#endif if (need_bind && bind (s->fd, &addr.sa, addr_len) < 0) { |