vppinfra: Protect Linux specific features behind CLIB_LINUX
Place Linux specific features behind CLIB_LINUX. The previous #ifdef
calls would still pass even if CLIB_LINUX is set to 0 in clib.h, instead
use #if.
Type: improvement
Change-Id: Ibe4424eee4bc0065f54764b017b9a56a3e854380
Signed-off-by: Tom Jones <thj@freebsd.org>
diff --git a/src/vppinfra/socket.c b/src/vppinfra/socket.c
index dd447ab..2abf2b2 100644
--- a/src/vppinfra/socket.c
+++ b/src/vppinfra/socket.c
@@ -226,7 +226,7 @@
default_socket_recvmsg (clib_socket_t * s, void *msg, int msglen,
int fds[], int num_fds)
{
-#ifdef CLIB_LINUX
+#if CLIB_LINUX
char ctl[CMSG_SPACE (sizeof (int) * num_fds) +
CMSG_SPACE (sizeof (struct ucred))];
struct ucred *cr = 0;
@@ -261,7 +261,7 @@
{
if (cmsg->cmsg_level == SOL_SOCKET)
{
-#ifdef CLIB_LINUX
+#if CLIB_LINUX
if (cmsg->cmsg_type == SCM_CREDENTIALS)
{
cr = (struct ucred *) CMSG_DATA (cmsg);
@@ -314,11 +314,13 @@
.family = AF_INET,
.type = CLIB_SOCKET_TYPE_INET,
.skip_prefix = 1 },
+#if CLIB_LINUX
{ .prefix = "abstract:",
.family = AF_UNIX,
.type = CLIB_SOCKET_TYPE_LINUX_ABSTRACT,
.skip_prefix = 1,
.is_local = 1 },
+#endif /* CLIB_LINUX */
{ .prefix = "/",
.family = AF_UNIX,
.type = CLIB_SOCKET_TYPE_UNIX,