From 6442b57a855e273aa5a3d93e8596783cea128073 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 15 Sep 2017 09:39:40 -0700
Subject: [PATCH] src: Add missing header limits.h for _POSIX_HOST_NAME_MAX

Use _GNU_SOURCE instead of libc internal __USE_GNU
Do not use the deprecated headers under include/sys

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/base/os_defs.h        | 5 +++--
 src/mds/mds_dt_tcp.c      | 1 -
 src/mds/mds_dt_tcp_disc.h | 2 +-
 src/mds/mds_dt_tipc.c     | 1 -
 src/mds/mds_dt_tipc.h     | 2 +-
 src/mds/mds_dt_trans.c    | 1 -
 src/ntf/ntfd/NtfLogger.cc | 2 +-
 7 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/base/os_defs.h b/src/base/os_defs.h
index 50a9bf5fc..af6842863 100644
--- a/src/base/os_defs.h
+++ b/src/base/os_defs.h
@@ -47,17 +47,18 @@
 #include <sys/stat.h>
 #include <sys/msg.h> /* Added for message-queues : PM : 28/10/03 */
 #include <syslog.h>
-#ifndef __USE_GNU
+#include <limits.h>
+#ifndef _GNU_SOURCE
 struct msgbuf {
   long int mtype;
   char mtext[1];
 };
 #endif /* else defined in <sys/msg.h> */
 #include <sys/time.h>
-#include <sys/fcntl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
+#include <fcntl.h>
 #include <signal.h>
 #include <pthread.h>
 
diff --git a/src/mds/mds_dt_tcp.c b/src/mds/mds_dt_tcp.c
index 1407eb1ab..a87c22faa 100644
--- a/src/mds/mds_dt_tcp.c
+++ b/src/mds/mds_dt_tcp.c
@@ -27,7 +27,6 @@
 
 #include <stdlib.h>
 #include <sched.h>
-#include <sys/poll.h>
 #include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/src/mds/mds_dt_tcp_disc.h b/src/mds/mds_dt_tcp_disc.h
index a6249d73e..574f52681 100644
--- a/src/mds/mds_dt_tcp_disc.h
+++ b/src/mds/mds_dt_tcp_disc.h
@@ -24,7 +24,7 @@
 #include "base/ncssysf_tsk.h"
 #include "base/ncssysf_mem.h"
 #include "mds_dt_tcp_disc.h"
-#include "sys/poll.h"
+#include <poll.h>
 
 /*  mds_indentifire + mds_version   + msg_type + scope_type + server_type +
    server_instance_lower + server_instance_upper + sub_ref_val + sub_ref_val  +
diff --git a/src/mds/mds_dt_tipc.c b/src/mds/mds_dt_tipc.c
index 37745e7f0..9b3255567 100644
--- a/src/mds/mds_dt_tipc.c
+++ b/src/mds/mds_dt_tipc.c
@@ -35,7 +35,6 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <sched.h>
-#include <sys/poll.h>
 #include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/src/mds/mds_dt_tipc.h b/src/mds/mds_dt_tipc.h
index e73a11b09..401d208c2 100644
--- a/src/mds/mds_dt_tipc.h
+++ b/src/mds/mds_dt_tipc.h
@@ -32,7 +32,7 @@
 #include <assert.h>
 #include <string.h>
 #include <sys/param.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <netdb.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/mds/mds_dt_trans.c b/src/mds/mds_dt_trans.c
index 6f621e04e..5aacbd33e 100644
--- a/src/mds/mds_dt_trans.c
+++ b/src/mds/mds_dt_trans.c
@@ -26,7 +26,6 @@
 #include "mds_core.h"
 #include "base/osaf_utility.h"
 
-#include <sys/poll.h>
 #include <poll.h>
 
 #define MDS_PROT_TCP 0xA0
diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
index 84014b578..31b1ccc6c 100644
--- a/src/ntf/ntfd/NtfLogger.cc
+++ b/src/ntf/ntfd/NtfLogger.cc
@@ -20,7 +20,7 @@
  *   INCLUDE FILES
  * ========================================================================
  */
-#include <sys/poll.h>
+#include <poll.h>
 
 #include "base/osaf_utility.h"
 #include <saAis.h>
-- 
2.14.1

