[lttng-dev] [PATCH lttng-tools 10/24] Add : Compatibility layer for netinet/in.h

Charles Briere c.briere at samsung.com
Mon Oct 27 16:49:29 EDT 2014


From: Charles Briere <c.briere at samsung.com>

Add definition for in_port_t

Signed-off-by: Charles Briere <c.briere at samsung.com>
---
 configure.ac                   |  2 ++
 src/common/compat/Makefile.am  |  3 ++-
 src/common/compat/netinet/in.h | 35 +++++++++++++++++++++++++++++++++++
 src/common/uri.h               |  2 +-
 4 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 src/common/compat/netinet/in.h

diff --git a/configure.ac b/configure.ac
index 1189d8e..3b880c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,8 @@ AC_CHECK_HEADERS([ \
 	[AC_CHECK_HEADERS([sys/syscall.h])]
 )
 
+AC_CHECK_TYPES([in_port_t], [], [], [[#include <netinet/in.h>]])
+
 # Babeltrace viewer check
 AC_ARG_WITH([babeltrace-bin],
 	AS_HELP_STRING([--with-babeltrace-bin],
diff --git a/src/common/compat/Makefile.am b/src/common/compat/Makefile.am
index 537375b..40495ed 100644
--- a/src/common/compat/Makefile.am
+++ b/src/common/compat/Makefile.am
@@ -9,4 +9,5 @@ COMPAT=compat-poll.c
 endif
 
 libcompat_la_SOURCES = poll.h fcntl.h endian.h mman.h clone.h \
-                       socket.h compat-fcntl.c uuid.h tid.h $(COMPAT)
+                       socket.h compat-fcntl.c uuid.h tid.h netinet/in.h \
+		       $(COMPAT)
diff --git a/src/common/compat/netinet/in.h b/src/common/compat/netinet/in.h
new file mode 100644
index 0000000..96981e2
--- /dev/null
+++ b/src/common/compat/netinet/in.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014 (c) - Charles Briere <c.briere at samsung.com>
+ *
+ * syscall compatibility layer.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef LTTNG_NETINET_IN_H
+#define LTTNG_NETINET_IN_H
+
+#include <netinet/in.h>
+#include <config.h>
+
+# ifndef HAVE_IN_PORT_T
+typedef uint16_t in_port_t;
+# endif
+
+#endif
diff --git a/src/common/uri.h b/src/common/uri.h
index 3ef6669..7f2f5b6 100644
--- a/src/common/uri.h
+++ b/src/common/uri.h
@@ -18,7 +18,7 @@
 #ifndef URI_H
 #define URI_H
 
-#include <netinet/in.h>
+#include <common/compat/netinet/in.h>
 #include <lttng/lttng.h>
 
 /* Destination type of lttng URI */
-- 
2.1.2



More information about the lttng-dev mailing list